From: Max Lapan Date: Wed, 17 Mar 2010 15:37:42 +0000 (+0300) Subject: Update data when device unlocked. X-Git-Tag: v0.1~11 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=c60231e670c7f1a98e155879e7e227a4b910d89a;p=yandex-traffic Update data when device unlocked. But only if user prohibited update when locked. --- diff --git a/mainwidget.cpp b/mainwidget.cpp index 89e9289..2a97dbc 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -3,6 +3,8 @@ #include "mainwidget.hpp" #include "settingsDialog.hpp" #include "connection.hpp" +#include "devstate.hpp" +#include "settings.hpp" // -------------------------------------------------- @@ -33,6 +35,7 @@ MainWidget::MainWidget () connect (_traffic, SIGNAL (updated ()), SLOT (trafficUpdated ())); connect (_timer, SIGNAL (timeout ()), SLOT (updateData ())); + connect (DeviceState::instance (), SIGNAL (lockChanged (bool)), SLOT (deviceLockChanged (bool))); updateData (); } @@ -175,3 +178,11 @@ void MainWidget::mousePressEvent (QMouseEvent *event) if (todo == updateAction) _traffic->update (); } + + +void MainWidget::deviceLockChanged (bool locked) +{ + if (!_settings->check (Settings::C_UpdateWhenLocked)) + if (!locked) + updateData (); +} diff --git a/mainwidget.hpp b/mainwidget.hpp index 00df461..eee235f 100644 --- a/mainwidget.hpp +++ b/mainwidget.hpp @@ -41,6 +41,7 @@ protected: protected slots: void trafficUpdated (); + void deviceLockChanged (bool locked); }; #endif /* __MAINWIDGET_H__ */