diff --git a/kmfoldercachedimap.cpp b/kmfoldercachedimap.cpp index 6d9b38f7f..d7a08e05b 100644 --- a/kmfoldercachedimap.cpp +++ b/kmfoldercachedimap.cpp @@ -176,7 +176,7 @@ KMFolderCachedImap::KMFolderCachedImap( KMFolder* folder, const char* aName ) mCheckFlags( true ), mReadOnly( false ), mAccount( NULL ), uidMapDirty( true ), uidWriteTimer( -1 ), mLastUid( 0 ), mTentativeHighestUid( 0 ), mFoundAnIMAPDigest( false ), - mUserRights( 0 ), mSilentUpload( false ), + mUserRights( 0 ), mOldUserRights( 0 ), mSilentUpload( false ), mFolderRemoved( false ), /*mHoldSyncs( false ),*/ mRecurse( true ), mStatusChangedLocally( false ), mAnnotationFolderTypeChanged( false ), @@ -246,6 +246,7 @@ void KMFolderCachedImap::readConfig() // << " readConfig: mIncidencesFor=" << mIncidencesFor << endl; mUserRights = config->readNumEntry( "UserRights", 0 ); // default is we don't know + mOldUserRights = mUserRights; int storageQuotaUsage = config->readNumEntry( "StorageQuotaUsage", -1 ); int storageQuotaLimit = config->readNumEntry( "StorageQuotaLimit", -1 ); @@ -790,6 +791,7 @@ void KMFolderCachedImap::serverSyncInternal() if( !noContent() && mAccount->hasACLSupport() ) { // Check the user's own rights. We do this every time in case they changed. + mOldUserRights = mUserRights; newState( mProgress, i18n("Checking permissions")); connect( mAccount, SIGNAL( receivedUserRights( KMFolder* ) ), this, SLOT( slotReceivedUserRights( KMFolder* ) ) ); @@ -1302,6 +1304,12 @@ void KMFolderCachedImap::uploadNewMessages() dest->storage()->setContentsType( contentsType() ); dest->storage()->writeConfig(); + KMessageBox::sorry( 0, i18n("

There are new messages in folder %1, which " + "have not been uploaded to the server yet, but you do not seem to " + "have sufficient access rights on the folder now to upload them.

" + "

All affected messages will therefore be moved to %2" + "to avoid data loss.

").arg( folder()->prettyURL() ).arg( dest->prettyURL() ), + i18n("Insufficient access rights") ); manualMove = false; break; } @@ -1336,6 +1344,14 @@ void KMFolderCachedImap::uploadNewMessages() return; } } + } else { // nothing to upload + if ( mUserRights != mOldUserRights && (mOldUserRights & KMail::ACLJobs::Insert) + && !(mUserRights & KMail::ACLJobs::Insert) ) { + // write access revoked + KMessageBox::information( 0, i18n("

Your access rights to folder %1 have been restricted, " + "it will no longer be possible to add messages to this folder.

").arg( folder()->prettyURL() ), + i18n("Acces rights revoked") ); + } } newState( mProgress, i18n("No messages to upload to server")); serverSyncInternal(); diff --git a/kmfoldercachedimap.h b/kmfoldercachedimap.h index 66a08e9c1..da3792850 100644 --- a/kmfoldercachedimap.h +++ b/kmfoldercachedimap.h @@ -482,7 +482,7 @@ private: * listing) attempted, during the sync. */ bool mFoundAnIMAPDigest; - int mUserRights; + int mUserRights, mOldUserRights; ACLList mACLList; bool mSilentUpload;