diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-08 16:29:00 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-08 16:29:00 -0400 |
commit | 07d1acabdc57d7c0f06420deab7326fa087ea1f6 (patch) | |
tree | 43114df28f5af55bacf7b42cfd0ba49ae69aa1c4 | |
parent | Fix a bug with detecting/using KDE applications as the defaults for particula... (diff) | |
download | lumina-07d1acabdc57d7c0f06420deab7326fa087ea1f6.tar.gz lumina-07d1acabdc57d7c0f06420deab7326fa087ea1f6.tar.bz2 lumina-07d1acabdc57d7c0f06420deab7326fa087ea1f6.zip |
Fix up the detection/usage of the "mailto:" option in lumina-open. This also changes the default mimetype used for email applications to "application/email"
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index 7011b2e1..7a7fef19 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -227,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) @@ -240,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; @@ -315,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+"\""); |