From 7f6a22c7875d80f74fa8edc101ea00ccd9710ddf Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 31 Aug 2014 16:51:51 -0300 Subject: [PATCH] Added Gui.showDownloads() py function to show the download manager, and allow to click https links in webgui browser --- src/Gui/Application.h | 2 ++ src/Gui/ApplicationPy.cpp | 12 ++++++++++++ src/Mod/Web/Gui/BrowserView.cpp | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Gui/Application.h b/src/Gui/Application.h index 5458f340bc..d2e85f9ef2 100644 --- a/src/Gui/Application.h +++ b/src/Gui/Application.h @@ -236,6 +236,8 @@ public: PYFUNCDEF_S(sDoCommand); PYFUNCDEF_S(sDoCommandGui); PYFUNCDEF_S(sAddModule); + + PYFUNCDEF_S(sShowDownloads); static PyMethodDef Methods[]; diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index f1db835f1c..6bf91900f8 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -44,6 +44,7 @@ #include "Workbench.h" #include "WorkbenchManager.h" #include "Language/Translator.h" +#include "DownloadManager.h" #include #include #include @@ -142,6 +143,9 @@ PyMethodDef Application::Methods[] = { {"addModule", (PyCFunction) Application::sAddModule, 1, "addModule(string) -> None\n\n" "Prints the given module import only once in the macro recording"}, + {"showDownloads", (PyCFunction) Application::sShowDownloads,1, + "showDownloads() -> None\n\n" + "Shows the downloads manager window"}, {NULL, NULL} /* Sentinel */ }; @@ -865,3 +869,11 @@ PyObject* Application::sAddModule(PyObject * /*self*/, PyObject *args,PyObject * Command::addModule(Command::Doc,pstr); return Py_None; } + +PyObject* Application::sShowDownloads(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/) +{ + if (!PyArg_ParseTuple(args, "")) // convert args: Python->C + return NULL; // NULL triggers exception + Gui::Dialog::DownloadManager::getInstance(); + return Py_None; +} diff --git a/src/Mod/Web/Gui/BrowserView.cpp b/src/Mod/Web/Gui/BrowserView.cpp index 18ffc9e19d..476cb4c436 100644 --- a/src/Mod/Web/Gui/BrowserView.cpp +++ b/src/Mod/Web/Gui/BrowserView.cpp @@ -145,7 +145,7 @@ void BrowserView::onLinkClicked (const QUrl & url) //QString fragment = url. fragment(); - if (scheme==QString::fromLatin1("http")) { + if (scheme==QString::fromLatin1("http") || scheme==QString::fromLatin1("https")) { load(url); } // Small trick to force opening a link in an external browser: use exthttp or exthttp