25 #include <kmessagebox.h>
28 using namespace MessageViewer;
33 const QString &application,
const QString &dontAskAgainName )
34 : dontAskName( dontAskAgainName )
36 text = i18n(
"Open attachment '%1'?\n"
37 "Note that opening an attachment may compromise "
38 "your system's security.",
42 dialog->setCaption( i18n(
"Open Attachment?") );
43 dialog->setObjectName( QLatin1String(
"attachmentSaveOpen") );
45 if ( application.isEmpty() )
46 dialog->setButtons( KDialog::User3 | KDialog::User1 | KDialog::Cancel );
48 dialog->setButtons( KDialog::User3 | KDialog::User2 | KDialog::User1 | KDialog::Cancel );
49 dialog->setButtonText( KDialog::User2, i18n(
"&Open with '%1'", application ) );
52 dialog->setButtonGuiItem( KDialog::User3, KStandardGuiItem::saveAs() );
53 dialog->setButtonText( KDialog::User1, i18n(
"&Open With...") );
54 dialog->setDefaultButton( KDialog::User3 );
56 connect( dialog, SIGNAL(user3Clicked()),
this, SLOT(saveClicked()) );
57 connect( dialog, SIGNAL(user2Clicked()),
this, SLOT(openClicked()) );
58 connect( dialog, SIGNAL(user1Clicked()),
this, SLOT(openWithClicked()) );
65 KConfigGroup cg( KGlobal::config().data(),
"Notification Messages" );
66 if ( cg.hasKey( dontAskName ) )
67 return cg.readEntry( dontAskName, 0 );
71 KMessageBox::createKMessageBox( dialog, QMessageBox::Question, text, QStringList(),
72 i18n(
"Do not ask again" ), &again, 0 );
74 if ( ret == QDialog::Rejected )
78 KConfigGroup::WriteConfigFlags flags = KConfig::Persistent;
79 KConfigGroup cg( KGlobal::config().data(),
"Notification Messages" );
80 cg.writeEntry( dontAskName, ret, flags );
90 void AttachmentDialog::saveClicked()
97 void AttachmentDialog::openClicked()
104 void AttachmentDialog::openWithClicked()
111 #include "attachmentdialog.moc"
AttachmentDialog(QWidget *parent, const QString &filenameText, const QString &application, const QString &dontAskAgainName)