2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Kaj Wallin - kaj.wallin@ixonos.com
7 Jussi Laitinen jussi.laitinen@ixonos.com
8 Sami Rämö - sami.ramo@ixonos.com
9 Ville Tiensuu - ville.tiensuu@ixonos.com
11 Situare is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 version 2 as published by the Free Software Foundation.
15 Situare is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Situare; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 #include <QtAlgorithms>
31 #include "facebookservice/facebookauthentication.h"
32 #include "friendlistpanel.h"
33 #include "logindialog.h"
34 #include "map/mapview.h"
35 #include "settingsdialog.h"
36 #include "userinfopanel.h"
37 #include "zoombuttonpanel.h"
39 #include "mainwindow.h"
41 // These MUST BE HERE, compiling for Maemo fails if moved
43 #include <QtMaemo5/QMaemo5InformationBox>
44 #include <QtGui/QX11Info>
45 #include <X11/Xatom.h>
47 #endif // Q_WS_MAEMO_5
49 // values for setting screen size in desktop matching N900 screen size
50 const int N900_APP_WIDTH = 800;
51 const int N900_APP_HEIGHT = 449;
53 MainWindow::MainWindow(QWidget *parent)
54 : QMainWindow(parent),
55 m_drawOwnLocationCrosshair(false),
59 m_ownLocationCrosshair(0),
62 m_fullScreenButton(0),
66 qDebug() << __PRETTY_FUNCTION__;
71 QHBoxLayout *layout = new QHBoxLayout;
72 layout->addWidget(m_mapView);
74 setCentralWidget(new QWidget());
75 centralWidget()->setLayout(layout);
77 buildFriendListPanel();
80 m_settingsDialog = new SettingsDialog(this);
81 m_settingsDialog->hide();
82 connect(m_settingsDialog, SIGNAL(enableAutomaticLocationUpdate(bool,int)),
83 this, SIGNAL(enableAutomaticLocationUpdate(bool,int)));
86 setWindowTitle(tr("Situare"));
88 // set stacking order of widgets
89 m_zoomButtonPanel->stackUnder(m_userPanel);
90 if(m_fullScreenButton) {
91 m_fullScreenButton->stackUnder(m_zoomButtonPanel);
92 m_osmLicense->stackUnder(m_fullScreenButton);
94 m_osmLicense->stackUnder(m_zoomButtonPanel);
95 m_ownLocationCrosshair->stackUnder(m_osmLicense);
96 m_mapView->stackUnder(m_ownLocationCrosshair);
98 this->toggleProgressIndicator(true);
102 // set screen size in desktop matching N900 screen size
103 resize(N900_APP_WIDTH, N900_APP_HEIGHT);
106 MainWindow::~MainWindow()
108 qDebug() << __PRETTY_FUNCTION__;
115 qDeleteAll(m_queue.begin(), m_queue.end());
118 qDeleteAll(m_error_queue.begin(), m_error_queue.end());
119 m_error_queue.clear();
122 void MainWindow::automaticLocationUpdateEnabled(bool enabled)
124 m_settingsDialog->setAutomaticLocationUpdateSettings(enabled);
127 void MainWindow::buildFullScreenButton()
129 qDebug() << __PRETTY_FUNCTION__;
131 m_fullScreenButton = new QToolButton(this);
132 m_fullScreenButton->setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
133 m_fullScreenButton->setFixedSize(m_fullScreenButton->sizeHint());
134 connect(m_fullScreenButton, SIGNAL(clicked()),
135 this, SLOT(toggleFullScreen()));
136 #endif // Q_WS_MAEMO_5
140 void MainWindow::buildFriendListPanel()
142 qDebug() << __PRETTY_FUNCTION__;
144 m_friendsListPanel = new FriendListPanel(this);
145 m_friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
147 m_friendsListPanel->stackUnder(m_friendsListPanelSidebar);
149 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
150 m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
152 connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
153 this, SIGNAL(findFriend(QPointF)));
155 connect(m_mapView, SIGNAL(viewResized(QSize)),
156 m_friendsListPanel, SLOT(screenResized(QSize)));
158 connect(this, SIGNAL(locationItemClicked(QList<QString>)),
159 m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
161 connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
162 m_friendsListPanelSidebar, SLOT(reDrawSidebar(int, int)));
165 void MainWindow::buildInformationBox(const QString &message, bool modal)
167 qDebug() << __PRETTY_FUNCTION__;
170 QMaemo5InformationBox *msgBox = new QMaemo5InformationBox(this);
171 QLabel *label = new QLabel(msgBox);
172 label->setAlignment(Qt::AlignCenter);
173 label->setText(message);
174 msgBox->setWidget(label);
177 msgBox->setTimeout(QMaemo5InformationBox::NoTimeout);
179 msgBox->setTimeout(QMaemo5InformationBox::DefaultTimeout);
182 QMessageBox *msgBox = new QMessageBox(this);
183 msgBox->button(QMessageBox::Ok);
184 msgBox->setText(message);
185 msgBox->setModal(modal);
191 void MainWindow::buildManualLocationCrosshair()
193 qDebug() << __PRETTY_FUNCTION__;
195 m_ownLocationCrosshair = new QLabel(this);
196 QPixmap crosshairImage(":/res/images/sight.png");
197 m_ownLocationCrosshair->setPixmap(crosshairImage);
198 m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
199 m_ownLocationCrosshair->hide();
200 m_ownLocationCrosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
202 connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
203 this, SLOT(drawOwnLocationCrosshair(int, int)));
206 void MainWindow::buildMap()
208 qDebug() << __PRETTY_FUNCTION__;
210 m_mapView = new MapView(this);
212 buildZoomButtonPanel();
214 buildManualLocationCrosshair();
215 buildFullScreenButton();
217 connect(m_mapView, SIGNAL(viewScrolled(QPoint)),
218 this, SIGNAL(mapViewScrolled(QPoint)));
220 connect(this, SIGNAL(centerToSceneCoordinates(QPoint)),
221 m_mapView, SLOT(centerToSceneCoordinates(QPoint)));
223 connect(m_mapView, SIGNAL(viewResized(QSize)),
224 this, SIGNAL(mapViewResized(QSize)));
226 connect(m_mapView, SIGNAL(viewResized(QSize)),
227 this, SLOT(drawFullScreenButton(QSize)));
229 connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
230 this, SLOT(setViewPortSize(int, int)));
232 connect(this, SIGNAL(zoomLevelChanged(int)),
233 m_mapView, SLOT(setZoomLevel(int)));
235 connect(m_mapView, SIGNAL(viewZoomFinished()),
236 this, SIGNAL(viewZoomFinished()));
239 void MainWindow::buildOsmLicense()
241 qDebug() << __PRETTY_FUNCTION__;
243 m_osmLicense = new QLabel(this);
244 m_osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
245 m_osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
246 m_osmLicense->setText("<font color='black'>" + OSM_LICENSE + "</font>");
247 m_osmLicense->setFont(QFont("Nokia Sans", 9));
248 m_osmLicense->resize(m_osmLicense->fontMetrics().width(OSM_LICENSE),
249 m_osmLicense->fontMetrics().height());
251 connect(m_mapView, SIGNAL(viewResized(QSize)),
252 this, SLOT(drawOsmLicense(QSize)));
255 void MainWindow::buildUserInfoPanel()
257 qDebug() << __PRETTY_FUNCTION__;
259 m_userPanel = new UserInfoPanel(this);
260 m_userPanelSidebar = new PanelSideBar(this, LEFT);
262 m_userPanelSidebar->stackUnder(m_friendsListPanel);
263 m_userPanel->stackUnder(m_userPanelSidebar);
265 connect(m_userPanel, SIGNAL(findUser(QPointF)),
266 this, SIGNAL(findUser(QPointF)));
268 connect(this, SIGNAL(userLocationReady(User*)),
269 m_userPanel, SLOT(userDataReceived(User*)));
271 connect(m_userPanel, SIGNAL(requestReverseGeo()),
272 this, SIGNAL(requestReverseGeo()));
274 connect(this, SIGNAL(reverseGeoReady(QString)),
275 m_userPanel, SIGNAL(reverseGeoReady(QString)));
277 connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
278 this, SIGNAL(statusUpdate(QString,bool)));
280 connect(m_userPanel, SIGNAL(refreshUserData()),
281 this, SIGNAL(refreshUserData()));
283 connect(m_mapView, SIGNAL(viewResized(QSize)),
284 m_userPanel, SLOT(screenResized(QSize)));
286 connect(this, SIGNAL(updateWasSuccessful()),
287 m_userPanel, SIGNAL(updateWasSuccessful()));
289 connect(this, SIGNAL(messageSendingFailed(QString)),
290 m_userPanel, SIGNAL(messageSendingFailed(QString)));
292 connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString)),
293 this, SIGNAL(notificateUpdateFailing(QString)));
296 void MainWindow::buildWebView()
298 qDebug() << __PRETTY_FUNCTION__;
301 m_webView = new QWebView;
304 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
306 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
308 connect(m_webView->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),
309 this, SLOT(webViewRequestFinished(QNetworkReply*)));
310 connect(m_webView, SIGNAL(urlChanged(const QUrl &)),
311 this, SIGNAL(updateCredentials(QUrl)));
312 connect(m_webView, SIGNAL(loadFinished(bool)),
313 this, SLOT(loadDone(bool)));
319 void MainWindow::buildZoomButtonPanel()
321 qDebug() << __PRETTY_FUNCTION__;
323 m_zoomButtonPanel = new ZoomButtonPanel(this);
325 connect(m_zoomButtonPanel->zoomInButton(), SIGNAL(clicked()),
326 this, SIGNAL(zoomIn()));
328 connect(m_zoomButtonPanel->zoomOutButton(), SIGNAL(clicked()),
329 this, SIGNAL(zoomOut()));
331 connect(this, SIGNAL(zoomLevelChanged(int)),
332 m_zoomButtonPanel, SLOT(resetButtons()));
334 connect(this, SIGNAL(maxZoomLevelReached()),
335 m_zoomButtonPanel, SLOT(disableZoomInButton()));
337 connect(this, SIGNAL(minZoomLevelReached()),
338 m_zoomButtonPanel, SLOT(disableZoomOutButton()));
340 connect(m_mapView, SIGNAL(viewResized(QSize)),
341 m_zoomButtonPanel, SLOT(screenResized(QSize)));
344 void MainWindow::clearCookieJar()
346 qDebug() << __PRETTY_FUNCTION__;
351 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
353 QList<QNetworkCookie> emptyList;
356 m_cookieJar->setAllCookies(emptyList);
357 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
360 void MainWindow::createMenus()
362 qDebug() << __PRETTY_FUNCTION__;
365 m_loginAct = new QAction(tr("Login"), this);
366 connect(m_loginAct, SIGNAL(triggered()),
367 this, SIGNAL(loginActionPressed()));
370 m_toSettingsAct = new QAction(tr("Settings"), this);
371 connect(m_toSettingsAct, SIGNAL(triggered()),
372 this, SLOT(openSettingsDialog()));
375 m_gpsToggleAct = new QAction(tr("GPS"), this);
376 m_gpsToggleAct->setCheckable(true);
378 connect(m_gpsToggleAct, SIGNAL(triggered(bool)),
379 this, SIGNAL(gpsTriggered(bool)));
381 // automatic centering
382 m_autoCenteringAct = new QAction(tr("Auto centering"), this);
383 m_autoCenteringAct->setCheckable(true);
384 connect(m_autoCenteringAct, SIGNAL(triggered(bool)),
385 this, SIGNAL(autoCenteringTriggered(bool)));
387 // build the actual menu
388 m_viewMenu = menuBar()->addMenu(tr("Main"));
389 m_viewMenu->addAction(m_loginAct);
390 m_viewMenu->addAction(m_toSettingsAct);
391 m_viewMenu->addAction(m_gpsToggleAct);
392 m_viewMenu->addAction(m_autoCenteringAct);
393 m_viewMenu->setObjectName(tr("Menu"));
396 void MainWindow::dialogFinished(int status)
398 qDebug() << __PRETTY_FUNCTION__;
400 QDialog *dialog = m_queue.takeFirst();
401 LoginDialog *loginDialog = qobject_cast<LoginDialog *>(dialog);
405 loginDialog->userInput(m_email, m_password);
407 QStringList urlParts;
408 urlParts.append(FACEBOOK_LOGINBASE);
409 urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
410 urlParts.append(INTERVAL1);
411 urlParts.append(SITUARE_LOGIN_SUCCESS);
412 urlParts.append(INTERVAL2);
413 urlParts.append(SITUARE_LOGIN_FAILURE);
414 urlParts.append(FACEBOOK_LOGIN_ENDING);
416 emit saveUsername(m_email);
418 m_webView->load(QUrl(urlParts.join(EMPTY)));
419 toggleProgressIndicator(true);
421 emit cancelLoginProcess();
425 dialog->deleteLater();
427 if(!m_error_queue.isEmpty() && m_errorShown == false) {
428 showErrorInformationBox();
430 if(!m_queue.isEmpty()) {
431 showInformationBox();
436 void MainWindow::drawFullScreenButton(const QSize &size)
438 qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
440 if(m_fullScreenButton) {
441 m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
443 size.height() - m_fullScreenButton->size().height());
447 void MainWindow::drawOsmLicense(const QSize &size)
449 qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
451 m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
453 size.height() - m_osmLicense->fontMetrics().height());
456 void MainWindow::drawOwnLocationCrosshair(int width, int height)
458 qDebug() << __PRETTY_FUNCTION__;
460 if (m_drawOwnLocationCrosshair && m_ownLocationCrosshair != 0) {
461 m_ownLocationCrosshair->move(width/2 - m_ownLocationCrosshair->pixmap()->width()/2,
462 height/2 - m_ownLocationCrosshair->pixmap()->height()/2);
466 void MainWindow::errorDialogFinished(int status)
468 qDebug() << __PRETTY_FUNCTION__;
471 QDialog *dialog = m_error_queue.takeFirst();
473 dialog->deleteLater();
474 m_errorShown = false;
476 if(!m_error_queue.isEmpty())
477 showErrorInformationBox();
478 else if(!m_queue.isEmpty())
479 showInformationBox();
482 void MainWindow::gpsTimeout()
484 qDebug() << __PRETTY_FUNCTION__;
486 buildInformationBox(tr("GPS timeout"));
489 void MainWindow::grabZoomKeys(bool grab)
491 qDebug() << __PRETTY_FUNCTION__;
494 // Can't grab keys unless we have a window id
498 unsigned long val = (grab) ? 1 : 0;
499 Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
503 XChangeProperty (QX11Info::display(),
509 reinterpret_cast<unsigned char *>(&val),
513 #endif // Q_WS_MAEMO_5
516 void MainWindow::keyPressEvent(QKeyEvent* event)
518 qDebug() << __PRETTY_FUNCTION__;
520 switch (event->key()) {
531 QWidget::keyPressEvent(event);
534 void MainWindow::loadCookies()
536 qDebug() << __PRETTY_FUNCTION__;
538 QSettings settings(DIRECTORY_NAME, FILE_NAME);
540 QStringList list = settings.value(COOKIES, EMPTY).toStringList();
542 if(!list.isEmpty()) {
543 QList<QNetworkCookie> cookieList;
544 for(int i=0;i<list.count();i++) {
545 cookieList.append(QNetworkCookie::parseCookies(list.at(i).toAscii()));
549 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
551 m_cookieJar->setAllCookies(cookieList);
552 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
557 void MainWindow::loadDone(bool done)
559 qDebug() << __PRETTY_FUNCTION__;
561 // for the first time the login page is opened, we need to refresh it to get cookies working
569 QWebFrame* frame = m_webView->page()->currentFrame();
573 QWebElementCollection emailCollection = frame->findAllElements("input[name=email]");
575 foreach (QWebElement element, emailCollection) {
576 element.setAttribute("value", m_email.toAscii());
579 QWebElementCollection passwordCollection = frame->findAllElements("input[name=pass]");
580 foreach (QWebElement element, passwordCollection) {
581 element.setAttribute("value", m_password.toAscii());
583 // find connect button
584 QWebElementCollection buttonCollection = frame->findAllElements("input[name=login]");
585 foreach (QWebElement element, buttonCollection)
587 QPoint pos(element.geometry().center());
589 // send a mouse click event to the web page
590 QMouseEvent event0(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton,
592 QApplication::sendEvent(m_webView->page(), &event0);
593 QMouseEvent event1(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton,
595 QApplication::sendEvent(m_webView->page(), &event1);
601 void MainWindow::loggedIn(bool logged)
603 qDebug() << __PRETTY_FUNCTION__;
608 m_loginAct->setText(tr("Logout"));
614 m_loginAct->setText(tr("Login"));
616 updateItemVisibility(m_loggedIn);
619 void MainWindow::loginFailed()
621 qDebug() << __PRETTY_FUNCTION__;
625 toggleProgressIndicator(false);
630 void MainWindow::loginUsingCookies()
632 qDebug() << __PRETTY_FUNCTION__;
637 QStringList urlParts;
638 urlParts.append(FACEBOOK_LOGINBASE);
639 urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
640 urlParts.append(INTERVAL1);
641 urlParts.append(SITUARE_LOGIN_SUCCESS);
642 urlParts.append(INTERVAL2);
643 urlParts.append(SITUARE_LOGIN_FAILURE);
644 urlParts.append(FACEBOOK_LOGIN_ENDING);
646 m_webView->load(QUrl(urlParts.join(EMPTY)));
650 void MainWindow::openSettingsDialog()
652 qDebug() << __PRETTY_FUNCTION__;
654 m_settingsDialog->enableSituareSettings(m_gpsToggleAct->isChecked() && m_loggedIn);
655 m_settingsDialog->show();
658 void MainWindow::requestAutomaticLocationUpdateSettings()
660 qDebug() << __PRETTY_FUNCTION__;
662 m_settingsDialog->emitAutomaticLocationUpdateSettings();
665 void MainWindow::queueDialog(QDialog *dialog)
667 qDebug() << __PRETTY_FUNCTION__;
669 // check is dialog is modal, for now all modal dialogs have hihger priority i.e. errors
670 if(dialog->isModal()) {
671 m_error_queue.append(dialog);
673 m_queue.append(dialog);
676 // show error dialog if there is only one error dialog in the queue and no error dialog is shown
677 if(m_error_queue.count() == 1 && m_errorShown == false)
678 showErrorInformationBox();
679 else if(m_queue.count() == 1 && m_errorShown == false)
680 showInformationBox();
683 void MainWindow::saveCookies()
685 qDebug() << __PRETTY_FUNCTION__;
688 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
690 QList<QNetworkCookie> cookieList = m_cookieJar->allCookies();
693 for(int i=0;i<cookieList.count();i++) {
694 QNetworkCookie cookie = cookieList.at(i);
695 QByteArray byteArray = cookie.toRawForm(QNetworkCookie::Full);
696 list.append(QString(byteArray));
698 list.removeDuplicates();
700 QSettings settings(DIRECTORY_NAME, FILE_NAME);
701 settings.setValue(COOKIES, list);
704 void MainWindow::setAutoCenteringButtonEnabled(bool enabled)
706 qDebug() << __PRETTY_FUNCTION__;
708 m_autoCenteringAct->setChecked(enabled);
711 void MainWindow::setGPSButtonEnabled(bool enabled)
713 qDebug() << __PRETTY_FUNCTION__;
715 m_gpsToggleAct->setChecked(enabled);
718 setOwnLocationCrosshairVisibility(!enabled);
720 m_autoCenteringAct->setVisible(enabled);
723 void MainWindow::setMapViewScene(QGraphicsScene *scene)
725 qDebug() << __PRETTY_FUNCTION__;
727 m_mapView->setScene(scene);
730 void MainWindow::setOwnLocationCrosshairVisibility(bool visibility)
732 qDebug() << __PRETTY_FUNCTION__;
735 m_ownLocationCrosshair->show();
736 m_drawOwnLocationCrosshair = true;
737 drawOwnLocationCrosshair(m_viewPortWidth, m_viewPortHeight);
739 m_ownLocationCrosshair->hide();
740 m_drawOwnLocationCrosshair = false;
744 void MainWindow::setUsername(const QString &username)
746 qDebug() << __PRETTY_FUNCTION__;
751 void MainWindow::setViewPortSize(int width, int height)
753 qDebug() << __PRETTY_FUNCTION__;
755 m_viewPortWidth = width;
756 m_viewPortHeight = height;
759 bool MainWindow::showEnableAutomaticUpdateLocationDialog()
761 QMessageBox msgBox(QMessageBox::Question, tr("Automatic location update"),
762 tr("Are you sure you want to enable automatic location update?"),
763 QMessageBox::Ok | QMessageBox::Cancel, 0);
764 msgBox.button(QMessageBox::Ok)->setText(tr("Ok"));
765 qWarning() << __PRETTY_FUNCTION__;
766 int ret = msgBox.exec();
767 qWarning() << __PRETTY_FUNCTION__;
768 if (ret == QMessageBox::Ok)
774 void MainWindow::toggleFullScreen()
776 qDebug() << __PRETTY_FUNCTION__;
778 if(windowState() == Qt::WindowNoState)
784 void MainWindow::showErrorInformationBox()
786 qDebug() << __PRETTY_FUNCTION__;
788 if(m_error_queue.count()) {
790 QDialog *dialog = m_error_queue.first();
791 connect(dialog, SIGNAL(finished(int)),
792 this, SLOT(errorDialogFinished(int)));
797 void MainWindow::showInformationBox()
799 qDebug() << __PRETTY_FUNCTION__;
801 if(m_queue.count()) {
802 QDialog *dialog = m_queue.first();
803 connect(dialog, SIGNAL(finished(int)),
804 this, SLOT(dialogFinished(int)));
809 void MainWindow::startLoginProcess()
811 qDebug() << __PRETTY_FUNCTION__;
813 LoginDialog *loginDialog = new LoginDialog();
815 emit fetchUsernameFromSettings();
817 loginDialog->clearTextFields();
819 if(!m_email.isEmpty())
820 loginDialog->setEmailField(m_email);
822 queueDialog(loginDialog);
825 void MainWindow::toggleProgressIndicator(bool value)
827 qDebug() << __PRETTY_FUNCTION__;
830 setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
833 #endif // Q_WS_MAEMO_5
836 void MainWindow::updateItemVisibility(bool show)
838 qDebug() << __PRETTY_FUNCTION__;
841 m_friendsListPanel->show();
842 m_friendsListPanelSidebar->show();
844 m_userPanelSidebar->show();
846 if(m_drawOwnLocationCrosshair) {
847 m_ownLocationCrosshair->show();
848 setGPSButtonEnabled(false);
849 emit gpsTriggered(false);
852 m_friendsListPanel->closePanel();
853 m_friendsListPanel->hide();
854 m_friendsListPanelSidebar->hide();
855 m_userPanel->closePanel();
857 m_userPanelSidebar->hide();
858 m_ownLocationCrosshair->hide();
862 const QString MainWindow::username()
864 qDebug() << __PRETTY_FUNCTION__;
869 void MainWindow::webViewRequestFinished(QNetworkReply *reply)
871 qDebug() << __PRETTY_FUNCTION__;
874 qDebug() << reply->error() << reply->errorString();
875 toggleProgressIndicator(false);