connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
scrollArea->show();
+ //setAttribute(Qt::WA_DeleteOnClose, true);
}
UpdateLocationDialog::~UpdateLocationDialog()
// emit m_textEdit sisältö userInfo luokalle talteen
}
-void UpdateLocationDialog::saveMessageAndClose()
-{
- qDebug() << __PRETTY_FUNCTION__ << "NONIIN NONIIN";
- qDebug() << "MIKSET TOIMI!!!!!!!!!";
-
+//void UpdateLocationDialog::saveMessageAndClose(const QString &message)
+//{
+// qDebug() << __PRETTY_FUNCTION__ << "NONIIN NONIIN";
-}
+// emit saveMessage(m_textEdit->toPlainText());
+// this->close();
+//}
void UpdateLocationDialog::setAddress(const QString &address)
{
qDebug() << __PRETTY_FUNCTION__;
// coordinates for this call will be get from somewhere, map etc...
- emit statusUpdate(m_textEdit->toPlainText(), m_checkBox->isChecked());
+ emit statusUpdate(m_textEdit->toPlainText(), m_checkBox->isChecked());
- //this->close();
+ //this->hide();
+ this->close();
}
*
* @param address Street address, result from SituareService's reverseGeo
*/
- void setAddress(const QString &address);
- void saveMessageAndClose();
+ void setAddress(const QString &address);
+// void saveMessageAndClose(const QString &message);
private slots:
******************************************************************************/
signals:
- void saveMessage(const QString &message);
+// void saveMessage(const QString &message);
/**
* @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
******************************************************************************/
private:
- //bool m_messageReceivedOnSituareServer; ///< Indicates when message is received on Situare server
-
QCheckBox *m_checkBox; ///< Pointer to CheckBox
QLabel *m_locationLabel; ///< Pointer to locationLabel
+public:
QTextEdit *m_textEdit; ///< Pointer to TextEdit
};
void UserInfo::setMessageText(const QString &text)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__ << "VIESTI LAITETAAN TALTEEN";
m_messageText = text;
setText(false);
emit findUser(m_coordinates);
}
+QString UserInfo::messageText() const
+{
+ return m_messageText;
+}
+
void UserInfo::messageUpdate()
{
qDebug() << __PRETTY_FUNCTION__;
UpdateLocationDialog updateLocationDialog(this);
+ //updateLocationDialog.m_textEdit->setPlainText("");
+ updateLocationDialog.m_textEdit->setPlainText(messageText());
+ //updateLocationDialog.m_textEdit->setPlainText("Messaging around the world");
+
emit requestReverseGeo();
connect(this, SIGNAL(reverseGeoReady(QString)),
&updateLocationDialog, SLOT(setAddress(QString)));
+
connect(&updateLocationDialog, SIGNAL(statusUpdate(QString, bool)),
this, SIGNAL(statusUpdate(QString, bool)));
+
+// connect(this, SIGNAL(messageUpdatedToSituare()),
+// &updateLocationDialog, SLOT(close())); //poistuu
+
+// /*connect(this, SIGNAL(messageSendingFailed(QString)),
+// &updateLocationDialog, SLOT(saveMessageAndClose(QString)))*/;
+
+// connect(&updateLocationDialog, SIGNAL(saveMessage(QString)),
+// this, SLOT(setMessageText(QString)));
+
+ connect(&updateLocationDialog, SIGNAL(statusUpdate(QString,bool)),
+ this, SLOT(updateUserData(QString,bool)));
+
connect(this, SIGNAL(messageUpdatedToSituare()),
- &updateLocationDialog, SLOT(close()));
- connect(this, SIGNAL(messageSendingFailed(QString)),
- &updateLocationDialog, SLOT(saveMessageAndClose()));
+ this, SLOT(deleteUserData()));
updateLocationDialog.exec();
}
+
+void UserInfo::updateUserData(const QString &status, const bool &publish)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ setMessageText(status);
+ //laita loputkin talteen (publish ja koordinaatit)
+}
+
+void UserInfo::deleteUserData()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ qDebug() << "TEKSTIN SISALTO ENNEN: " << m_messageText;
+ m_messageText.clear();
+ qDebug() << "TEKSTIN SISALTO JALKEEN: " << m_messageText;
+}
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public:
+ QString messageText() const;
/**
* @brief Sets the users current address
*
*
* @param coordinates Reference to users current coordinates
*/
- void setCoordinates(const QPointF &coordinates);
-
- /**
- * @brief Sets the message text
- *
- * @param text Reference to user message
- */
- void setMessageText(const QString &text);
+ void setCoordinates(const QPointF &coordinates);
/**
* @brief Sets the user picture
*/
void setUserName(const QString &name);
+public slots:
+ void deleteUserData();
+ /**
+ * @brief Sets the message text
+ *
+ * @param text Reference to user message
+ */
+ void setMessageText(const QString &text);
+ void updateUserData(const QString &status, const bool &publish);
+
private:
/**
* @brief Set shortened or full-length text to labels.