aboutsummaryrefslogtreecommitdiff
path: root/lumina-config
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-config')
-rw-r--r--lumina-config/mainUI.cpp196
-rw-r--r--lumina-config/mainUI.ui29
2 files changed, 208 insertions, 17 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index dea72814..84ad4d56 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -186,6 +186,10 @@ void MainUI::setupConnections(){
//Defaults Page
//connect(ui->tool_defaults_addextension, SIGNAL(clicked()), this, SLOT(adddefaultextension()) );
//connect(ui->tool_defaults_addgroup, SIGNAL(clicked()), this, SLOT(adddefaultgroup()) );
+ connect(ui->tool_default_filemanager, SIGNAL(clicked()), this, SLOT(changeDefaultFileManager()) );
+ connect(ui->tool_default_terminal, SIGNAL(clicked()), this, SLOT(changeDefaultTerminal()) );
+ connect(ui->tool_default_webbrowser, SIGNAL(clicked()), this, SLOT(changeDefaultBrowser()) );
+ connect(ui->tool_default_email, SIGNAL(clicked()), this, SLOT(changeDefaultEmail()) );
connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) );
connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) );
connect(ui->tool_defaults_setbin, SIGNAL(clicked()), this, SLOT(setdefaultbinary()) );
@@ -1158,26 +1162,208 @@ void MainUI::getKeyPress(){
// Defaults Page
//===========
void MainUI::changeDefaultBrowser(){
-
+ //Prompt for the new app
+ XDGDesktop desk = getSysApp();
+ if(desk.filePath.isEmpty()){ return; }//nothing selected
+ //save the new app setting and adjust the button appearance
+ appsettings->setValue("default/webbrowser", desk.filePath);
+ QString tmp = desk.filePath;
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_webbrowser->setText(tmp.section("/",-1));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_webbrowser->setText(desk.name);
+ ui->tool_default_webbrowser->setIcon(LXDG::findIcon(desk.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_webbrowser->setText(tr("Click to Set"));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_webbrowser->setText(tmp.section("/",-1));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
}
void MainUI::changeDefaultEmail(){
-
+ //Prompt for the new app
+ XDGDesktop desk = getSysApp();
+ if(desk.filePath.isEmpty()){ return; }//nothing selected
+ //save the new app setting and adjust the button appearance
+ appsettings->setValue("default/email", desk.filePath);
+ QString tmp = desk.filePath;
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_email->setText(tmp.section("/",-1));
+ ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_email->setText(file.name);
+ ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_email->setText(tr("Click to Set"));
+ ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_email->setText(tmp.section("/",-1));
+ ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
}
void MainUI::changeDefaultFileManager(){
-
+ //Prompt for the new app
+ XDGDesktop desk = getSysApp();
+ if(desk.filePath.isEmpty()){ return; }//nothing selected
+ //save the new app setting and adjust the button appearance
+ appsettings->setValue("default/directory", desk.filePath);
+ QString tmp = desk.filePath;
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_filemanager->setText(tmp.section("/",-1));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_filemanager->setText(file.name);
+ ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_filemanager->setText(tr("Click to Set"));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_filemanager->setText(tmp.section("/",-1));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
}
void MainUI::changeDefaultTerminal(){
-
+ //Prompt for the new app
+ 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);
+ QString tmp = desk.filePath;
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_terminal->setText(tmp.section("/",-1));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_terminal->setText(file.name);
+ ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_terminal->setText(tr("Click to Set"));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_terminal->setText(tmp.section("/",-1));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
}
void MainUI::loadDefaultSettings(){
//First load the lumina-open specific defaults
+ // - Default File Manager
QString tmp = appsettings->value("default/directory", "lumina-fm").toString();
+ if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_filemanager->setText(tmp.section("/",-1));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_filemanager->setText(file.name);
+ ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_filemanager->setText(tr("Click to Set"));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_filemanager->setText(tmp.section("/",-1));
+ ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
+ // - Default Terminal
+ tmp = appsettings->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;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_terminal->setText(tmp.section("/",-1));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_terminal->setText(file.name);
+ ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_terminal->setText(tr("Click to Set"));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_terminal->setText(tmp.section("/",-1));
+ ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
+ // - Default Web Browser
+ tmp = appsettings->value("default/webbrowser", "").toString();
+ if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
+ if(tmp.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_webbrowser->setText(tmp.section("/",-1));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_webbrowser->setText(file.name);
+ ui->tool_default_webbrowser->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_webbrowser->setText(tr("Click to Set"));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_webbrowser->setText(tmp.section("/",-1));
+ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
+ // - 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")){
+ bool ok = false;
+ XDGDesktop file = LXDG::loadDesktopFile(tmp, ok);
+ if(!ok || file.filePath.isEmpty()){
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_email->setText(tmp.section("/",-1));
+ ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
+ }else{
+ ui->tool_default_email->setText(file.name);
+ ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") );
+ }
+ }else if(tmp.isEmpty()){
+ ui->tool_default_email->setText(tr("Click to Set"));
+ ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") );
+ }else{
+ //Might be a binary - just print out the raw "path"
+ ui->tool_default_email->setText(tmp.section("/",-1));
+ ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
+ }
-
//Now load the XDG mime defaults
ui->tree_defaults->clear();
QStringList defMimeList = LXDG::listFileMimeDefaults();
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index c3ed700a..2e17be03 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -375,8 +375,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>181</width>
- <height>113</height>
+ <width>192</width>
+ <height>115</height>
</rect>
</property>
<attribute name="label">
@@ -464,8 +464,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>106</height>
+ <width>191</width>
+ <height>107</height>
</rect>
</property>
<attribute name="label">
@@ -602,8 +602,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>181</width>
- <height>113</height>
+ <width>192</width>
+ <height>115</height>
</rect>
</property>
<attribute name="label">
@@ -691,8 +691,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>106</height>
+ <width>191</width>
+ <height>107</height>
</rect>
</property>
<attribute name="label">
@@ -1107,6 +1107,9 @@
<property name="text">
<string>...</string>
</property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
</widget>
</item>
<item row="1" column="1">
@@ -1114,6 +1117,9 @@
<property name="text">
<string>...</string>
</property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
</widget>
</item>
</layout>
@@ -1229,7 +1235,6 @@
</item>
</layout>
<zorder>tree_defaults</zorder>
- <zorder>tree_defaults</zorder>
<zorder></zorder>
</widget>
</item>
@@ -1530,8 +1535,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>118</width>
- <height>16</height>
+ <width>129</width>
+ <height>26</height>
</rect>
</property>
<property name="sizePolicy">
@@ -1638,7 +1643,7 @@
<x>0</x>
<y>0</y>
<width>579</width>
- <height>20</height>
+ <height>21</height>
</rect>
</property>
</widget>
bgstack15