connect(dictListWidget, SIGNAL(itemClicked(QListWidgetItem*)),
this, SLOT(itemSelected(QListWidgetItem*)));
+ connect(dictListWidget, SIGNAL(itemActivated(QListWidgetItem*)),
+ this, SLOT(changed()));
+
refreshDictsList();
#ifndef Q_WS_MAEMO_5
}
void DictManagerWidget::showEvent(QShowEvent *e) {
+ _changed = false;
refreshDictsList();
QWidget::showEvent(e);
}
#ifndef Q_WS_MAEMO_5
if(_save) {
#else
- if(QMessageBox::question(this, "Save", "Do you want to save changes?",
- QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+ if(_changed &&
+ QMessageBox::question(this, "Save", "Do you want to save changes?",
+ QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
#endif
QList<CommonDictInterface*> checkedDicts;
emit selectedDictionaries(checkedDicts);
}
+ _changed = false;
QWidget::hideEvent(e);
}
}
+void DictManagerWidget::changed() {
+ _changed=true;
+}
+
+
#ifndef Q_WS_MAEMO_5
void DictManagerWidget::save() {
_save = true;
/*! Shows plugin's settings dialog*/
void settingsButtonClicked();
+ //! Each change of state (that needs to be saved) should call this to indicate state change
+ void changed();
+
private:
QPushButton* addNewDictButton;
QPushButton* removeDictButton;
//holds association between items on list and CommonDictInterface objects
QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
GUIInterface* guiInterface;
+ bool _changed;
void refreshDictsList();
#ifndef Q_WS_MAEMO_5
"Do you want to delete all bookmarks? (This action cannot be revoked)",
QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
backbone->removeAllBookmarks();
- backbone->search(searchString);
+ if(searchString.size())
+ backbone->search(searchString);
}
}
verticalLayout->addWidget(searchInBookmarksCheckBox);
- connect(historySizeSpinBox, SIGNAL(editingFinished()), this,
+ connect(historySizeSpinBox, SIGNAL(valueChanged(int)), this,
SLOT(changed()));
- connect(searchResultSizeSpinBox, SIGNAL(editingFinished()), this,
+ connect(searchResultSizeSpinBox, SIGNAL(valueChanged(int)), this,
SLOT(changed()));
connect(searchInDictionariesCheckBox, SIGNAL(toggled(bool)), this,
SLOT(changed()));
setMinimumWidth(250);
setMaximumWidth(250);
footerLayout = new QHBoxLayout(this);
- closeButton = new QPushButton(tr("Ok"));
+ closeButton = new QPushButton(tr("Save"));
footerLayout->addStretch(0);
footerLayout->addWidget(closeButton);
verticalLayout->addLayout(footerLayout);
#ifndef Q_WS_MAEMO_5
_save = false;
#endif
- _changed = false;
settings = guiInterface->settings();
historySizeSpinBox->setValue(
else
searchInDictionariesCheckBox->setChecked(false);
+ _changed = false;
QDialog::showEvent(e);
}
delete settings;
settings = 0;
}
+ _changed = false;
}