From b55068ba9f04381075121abd3f7b56823063c35e Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 13 Dec 2020 10:04:38 +0100 Subject: Allow to open local files without specifying the 'file:' schema It makes possible to launch Kristall by double-clicking a file from file manager. --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 46bc7e9..5939940 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -274,6 +274,13 @@ int main(int argc, char *argv[]) if(urls.size() > 0) { for(auto url_str : urls) { QUrl url { url_str }; + if (url.isRelative()) { + if (QFile::exists(url_str)) { + url = QUrl::fromLocalFile(QFileInfo(url_str).absoluteFilePath()); + } else { + url = QUrl("gemini://" + url_str); + } + } if(url.isValid()) { w.addNewTab(false, url); } else { -- cgit v1.2.3