diff options
Diffstat (limited to 'framework/accounts/maildircontroller.cpp')
-rw-r--r-- | framework/accounts/maildircontroller.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/framework/accounts/maildircontroller.cpp b/framework/accounts/maildircontroller.cpp new file mode 100644 index 00000000..daafccb6 --- /dev/null +++ b/framework/accounts/maildircontroller.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "maildircontroller.h" | ||
20 | |||
21 | #include <sink/store.h> | ||
22 | |||
23 | using namespace Sink; | ||
24 | using namespace Sink::ApplicationDomain; | ||
25 | |||
26 | MaildirController::MaildirController() : Kube::Controller(), | ||
27 | action_create{new Kube::ControllerAction{this, &MaildirController::create}}, | ||
28 | action_modify{new Kube::ControllerAction{this, &MaildirController::modify}}, | ||
29 | action_remove{new Kube::ControllerAction{this, &MaildirController::remove}} | ||
30 | { | ||
31 | |||
32 | } | ||
33 | |||
34 | void MaildirController::create() { | ||
35 | auto account = ApplicationDomainType::createEntity<SinkAccount>(); | ||
36 | account.setProperty("type", "maildir"); | ||
37 | account.setProperty("name", getName()); | ||
38 | //account.setProperty("icon", getIcon()); | ||
39 | Store::create(account).exec().waitForFinished(); | ||
40 | |||
41 | auto resource = ApplicationDomainType::createEntity<SinkResource>(); | ||
42 | resource.setResourceType("sink.maildir"); | ||
43 | resource.setAccount(account); | ||
44 | resource.setProperty("path", getPath().path()); | ||
45 | |||
46 | Store::create(resource).exec().waitForFinished(); | ||
47 | |||
48 | clear(); | ||
49 | } | ||
50 | |||
51 | void MaildirController::modify() { | ||
52 | } | ||
53 | |||
54 | void MaildirController::remove() { | ||
55 | } | ||