EntryConfig: Introduce (dirty) way to distinguish between user/system entries
This commit is contained in:
parent
b72931cc9e
commit
27ac3155d3
@ -214,7 +214,7 @@ QString EntryProvider::resolveEntryPath(QString path)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<EntryConfig> EntryProvider::readConfig(QStringList paths)
|
QVector<EntryConfig> EntryProvider::readConfig(QStringList paths, bool userentrymode)
|
||||||
{
|
{
|
||||||
QVector<EntryConfig> result;
|
QVector<EntryConfig> result;
|
||||||
for(QString &configPath : paths)
|
for(QString &configPath : paths)
|
||||||
@ -228,6 +228,11 @@ QVector<EntryConfig> EntryProvider::readConfig(QStringList paths)
|
|||||||
{
|
{
|
||||||
if(!entry->hidden)
|
if(!entry->hidden)
|
||||||
{
|
{
|
||||||
|
if(userentrymode)
|
||||||
|
{
|
||||||
|
entry->userEntry = true;
|
||||||
|
entry->entryPath = path;
|
||||||
|
}
|
||||||
result.append(*entry);
|
result.append(*entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,7 +243,7 @@ QVector<EntryConfig> EntryProvider::readConfig(QStringList paths)
|
|||||||
|
|
||||||
QVector<EntryConfig> EntryProvider::getUserEntries()
|
QVector<EntryConfig> EntryProvider::getUserEntries()
|
||||||
{
|
{
|
||||||
return readConfig(this->userEntriesDirsPaths);
|
return readConfig(this->userEntriesDirsPaths, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<EntryConfig> EntryProvider::getSystemEntries()
|
QVector<EntryConfig> EntryProvider::getSystemEntries()
|
||||||
|
@ -18,7 +18,9 @@ class ConfigFormatException : public std::runtime_error
|
|||||||
class EntryConfig
|
class EntryConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool userEntry = false;
|
||||||
bool hidden = false;
|
bool hidden = false;
|
||||||
|
QString entryPath;
|
||||||
QString key;
|
QString key;
|
||||||
QString name;
|
QString name;
|
||||||
QString command;
|
QString command;
|
||||||
@ -39,13 +41,14 @@ class EntryProvider
|
|||||||
EntryConfig readqsrunFile(const QString &path);
|
EntryConfig readqsrunFile(const QString &path);
|
||||||
EntryConfig readFromDesktopFile(const QString &path);
|
EntryConfig readFromDesktopFile(const QString &path);
|
||||||
std::optional<EntryConfig> readEntryFromPath(const QString &path);
|
std::optional<EntryConfig> readEntryFromPath(const QString &path);
|
||||||
QVector<EntryConfig> readConfig(QStringList paths);
|
QVector<EntryConfig> readConfig(QStringList paths, bool userentrymode=false);
|
||||||
QString resolveEntryPath(QString path);
|
QString resolveEntryPath(QString path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EntryProvider(QStringList userEntriesDirsPaths, QStringList systemEntriesDirsPaths);
|
EntryProvider(QStringList userEntriesDirsPaths, QStringList systemEntriesDirsPaths);
|
||||||
QVector<EntryConfig> getUserEntries();
|
QVector<EntryConfig> getUserEntries();
|
||||||
QVector<EntryConfig> getSystemEntries();
|
QVector<EntryConfig> getSystemEntries();
|
||||||
|
void saveUserEntry(const EntryConfig &config);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTRYPROVIDER_H
|
#endif // ENTRYPROVIDER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user