File r899974.diff of Package kdepim4

Subject: kmail: don't allow attachment deletion/editing in read-only folders
From: wstephenson@suse.de
Bug: kolab#3324
Patch-upstream: 899974
--- kmail/kmreaderwin.cpp	(revision 899973)
+++ kmail/kmreaderwin.cpp	(revision 899974)
@@ -1971,15 +1971,19 @@ void KMReaderWin::showAttachmentPopup( i
   connect( action, SIGNAL( triggered(bool) ), attachmentMapper, SLOT( map() ) );
   attachmentMapper->setMapping( action, KMHandleAttachmentCommand::Copy );
 
+  const bool canChange = message()->parent() ? !message()->parent()->isReadOnly() : false;
+
   if ( GlobalSettings::self()->allowAttachmentEditing() ) {
     action = menu->addAction(SmallIcon("document-properties"), i18n("Edit Attachment") );
     connect( action, SIGNAL(triggered()), attachmentMapper, SLOT(map()) );
     attachmentMapper->setMapping( action, KMHandleAttachmentCommand::Edit );
+    action->setEnabled( canChange );
   }
   if ( GlobalSettings::self()->allowAttachmentDeletion() ) {
     action = menu->addAction(SmallIcon("edit-delete"), i18n("Delete Attachment") );
     connect( action, SIGNAL(triggered()), attachmentMapper, SLOT(map()) );
     attachmentMapper->setMapping( action, KMHandleAttachmentCommand::Delete );
+    action->setEnabled( canChange );
   }
   if ( name.endsWith( ".xia", Qt::CaseInsensitive ) &&
        Kleo::CryptoBackendFactory::instance()->protocol( "Chiasmus" ) ) {
Index: kmail/kmreaderwin.cpp
===================================================================
openSUSE Build Service is sponsored by