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

Use action texts for buttons of decision/confirmation dialogs

parent 71b0742e
Pipeline #94304 passed with stage
in 7 minutes and 6 seconds
......@@ -142,7 +142,12 @@ void NotesAgentAlarmDialog::slotShowNote()
void NotesAgentAlarmDialog::slotRemoveAlarm()
{
if (KMessageBox::Yes == KMessageBox::warningYesNo(this, i18n("Are you sure to remove alarm?"), i18nc("@title:window", "Remove Alarm"))) {
const int answer = KMessageBox::warningYesNo(this,
i18n("Are you sure to remove alarm?"),
i18nc("@title:window", "Remove Alarm"),
KStandardGuiItem::remove(),
KStandardGuiItem::cancel());
if (answer == KMessageBox::Yes) {
const Akonadi::Item::Id id = mListWidget->currentItemId();
if (id != -1) {
Akonadi::Item item(id);
......
......@@ -91,8 +91,12 @@ void CreateNewNoteJob::slotFetchCollection(KJob *job)
{
if (job->error()) {
qCDebug(NOTESHARED_LOG) << " Error during fetch: " << job->errorString();
if (KMessageBox::Yes
== KMessageBox::warningYesNo(nullptr, i18n("An error occurred during fetching. Do you want to select a new default collection?"))) {
const int answer = KMessageBox::warningYesNo(nullptr,
i18n("An error occurred during fetching. Do you want to select a new default collection?"),
QString(),
KGuiItem(i18nc("@action:button", "Select New Default")),
KGuiItem(i18nc("@action:button", "Ignore"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
Q_EMIT selectNewCollection();
} else {
deleteLater();
......@@ -102,8 +106,12 @@ void CreateNewNoteJob::slotFetchCollection(KJob *job)
auto fetchCollection = qobject_cast<Akonadi::CollectionFetchJob *>(job);
if (fetchCollection->collections().isEmpty()) {
qCDebug(NOTESHARED_LOG) << "No collection fetched";
if (KMessageBox::Yes
== KMessageBox::warningYesNo(nullptr, i18n("An error occurred during fetching. Do you want to select a new default collection?"))) {
const int answer = KMessageBox::warningYesNo(nullptr,
i18n("An error occurred during fetching. Do you want to select a new default collection?"),
QString(),
KGuiItem(i18nc("@action:button", "Select New Default")),
KGuiItem(i18nc("@action:button", "Ignore"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
Q_EMIT selectNewCollection();
} else {
deleteLater();
......@@ -113,9 +121,13 @@ void CreateNewNoteJob::slotFetchCollection(KJob *job)
Akonadi::Collection col = fetchCollection->collections().at(0);
if (col.isValid()) {
if (!col.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
if (KMessageBox::Yes
== KMessageBox::warningYesNo(nullptr,
i18n("Collection is hidden. New note will be stored but not displayed. Do you want to show collection?"))) {
const int answer =
KMessageBox::warningYesNo(nullptr,
i18n("Collection is hidden. New note will be stored but not displayed. Do you want to show collection?"),
QString(),
KGuiItem(i18nc("@action::button", "Show Collection")),
KGuiItem(i18nc("@action::button", "Do Not Show", QStringLiteral("dialog-cancel"))));
if (answer == KMessageBox::Yes) {
col.addAttribute(new NoteShared::ShowFolderNotesAttribute());
auto modifyJob = new Akonadi::CollectionModifyJob(col);
connect(modifyJob, &Akonadi::CollectionModifyJob::result, this, &CreateNewNoteJob::slotCollectionModifyFinished);
......
Markdown is supported
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