From 07d1acabdc57d7c0f06420deab7326fa087ea1f6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 8 Jun 2016 16:29:00 -0400 Subject: 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" --- src-qt5/core/lumina-open/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-open') 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." 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+"\""); -- cgit