mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
[Facebook] Use statusbar instead of popup messages
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3e2a86cf80
commit
527078e277
3 changed files with 13 additions and 11 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
#include <QStatusBar>
|
||||||
|
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
#include "desktop-widgets/divelistview.h"
|
#include "desktop-widgets/divelistview.h"
|
||||||
|
@ -334,6 +335,9 @@ void MainWindow::setupSocialNetworkMenu()
|
||||||
FacebookManager *fb = FacebookManager::instance();
|
FacebookManager *fb = FacebookManager::instance();
|
||||||
connect(fb, &FacebookManager::justLoggedIn, this, &MainWindow::facebookLoggedIn);
|
connect(fb, &FacebookManager::justLoggedIn, this, &MainWindow::facebookLoggedIn);
|
||||||
connect(fb, &FacebookManager::justLoggedOut, this, &MainWindow::facebookLoggedOut);
|
connect(fb, &FacebookManager::justLoggedOut, this, &MainWindow::facebookLoggedOut);
|
||||||
|
connect(fb, &FacebookManager::sendMessage, [this](const QString& msg) {
|
||||||
|
statusBar()->showMessage(msg, 10000); // show message for 10 secs on the statusbar.
|
||||||
|
});
|
||||||
share_on_fb = new QAction(this);
|
share_on_fb = new QAction(this);
|
||||||
share_on_fb->setText(facebookPlugin->socialNetworkName());
|
share_on_fb->setText(facebookPlugin->socialNetworkName());
|
||||||
share_on_fb->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
share_on_fb->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
||||||
|
|
|
@ -182,9 +182,11 @@ void FacebookManager::userIdReceived()
|
||||||
if (obj.keys().contains("id")) {
|
if (obj.keys().contains("id")) {
|
||||||
qCDebug(lcFacebook) << "User id requested successfully:" << obj.value("id").toString();
|
qCDebug(lcFacebook) << "User id requested successfully:" << obj.value("id").toString();
|
||||||
SettingsObjectWrapper::instance()->facebook->setUserId(obj.value("id").toString());
|
SettingsObjectWrapper::instance()->facebook->setUserId(obj.value("id").toString());
|
||||||
|
emit sendMessage(tr("Facebook logged in successfully"));
|
||||||
emit justLoggedIn(true);
|
emit justLoggedIn(true);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(lcFacebook) << "Error, user id unknown, cannot login.";
|
emit sendMessage(tr("Error, unknown user id, cannot login."));
|
||||||
|
qCDebug(lcFacebook) << "Error, unknown user id, cannot login.";
|
||||||
}
|
}
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -281,17 +283,10 @@ void FacebookManager::uploadFinished()
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
if (obj.keys().contains("id")){
|
if (obj.keys().contains("id")){
|
||||||
QMessageBox::information(qApp->activeWindow(),
|
emit sendMessage(tr("Dive uploaded successfully to Facebook"));
|
||||||
tr("Photo upload sucessfull"),
|
|
||||||
tr("Your dive profile was updated to Facebook."),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(qApp->activeWindow(),
|
emit sendMessage(tr("Dive upload failed. Please see debug output and send to Subsurface mailing list"));
|
||||||
tr("Photo upload failed"),
|
qCDebug(lcFacebook) << "Dive upload failed" << response;
|
||||||
tr("Your dive profile was not updated to Facebook, \n "
|
|
||||||
"please send the following to the developer. \n"
|
|
||||||
+ response),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sendDiveFinished();
|
emit sendDiveFinished();
|
||||||
|
@ -325,6 +320,7 @@ void FacebookConnectWidget::facebookLoggedIn()
|
||||||
ui->fbWebviewContainer->hide();
|
ui->fbWebviewContainer->hide();
|
||||||
ui->fbWebviewContainer->setEnabled(false);
|
ui->fbWebviewContainer->setEnabled(false);
|
||||||
ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the 'Share on' menu entry."));
|
ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the 'Share on' menu entry."));
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FacebookConnectWidget::facebookDisconnect()
|
void FacebookConnectWidget::facebookDisconnect()
|
||||||
|
|
|
@ -38,11 +38,13 @@ public:
|
||||||
QUrl albumListUrl();
|
QUrl albumListUrl();
|
||||||
bool loggedIn();
|
bool loggedIn();
|
||||||
QPixmap grabProfilePixmap();
|
QPixmap grabProfilePixmap();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void justLoggedIn(bool triggererd);
|
void justLoggedIn(bool triggererd);
|
||||||
void justLoggedOut(bool triggered);
|
void justLoggedOut(bool triggered);
|
||||||
void albumIdReceived(const QString& albumId);
|
void albumIdReceived(const QString& albumId);
|
||||||
void sendDiveFinished();
|
void sendDiveFinished();
|
||||||
|
void sendMessage(const QString& message);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void tryLogin(const QUrl& loginResponse);
|
void tryLogin(const QUrl& loginResponse);
|
||||||
|
|
Loading…
Add table
Reference in a new issue