aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-desktop/LDesktop.cpp69
-rw-r--r--lumina-desktop/LDesktop.h1
-rw-r--r--lumina-desktop/LSession.cpp20
-rw-r--r--lumina-desktop/LSession.h10
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.cpp29
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.h49
-rw-r--r--lumina-desktop/desktop-plugins/LDPluginContainer.h35
-rw-r--r--lumina-desktop/desktop-plugins/NewDP.h4
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp100
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h1
-rw-r--r--lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp2
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp20
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h2
-rw-r--r--lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp47
-rw-r--r--lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp2
-rw-r--r--lumina-desktop/lumina-desktop.pro1
-rw-r--r--lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp4
-rw-r--r--lumina-desktop/panel-plugins/systemtray/LSysTray.cpp3
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp4
19 files changed, 244 insertions, 159 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 8040c18b..5e359df7 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -153,20 +153,26 @@ void LDesktop::checkResolution(){
}
//Update any desktop plugins
QStringList plugs = settings->value(DPREFIX+"pluginlist").toStringList();
- QString pspath = QDir::homePath()+"/.lumina/desktop-plugins/%1.conf";
+ QFileInfoList files = LSession::handle()->DesktopFiles();
+ for(int i=0; i<files.length(); i++){
+ plugs << "applauncher::"+files[i].absoluteFilePath()+"---"+DPREFIX;
+ }
+ //QString pspath = QDir::homePath()+"/.lumina/desktop-plugins/%1.conf";
+ QSettings *DP = LSession::handle()->DesktopPluginSettings();
+ QStringList keys = DP->allKeys();
for(int i=0; i<plugs.length(); i++){
- if(QFile::exists( pspath.arg(plugs[i]) )){
- //Has existing settings file - need to adjust this as well
- QSettings pset(QSettings::UserScope, "desktop-plugins",plugs[i]);
- if(pset.contains("location/height")){ pset.setValue( "location/height", qRound(pset.value("location/height").toInt()*yscale) ); }
- if(pset.contains("location/width")){ pset.setValue( "location/width", qRound(pset.value("location/width").toInt()*xscale) ); }
- if(pset.contains("location/x")){ pset.setValue( "location/x", qRound(pset.value("location/x").toInt()*xscale) ); }
- if(pset.contains("location/y")){ pset.setValue( "location/y", qRound(pset.value("location/y").toInt()*yscale) ); }
- if(pset.contains("IconSize")){ pset.setValue( "IconSize", qRound(pset.value("IconSize").toInt()*yscale) ); }
- if(pset.contains("iconsize")){ pset.setValue( "iconsize", qRound(pset.value("iconsize").toInt()*yscale) ); }
- pset.sync(); //make sure it gets saved to disk right away
+ QStringList filter = keys.filter(plugs[i]);
+ for(int j=0; j<filter.length(); j++){
+ //Has existing settings - need to adjust it
+ if(filter[j].endsWith("location/height")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*yscale) ); }
+ if(filter[j].endsWith("location/width")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*xscale) ); }
+ if(filter[j].endsWith("location/x")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*xscale) ); }
+ if(filter[j].endsWith("location/y")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*yscale) ); }
+ if(filter[j].endsWith("IconSize")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*yscale) ); }
+ if(filter[j].endsWith("iconsize")){ DP->setValue( filter[j], qRound(DP->value(filter[j]).toInt()*yscale) ); }
}
}
+ DP->sync(); //make sure it gets saved to disk right away
}
issyncing = false;
@@ -213,6 +219,7 @@ void LDesktop::InitDesktop(){
connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) );
//watcher = new QFileSystemWatcher(this);
connect(QApplication::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) );
+ connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) );
//watcher->addPath(settings->fileName());
//connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) );
@@ -314,6 +321,7 @@ void LDesktop::winClicked(QAction* act){
void LDesktop::UpdateDesktop(){
if(DEBUG){ qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber; }
QStringList plugins = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList();
+
if(defaultdesktop && plugins.isEmpty()){
//plugins << "sample" << "sample" << "sample";
}
@@ -329,11 +337,24 @@ void LDesktop::UpdateDesktop(){
changed=true;
}
}
+ if(changed){
+ //save the modified plugin list to file (so per-plugin settings are preserved)
+ issyncing=true; //don't let the change cause a refresh
+ settings->setValue(DPREFIX+"pluginlist", plugins);
+ settings->sync();
+ QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
+ }
+ //If generating desktop file launchers, add those in
+ if(settings->value(DPREFIX+"generateDesktopIcons",false).toBool()){
+ QFileInfoList files = LSession::handle()->DesktopFiles();
+ for(int i=0; i<files.length(); i++){
+ plugins << "applauncher::"+files[i].absoluteFilePath()+"---"+DPREFIX;
+ }
+ }
//Go through the plugins and remove any existing ones that do not show up on the current list
for(int i=0; i<PLUGINS.length(); i++){
if(!plugins.contains(PLUGINS[i]->ID())){
//Remove this plugin (with settings) - is not currently listed
-
DesktopPluginRemoved(PLUGINS[i]->ID(),true); //flag this as an internal removal
i--;
}
@@ -356,19 +377,12 @@ void LDesktop::UpdateDesktop(){
plug = NewDP::createPlugin(plugins[i], bgDesktop);
if(plug != 0){
connect(plug, SIGNAL(OpenDesktopMenu()), this, SLOT(ShowMenu()) );
- //qDebug() << " -- Show Plugin";
+ if(DEBUG){ qDebug() << " -- Show Plugin"; }
PLUGINS << plug;
CreateDesktopPluginContainer(plug);
+ if(DEBUG){ qDebug() << " -- Done Creating Plugin Container"; }
}
}
-
- }
- if(changed){
- //save the modified plugin list to file (so per-plugin settings are preserved)
- issyncing=true; //don't let the change cause a refresh
- settings->setValue(DPREFIX+"pluginlist", plugins);
- settings->sync();
- QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
}
}
@@ -457,6 +471,7 @@ void LDesktop::DesktopPluginRemoved(QString ID, bool internal){
if(PLUGINS[i]->ID() == ID){
//qDebug() << "- found ID";
if(DEBUG){ qDebug() << " - Deleting Desktop Plugin:" << ID; }
+ PLUGINS[i]->removeSettings(); //Remove any settings associated with this plugin
delete PLUGINS.takeAt(i);
break;
}
@@ -465,17 +480,17 @@ void LDesktop::DesktopPluginRemoved(QString ID, bool internal){
//Now remove that plugin from the internal list (then let the plugin system remove the actual plugin)
QStringList plugins = settings->value(DPREFIX+"pluginlist",QStringList()).toStringList();
if(DEBUG){ qDebug() << " - Also removing plugin from future list"; }
- plugins.removeAll(ID);
+ if(plugins.removeAll(ID) > 0){
issyncing = true;
if(DEBUG){ qDebug() << " - Save modified plugins list"; }
settings->setValue(DPREFIX+"pluginlist", plugins);
- if(QFile::exists(QDir::homePath()+"/.lumina/desktop-plugins/"+ID+".conf")){
+ if(DEBUG){ qDebug() << " - Unlock settings file in 200 ms"; }
+ QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
+ }
+ /*if(QFile::exists(QDir::homePath()+"/.lumina/desktop-plugins/"+ID+".conf")){
if(DEBUG){ qDebug() << " - Removing settings file"; }
QFile::remove(QDir::homePath()+"/.lumina/desktop-plugins/"+ID+".conf");
- }
- if(DEBUG){ qDebug() << " - Unlock settings file in 200 ms"; }
- //settings->sync();
- QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
+ }*/
if(DEBUG){ qDebug() << " - Done removing plugin"; }
}
diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h
index 4860313e..f949d861 100644
--- a/lumina-desktop/LDesktop.h
+++ b/lumina-desktop/LDesktop.h
@@ -70,7 +70,6 @@ private:
QLabel *workspacelabel;
QWidgetAction *wkspaceact;
QList<LDPlugin*> PLUGINS;
- //QFileSystemWatcher *watcher;
QString CBG; //current background
QRect globalWorkRect;
void CreateDesktopPluginContainer(LDPlugin*);
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index d6b6e891..90be178b 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -89,6 +89,7 @@ void LSession::setupSession(){
if(DEBUG){ qDebug() << " - Init QSettings:" << timer->elapsed();}
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
sessionsettings = new QSettings("LuminaDE", "sessionsettings");
+ DPlugSettings = new QSettings("pluginsettings","desktopsettings");
//Setup the user's lumina settings directory as necessary
splash.showScreen("user");
if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();}
@@ -123,6 +124,7 @@ void LSession::setupSession(){
//Initialize the desktops
splash.showScreen("desktop");
if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed();}
+ desktopFiles = QDir(QDir::homePath()+"/Desktop").entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs, QDir::Name | QDir::IgnoreCase | QDir::DirsFirst);
updateDesktops();
//Now setup the system watcher for changes
@@ -135,6 +137,7 @@ void LSession::setupSession(){
watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" );
watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-init" );
watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-keys" );
+ watcher->addPath( QDir::homePath() );
//connect internal signals/slots
connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(updateDesktops()) );
@@ -326,17 +329,21 @@ void LSession::watcherChange(QString changed){
if(changed.endsWith("fluxbox-init") || changed.endsWith("fluxbox-keys")){ refreshWindowManager(); }
else if(changed.endsWith("sessionsettings.conf") ){ sessionsettings->sync(); emit SessionConfigChanged(); }
else if(changed.endsWith("desktopsettings.conf") ){ emit DesktopConfigChanged(); }
-
+ else if(changed == QDir::homePath()+"/Desktop"){
+ desktopFiles = QDir(QDir::homePath()+"/Desktop").entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs ,QDir::Name | QDir::IgnoreCase | QDir::DirsFirst);
+ emit DesktopFilesChanged();
+ }
//Now double-check all the watches files to ensure that none of them got removed
QStringList files = watcher->files();
- if(files.length() < 4){
+ if(files.length() < 5){
qDebug() << " - Resetting Watched Files...";
watcher->removePaths(files); //clear the current files before re-setting them
watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/sessionsettings.conf" );
watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" );
watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-init" );
watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-keys" );
+ watcher->addPath( QDir::homePath()+"/Desktop");
}
}
@@ -505,6 +512,7 @@ void LSession::adjustWindowGeom(WId win, bool maximize){
XCB->MoveResizeWindow(win, geom);
}
+
}
void LSession::SessionEnding(){
@@ -519,6 +527,10 @@ void LSession::LaunchApplication(QString cmd){
QProcess::startDetached(cmd);
}
+QFileInfoList LSession::DesktopFiles(){
+ return desktopFiles;
+}
+
AppMenu* LSession::applicationMenu(){
return appmenu;
}
@@ -531,6 +543,10 @@ QSettings* LSession::sessionSettings(){
return sessionsettings;
}
+QSettings* LSession::DesktopPluginSettings(){
+ return DPlugSettings;
+}
+
void LSession::systemWindow(){
if(sysWindow==0){ sysWindow = new SystemWindow(); }
else{ sysWindow->updateWindow(); }
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index cdd91899..867f4bd9 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -74,6 +74,7 @@ public:
}
static void LaunchApplication(QString cmd);
+ QFileInfoList DesktopFiles();
AppMenu* applicationMenu();
void systemWindow();
@@ -81,7 +82,8 @@ public:
LXCB *XCB; //class for XCB usage
QSettings* sessionSettings();
-
+ QSettings* DesktopPluginSettings();
+
//Play System Audio
void playAudioFile(QString filepath);
//Window Adjustment Routine (due to Fluxbox not respecting _NET_WM_STRUT)
@@ -98,7 +100,7 @@ private:
SystemWindow *sysWindow;
QTranslator *currTranslator;
QMediaPlayer *mediaObj;
- QSettings *sessionsettings;
+ QSettings *sessionsettings, *DPlugSettings;
bool cleansession;
//System Tray Variables
@@ -109,6 +111,7 @@ private:
//Task Manager Variables
QList<WId> RunningApps;
+ QFileInfoList desktopFiles;
void CleanupSession();
@@ -151,6 +154,7 @@ signals:
void IconThemeChanged();
void DesktopConfigChanged();
void SessionConfigChanged();
+ void DesktopFilesChanged();
};
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp
new file mode 100644
index 00000000..f7be148d
--- /dev/null
+++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp
@@ -0,0 +1,29 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014-2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "LDPlugin.h"
+
+#include "../LSession.h"
+
+LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){
+ PLUGID=id;
+ prefix = id.replace("/","_")+"/";
+ qDebug() << "ID:" << PLUGID << prefix;
+ settings = LSession::handle()->DesktopPluginSettings();
+ //Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...)
+ this->setObjectName(id.section("---",0,0).section("::",0,0));
+}
+
+void LDPlugin::setInitialSize(int width, int height){
+ //Note: Only run this in the plugin initization routine:
+ // if the plugin is completely new (first time used), it will be this size
+ if(settings->allKeys().filter(prefix).isEmpty()){
+ //Brand new plugin: set initial size
+ settings->setValue(prefix+"location/width",width);
+ settings->setValue(prefix+"location/height",height);
+ settings->sync();
+ }
+}
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h
index fc6ab604..a69ca9c2 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.h
+++ b/lumina-desktop/desktop-plugins/LDPlugin.h
@@ -28,42 +28,35 @@ class LDPlugin : public QFrame{
Q_OBJECT
private:
- QString PLUGID;
-
-public:
+ QString PLUGID, prefix;
QSettings *settings;
- LDPlugin(QWidget *parent = 0, QString id="unknown", bool opaque = false) : QFrame(parent){
- PLUGID=id;
- settings = new QSettings("desktop-plugins",PLUGID);
- //Use two values for stylesheet access, Visible or normal plugin base
- if(opaque){ this->setObjectName("LuminaDesktopPluginVisible"); }
- else{ this->setObjectName("LuminaDesktopPlugin"); }
- //Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...)
- //qDebug() << "set Objectname:" << id.section("---",0,0).section("::",0,0);
- this->setObjectName(id.section("---",0,0).section("::",0,0));
- }
+public:
+ LDPlugin(QWidget *parent = 0, QString id="unknown");
- ~LDPlugin(){
-
- }
+ ~LDPlugin(){}
QString ID(){
return PLUGID;
}
- void setInitialSize(int width, int height){
- //Note: Only run this in the plugin initization routine:
- // if the plugin is completely new (first time used), it will be this size
- if(settings->allKeys().isEmpty()){
- //Brand new plugin: set initial size
- settings->setValue("location/width",width);
- settings->setValue("location/height",height);
- settings->sync();
- }
+ void setInitialSize(int width, int height);
+
+ void saveSetting(QString var, QVariant val){
+ settings->setValue(prefix+var, val);
+ settings->sync();
}
-
- virtual void scalePlugin(double xscale, double yscale){
+
+ QVariant readSetting(QString var, QVariant defaultval){
+ return settings->value(prefix+var, defaultval);
+ }
+
+ void removeSettings(){ //such as when a plugin is deleted
+ QStringList list = settings->allKeys().filter(prefix);
+ for(int i=0; i<list.length(); i++){ settings->remove(list[i]); }
+ }
+
+ /*virtual void scalePlugin(double xscale, double yscale){
//This can be re-implemented in the subclassed plugin as necessary
// Example: If there are icons in the plugin which should also be re-scaled
@@ -82,7 +75,7 @@ public:
val = settings->value("location/y",0).toInt();
if(val>0){ val = qRound(val*yscale); }
settings->setValue("location/y",val);
- }
+ }*/
public slots:
virtual void LocaleChange(){
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h
index 04ae8262..0e570e26 100644
--- a/lumina-desktop/desktop-plugins/LDPluginContainer.h
+++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h
@@ -27,43 +27,31 @@ class LDPluginContainer : public QMdiSubWindow{
Q_OBJECT
private:
- QSettings *settings;
QTimer *syncTimer;
bool locked, setup;
-
+ LDPlugin *PLUG;
+
private slots:
void saveGeometry(){
- if(settings==0){ return; }
- settings->setValue("location/x", this->pos().x());
- settings->setValue("location/y", this->pos().y());
- settings->setValue("location/width", this->size().width());
- settings->setValue("location/height", this->size().height());
- settings->sync();
+ if(PLUG==0){ return; }
+ PLUG->saveSetting("location/x", this->pos().x());
+ PLUG->saveSetting("location/y", this->pos().y());
+ PLUG->saveSetting("location/width", this->size().width());
+ PLUG->saveSetting("location/height", this->size().height());
}
public:
LDPluginContainer(LDPlugin *plugin = 0, bool islocked = true) : QMdiSubWindow(){
locked = islocked;
setup=true;
+ PLUG = plugin;
syncTimer = new QTimer(this);
syncTimer->setInterval(500); //save settings 1 second after it is moved
syncTimer->setSingleShot(true); //no repeats
connect(syncTimer, SIGNAL(timeout()), this, SLOT(saveGeometry()) );
this->setWhatsThis(plugin->ID());
if(locked){ this->setWindowFlags(Qt::FramelessWindowHint); }
- else{ this->setWindowFlags(Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); }
- settings = plugin->settings; //save this pointer for access later
- if(settings!=0){
- if(settings->allKeys().isEmpty()){
- //Brand new plugin - no location/size info saved yet
- //save the initial size of the plugin - the initial location will be set automatically
- QSize sz = plugin->sizeHint();
- if(!sz.isValid()){ sz = QSize(64,64); }
- settings->setValue("location/width", sz.width());
- settings->setValue("location/height", sz.height());
- settings->sync();
- }
- }
+ else{ this->setWindowFlags(Qt::CustomizeWindowHint); }//Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); }
this->setContentsMargins(0,0,0,0);
if(!locked){
this->setWindowTitle( plugin->ID().replace("---"," - ") );
@@ -80,7 +68,7 @@ public:
}
void loadInitialPosition(){
- QRect set(settings->value("location/x",-12345).toInt(), settings->value("location/y",-12345).toInt(), settings->value("location/width",this->widget()->sizeHint().width()).toInt(), settings->value("location/height",this->widget()->sizeHint().height()).toInt());
+ QRect set(PLUG->readSetting("location/x",-12345).toInt(), PLUG->readSetting("location/y",-12345).toInt(), PLUG->readSetting("location/width",this->widget()->sizeHint().width()).toInt(), PLUG->readSetting("location/height",this->widget()->sizeHint().height()).toInt());
//qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height();
if(set.height() < 10){ set.setHeight(10); } //to prevent foot-shooting
if(set.width() < 10){ set.setWidth(10); } //to prevent foot-shooting
@@ -122,11 +110,10 @@ protected:
if( !this->whatsThis().isEmpty() && !locked){
//Plugin removed by the user - delete the settings file
locked = true; //ensure that the save settings routines don't do anything during the close
- //QFile::remove( settings->fileName() );
emit PluginRemoved( this->whatsThis() );
}
if(syncTimer->isActive()){ syncTimer->stop(); } //prevent save routine from running in a moment
- settings = 0; //ensure we don't touch the settings file after a close event
+ //settings = 0; //ensure we don't touch the settings file after a close event
QMdiSubWindow::closeEvent(event); //continue closing this window
}
diff --git a/lumina-desktop/desktop-plugins/NewDP.h b/lumina-desktop/desktop-plugins/NewDP.h
index 78f10981..b5881c4e 100644
--- a/lumina-desktop/desktop-plugins/NewDP.h
+++ b/lumina-desktop/desktop-plugins/NewDP.h
@@ -26,6 +26,7 @@
class NewDP{
public:
static LDPlugin* createPlugin(QString plugin, QWidget* parent=0){
+ //qDebug() << "Create Plugin:" << plugin;
LDPlugin *plug = 0;
if(plugin.section("---",0,0)=="sample"){
plug = new SamplePlugin(parent, plugin);
@@ -49,9 +50,10 @@ public:
}else{
qWarning() << "Invalid Desktop Plugin:"<<plugin << " -- Ignored";
}
+ //qDebug() << " -- done";
return plug;
}
};
-#endif \ No newline at end of file
+#endif
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index b3c6afcf..4dee95ca 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -13,11 +13,8 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
lay->addWidget(button, 0, Qt::AlignCenter);
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
menu = new QMenu(this);
- menu->addAction(LXDG::findIcon("zoom-in",""), tr("Increase Size"), this, SLOT(increaseIconSize()));
- menu->addAction(LXDG::findIcon("zoom-out",""), tr("Decrease Size"), this, SLOT(decreaseIconSize()));
- int icosize = settings->value("iconsize",64).toInt();
+ int icosize = this->readSetting("iconsize",64).toInt();
button->setIconSize(QSize(icosize,icosize));
- this->setInitialSize(icosize,icosize+10+this->fontMetrics().height());
this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(openContextMenu()) );
watcher = new QFileSystemWatcher(this);
@@ -27,23 +24,75 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
void AppLauncherPlugin::loadButton(){
QString def = this->ID().section("::",1,50).section("---",0,0).simplified();
- QString path = this->settings->value("applicationpath",def).toString(); //use the default if necessary
+ QString path = this->readSetting("applicationpath",def).toString(); //use the default if necessary
//qDebug() << "Default Application Launcher:" << def << path;
- bool ok = false;
- XDGDesktop file = LXDG::loadDesktopFile(path, ok);
- if(path.isEmpty() || !QFile::exists(path) || !ok){
- button->setWhatsThis("");
- button->setIcon( LXDG::findIcon("quickopen-file","") );
- button->setText( tr("Click to Set") );
+ bool ok = QFile::exists(path);
+ QString txt;
+ if(path.endsWith(".desktop") && ok){
+ XDGDesktop file = LXDG::loadDesktopFile(path, ok);
+ if(path.isEmpty() || !QFile::exists(path) || !ok){
+ button->setWhatsThis("");
+ button->setIcon( LXDG::findIcon("quickopen-file","") );
+ txt = tr("Click to Set");
+ if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
+ }else{
+ button->setWhatsThis(file.filePath);
+ button->setIcon( LXDG::findIcon(file.icon,"quickopen") );
+ txt = file.name;
+ if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
+ watcher->addPath(file.filePath); //make sure to update this shortcut if the file changes
+ }
+ }else if(ok){
+ QFileInfo info(path);
+ button->setWhatsThis(info.absoluteFilePath());
+ if(info.isDir()){
+ button->setIcon( LXDG::findIcon("folder","") );
+ }else if(LUtils::imageExtensions().contains(info.suffix().toLower()) ){
+ button->setIcon( QIcon(QPixmap(path).scaled(256,256)) ); //max size for thumbnails in memory
+ }else{
+ button->setIcon( LXDG::findMimeIcon(path) );
+ }
+ txt = info.fileName();
if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
+ watcher->addPath(path); //make sure to update this shortcut if the file changes
}else{
- button->setWhatsThis(file.filePath);
- button->setIcon( LXDG::findIcon(file.icon,"quickopen") );
- button->setText( this->fontMetrics().elidedText(file.name, Qt::ElideRight, 64) );
+ //InValid File
+ button->setWhatsThis("");
+ button->setIcon( LXDG::findIcon("quickopen","") );
+ button->setText( tr("Click to Set") );
if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
- watcher->addPath(file.filePath); //make sure to update this shortcut if the file changes
}
- this->adjustSize(); //make sure to adjust the button on first show.
+ //Now adjust the visible text as necessary based on font/grid sizing
+ button->setToolTip(txt);
+ int icosize = this->readSetting("iconsize",64).toInt();
+ //qDebug() << "Initial Button Text:" << txt << icosize;
+ if(button->fontMetrics().width(txt) > (icosize-2) ){
+ //int dash = this->fontMetrics().width("-");
+ //Text too long, try to show it on two lines
+ txt = txt.section(" ",0,2).replace(" ","\n"); //First take care of any natural breaks
+ if(txt.contains("\n")){
+ //need to check each line
+ QStringList txtL = txt.split("\n");
+ for(int i=0; i<txtL.length(); i++){ txtL[i] = button->fontMetrics().elidedText(txtL[i], Qt::ElideRight, icosize); }
+ txt = txtL.join("\n");
+ }else{
+ txt = this->fontMetrics().elidedText(txt,Qt::ElideRight, 2*icosize);
+ //Now split the line in half for the two lines
+ txt.insert( (txt.count()/2), "\n");
+ }
+ }
+ //qDebug() << " - Setting Button Text:" << txt;
+ button->setText(txt);
+ //Now setup the menu again
+ menu->clear();
+ menu->addAction(LXDG::findIcon("zoom-in",""), tr("Increase Size"), this, SLOT(increaseIconSize()));
+ menu->addAction(LXDG::findIcon("zoom-out",""), tr("Decrease Size"), this, SLOT(decreaseIconSize()));
+ if( !button->whatsThis().isEmpty() && button->whatsThis().startsWith(QDir::homePath()+"/Desktop") ){
+ menu->addAction(LXDG::findIcon("list-remove",""), tr("Delete File"), this, SLOT(deleteFile()) );
+ }
+
+ button->setFixedSize(icosize+4, icosize+8+(2*button->fontMetrics().height()) ); //make sure to adjust the button on first show.
+ this->setInitialSize(button->width()+4, button->height()+4);
QTimer::singleShot(100, this, SLOT(update()) ); //Make sure to re-draw the image in a moment
}
@@ -57,7 +106,7 @@ void AppLauncherPlugin::buttonClicked(){
bool ok = false;
QString app = QInputDialog::getItem(this, tr("Select Application"), tr("Name:"), names, 0, false, &ok);
if(!ok || names.indexOf(app)<0){ return; } //cancelled
- this->settings->setValue("applicationpath", apps[ names.indexOf(app) ].filePath);
+ this->saveSetting("applicationpath", apps[ names.indexOf(app) ].filePath);
QTimer::singleShot(0,this, SLOT(loadButton()));
}else{
LSession::LaunchApplication("lumina-open \""+path+"\"");
@@ -74,16 +123,25 @@ void AppLauncherPlugin::openContextMenu(){
}
void AppLauncherPlugin::increaseIconSize(){
- int icosize = settings->value("iconsize",64).toInt();
+ int icosize = this->readSetting("iconsize",64).toInt();
icosize += 16;
button->setIconSize(QSize(icosize,icosize));
- settings->setValue("iconsize",icosize);
+ this->saveSetting("iconsize",icosize);
+
}
void AppLauncherPlugin::decreaseIconSize(){
- int icosize = settings->value("iconsize",64).toInt();
+ int icosize = this->readSetting("iconsize",64).toInt();
if(icosize < 20){ return; } //cannot get smaller
icosize -= 16;
button->setIconSize(QSize(icosize,icosize));
- settings->setValue("iconsize",icosize);
+ this->saveSetting("iconsize",icosize);
}
+
+void AppLauncherPlugin::deleteFile(){
+ if(QFileInfo(button->whatsThis()).isDir()){
+ QProcess::startDetached("rm -r \""+button->whatsThis()+"\"");
+ }else{
+ QFile::remove(button->whatsThis());
+ }
+} \ No newline at end of file
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h
index 2c861e4d..fdb4e8f4 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h
@@ -41,6 +41,7 @@ private slots:
void increaseIconSize();
void decreaseIconSize();
+ void deleteFile();
};
#endif
diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
index b2ed3d03..cc1136f1 100644
--- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
+++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
@@ -256,7 +256,7 @@ void PlayerWidget::updateMaxProgress(qint64 val){
}
-AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID, true){
+AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID){
player = new PlayerWidget(this);
this->setLayout( new QVBoxLayout() );
this->layout()->setContentsMargins(0,0,0,0);
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
index 991abf2e..81f1281b 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
@@ -21,7 +21,7 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par
list->setSpacing(2);
list->setSelectionBehavior(QAbstractItemView::SelectItems);
list->setSelectionMode(QAbstractItemView::ExtendedSelection);
- //int icosize = settings->value("IconSize",64).toInt();
+ //int icosize = this->readSetting("IconSize",64).toInt();
//list->setIconSize(QSize(icosize,icosize));
//list->setUniformItemSizes(true);
list->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -42,10 +42,8 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par
}
this->layout()->addWidget(list);
this->setInitialSize(600,600);
- watcher = new QFileSystemWatcher(this);
- watcher->addPath(QDir::homePath()+"/Desktop");
- connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateContents()) );
-
+
+ connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateContents()) );
connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(runItems()) );
connect(list, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu(const QPoint&)) );
QTimer::singleShot(0,this, SLOT(updateContents()) );
@@ -116,21 +114,19 @@ void DesktopViewPlugin::showMenu(const QPoint &pos){
}
void DesktopViewPlugin::increaseIconSize(){
- int icosize = settings->value("IconSize",64).toInt();
+ int icosize = this->readSetting("IconSize",64).toInt();
icosize+=16; //go in orders of 16 pixels
//list->setIconSize(QSize(icosize,icosize));
- settings->setValue("IconSize",icosize);
- settings->sync();
+ this->saveSetting("IconSize",icosize);
updateContents();
}
void DesktopViewPlugin::decreaseIconSize(){
- int icosize = settings->value("IconSize",64).toInt();
+ int icosize = this->readSetting("IconSize",64).toInt();
if(icosize < 20){ return; } //too small to decrease more
icosize-=16; //go in orders of 16 pixels
//list->setIconSize(QSize(icosize,icosize));
- settings->setValue("IconSize",icosize);
- settings->sync();
+ this->saveSetting("IconSize",icosize);
updateContents();
}
@@ -140,7 +136,7 @@ void DesktopViewPlugin::updateContents(){
QList<QByteArray> fmt = QImageReader::supportedImageFormats();
for(int i=0; i<fmt.length(); i++){ imgExtensions << QString::fromLocal8Bit(fmt[i]); }
}*/
- int icosize = settings->value("IconSize",64).toInt();
+ int icosize = this->readSetting("IconSize",64).toInt();
QSize gridSZ = QSize(icosize+8,icosize+4+(2*this->fontMetrics().height()) );
//qDebug() << "Icon Size:" << icosize <<"Grid Size:" << gridSZ.width() << gridSZ.height();
list->setGridSize(gridSZ);
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
index d8f217f0..7a2d327b 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.h
@@ -25,7 +25,7 @@ public:
private:
QListWidget *list;
- QFileSystemWatcher *watcher;
+ //QFileSystemWatcher *watcher;
QMenu *menu;
//QStringList imgExtensions;
diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index dacaca60..7d9076c7 100644
--- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -7,7 +7,8 @@
#include <QFileDialog>
#include <QInputDialog>
-NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID, true){
+NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
+ //qDebug() << "Creating Notepad Plugin:";
QVBoxLayout *vlay = new QVBoxLayout();
this->setLayout( new QVBoxLayout() );
this->layout()->setContentsMargins(0,0,0,0);
@@ -54,34 +55,16 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID,
edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
vlay->addWidget(edit);
- //Special detection of the old notes format and conversion to the new files format
- if( this->settings->value("availableNotes",-1).toInt() > 0){
- qDebug() << "Converting all old desktop notes into the new file-based format (located at ~/Notes/<name>.note)";
- int notes = this->settings->value("availableNotes",1).toInt();
- int current = settings->value("currentNote",1).toInt();
- for(int i=0; i<(notes+1); i++){
- QString note = settings->value("Note-"+QString::number(i),"").toString();
- settings->remove("Note-"+QString::number(i));
- if(!note.isEmpty()){
- //Save this note in the new file format
- LUtils::writeFile(QDir::homePath()+"/Notes/Note-"+QString::number(i)+".note", note.split("\n"), true);
- }
- if(i==current){
- //Convert the current note value to the new format
- settings->setValue("currentFile", QDir::homePath()+"/Notes/Note-"+QString::number(i)+".note");
- }
- }
- //Clear the old settings-based values
- settings->remove("availableNotes");
- settings->remove("currentNote");
- }
//Now load the new file-based system for saving notes
- settings->setValue("customFile",""); //always clear this when the plugin is initialized (only maintained per-session)
+ //qDebug() << "Saving a new setting";
+ this->saveSetting("customFile",""); //always clear this when the plugin is initialized (only maintained per-session)
+ //qDebug() << "Loading Notes Dir";
notesDirChanged();
+ //qDebug() << "Set Sizing";
//Now setup the initial values for the plugin
this->setInitialSize(200,300);
-
+ //qDebug() << "Connect Signals/slots";
//Setup the button connections
connect(open, SIGNAL(clicked()), this, SLOT(openNote()) );
connect(add, SIGNAL(clicked()), this, SLOT(newNote()) );
@@ -92,7 +75,7 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID,
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(notesDirChanged()) ); //re-load the available notes
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(noteChanged()) ); //re-load the current file
QTimer::singleShot(0,this, SLOT(loadIcons()) );
-
+ //qDebug() << " - Done with init";
}
NotePadPlugin::~NotePadPlugin(){
@@ -133,7 +116,7 @@ void NotePadPlugin::openNote(){
}else{
//New note - add it to the end of the list and then load it
cnote->addItem(name, fullpath);
- settings->setValue("customFile", fullpath); //save this as a custom file
+ this->saveSetting("customFile", fullpath); //save this as a custom file
cnote->setCurrentIndex( cnote->count()-1 );
QTimer::singleShot(1000, this, SLOT(notesDirChanged())); //Make sure to refresh the list (only one custom file at a time)
}
@@ -179,7 +162,7 @@ void NotePadPlugin::remNote(){
QString note = cnote->currentData().toString();
if(note.isEmpty()){ return; }
watcher->removePath(note); //remove this file from the watcher
- settings->setValue("currentFile",""); //reset the internal value
+ this->saveSetting("currentFile",""); //reset the internal value
QFile::remove(note); //remove the file
//if(!note.startsWith(QDir::homePath()+"/Notes/") ){
//If the file was not in the notes directory, need to manually prompt for a re-load
@@ -206,14 +189,14 @@ void NotePadPlugin::updateContents(){
void NotePadPlugin::notesDirChanged(){
if(updating){ return; }
- QString cfile = settings->value("currentFile","").toString();
+ QString cfile = this->readSetting("currentFile","").toString();
QStringList notes;
QDir dir(QDir::homePath()+"/Notes");
QStringList files = dir.entryList(QStringList() << "*.note", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
for(int i=0; i<files.length(); i++){
notes << dir.absoluteFilePath(files[i]);
}
- QString custom = settings->value("customFile","").toString();
+ QString custom = this->readSetting("customFile","").toString();
if(!custom.isEmpty() && QFile::exists(custom) ){ notes << custom; }
//qDebug() << "Available Notes:" << notes << cfile;
//Now update the UI list
@@ -249,16 +232,16 @@ void NotePadPlugin::noteChanged(){
cnote->setCurrentIndex(0);
return;
}
- QString oldnote = settings->value("currentFile","").toString();
+ QString oldnote = this->readSetting("currentFile","").toString();
//qDebug() << "Note Changed:" << note << oldnote;
if( oldnote!=note ){
//Clear the old note file/setting
if(!oldnote.isEmpty()){
watcher->removePath(oldnote);
- settings->setValue("currentFile","");
+ this->saveSetting("currentFile","");
}
if(!note.isEmpty()){
- settings->setValue("currentFile",note);
+ this->saveSetting("currentFile",note);
watcher->addPath(note);
}
}
diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
index 0d568a45..981e411d 100644
--- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
+++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
@@ -49,7 +49,7 @@ void MonitorWidget::UpdateStats(){
// -- TO DO --
}
-SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID, true){
+SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(parent, ID){
monitor = new MonitorWidget(this);
this->setLayout( new QVBoxLayout() );
this->layout()->setContentsMargins(0,0,0,0);
diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro
index c6e67e00..204a449b 100644
--- a/lumina-desktop/lumina-desktop.pro
+++ b/lumina-desktop/lumina-desktop.pro
@@ -52,6 +52,7 @@ SOURCES += main.cpp \
panel-plugins/showdesktop/LHomeButton.cpp \
panel-plugins/appmenu/LAppMenuPlugin.cpp \
panel-plugins/applauncher/AppLaunchButton.cpp \
+ desktop-plugins/LDPlugin.cpp \
desktop-plugins/applauncher/AppLauncherPlugin.cpp \
desktop-plugins/desktopview/DesktopViewPlugin.cpp \
desktop-plugins/notepad/NotepadPlugin.cpp \
diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
index 163f7c0a..71eaa8c4 100644
--- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
+++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp
@@ -35,6 +35,7 @@ LDeskBarPlugin::LDeskBarPlugin(QWidget *parent, QString id, bool horizontal) : L
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(desktopChanged()) );
QTimer::singleShot(1,this, SLOT(desktopChanged()) ); //make sure to load it the first time
QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust sizes/layout
+ connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(desktopChanged()) );
}
LDeskBarPlugin::~LDeskBarPlugin(){
@@ -144,8 +145,7 @@ void LDeskBarPlugin::desktopChanged(){
QStringList newfavs = LUtils::listFavorites();
if(lastHomeUpdate.isNull() || (QFileInfo(QDir::homePath()+"/Desktop").lastModified() > lastHomeUpdate) || newfavs!=favs ){
favs = newfavs;
- QDir homedir = QDir( QDir::homePath()+"/Desktop");
- homefiles = homedir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
+ homefiles = LSession::handle()->DesktopFiles();
lastHomeUpdate = QDateTime::currentDateTime();
QStringList favitems = favs;
//Remember for format for favorites: <name>::::[app/dir/<mimetype>]::::<full path>
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
index 1b458f0c..519a5e23 100644
--- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
@@ -36,7 +36,8 @@ LSysTray::LSysTray(QWidget *parent, QString id, bool horizontal) : LPPlugin(pare
connect(upTimer, SIGNAL(timeout()), this, SLOT(checkAll()) );
isRunning = false; stopping = false; checking = false; pending = false;
QTimer::singleShot(100, this, SLOT(start()) );
-
+ //Also do one extra check a minute or so after startup (just in case something got missed in the initial flood of registrations)
+ QTimer::singleShot(90000,this, SLOT(checkAll()) );
connect(LSession::handle(), SIGNAL(TrayListChanged()), this, SLOT(checkAll()) );
connect(LSession::handle(), SIGNAL(TrayIconChanged(WId)), this, SLOT(UpdateTrayWindow(WId)) );
connect(LSession::handle(), SIGNAL(VisualTrayAvailable()), this, SLOT(start()) );
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index d1173ee1..bae14b5a 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -89,6 +89,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
lastUpdate = QDateTime(); //make sure it refreshes
connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu()) );
+ connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFavItems()) );
QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization
}
@@ -176,8 +177,7 @@ void UserWidget::updateFavItems(bool newfilter){
if(lastHomeUpdate.isNull() || (QFileInfo(QDir::homePath()+"/Desktop").lastModified() > lastHomeUpdate) || newfavs!=favs ){
favs = newfavs;
- QDir homedir = QDir( QDir::homePath()+"/Desktop");
- homefiles = homedir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
+ homefiles = LSession::handle()->DesktopFiles();
lastHomeUpdate = QDateTime::currentDateTime();
}else if(!newfilter){ return; } //nothing new to change - stop now
QStringList favitems;
bgstack15