mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
4b120d1bf5
commit
0c44bc7271
3 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,11 @@ void NotificationWidget::hideNotification()
|
|||
animatedHide();
|
||||
}
|
||||
|
||||
QString NotificationWidget::getNotificationText()
|
||||
{
|
||||
return text();
|
||||
}
|
||||
|
||||
void NotificationWidget::setFuture(const QFuture<void> &future)
|
||||
{
|
||||
future_watcher->setFuture(future);
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
void setFuture(const QFuture<void> &future);
|
||||
void showNotification(QString message, KMessageWidget::MessageType type);
|
||||
void hideNotification();
|
||||
QString getNotificationText();
|
||||
~NotificationWidget();
|
||||
|
||||
private:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue