diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp --- a/messageviewer/src/viewer/viewer_p.cpp +++ b/messageviewer/src/viewer/viewer_p.cpp @@ -369,7 +369,7 @@ const QString filenameText = MimeTreeParser::NodeHelper::fileName(node); QPointer dialog = new AttachmentDialog(mMainWindow, filenameText, - offer ? offer->name() : QString(), + offer, QLatin1String( "askSave_") + mimetype.name()); const int choice = dialog->exec(); diff --git a/messageviewer/src/widgets/attachmentdialog.h b/messageviewer/src/widgets/attachmentdialog.h --- a/messageviewer/src/widgets/attachmentdialog.h +++ b/messageviewer/src/widgets/attachmentdialog.h @@ -21,6 +21,7 @@ #define MESSAGEVIEWERT_ATTACHMENTDIALOG_H #include +#include class QDialog; class QDialogButtonBox; @@ -42,9 +43,10 @@ Cancel }; - // if @application is non-empty, the "open with " button will also be shown, + // if @offer is non-null, the "open with " button will also be shown, // otherwise only save, open with, cancel - explicit AttachmentDialog(QWidget *parent, const QString &filenameText, const QString &application, const QString &dontAskAgainName); + explicit AttachmentDialog(QWidget *parent, const QString &filenameText, + const KService::Ptr &offer, const QString &dontAskAgainName); // executes the modal dialog int exec(); diff --git a/messageviewer/src/widgets/attachmentdialog.cpp b/messageviewer/src/widgets/attachmentdialog.cpp --- a/messageviewer/src/widgets/attachmentdialog.cpp +++ b/messageviewer/src/widgets/attachmentdialog.cpp @@ -31,13 +31,14 @@ //--------------------------------------------------------------------- -AttachmentDialog::AttachmentDialog(QWidget *parent, const QString &filenameText, const QString &application, const QString &dontAskAgainName) +AttachmentDialog::AttachmentDialog(QWidget *parent, const QString &filenameText, + const KService::Ptr &offer, const QString &dontAskAgainName) : dontAskName(dontAskAgainName) { - text = i18n("Open attachment '%1'?\n" - "Note that opening an attachment may compromise " - "your system's security.", - filenameText); + text = xi18nc("@info", "Open attachment %1?" + "Note that opening an attachment may compromise " + "your system's security.", + filenameText); dialog = new QDialog(parent); dialog->setWindowTitle(i18n("Open Attachment?")); @@ -48,18 +49,20 @@ dialog->connect(mButtonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); dialog->connect(mButtonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); - if (!application.isEmpty()) { + if (offer) { QPushButton *user2Button = new QPushButton; mButtonBox->addButton(user2Button, QDialogButtonBox::ActionRole); - user2Button->setText(i18n("&Open with '%1'", application)); + user2Button->setText(i18n("&Open with '%1'", offer->name())); + user2Button->setIcon(QIcon::fromTheme(offer->icon())); connect(user2Button, &QPushButton::clicked, this, &AttachmentDialog::openClicked); } QPushButton *user3Button = new QPushButton; mButtonBox->addButton(user3Button, QDialogButtonBox::ActionRole); KGuiItem::assign(user3Button, KStandardGuiItem::saveAs()); user1Button->setText(i18n("&Open With...")); + user1Button->setIcon(QIcon::fromTheme(QLatin1String("document-open"))); user3Button->setDefault(true); connect(user3Button, &QPushButton::clicked, this, &AttachmentDialog::saveClicked);