From c60231e670c7f1a98e155879e7e227a4b910d89a Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Wed, 17 Mar 2010 18:37:42 +0300 Subject: [PATCH] Update data when device unlocked. But only if user prohibited update when locked. --- mainwidget.cpp | 11 +++++++++++ mainwidget.hpp | 1 + 2 files changed, 12 insertions(+) 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__ */ -- 1.7.9.5