Added include for QTimer in header file.
[easylist] / mainform.cpp
index d821902..c366754 100755 (executable)
@@ -8,10 +8,9 @@ MainForm::MainForm(QWidget *parent) :
     ui->setupUi(this);\r
     settings = new QSettings(WILLEM_LIU, EASY_LIST);\r
 \r
-     /* Make a call every x milliseconds */\r
-     QTimer *timer = new QTimer(this);\r
-     connect(timer, SIGNAL(timeout()), this, SLOT(Keep_backlight_on()));\r
-     timer->start(30000);\r
+    /* Make a call every x milliseconds */\r
+    timer = new QTimer(this);\r
+    connect(timer, SIGNAL(timeout()), this, SLOT(Keep_backlight_on()));\r
 \r
     requestWebpage = new RequestWebpage(this);\r
     connect(requestWebpage, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotSyncList(QNetworkReply*)));\r
@@ -184,6 +183,7 @@ void MainForm::on_actionAbout_triggered()
     aboutText.append(QDate::currentDate().toString("yyyy"));\r
     aboutText.append("<br><br>");\r
     aboutText.append("Created by Willem Liu.<br>");\r
+    aboutText.append("Thanks to Ade.<br>");\r
     aboutText.append("Created with QtCreator.<br><br>");\r
     aboutText.append("Please <a href='http://www.willemliu.nl/donate'>donate</a> any amount you deem this app is worthy to keep me going on.<br><br>");\r
     aboutText.append("</body></html>");\r
@@ -279,6 +279,18 @@ void MainForm::on_actionSetting_triggered()
 void MainForm::on_actionKeep_backlight_on_triggered()\r
 {\r
     bool setBacklight = ui->actionKeep_backlight_on->isChecked();\r
+    if(setBacklight)\r
+    {\r
+       if(timer->isActive() == false)\r
+        {\r
+            timer->start(5000);\r
+        }\r
+    }\r
+    else\r
+    {\r
+        qDebug() << "Backlight: " << setBacklight;\r
+        timer->stop();\r
+    }\r
     qDebug() << "Checked Backlight" << setBacklight;\r
     settings->setValue(CHECKED_BACKLIGHT, setBacklight);\r
 }\r
@@ -288,7 +300,7 @@ void MainForm::Keep_backlight_on()
     bool setBacklight = ui->actionKeep_backlight_on->isChecked();\r
     if(setBacklight)\r
     {\r
-        /* qDebug() << "Backlight: " << setBacklight; */\r
+        qDebug() << "Backlight: " << setBacklight;\r
         QString strUnlock = "dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_display_blanking_pause";\r
         QProcess::startDetached(strUnlock);\r
     }\r