Update translation.
[yandex-traffic] / mainwidget.cpp
index 5f4771c..902aa02 100644 (file)
@@ -32,7 +32,7 @@ MainWidget::MainWidget ()
     applySettings ();
 
     connect (_traffic, SIGNAL (updated ()), SLOT (trafficUpdated ()));
-    connect (_timer, SIGNAL (timeout ()), SLOT (updateDate ()));
+    connect (_timer, SIGNAL (timeout ()), SLOT (updateData ()));
 
     updateData ();
 }
@@ -73,7 +73,7 @@ void MainWidget::trafficUpdated ()
 
         if (_settings->check (Settings::C_ShowRank)) {
             data.append (QString::number (info.level ()));
-            data.append (info.level () > 1 ? tr (" points") : tr (" point"));
+            data.append (tr ("%n point(s)", "", info.level ()));
             first = false;
         }
 
@@ -106,6 +106,8 @@ void MainWidget::updateData ()
 #if CHECK_FOR_CONNECTION
     update = ConnectionChecker::instance ()->checkConnection (_settings->check (Settings::C_UpdateOnGSM),
                                                               _settings->check (Settings::C_UpdateOnWiFi));
+    if (!_settings->check (Settings::C_UpdateWhenLocked))
+        update &= !DeviceState::instance ()->locked ();
 #endif
 
     if (update)
@@ -155,3 +157,22 @@ void MainWidget::applySettings ()
     else
         _timer->setInterval (1000 * 60 * _settings->updateInterval ());
 }
+
+
+void MainWidget::mousePressEvent (QMouseEvent *event)
+{
+    QMenu menu;
+    QAction *settingsAction, *updateAction, *todo;
+
+    settingsAction = menu.addAction (tr ("Settings"));
+    updateAction = menu.addAction (tr ("Update"));
+
+    todo = menu.exec (event->pos ());
+    if (!todo)
+        return;
+
+    if (todo == settingsAction)
+        settingsDialog ();
+    if (todo == updateAction)
+        _traffic->update ();
+}