Merged revisions 854399 via svnmerge from

svn+ssh://tmcguire@svn.kde.org/home/kde/branches/kdepim/enterprise4/kdepim

................
  r854399 | vkrause | 2008-08-29 15:04:19 +0200 (Fri, 29 Aug 2008) | 13 lines
  
  Merged revisions 850513 via svnmerge from 
  https://vkrause@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim
  
  ........
    r850513 | vkrause | 2008-08-21 19:11:57 +0200 (Thu, 21 Aug 2008) | 6 lines
    
    Allow deletion of message only if the IMAP ACLs allow it. The current
    code assumed that deletion was not possible iff a folder is read-only,
    which is too simple for IMAP.
    
    Kolab issue 2954
  ........
................

svn path=/trunk/KDE/kdepim/; revision=855221
wilder-work
Thomas McGuire 18 years ago
parent c097de26d3
commit 68a85ec67b
  1. 5
      folderstorage.cpp
  2. 3
      folderstorage.h
  3. 5
      kmfolder.cpp
  4. 3
      kmfolder.h
  5. 9
      kmfoldercachedimap.cpp
  6. 1
      kmfoldercachedimap.h
  7. 10
      kmfolderimap.cpp
  8. 1
      kmfolderimap.h
  9. 6
      kmmainwidget.cpp

@ -1247,4 +1247,9 @@ QString FolderStorage::sortedLocation() const
return location( "sorted" );
}
bool FolderStorage::canDeleteMessages() const
{
return !isReadOnly();
}
#include "folderstorage.moc"

@ -355,6 +355,9 @@ public:
/** Is the folder read-only? */
virtual bool isReadOnly() const = 0;
/** Can messages in this folder be deleted? */
virtual bool canDeleteMessages() const;
/** Returns the label of the folder for visualization. */
QString label() const;

@ -585,6 +585,11 @@ bool KMFolder::isReadOnly() const
return mStorage->isReadOnly();
}
bool KMFolder::canDeleteMessages() const
{
return mStorage->canDeleteMessages();
}
QString KMFolder::label() const
{
if ( !mSystemLabel.isEmpty() )

@ -365,6 +365,9 @@ public:
/** Is the folder read-only? */
bool isReadOnly() const;
/** Can messages in this folder be deleted? */
bool canDeleteMessages() const;
/** Returns true if the folder is a kmail system folder. These are
the folders 'inbox', 'outbox', 'sent', 'trash', 'drafts', 'templates'.
The name of these folders is nationalized in the folder display and

@ -3194,4 +3194,13 @@ void KMFolderCachedImap::slotRescueDone(KMCommand * command)
serverSyncInternal();
}
bool KMFolderCachedImap::canDeleteMessages() const
{
if ( isReadOnly() )
return false;
if ( userRights() > 0 && !(userRights() & ACLJobs::Delete) )
return false;
return true;
}
#include "kmfoldercachedimap.moc"

@ -227,6 +227,7 @@ class KMFolderCachedImap : public KMFolderMaildir
/** Reimplemented from KMFolderMaildir */
virtual KMMessage *take( int idx );
bool canDeleteMessages() const;
/** Reimplemented from KMFolderMaildir */
virtual int addMsg( KMMessage *msg, int *index_return = 0 );

@ -45,6 +45,7 @@ using KMail::ListJob;
using KMail::SearchJob;
#include "renamejob.h"
using KMail::RenameJob;
#include "acljobs.h"
#include <kdebug.h>
#include <kio/scheduler.h>
@ -2464,4 +2465,13 @@ void KMFolderImap::finishMailCheck( const char *dbg, imapState state )
close( dbg );
}
bool KMFolderImap::canDeleteMessages() const
{
if ( isReadOnly() )
return false;
if ( mUserRights > 0 && !(mUserRights & KMail::ACLJobs::Delete) )
return false;
return true;
}
#include "kmfolderimap.moc"

@ -296,6 +296,7 @@ bool isReadOnly() const { return KMFolderMbox::isReadOnly() || mReadOnly; }
* @return 0 when not known yet
*/
unsigned int userRights() const { return mUserRights; }
bool canDeleteMessages() const;
/** Set the user's rights on this folder - called by getUserRights */
void setUserRights( unsigned int userRights );

@ -3451,7 +3451,7 @@ void KMMainWidget::updateMessageActions()
mMarkThreadAsUnreadAction->setEnabled( thread_actions );
mToggleThreadToActAction->setEnabled( thread_actions && flags_available );
mToggleThreadImportantAction->setEnabled( thread_actions && flags_available );
mTrashThreadAction->setEnabled( thread_actions && !mFolder->isReadOnly() );
mTrashThreadAction->setEnabled( thread_actions && mFolder->canDeleteMessages() );
mDeleteThreadAction->setEnabled( thread_actions && !mFolder->isReadOnly() );
if (mFolder && mHeaders && mHeaders->currentMsg()) {
@ -3467,8 +3467,8 @@ void KMMainWidget::updateMessageActions()
mMoveActionMenu->setEnabled( mass_actions && !mFolder->isReadOnly() );
mCopyActionMenu->setEnabled( mass_actions );
mTrashAction->setEnabled( mass_actions && !mFolder->isReadOnly() );
mDeleteAction->setEnabled( mass_actions && !mFolder->isReadOnly() );
mTrashAction->setEnabled( mass_actions && mFolder->canDeleteMessages() );
mDeleteAction->setEnabled( mass_actions && mFolder->canDeleteMessages() );
mFindInMessageAction->setEnabled( mass_actions );
mForwardAction->setEnabled( mass_actions );
mForwardAttachedAction->setEnabled( mass_actions );

Loading…
Cancel
Save