mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
a63505dde9
commit
b2cc840ebf
3 changed files with 18 additions and 2 deletions
|
@ -59,6 +59,7 @@
|
||||||
|
|
||||||
#if defined(FBSUPPORT)
|
#if defined(FBSUPPORT)
|
||||||
#include "plugins/facebook/facebook_integration.h"
|
#include "plugins/facebook/facebook_integration.h"
|
||||||
|
#include "plugins/facebook/facebookconnectwidget.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QProgressDialog *progressDialog = NULL;
|
QProgressDialog *progressDialog = NULL;
|
||||||
|
@ -336,7 +337,9 @@ void MainWindow::setupSocialNetworkMenu()
|
||||||
toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
||||||
toggle_connection->setData(QVariant::fromValue(obj));
|
toggle_connection->setData(QVariant::fromValue(obj));
|
||||||
connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect()));
|
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);
|
QAction *share_on = new QAction(this);
|
||||||
share_on->setText(facebookPlugin->socialNetworkName());
|
share_on->setText(facebookPlugin->socialNetworkName());
|
||||||
share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
|
||||||
|
@ -350,6 +353,16 @@ void MainWindow::setupSocialNetworkMenu()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::facebookLoggedIn()
|
||||||
|
{
|
||||||
|
connections->setTitle(tr("Disconnect from"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::facebookLoggedOut()
|
||||||
|
{
|
||||||
|
connections->setTitle(tr("Connect to"));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::socialNetworkRequestConnect()
|
void MainWindow::socialNetworkRequestConnect()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction*>(sender());
|
QAction *action = qobject_cast<QAction*>(sender());
|
||||||
|
|
|
@ -183,6 +183,9 @@ slots:
|
||||||
|
|
||||||
void socialNetworkRequestConnect();
|
void socialNetworkRequestConnect();
|
||||||
void socialNetworkRequestUpload();
|
void socialNetworkRequestUpload();
|
||||||
|
void facebookLoggedIn();
|
||||||
|
void facebookLoggedOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
QAction *actionNextDive;
|
QAction *actionNextDive;
|
||||||
|
|
|
@ -251,7 +251,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 button below"));
|
ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the 'Share on' menu entry."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FacebookConnectWidget::facebookDisconnect()
|
void FacebookConnectWidget::facebookDisconnect()
|
||||||
|
|
Loading…
Add table
Reference in a new issue