[Kita-svn] [2460] fix bugs in a preference dialog

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 7月 20日 (月) 21:39:41 JST


Revision: 2460
          http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2460
Author:   nogu
Date:     2009-07-20 21:39:41 +0900 (Mon, 20 Jul 2009)

Log Message:
-----------
fix bugs in a preference dialog

Modified Paths:
--------------
    kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp
    kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h
    kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.cpp
    kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.h
    kita/branches/KITA-KDE4/kita/src/prefs/preferences.cpp

Modified: kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp	2009-07-20 10:37:24 UTC (rev 2459)
+++ kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.cpp	2009-07-20 12:39:41 UTC (rev 2460)
@@ -15,38 +15,28 @@
 using namespace Kita;
 
 AbonePrefPage::AbonePrefPage(QWidget *parent)
-: AbstractPrefPage(parent), m_changed(false)
+: AbstractPrefPage(parent)
 {
     setupUi(this);
     load();
-    connect(idAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged()));
-    connect(nameAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged()));
-    connect(wordAboneText, SIGNAL(textChanged()), SLOT(slotTextChanged()));
+    connect(idAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
+    connect(nameAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
+    connect(wordAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
 }
 
-void AbonePrefPage::slotTextChanged()
-{
-    m_changed = true;
-    emit changed();
-}
-
 void AbonePrefPage::apply()
 {
-    if (m_changed) {
-        QString idText = idAboneText->toPlainText();
-        QStringList idList = idText.split('\n');
-        AboneConfig::setAboneIDList(idList);
+    QString idText = idAboneText->toPlainText();
+    QStringList idList = idText.split('\n');
+    AboneConfig::setAboneIDList(idList);
 
-        QString nameText = nameAboneText->toPlainText();
-        QStringList nameList = nameText.split('\n');
-        AboneConfig::setAboneNameList(nameList);
+    QString nameText = nameAboneText->toPlainText();
+    QStringList nameList = nameText.split('\n');
+    AboneConfig::setAboneNameList(nameList);
 
-        QString wordText = wordAboneText->toPlainText();
-        QStringList wordList = wordText.split('\n');
-        AboneConfig::setAboneWordList(wordList);
-    }
-
-    m_changed = false;
+    QString wordText = wordAboneText->toPlainText();
+    QStringList wordList = wordText.split('\n');
+    AboneConfig::setAboneWordList(wordList);
 }
 
 void AbonePrefPage::load()

Modified: kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h	2009-07-20 10:37:24 UTC (rev 2459)
+++ kita/branches/KITA-KDE4/kita/src/prefs/aboneprefpage.h	2009-07-20 12:39:41 UTC (rev 2460)
@@ -21,15 +21,11 @@
     class AbonePrefPage : public AbstractPrefPage, public Ui::AbonePrefBase
     {
         Q_OBJECT
-        bool m_changed;
     public:
         AbonePrefPage(QWidget *parent = 0);
         virtual void apply();
         virtual void load();
         virtual void reset();
-
-    private slots:
-        void slotTextChanged();
     };
 }
 

Modified: kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.cpp	2009-07-20 10:37:24 UTC (rev 2459)
+++ kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.cpp	2009-07-20 12:39:41 UTC (rev 2460)
@@ -17,8 +17,7 @@
 
 using namespace Kita;
 
-FacePrefPage::FacePrefPage(QWidget* parent) : AbstractPrefPage(parent),
-    m_threadFontChanged(false), m_threadColorChanged(false)
+FacePrefPage::FacePrefPage(QWidget* parent) : AbstractPrefPage(parent)
 {
     setupUi(this);
     load();
@@ -31,14 +30,11 @@
     connect(popupFontButton, SIGNAL(clicked()),
              SLOT(slotPopupFontButtonClicked()));
 
+    // color
     connect(threadColorButton, SIGNAL(changed(const QColor&)),
             SIGNAL(changed()));
     connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)),
             SIGNAL(changed()));
