aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-14 14:18:51 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-14 14:18:51 -0700
commit0c44bc7271eaeff541bbf0b30c3afe372165b2be (patch)
tree397f8653f349d11bea22c84618394bfdcdb0b192
parent4b120d1bf54f339eaea488c71faecb5395defaf3 (diff)
downloadsubsurface-0c44bc7271eaeff541bbf0b30c3afe372165b2be.tar.gz
Cloud storage: clear our last error if verification succeeds
This is cosmetic but makes things friendlier, I think. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/notificationwidget.cpp5
-rw-r--r--qt-ui/notificationwidget.h1
-rw-r--r--qt-ui/subsurfacewebservices.cpp7
3 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/notificationwidget.cpp b/qt-ui/notificationwidget.cpp
index 44e2eed1b..103c0d068 100644
--- a/qt-ui/notificationwidget.cpp
+++ b/qt-ui/notificationwidget.cpp
@@ -21,6 +21,11 @@ void NotificationWidget::hideNotification()
animatedHide();
}
+QString NotificationWidget::getNotificationText()
+{
+ return text();
+}
+
void NotificationWidget::setFuture(const QFuture<void> &future)
{
future_watcher->setFuture(future);
diff --git a/qt-ui/notificationwidget.h b/qt-ui/notificationwidget.h
index 7a3f93b4d..8a551a0b3 100644
--- a/qt-ui/notificationwidget.h
+++ b/qt-ui/notificationwidget.h
@@ -18,6 +18,7 @@ public:
void setFuture(const QFuture<void> &future);
void showNotification(QString message, KMessageWidget::MessageType type);
void hideNotification();
+ QString getNotificationText();
~NotificationWidget();
private:
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 1deb3099c..dfaf69468 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -974,14 +974,21 @@ QNetworkReply* CloudStorageAuthenticate::authenticate(QString email, QString pas
void CloudStorageAuthenticate::uploadFinished()
{
+ static QString myLastError;
+
QString cloudAuthReply(reply->readAll());
qDebug() << "Completed connection with cloud storage backend, response" << cloudAuthReply;
if (cloudAuthReply == "[VERIFIED]" || cloudAuthReply == "[OK]") {
prefs.cloud_verification_status = CS_VERIFIED;
+ NotificationWidget *nw = MainWindow::instance()->getNotificationWidget();
+ if (nw->getNotificationText() == myLastError)
+ nw->hideNotification();
+ myLastError.clear();
} else if (cloudAuthReply == "[VERIFY]") {
prefs.cloud_verification_status = CS_NEED_TO_VERIFY;
} else {
prefs.cloud_verification_status = CS_INCORRECT_USER_PASSWD;
+ myLastError = cloudAuthReply;
report_error("%s", qPrintable(cloudAuthReply));
MainWindow::instance()->getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
}