blob: b78fe533543b58bb0209c3eadcb60a6880a8ffbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "xdgautostart.h"
#include "xdgbasedir.h"
#include "xdgentry.h"
#include "debug.h"
KaZoe::AutoStart::AutoStart(QObject *parent)
: QObject{parent}
{
qCDebug(AUTO_START) << "Create Auto start";
QStringList configdirs = KaZoe::configDirs();
for (auto dir = configdirs.rbegin(); dir != configdirs.rend(); ++dir)
{
m_entries.addDirectory(*dir + "/autostart");
}
m_entries.addDirectory(KaZoe::configHome() + "/autostart");
}
void KaZoe::AutoStart::start(QString key, QString value)
{
qCDebug(AUTO_START) << "Start " << key << value;
for(KaZoe::Entry *entry: m_entries.getEntries())
{
if((!value.isNull()) && (!key.isNull()))
{
QString c = entry->data(key);
if(c.trimmed().toLower() == value.trimmed().toLower())
{
qCDebug(AUTO_START) << "Start app " << entry->appId() << "with" << key << value;
entry->start(QStringList());
}
}
else
{
qCDebug(AUTO_START) << "Start app " << entry->appId();
entry->start(QStringList());
}
}
}
|