aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
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
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')
-rw-r--r--desktop-widgets/mainwindow.cpp51
-rw-r--r--desktop-widgets/mainwindow.h1
-rw-r--r--desktop-widgets/plugins/facebook/CMakeLists.txt6
3 files changed, 30 insertions, 28 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
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index fc63c5740..adf35686e 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -225,6 +225,7 @@ private:
bool plannerStateClean();
void setupForAddAndPlan(const char *model);
void configureToolbar();
+ void setupSocialNetworkMenu();
QDialog *survey;
struct dive copyPasteDive;
struct dive_components what;
diff --git a/desktop-widgets/plugins/facebook/CMakeLists.txt b/desktop-widgets/plugins/facebook/CMakeLists.txt
index 3f63a8fac..c0175a26e 100644
--- a/desktop-widgets/plugins/facebook/CMakeLists.txt
+++ b/desktop-widgets/plugins/facebook/CMakeLists.txt
@@ -1,7 +1,7 @@
set(FACEBOOK_PLUGIN_SRCS facebook_integration.cpp facebookconnectwidget.cpp)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-add_library(facebook_integration SHARED ${FACEBOOK_PLUGIN_SRCS})
+add_library(facebook_integration STATIC ${FACEBOOK_PLUGIN_SRCS})
-target_link_libraries(facebook_integration subsurface_corelib subsurface_interface ${QT_LIBRARIES})
-add_dependencies(facebook_integration subsurface_corelib subsurface_interface) \ No newline at end of file
+target_link_libraries(facebook_integration ${QT_LIBRARIES})
+add_dependencies(facebook_integration subsurface_corelib) \ No newline at end of file