summaryrefslogtreecommitdiffstats
path: root/logic/net
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-07-07 00:02:04 +0200
committerPetr Mrázek <peterix@gmail.com>2014-07-07 00:02:04 +0200
commitd934e6483190d7d173051380c62bc040911b42cd (patch)
treefe8a09797a23d324b13d5b3d08ffe9b1aaf55459 /logic/net
parent15775bd30a3269adece8272badaee70823d64ec6 (diff)
downloadMultiMC-d934e6483190d7d173051380c62bc040911b42cd.tar
MultiMC-d934e6483190d7d173051380c62bc040911b42cd.tar.gz
MultiMC-d934e6483190d7d173051380c62bc040911b42cd.tar.lz
MultiMC-d934e6483190d7d173051380c62bc040911b42cd.tar.xz
MultiMC-d934e6483190d7d173051380c62bc040911b42cd.zip
Tweak the response to successful uploads (screenshots, log pastes)
The url will now be shown as link, put into the clipboard AND opened in a browser. At the same time. To avoid losing the URL.
Diffstat (limited to 'logic/net')
-rw-r--r--logic/net/PasteUpload.cpp5
-rw-r--r--logic/net/PasteUpload.h11
2 files changed, 12 insertions, 4 deletions
diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp
index ec0b2c60..ccd7dc48 100644
--- a/logic/net/PasteUpload.cpp
+++ b/logic/net/PasteUpload.cpp
@@ -77,9 +77,8 @@ bool PasteUpload::parseResult(QJsonDocument doc)
QLOG_ERROR() << "paste.ee reported error:" << QString(object.value("error").toString());
return false;
}
- // FIXME: not the place for GUI things.
- QString pasteUrl = object.value("paste").toObject().value("link").toString();
- QDesktopServices::openUrl(pasteUrl);
+ m_pasteLink = object.value("paste").toObject().value("link").toString();
+ m_pasteID = object.value("paste").toObject().value("id").toString();
return true;
}
diff --git a/logic/net/PasteUpload.h b/logic/net/PasteUpload.h
index 55cfabf4..0ddc8cef 100644
--- a/logic/net/PasteUpload.h
+++ b/logic/net/PasteUpload.h
@@ -10,7 +10,14 @@ class PasteUpload : public Task
public:
PasteUpload(QWidget *window, QString text);
virtual ~PasteUpload(){};
-
+ QString pasteLink()
+ {
+ return m_pasteLink;
+ }
+ QString pasteID()
+ {
+ return m_pasteID;
+ }
protected:
virtual void executeTask();
@@ -19,6 +26,8 @@ private:
QString m_text;
QString m_error;
QWidget *m_window;
+ QString m_pasteID;
+ QString m_pasteLink;
std::shared_ptr<QNetworkReply> m_reply;
public
slots: