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>
This commit is contained in:
Dirk Hohndel 2017-01-01 22:23:39 -08:00
parent a63505dde9
commit b2cc840ebf
3 changed files with 18 additions and 2 deletions

View file

@ -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());