X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=mainform.cpp;h=c36675458d5b09d749e3ad48272e08ee0391219e;hb=HEAD;hp=1be0d42bf6a5f658a786571794bd9826900c7736;hpb=96213bebe45837ef7e6175106cb48c4a186fc001;p=easylist diff --git a/mainform.cpp b/mainform.cpp index 1be0d42..c366754 100755 --- a/mainform.cpp +++ b/mainform.cpp @@ -8,6 +8,10 @@ MainForm::MainForm(QWidget *parent) : ui->setupUi(this); settings = new QSettings(WILLEM_LIU, EASY_LIST); + /* Make a call every x milliseconds */ + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(Keep_backlight_on())); + requestWebpage = new RequestWebpage(this); connect(requestWebpage, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotSyncList(QNetworkReply*))); @@ -28,6 +32,14 @@ MainForm::MainForm(QWidget *parent) : ui->actionChecked_bottom->setChecked(settings->value(CHECKED_ITEMS_TO_BOTTOM).toBool()); on_actionChecked_bottom_triggered(); + // Set a default value for CHECKED_BACKLIGHT + if(settings->contains(CHECKED_BACKLIGHT) == false) + { + settings->setValue(CHECKED_BACKLIGHT, false); + } + ui->actionKeep_backlight_on->setChecked(settings->value(CHECKED_BACKLIGHT).toBool()); + on_actionKeep_backlight_on_triggered(); + // Create a default for landscape mode. landscape = settings->value(LANDSCAPE).toBool(); // If LANDSCAPE exists in QSettings. @@ -171,6 +183,7 @@ void MainForm::on_actionAbout_triggered() aboutText.append(QDate::currentDate().toString("yyyy")); aboutText.append("

"); aboutText.append("Created by Willem Liu.
"); + aboutText.append("Thanks to Ade.
"); aboutText.append("Created with QtCreator.

"); aboutText.append("Please donate any amount you deem this app is worthy to keep me going on.

"); aboutText.append(""); @@ -262,3 +275,33 @@ void MainForm::on_actionSetting_triggered() { changeWidget(3); } + +void MainForm::on_actionKeep_backlight_on_triggered() +{ + bool setBacklight = ui->actionKeep_backlight_on->isChecked(); + if(setBacklight) + { + if(timer->isActive() == false) + { + timer->start(5000); + } + } + else + { + qDebug() << "Backlight: " << setBacklight; + timer->stop(); + } + qDebug() << "Checked Backlight" << setBacklight; + settings->setValue(CHECKED_BACKLIGHT, setBacklight); +} + +void MainForm::Keep_backlight_on() +{ + bool setBacklight = ui->actionKeep_backlight_on->isChecked(); + if(setBacklight) + { + qDebug() << "Backlight: " << setBacklight; + QString strUnlock = "dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_display_blanking_pause"; + QProcess::startDetached(strUnlock); + } +}