summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/CMakeLists.txt1
-rw-r--r--framework/actions/action.cpp8
-rw-r--r--framework/actions/action.h1
-rw-r--r--framework/mail/CMakeLists.txt2
-rw-r--r--framework/mail/composer.cpp26
5 files changed, 36 insertions, 2 deletions
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index ff5fb746..d8d45af9 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -22,6 +22,7 @@ find_package(Sink CONFIG REQUIRED)
22find_package(KF5Async CONFIG REQUIRED) 22find_package(KF5Async CONFIG REQUIRED)
23find_package(KF5Libkleo CONFIG REQUIRED) 23find_package(KF5Libkleo CONFIG REQUIRED)
24find_package(KF5IconThemes CONFIG REQUIRED) 24find_package(KF5IconThemes CONFIG REQUIRED)
25find_package(KF5Codecs CONFIG REQUIRED)
25 26
26set(CMAKE_AUTOMOC ON) 27set(CMAKE_AUTOMOC ON)
27add_definitions("-Wall -std=c++0x -g") 28add_definitions("-Wall -std=c++0x -g")
diff --git a/framework/actions/action.cpp b/framework/actions/action.cpp
index 1f94ae81..905f6f57 100644
--- a/framework/actions/action.cpp
+++ b/framework/actions/action.cpp
@@ -35,6 +35,14 @@ Action::Action(QObject *parent)
35{ 35{
36} 36}
37 37
38Action::Action(const QByteArray &actionId, Context &context, QObject *parent)
39 : QObject(parent),
40 mContext(&context),
41 mActionId(actionId)
42{
43
44}
45
38void Action::setContext(Context *context) 46void Action::setContext(Context *context)
39{ 47{
40 //Get notified when any property changes 48 //Get notified when any property changes
diff --git a/framework/actions/action.h b/framework/actions/action.h
index 067c3c37..b820955e 100644
--- a/framework/actions/action.h
+++ b/framework/actions/action.h
@@ -33,6 +33,7 @@ class Action : public QObject
33 33
34public: 34public:
35 Action(QObject *parent = 0); 35 Action(QObject *parent = 0);
36 Action(const QByteArray &actionId, Context &context, QObject *parent = 0);
36 37
37 void setContext(Context *); 38 void setContext(Context *);
38 Context *context() const; 39 Context *context() const;
diff --git a/framework/mail/CMakeLists.txt b/framework/mail/CMakeLists.txt
index 94d15f4c..7215427b 100644
--- a/framework/mail/CMakeLists.txt
+++ b/framework/mail/CMakeLists.txt
@@ -24,7 +24,7 @@ add_library(mailplugin SHARED ${mailplugin_SRCS})
24 24
25qt5_use_modules(mailplugin Core Quick Qml) 25qt5_use_modules(mailplugin Core Quick Qml)
26 26
27target_link_libraries(mailplugin actionplugin sink KF5::Otp ${CURL_LIBRARIES}) 27target_link_libraries(mailplugin actionplugin sink KF5::Otp KF5::Codecs ${CURL_LIBRARIES})
28 28
29install(TARGETS mailplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail) 29install(TARGETS mailplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail)
30install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail) 30install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/kube/mail)
diff --git a/framework/mail/composer.cpp b/framework/mail/composer.cpp
index 6f603979..1ec56347 100644
--- a/framework/mail/composer.cpp
+++ b/framework/mail/composer.cpp
@@ -19,6 +19,12 @@
19 19
20 20
21#include "composer.h" 21#include "composer.h"
22#include <actions/context.h>
23#include <actions/action.h>
24#include <KMime/Message>
25#include <KCodecs/KEmailAddress>
26#include <QVariant>
27#include <QDebug>
22 28
23Composer::Composer(QObject *parent) : QObject(parent) 29Composer::Composer(QObject *parent) : QObject(parent)
24{ 30{
@@ -110,7 +116,25 @@ void Composer::setFromIndex(int fromIndex)
110 116
111void Composer::send() 117void Composer::send()
112{ 118{
113 //TODO 119 auto mail = KMime::Message::Ptr::create();
120 for (const auto &to : KEmailAddress::splitAddressList(m_to)) {
121 QByteArray displayName;
122 QByteArray addrSpec;
123 QByteArray comment;
124 KEmailAddress::splitAddress(to.toUtf8(), displayName, addrSpec, comment);
125 mail->to(true)->addAddress(addrSpec, displayName);
126 }
127 mail->subject(true)->fromUnicodeString(m_subject, "utf-8");
128 mail->setBody(m_body.toUtf8());
129 mail->assemble();
130 Kube::Context context;
131 context.setProperty("message", QVariant::fromValue(mail));
132 //TODO get from somewhere
133 context.setProperty("username", QVariant::fromValue(QByteArray("test@test.com")));
134 context.setProperty("password", QVariant::fromValue(QByteArray("pass")));
135 context.setProperty("server", QVariant::fromValue(QByteArray("smtp://smtp.gmail.com:587")));
136
137 Kube::Action("org.kde.kube.actions.sendmail", context).execute();
114 clear(); 138 clear();
115} 139}
116 140