diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-10-09 20:15:26 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:52 -0700 |
commit | d3a8288ad5a25db502cb0c782b72c3242f3f30e9 (patch) | |
tree | ff2a9f627812c91e2d64167ddf78822bea88d62b /desktop-widgets | |
parent | 9d1117cd6c513b6b64f45520a60051a1717ca50b (diff) | |
download | subsurface-d3a8288ad5a25db502cb0c782b72c3242f3f30e9.tar.gz |
Populate the MainMenu with social network actions
The magic happens here: We are iterating over the plugins
and populating the main menu with all actions provided by
them. Currently we can't test this as we don't have a single
plugin. Next patch series of commits will be adding the
Facebook plugin.
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.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 2afc8f979..0150a7c6f 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -11,6 +11,7 @@ #include <QSettings> #include <QShortcut> #include <QToolBar> + #include "version.h" #include "divelistview.h" #include "downloadfromdivecomputer.h" @@ -52,6 +53,8 @@ #include <qthelper.h> #include <QtConcurrentRun> #include "subsurface-core/color.h" +#include "subsurface-core/isocialnetworkintegration.h" +#include "subsurface-core/pluginmanager.h" #if defined(FBSUPPORT) #include "socialnetworks.h" @@ -252,6 +255,24 @@ MainWindow::MainWindow() : QMainWindow(), ui.actionFacebook->setEnabled(false); #endif + if(PluginManager::instance().socialNetworkIntegrationPlugins().count()) { + QMenu *connections = new QMenu(); + for(ISocialNetworkIntegration *plugin : PluginManager::instance().socialNetworkIntegrationPlugins()){ + QAction *toggle_connection = new QAction(this); + toggle_connection->setText(plugin->socialNetworkName()); + toggle_connection->setIcon(QIcon(plugin->socialNetworkIcon())); + + QAction *share_on = new QAction(this); + share_on->setText(plugin->socialNetworkName()); + share_on->setIcon(QIcon(plugin->socialNetworkIcon())); + ui.menuShare_on->addAction(share_on); + connections->addAction(toggle_connection); + } + ui.menuShare_on->addSeparator(); + ui.menuShare_on->addMenu(connections); + } else { + ui.menubar->removeAction(ui.menuShare_on->menuAction()); + } ui.menubar->show(); set_git_update_cb(&updateProgress); |