Add edit + delete attachment actions to the mime part tree

svn path=/branches/kdepim/enterprise/kdepim/; revision=668963
wilder-work
Volker Krause 19 years ago
parent f366e762f6
commit a87581621d
  1. 25
      kmmimeparttree.cpp
  2. 2
      kmmimeparttree.h
  3. 42
      kmreaderwin.cpp
  4. 3
      kmreaderwin.h

@ -132,6 +132,13 @@ void KMMimePartTree::itemRightClicked( QListViewItem* item,
SLOT( slotSaveAsEncoded() ) );
popup->insertItem( i18n( "Save All Attachments..." ), this,
SLOT( slotSaveAll() ) );
// edit + delete only for attachments
if ( mCurrentContextMenuItem->node()->nodeId() > 2 ) {
popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ),
this, SLOT( slotDelete() ) );
popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ),
this, SLOT( slotEdit() ) );
}
popup->exec( point );
delete popup;
mCurrentContextMenuItem = 0;
@ -224,6 +231,23 @@ void KMMimePartTree::correctSize( QListViewItem * item )
correctSize( item->parent() );
}
void KMMimePartTree::slotDelete()
{
QPtrList<QListViewItem> selected = selectedItems();
if ( selected.count() != 1 )
return;
mReaderWin->slotDeleteAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
void KMMimePartTree::slotEdit()
{
QPtrList<QListViewItem> selected = selectedItems();
if ( selected.count() != 1 )
return;
mReaderWin->slotEditAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
//=============================================================================
KMMimePartTreeItem::KMMimePartTreeItem( KMMimePartTree * parent,
partNode* node,
@ -286,5 +310,4 @@ void KMMimePartTreeItem::setIconAndTextForType( const QString & mime )
}
}
#include "kmmimeparttree.moc"

@ -63,6 +63,8 @@ protected slots:
void slotSaveAs();
void slotSaveAsEncoded();
void slotSaveAll();
void slotDelete();
void slotEdit();
protected:
/** reimplemented in order to update the frame width in case of a changed

@ -1960,23 +1960,9 @@ void KMReaderWin::slotHandleAttachment( int choice )
this, SLOT( slotAtmView( int, const QString& ) ) );
command->start();
} else if ( choice == 7 ) {
if ( KMessageBox::warningContinueCancel( this,
i18n("Deleting an attachment might invalidate any digital signature on this message."),
i18n("Delete Attachment"), KStdGuiItem::del(), "DeleteAttachmentSignatureWarning" )
!= KMessageBox::Continue ) {
return;
}
KMDeleteAttachmentCommand* command = new KMDeleteAttachmentCommand( node, message(), this );
command->start();
slotDeleteAttachment( node );
} else if ( choice == 8 ) {
if ( KMessageBox::warningContinueCancel( this,
i18n("Modifying an attachment might invalidate any digital signature on this message."),
i18n("Edit Attachment"), KGuiItem( i18n("Edit"), "edit" ), "EditAttachmentSignatureWarning" )
!= KMessageBox::Continue ) {
return;
}
KMEditAttachmentCommand* command = new KMEditAttachmentCommand( node, message(), this );
command->start();
slotEditAttachment( node );
}
}
@ -2551,6 +2537,30 @@ bool KMReaderWin::eventFilter( QObject *, QEvent *e )
return false;
}
void KMReaderWin::slotDeleteAttachment(partNode * node)
{
if ( KMessageBox::warningContinueCancel( this,
i18n("Deleting an attachment might invalidate any digital signature on this message."),
i18n("Delete Attachment"), KStdGuiItem::del(), "DeleteAttachmentSignatureWarning" )
!= KMessageBox::Continue ) {
return;
}
KMDeleteAttachmentCommand* command = new KMDeleteAttachmentCommand( node, message(), this );
command->start();
}
void KMReaderWin::slotEditAttachment(partNode * node)
{
if ( KMessageBox::warningContinueCancel( this,
i18n("Modifying an attachment might invalidate any digital signature on this message."),
i18n("Edit Attachment"), KGuiItem( i18n("Edit"), "edit" ), "EditAttachmentSignatureWarning" )
!= KMessageBox::Continue ) {
return;
}
KMEditAttachmentCommand* command = new KMEditAttachmentCommand( node, message(), this );
command->start();
}
#include "kmreaderwin.moc"

@ -356,6 +356,9 @@ public slots:
void slotLevelQuote( int l );
void slotTouchMessage();
void slotDeleteAttachment( partNode* node );
void slotEditAttachment( partNode* node );
protected slots:
void slotCycleHeaderStyles();
void slotBriefHeaders();

Loading…
Cancel
Save