diff options
author | Ken Moore <moorekou@gmail.com> | 2014-11-17 18:53:12 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2014-11-17 18:53:12 -0500 |
commit | 08fbc54ef9b30f5db1eea4ffbb4cbf6e3e52d99f (patch) | |
tree | fac7027b2a0b413f3e7b8662dd95f0aa96ef4341 /lumina-open | |
parent | Update the XDG MIME inplementation to support the draft standards for registe... (diff) | |
download | lumina-08fbc54ef9b30f5db1eea4ffbb4cbf6e3e52d99f.tar.gz lumina-08fbc54ef9b30f5db1eea4ffbb4cbf6e3e52d99f.tar.bz2 lumina-08fbc54ef9b30f5db1eea4ffbb4cbf6e3e52d99f.zip |
Finish up the new Mime type default app usage in lumina-config and lumina-open. The new buttons in lumina config set the backends fine, but the file manager/terminal options will not be respected yet until I update the menu plugins in lumina-desktop.
Diffstat (limited to 'lumina-open')
-rw-r--r-- | lumina-open/main.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp index c3fb5c49..4fcf70b7 100644 --- a/lumina-open/main.cpp +++ b/lumina-open/main.cpp @@ -76,7 +76,16 @@ void showOSD(int argc, char **argv, QString message){ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QString& path, bool showDLG=false){ //First check to see if there is a default for this extension - QString defApp = LFileDialog::getDefaultApp(extension); + QString defApp; + if(extension=="mimetype"){ + QStringList matches = LXDG::findAppMimeForFile(inFile, true).split("::::"); //allow multiple matches + for(int i=0; i<matches.length(); i++){ + defApp = LXDG::findDefaultAppForMime(matches[i]); + if(!defApp.isEmpty()){ extension = matches[i]; break; } + else if(i+1==matches.length()){ extension = matches[0]; } + } + }else{ defApp = LFileDialog::getDefaultApp(extension); } + if( !defApp.isEmpty() && !showDLG ){ bool ok = false; if(defApp.endsWith(".desktop")){ @@ -204,7 +213,10 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat extension=info.completeSuffix(); if(info.isDir()){ extension="directory"; } else if(info.isExecutable() && extension.isEmpty()){ extension="binary"; } - }else if(isUrl){ extension = inFile.section(":",0,0); } + 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){ extension = "webbrowser"; } //if not an application - find the right application to open the file QString cmd; bool useInputFile = false; |