From 68f95cf68c3a8d29c2cc81929287eabb3a6d7682 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 13 Mar 2016 23:57:18 +0100 Subject: Sync action --- framework/domain/actions/sinkactions.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'framework/domain/actions/sinkactions.cpp') 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", static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize", [](Context *context) -> bool { - return context->property("folder").isValid(); + return true; }, [](Context *context) { - auto folder = context->property("folder").value(); - if (!folder) { - qWarning() << "Failed to get the folder: " << context->property("folder"); - return; + if (auto folder = context->property("folder").value()) { + qDebug() << "Synchronizing resource " << folder->resourceInstanceIdentifier(); + Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec(); + } else { + qDebug() << "Synchronizing all"; + Sink::Store::synchronize(Sink::Query()).exec(); } - Sink::Store::synchronize(Sink::Query::ResourceFilter(folder->resourceInstanceIdentifier())).exec(); } ); -- cgit v1.2.3