┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/global.cpp
diff options
context:
space:
mode:
authorSerg Podtynnyi <[email protected]>2023-02-04 00:14:53 +0700
committerSerg Podtynnyi <[email protected]>2023-02-05 12:45:38 +0700
commit38c34eeca315c7be58e65d4d3fb72aaf7b866719 (patch)
tree886e53f20c9c43edc3eb7fe04789716a9bc98ebe /src/global.cpp
parentffff8af851e3a386c44438337779d0ce7ca98a61 (diff)
Add clang-format and format code as in Frameworks
Diffstat (limited to 'src/global.cpp')
-rw-r--r--src/global.cpp44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/global.cpp b/src/global.cpp
index d5fbec6bc..554eb41fa 100644
--- a/src/global.cpp
+++ b/src/global.cpp
@@ -19,11 +19,11 @@
#include <QApplication>
-QList<QUrl> Dolphin::validateUris(const QStringList& uriList)
+QList<QUrl> Dolphin::validateUris(const QStringList &uriList)
{
const QString currentDir = QDir::currentPath();
QList<QUrl> urls;
- for (const QString& str : uriList) {
+ for (const QString &str : uriList) {
const QUrl url = QUrl::fromUserInput(str, currentDir, QUrl::AssumeLocalFile);
if (url.isValid()) {
urls.append(url);
@@ -57,7 +57,11 @@ void Dolphin::openNewWindow(const QList<QUrl> &urls, QWidget *window, const Open
job->start();
}
-bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService, const QString &activationToken)
+bool Dolphin::attachToExistingInstance(const QList<QUrl> &inputUrls,
+ bool openFiles,
+ bool splitView,
+ const QString &preferredService,
+ const QString &activationToken)
{
bool attached = false;
@@ -71,7 +75,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
}
int activeWindowIndex = -1;
- for (const auto& interface: qAsConst(dolphinInterfaces)) {
+ for (const auto &interface : qAsConst(dolphinInterfaces)) {
++activeWindowIndex;
auto isActiveWindowReply = interface.first->isActiveWindow();
@@ -83,7 +87,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
// check to see if any instances already have any of the given URLs or their parents open
QList<QUrl> newWindowURLs;
- for (const QUrl& url : inputUrls) {
+ for (const QUrl &url : inputUrls) {
bool urlFound = false;
const QString urlString = url.toString();
@@ -101,8 +105,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
}
i = (i + 1) % dolphinInterfaces.size();
- }
- while (i != activeWindowIndex);
+ } while (i != activeWindowIndex);
if (!urlFound) {
if (GeneralSettings::openExternallyCalledFolderInNewTab()) {
@@ -113,13 +116,11 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
}
}
- for (const auto& interface: qAsConst(dolphinInterfaces)) {
+ for (const auto &interface : qAsConst(dolphinInterfaces)) {
if (interface.second.isEmpty()) {
continue;
}
- auto reply = openFiles ?
- interface.first->openFiles(interface.second, splitView) :
- interface.first->openDirectories(interface.second, splitView);
+ auto reply = openFiles ? interface.first->openFiles(interface.second, splitView) : interface.first->openDirectories(interface.second, splitView);
reply.waitForFinished();
if (!reply.isError()) {
interface.first->activateWindow(activationToken);
@@ -137,14 +138,12 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
return attached;
}
-QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Dolphin::dolphinGuiInstances(const QString& preferredService)
+QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Dolphin::dolphinGuiInstances(const QString &preferredService)
{
QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinInterfaces;
if (!preferredService.isEmpty()) {
QSharedPointer<OrgKdeDolphinMainWindowInterface> preferredInterface(
- new OrgKdeDolphinMainWindowInterface(preferredService,
- QStringLiteral("/dolphin/Dolphin_1"),
- QDBusConnection::sessionBus()));
+ new OrgKdeDolphinMainWindowInterface(preferredService, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus()));
if (preferredInterface->isValid() && !preferredInterface->lastError().isValid()) {
dolphinInterfaces.append(qMakePair(preferredInterface, QStringList()));
}
@@ -157,13 +156,11 @@ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Do
const QString pattern = QStringLiteral("org.kde.dolphin-");
// Don't match the pid without leading "-"
const QString myPid = QLatin1Char('-') + QString::number(QCoreApplication::applicationPid());
- for (const QString& service : dbusServices) {
+ for (const QString &service : dbusServices) {
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
// Check if instance can handle our URLs
QSharedPointer<OrgKdeDolphinMainWindowInterface> interface(
- new OrgKdeDolphinMainWindowInterface(service,
- QStringLiteral("/dolphin/Dolphin_1"),
- QDBusConnection::sessionBus()));
+ new OrgKdeDolphinMainWindowInterface(service, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus()));
if (interface->isValid() && !interface->lastError().isValid()) {
dolphinInterfaces.append(qMakePair(interface, QStringList()));
}
@@ -189,17 +186,14 @@ double GlobalConfig::animationDurationFactor()
updateAnimationDurationFactor(kdeGlobalsConfig, {"AnimationDurationFactor"});
KConfigWatcher::Ptr configWatcher = KConfigWatcher::create(KSharedConfig::openConfig());
- connect(configWatcher.data(), &KConfigWatcher::configChanged,
- &GlobalConfig::updateAnimationDurationFactor);
+ connect(configWatcher.data(), &KConfigWatcher::configChanged, &GlobalConfig::updateAnimationDurationFactor);
return s_animationDurationFactor;
}
void GlobalConfig::updateAnimationDurationFactor(const KConfigGroup &group, const QByteArrayList &names)
{
- if (group.name() == QLatin1String("KDE") &&
- names.contains(QByteArrayLiteral("AnimationDurationFactor"))) {
- s_animationDurationFactor = std::max(0.0,
- group.readEntry("AnimationDurationFactor", 1.0));
+ if (group.name() == QLatin1String("KDE") && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) {
+ s_animationDurationFactor = std::max(0.0, group.readEntry("AnimationDurationFactor", 1.0));
}
}