OSDN Git Service

save completion
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 1 Jan 2004 04:24:16 +0000 (04:24 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 1 Jan 2004 04:24:16 +0000 (04:24 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@760 56b19765-1e22-0410-a548-a0f45d66c51a

ChangeLog
kita/src/kita.cpp
kita/src/kita.h
kita/src/part/kitaconfig.h

index 5a24d1a..50e429f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-01  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
+
+       * save color pref.
+       * save name completion.
+
 2003-12-30  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
 
        * version 0.80 released.
index 6b0268f..8c4bfc7 100644 (file)
@@ -43,6 +43,7 @@
 #include <krun.h>
 #include <kstandarddirs.h>
 #include <kdebug.h>
+#include <ksimpleconfig.h>
 
 #include <kedittoolbar.h>
 
@@ -69,6 +70,9 @@ KitaMainWindow::KitaMainWindow()
     // load favorites
     loadFavorites();
 
+    // load completion
+    loadCompletion();
+    
     // and a status bar
     statusBar()->show();
 
@@ -133,6 +137,8 @@ KitaMainWindow::KitaMainWindow()
 
 KitaMainWindow::~KitaMainWindow()
 {
+    saveCompletion();
+
     saveFavorites();
 
     saveCache();
@@ -616,6 +622,23 @@ void KitaMainWindow::saveFavorites()
     }
 }
 
+void KitaMainWindow::loadCompletion()
+{
+    QString configPath = locateLocal( "appdata", "completion" );
+    KSimpleConfig config( configPath );
+
+    KitaConfig::setNameCompletionItems( config.readListEntry( "name" ) );
+}
+
+void KitaMainWindow::saveCompletion()
+{
+    QString configPath = locateLocal( "appdata", "completion" );
+    KSimpleConfig config( configPath );
+
+    config.writeEntry( "name", KitaConfig::nameCompletion()->items() );
+    config.sync();
+}
+
 void KitaMainWindow::slotThread( const Kita::Thread& thread )
 {
     setCaption( thread.name() );
index 942dff3..10d21e5 100644 (file)
@@ -140,6 +140,8 @@ private:
     void saveCache();
     void loadFavorites();
     void saveFavorites();
+    void loadCompletion();
+    void saveCompletion();
 };
 
 #endif // _KITA_H_
index 7de5c43..d8d3908 100644 (file)
@@ -40,6 +40,7 @@ public:
   static QString& boardListURL() { return getInstance()->m_boardListURL; }
   static KCompletion* nameCompletion() { return &(getInstance()->m_nameCompletion); }
   static void addNameCompletionItem( QString& item ) { getInstance()->m_nameCompletion.addItem( item ); }
+  static void setNameCompletionItems( QStringList list ) { getInstance()->m_nameCompletion.setItems( list ); }
   static QColor& threadColor() { return getInstance()->m_threadColor; }
   static void setThreadColor( QColor color ) { getInstance()->m_threadColor = color; }
   static QColor& threadBackgroundColor() { return getInstance()->m_threadBackgroundColor; }