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

messageviewer

  • sources
  • kde-4.12
  • kdepim
  • messageviewer
  • scamdetection
scamdetectionwarningwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013 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 "scamdetectionwarningwidget.h"
19 #include "settings/globalsettings.h"
20 
21 #include <KLocale>
22 #include <KAction>
23 
24 #include <QDebug>
25 
26 using namespace MessageViewer;
27 
28 ScamDetectionWarningWidget::ScamDetectionWarningWidget(QWidget *parent)
29  : KMessageWidget(parent),
30  mUseInTestApps(false)
31 {
32  setVisible(false);
33  setCloseButtonVisible(true);
34  setMessageType(Warning);
35  setWordWrap(true);
36  setText(i18n("This message may be a scam. <a href=\"scamdetails\">(Details...)</a>"));
37 
38  connect(this, SIGNAL(linkActivated(QString)), SLOT(slotShowDetails(QString)));
39 
40  KAction *action = new KAction( i18n( "Move to Trash" ), this );
41  connect( action, SIGNAL(triggered(bool)), SIGNAL(moveMessageToTrash()) );
42  addAction( action );
43 
44  action = new KAction( i18n( "I confirm it's not a scam" ), this );
45  connect( action, SIGNAL(triggered(bool)), SLOT(slotMessageIsNotAScam()) );
46  addAction( action );
47 
48  action = new KAction( i18n( "Add email to whitelist" ), this );
49  connect( action, SIGNAL(triggered(bool)), SLOT(slotAddToWhiteList()) );
50  addAction( action );
51 
52  action = new KAction( i18n( "Disable scam detection for all messages" ), this );
53  connect( action, SIGNAL(triggered(bool)), SLOT(slotDisableScamDetection()) );
54  addAction( action );
55 }
56 
57 ScamDetectionWarningWidget::~ScamDetectionWarningWidget()
58 {
59 }
60 
61 void ScamDetectionWarningWidget::setUseInTestApps(bool b)
62 {
63  mUseInTestApps = b;
64 }
65 
66 void ScamDetectionWarningWidget::slotMessageIsNotAScam()
67 {
68  Q_EMIT messageIsNotAScam();
69  setVisible(false);
70 }
71 
72 void ScamDetectionWarningWidget::slotShowDetails(const QString &content)
73 {
74  if (content == QLatin1String("scamdetails")) {
75  Q_EMIT showDetails();
76  }
77 }
78 
79 void ScamDetectionWarningWidget::slotShowWarning()
80 {
81  animatedShow();
82 }
83 
84 void ScamDetectionWarningWidget::slotDisableScamDetection()
85 {
86  if (!mUseInTestApps) {
87  MessageViewer::GlobalSettings::self()->setScamDetectionEnabled( false );
88  MessageViewer::GlobalSettings::self()->writeConfig();
89  }
90  setVisible(false);
91 }
92 
93 void ScamDetectionWarningWidget::slotAddToWhiteList()
94 {
95  setVisible(false);
96  Q_EMIT addToWhiteList();
97 }
98 
99 #include "scamdetectionwarningwidget.moc"
MessageViewer::ScamDetectionWarningWidget::slotShowWarning
void slotShowWarning()
Definition: scamdetectionwarningwidget.cpp:79
MessageViewer::ScamDetectionWarningWidget::messageIsNotAScam
void messageIsNotAScam()
MessageViewer::ScamDetectionWarningWidget::moveMessageToTrash
void moveMessageToTrash()
globalsettings.h
MessageViewer::ScamDetectionWarningWidget::setUseInTestApps
void setUseInTestApps(bool b)
Definition: scamdetectionwarningwidget.cpp:61
QWidget
MessageViewer::GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:34
MessageViewer::ScamDetectionWarningWidget::showDetails
void showDetails()
scamdetectionwarningwidget.h
MessageViewer::ScamDetectionWarningWidget::addToWhiteList
void addToWhiteList()
KMessageWidget
MessageViewer::ScamDetectionWarningWidget::~ScamDetectionWarningWidget
~ScamDetectionWarningWidget()
Definition: scamdetectionwarningwidget.cpp:57
MessageViewer::ScamDetectionWarningWidget::ScamDetectionWarningWidget
ScamDetectionWarningWidget(QWidget *parent=0)
Definition: scamdetectionwarningwidget.cpp:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

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

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