From 4e6cfb39cc3fed7ee4c7c6232612342d7ad9be2d Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Thu, 26 Nov 2020 17:26:24 +0100 Subject: [PATCH] Prevent clang-format uglification --- applets/kicker/plugin/actionlist.cpp | 4 ++++ applets/kicker/plugin/recentcontactsmodel.cpp | 2 ++ applets/kicker/plugin/recentusagemodel.cpp | 2 ++ applets/notifications/filemenu.cpp | 10 ++++++---- applets/notifications/globalshortcuts.cpp | 2 +- libnotificationmanager/job_p.cpp | 2 ++ runners/recentdocuments/recentdocuments.cpp | 2 ++ 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/applets/kicker/plugin/actionlist.cpp b/applets/kicker/plugin/actionlist.cpp index 4e7f0a072..e20e44fb4 100644 --- a/applets/kicker/plugin/actionlist.cpp +++ b/applets/kicker/plugin/actionlist.cpp @@ -285,12 +285,14 @@ QVariantList recentDocumentActions(KService::Ptr service) return list; } + // clang-format off auto query = UsedResources | RecentlyUsedFirst | Agent(storageId) | Type::any() | Activity::current() | Url::file(); + // clang-format on ResultSet results(query); @@ -343,11 +345,13 @@ bool handleRecentDocumentAction(KService::Ptr service, const QString &actionId, return false; } + // clang-format off auto query = UsedResources | Agent(storageId) | Type::any() | Activity::current() | Url::file(); + // clang-format on KAStats::forgetResources(query); diff --git a/applets/kicker/plugin/recentcontactsmodel.cpp b/applets/kicker/plugin/recentcontactsmodel.cpp index b124a1297..064f38721 100644 --- a/applets/kicker/plugin/recentcontactsmodel.cpp +++ b/applets/kicker/plugin/recentcontactsmodel.cpp @@ -172,6 +172,7 @@ void RecentContactsModel::refresh() { QObject *oldModel = sourceModel(); + // clang-format off auto query = UsedResources | RecentlyUsedFirst | Agent(QStringLiteral("KTp")) @@ -179,6 +180,7 @@ void RecentContactsModel::refresh() | Activity::current() | Url::startsWith(QStringLiteral("ktp")) | Limit(15); + // clang-format on ResultModel *model = new ResultModel(query); diff --git a/applets/kicker/plugin/recentusagemodel.cpp b/applets/kicker/plugin/recentusagemodel.cpp index b2bf135ba..26dec7535 100644 --- a/applets/kicker/plugin/recentusagemodel.cpp +++ b/applets/kicker/plugin/recentusagemodel.cpp @@ -513,11 +513,13 @@ void RecentUsageModel::refresh() setSourceModel(nullptr); delete oldModel; + // clang-format off auto query = UsedResources | (m_ordering == Recent ? RecentlyUsedFirst : HighScoredFirst) | Agent::any() | (m_usage == OnlyDocs ? Type::files() : Type::any()) | Activity::current(); + // clang-format on switch (m_usage) { case AppsAndDocs: diff --git a/applets/notifications/filemenu.cpp b/applets/notifications/filemenu.cpp index 22e63df69..8f6968866 100644 --- a/applets/notifications/filemenu.cpp +++ b/applets/notifications/filemenu.cpp @@ -149,7 +149,7 @@ void FileMenu::open(int x, int y) const bool canTrash = itemProperties.isLocal() && itemProperties.supportsMoving(); if (canTrash) { - QAction *moveToTrashAction = KStandardAction::moveToTrash(this, [this] { + auto moveToTrashLambda = [this] { const QList urls{m_url}; KIO::JobUiDelegate uiDelegate; @@ -159,7 +159,8 @@ void FileMenu::open(int x, int y) KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl(QStringLiteral("trash:/")), job); } - }, menu); + }; + QAction *moveToTrashAction = KStandardAction::moveToTrash(this, moveToTrashLambda, menu); moveToTrashAction->setShortcut({}); // Can't focus notification to press Delete menu->addAction(moveToTrashAction); } @@ -168,7 +169,7 @@ void FileMenu::open(int x, int y) const bool showDeleteCommand = cg.readEntry("ShowDeleteCommand", false); if (itemProperties.supportsDeleting() && (!canTrash || showDeleteCommand)) { - QAction *deleteAction = KStandardAction::deleteFile(this, [this] { + auto deleteLambda = [this] { const QList urls{m_url}; KIO::JobUiDelegate uiDelegate; @@ -176,7 +177,8 @@ void FileMenu::open(int x, int y) auto *job = KIO::del(urls); job->uiDelegate()->setAutoErrorHandlingEnabled(true); } - }, menu); + }; + QAction *deleteAction = KStandardAction::deleteFile(this, deleteLambda, menu); deleteAction->setShortcut({}); menu->addAction(deleteAction); } diff --git a/applets/notifications/globalshortcuts.cpp b/applets/notifications/globalshortcuts.cpp index ec1c41244..f47c60ad5 100644 --- a/applets/notifications/globalshortcuts.cpp +++ b/applets/notifications/globalshortcuts.cpp @@ -46,7 +46,7 @@ GlobalShortcuts::~GlobalShortcuts() = default; void GlobalShortcuts::showDoNotDisturbOsd(bool doNotDisturb) const { - QDBusMessage msg = QDBusMessage::createMethodCall( + QDBusMessage msg = QDBusMessage::createMethodCall(// QStringLiteral("org.kde.plasmashell"), QStringLiteral("/org/kde/osdService"), QStringLiteral("org.kde.osdService"), diff --git a/libnotificationmanager/job_p.cpp b/libnotificationmanager/job_p.cpp index af54ea718..f72c34772 100644 --- a/libnotificationmanager/job_p.cpp +++ b/libnotificationmanager/job_p.cpp @@ -122,6 +122,7 @@ QString JobPrivate::prettyDestUrl() const void JobPrivate::updateHasDetails() { + // clang-format off const bool hasDetails = m_totalBytes > 0 || m_totalFiles > 0 || m_totalDirectories > 0 @@ -133,6 +134,7 @@ void JobPrivate::updateHasDetails() || !m_descriptionValue1.isEmpty() || !m_descriptionValue2.isEmpty() || m_speed > 0; + // clang-format on if (m_hasDetails != hasDetails) { m_hasDetails = hasDetails; diff --git a/runners/recentdocuments/recentdocuments.cpp b/runners/recentdocuments/recentdocuments.cpp index 5489a1321..58b0a9581 100644 --- a/runners/recentdocuments/recentdocuments.cpp +++ b/runners/recentdocuments/recentdocuments.cpp @@ -59,6 +59,7 @@ void RecentDocuments::match(Plasma::RunnerContext &context) return; } + // clang-format off const QString term = context.query(); auto query = UsedResources | Activity::current() @@ -67,6 +68,7 @@ void RecentDocuments::match(Plasma::RunnerContext &context) // we search only on file name, as KActivity does not support better options | Url("/*/" + term + "*") | Limit(20); + // clang-format on const auto result = new ResultModel(query);