mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-18 23:36:16 +00:00
Initialize Facebook page only when dialog is shown
Quick hack to avoid Facebook access on every program start. Move the initialization of the login page from the FacebookConnectWidget constructor to the show event handler. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
513f5a0230
commit
d1d4b4edb1
2 changed files with 11 additions and 5 deletions
|
@ -300,6 +300,16 @@ void FacebookManager::uploadFinished()
|
|||
emit sendDiveFinished();
|
||||
}
|
||||
|
||||
void FacebookConnectWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
if (FacebookManager::instance()->loggedIn()) {
|
||||
facebookLoggedIn();
|
||||
} else {
|
||||
facebookDisconnect();
|
||||
}
|
||||
return QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
FacebookConnectWidget::FacebookConnectWidget(QWidget *parent) : QDialog(parent), ui(new Ui::FacebookConnectWidget) {
|
||||
ui->setupUi(this);
|
||||
FacebookManager *fb = FacebookManager::instance();
|
||||
|
@ -309,11 +319,6 @@ FacebookConnectWidget::FacebookConnectWidget(QWidget *parent) : QDialog(parent),
|
|||
facebookWebView = new QWebView(this);
|
||||
#endif
|
||||
ui->fbWebviewContainer->layout()->addWidget(facebookWebView);
|
||||
if (fb->loggedIn()) {
|
||||
facebookLoggedIn();
|
||||
} else {
|
||||
facebookDisconnect();
|
||||
}
|
||||
#ifdef USE_WEBENGINE
|
||||
connect(facebookWebView, &QWebEngineView::urlChanged, fb, &FacebookManager::tryLogin);
|
||||
#else
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
explicit FacebookConnectWidget(QWidget* parent = 0);
|
||||
void facebookLoggedIn();
|
||||
void facebookDisconnect();
|
||||
void showEvent(QShowEvent *event);
|
||||
private:
|
||||
Ui::FacebookConnectWidget *ui;
|
||||
#ifdef USE_WEBENGINE
|
||||
|
|
Loading…
Add table
Reference in a new issue