verticalLayout->addWidget(searchInBookmarksCheckBox);
+ connect(historySizeSpinBox, SIGNAL(valueChanged(int)), this,
+ SLOT(changed()));
+ connect(searchResultSizeSpinBox, SIGNAL(valueChanged(int)), this,
+ SLOT(changed()));
+ connect(searchInDictionariesCheckBox, SIGNAL(toggled(bool)), this,
+ SLOT(changed()));
+ connect(searchInBookmarksCheckBox, SIGNAL(toggled(bool)), this,
+ SLOT(changed()));
+
+
settings = 0;
#ifndef Q_WS_MAEMO_5
setMinimumWidth(250);
setMaximumWidth(250);
+ footerLayout = new QHBoxLayout(this);
+ closeButton = new QPushButton(tr("Save"));
+ footerLayout->addStretch(0);
+ footerLayout->addWidget(closeButton);
+ verticalLayout->addLayout(footerLayout);
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
void SettingsWidget::showEvent(QShowEvent *e) {
+ #ifndef Q_WS_MAEMO_5
+ _save = false;
+ #endif
settings = guiInterface->settings();
historySizeSpinBox->setValue(
else
searchInDictionariesCheckBox->setChecked(false);
+ _changed = false;
QDialog::showEvent(e);
}
void SettingsWidget::hideEvent(QHideEvent *e) {
QDialog::hideEvent(e);
- if(settings) {
+ #ifndef Q_WS_MAEMO_5
+ if(settings && _save) {
+ #else
+ if(settings && _changed &&
+ QMessageBox::question(this, "Save", "Do you want to save changes?",
+ QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+
+ #endif
Settings* newSettings = new Settings;
newSettings->setValue("history_size",
QString::number(historySizeSpinBox->value()));
}
}
+ }
+ if(settings) {
delete settings;
settings = 0;
}
+ _changed = false;
+}
+
+
+void SettingsWidget::changed() {
+ _changed = true;
}
+
+#ifndef Q_WS_MAEMO_5
+ void SettingsWidget::save() {
+ _save = true;
+ hide();
+ }
+#endif