diff options
-rw-r--r-- | src/applicationclient.cpp | 17 | ||||
-rw-r--r-- | src/applicationclient.h | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/applicationclient.cpp b/src/applicationclient.cpp index 0887b23..4d5989a 100644 --- a/src/applicationclient.cpp +++ b/src/applicationclient.cpp @@ -56,6 +56,7 @@ #define BACKEND_ID QUOTE(TALK_SCHEDULE_BACKEND_ID) ApplicationClient::ApplicationClient() + : init(true) { m_settings = new FileIO(this, "settings.txt"); @@ -145,10 +146,13 @@ void ApplicationClient::authenticationSuccess(EnginioReply *reply) int timeout = (reply->data().value("expires_in").toInt() - 20*60)*1000; timer->setSingleShot(true); timer->start(timeout); - QJsonObject query; - query["objectType"] = QString::fromUtf8("objects.Conference"); - const EnginioReply *replyConf = m_client->query(query); - connect(replyConf, SIGNAL(finished(EnginioReply*)), this, SLOT(queryConferenceReply(EnginioReply*))); + if (init) { // Query the conference only once + QJsonObject query; + query["objectType"] = QString::fromUtf8("objects.Conference"); + const EnginioReply *replyConf = m_client->query(query); + connect(replyConf, SIGNAL(finished(EnginioReply*)), this, SLOT(queryConferenceReply(EnginioReply*))); + init = false; + } } void ApplicationClient::setCurrentConferenceId(const QString &newConfId) @@ -167,6 +171,9 @@ void ApplicationClient::setCurrentConferenceId(const QString &newConfId) void ApplicationClient::queryConferenceReply(EnginioReply *reply) { m_conferenceModel->onFinished(reply); + // If no conference were retrieved, allow conference query on next authentication + if (m_conferenceModel->rowCount() == 0) + init = true; setCurrentConferenceId(m_settings->read()); emit conferencesModelChanged(); } @@ -184,11 +191,13 @@ void ApplicationClient::setCurrentConferenceIndex(const int index) bool ApplicationClient::eventFilter(QObject *object, QEvent *event) { +#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_WINPHONE) if (event->type() == QEvent::ApplicationStateChange) { if (QApplication::applicationState() == Qt::ApplicationActive) { authenticate(); return true; } } +#endif return QObject::eventFilter(object, event); } diff --git a/src/applicationclient.h b/src/applicationclient.h index 538d3fb..6492f3f 100644 --- a/src/applicationclient.h +++ b/src/applicationclient.h @@ -103,6 +103,7 @@ private: QString m_currentConferenceId; QQmlPropertyMap *m_details; QTimer *timer; + bool init; }; #endif // APPLICATIONCLIENT_H |