Skip to content

Commit

Permalink
Prevent exactly the same shortcut from being repeated at startup
Browse files Browse the repository at this point in the history
However, the same shortcut key can be repeated when one of the other parameters is different.
  • Loading branch information
tsujan committed Aug 23, 2019
1 parent 099d6ad commit 794c780
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions daemon/core.cpp
Expand Up @@ -464,6 +464,7 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi


{
QStringList execList, interfaceList, pathList;
// use regular XDG hierarchy (implemented by QSettings) if no config file given on command line
auto config_file_i = configFiles.cbegin();
if (config_file_i != configFiles.cend())
Expand Down Expand Up @@ -553,7 +554,12 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi
if (mSettings->contains(ExecKey))
{
QStringList values = mSettings->value(ExecKey).toStringList();
id = registerCommandAction(shortcut, values[0], values.mid(1), description);
QString str = shortcut + values.join(QString()) + description;
if (!execList.contains(str)) // don't add the same shortcut
{
id = registerCommandAction(shortcut, values[0], values.mid(1), description);
execList << str;
}
}
else
{
Expand All @@ -576,13 +582,23 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi
{
QString method = iniValue;

id = registerMethodAction(shortcut, service, QDBusObjectPath(path), interface, method, description);
QString str = shortcut + service + path + interface + method + description;
if (!interfaceList.contains(str)) // don't add the same shortcut
{
id = registerMethodAction(shortcut, service, QDBusObjectPath(path), interface, method, description);
interfaceList << str;
}
}
}
}
else
{
id = registerClientAction(shortcut, QDBusObjectPath(path), description);
QString str = shortcut + path + description;
if (!pathList.contains(str)) // don't add the same shortcut
{
id = registerClientAction(shortcut, QDBusObjectPath(path), description);
pathList << str;
}
}
}
}
Expand Down

0 comments on commit 794c780

Please sign in to comment.