From 757c4aab20cee9cd3699276a9b4f7a7aee4719c2 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 24 Apr 2015 17:10:55 +0200 Subject: Allow images to be added via the web This adds a new divelist context menu entry which asks for a URL. The file is retrieved and if it is an image it is added to the cache and the url is associated to dives as with local files. NB this currently only works with URLs pointing directly to images. But it should not be too hard to add the possibility to add a direction via an html file and its image tags. To test: open dives/test43.xml and delete the image and then add the URL http://euve10195.vserver.de/~robert/wreck.jpg Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'qt-ui/simplewidgets.cpp') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 2b8605a69..a074ad18c 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -361,6 +361,20 @@ void ShiftImageTimesDialog::timeEditChanged(const QTime &time) updateInvalid(); } +URLDialog::URLDialog(QWidget *parent) : QDialog(parent) +{ + ui.setupUi(this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + connect(close, SIGNAL(activated()), this, SLOT(close())); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + connect(quit, SIGNAL(activated()), parent, SLOT(close())); +} + +QString URLDialog::url() const +{ + return ui.urlField->toPlainText(); +} + bool isGnome3Session() { #if defined(QT_OS_WIW) || defined(QT_OS_MAC) -- cgit v1.2.3-70-g09d2