X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fgui%2Fsettingsdialog.cpp;h=f84f8c88e0a8c0c9e16e788031f86c3786b7de73;hp=757a0ffad5bde906f28e3e22bf198d886670a4da;hb=72f0ccb17472f83c1cba569879e185eb7cd60e31;hpb=b637fdb3f5803104d4da20e6455f6de4de075927 diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 757a0ff..f84f8c8 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include "settings.h" #include "db.h" #include "daemon.h" +#include "cache.h" QMap SettingsDialog::sites_ = Eniro::getSites(); @@ -54,6 +56,8 @@ autostartSelector_(0) QLabel* cacheLabel = new QLabel(tr("Cache size (numbers)")); cacheInput_ = new QLineEdit(Settings::instance()->get("cache_size")); cacheInput_->setValidator(new QIntValidator(0, 10000, this)); + QPushButton* cacheResetButton = new QPushButton(tr("Clear"), this); + connect(cacheResetButton, SIGNAL(pressed()), this, SLOT(resetCache())); siteSelector_ = new ButtonSelector(tr("Eniro site"), this); QString site = Settings::instance()->get("eniro_site"); @@ -95,7 +99,7 @@ autostartSelector_(0) autostartSelector_->addItem(tr("Disabled"), "0"); autostartSelector_->setCurrentIndex(autostart == "1" ? 0 : 1); - QPushButton* submitButton = new QPushButton(tr("Save")); + QPushButton* submitButton = new QPushButton(tr("Save"), this); connect(submitButton, SIGNAL(pressed()), this, SLOT(saveSettings())); username->addWidget(usernameLabel); @@ -104,14 +108,19 @@ autostartSelector_(0) password->addWidget(passwordInput_); cache->addWidget(cacheLabel); cache->addWidget(cacheInput_); + cache->addWidget(cacheResetButton); left->addLayout(username); left->addLayout(password); left->addLayout(cache); left->addWidget(siteSelector_); left->addWidget(autostartSelector_); + QDialogButtonBox* buttons = new QDialogButtonBox; + buttons->setCenterButtons(false); + buttons->addButton(submitButton, QDialogButtonBox::AcceptRole); + mainLayout->addLayout(left); - mainLayout->addWidget(submitButton); + mainLayout->addWidget(buttons); setLayout(mainLayout); @@ -166,3 +175,13 @@ void SettingsDialog::setVisible(bool visible) } } + +void SettingsDialog::resetCache() +{ + int ret = Cache::instance().clear(); + + if(ret >= 0) + { + QMaemo5InformationBox::information(this, tr("%n number(s) were deleted from cache", "", ret)); + } +}