implement inheritance keyword for .qsrun entries
This commit is contained in:
szülő
45d7b930f8
commit
560e15d48d
@ -162,7 +162,7 @@ EntryConfig EntryProvider::readFromFile(const QString &path)
|
||||
inheritedConfig = readFromDesktopFile(resolveEntryPath(splitted[1]));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result.update(inheritedConfig);
|
||||
}
|
||||
|
||||
QString EntryProvider::resolveEntryPath(QString path)
|
||||
@ -224,3 +224,26 @@ QVector<EntryConfig> EntryProvider::getSystemEntries()
|
||||
{
|
||||
return readConfig(this->systemEntriesDirsPaths);
|
||||
}
|
||||
|
||||
template <class T> void assignIfDestDefault(T &dest, const T &source)
|
||||
{
|
||||
if(dest == T())
|
||||
{
|
||||
dest = source;
|
||||
}
|
||||
}
|
||||
|
||||
EntryConfig &EntryConfig::update(const EntryConfig &o)
|
||||
{
|
||||
assignIfDestDefault(this->arguments, o.arguments);
|
||||
assignIfDestDefault(this->col, o.col);
|
||||
assignIfDestDefault(this->command, o.command);
|
||||
if(this->icon.isNull())
|
||||
{
|
||||
this->icon = o.icon;
|
||||
}
|
||||
assignIfDestDefault(this->key, o.key);
|
||||
assignIfDestDefault(this->name, o.name);
|
||||
assignIfDestDefault(this->row, o.row);
|
||||
return *this;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ class EntryConfig
|
||||
QIcon icon;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
EntryConfig &update(const EntryConfig &o);
|
||||
};
|
||||
|
||||
class EntryProvider
|
||||
|
Betöltés…
Reference in New Issue
Block a user