diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-01-01 22:23:39 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-01-01 22:24:48 -0800 |
commit | b2cc840ebf9f670cf06b281805f98cf1dfb20cb2 (patch) | |
tree | 38f907c4578ebabf62717a42ff2756de02f7100c /desktop-widgets | |
parent | a63505dde9be923dcbb208044e516733bed33125 (diff) | |
download | subsurface-b2cc840ebf9f670cf06b281805f98cf1dfb20cb2.tar.gz |
Facebook integration: change the menu entry to disconnect
This way the menu entry becomes the togglee it appears it was designed to be in
the first place.
This closes #129
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 15 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 3 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 526a71a17..fa30188c2 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -59,6 +59,7 @@ #if defined(FBSUPPORT) #include "plugins/facebook/facebook_integration.h" +#include "plugins/facebook/facebookconnectwidget.h" #endif QProgressDialog *progressDialog = NULL; @@ -336,7 +337,9 @@ void MainWindow::setupSocialNetworkMenu() toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); toggle_connection->setData(QVariant::fromValue(obj)); connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); - + FacebookManager *fb = FacebookManager::instance(); + connect(fb, &FacebookManager::justLoggedIn, this, &MainWindow::facebookLoggedIn); + connect(fb, &FacebookManager::justLoggedOut, this, &MainWindow::facebookLoggedOut); QAction *share_on = new QAction(this); share_on->setText(facebookPlugin->socialNetworkName()); share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); @@ -350,6 +353,16 @@ void MainWindow::setupSocialNetworkMenu() #endif } +void MainWindow::facebookLoggedIn() +{ + connections->setTitle(tr("Disconnect from")); +} + +void MainWindow::facebookLoggedOut() +{ + connections->setTitle(tr("Connect to")); +} + void MainWindow::socialNetworkRequestConnect() { QAction *action = qobject_cast<QAction*>(sender()); diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 8e9358a4c..ee93c3b1e 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -183,6 +183,9 @@ slots: void socialNetworkRequestConnect(); void socialNetworkRequestUpload(); + void facebookLoggedIn(); + void facebookLoggedOut(); + private: Ui::MainWindow ui; QAction *actionNextDive; diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index 0e4ddae6c..419a823ca 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -251,7 +251,7 @@ void FacebookConnectWidget::facebookLoggedIn() { ui->fbWebviewContainer->hide(); ui->fbWebviewContainer->setEnabled(false); - ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below")); + ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the 'Share on' menu entry.")); } void FacebookConnectWidget::facebookDisconnect() |