summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 21:01:30 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 21:01:46 (GMT)
commit1518beca32293b8518008532102f25f862321479 (patch)
treee19eaa4af0c66530a124fe7ef1ca6c7acd275039
parentf2e6e3c4a32157ce570f52549528676feabb16a3 (diff)
Add check url job
-rw-r--r--messageviewer/src/CMakeLists.txt12
-rw-r--r--messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp35
-rw-r--r--messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h33
-rw-r--r--messageviewer/src/checkphishingurl/checkphishingurljob.cpp53
-rw-r--r--messageviewer/src/checkphishingurl/checkphishingurljob.h44
5 files changed, 173 insertions, 4 deletions
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index 2ea1567..f21d141 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -36,6 +36,7 @@ if(BUILD_TESTING)
add_subdirectory(viewer/webengine/tests)
add_subdirectory(messagepartthemes/default/autotests)
add_subdirectory(viewer/webengine/autotests/)
+ add_subdirectory(checkphishingurl/autotests/)
endif()
add_subdirectory(pics)
add_subdirectory(kconf_update)
@@ -117,6 +118,10 @@ set(libmessageviewer_scamdetection_webengine_SRCS
scamdetection/scamdetectionwebengine.cpp
)
+set(libmessageviewer_checkphishingurl_SRCS
+ checkphishingurl/checkphishingurljob.cpp
+ )
+
set(libmessageviewer_findbar_SRCS
findbar/findbarsourceview.cpp
)
@@ -135,7 +140,6 @@ set(libmessageviewer_htmlwriter_webengine_SRCS
set(libmessageviewer_htmlwriter_SRCS
htmlwriter/teehtmlwriter.cpp
- ${libmessageviewer_htmlwriter_webengine_SRCS}
)
set(libmessageviewer_antispam_SRCS
@@ -162,10 +166,10 @@ set(libmessageviewer_messagepartthemes_default_SRCS
messagepartthemes/default/messagepartrenderermanager.cpp
)
-set(libmessageviewer_messagepartthemes_SRCS
- ${libmessageviewer_messagepartthemes_default_SRCS}
- )
set(libmessageviewer_SRCS
+ ${libmessageviewer_checkphishingurl_SRCS}
+ ${libmessageviewer_messagepartthemes_default_SRCS}
+ ${libmessageviewer_htmlwriter_webengine_SRCS}
${libmessageviewer_messagepartthemes_SRCS}
${libmessageviewer_scamdetection_webengine_SRCS}
${libmessageviewer_widgets_webengine_SRCS}
diff --git a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp b/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp
new file mode 100644
index 0000000..5b1b12a
--- /dev/null
+++ b/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.cpp
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2016 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "checkphishingurljobtest.h"
+
+#include <QTest>
+
+CheckPhishingUrlJobTest::CheckPhishingUrlJobTest(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+CheckPhishingUrlJobTest::~CheckPhishingUrlJobTest()
+{
+
+}
+
+QTEST_MAIN(CheckPhishingUrlJobTest)
diff --git a/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h b/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h
new file mode 100644
index 0000000..491cd0b
--- /dev/null
+++ b/messageviewer/src/checkphishingurl/autotests/checkphishingurljobtest.h
@@ -0,0 +1,33 @@
+/*
+ Copyright (C) 2016 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CHECKPHISHINGURLJOBTEST_H
+#define CHECKPHISHINGURLJOBTEST_H
+
+#include <QObject>
+
+class CheckPhishingUrlJobTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit CheckPhishingUrlJobTest(QObject *parent = Q_NULLPTR);
+ ~CheckPhishingUrlJobTest();
+};
+
+#endif // CHECKPHISHINGURLJOBTEST_H
diff --git a/messageviewer/src/checkphishingurl/checkphishingurljob.cpp b/messageviewer/src/checkphishingurl/checkphishingurljob.cpp
new file mode 100644
index 0000000..fd95037
--- /dev/null
+++ b/messageviewer/src/checkphishingurl/checkphishingurljob.cpp
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2016 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "checkphishingurljob.h"
+
+using namespace MessageViewer;
+
+CheckPhishingUrlJob::CheckPhishingUrlJob(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+CheckPhishingUrlJob::~CheckPhishingUrlJob()
+{
+
+}
+
+void CheckPhishingUrlJob::setUrl(const QUrl &url)
+{
+ mUrl = url;
+}
+
+void CheckPhishingUrlJob::start()
+{
+ if (canStart()) {
+
+ } else {
+ //TODO emit signal
+ deleteLater();
+ }
+}
+
+bool MessageViewer::CheckPhishingUrlJob::canStart() const
+{
+ return mUrl.isValid();
+}
diff --git a/messageviewer/src/checkphishingurl/checkphishingurljob.h b/messageviewer/src/checkphishingurl/checkphishingurljob.h
new file mode 100644
index 0000000..a8ab7d0
--- /dev/null
+++ b/messageviewer/src/checkphishingurl/checkphishingurljob.h
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2016 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CHECKPHISHINGURLJOB_H
+#define CHECKPHISHINGURLJOB_H
+
+#include <QObject>
+#include <QUrl>
+
+namespace MessageViewer {
+class CheckPhishingUrlJob : public QObject
+{
+ Q_OBJECT
+public:
+ explicit CheckPhishingUrlJob(QObject *parent = Q_NULLPTR);
+ ~CheckPhishingUrlJob();
+
+ void setUrl(const QUrl &url);
+
+ void start();
+ bool canStart() const;
+
+private:
+ QUrl mUrl;
+};
+}
+
+#endif // CHECKPHISHINGURLJOB_H