-    connect(threadColorButton, SIGNAL(changed(const QColor&)),
-            SLOT(slotColorChanged()));
-    connect(threadBackgroundColorButton, SIGNAL(changed(const QColor&)),
-            SLOT(slotColorChanged()));
     connect(popupColorButton, SIGNAL(changed(const QColor&)),
             SIGNAL(changed()));
     connect(popupBackgroundColorButton, SIGNAL(changed(const QColor&)),
@@ -52,21 +48,15 @@
     Config::setFont(font);
     emit fontChanged(font);
 
-    if (m_threadFontChanged) {
-        QFont threadFont = threadFontButton->font();
-        Config::setThreadFont(threadFont);
-    }
-    m_threadFontChanged = false;
+    QFont threadFont = threadFontButton->font();
+    Config::setThreadFont(threadFont);
 
     QFont popupFont = popupFontButton->font();
     Config::setPopupFont(popupFont);
 
     // color
-    if (m_threadColorChanged) {
-        Config::setThreadColor(threadColorButton->color());
-        Config::setThreadBackground(threadBackgroundColorButton->color());
-    }
-    m_threadColorChanged = false;
+    Config::setThreadColor(threadColorButton->color());
+    Config::setThreadBackground(threadBackgroundColorButton->color());
     Config::setPopupColor(popupColorButton->color());
     Config::setPopupBackground(popupBackgroundColorButton->color());
 }
@@ -96,24 +86,9 @@
 
 void FacePrefPage::reset()
 {
-    // font
-    QFont font;
-    listFontButton->setText(fontToString(font));
-    listFontButton->setFont(font);
-
-    threadFontButton->setText(fontToString(font));
-    threadFontButton->setFont(font);
-    m_threadFontChanged = true;
-
-    popupFontButton->setText(fontToString(font));
-    popupFontButton->setFont(font);
-
-    // color
-    threadColorButton->setColor(Qt::black);
-    threadBackgroundColorButton->setColor(Qt::white);
-    popupColorButton->setColor(Qt::black);
-    popupBackgroundColorButton->setColor(Qt::yellow);
-    m_threadColorChanged = true;
+    Config::self()->useDefaults(true);
+    load();
+    Config::self()->useDefaults(false);
 }
 
 void FacePrefPage::slotThreadFontButtonClicked()
@@ -124,7 +99,6 @@
         threadFontButton->setText(fontToString(threadFont));
         threadFontButton->setFont(threadFont);
         emit changed();
-        m_threadFontChanged = true;
     }
 }
 
@@ -149,8 +123,3 @@
         emit changed();
     }
 }
-
-void FacePrefPage::slotColorChanged()
-{
-    m_threadColorChanged = true;
-}

Modified: kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.h	2009-07-20 10:37:24 UTC (rev 2459)
+++ kita/branches/KITA-KDE4/kita/src/prefs/faceprefpage.h	2009-07-20 12:39:41 UTC (rev 2460)
@@ -19,10 +19,6 @@
     class FacePrefPage : public AbstractPrefPage, public Ui::FacePrefBase
     {
         Q_OBJECT
-
-        bool m_threadFontChanged;
-        bool m_threadColorChanged;
-
     public:
         FacePrefPage(QWidget* parent = 0);
         virtual void apply();
@@ -33,7 +29,6 @@
         void slotFontButtonClicked();
         void slotPopupFontButtonClicked();
         void slotThreadFontButtonClicked();
-        void slotColorChanged();
 
     signals:
         void fontChanged(const QFont&);

Modified: kita/branches/KITA-KDE4/kita/src/prefs/preferences.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/prefs/preferences.cpp	2009-07-20 10:37:24 UTC (rev 2459)
+++ kita/branches/KITA-KDE4/kita/src/prefs/preferences.cpp	2009-07-20 12:39:41 UTC (rev 2460)
@@ -91,6 +91,7 @@
         apply();
     } else if (button == Default) {
         reset();
+        return;
     }
     KConfigDialog::slotButtonClicked(button);
 }




Kita-svn メーリングリストの案内
アーカイブの一覧に戻る