Skip to content

Commit 9af6895

Browse files
committed
some minor readability improvements
1 parent 113f871 commit 9af6895

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

daemon/core.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,6 @@ QString Core::checkShortcut(const QString &shortcut, X11Shortcut &X11shortcut)
20312031
QPair<QString, qulonglong> Core::addOrRegisterClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description, const QString &sender)
20322032
{
20332033
X11Shortcut X11shortcut;
2034-
20352034
QString newShortcut = checkShortcut(shortcut, X11shortcut);
20362035
// if (newShortcut.isEmpty())
20372036
// {
@@ -2054,25 +2053,24 @@ QPair<QString, qulonglong> Core::addOrRegisterClientAction(const QString &shortc
20542053
mIdsByShortcut[newShortcut].insert(id);
20552054
}
20562055

2057-
dynamic_cast<ClientAction*>(shortcutAndAction.second)->appeared(QDBusConnection::sessionBus(), sender);
2056+
auto action = static_cast<ClientAction*>(shortcutAndAction.second);
2057+
action->appeared(QDBusConnection::sessionBus(), sender);
20582058

20592059
return qMakePair(newShortcut, id);
20602060
}
20612061

20622062
qulonglong id = ++mLastId;
2063-
20642063
if (!sender.isEmpty() && !newShortcut.isEmpty())
20652064
{
20662065
newShortcut = grabOrReuseKey(X11shortcut, newShortcut);
20672066
mIdsByShortcut[newShortcut].insert(id);
20682067
}
20692068

20702069
mIdByClientPath[path] = id;
2071-
ClientAction *clientAction = sender.isEmpty() ? new ClientAction(this, path, description) : new ClientAction(this, QDBusConnection::sessionBus(), sender, path, description);
2070+
auto clientAction = sender.isEmpty() ? new ClientAction(this, path, description) : new ClientAction(this, QDBusConnection::sessionBus(), sender, path, description);
20722071
mShortcutAndActionById[id] = qMakePair<QString, BaseAction *>(newShortcut, clientAction);
20732072

20742073
log(LOG_INFO, "addClientAction shortcut:'%s' id:%llu", qPrintable(newShortcut), id);
2075-
20762074
return qMakePair(newShortcut, id);
20772075
}
20782076

@@ -2125,7 +2123,8 @@ qulonglong Core::registerClientAction(const QString &shortcut, const QDBusObject
21252123

21262124
QMutexLocker lock(&mDataMutex);
21272125

2128-
return addOrRegisterClientAction(shortcut, path, description, QString()).second;
2126+
auto action = addOrRegisterClientAction(shortcut, path, description, QString());
2127+
return action.second;
21292128
}
21302129

21312130
void Core::addMethodAction(QPair<QString, qulonglong> &result, const QString &shortcut, const QString &service, const QDBusObjectPath &path, const QString &interface, const QString &method, const QString &description)

0 commit comments

Comments
 (0)