aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-09-29 10:18:14 -0400
committerKen Moore <ken@pcbsd.org>2014-09-29 10:18:14 -0400
commitf11d2a7d2b38d751d50ecfe6349039447d80fb15 (patch)
tree92833d6338e0ff0df59634e2a0c606578c89af6d /lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
parentMerge pull request #11 from slicer69/master (diff)
downloadlumina-f11d2a7d2b38d751d50ecfe6349039447d80fb15.tar.gz
lumina-f11d2a7d2b38d751d50ecfe6349039447d80fb15.tar.bz2
lumina-f11d2a7d2b38d751d50ecfe6349039447d80fb15.zip
A few updates to plugins:
UserButton: 1) When creating links, always create them in ~/.lumina/favorites 2) Scan both the Desktop and the favorites dir for favorite items 3) Distinguish between removing a link and deleting a file 4) Allow for setting links to directories 5) Allow removing links to directories AppLauncher desktop plugin: 1) Make sure to use the session function for launching an item (makes the mouse cursor show the loading icon). 2) Allow for pre-defining a file path for the launcher (syntax: applauncher::<path to file>)
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton/UserWidget.cpp')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index f7a932ad..d1cf82d4 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -157,19 +157,26 @@ void UserWidget::FavChanged(){
void UserWidget::updateFavItems(){
ClearScrollArea(ui->scroll_fav);
- QStringList items;
+ QFileInfoList items;
QDir homedir = QDir( QDir::homePath()+"/Desktop");
- if(ui->tool_fav_apps->isChecked()){ items = homedir.entryList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name); }
- else if(ui->tool_fav_dirs->isChecked()){ items = homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); }
- else{
+ QDir favdir = QDir( QDir::homePath()+"/.lumina/favorites");
+ if(!favdir.exists()){ favdir.mkpath( QDir::homePath()+"/.lumina/favorites"); }
+ if(ui->tool_fav_apps->isChecked()){
+ items = homedir.entryInfoList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ items << favdir.entryInfoList(QStringList()<<"*.desktop", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ }else if(ui->tool_fav_dirs->isChecked()){
+ items = homedir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ items << favdir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ }else{
//Files
- items = homedir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ items = homedir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ items << favdir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
for(int i=0; i<items.length(); i++){
- if(items[i].endsWith(".desktop")){ items.removeAt(i); i--; }
+ if(items[i].suffix()=="desktop"){ items.removeAt(i); i--; }
}
}
for(int i=0; i<items.length(); i++){
- UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), homedir.absoluteFilePath(items[i]), ui->tool_fav_dirs->isChecked());
+ UserItemWidget *it = new UserItemWidget(ui->scroll_fav->widget(), items[i].absoluteFilePath(), ui->tool_fav_dirs->isChecked());
ui->scroll_fav->widget()->layout()->addWidget(it);
connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
bgstack15