summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-01 22:23:39 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-01 22:24:48 -0800
commitb2cc840ebf9f670cf06b281805f98cf1dfb20cb2 (patch)
tree38f907c4578ebabf62717a42ff2756de02f7100c /desktop-widgets/mainwindow.cpp
parenta63505dde9be923dcbb208044e516733bed33125 (diff)
downloadsubsurface-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/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp15
1 files changed, 14 insertions, 1 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());