#include "settingsdialog.h"
#include "situareservice/situarecommon.h"
#include "tabbedpanel.h"
+#include "updatelocation/updatelocationdialog.h"
#include "userinfopanel.h"
#include "zoombuttonpanel.h"
m_crosshair(0),
m_fullScreenButton(0),
m_indicatorButtonPanel(0),
- m_mapScale(0)
+ m_mapScale(0),
+ m_updateLocation(0)
{
qDebug() << __PRETTY_FUNCTION__;
qDeleteAll(m_error_queue.begin(), m_error_queue.end());
m_error_queue.clear();
+
+ QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
+
+ if (!m_backupMessage.isEmpty()) {
+ settings.setValue(USER_UNSEND_MESSAGE, m_backupMessage.toAscii());
+ settings.setValue(USER_UNSEND_MESSAGE_PUBLISH, m_backupFacebookPublishPolicity);
+ } else {
+ settings.remove(USER_UNSEND_MESSAGE);
+ settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
+ }
}
void MainWindow::automaticUpdateDialogFinished(int result)
m_automaticUpdateLocationDialog->deleteLater();
}
+void MainWindow::backupUpdateLocationDialogData(const QString &status, bool publish)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_backupMessage = status;
+ m_backupFacebookPublishPolicity = publish;
+}
+
void MainWindow::buildCrosshair()
{
qDebug() << __PRETTY_FUNCTION__;
connect(this, SIGNAL(userLocationReady(User*)),
m_userInfoPanel, SLOT(userDataReceived(User*)));
- connect(this, SIGNAL(reverseGeoReady(QString)),
- m_userInfoPanel, SIGNAL(reverseGeoReady(QString)));
-
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
-
connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(centerToCoordinates(GeoCoordinate)));
- connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
- this, SIGNAL(requestReverseGeo()));
-
- connect(m_userInfoPanel, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
connect(m_userInfoPanel, SIGNAL(refreshUserData()),
this, SIGNAL(refreshUserData()));
- connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
- this, SLOT(buildInformationBox(QString, bool)));
+ connect(m_userInfoPanel, SIGNAL(updateLocationMessageButtonClicked()),
+ this, SLOT(showUpdateLocationDialog()));
}
void MainWindow::buildZoomButtonPanel()
this, SIGNAL(draggingModeTriggered()));
}
+void MainWindow::clearUpdateLocationDialogData()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_backupMessage.clear();
+ m_backupFacebookPublishPolicity = false;
+}
+
void MainWindow::createMenus()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void MainWindow::restoreUnsendMessage()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
+ m_backupMessage = settings.value(USER_UNSEND_MESSAGE).toString();
+ m_backupFacebookPublishPolicity = settings.value(USER_UNSEND_MESSAGE_PUBLISH, false).toBool();
+}
+
void MainWindow::setCrosshairVisibility(bool visibility)
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void MainWindow::showUpdateLocationDialog()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ delete m_updateLocation;
+ m_updateLocation = new UpdateLocationDialog(m_backupMessage, m_backupFacebookPublishPolicity,
+ this);
+
+ connect(this, SIGNAL(reverseGeoReady(QString)),
+ m_updateLocation, SLOT(setAddress(QString)));
+
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
+ this, SIGNAL(statusUpdate(QString, bool)));
+
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
+ this, SLOT(backupUpdateLocationDialogData(QString, bool)));
+
+ connect(m_updateLocation, SIGNAL(finished(int)),
+ this, SLOT(updateLocationDialogFinished(int)));
+
+ m_updateLocation->show();
+
+ emit requestReverseGeo();
+}
+
void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
qWarning() << __PRETTY_FUNCTION__;
m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, loggedIn);
}
+
+void MainWindow::updateLocationDialogFinished(int reason)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(reason);
+
+ if (m_updateLocation) {
+ disconnect(this, SIGNAL(reverseGeoReady(QString)),
+ m_updateLocation, SLOT(setAddress(QString)));
+
+ disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SIGNAL(statusUpdate(QString,bool)));
+
+ disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SLOT(backupUpdateLocationDialogData(QString,bool)));
+
+ disconnect(m_updateLocation, SIGNAL(finished(int)),
+ this, SLOT(updateLocationDialogFinished(int)));
+
+ m_updateLocation->deleteLater();
+ m_updateLocation = 0;
+ }
+}