summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-04-16 11:41:29 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-16 07:43:23 -0700
commitf2d88619c58b748f0db20fdd2887d276ef79b0c1 (patch)
treeda18dd73a76b684861825bce8bfd6e4ca7a3aa41
parenta5d54b04a7ff02f40537193181d00c3dadf59317 (diff)
downloadsubsurface-f2d88619c58b748f0db20fdd2887d276ef79b0c1.tar.gz
Restore FB grayed out when disconnected
See https://github.com/Subsurface-divelog/subsurface/issues/253. The original behaviour (greyed out when disconnected) is restored. Not sure where and when got lost, but this simple change fixes it. Fixes #253 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r--desktop-widgets/mainwindow.cpp15
-rw-r--r--desktop-widgets/mainwindow.h1
2 files changed, 10 insertions, 6 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 5f70fa2e3..259db6a33 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -340,13 +340,14 @@ void MainWindow::setupSocialNetworkMenu()
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()));
- share_on->setData(QVariant::fromValue(obj));
- ui.menuShare_on->addAction(share_on);
+ share_on_fb = new QAction(this);
+ share_on_fb->setText(facebookPlugin->socialNetworkName());
+ share_on_fb->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
+ share_on_fb->setData(QVariant::fromValue(obj));
+ share_on_fb->setEnabled(false);
+ ui.menuShare_on->addAction(share_on_fb);
connections->addAction(toggle_connection);
- connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload()));
+ connect(share_on_fb, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload()));
ui.menuShare_on->addSeparator();
ui.menuShare_on->addMenu(connections);
ui.menubar->show();
@@ -356,11 +357,13 @@ void MainWindow::setupSocialNetworkMenu()
void MainWindow::facebookLoggedIn()
{
connections->setTitle(tr("Disconnect from"));
+ share_on_fb->setEnabled(true);
}
void MainWindow::facebookLoggedOut()
{
connections->setTitle(tr("Connect to"));
+ share_on_fb->setEnabled(false);
}
void MainWindow::socialNetworkRequestConnect()
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index ee93c3b1e..0fcb1dd29 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -245,6 +245,7 @@ private:
WindowTitleUpdate *wtu;
GpsLocation *locationProvider;
QMenu *connections;
+ QAction *share_on_fb;
};
#endif // MAINWINDOW_H