aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-config/mainUI.cpp68
-rw-r--r--lumina-config/mainUI.h2
-rw-r--r--lumina-config/mainUI.ui75
-rw-r--r--lumina-open/LFileDialog.cpp15
4 files changed, 40 insertions, 120 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index 84ad4d56..ae4ec122 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -100,8 +100,6 @@ void MainUI::setupIcons(){
ui->tool_menu_rm->setIcon( LXDG::findIcon("list-remove","") );
ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") );
ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") );
- ui->tool_menu_findterm->setIcon( LXDG::findIcon("system-search","") );
- ui->tool_menu_findfm->setIcon( LXDG::findIcon("system-search","") );
//Shortcuts Page
ui->tool_shortcut_set->setIcon( LXDG::findIcon("input-keyboard","") );
@@ -173,11 +171,7 @@ void MainUI::setupConnections(){
connect(ui->tool_menu_rm, SIGNAL(clicked()), this, SLOT(rmmenuplugin()) );
connect(ui->tool_menu_up, SIGNAL(clicked()), this, SLOT(upmenuplugin()) );
connect(ui->tool_menu_dn, SIGNAL(clicked()), this, SLOT(downmenuplugin()) );
- connect(ui->tool_menu_findterm, SIGNAL(clicked()), this, SLOT(findmenuterminal()) );
- connect(ui->tool_menu_findfm, SIGNAL(clicked()), this, SLOT(findmenufilemanager()) );
connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) );
- connect(ui->line_menu_term, SIGNAL(textChanged(QString)), this, SLOT(checkmenuicons()) );
- connect(ui->line_menu_fm, SIGNAL(textChanged(QString)), this, SLOT(checkmenuicons()) );
//Shortcuts Page
connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) );
@@ -521,8 +515,8 @@ void MainUI::loadCurrentSettings(bool screenonly){
if(!screenonly){
// Menu Page
//Default terminal and filemanager binary
- ui->line_menu_term->setText( settings->value("default-terminal","xterm").toString() );
- ui->line_menu_fm->setText( settings->value("default-filemanager","lumina-fm").toString() );
+ //ui->line_menu_term->setText( settings->value("default-terminal","xterm").toString() );
+ //ui->line_menu_fm->setText( settings->value("default-filemanager","lumina-fm").toString() );
//Menu Items
QStringList items = settings->value("menu/itemlist", QStringList() ).toStringList();
if(items.isEmpty()){ items << "terminal" << "filemanager" << "applications" << "line" << "settings"; }
@@ -636,14 +630,11 @@ void MainUI::saveCurrentSettings(bool screenonly){
// Menu Page
if(modmenu && !screenonly){
- sessionsettings->setValue("default-terminal", ui->line_menu_term->text() );
- sessionsettings->setValue("default-filemanager", ui->line_menu_fm->text() );
- appsettings->setValue("default/directory", ui->line_menu_fm->text() );
- QStringList items;
- for(int i=0; i<ui->list_menu->count(); i++){
- items << ui->list_menu->item(i)->whatsThis();
- }
- settings->setValue("menu/itemlist", items);
+ QStringList items;
+ for(int i=0; i<ui->list_menu->count(); i++){
+ items << ui->list_menu->item(i)->whatsThis();
+ }
+ settings->setValue("menu/itemlist", items);
}
//Shortcuts page
@@ -1031,43 +1022,10 @@ void MainUI::downmenuplugin(){
modmenu = true;
}
-void MainUI::findmenuterminal(){
- QString chkpath = LOS::AppPrefix() + "bin";
- if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); }
- QString bin = QFileDialog::getOpenFileName(this, tr("Set Default Terminal Application"), chkpath, tr("Application Binaries (*)") );
- if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled
- if( !QFileInfo(bin).isExecutable() ){
- QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!"));
- return;
- }
- ui->line_menu_term->setText(bin);
- ui->push_save->setEnabled(true);
- modmenu = true;
-}
-
-void MainUI::findmenufilemanager(){
- QString chkpath = LOS::AppPrefix() + "bin";
- if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); }
- QString bin = QFileDialog::getOpenFileName(this, tr("Set Default File Manager"), chkpath, tr("Application Binaries (*)") );
- if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled
- if( !QFileInfo(bin).isExecutable() ){
- QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!"));
- return;
- }
- ui->line_menu_fm->setText(bin);
- ui->push_save->setEnabled(true);
- modmenu = true;
-}
-
void MainUI::checkmenuicons(){
ui->tool_menu_up->setEnabled( ui->list_menu->currentRow() > 0 );
ui->tool_menu_dn->setEnabled( ui->list_menu->currentRow() < (ui->list_menu->count()-1) );
ui->tool_menu_rm->setEnabled( ui->list_menu->currentRow() >=0 );
- if( sessionsettings->value("default-terminal","xterm").toString() != ui->line_menu_term->text() ||
- sessionsettings->value("default-filemanager","lumina-fm").toString() != ui->line_menu_fm->text()){
- ui->push_save->setEnabled(true);
- modmenu = true;
- }
}
//===========
@@ -1223,6 +1181,7 @@ void MainUI::changeDefaultFileManager(){
if(desk.filePath.isEmpty()){ return; }//nothing selected
//save the new app setting and adjust the button appearance
appsettings->setValue("default/directory", desk.filePath);
+ sessionsettings->setValue("default-filemanager", desk.filePath);
QString tmp = desk.filePath;
if(tmp.endsWith(".desktop")){
bool ok = false;
@@ -1250,7 +1209,7 @@ void MainUI::changeDefaultTerminal(){
XDGDesktop desk = getSysApp();
if(desk.filePath.isEmpty()){ return; }//nothing selected
//save the new app setting and adjust the button appearance
- appsettings->setValue("default/terminal", desk.filePath);
+ sessionsettings->setValue("default-terminal", desk.filePath);
QString tmp = desk.filePath;
if(tmp.endsWith(".desktop")){
bool ok = false;
@@ -1276,7 +1235,10 @@ void MainUI::changeDefaultTerminal(){
void MainUI::loadDefaultSettings(){
//First load the lumina-open specific defaults
// - Default File Manager
- QString tmp = appsettings->value("default/directory", "lumina-fm").toString();
+ QString tmp = sessionsettings->value("default-filemanager", "lumina-fm").toString();
+ if( tmp!=appsettings->value("default/directory", "").toString() ){
+ appsettings->setValue("default/directory", tmp); //make sure they are consistent
+ }
if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
if(tmp.endsWith(".desktop")){
bool ok = false;
@@ -1298,7 +1260,7 @@ void MainUI::loadDefaultSettings(){
ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
}
// - Default Terminal
- tmp = appsettings->value("default/terminal", "xterm").toString();
+ tmp = sessionsettings->value("default-terminal", "xterm").toString();
if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
if(tmp.endsWith(".desktop")){
bool ok = false;
@@ -1344,7 +1306,7 @@ void MainUI::loadDefaultSettings(){
// - Default Email Client
tmp = appsettings->value("default/email", "").toString();
if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
- if(tmp.endsWith("*.desktop")){
+ if(tmp.endsWith(".desktop")){
bool ok = false;
XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
if(!ok || file.filePath.isEmpty()){
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 4662f763..227f4aef 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -126,8 +126,6 @@ private slots:
void rmmenuplugin();
void upmenuplugin();
void downmenuplugin();
- void findmenuterminal();
- void findmenufilemanager();
void checkmenuicons();
//Shortcuts Page
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index 2e17be03..7495240a 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -97,7 +97,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="currentIndex">
- <number>4</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="page_desktop">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -375,8 +375,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>192</width>
- <height>115</height>
+ <width>265</width>
+ <height>193</height>
</rect>
</property>
<attribute name="label">
@@ -464,8 +464,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>191</width>
- <height>107</height>
+ <width>177</width>
+ <height>106</height>
</rect>
</property>
<attribute name="label">
@@ -602,8 +602,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>192</width>
- <height>115</height>
+ <width>266</width>
+ <height>193</height>
</rect>
</property>
<attribute name="label">
@@ -691,8 +691,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>191</width>
- <height>107</height>
+ <width>177</width>
+ <height>106</height>
</rect>
</property>
<attribute name="label">
@@ -778,28 +778,7 @@
</widget>
<widget class="QWidget" name="page_menu">
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_14">
- <item>
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Terminal Command:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="line_menu_term"/>
- </item>
- <item>
- <widget class="QToolButton" name="tool_menu_findterm">
- <property name="text">
- <string notr="true">find</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
+ <item row="0" column="0">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -812,10 +791,10 @@
</property>
</spacer>
</item>
- <item row="2" column="1">
+ <item row="0" column="1">
<widget class="QListWidget" name="list_menu"/>
</item>
- <item row="2" column="2">
+ <item row="0" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -828,7 +807,7 @@
</property>
</spacer>
</item>
- <item row="3" column="1">
+ <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QToolButton" name="tool_menu_add">
@@ -873,30 +852,6 @@
</item>
</layout>
</item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_18">
- <property name="topMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_15">
- <property name="text">
- <string>File Manager:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="line_menu_fm"/>
- </item>
- <item>
- <widget class="QToolButton" name="tool_menu_findfm">
- <property name="text">
- <string>find</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
<widget class="QWidget" name="page_shortcuts">
@@ -1535,7 +1490,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>129</width>
+ <width>118</width>
<height>26</height>
</rect>
</property>
@@ -1643,7 +1598,7 @@
<x>0</x>
<y>0</y>
<width>579</width>
- <height>21</height>
+ <height>20</height>
</rect>
</property>
</widget>
diff --git a/lumina-open/LFileDialog.cpp b/lumina-open/LFileDialog.cpp
index dfd70ba2..0f2ab1cf 100644
--- a/lumina-open/LFileDialog.cpp
+++ b/lumina-open/LFileDialog.cpp
@@ -47,12 +47,17 @@ QString LFileDialog::getDefaultApp(QString extension){
}
void LFileDialog::setDefaultApp(QString extension, QString appFile){
- QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
- if(appFile.isEmpty()){
- QSettings("LuminaDE", "lumina-open").remove("default/"+extension);
+ if(extension.contains("/")){
+ //mime type default: set on the system itself
+ LXDG::setDefaultAppForMime(extension, appFile);
}else{
- QSettings("LuminaDE", "lumina-open").setValue("default/"+extension,appFile);
- }
+ QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
+ if(appFile.isEmpty()){
+ QSettings("LuminaDE", "lumina-open").remove("default/"+extension);
+ }else{
+ QSettings("LuminaDE", "lumina-open").setValue("default/"+extension,appFile);
+ }
+ }
}
// -----------
bgstack15