summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/mail/contents/ui/main.qml21
-rw-r--r--framework/domain/actions/sinkactions.cpp13
2 files changed, 28 insertions, 6 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml
index 83bd85b2..414e3f5d 100644
--- a/components/mail/contents/ui/main.qml
+++ b/components/mail/contents/ui/main.qml
@@ -52,6 +52,12 @@ ApplicationWindow {
52 mail: mailListView.currentMail 52 mail: mailListView.currentMail
53 } 53 }
54 54
55 KubeAction.Context {
56 id: folderListContext
57 property variant folder
58 folder: folderListView.currentFolder
59 }
60
55 KubeAction.Action { 61 KubeAction.Action {
56 id: markAsReadAction 62 id: markAsReadAction
57 actionId: "org.kde.kube.actions.mark-as-read" 63 actionId: "org.kde.kube.actions.mark-as-read"
@@ -64,6 +70,12 @@ ApplicationWindow {
64 context: maillistcontext 70 context: maillistcontext
65 } 71 }
66 72
73 KubeAction.Action {
74 id: syncAction
75 actionId: "org.kde.kube.actions.synchronize"
76 context: folderListContext
77 }
78
67 //UI 79 //UI
68 toolBar: ToolBar { 80 toolBar: ToolBar {
69 81
@@ -140,6 +152,15 @@ ApplicationWindow {
140 } 152 }
141 } 153 }
142 154
155 PlasmaComponents.ToolButton {
156 height: parent.height
157 iconName: "view-refresh"
158 text: "Sync"
159 enabled: syncAction.ready
160 onClicked: {
161 syncAction.execute()
162 }
163 }
143 164
144 } 165 }
145 Rectangle { 166 Rectangle {
diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp
index a19ab149..57d63752 100644
--- a/framework/domain/actions/sinkactions.cpp
+++ b/framework/domain/actions/sinkactions.cpp
@@ -57,15 +57,16 @@ static ActionHandlerHelper deleteHandler("org.kde.kube.actions.delete",
57 57
58static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize", 58static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize",
59 [](Context *context) -> bool { 59 [](Context *context) -> bool {
60 return context->property("folder").isValid(); 60 return true;
61 }, 61 },
62 [](Context *context) { 62 [](Context *context) {
63 auto folder = context->property("folder").value<Sink::ApplicationDomain::Folder::Ptr>(); 63 if (auto folder = context->property("folder").value<Sink::ApplicationDomain::Folder::Ptr>()) {
64 if (!folder) { 64 qDebug() << "Synchronizing resource " << folder->resourceInstanceIdentifier();
65 qWarning() << "Failed to get the folder: " << context->property("folder"); 65 Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec();
66 return; 66 } else {
67 qDebug() << "Synchronizing all";
68 Sink::Store::synchronize(Sink::Query()).exec();
67 } 69 }
68 Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec();
69 } 70 }
70); 71);
71 72