\r
m_textEdit = new QTextEdit;\r
\r
- if ( userMessage.isEmpty() )\r
+ if (userMessage.isEmpty())\r
{\r
- m_textEdit->setText( tr("Message:") );\r
+ m_textEdit->setText(tr("Message:"));\r
m_textEdit->selectAll();\r
- connect(m_textEdit, SIGNAL(selectionChanged()), this, SLOT(textSelectionChanged()));\r
+\r
+ connect(m_textEdit, SIGNAL(selectionChanged()),\r
+ this, SLOT(textSelectionChanged()));\r
}\r
else\r
{\r
- m_textEdit->setText( userMessage );\r
- m_textEdit->document()->setModified( true );\r
+ m_textEdit->setText(userMessage);\r
+ m_textEdit->document()->setModified(true);\r
}\r
\r
QScrollArea *scrollArea = new QScrollArea();\r
QVBoxLayout* scrollAreaLayout = new QVBoxLayout;\r
scrollAreaLayout->setSpacing(0);\r
scrollAreaLayout->setMargin(0);\r
- scrollAreaLayout->addWidget( m_textEdit );\r
+ scrollAreaLayout->addWidget(m_textEdit);\r
\r
QWidget* scrollAreaWidget = new QWidget;\r
- scrollAreaWidget->setLayout( scrollAreaLayout );\r
+ scrollAreaWidget->setLayout(scrollAreaLayout);\r
\r
scrollArea->setWidget(scrollAreaWidget);\r
\r
m_charCountLabel = new QLabel;\r
m_charCountLabel->setNum(MESSAGE_MAX_LENGTH);\r
\r
- gridLayout->addWidget(new QLabel(tr("Location:")), 0, 0, 1, 1, Qt::AlignTop | Qt::AlignLeft );\r
+ gridLayout->addWidget(new QLabel(tr("Location:")), 0, 0, 1, 1, Qt::AlignTop | Qt::AlignLeft);\r
gridLayout->addWidget(m_locationLabel, 0, 1, 1, 3);\r
gridLayout->addWidget(scrollArea, 1, 0, 1, 4);\r
gridLayout->addWidget(m_checkBox, 2, 0, 1, 2);\r
- gridLayout->addWidget(m_charCountLabel,2, 2, 1, 1, Qt::AlignCenter );\r
+ gridLayout->addWidget(m_charCountLabel,2, 2, 1, 1, Qt::AlignCenter);\r
gridLayout->addWidget(buttonBox, 2, 3, 2, 1, Qt::AlignTop);\r
\r
- gridLayout->setColumnMinimumWidth( 2, 2 * m_charCountLabel->fontMetrics().width(\r
- m_charCountLabel->text() ));\r
+ gridLayout->setColumnMinimumWidth(2, 2 * m_charCountLabel->fontMetrics().width(\r
+ m_charCountLabel->text()));\r
\r
setLayout(gridLayout);\r
\r
const int LAYOUT_COLUMN_ONE_STRETCH = 10;\r
const int LAYOUT_TOP_MARGIN = 15;\r
- gridLayout->setColumnStretch( 1, LAYOUT_COLUMN_ONE_STRETCH );\r
+ gridLayout->setColumnStretch(1, LAYOUT_COLUMN_ONE_STRETCH);\r
\r
QMargins layoutMargins = gridLayout->contentsMargins();\r
- layoutMargins.setTop( LAYOUT_TOP_MARGIN );\r
- gridLayout->setContentsMargins( layoutMargins );\r
+ layoutMargins.setTop(LAYOUT_TOP_MARGIN);\r
+ gridLayout->setContentsMargins(layoutMargins);\r
+\r
+ connect(sendButton, SIGNAL(clicked()),\r
+ this, SLOT(sendUpdate()));\r
\r
- connect(sendButton, SIGNAL(clicked()), this, SLOT(sendUpdate()));\r
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));\r
- connect(m_textEdit, SIGNAL(textChanged()), this, SLOT(textChanged()));\r
+ connect(cancelButton, SIGNAL(clicked()),\r
+ this, SLOT(reject()));\r
+\r
+ connect(m_textEdit, SIGNAL(textChanged()),\r
+ this, SLOT(textChanged()));\r
\r
#ifdef Q_WS_MAEMO_5\r
- if (QAbstractKineticScroller * scroller = scrollArea->property("kineticScroller").value<\r
+ if (QAbstractKineticScroller *scroller = scrollArea->property("kineticScroller").value<\r
QAbstractKineticScroller *>()) {\r
scroller->setOvershootPolicy(QAbstractKineticScroller::OvershootAlwaysOff);\r
}\r
\r
new TextEditAutoResizer(m_textEdit);\r
setAttribute(Qt::WA_Maemo5StackedWindow);\r
- setWindowFlags( Qt::Window );\r
+ setWindowFlags(Qt::Window);\r
#endif\r
}\r
\r
UpdateLocationDialog::~UpdateLocationDialog()\r
{\r
- qWarning() << __PRETTY_FUNCTION__;\r
+ qDebug() << __PRETTY_FUNCTION__;\r
}\r
\r
void UpdateLocationDialog::setAddress(const QString &address)\r
{\r
qDebug() << __PRETTY_FUNCTION__;\r
\r
- QString msgText( m_textEdit->toPlainText() );\r
+ QString msgText = m_textEdit->toPlainText();\r
\r
- if ( msgText.length() > MESSAGE_MAX_LENGTH )\r
+ if (msgText.length() > MESSAGE_MAX_LENGTH)\r
{\r
- int cursorPos ( m_textEdit->textCursor().position() );\r
+ int cursorPos = m_textEdit->textCursor().position();\r
\r
QTextCursor textCursor = m_textEdit->textCursor();\r
- int removedChars( msgText.length() - MESSAGE_MAX_LENGTH );\r
+ int removedChars = msgText.length() - MESSAGE_MAX_LENGTH;\r
+ m_textEdit->blockSignals(true);\r
\r
- m_textEdit->setText( msgText.left(cursorPos - removedChars) + msgText.mid( cursorPos ) );\r
+ m_textEdit->setText( msgText.left(cursorPos - removedChars) + msgText.mid(cursorPos));\r
+ m_textEdit->blockSignals(false);\r
\r
- textCursor.setPosition( cursorPos - removedChars );\r
- m_textEdit->setTextCursor( textCursor );\r
+ textCursor.setPosition(cursorPos - removedChars);\r
+ m_textEdit->setTextCursor(textCursor);\r
}\r
\r
- m_charCountLabel->setNum(MESSAGE_MAX_LENGTH - m_textEdit->toPlainText().length() );\r
+ m_charCountLabel->setNum(MESSAGE_MAX_LENGTH - m_textEdit->toPlainText().length());\r
}\r
\r
void UpdateLocationDialog::textSelectionChanged()\r
{\r
qDebug() << __PRETTY_FUNCTION__;\r
\r
- if ( !m_textEdit->document()->isModified() )\r
+ if (!m_textEdit->document()->isModified())\r
{\r
m_textEdit->clear();\r
}\r
UserInfo::UserInfo(QWidget *parent)
: QWidget(parent),
- m_expanded(false)
+ m_expanded(false),
+ m_updateLocation(0)
{
qDebug() << __PRETTY_FUNCTION__;
this, SIGNAL(refreshUserData()));
connect(m_findButton, SIGNAL(clicked()),
- this, SLOT(findButtonClicked()));
+ this, SLOT(findButtonClicked()));
setFixedWidth(BACKGROUND_WIDTH);
emit requestReverseGeo();
- UpdateLocationDialog updateLocation(m_backupMessage, m_backupFacebookPublishPolicity, this);
+ delete m_updateLocation;
+ m_updateLocation = new UpdateLocationDialog(m_backupMessage, m_backupFacebookPublishPolicity,
+ this);
connect(this, SIGNAL(reverseGeoReady(QString)),
- &updateLocation, SLOT(setAddress(QString)));
+ m_updateLocation, SLOT(setAddress(QString)));
- connect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
this, SIGNAL(statusUpdate(QString,bool)));
- connect(&updateLocation, SIGNAL(statusUpdate(QString,bool)),
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
this, SLOT(backupUpdateLocationDialogData(QString,bool)));
- updateLocation.exec();
+ connect(m_updateLocation, SIGNAL(finished(int)),
+ this, SLOT(updateLocationDialogFinished(int)));
- 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)));
+ m_updateLocation->show();
}
void UserInfo::paintEvent(QPaintEvent *aPaintEvent)
m_messageUpdateVerified = true;
}
+
+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;
+ }
+
+}