Moved UpdateLocationDialog to be managed by MainWindow.
[situare] / src / ui / userinfo.cpp
index eb34132..83663a9 100644 (file)
@@ -47,8 +47,7 @@ const int LABEL_MAX_WIDTH = BACKGROUND_WIDTH - ICON_WIDTH - 5 * MARGIN;
 
 UserInfo::UserInfo(QWidget *parent)
     : QWidget(parent),
-      m_expanded(false),
-      m_updateLocation(0)
+      m_expanded(false)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -114,38 +113,12 @@ UserInfo::UserInfo(QWidget *parent)
     m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
     m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
 
-    restoreUnsendMessage();
+//    restoreUnsendMessage();
 }
 
 UserInfo::~UserInfo()
 {
     qDebug() << __PRETTY_FUNCTION__;
-
-    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 UserInfo::backupUpdateLocationDialogData(const QString &status, bool publish)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_backupMessage = status;
-    m_backupFacebookPublishPolicity = publish;
-}
-
-void UserInfo::clearUpdateLocationDialogData()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_backupMessage.clear();
-    m_backupFacebookPublishPolicity = false;
 }
 
 void UserInfo::collapse()
@@ -162,31 +135,6 @@ void UserInfo::findButtonClicked()
     emit findUser(m_coordinates);
 }
 
-void UserInfo::messageUpdate()
-{
-    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 UserInfo::mousePressEvent(QMouseEvent *event)
 {
     qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
@@ -233,15 +181,6 @@ void UserInfo::paintEvent(QPaintEvent *event)
     painter.drawPixmap(bottomRect, m_backgroundBottomImage);
 }
 
-void UserInfo::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 UserInfo::setAddress(const QString &address)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -302,27 +241,3 @@ void UserInfo::setUserName(const QString &name)
     m_nameLabel->setText(TextModifier::shortenText(m_nameLabel->fontMetrics(), m_userName,
                                                    LABEL_MAX_WIDTH));
 }
-
-void UserInfo::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;
-    }
-}