aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaXDG.cpp25
-rw-r--r--libLumina/LuminaXDG.h1
-rw-r--r--lumina-config/mainUI.cpp77
-rw-r--r--lumina-config/mainUI.h3
-rw-r--r--lumina-config/mainUI.ui15
5 files changed, 89 insertions, 32 deletions
diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp
index 78e56823..9e8a8dce 100644
--- a/libLumina/LuminaXDG.cpp
+++ b/libLumina/LuminaXDG.cpp
@@ -253,7 +253,7 @@ bool LXDG::checkValidity(XDGDesktop dFile, bool showAll){
if(!showAll){
if(!dFile.showInList.isEmpty()){ ok = dFile.showInList.contains("Lumina", Qt::CaseInsensitive); }
else if(!dFile.notShowInList.isEmpty()){ ok = !dFile.notShowInList.contains("Lumina",Qt::CaseInsensitive); }
- else if(dFile.genericName.isEmpty()){ ok = false; }
+ else if(dFile.name.isEmpty()){ ok = false; }
}
return ok;
}
@@ -854,6 +854,11 @@ bool LXDG::setAutoStarted(bool autostart, XDGDesktop app){
QStringList paths = QString(getenv("XDG_CONFIG_DIRS")).split(":");
QString upath = QString(getenv("XDG_CONFIG_HOME")).section(":",0,0);
if(upath.isEmpty()){ upath = QDir::homePath()+"/.config/autostart/"; }
+ else{ upath.append("/autostart/"); }
+ //Quick check/finish for user-defined files which are getting disabled (just remove the file)
+ if(app.filePath.startsWith(upath) && !autostart){
+ return QFile::remove(app.filePath);
+ }
bool sysfile = false;
for(int i=0; i<paths.length(); i++){
if(app.filePath.startsWith(paths[i]+"/autostart/") ){
@@ -869,11 +874,11 @@ bool LXDG::setAutoStarted(bool autostart, XDGDesktop app){
app.exec = "lumina-open \""+app.filePath+"\"";
app.tryexec = app.filePath; //make sure this file exists
if(app.name.isEmpty()){ app.name = app.filePath.section("/",-1); }
- if(app.icon.isEmpty()){ app.icon = LXDG::findAppMimeForFile(app.filePath); }
+ if(app.icon.isEmpty()){ app.icon = LXDG::findAppMimeForFile(app.filePath); app.icon.replace("/","-"); }
app.filePath = upath+app.filePath.section("/",-1)+".desktop";
app.type = XDGDesktop::APP;
}else{
- //Some other *.desktop file on the system
+ //Some other *.desktop file on the system (keep almost all the existing settings/values)
// - setup a redirect to the other file
app.exec = "lumina-open \""+app.filePath+"\"";
app.tryexec = app.filePath; //make sure this file exists
@@ -885,6 +890,7 @@ bool LXDG::setAutoStarted(bool autostart, XDGDesktop app){
app.isHidden = !autostart; //if hidden, it will not be autostarted
//Now save the file as necessary
bool saved = false;
+ //qDebug() << " - Saving AutoStart File:" << app.filePath << app.name << app.isHidden;
if(sysfile){
//Just an override file for the "hidden" field - nothing more
QStringList info;
@@ -897,3 +903,16 @@ bool LXDG::setAutoStarted(bool autostart, XDGDesktop app){
return saved;
}
+bool LXDG::setAutoStarted(bool autostart, QString filePath){
+ //Convenience function for the auto-start setter
+ XDGDesktop desk;
+ if(filePath.endsWith(".desktop")){
+ bool ok = false;
+ desk = LXDG::loadDesktopFile(filePath, ok);
+ if(!ok){ return false; } //error reading input file
+ }else{
+ desk.filePath = filePath;
+ desk.useTerminal = false;
+ }
+ return LXDG::setAutoStarted(autostart, desk);
+}
diff --git a/libLumina/LuminaXDG.h b/libLumina/LuminaXDG.h
index a66e3ad2..1361ba7c 100644
--- a/libLumina/LuminaXDG.h
+++ b/libLumina/LuminaXDG.h
@@ -104,6 +104,7 @@ public:
//Find all the autostart *.desktop files
static QList<XDGDesktop> findAutoStartFiles(bool includeInvalid = false);
static bool setAutoStarted(bool autostart, XDGDesktop app);
+ static bool setAutoStarted(bool autostart, QString filePath); //for convenience
};
#endif
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index b548d7cd..6d43308e 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -128,7 +128,7 @@ void MainUI::setupIcons(){
ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_defaults), LXDG::findIcon("preferences-desktop-filetype-association", "") );
//Session Page
- ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") );
+ //ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") );
ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") );
ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") );
ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") );
@@ -217,7 +217,7 @@ void MainUI::setupConnections(){
connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) );
connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) );
connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) );
- connect(ui->tool_session_rmapp, SIGNAL(clicked()), this, SLOT(rmsessionstartitem()) );
+ //connect(ui->tool_session_rmapp, SIGNAL(clicked()), this, SLOT(rmsessionstartitem()) );
connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) );
@@ -225,7 +225,8 @@ void MainUI::setupConnections(){
connect(ui->check_session_playloginaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) );
- connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) );
+ //connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) );
+ connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(sessionoptchanged()) );
connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
@@ -771,7 +772,7 @@ void MainUI::saveCurrentSettings(bool screenonly){
moddesk = modpan = false;
if(!screenonly){ modmenu = modshort = moddef = modses = false; }
ui->push_save->setEnabled(modmenu || modshort || moddef || modses); //wait for new changes
- ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses);
+ //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses);
}
@@ -1810,8 +1811,21 @@ void MainUI::loadSessionSettings(){
//Now do the startup applications
QStringList STARTUP = readFile(QDir::homePath()+"/.lumina/startapps");
+ STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items
+ //qDebug() << "StartApps:";
ui->list_session_start->clear();
- for(int i=0; i<STARTUP.length(); i++){
+ for(int i=0; i<STARTAPPS.length(); i++){
+ //qDebug() << STARTAPPS[i].filePath +" -> " +STARTAPPS[i].name << STARTAPPS[i].isHidden;
+ if( !LXDG::checkValidity(STARTAPPS[i],false) || !QFile::exists(STARTAPPS[i].filePath) ){ continue; }
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i].icon,"application-x-executable"), STARTAPPS[i].name );
+ it->setWhatsThis(STARTAPPS[i].filePath); //keep the file location
+ it->setToolTip(STARTAPPS[i].comment);
+ if(STARTAPPS[i].isHidden){ it->setCheckState( Qt::Unchecked); }
+ else{it->setCheckState( Qt::Checked); }
+ ui->list_session_start->addItem(it);
+ }
+
+ /*for(int i=0; i<STARTUP.length(); i++){
if(STARTUP[i].startsWith("#")){ continue; }
else if(STARTUP[i].startsWith("lumina-open ")){
//Application or file
@@ -1835,7 +1849,7 @@ void MainUI::loadSessionSettings(){
it->setWhatsThis(STARTUP[i]); //keep the raw line
ui->list_session_start->addItem(it);
}
- }
+ }*/
//Now do the general session options
ui->check_session_numlock->setChecked( sessionsettings->value("EnableNumlock", true).toBool() );
@@ -1900,7 +1914,7 @@ void MainUI::loadSessionSettings(){
// - Font Size
ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() );
- sessionstartchanged(); //make sure to update buttons
+ //sessionstartchanged(); //make sure to update buttons
sessionLoadTimeSample();
sessionLoadDateSample();
}
@@ -1931,14 +1945,35 @@ void MainUI::saveSessionSettings(){
//Save the fluxbox settings
bool ok = overwriteFile(QDir::homePath()+"/.lumina/fluxbox-init", FB);
- if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; }
+ if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/fluxbox-init"; }
+
//Now do the start apps
- QStringList STARTUP;
+ bool newstartapps = false;
for(int i=0; i<ui->list_session_start->count(); i++){
- STARTUP << ui->list_session_start->item(i)->whatsThis();
+ QString file = ui->list_session_start->item(i)->whatsThis();
+ bool enabled = ui->list_session_start->item(i)->checkState()==Qt::Checked;
+ bool found = false;
+ for(int i=0; i<STARTAPPS.length(); i++){
+ if(STARTAPPS[i].filePath==file){
+ found = true;
+ if(enabled != !STARTAPPS[i].isHidden){
+ //value is different
+ qDebug() << "Setting Autostart:" << enabled << STARTAPPS[i].filePath;
+ LXDG::setAutoStarted(enabled, STARTAPPS[i]);
+ }
+ break;
+ }
+ }
+ if(!found && enabled){
+ //New file/binary/app
+ qDebug() << "Adding new AutoStart File:" << file;
+ LXDG::setAutoStarted(enabled, file);
+ newstartapps = true;
+ }
}
- ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP);
- if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; }
+
+ //ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP);
+ //if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; }
//Now do the general session options
sessionsettings->setValue("EnableNumlock", ui->check_session_numlock->isChecked());
@@ -1964,6 +1999,7 @@ void MainUI::saveSessionSettings(){
QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt";
//qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize;
LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize);
+ if(newstartapps){ loadSessionSettings(); } //make sure to re-load the session settings to catch the new files
}
void MainUI::rmsessionstartitem(){
@@ -1977,7 +2013,10 @@ void MainUI::addsessionstartapp(){
XDGDesktop desk = getSysApp();
if(desk.filePath.isEmpty()){ return; } //cancelled
QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name );
- it->setWhatsThis("lumina-open "+desk.filePath); //command to be saved/run
+ it->setWhatsThis(desk.filePath);
+ it->setToolTip(desk.comment);
+ it->setCheckState(Qt::Checked);
+
ui->list_session_start->addItem(it);
ui->list_session_start->setCurrentItem(it);
sessionoptchanged();
@@ -1994,6 +2033,8 @@ void MainUI::addsessionstartbin(){
}
QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) );
it->setWhatsThis(bin); //command to be saved/run
+ it->setToolTip(bin);
+ it->setCheckState(Qt::Checked);
ui->list_session_start->addItem(it);
ui->list_session_start->setCurrentItem(it);
sessionoptchanged();
@@ -2003,8 +2044,10 @@ void MainUI::addsessionstartfile(){
QString chkpath = QDir::homePath();
QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") );
if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled
- QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("unknown",""), bin.section("/",-1) );
- it->setWhatsThis("lumina-open "+bin); //command to be saved/run
+ QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) );
+ it->setWhatsThis(bin); //file to be saved/run
+ it->setToolTip(bin);
+ it->setCheckState(Qt::Checked);
ui->list_session_start->addItem(it);
ui->list_session_start->setCurrentItem(it);
sessionoptchanged();
@@ -2029,9 +2072,9 @@ void MainUI::sessionthemechanged(){
sessionoptchanged();
}
-void MainUI::sessionstartchanged(){
+/*void MainUI::sessionstartchanged(){
ui->tool_session_rmapp->setEnabled( ui->list_session_start->currentRow()>=0 );
-}
+}*/
void MainUI::sessionEditColor(){
//Get the current color file
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 2593d648..397f750b 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -57,6 +57,7 @@ private:
QString panelcolor;
QString DEFAULTBG;
QList<XDGDesktop> sysApps;
+ QList<XDGDesktop> STARTAPPS;
bool loading, panadjust;
bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags
int panelnumber;
@@ -164,7 +165,7 @@ private slots:
void addsessionstartfile();
void sessionoptchanged();
void sessionthemechanged();
- void sessionstartchanged();
+ //void sessionstartchanged();
void sessionEditColor();
void sessionEditTheme();
void sessionChangeUserIcon();
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index 791165d7..99cf6f83 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -109,7 +109,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="currentIndex">
- <number>1</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="page_desktop">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -602,7 +602,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>249</width>
+ <width>238</width>
<height>215</height>
</rect>
</property>
@@ -836,7 +836,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>249</width>
+ <width>238</width>
<height>209</height>
</rect>
</property>
@@ -1224,13 +1224,6 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
- <widget class="QToolButton" name="tool_session_rmapp">
- <property name="text">
- <string notr="true">rem</string>
- </property>
- </widget>
- </item>
- <item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -1876,7 +1869,7 @@
<x>0</x>
<y>0</y>
<width>129</width>
- <height>16</height>
+ <height>28</height>
</rect>
</property>
<property name="sizePolicy">
bgstack15