mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:43:23 +00:00
Facebook Plugin is aware of it's connection status
This patch makes facebook plugin aware of it's connection status enabling uploads only when connected, and hooking some things up. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
72b85e3151
commit
a1ff14a48f
3 changed files with 28 additions and 18 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
#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")
|
||||
|
@ -16,6 +20,9 @@ public:
|
|||
virtual QString socialNetworkIcon() const;
|
||||
virtual QString socialNetworkName() const;
|
||||
virtual void requestUpload();
|
||||
private:
|
||||
FacebookConnectWidget *fbConnectWidget;
|
||||
SocialNetworkDialog *fbUploadDialog;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue