• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • editor
validatesendmailshortcut.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "validatesendmailshortcut.h"
19 
20 #include "libkdepim/widgets/pimmessagebox.h"
21 #include "settings/globalsettings.h"
22 
23 #include <KMessageBox>
24 #include <KActionCollection>
25 #include <KLocalizedString>
26 #include <kaction.h>
27 
28 ValidateSendMailShortcut::ValidateSendMailShortcut(KActionCollection *actionCollection, QWidget *parent)
29  : mParent(parent),
30  mActionCollection(actionCollection)
31 {
32 }
33 
34 ValidateSendMailShortcut::~ValidateSendMailShortcut()
35 {
36 
37 }
38 
39 bool ValidateSendMailShortcut::validate()
40 {
41  bool sendNow = false;
42  const int result = PIMMessageBox::fourBtnMsgBox(mParent,
43  QMessageBox::Question,
44  i18n("This shortcut allows to send mail directly. Mail can be send accidentally. What do you want to do?"),
45  i18n("Configure shortcut"),
46  KGuiItem(i18n("Remove Shortcut")),
47  KGuiItem(i18n("Ask Before Sending")),
48  KGuiItem(i18n("Sending Without Confirmation")));
49  if (result == KMessageBox::Yes) {
50  QAction *act = mActionCollection->action( QLatin1String("send_mail") );
51  if (act) {
52  act->setShortcut(QKeySequence());
53  mActionCollection->writeSettings();
54  } else {
55  qDebug()<<"Unable to find action named \"send_mail\"";
56  }
57  sendNow = false;
58  } else if (result == KMessageBox::No) {
59  GlobalSettings::self()->setConfirmBeforeSendWhenUseShortcut(true);
60  sendNow = true;
61  } else if (result == KMessageBox::Ok) {
62  GlobalSettings::self()->setConfirmBeforeSendWhenUseShortcut(false);
63  sendNow = true;
64  } else if (result == KMessageBox::Cancel) {
65  return false;
66  }
67  GlobalSettings::self()->setCheckSendDefaultActionShortcut(true);
68  GlobalSettings::self()->writeConfig();
69  return sendNow;
70 }
globalsettings.h
ValidateSendMailShortcut::validate
bool validate()
Definition: validatesendmailshortcut.cpp:39
QWidget
ValidateSendMailShortcut::ValidateSendMailShortcut
ValidateSendMailShortcut(KActionCollection *actionCollection, QWidget *parent=0)
Definition: validatesendmailshortcut.cpp:28
validatesendmailshortcut.h
PIMMessageBox::fourBtnMsgBox
static int fourBtnMsgBox(QWidget *parent, QMessageBox::Icon type, const QString &text, const QString &caption=QString(), const KGuiItem &button1=KStandardGuiItem::yes(), const KGuiItem &button2=KStandardGuiItem::no(), const KGuiItem &button3=KStandardGuiItem::cont(), KMessageBox::Options options=KMessageBox::Notify)
pimmessagebox.h
QAction::setShortcut
void setShortcut(const QKeySequence &shortcut)
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
QLatin1String
QKeySequence
QAction
ValidateSendMailShortcut::~ValidateSendMailShortcut
~ValidateSendMailShortcut()
Definition: validatesendmailshortcut.cpp:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal