diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ ) find_package(KF5 5.23.0 REQUIRED COMPONENTS + ActivitiesStats Bookmarks Crash Config @@ -56,6 +57,7 @@ Qt5::Core Qt5::DBus Qt5::Widgets + KF5::ActivitiesStats KF5::Bookmarks KF5::Crash KF5::I18n diff --git a/privacyfunctions.cpp b/privacyfunctions.cpp --- a/privacyfunctions.cpp +++ b/privacyfunctions.cpp @@ -25,6 +25,10 @@ #include #include #include +#include +#include +#include + #include #include @@ -39,6 +43,11 @@ #include "config-sweeper.h" +namespace KAStats = KActivities::Stats; + +using namespace KAStats; +using namespace KAStats::Terms; + bool ClearThumbnailsAction::action() { // http://freedesktop.org/Standards/Home @@ -153,6 +162,13 @@ bool ClearRecentDocumentsAction::action() { + auto query = UsedResources + | Agent::any() + | Type::any() + | Url::file(); + + KAStats::forgetResources(query); + KRecentDocument::clear(); return KRecentDocument::recentDocuments().isEmpty(); } @@ -228,9 +244,11 @@ bool ClearRecentApplicationAction::action() { - QDBusMessage message = - QDBusMessage::createSignal(QLatin1String( "/kickoff/RecentAppDoc" ), QLatin1String( "org.kde.plasma" ), QLatin1String( "clearRecentDocumentsAndApplications" )); - QDBusConnection::sessionBus().send(message); + auto query = UsedResources + | Agent::any() + | Type::any() + | Url::startsWith(QStringLiteral("applications:")); + KAStats::forgetResources(query); return true; } diff --git a/sweeper.cpp b/sweeper.cpp --- a/sweeper.cpp +++ b/sweeper.cpp @@ -154,9 +154,9 @@ checklist.append(new ClearSavedClipboardContentsAction(generalCLI)); checklist.append(new ClearRecentDocumentsAction(generalCLI)); checklist.append(new ClearRunCommandHistoryAction(generalCLI)); -#ifdef Q_WS_X11 - checklist.append( new ClearRecentApplicationAction( generalCLI ) ); -#endif + if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.ActivityManager"))) { + checklist.append( new ClearRecentApplicationAction( generalCLI ) ); + } checklist.append(new ClearThumbnailsAction(generalCLI)); checklist.append(new ClearAllCookiesAction(webbrowsingCLI));