summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-11-09 18:05:30 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-09 18:00:56 -0800
commit66091ff853fe16495c981a5f8deff285cd310358 (patch)
treeedad876a401bbe174aaf55aa6ba49c87d4ac2511 /desktop-widgets/mainwindow.cpp
parent7b1950ca03ae928e3c51d74b8269e7054de7fdc8 (diff)
downloadsubsurface-66091ff853fe16495c981a5f8deff285cd310358.tar.gz
Remove Facebook from Plugins
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index b532b8501..58778f394 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -55,6 +55,8 @@
#include "subsurface-core/isocialnetworkintegration.h"
#include "subsurface-core/pluginmanager.h"
+#include "plugins/facebook/facebook_integration.h"
+
#if defined(FBSUPPORT)
#include "socialnetworks.h"
#endif
@@ -243,30 +245,7 @@ MainWindow::MainWindow() : QMainWindow(),
find_all_templates();
#endif
- if(PluginManager::instance().socialNetworkIntegrationPlugins().count()) {
- QMenu *connections = new QMenu(tr("Connect to"));
- Q_FOREACH(ISocialNetworkIntegration *plugin, PluginManager::instance().socialNetworkIntegrationPlugins()){
- QAction *toggle_connection = new QAction(this);
- toggle_connection->setText(plugin->socialNetworkName());
- toggle_connection->setIcon(QIcon(plugin->socialNetworkIcon()));
- toggle_connection->setData(QVariant::fromValue(plugin));
- connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect()));
-
- QAction *share_on = new QAction(this);
- share_on->setText(plugin->socialNetworkName());
- share_on->setIcon(QIcon(plugin->socialNetworkIcon()));
- share_on->setData(QVariant::fromValue(plugin));
- ui.menuShare_on->addAction(share_on);
- connections->addAction(toggle_connection);
- connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload()));
- }
- ui.menuShare_on->addSeparator();
- ui.menuShare_on->addMenu(connections);
- } else {
- ui.menubar->removeAction(ui.menuShare_on->menuAction());
- }
-
- ui.menubar->show();
+ setupSocialNetworkMenu();
set_git_update_cb(&updateProgress);
}
@@ -276,10 +255,32 @@ MainWindow::~MainWindow()
m_Instance = NULL;
}
+void MainWindow::setupSocialNetworkMenu()
+{
+ QMenu *connections = new QMenu(tr("Connect to"));
+ FacebookPlugin *facebookPlugin = new FacebookPlugin();
+ QAction *toggle_connection = new QAction(this);
+ toggle_connection->setText(facebookPlugin->socialNetworkName());
+ toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
+ toggle_connection->setData(QVariant::fromValue(facebookPlugin));
+ connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect()));
+
+ QAction *share_on = new QAction(this);
+ share_on->setText(facebookPlugin->socialNetworkName());
+ share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon()));
+ share_on->setData(QVariant::fromValue(facebookPlugin));
+ ui.menuShare_on->addAction(share_on);
+ connections->addAction(toggle_connection);
+ connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload()));
+ ui.menuShare_on->addSeparator();
+ ui.menuShare_on->addMenu(connections);
+ ui.menubar->show();
+}
+
void MainWindow::socialNetworkRequestConnect()
{
QAction *action = qobject_cast<QAction*>(sender());
- ISocialNetworkIntegration *plugin = action->data().value<ISocialNetworkIntegration*>();
+ FacebookPlugin *plugin = action->data().value<FacebookPlugin*>();
if (plugin->isConnected())
plugin->requestLogoff();
else