[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/sonnet
From:       Michel Ludwig <michel.ludwig () gmail ! com>
Date:       2010-12-30 17:35:46
Message-ID: 20101230173546.0D31DAC8AC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1210325 by mludwig:

Avoid annoying visual artifacts when updating the combo box, which are caused
by clearing and repopulating the combo box.


 M  +13 -11    dialog.cpp  
 M  +2 -1      dialog.h  


--- trunk/KDE/kdelibs/kdeui/sonnet/dialog.cpp #1210324:1210325
@@ -2,7 +2,7 @@
  * dialog.cpp
  *
  * Copyright (C)  2003  Zack Rusin <zack@kde.org>
- * Copyright (C)  2009  Michel Ludwig <michel.ludwig@kdemail.net>
+ * Copyright (C)  2009-2010  Michel Ludwig <michel.ludwig@kdemail.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -165,7 +165,7 @@
     setGuiEnabled(false);
 
     //d->ui.m_suggestions->setSorting( NONSORTINGCOLUMN );
-    updateDictionaryComboBox();
+    fillDictionaryComboBox();
     d->restart = false;
 
     d->suggestionsModel=new ReadOnlyStringListModel(this);
@@ -275,17 +275,22 @@
     d->restart = true;
 }
 
-void Dialog::updateDictionaryComboBox()
+void Dialog::fillDictionaryComboBox()
 {
-    d->ui.m_language->clear();
     Speller speller = d->checker->speller();
     d->dictsMap = speller.availableDictionaries();
     QStringList langs = d->dictsMap.keys();
-    d->ui.m_language->insertItems(0, langs);
-    d->ui.m_language->setCurrentIndex(d->dictsMap.values().indexOf(
-                                          speller.language()));
+  d->ui.m_language->clear();
+  d->ui.m_language->addItems(langs);
+  updateDictionaryComboBox();
 }
 
+void Dialog::updateDictionaryComboBox()
+{
+  Speller speller = d->checker->speller();
+  d->ui.m_language->setCurrentIndex(d->dictsMap.values().indexOf(speller.language()));
+}
+
 void Dialog::updateDialog( const QString& word )
 {
     d->ui.m_unknownWord->setText( word );
@@ -303,6 +308,7 @@
 {
     kDebug()<<"Showing dialog";
     d->canceled = false;
+    fillDictionaryComboBox();
     updateDictionaryComboBox();
     if (d->originalBuffer.isEmpty())
     {
@@ -421,14 +427,10 @@
 void Dialog::slotDone()
 {
     d->restart=false;
-    QString currentLanguage = d->checker->speller().language();
     emit done(d->checker->text());
     if (d->restart)
     {
-        if (currentLanguage != d->checker->speller().language())
-        {
           updateDictionaryComboBox();
-        }
         d->checker->setText(d->originalBuffer);
         d->restart=false;
     }
--- trunk/KDE/kdelibs/kdeui/sonnet/dialog.h #1210324:1210325
@@ -3,7 +3,7 @@
  * dialog.h
  *
  * Copyright (C)  2003  Zack Rusin <zack@kde.org>
- * Copyright (C)  2009  Michel Ludwig <michel.ludwig@kdemail.net>
+ * Copyright (C)  2009-2010  Michel Ludwig <michel.ludwig@kdemail.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -149,6 +149,7 @@
 
     private:
         void updateDialog( const QString& word );
+        void fillDictionaryComboBox();
         void updateDictionaryComboBox();
         void fillSuggestions( const QStringList& suggs );
         void initConnections();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic