diff options
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 12 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 48185a38..64f21743 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -20,6 +20,7 @@ XDGDesktopList::XDGDesktopList(QObject *parent, bool watchdirs) : QObject(parent synctimer = new QTimer(this); synctimer->setInterval(60000); //1 minute intervals. since the polling/update only takes a few ms, this is completely reasonable connect(synctimer, SIGNAL(timeout()), this, SLOT(updateList()) ); + keepsynced = watchdirs; if(watchdirs){ watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(watcherChanged()) ); @@ -79,12 +80,13 @@ void XDGDesktopList::updateList(){ } //If this class is automatically managing the lists, update the watched files/dirs and send out notifications if(watcher!=0){ - //qDebug() << "App List Updated:" << lastCheck << appschanged << newfiles << oldkeys; + qDebug() << "Auto App List Update:" << lastCheck << "Changes:" << appschanged;// << newfiles << oldkeys; watcher->removePaths(QStringList() << watcher->files() << watcher->directories()); watcher->addPaths(appDirs); if(appschanged){ emit appsUpdated(); } + synctimer->start(); } - synctimer->start(); + } QList<XDGDesktop> XDGDesktopList::apps(bool showAll, bool showHidden){ @@ -511,15 +513,15 @@ QStringList LXDG::systemApplicationDirs(){ } XDGDesktopList* LXDG::systemAppsList(){ - static XDGDesktopList *sysapps = new XDGDesktopList(0,true); //set this to automatically update as needed + static XDGDesktopList *sysapps = 0; + if(sysapps == 0){ qDebug() << "Generating new apps list"; sysapps = new XDGDesktopList(0,true); }//set this to automatically update as needed if(sysapps->lastCheck.isNull()){ sysapps->updateList(); } //catch the first time the class was used, and prompt for an update right now return sysapps; } QList<XDGDesktop> LXDG::systemDesktopFiles(bool showAll, bool showHidden){ //Quick overload for backwards compatibility which uses the static/global class for managing app entries - XDGDesktopList list(0, false); - return list.apps(showAll, showHidden); + return systemAppsList()->apps(showAll, showHidden); } QHash<QString,QList<XDGDesktop> > LXDG::sortDesktopCats(QList<XDGDesktop> apps){ diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h index 996e5a20..0397ce71 100644 --- a/src-qt5/core/libLumina/LuminaXDG.h +++ b/src-qt5/core/libLumina/LuminaXDG.h @@ -93,6 +93,7 @@ public slots: private: QFileSystemWatcher *watcher; QTimer *synctimer; + bool keepsynced; private slots: void watcherChanged(); |