Commit 19f0404c authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use action texts for buttons of decision/confirmation dialogs

parent 3647fe62
Pipeline #94072 passed with stage
in 11 minutes and 48 seconds
......@@ -175,8 +175,12 @@ AkonadiContactEditor *ContactEditorDialog::editor() const
void ContactEditorDialog::accept()
{
if (d->mEditor->hasNoSavedData()) {
if (KMessageBox::questionYesNo(this, i18nc("@info", "Location was not saved. Do you want to close editor?"), i18nc("@title:window", "Confirmation"))
== KMessageBox::No) {
const int answer = KMessageBox::questionYesNo(this,
i18nc("@info", "Location was not saved. Do you want to close editor?"),
i18nc("@title:window", "Confirmation"),
KGuiItem(i18nc("@action:button", "Close Editor"), QStringLiteral("dialog-close")),
KGuiItem(i18nc("@action:button", "Do Not Close"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::No) {
return;
}
}
......@@ -188,7 +192,13 @@ void ContactEditorDialog::accept()
void ContactEditorDialog::reject()
{
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Confirmation")) == KMessageBox::Yes) {
const int answer = KMessageBox::questionYesNo(this,
i18nc("@info", "Do you really want to cancel?"),
i18nc("@title:window", "Confirmation"),
KGuiItem(i18nc("@action:button", "Cancel Editing"), QStringLiteral("dialog-ok")),
KGuiItem(i18nc("@action:button", "Do Not Cancel"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
QDialog::reject(); // Discard current changes
}
}
......
......@@ -157,7 +157,13 @@ void ContactGroupEditorDialog::slotAccepted()
void ContactGroupEditorDialog::reject()
{
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Confirmation")) == KMessageBox::Yes) {
const int answer = KMessageBox::questionYesNo(this,
i18nc("@info", "Do you really want to cancel?"),
i18nc("@title:window", "Confirmation"),
KGuiItem(i18nc("@action:button", "Cancel Editing"), QStringLiteral("dialog-ok")),
KGuiItem(i18nc("@action:button", "Do Not Cancel"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
QDialog::reject(); // Discard current changes
}
}
......
......@@ -119,7 +119,9 @@ public:
if (nbItemCollection == 0) {
if (KMessageBox::questionYesNo(mParentWidget,
i18nc("@info", "You must create an address book before adding a contact. Do you want to create an address book?"),
i18nc("@title:window", "No Address Book Available"))
i18nc("@title:window", "No Address Book Available"),
KGuiItem(i18nc("@action:button", "Create Address Book"), QStringLiteral("address-book-new")),
KStandardGuiItem::cancel())
== KMessageBox::Yes) {
QPointer<Akonadi::AgentTypeDialog> dlg = new Akonadi::AgentTypeDialog(mParentWidget);
dlg->setWindowTitle(i18nc("@title:window", "Add Address Book"));
......@@ -221,7 +223,12 @@ public:
"<para>Do you want to edit this new contact now?</para>",
mCompleteAddress);
if (KMessageBox::questionYesNo(mParentWidget, text, QString(), KStandardGuiItem::yes(), KStandardGuiItem::no(), QStringLiteral("addedtokabc"))
if (KMessageBox::questionYesNo(mParentWidget,
text,
QString(),
KGuiItem(i18nc("@action:button", "Edit"), QStringLiteral("document-edit")),
KGuiItem(i18nc("@action:button", "Finish"), QStringLiteral("dialog-ok-apply")),
QStringLiteral("addedtokabc"))
== KMessageBox::Yes) {
QPointer<Akonadi::ContactEditorDialog> dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::EditMode, mParentWidget);
dlg->setContact(mItem);
......
......@@ -158,7 +158,9 @@ public:
if (nbItemCollection == 0) {
if (KMessageBox::questionYesNo(mParentWidget,
i18nc("@info", "You must create an address book before adding a contact. Do you want to create an address book?"),
i18nc("@title:window", "No Address Book Available"))
i18nc("@title:window", "No Address Book Available"),
KGuiItem(i18nc("@action:button", "Create Address Book"), QStringLiteral("address-book-new")),
KStandardGuiItem::cancel())
== KMessageBox::Yes) {
QPointer<Akonadi::AgentTypeDialog> dlg = new Akonadi::AgentTypeDialog(mParentWidget);
dlg->setWindowTitle(i18nc("@title:window", "Add Address Book"));
......
......@@ -64,7 +64,11 @@ AddressesLocationWidget::AddressesLocationWidget(QWidget *parent)
auto action = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Remove Address"));
action->setEnabled(!mReadOnly);
connect(action, &QAction::triggered, this, [this, idx]() {
const auto result = KMessageBox::questionYesNo(this, i18n("Do you really want to delete this address?"));
const auto result = KMessageBox::questionYesNo(this,
i18n("Do you really want to delete this address?"),
QString(),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (result == KMessageBox::Yes) {
mAddressModel->removeAddress(idx.row());
}
......
......@@ -289,7 +289,11 @@ void AddressLocationWidget::slotUpdateAddress()
void AddressLocationWidget::slotRemoveAddress()
{
if (mCurrentMode == ModifyAddress) {
const auto result = KMessageBox::questionYesNo(this, i18n("Do you really want to delete this address?"));
const auto result = KMessageBox::questionYesNo(this,
i18n("Do you really want to delete this address?"),
QString(),
KStandardGuiItem::del(),
KStandardGuiItem::cancel());
if (result == KMessageBox::Yes) {
Q_EMIT removeAddress(mCurrentAddress);
reset();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment