m_updatedLabel = new QLabel();
m_updatedLabel->setWordWrap(true);
- m_messageDialog = new UpdateLocationDialog(this);
- m_messageDialog->hide();
- m_messageDialog->setWindowModality(Qt::NonModal);
-
ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
":/res/images/refresh_s.png");
ImageButton *updateStatusMessageButton = new ImageButton(this, ":/res/images/send_position.png",
this, SIGNAL(refreshUserData()));
connect(m_findButton, SIGNAL(clicked()),
- this, SLOT(findButtonClicked()));
-
- connect(this, SIGNAL(reverseGeoReady(QString)),
- m_messageDialog, SLOT(setAddress(QString)));
-
- connect(m_messageDialog, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
- connect(m_messageDialog, SIGNAL(statusUpdate(QString,bool)),
- this, SLOT(backupUpdateLocationDialogData(QString,bool)));
+ this, SLOT(findButtonClicked()));
setFixedWidth(BACKGROUND_WIDTH);
{
qDebug() << __PRETTY_FUNCTION__;
- if (!m_backupMessage.isEmpty()) {
- QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+
+ if (!m_backupMessage.isEmpty()) {
settings.setValue(USER_UNSEND_MESSAGE, m_backupMessage.toAscii());
settings.setValue(USER_UNSEND_MESSAGE_PUBLISH_POLICITY, m_backupFacebookPublishPolicity);
+ } else {
+ settings.remove(USER_UNSEND_MESSAGE);
+ settings.remove(USER_UNSEND_MESSAGE_PUBLISH_POLICITY);
}
-
}
void UserInfo::setAddress(const QString &address)
}
}
-void UserInfo::backupUpdateLocationDialogData(const QString &status, const bool &publish)
+void UserInfo::backupUpdateLocationDialogData(const QString &status, bool publish)
{
qDebug() << __PRETTY_FUNCTION__;
{
qDebug() << __PRETTY_FUNCTION__;
- qDebug() << "Message Before Clearing: " << m_backupMessage;
m_backupMessage.clear();
- qDebug() << "Message After Clearing: " << m_backupMessage;
m_backupFacebookPublishPolicity = false;
}
emit findUser(m_coordinates);
}
-void UserInfo::restoreUnsendMessage()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QSettings settings(DIRECTORY_NAME, FILE_NAME);
- m_backupMessage = settings.value(USER_UNSEND_MESSAGE, "").toString();
- m_backupFacebookPublishPolicity =
- settings.value(USER_UNSEND_MESSAGE_PUBLISH_POLICITY, false).toBool();
-}
-
-
void UserInfo::mouseReleaseEvent(QMouseEvent *event)
{
qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
emit requestReverseGeo();
- m_messageDialog->show();
- m_messageDialog->m_textEdit->setPlainText(m_backupMessage);
- m_messageDialog->m_checkBox->setCheckState(Qt::Unchecked);
+ UpdateLocationDialog updateLocation(m_backupMessage, m_backupFacebookPublishPolicity, this);
- if (m_backupFacebookPublishPolicity == true)
- m_messageDialog->m_checkBox->setCheckState(Qt::Checked);
+ connect(this, SIGNAL(reverseGeoReady(QString)),
+ &updateLocation, SLOT(setAddress(QString)));
+
+ connect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SIGNAL(statusUpdate(QString,bool)));
+
+ connect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SLOT(backupUpdateLocationDialogData(QString,bool)));
+
+ updateLocation.exec();
+
+ disconnect(this, SIGNAL(reverseGeoReady(QString)),
+ &updateLocation, SLOT(setAddress(QString)));
+
+ disconnect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SIGNAL(statusUpdate(QString,bool)));
+
+ disconnect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ this, SLOT(backupUpdateLocationDialogData(QString,bool)));
}
void UserInfo::paintEvent(QPaintEvent *aPaintEvent)
painter.drawPixmap(bottomRect, m_backgroundBottomImage);
}
+void UserInfo::restoreUnsendMessage()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ m_backupMessage = settings.value(USER_UNSEND_MESSAGE, "").toString();
+ m_backupFacebookPublishPolicity =
+ settings.value(USER_UNSEND_MESSAGE_PUBLISH_POLICITY, false).toBool();
+}
+
QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
{
qDebug() << __PRETTY_FUNCTION__;
Q_UNUSED(errorMessage);
if (!m_messageUpdateVerified) {
- QString message = QObject::tr("Status update failed\n\nYour message is saved to textbox "
- "until sending will succeed");
-
- qDebug() << "m_messageText: " << m_messageText;
- qDebug() << "m_backupMessage: " << m_backupMessage;
if (m_messageText != m_backupMessage && !m_backupMessage.isEmpty())
- emit notificateUpdateFailing(message);
+ emit notificateUpdateFailing(tr("Location update failed\n\nYour message is saved to "
+ "textbox until sending will succeed"));
}
m_messageUpdateVerified = true;