summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/CMakeLists.txt1
-rw-r--r--framework/mail/CMakeLists.txt3
-rw-r--r--framework/mail/actions/akonadiactions.cpp75
-rw-r--r--framework/mail/actions/akonadiactions.h40
-rw-r--r--framework/mail/folderlistcontroller.cpp20
-rw-r--r--framework/mail/folderlistcontroller.h20
-rw-r--r--framework/mail/folderlistmodel.cpp20
-rw-r--r--framework/mail/folderlistmodel.h20
-rw-r--r--framework/mail/maillistcontroller.cpp20
-rw-r--r--framework/mail/maillistcontroller.h20
-rw-r--r--framework/mail/maillistmodel.cpp20
-rw-r--r--framework/mail/maillistmodel.h20
-rw-r--r--framework/mail/mailplugin.cpp20
-rw-r--r--framework/mail/mailplugin.h20
-rw-r--r--framework/mail/singlemailcontroller.cpp20
-rw-r--r--framework/mail/singlemailcontroller.h20
16 files changed, 358 insertions, 1 deletions
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index 8301392a..0b2b505d 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -24,6 +24,7 @@ find_package(KF5Libkleo)
24 24
25set(CMAKE_AUTOMOC ON) 25set(CMAKE_AUTOMOC ON)
26add_definitions("-Wall -std=c++0x -g") 26add_definitions("-Wall -std=c++0x -g")
27include_directories(.)
27include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/common) 28include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/common)
28include_directories(SYSTEM /work/install/include/) 29include_directories(SYSTEM /work/install/include/)
29include_directories(SYSTEM /work/install/include/KF5/) 30include_directories(SYSTEM /work/install/include/KF5/)
diff --git a/framework/mail/CMakeLists.txt b/framework/mail/CMakeLists.txt
index 0abc6880..9a32cc83 100644
--- a/framework/mail/CMakeLists.txt
+++ b/framework/mail/CMakeLists.txt
@@ -5,6 +5,7 @@ set(mailplugin_SRCS
5 singlemailcontroller.cpp 5 singlemailcontroller.cpp
6 folderlistmodel.cpp 6 folderlistmodel.cpp
7 folderlistcontroller.cpp 7 folderlistcontroller.cpp
8 actions/akonadiactions.cpp
8 objecttreesource.cpp 9 objecttreesource.cpp
9 stringhtmlwriter.cpp 10 stringhtmlwriter.cpp
10) 11)
@@ -13,7 +14,7 @@ add_library(mailplugin SHARED ${mailplugin_SRCS})
13 14
14qt5_use_modules(mailplugin Core Quick Qml) 15qt5_use_modules(mailplugin Core Quick Qml)
15 16
16target_link_libraries(mailplugin KF5::akonadi2common KF5::Otp) 17target_link_libraries(mailplugin actionplugin KF5::akonadi2common KF5::Otp actionplugin)
17 18
18install(TARGETS mailplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail) 19install(TARGETS mailplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail)
19install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail) 20install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail)
diff --git a/framework/mail/actions/akonadiactions.cpp b/framework/mail/actions/akonadiactions.cpp
new file mode 100644
index 00000000..d0a51deb
--- /dev/null
+++ b/framework/mail/actions/akonadiactions.cpp
@@ -0,0 +1,75 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "akonadiactions.h"
20
21#include <actions/context.h>
22
23#include <akonadi2common/clientapi.h>
24
25using namespace Kube;
26
27ActionHandlerHelper::ActionHandlerHelper(const QByteArray &actionId, const std::function<bool(Context*)> &isReady, const std::function<void(Context*)> &handler)
28 : ActionHandler(nullptr),
29 isReadyFunction(isReady),
30 handlerFunction(handler)
31{
32 setActionId(actionId);
33}
34
35bool ActionHandlerHelper::isActionReady(Context *context)
36{
37 return isReadyFunction(context);
38}
39
40void ActionHandlerHelper::execute(Context *context)
41{
42 handlerFunction(context);
43}
44
45static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read",
46 [](Context *context) -> bool {
47 return context->property("mail").isValid();
48 },
49 [](Context *context) {
50 auto mail = context->property("mail").value<Akonadi2::ApplicationDomain::Mail::Ptr>();
51 if (!mail) {
52 qWarning() << "Failed to get the mail mail: " << context->property("mail");
53 return;
54 }
55 mail->setProperty("unread", false);
56 qDebug() << "Mark as read " << mail->identifier();
57 Akonadi2::Store::modify(*mail).exec();
58 }
59);
60
61static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete",
62 [](Context *context) -> bool {
63 return context->property("mail").isValid();
64 },
65 [](Context *context) {
66 auto mail = context->property("mail").value<Akonadi2::ApplicationDomain::Mail::Ptr>();
67 if (!mail) {
68 qWarning() << "Failed to get the mail mail: " << context->property("mail");
69 return;
70 }
71 mail->setProperty("unread", false);
72 qDebug() << "Remove " << mail->identifier();
73 Akonadi2::Store::remove(*mail).exec();
74 }
75);
diff --git a/framework/mail/actions/akonadiactions.h b/framework/mail/actions/akonadiactions.h
new file mode 100644
index 00000000..a583ebf8
--- /dev/null
+++ b/framework/mail/actions/akonadiactions.h
@@ -0,0 +1,40 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <actions/actionhandler.h>
22#include <functional>
23
24namespace Kube {
25class Context;
26
27class ActionHandlerHelper : public ActionHandler
28{
29 Q_OBJECT
30public:
31 ActionHandlerHelper(const QByteArray &actionId, const std::function<bool(Context*)> &, const std::function<void(Context*)> &);
32
33 bool isActionReady(Context *context) Q_DECL_OVERRIDE;
34 void execute(Context *context) Q_DECL_OVERRIDE;
35private:
36 const std::function<bool(Context*)> isReadyFunction;
37 const std::function<void(Context*)> handlerFunction;
38};
39
40}
diff --git a/framework/mail/folderlistcontroller.cpp b/framework/mail/folderlistcontroller.cpp
index 9edc547c..3b1cf9f8 100644
--- a/framework/mail/folderlistcontroller.cpp
+++ b/framework/mail/folderlistcontroller.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "folderlistcontroller.h" 21#include "folderlistcontroller.h"
2 22
3#include "folderlistmodel.h" 23#include "folderlistmodel.h"
diff --git a/framework/mail/folderlistcontroller.h b/framework/mail/folderlistcontroller.h
index 84ce24be..11057f21 100644
--- a/framework/mail/folderlistcontroller.h
+++ b/framework/mail/folderlistcontroller.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include "folderlistmodel.h" 23#include "folderlistmodel.h"
diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp
index 0f66c46f..204dfdbf 100644
--- a/framework/mail/folderlistmodel.cpp
+++ b/framework/mail/folderlistmodel.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "folderlistmodel.h" 21#include "folderlistmodel.h"
2#include <akonadi2common/clientapi.h> 22#include <akonadi2common/clientapi.h>
3#include <akonadi2common/applicationdomaintype.h> 23#include <akonadi2common/applicationdomaintype.h>
diff --git a/framework/mail/folderlistmodel.h b/framework/mail/folderlistmodel.h
index 9ce3ee79..d412c29c 100644
--- a/framework/mail/folderlistmodel.h
+++ b/framework/mail/folderlistmodel.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include <QObject> 23#include <QObject>
diff --git a/framework/mail/maillistcontroller.cpp b/framework/mail/maillistcontroller.cpp
index 07baeb01..ed353b70 100644
--- a/framework/mail/maillistcontroller.cpp
+++ b/framework/mail/maillistcontroller.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "maillistcontroller.h" 21#include "maillistcontroller.h"
2 22
3#include <QStringList> 23#include <QStringList>
diff --git a/framework/mail/maillistcontroller.h b/framework/mail/maillistcontroller.h
index 3c969403..959c63a3 100644
--- a/framework/mail/maillistcontroller.h
+++ b/framework/mail/maillistcontroller.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include "maillistmodel.h" 23#include "maillistmodel.h"
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp
index f7a92097..2314e155 100644
--- a/framework/mail/maillistmodel.cpp
+++ b/framework/mail/maillistmodel.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "maillistmodel.h" 21#include "maillistmodel.h"
2 22
3#include "stringhtmlwriter.h" 23#include "stringhtmlwriter.h"
diff --git a/framework/mail/maillistmodel.h b/framework/mail/maillistmodel.h
index 7eb55ffd..1d56e6b8 100644
--- a/framework/mail/maillistmodel.h
+++ b/framework/mail/maillistmodel.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include <akonadi2common/clientapi.h> 23#include <akonadi2common/clientapi.h>
diff --git a/framework/mail/mailplugin.cpp b/framework/mail/mailplugin.cpp
index bf92f4e7..8b35dfb7 100644
--- a/framework/mail/mailplugin.cpp
+++ b/framework/mail/mailplugin.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "mailplugin.h" 21#include "mailplugin.h"
2 22
3#include "maillistmodel.h" 23#include "maillistmodel.h"
diff --git a/framework/mail/mailplugin.h b/framework/mail/mailplugin.h
index e835c384..ebd091ee 100644
--- a/framework/mail/mailplugin.h
+++ b/framework/mail/mailplugin.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include <QQmlEngine> 23#include <QQmlEngine>
diff --git a/framework/mail/singlemailcontroller.cpp b/framework/mail/singlemailcontroller.cpp
index fecf2fbc..5f7a6d93 100644
--- a/framework/mail/singlemailcontroller.cpp
+++ b/framework/mail/singlemailcontroller.cpp
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#include "singlemailcontroller.h" 21#include "singlemailcontroller.h"
2 22
3SingleMailController::SingleMailController(QObject *parent) : QObject(parent), m_model(new MailListModel) 23SingleMailController::SingleMailController(QObject *parent) : QObject(parent), m_model(new MailListModel)
diff --git a/framework/mail/singlemailcontroller.h b/framework/mail/singlemailcontroller.h
index bdac971c..283b03c4 100644
--- a/framework/mail/singlemailcontroller.h
+++ b/framework/mail/singlemailcontroller.h
@@ -1,3 +1,23 @@
1/*
2 Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA.
19*/
20
1#pragma once 21#pragma once
2 22
3#include "maillistmodel.h" 23#include "maillistmodel.h"