summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtSpellCheckerWindow.cpp')
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Swift/QtUI/QtSpellCheckerWindow.cpp b/Swift/QtUI/QtSpellCheckerWindow.cpp
index f955668..ff6ef39 100644
--- a/Swift/QtUI/QtSpellCheckerWindow.cpp
+++ b/Swift/QtUI/QtSpellCheckerWindow.cpp
@@ -31,8 +31,8 @@ QtSpellCheckerWindow::QtSpellCheckerWindow(SettingsProvider* settings, QWidget*
void QtSpellCheckerWindow::setFromSettings() {
ui_.spellChecker->setChecked(settings_->getSetting(SettingConstants::SPELL_CHECKER));
- ui_.personalPathContent->insert(P2QSTRING(settings_->getSetting(SettingConstants::PERSONAL_DICT_PATH)));
- ui_.pathContent->insert(P2QSTRING(settings_->getSetting(SettingConstants::DICT_PATH)));
+ ui_.personalPathContent->setText(P2QSTRING(settings_->getSetting(SettingConstants::PERSONAL_DICT_PATH)));
+ ui_.pathContent->setText(P2QSTRING(settings_->getSetting(SettingConstants::DICT_PATH)));
ui_.currentLanguageValue->setText(P2QSTRING(settings_->getSetting(SettingConstants::DICT_FILE)));
std::string currentPath = settings_->getSetting(SettingConstants::DICT_PATH);
QString filename = "*.dic";
@@ -63,7 +63,7 @@ void QtSpellCheckerWindow::handleApply() {
settings_->storeSetting(SettingConstants::SPELL_CHECKER, ui_.spellChecker->isChecked());
QList<QListWidgetItem* > selectedLanguage = ui_.languageView->selectedItems();
if (!selectedLanguage.empty()) {
- settings_->storeSetting(SettingConstants::DICT_FILE, Q2PSTRING(selectedLanguage[0]->text()));
+ settings_->storeSetting(SettingConstants::DICT_FILE, Q2PSTRING((selectedLanguage.first())->text()));
}
emit settingsChanged();
this->done(0);
@@ -76,13 +76,18 @@ void QtSpellCheckerWindow::handleCancel() {
void QtSpellCheckerWindow::handlePathButton() {
std::string currentPath = settings_->getSetting(SettingConstants::DICT_PATH);
QString dirpath = QFileDialog::getExistingDirectory(this, tr("Dictionary Path"), P2QSTRING(currentPath));
+ if (dirpath.compare(P2QSTRING(currentPath))) {
+ ui_.languageView->clear();
+ settings_->storeSetting(SettingConstants::DICT_FILE, "");
+ ui_.currentLanguageValue->setText(" ");
+ }
if (!dirpath.isEmpty()) {
if (!dirpath.endsWith("/")) {
dirpath.append("/");
}
settings_->storeSetting(SettingConstants::DICT_PATH, Q2PSTRING(dirpath));
QDir dictDirectory = QDir(dirpath);
- ui_.pathContent->insert(dirpath);
+ ui_.pathContent->setText(dirpath);
QString filename = "*.dic";
QStringList files = dictDirectory.entryList(QStringList(filename), QDir::Files);
showFiles(files);
@@ -92,9 +97,11 @@ void QtSpellCheckerWindow::handlePathButton() {
void QtSpellCheckerWindow::handlePersonalPathButton() {
std::string currentPath = settings_->getSetting(SettingConstants::PERSONAL_DICT_PATH);
QString filename = QFileDialog::getOpenFileName(this, tr("Select Personal Dictionary"), P2QSTRING(currentPath), tr("(*.dic"));
+ settings_->storeSetting(SettingConstants::PERSONAL_DICT_PATH, Q2PSTRING(filename));
}
void QtSpellCheckerWindow::showFiles(const QStringList& files) {
+ ui_.languageView->clear();
for (int i = 0; i < files.size(); ++i) {
ui_.languageView->insertItem(i, files[i]);
}