diff options
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 19 | ||||
-rw-r--r-- | src-qt5/core/lumina-open/LFileDialog.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 1 |
3 files changed, 9 insertions, 15 deletions
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-open/LFileDialog.cpp b/src-qt5/core/lumina-open/LFileDialog.cpp index c0417935..e5fbc874 100644 --- a/src-qt5/core/lumina-open/LFileDialog.cpp +++ b/src-qt5/core/lumina-open/LFileDialog.cpp @@ -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..7011b2e1 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]; } } |