CloseMessageBox::CloseMessageBox(const QString& Caption, const QString& Text, QWidget *parent, const char *name) : QDialog(parent, name) // must not be "WDestructiveClose" !!!!! { setCaption(Caption); all = new Q3VBoxLayout(this); all->setSpacing(5); QLabel *l = new QLabel(Text, this); l->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter); l->setMargin(5); all->addWidget(l); Q3HBox *Butts = new Q3HBox(this); // Butts->setSpacing(5); all->addWidget(Butts); QPushButton *Save = new QPushButton(tr("Save"), Butts); connect(Save, SIGNAL(clicked()), SLOT(slotSave())); QPushButton *SaveAll = new QPushButton(tr("Save all"), Butts); connect(SaveAll, SIGNAL(clicked()), SLOT(slotSaveAll())); QPushButton *Discard = new QPushButton(tr("Discard"), Butts); connect(Discard, SIGNAL(clicked()), SLOT(slotDiscard())); QPushButton *DiscardAll = new QPushButton(tr("Discard all"), Butts); connect(DiscardAll, SIGNAL(clicked()), SLOT(slotDiscardAll())); QPushButton *Cancel = new QPushButton(tr("Cancel"), Butts); connect(Cancel, SIGNAL(clicked()), SLOT(slotCancel())); }
void KMMimePartTree::itemRightClicked( QListViewItem* item, const QPoint& point ) { // TODO: remove this member var? mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item ); if ( 0 == mCurrentContextMenuItem ) { kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl; } else { kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl; QPopupMenu* popup = new QPopupMenu; if ( mCurrentContextMenuItem->node()->nodeId() > 2 && mCurrentContextMenuItem->node()->typeString() != "Multipart" ) { popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) ); popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) ); popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) ); } popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) ); /* * FIXME mkae optional? popup->insertItem( i18n( "Save as &Encoded..." ), this, SLOT( slotSaveAsEncoded() ) ); */ popup->insertItem( i18n( "Save All Attachments..." ), this, SLOT( slotSaveAll() ) ); // edit + delete only for attachments if ( mCurrentContextMenuItem->node()->nodeId() > 2 && mCurrentContextMenuItem->node()->typeString() != "Multipart" ) { popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) ); if ( GlobalSettings::self()->allowAttachmentDeletion() ) popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ), this, SLOT( slotDelete() ) ); if ( GlobalSettings::self()->allowAttachmentEditing() ) popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ), this, SLOT( slotEdit() ) ); } if ( mCurrentContextMenuItem->node()->nodeId() > 0 ) popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) ); popup->exec( point ); delete popup; mCurrentContextMenuItem = 0; } }