diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-08 18:39:09 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-08 18:39:09 -0400 |
commit | 5c835e6906cffe08b629f3abd19bc2f746fbf88e (patch) | |
tree | 56e42c2488fcfd51b1c523fc92d204f8c42bd271 | |
parent | Oops, forgot to add in a couple new files for lumina-xconfig. (diff) | |
parent | Move the lumina-open.conf file over to the standard XDG location (~/.config/l... (diff) | |
download | lumina-5c835e6906cffe08b629f3abd19bc2f746fbf88e.tar.gz lumina-5c835e6906cffe08b629f3abd19bc2f746fbf88e.tar.bz2 lumina-5c835e6906cffe08b629f3abd19bc2f746fbf88e.zip |
Merge branch 'master' of github.com:pcbsd/lumina
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainUI.cpp | 10 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.cpp | 15 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 19 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-open/LFileDialog.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 6 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 6 |
7 files changed, 33 insertions, 33 deletions
diff --git a/src-qt5/core-utils/lumina-config/mainUI.cpp b/src-qt5/core-utils/lumina-config/mainUI.cpp index 5062a5ef..bd2bf695 100644 --- a/src-qt5/core-utils/lumina-config/mainUI.cpp +++ b/src-qt5/core-utils/lumina-config/mainUI.cpp @@ -1136,7 +1136,8 @@ void MainUI::changeDefaultEmail(){ desk.filePath=""; } //save the new app setting and adjust the button appearance - appsettings->setValue("default/email", desk.filePath); + LXDG::setDefaultAppForMime("application/email",desk.filePath); + // appsettings->setValue("default/email", desk.filePath); QString tmp = desk.filePath; if(tmp.endsWith(".desktop")){ bool ok = false; @@ -1200,7 +1201,8 @@ void MainUI::changeDefaultTerminal(){ desk.filePath="xterm"; } //save the new app setting and adjust the button appearance - sessionsettings->setValue("default-terminal", desk.filePath); + LXDG::setDefaultAppForMime("application/terminal",desk.filePath); + //sessionsettings->setValue("default-terminal", desk.filePath); QString tmp = desk.filePath; if(tmp.endsWith(".desktop")){ bool ok = false; @@ -1249,7 +1251,7 @@ void MainUI::loadDefaultSettings(){ ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); } // - Default Terminal - tmp = sessionsettings->value("default-terminal", "xterm").toString(); + tmp =LXDG::findDefaultAppForMime("application/terminal"); //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; @@ -1293,7 +1295,7 @@ void MainUI::loadDefaultSettings(){ ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); } // - Default Email Client - tmp = appsettings->value("default/email", "").toString(); + tmp = LXDG::findDefaultAppForMime("application/email"); //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; diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 5340d223..28ef5ad3 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -623,17 +623,20 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(var=="session_enablenumlock"){ sset = "EnableNumlock="+ istrue; } else if(var=="session_playloginaudio"){ sset = "PlayStartupAudio="+istrue; } else if(var=="session_playlogoutaudio"){ sset = "PlayLogoutAudio="+istrue; } - else if(var=="session_default_terminal"){ sset = "default-terminal="+val; } - else if(var=="session_default_filemanager"){ + else if(var=="session_default_terminal"){ + LXDG::setDefaultAppForMime("application/terminal", val); + //sset = "default-terminal="+val; + }else if(var=="session_default_filemanager"){ LXDG::setDefaultAppForMime("inode/directory", val); - sset = "default-filemanager="+val; - loset = "directory="+val; + //sset = "default-filemanager="+val; + //loset = "directory="+val; }else if(var=="session_default_webbrowser"){ - loset = "webbrowser="+val; + //loset = "webbrowser="+val; LXDG::setDefaultAppForMime("x-scheme-handler/http", val); LXDG::setDefaultAppForMime("x-scheme-handler/https", val); }else if(var=="session_default_email"){ - loset = "email="+val; + LXDG::setDefaultAppForMime("application/email",val); + //loset = "email="+val; } //Put the line into the file (overwriting any previous assignment as necessary) if(!loset.isEmpty()){ diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index bfca4f71..68cd84bc 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -859,13 +859,15 @@ QString LXDG::findDefaultAppForMime(QString mime){ if(!QFile::exists(dirs[i])){ continue; } QStringList info = LUtils::readFile(dirs[i]); if(info.isEmpty()){ continue; } - QString workdir = dirs[i].section("/",0,-1); //just the directory + QString workdir = dirs[i].section("/",0,-2); //just the directory + // qDebug() << "Check File:" << mime << dirs[i] << workdir; int def = info.indexOf("[Default Applications]"); //find this line to start on if(def>=0){ for(int d=def+1; d<info.length(); d++){ + //qDebug() << "Check Line:" << info[d]; if(info[d].startsWith("[")){ break; } //starting a new section now - finished with defaults if(info[d].contains(mime+"=")){ - white << info[d].section("=",1,50).split(";"); + white << info[d].section("=",1,-1).split(";"); break; } } @@ -884,17 +886,8 @@ QString LXDG::findDefaultAppForMime(QString mime){ else if( QFile::exists(workdir+"/"+white[w]) ){ cdefault=workdir+"/"+white[w]; break; } //Now go through the XDG DATA dirs and see if the file is in there else{ - QStringList xdirs; - xdirs << QString(getenv("XDG_DATA_HOME"))+"/applications/"; - tmp = QString(getenv("XDG_DATA_DIRS")).split(":"); - for(int t=0; t<tmp.length(); t++){ xdirs << tmp[t]+"/applications/"; } - //Now scan these dirs - bool found = false; - //qDebug() << "Scan dirs:" << white[w] << xdirs; - for(int x=0; x<xdirs.length() && !found; x++){ - if(QFile::exists(xdirs[x]+white[w])){cdefault=xdirs[x]+white[w]; found = true; } - } - if(found){ break; } + white[w] = LUtils::AppToAbsolute(white[w]); + if(QFile::exists(white[w])){ cdefault = white[w]; } } } /* WRITTEN BUT UNUSED CODE FOR MIMETYPE ASSOCIATIONS diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index 113b7efc..11d99581 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -104,7 +104,7 @@ void LDesktop::SystemLogout(){ void LDesktop::SystemTerminal(){ LSession::handle()->sessionSettings()->sync(); //make sure it is up to date - QString term = LSession::handle()->sessionSettings()->value("default-terminal","xterm").toString(); + QString term = LXDG::findDefaultAppForMime("application/terminal"); //LSession::handle()->sessionSettings()->value("default-terminal","xterm").toString(); if(term.endsWith(".desktop")){ term = "lumina-open \""+term+"\""; } LSession::LaunchApplication(term); } diff --git a/src-qt5/core/lumina-open/LFileDialog.cpp b/src-qt5/core/lumina-open/LFileDialog.cpp index c0417935..9ec94bf5 100644 --- a/src-qt5/core/lumina-open/LFileDialog.cpp +++ b/src-qt5/core/lumina-open/LFileDialog.cpp @@ -15,8 +15,8 @@ LFileDialog::LFileDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LFileDia appExec.clear(); appPath.clear(); appFile.clear(); - QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); - settings = new QSettings("LuminaDE", "lumina-open",this); + //QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); + settings = new QSettings("lumina-desktop", "lumina-open", this); //Connect the signals/slots connect(ui->combo_apps, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI()) ); connect(ui->radio_rec, SIGNAL(toggled(bool)), this, SLOT(radioChanged()) ); @@ -46,6 +46,7 @@ void LFileDialog::setFileInfo(QString filename, QString extension, bool isFile){ //static functions QString LFileDialog::getDefaultApp(QString extension){ + qDebug() << "Get Default App:" << extension; QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); if(extension.contains("/")){ return LXDG::findDefaultAppForMime(extension); @@ -66,7 +67,7 @@ void LFileDialog::setDefaultApp(QString extension, QString appFile){ }else{ QSettings("LuminaDE", "lumina-open").setValue("default/"+extension,appFile); } - } + } } // ----------- @@ -283,4 +284,3 @@ void LFileDialog::on_tool_findBin_clicked(){ void LFileDialog::on_line_bin_textChanged(){ updateUI(); } - diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index a323e075..7a7fef19 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -101,6 +101,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS //qDebug() << "Matches:" << matches; for(int i=0; i<matches.length(); i++){ defApp = LXDG::findDefaultAppForMime(matches[i]); + //qDebug() << "MimeType:" << matches[i] << defApp; if(!defApp.isEmpty()){ extension = matches[i]; break; } else if(i+1==matches.length()){ extension = matches[0]; } } @@ -226,6 +227,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat //Now check what type of file this is if(QFile::exists(inFile)){ isFile=true; } else if(QFile::exists(QDir::currentPath()+"/"+inFile)){isFile=true; inFile = QDir::currentPath()+"/"+inFile;} //account for relative paths + else if(inFile.startsWith("mailto:")){ isUrl= true; } else if(QUrl(inFile).isValid() && !inFile.startsWith("/") ){ isUrl=true; } if( !isFile && !isUrl ){ ShowErrorDialog( argc, argv, QString(QObject::tr("Invalid file or URL: %1")).arg(inFile) ); } //Determing the type of file (extension) @@ -239,7 +241,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat else if(info.isExecutable() && extension.isEmpty()){ extension="binary"; } else if(extension!="desktop"){ extension="mimetype"; } //flag to check for mimetype default based on file } - else if(isUrl && inFile.startsWith("mailto:")){ extension = "email"; } + else if(isUrl && inFile.startsWith("mailto:")){ extension = "application/email"; } else if(isUrl && inFile.contains("://") ){ extension = "x-scheme-handler/"+inFile.section("://",0,0); } else if(isUrl && inFile.startsWith("www.")){ extension = "x-scheme-handler/http"; inFile.prepend("http://"); } //this catches partial (but still valid) URL's ("www.<something>" for instance) //qDebug() << "Input:" << inFile << isFile << isUrl << extension; @@ -314,7 +316,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat cmd.replace("%F","\""+inFile+"\""); }else if( (cmd.contains("%U") || cmd.contains("%u")) ){ //Apply any special field replacements for the desired format - if(!inFile.contains("://")){ inFile.prepend("file://"); } //local file - add the extra flag + if(!inFile.contains("://") && !isUrl){ inFile.prepend("file://"); } //local file - add the extra flag inFile.replace(" ", "%20"); //Now replace the field codes cmd.replace("%u","\""+inFile+"\""); diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index 010df40d..a4d2db28 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -718,10 +718,10 @@ void MainUI::OpenImages(LFileInfoList list){ void MainUI::OpenTerminal(QString dirpath){ //we use the application defined as the default terminal - QSettings sessionsettings( QSettings::UserScope, "LuminaDE","sessionsettings", this); + //QSettings sessionsettings( QSettings::UserScope, "LuminaDE","sessionsettings", this); //xterm remains the default - QString defTerminal = sessionsettings.value("default-terminal", "xterm").toString(); - //qDebug() << "Found default terminal:" << defTerminal; + QString defTerminal = LXDG::findDefaultAppForMime("application/terminal"); //sessionsettings.value("default-terminal", "xterm").toString(); + qDebug() << "Found default terminal:" << defTerminal; //Now get the exec string and run it QString cmd = LUtils::GenerateOpenTerminalExec(defTerminal, dirpath); //qDebug() << "Starting Terminal with command:" << cmd; |