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"
40 #include "mainwindow.h"
42 // These MUST BE HERE, compiling for Maemo fails if moved
44 #include <QtMaemo5/QMaemo5InformationBox>
45 #include <QtGui/QX11Info>
46 #include <X11/Xatom.h>
48 #endif // Q_WS_MAEMO_5
50 // values for setting screen size in desktop matching N900 screen size
51 const int N900_APP_WIDTH = 800;
52 const int N900_APP_HEIGHT = 449;
54 MainWindow::MainWindow(QWidget *parent)
55 : QMainWindow(parent),
56 m_drawOwnLocationCrosshair(false),
60 m_ownLocationCrosshair(0),
63 m_fullScreenButton(0),
68 qDebug() << __PRETTY_FUNCTION__;
73 QHBoxLayout *layout = new QHBoxLayout;
74 layout->addWidget(m_mapView);
76 setCentralWidget(new QWidget());
77 centralWidget()->setLayout(layout);
79 buildFriendListPanel();
82 m_settingsDialog = new SettingsDialog(this);
83 m_settingsDialog->hide();
84 connect(m_settingsDialog, SIGNAL(enableAutomaticLocationUpdate(bool,int)),
85 this, SIGNAL(enableAutomaticLocationUpdate(bool,int)));
88 setWindowTitle(tr("Situare"));
90 // set stacking order of widgets
91 m_zoomButtonPanel->stackUnder(m_userPanel);
92 if(m_fullScreenButton) {
93 m_fullScreenButton->stackUnder(m_zoomButtonPanel);
94 m_osmLicense->stackUnder(m_fullScreenButton);
96 m_osmLicense->stackUnder(m_zoomButtonPanel);
98 m_ownLocationCrosshair->stackUnder(m_osmLicense);
99 m_mapScale->stackUnder(m_ownLocationCrosshair);
100 m_mapView->stackUnder(m_mapScale);
102 this->toggleProgressIndicator(true);
106 // set screen size in desktop matching N900 screen size
107 resize(N900_APP_WIDTH, N900_APP_HEIGHT);
110 MainWindow::~MainWindow()
112 qDebug() << __PRETTY_FUNCTION__;
119 qDeleteAll(m_queue.begin(), m_queue.end());
122 qDeleteAll(m_error_queue.begin(), m_error_queue.end());
123 m_error_queue.clear();
126 void MainWindow::buildFullScreenButton()
128 qDebug() << __PRETTY_FUNCTION__;
130 m_fullScreenButton = new QToolButton(this);
131 m_fullScreenButton->setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
132 m_fullScreenButton->setFixedSize(m_fullScreenButton->sizeHint());
133 connect(m_fullScreenButton, SIGNAL(clicked()),
134 this, SLOT(toggleFullScreen()));
135 #endif // Q_WS_MAEMO_5
139 void MainWindow::buildFriendListPanel()
141 qDebug() << __PRETTY_FUNCTION__;
143 m_friendsListPanel = new FriendListPanel(this);
144 m_friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
146 m_friendsListPanel->stackUnder(m_friendsListPanelSidebar);
148 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
149 m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
151 connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
152 this, SIGNAL(findFriend(QPointF)));
154 connect(m_mapView, SIGNAL(viewResized(QSize)),
155 m_friendsListPanel, SLOT(screenResized(QSize)));
157 connect(this, SIGNAL(locationItemClicked(QList<QString>)),
158 m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
160 connect(m_mapView, SIGNAL(viewResized(QSize)),
161 m_friendsListPanelSidebar, SLOT(reDrawSidebar(QSize)));
164 void MainWindow::buildInformationBox(const QString &message, bool modal)
166 qDebug() << __PRETTY_FUNCTION__;
169 QMaemo5InformationBox *msgBox = new QMaemo5InformationBox(this);
170 QLabel *label = new QLabel(msgBox);
171 label->setAlignment(Qt::AlignCenter);
172 label->setText(message);
173 msgBox->setWidget(label);
176 msgBox->setTimeout(QMaemo5InformationBox::NoTimeout);
178 msgBox->setTimeout(QMaemo5InformationBox::DefaultTimeout);
181 QMessageBox *msgBox = new QMessageBox(this);
182 msgBox->button(QMessageBox::Ok);
183 msgBox->setText(message);
184 msgBox->setModal(modal);
190 void MainWindow::buildManualLocationCrosshair()
192 qDebug() << __PRETTY_FUNCTION__;
194 m_ownLocationCrosshair = new QLabel(this);
195 QPixmap crosshairImage(":/res/images/sight.png");
196 m_ownLocationCrosshair->setPixmap(crosshairImage);
197 m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
198 m_ownLocationCrosshair->hide();
199 m_ownLocationCrosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
201 connect(m_mapView, SIGNAL(viewResized(QSize)),
202 this, SLOT(drawOwnLocationCrosshair(QSize)));
205 void MainWindow::buildMap()
207 qDebug() << __PRETTY_FUNCTION__;
209 m_mapView = new MapView(this);
211 buildZoomButtonPanel();
213 buildManualLocationCrosshair();
214 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(viewResized(QSize)),
230 this, SLOT(drawMapScale(QSize)));
232 connect(m_mapView, SIGNAL(viewResized(QSize)),
233 this, SLOT(setViewPortSize(QSize)));
235 connect(this, SIGNAL(zoomLevelChanged(int)),
236 m_mapView, SLOT(setZoomLevel(int)));
238 connect(m_mapView, SIGNAL(viewZoomFinished()),
239 this, SIGNAL(viewZoomFinished()));
242 void MainWindow::buildMapScale()
244 m_mapScale = new MapScale(this);
245 connect(this, SIGNAL(newMapResolution(qreal)),
246 m_mapScale, SLOT(updateMapResolution(qreal)));
249 void MainWindow::buildOsmLicense()
251 qDebug() << __PRETTY_FUNCTION__;
253 m_osmLicense = new QLabel(this);
254 m_osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
255 m_osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
256 m_osmLicense->setText("<font color='black'>" + OSM_LICENSE + "</font>");
257 m_osmLicense->setFont(QFont("Nokia Sans", 9));
258 m_osmLicense->resize(m_osmLicense->fontMetrics().width(OSM_LICENSE),
259 m_osmLicense->fontMetrics().height());
261 connect(m_mapView, SIGNAL(viewResized(QSize)),
262 this, SLOT(drawOsmLicense(QSize)));
265 void MainWindow::buildUserInfoPanel()
267 qDebug() << __PRETTY_FUNCTION__;
269 m_userPanel = new UserInfoPanel(this);
270 m_userPanelSidebar = new PanelSideBar(this, LEFT);
272 m_userPanelSidebar->stackUnder(m_friendsListPanel);
273 m_userPanel->stackUnder(m_userPanelSidebar);
275 connect(m_userPanel, SIGNAL(findUser(QPointF)),
276 this, SIGNAL(findUser(QPointF)));
278 connect(this, SIGNAL(userLocationReady(User*)),
279 m_userPanel, SLOT(userDataReceived(User*)));
281 connect(m_userPanel, SIGNAL(requestReverseGeo()),
282 this, SIGNAL(requestReverseGeo()));
284 connect(this, SIGNAL(reverseGeoReady(QString)),
285 m_userPanel, SIGNAL(reverseGeoReady(QString)));
287 connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
288 this, SIGNAL(statusUpdate(QString,bool)));
290 connect(m_userPanel, SIGNAL(refreshUserData()),
291 this, SIGNAL(refreshUserData()));
293 connect(m_mapView, SIGNAL(viewResized(QSize)),
294 m_userPanel, SLOT(screenResized(QSize)));
296 connect(this, SIGNAL(updateWasSuccessful()),
297 m_userPanel, SIGNAL(updateWasSuccessful()));
299 connect(this, SIGNAL(messageSendingFailed(QString)),
300 m_userPanel, SIGNAL(messageSendingFailed(QString)));
302 connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString)),
303 this, SIGNAL(notificateUpdateFailing(QString)));
306 void MainWindow::buildWebView()
308 qDebug() << __PRETTY_FUNCTION__;
311 m_webView = new QWebView;
314 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
316 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
318 connect(m_webView->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),
319 this, SLOT(webViewRequestFinished(QNetworkReply*)));
320 connect(m_webView, SIGNAL(urlChanged(const QUrl &)),
321 this, SIGNAL(updateCredentials(QUrl)));
322 connect(m_webView, SIGNAL(loadFinished(bool)),
323 this, SLOT(loadDone(bool)));
329 void MainWindow::buildZoomButtonPanel()
331 qDebug() << __PRETTY_FUNCTION__;
333 m_zoomButtonPanel = new ZoomButtonPanel(this);
335 connect(m_zoomButtonPanel->zoomInButton(), SIGNAL(clicked()),
336 this, SIGNAL(zoomIn()));
338 connect(m_zoomButtonPanel->zoomOutButton(), SIGNAL(clicked()),
339 this, SIGNAL(zoomOut()));
341 connect(this, SIGNAL(zoomLevelChanged(int)),
342 m_zoomButtonPanel, SLOT(resetButtons()));
344 connect(this, SIGNAL(maxZoomLevelReached()),
345 m_zoomButtonPanel, SLOT(disableZoomInButton()));
347 connect(this, SIGNAL(minZoomLevelReached()),
348 m_zoomButtonPanel, SLOT(disableZoomOutButton()));
350 connect(m_mapView, SIGNAL(viewResized(QSize)),
351 m_zoomButtonPanel, SLOT(screenResized(QSize)));
354 void MainWindow::clearCookieJar()
356 qDebug() << __PRETTY_FUNCTION__;
361 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
363 QList<QNetworkCookie> emptyList;
366 m_cookieJar->setAllCookies(emptyList);
367 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
370 void MainWindow::createMenus()
372 qDebug() << __PRETTY_FUNCTION__;
375 m_loginAct = new QAction(tr("Login"), this);
376 connect(m_loginAct, SIGNAL(triggered()),
377 this, SIGNAL(loginActionPressed()));
380 m_toSettingsAct = new QAction(tr("Settings"), this);
381 connect(m_toSettingsAct, SIGNAL(triggered()),
382 this, SLOT(openSettingsDialog()));
385 m_gpsToggleAct = new QAction(tr("GPS"), this);
386 m_gpsToggleAct->setCheckable(true);
388 connect(m_gpsToggleAct, SIGNAL(triggered(bool)),
389 this, SIGNAL(gpsTriggered(bool)));
391 // automatic centering
392 m_autoCenteringAct = new QAction(tr("Auto centering"), this);
393 m_autoCenteringAct->setCheckable(true);
394 connect(m_autoCenteringAct, SIGNAL(triggered(bool)),
395 this, SIGNAL(autoCenteringTriggered(bool)));
397 // build the actual menu
398 m_viewMenu = menuBar()->addMenu(tr("Main"));
399 m_viewMenu->addAction(m_loginAct);
400 m_viewMenu->addAction(m_toSettingsAct);
401 m_viewMenu->addAction(m_gpsToggleAct);
402 m_viewMenu->addAction(m_autoCenteringAct);
403 m_viewMenu->setObjectName(tr("Menu"));
406 void MainWindow::dialogFinished(int status)
408 qDebug() << __PRETTY_FUNCTION__;
410 QDialog *dialog = m_queue.takeFirst();
411 LoginDialog *loginDialog = qobject_cast<LoginDialog *>(dialog);
415 loginDialog->userInput(m_email, m_password);
417 QStringList urlParts;
418 urlParts.append(FACEBOOK_LOGINBASE);
419 urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
420 urlParts.append(INTERVAL1);
421 urlParts.append(SITUARE_LOGIN_SUCCESS);
422 urlParts.append(INTERVAL2);
423 urlParts.append(SITUARE_LOGIN_FAILURE);
424 urlParts.append(FACEBOOK_LOGIN_ENDING);
426 emit saveUsername(m_email);
428 m_webView->load(QUrl(urlParts.join(EMPTY)));
429 toggleProgressIndicator(true);
431 emit cancelLoginProcess();
435 dialog->deleteLater();
437 if(!m_error_queue.isEmpty() && m_errorShown == false) {
438 showErrorInformationBox();
440 if(!m_queue.isEmpty()) {
441 showInformationBox();
446 void MainWindow::drawFullScreenButton(const QSize &size)
448 qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
450 if(m_fullScreenButton) {
451 m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
453 size.height() - m_fullScreenButton->size().height());
457 void MainWindow::drawMapScale(const QSize &size)
459 const int LEFT_SCALE_MARGIN = 10;
460 const int BOTTOM_SCALE_MARGIN = 2;
461 qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
463 m_mapScale->move(PANEL_PEEK_AMOUNT + LEFT_SCALE_MARGIN,
464 size.height() - m_mapScale->size().height() - BOTTOM_SCALE_MARGIN);
467 void MainWindow::drawOsmLicense(const QSize &size)
469 qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
471 m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
473 size.height() - m_osmLicense->fontMetrics().height());
476 void MainWindow::drawOwnLocationCrosshair(const QSize &size)
478 qDebug() << __PRETTY_FUNCTION__;
480 if (m_drawOwnLocationCrosshair && m_ownLocationCrosshair != 0) {
481 m_ownLocationCrosshair->move(size.width()/2 - m_ownLocationCrosshair->pixmap()->width()/2,
482 size.height()/2 - m_ownLocationCrosshair->pixmap()->height()/2);
486 void MainWindow::errorDialogFinished(int status)
488 qDebug() << __PRETTY_FUNCTION__;
491 QDialog *dialog = m_error_queue.takeFirst();
493 dialog->deleteLater();
494 m_errorShown = false;
496 if(!m_error_queue.isEmpty())
497 showErrorInformationBox();
498 else if(!m_queue.isEmpty())
499 showInformationBox();
502 void MainWindow::gpsTimeout()
504 qDebug() << __PRETTY_FUNCTION__;
506 buildInformationBox(tr("GPS timeout"));
509 void MainWindow::grabZoomKeys(bool grab)
511 qDebug() << __PRETTY_FUNCTION__;
514 // Can't grab keys unless we have a window id
518 unsigned long val = (grab) ? 1 : 0;
519 Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
523 XChangeProperty (QX11Info::display(),
529 reinterpret_cast<unsigned char *>(&val),
533 #endif // Q_WS_MAEMO_5
536 void MainWindow::keyPressEvent(QKeyEvent* event)
538 qDebug() << __PRETTY_FUNCTION__;
540 switch (event->key()) {
551 QWidget::keyPressEvent(event);
554 void MainWindow::loadCookies()
556 qDebug() << __PRETTY_FUNCTION__;
558 QSettings settings(DIRECTORY_NAME, FILE_NAME);
560 QStringList list = settings.value(COOKIES, EMPTY).toStringList();
562 if(!list.isEmpty()) {
563 QList<QNetworkCookie> cookieList;
564 for(int i=0;i<list.count();i++) {
565 cookieList.append(QNetworkCookie::parseCookies(list.at(i).toAscii()));
569 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
571 m_cookieJar->setAllCookies(cookieList);
572 m_webView->page()->networkAccessManager()->setCookieJar(m_cookieJar);
577 void MainWindow::loadDone(bool done)
579 qDebug() << __PRETTY_FUNCTION__;
581 // for the first time the login page is opened, we need to refresh it to get cookies working
589 QWebFrame* frame = m_webView->page()->currentFrame();
593 QWebElementCollection emailCollection = frame->findAllElements("input[name=email]");
595 foreach (QWebElement element, emailCollection) {
596 element.setAttribute("value", m_email.toAscii());
599 QWebElementCollection passwordCollection = frame->findAllElements("input[name=pass]");
600 foreach (QWebElement element, passwordCollection) {
601 element.setAttribute("value", m_password.toAscii());
603 // find connect button
604 QWebElementCollection buttonCollection = frame->findAllElements("input[name=login]");
605 foreach (QWebElement element, buttonCollection)
607 QPoint pos(element.geometry().center());
609 // send a mouse click event to the web page
610 QMouseEvent event0(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton,
612 QApplication::sendEvent(m_webView->page(), &event0);
613 QMouseEvent event1(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton,
615 QApplication::sendEvent(m_webView->page(), &event1);
621 void MainWindow::loggedIn(bool logged)
623 qDebug() << __PRETTY_FUNCTION__;
628 m_loginAct->setText(tr("Logout"));
634 m_loginAct->setText(tr("Login"));
636 updateItemVisibility(m_loggedIn);
639 void MainWindow::loginFailed()
641 qDebug() << __PRETTY_FUNCTION__;
645 toggleProgressIndicator(false);
650 void MainWindow::loginUsingCookies()
652 qDebug() << __PRETTY_FUNCTION__;
657 QStringList urlParts;
658 urlParts.append(FACEBOOK_LOGINBASE);
659 urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
660 urlParts.append(INTERVAL1);
661 urlParts.append(SITUARE_LOGIN_SUCCESS);
662 urlParts.append(INTERVAL2);
663 urlParts.append(SITUARE_LOGIN_FAILURE);
664 urlParts.append(FACEBOOK_LOGIN_ENDING);
666 m_webView->load(QUrl(urlParts.join(EMPTY)));
670 void MainWindow::openSettingsDialog()
672 qDebug() << __PRETTY_FUNCTION__;
674 m_settingsDialog->enableSituareSettings(m_gpsToggleAct->isChecked() && m_loggedIn);
675 m_settingsDialog->show();
678 void MainWindow::queueDialog(QDialog *dialog)
680 qDebug() << __PRETTY_FUNCTION__;
682 // check is dialog is modal, for now all modal dialogs have hihger priority i.e. errors
683 if(dialog->isModal()) {
684 m_error_queue.append(dialog);
686 m_queue.append(dialog);
689 // show error dialog if there is only one error dialog in the queue and no error dialog is shown
690 if(m_error_queue.count() == 1 && m_errorShown == false)
691 showErrorInformationBox();
692 else if(m_queue.count() == 1 && m_errorShown == false)
693 showInformationBox();
696 void MainWindow::saveCookies()
698 qDebug() << __PRETTY_FUNCTION__;
701 m_cookieJar = new NetworkCookieJar(new QNetworkCookieJar(this));
703 QList<QNetworkCookie> cookieList = m_cookieJar->allCookies();
706 for(int i=0;i<cookieList.count();i++) {
707 QNetworkCookie cookie = cookieList.at(i);
708 QByteArray byteArray = cookie.toRawForm(QNetworkCookie::Full);
709 list.append(QString(byteArray));
711 list.removeDuplicates();
713 QSettings settings(DIRECTORY_NAME, FILE_NAME);
714 settings.setValue(COOKIES, list);
717 void MainWindow::setAutoCenteringButtonEnabled(bool enabled)
719 qDebug() << __PRETTY_FUNCTION__;
721 m_autoCenteringAct->setChecked(enabled);
724 void MainWindow::setGPSButtonEnabled(bool enabled)
726 qDebug() << __PRETTY_FUNCTION__;
728 m_gpsToggleAct->setChecked(enabled);
731 setOwnLocationCrosshairVisibility(!enabled);
733 m_autoCenteringAct->setVisible(enabled);
736 void MainWindow::setMapViewScene(QGraphicsScene *scene)
738 qDebug() << __PRETTY_FUNCTION__;
740 m_mapView->setScene(scene);
743 void MainWindow::setOwnLocationCrosshairVisibility(bool visibility)
745 qDebug() << __PRETTY_FUNCTION__;
748 m_ownLocationCrosshair->show();
749 m_drawOwnLocationCrosshair = true;
750 drawOwnLocationCrosshair(QSize(m_viewPortWidth, m_viewPortHeight));
752 m_ownLocationCrosshair->hide();
753 m_drawOwnLocationCrosshair = false;
757 void MainWindow::setUsername(const QString &username)
759 qDebug() << __PRETTY_FUNCTION__;
764 void MainWindow::setViewPortSize(const QSize &size)
766 qDebug() << __PRETTY_FUNCTION__;
768 m_viewPortWidth = size.width();
769 m_viewPortHeight = size.height();
772 void MainWindow::toggleFullScreen()
774 qDebug() << __PRETTY_FUNCTION__;
776 if(windowState() == Qt::WindowNoState)
782 void MainWindow::showErrorInformationBox()
784 qDebug() << __PRETTY_FUNCTION__;
786 if(m_error_queue.count()) {
788 QDialog *dialog = m_error_queue.first();
789 connect(dialog, SIGNAL(finished(int)),
790 this, SLOT(errorDialogFinished(int)));
795 void MainWindow::showInformationBox()
797 qDebug() << __PRETTY_FUNCTION__;
799 if(m_queue.count()) {
800 QDialog *dialog = m_queue.first();
801 connect(dialog, SIGNAL(finished(int)),
802 this, SLOT(dialogFinished(int)));
807 void MainWindow::startLoginProcess()
809 qDebug() << __PRETTY_FUNCTION__;
811 LoginDialog *loginDialog = new LoginDialog();
813 emit fetchUsernameFromSettings();
815 loginDialog->clearTextFields();
817 if(!m_email.isEmpty())
818 loginDialog->setEmailField(m_email);
820 queueDialog(loginDialog);
823 void MainWindow::toggleProgressIndicator(bool value)
825 qDebug() << __PRETTY_FUNCTION__;
828 setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
831 #endif // Q_WS_MAEMO_5
834 void MainWindow::updateItemVisibility(bool show)
836 qDebug() << __PRETTY_FUNCTION__;
839 m_friendsListPanel->show();
840 m_friendsListPanelSidebar->show();
842 m_userPanelSidebar->show();
844 if(m_drawOwnLocationCrosshair) {
845 m_ownLocationCrosshair->show();
846 setGPSButtonEnabled(false);
847 emit gpsTriggered(false);
850 m_friendsListPanel->closePanel();
851 m_friendsListPanel->hide();
852 m_friendsListPanelSidebar->hide();
853 m_userPanel->closePanel();
855 m_userPanelSidebar->hide();
856 m_ownLocationCrosshair->hide();
860 const QString MainWindow::username()
862 qDebug() << __PRETTY_FUNCTION__;
867 void MainWindow::webViewRequestFinished(QNetworkReply *reply)
869 qDebug() << __PRETTY_FUNCTION__;
872 qDebug() << reply->error() << reply->errorString();
873 toggleProgressIndicator(false);