summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/mainwindow.cpp2
-rw-r--r--desktop-widgets/plugins/facebook/facebook_integration.cpp17
-rw-r--r--desktop-widgets/plugins/facebook/facebook_integration.h27
3 files changed, 28 insertions, 18 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 12aed9c7a..14ba96772 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -258,7 +258,7 @@ MainWindow::MainWindow() : QMainWindow(),
share_on->setData(QVariant::fromValue(plugin));
ui.menuShare_on->addAction(share_on);
connections->addAction(toggle_connection);
- connect(share_on, &QAction::triggered, [plugin](bool triggered) { plugin->requestUpload(); }
+ connect(share_on, &QAction::triggered, [plugin](bool triggered) { plugin->requestUpload(); });
}
ui.menuShare_on->addSeparator();
ui.menuShare_on->addMenu(connections);
diff --git a/desktop-widgets/plugins/facebook/facebook_integration.cpp b/desktop-widgets/plugins/facebook/facebook_integration.cpp
index 43f74b8f9..f817f9df8 100644
--- a/desktop-widgets/plugins/facebook/facebook_integration.cpp
+++ b/desktop-widgets/plugins/facebook/facebook_integration.cpp
@@ -3,25 +3,26 @@
#include <QDebug>
-FacebookPlugin::FacebookPlugin(QObject* parent): QObject(parent)
+FacebookPlugin::FacebookPlugin(QObject* parent): QObject(parent),
+ fbConnectWidget(new FacebookConnectWidget()),
+ fbUploadDialog(new SocialNetworkDialog())
{
-
}
bool FacebookPlugin::isConnected()
{
- return false;
+ FacebookManager *instance = FacebookManager::instance();
+ return instance->loggedIn();
}
void FacebookPlugin::requestLogin()
{
- FacebookConnectWidget connectDialog;
- connectDialog.exec();
+ fbConnectWidget->exec();
}
void FacebookPlugin::requestLogoff()
{
-
+ FacebookManager::instance()->logout();
}
QString FacebookPlugin::socialNetworkIcon() const
@@ -36,5 +37,7 @@ QString FacebookPlugin::socialNetworkName() const
void FacebookPlugin::requestUpload()
{
- qDebug() << "Upload Requested";
+ FacebookManager *instance = FacebookManager::instance();
+ if (instance->loggedIn())
+ fbUploadDialog->exec();
}
diff --git a/desktop-widgets/plugins/facebook/facebook_integration.h b/desktop-widgets/plugins/facebook/facebook_integration.h
index 99362e747..714f636fc 100644
--- a/desktop-widgets/plugins/facebook/facebook_integration.h
+++ b/desktop-widgets/plugins/facebook/facebook_integration.h
@@ -4,18 +4,25 @@
#include "subsurface-core/isocialnetworkintegration.h"
#include <QString>
+class FacebookConnectWidget;
+class SocialNetworkDialog;
+class FacebookManager;
+
class FacebookPlugin : public QObject, public ISocialNetworkIntegration {
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.subsurface.plugins.ISocialNetworkIntegration")
- Q_INTERFACES(ISocialNetworkIntegration)
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.subsurface.plugins.ISocialNetworkIntegration")
+ Q_INTERFACES(ISocialNetworkIntegration)
public:
- explicit FacebookPlugin(QObject* parent = 0);
- virtual bool isConnected();
- virtual void requestLogin();
- virtual void requestLogoff();
- virtual QString socialNetworkIcon() const;
- virtual QString socialNetworkName() const;
- virtual void requestUpload();
+ explicit FacebookPlugin(QObject* parent = 0);
+ virtual bool isConnected();
+ virtual void requestLogin();
+ virtual void requestLogoff();
+ virtual QString socialNetworkIcon() const;
+ virtual QString socialNetworkName() const;
+ virtual void requestUpload();
+private:
+ FacebookConnectWidget *fbConnectWidget;
+ SocialNetworkDialog *fbUploadDialog;
};
#endif \ No newline at end of file