Open the url direectly.

This commit is contained in:
robotbrainify 2013-12-06 17:17:32 -05:00
parent e2728317e7
commit 4548930e34
3 changed files with 3 additions and 12 deletions

View File

@ -189,11 +189,7 @@ void ConsoleWindow::on_btnPaste_clicked()
ProgressDialog dialog(this); ProgressDialog dialog(this);
PasteUpload* paste=new PasteUpload(this, text); PasteUpload* paste=new PasteUpload(this, text);
dialog.exec(paste); dialog.exec(paste);
if(paste->successful()) if(!paste->successful())
{
paste->messageBox()->exec();
}
else
{ {
CustomMessageBox::selectable(this, "Upload failed", paste->failReason(), QMessageBox::Critical)->exec(); CustomMessageBox::selectable(this, "Upload failed", paste->failReason(), QMessageBox::Critical)->exec();
} }

View File

@ -4,6 +4,7 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
#include "gui/dialogs/CustomMessageBox.h" #include "gui/dialogs/CustomMessageBox.h"
#include <QDesktopServices>
PasteUpload::PasteUpload(QWidget *window, QString text) : m_text(text), m_window(window) PasteUpload::PasteUpload(QWidget *window, QString text) : m_text(text), m_window(window)
{ {
@ -78,7 +79,6 @@ bool PasteUpload::parseResult(QJsonDocument doc, QString *parseError)
return false; return false;
} }
QString pasteUrl = object.value("paste").toObject().value("link").toString(); QString pasteUrl = object.value("paste").toObject().value("link").toString();
m_messageBox = CustomMessageBox::selectable(m_window, "Paste upload successful!", QDesktopServices::openUrl(pasteUrl);
QString("Find your paste at %1").arg(pasteUrl));
return true; return true;
} }

View File

@ -9,10 +9,6 @@ class PasteUpload : public Task
Q_OBJECT Q_OBJECT
public: public:
PasteUpload(QWidget *window, QString text); PasteUpload(QWidget *window, QString text);
QMessageBox *messageBox() const
{
return m_messageBox;
}
protected: protected:
virtual void executeTask(); virtual void executeTask();
@ -22,7 +18,6 @@ private:
QString m_text; QString m_text;
QString m_error; QString m_error;
QWidget *m_window; QWidget *m_window;
QMessageBox *m_messageBox;
std::shared_ptr<QNetworkReply> m_reply; std::shared_ptr<QNetworkReply> m_reply;
public public
slots: slots: