Fixed facebookcredentials when expire value is 0 (infinite).
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
+ Henri Lampela - henri.lampela@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
m_loggedIn = false;
m_facebookAuthenticator = new FacebookAuthentication();
+
connect(m_facebookAuthenticator, SIGNAL(credentialsReady()), this, SLOT(loginOk()));
connect(m_facebookAuthenticator, SIGNAL(userExit()), this, SLOT(loginScreenClosed()));
+
+ connect(m_ui, SIGNAL(requestReverseGeo()), this, SLOT(requestAddress()));
+ connect(m_situareService, SIGNAL(reverseGeoReady(QString)), m_ui, SIGNAL(reverseGeoReady(QString)));
+ connect(m_ui, SIGNAL(statusUpdate(QString,bool)), this, SLOT(requestUpdateLocation(QString,bool)));
+
start();
}
}
}
+void SituareEngine::requestAddress()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ QPointF coordinates(65, 25.5); // this will be get from somewhere, map etc...
+ m_situareService->reverseGeo(coordinates);
+}
+
+void SituareEngine::requestUpdateLocation(const QString &status, const bool &publish)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ QPointF coordinates(65, 25.5); // this will be get from somewhere, map etc...
+ m_situareService->updateLocation(coordinates, status, publish);
+}
+
void SituareEngine::updateFriendsList()
{
qDebug() << __PRETTY_FUNCTION__;
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
+ Henri Lampela - henri.lampela@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
*/
void loginScreenClosed();
- /**#include "engine/engine.h"
+ /**
* @brief Slot to intercept signal from successful login
*/
void loginOk();
+ /**
+ * @brief Calls reverseGeo from SituareService to translate coordinates to street address
+ *
+ */
+ void requestAddress();
+
+ /**
+ * @brief Calls updateLocation from SituareService to send the location update to
+ * Situare server.
+ *
+ * @param status Status message
+ * @param publish Publish on Facebook
+ */
+ void requestUpdateLocation(const QString &status, const bool &publish);
+
void updateFriendsList();
/*******************************************************************************
bool FacebookAuthentication::verifyCredentials(const FacebookCredentials &credentials) const
{
qDebug() << __PRETTY_FUNCTION__;
- QString expires = credentials.expires();
- QDateTime expireTime;
- expireTime.setTime_t(expires.toInt());
- QString expiresString = expireTime.toString("dd.MM.yyyy hh:mm:ss");
- qDebug() << expiresString.toAscii();
-
- QDateTime currentTime;
- currentTime = QDateTime::currentDateTime();
- QString currentTimeString = currentTime.toString("dd.MM.yyyy hh:mm:ss");
- qDebug() << currentTimeString.toAscii();
-
- return currentTime < expireTime;
+
+ // if expires value is 0, then credentials are valid forever
+ if(credentials.expires() == "0") {
+ return true;
+ }
+ else {
+ QString expires = credentials.expires();
+ QDateTime expireTime;
+ expireTime.setTime_t(expires.toInt());
+ QString expiresString = expireTime.toString("dd.MM.yyyy hh:mm:ss");
+ qDebug() << expiresString.toAscii();
+
+ QDateTime currentTime;
+ currentTime = QDateTime::currentDateTime();
+ QString currentTimeString = currentTime.toString("dd.MM.yyyy hh:mm:ss");
+ qDebug() << currentTimeString.toAscii();
+
+ return currentTime < expireTime;
+ }
}
void FacebookAuthentication::closeEvent(QCloseEvent *event)
qDebug() << "JSON string";
parseUserData(replyArray);
}
+ else if(replyArray == "") {
+ qDebug() << "No error, update was successful";
+ }
else {
- // no error -> update was successful
- // ToDo: signal UI?
- qDebug() << reply->read(max);
+ // Street address ready
+ QString address(replyArray);
+ emit reverseGeoReady(address);
}
}
-
m_currentRequests.removeAll(reply);
reply->deleteLater();
}
*/
~SituareService();
- /*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
/**
* @brief Retrieves location user and friends information from Situare server
*/
void sendRequest(const QUrl &url, const QString &cookieType, const QString &cookie);
- /*******************************************************************************
- * SIGNALS
- ******************************************************************************/
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
*/
void error(const QString &error);
+ /**
+ * @brief Signals when address data is retrieved
+ *
+ * @param address Street address
+ */
+ void reverseGeoReady(const QString &address);
/**
* @brief Signals when user data is retrieved
*/
void userDataChanged(User &user, QList<User *> &friendList);
- /*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
private:
m_vbox->addWidget(view);
m_vbox->setMargin(0);
- connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
+ //connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
}
ListViewScreen::~ListViewScreen()
connect(m_listViewScreen->m_personalInfo,SIGNAL(launchMessageUpdate()),
this,SLOT(openLocationUpdateDialog()));
+ connect(this, SIGNAL(reverseGeoReady(QString)), m_locationDialog, SLOT(setAddress(QString)));
+ connect(m_locationDialog, SIGNAL(statusUpdate(QString,bool)), this,
+ SIGNAL(statusUpdate(QString,bool)));
}
MainWindow::~MainWindow()
void MainWindow::openLocationUpdateDialog()
{
qDebug() << __PRETTY_FUNCTION__;
+
+ emit requestReverseGeo();
m_locationDialog->exec();
}
#include "facebookservice/facebookauthentication.h"
#include "situareservice/situareservice.h"
#include <QNetworkAccessManager>
-//#include "engine/engine.h"
#include "listviewscreen.h"
#include "mapviewscreen.h"
#include "updatelocation/updatelocationdialog.h"
void switchView(int);
private slots:
+
+ /**
+ * @brief Private slot, which starts UpdateLocationDialog
+ *
+ */
void openLocationUpdateDialog();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+
+signals:
+
+ /**
+ * @brief Signal for requesting reverseGeo from SituareEngine
+ *
+ */
+ void requestReverseGeo();
+
+ /**
+ * @brief Signals, when address data is ready
+ *
+ * @param address Street address
+ */
+ void reverseGeoReady(const QString &address);
+
+ /**
+ * @brief Signal for requestLocationUpdate from SituareEngine
+ *
+ * @param status Status message
+ * @param publish Publish on Facebook
+ */
+ void statusUpdate(const QString &status, const bool &publish);
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
-// SituareEngine *m_situareEngine;
ListViewScreen *m_listViewScreen;
+ UpdateLocationDialog *m_locationDialog; ///< Message dialog
MapViewScreen *m_mapViewScreen;
QStackedWidget *m_situareViews; ///< Stacked widget that hold both view widgets
QAction *m_toListViewAct; ///< Action to trigger switch to list view
QAction *m_toMapViewAct; ///< Action to trigger switch to map view
QMenu *m_viewMenu; ///< Object that hold the view menu items
-
- UpdateLocationDialog *m_locationDialog; ///< Message dialog
};
#endif // MAINWINDOW_H
Copyright (C) 2010 Ixonos Plc. Authors:
Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Henri Lampela - henri.lampela@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
USA.
*/
-#include <QtGui>
#include <QDebug>
#include "updatelocationdialog.h"
QGridLayout *gridLayout = new QGridLayout(this);
QGroupBox *groupBox = new QGroupBox(scrollArea);
- QTextEdit *m_textEdit = new QTextEdit;
- QLineEdit *m_lineEdit = new QLineEdit;
- QCheckBox *m_checkBox = new QCheckBox(tr("Publish in Fabebook"));
+ m_textEdit = new QTextEdit;
+ m_locationLabel = new QLabel;
+ m_checkBox = new QCheckBox(tr("Publish in Facebook"));
- QPushButton *m_okButton = new QPushButton(tr("Send"));
- QDialogButtonBox *m_buttonBox = new QDialogButtonBox(Qt::Vertical);
+ m_okButton = new QPushButton(tr("Send"));
+ m_buttonBox = new QDialogButtonBox(Qt::Vertical);
m_buttonBox->addButton(m_okButton, QDialogButtonBox::ActionRole);
QFormLayout *form = new QFormLayout();
- form->addRow(new QLabel(tr("Location:")), m_lineEdit);
+ form->addRow(new QLabel(tr("Location:")), m_locationLabel);
form->addRow(new QLabel(tr("Message:")), m_textEdit);
form->addWidget(m_checkBox);
gridLayout->addWidget(m_buttonBox, 0, 1, 1, 1);
setLayout(gridLayout);
+ connect(m_okButton, SIGNAL(clicked()), this, SLOT(sendUpdate()));
+
scrollArea->show();
}
+
+void UpdateLocationDialog::setAddress(const QString &address)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ m_locationLabel->setText(address);
+}
+
+void UpdateLocationDialog::sendUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ // coordinates for this call will be get from somewhere, map etc...
+ emit statusUpdate(m_textEdit->toPlainText(), m_checkBox->isChecked());
+
+ this->close();
+}
Copyright (C) 2010 Ixonos Plc. Authors:
Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Henri Lampela - henri.lampela@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#define UPDATELOCATIONDIALOG_H
#include <QDialog>
-#include <QtGui>
#ifdef Q_WS_MAEMO_5
#include <QAbstractKineticScroller>
#endif // Q_WS_MAEMO_5
*/
UpdateLocationDialog(QWidget *parent = 0);
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+
+public slots:
+
+ /**
+ * @brief Public slot, which is used to set the street address to location label
+ *
+ * @param address Street address, result from SituareService's reverseGeo
+ */
+ void setAddress(const QString &address);
+
private slots:
+ /**
+ * @brief Private slot, which is used to connect send button
+ *
+ */
+ void sendUpdate();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+
+signals:
+
+ /**
+ * @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
+ *
+ * @param status Status message
+ * @param publish Publish on Facebook
+ */
+ void statusUpdate(const QString &status, const bool &publish);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+
private:
+
QDialogButtonBox *m_buttonBox; ///< Pointer to DialogButtonBox
QCheckBox *m_checkBox; ///< Pointer to CheckBox
- QLineEdit *m_lineEdit; ///< Pointer to LineEdit
+ QLabel *m_locationLabel; ///< Pointer to locationLabel
QPushButton *m_okButton; ///< Pointer to PushButton
QTextEdit *m_textEdit; ///< Pointer to TextEdit
};