OSDN Git Service

tmp
[kita/kita.git] / kita / src / mainwindow.cpp
1 /***************************************************************************
2 *   Copyright (C) 2004 by Kita Developers                                 *
3 *   ikemo@users.sourceforge.jp                                            *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 ***************************************************************************/
10
11 #include "mainwindow.h"
12
13 #include "prefs/prefs.h"
14
15 #include "threadview.h"
16 #include "threadtabwidget.h"
17 #include "boardview.h"
18 #include "boardtabwidget.h"
19 #include "bbsview.h"
20 #include "bbstabwidget.h"
21 #include "writetabwidget.h"
22 #include "viewmediator.h"
23
24 #include "libkita/threadinfo.h"
25 #include "libkita/favoriteboards.h"
26 #include "libkita/favoritethreads.h"
27 #include "libkita/kita_misc.h"
28 #include "libkita/kitaconfig.h"
29 #include "libkita/signalcollection.h"
30 #include "libkita/account.h"
31 #include "libkita/datmanager.h"
32 #include "libkita/boardmanager.h"
33 #include "libkita/config_xt.h"
34 #include "libkita/asciiart.h"
35 #include "libkita/abone.h"
36
37 #include <qdragobject.h>
38 #include <qtextcodec.h>
39 #include <qevent.h>
40 #include <qregexp.h>
41 #include <qmessagebox.h>
42 #include <qclipboard.h>
43 #include <qpushbutton.h>
44 #include <qlayout.h>
45
46 #include <klineedit.h>
47 #include <kglobal.h>
48 #include <klocale.h>
49 #include <kiconloader.h>
50 #include <kmenubar.h>
51 #include <kstatusbar.h>
52 #include <kkeydialog.h>
53 #include <kaccel.h>
54 #include <kio/netaccess.h>
55 #include <kuserprofile.h>
56 #include <kfiledialog.h>
57 #include <kconfig.h>
58 #include <kurl.h>
59 #include <krun.h>
60 #include <kstandarddirs.h>
61 #include <kdebug.h>
62 #include <ksimpleconfig.h>
63 #include <kedittoolbar.h>
64 #include <kstdaccel.h>
65 #include <kaction.h>
66 #include <kstdaction.h>
67 #include <kshortcut.h>
68 #include <kaboutdata.h>
69 #include <kparts/partmanager.h>
70 #include <kdeversion.h>
71 #include <kglobal.h>
72
73 KitaMainWindow::KitaMainWindow()
74         : KDockMainWindow( 0, "Kita" )
75 {
76     // FIXME: merge *.po
77     KGlobal::locale() ->insertCatalogue( "kitapart" );
78
79     // accept dnd
80     setAcceptDrops( true );
81
82     // setup view, dock
83     setupView();
84
85     // then, setup our actions
86     setupActions();
87
88     // load cache
89     loadCache();
90
91     // load style sheet
92     loadStyleSheet();
93
94     // load ascii art
95     Kita::AsciiArtConfig::self()->readConfig();
96     if ( Kita::AsciiArtConfig::self()->asciiArtList().empty() ) {
97         loadAsciiArt();
98     }
99
100     // load abone lists
101     Kita::AboneConfig::self()->readConfig();
102     if ( Kita::AboneConfig::self()->aboneIDList().empty() ) {
103         loadAboneIDList();
104     }
105
106     if ( Kita::AboneConfig::self()->aboneNameList().empty() ) {
107         loadAboneNameList();
108     }
109
110     if ( Kita::AboneConfig::self()->aboneWordList().empty() ) {
111         loadAboneWordList();
112     }
113
114     // and a status bar
115     statusBar() ->show();
116
117     // read dock status
118     m_bbsDock->loadSession();
119     m_boardDock->loadSession();
120     m_threadDock->loadSession();
121     m_writeDock->loadSession();
122     QString dockConfigPath = locateLocal( "appdata", "dock.conf" );
123     KConfig dockConfig( dockConfigPath );
124     readDockConfig( &dockConfig );
125
126     // show subject dock
127     m_boardDock->slotShowDock();
128
129     // show thread view
130     m_threadDock->slotShowDock();
131
132     // hide writedock
133     makeDockInvisible( m_writeDock );
134
135     // for compativility
136     loadCompletion();
137     KitaConfig::readConfig( KGlobal::config() );
138
139     Kita::Config::self()->readConfig();
140
141     // apply the saved mainwindow settings, if any, and ask the mainwindow
142     // to automatically save settings if changed: window size, toolbar
143     // position, icon size, etc.
144     setAutoSaveSettings();
145
146     // set list font
147     setFont( Kita::Config::font() );
148
149     // allow the view to change the statusbar and caption
150     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
151
152     connect( signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
153              SLOT( slotOpenURLRequestExt( const KURL&, const QString ) ) );
154
155     connect( m_urlLine, SIGNAL( returnPressed() ),
156              SLOT( slotURLLine() ) );
157
158     QPopupMenu* settingsPopup = static_cast<QPopupMenu *>( factory() ->container( "settings", this ) );
159     connect( settingsPopup, SIGNAL( aboutToShow() ),
160              SLOT( settingsMenuAboutToShow() ) );
161
162     // load favorite boards;
163     loadFavoriteBoards();
164
165     // load boad list
166     {
167         QString configPath = locateLocal( "appdata", "board_list" );
168         if ( QFile::exists( configPath ) ) {
169             m_bbsTab->showBoardList();
170             m_bbsTab->loadOpened();
171         } else {
172             m_bbsTab->updateBoardList();
173         }
174     }
175
176     // load favorites
177     loadFavorites();
178
179     // show board dock
180     m_bbsDock->slotShowDock();
181
182     // update favorite list
183     ViewMediator::getInstance()->updateFavoriteListView();
184
185     if ( Kita::Config::autoLogin() ) {
186         login();
187     }
188 }
189
190 KitaMainWindow::~KitaMainWindow()
191 {
192     /* save dock status */
193     m_bbsDock->saveSession();
194     m_boardDock->saveSession();
195     m_threadDock->saveSession();
196     m_writeDock->saveSession();
197
198     Kita::AboneConfig::self()->writeConfig();
199
200     saveStyleSheet();
201
202     Kita::AsciiArtConfig::self()->writeConfig();
203
204     saveFavoriteBoards();
205
206     saveFavorites();
207
208     saveCache();
209
210     saveMainWindowSettings( KGlobal::config(), "MainWindow" );
211
212     KitaConfig::writeConfig( KGlobal::config() );
213     Kita::Config::self()->writeConfig();
214
215     QString dockConfigPath = locateLocal( "appdata", "dock.conf" );
216     KConfig dockConfig( dockConfigPath );
217     writeDockConfig( &dockConfig );
218
219     delete m_bbsDock;
220     delete m_threadDock;
221     delete m_writeDock;
222
223     Kita::DatManager::deleteAllDatInfo();
224 }
225
226 void KitaMainWindow::load( const KURL& url )
227 {
228     setCaption( url.url() );
229 }
230
231 void KitaMainWindow::bookmark( const QString& datURL, bool on )
232 {
233     FavoriteThreads * favorite = FavoriteThreads::getInstance();
234
235     if ( on ) {
236         favorite->insert( datURL );
237     } else {
238         favorite->remove( datURL );
239     }
240     saveFavorites();
241     ViewMediator::getInstance()->updateFavoriteListView();
242 }
243
244 void KitaMainWindow::closeSubjectView()
245 {
246     m_subjectListAction->setChecked( FALSE );
247 }
248
249 void KitaMainWindow::login()
250 {
251     if ( Kita::Account::login( Kita::Config::userID(), Kita::Config::password() ) ) {
252         slotSetMainStatusbar( i18n( "Login succeeded." ) );
253     } else {
254         slotSetMainStatusbar( i18n( "Login failed." ) );
255     }
256 }
257
258 void KitaMainWindow::newToolbarConfig()
259 {
260     // this slot is called when user clicks "Ok" or "Apply" in the toolbar editor.
261     // recreate our GUI, and re-apply the settings (e.g. "text under icons", etc.)
262     applyMainWindowSettings( KGlobal::config(), "MainWindow" );
263 }
264
265 void KitaMainWindow::optionsShowToolbar()
266 {
267     // this is all very cut and paste code for showing/hiding the
268     // toolbar
269     if ( m_toolbarAction->isChecked() ) {
270         toolBar() ->show();
271     } else {
272         toolBar() ->hide();
273     }
274 }
275
276 void KitaMainWindow::optionsShowStatusbar()
277 {
278     // this is all very cut and paste code for showing/hiding the
279     // statusbar
280     if ( m_statusbarAction->isChecked() ) {
281         statusBar() ->show();
282     } else {
283         statusBar() ->hide();
284     }
285 }
286
287 void KitaMainWindow::optionsConfigureKeys()
288 {
289     KKeyDialog dlg( TRUE, this );
290     dlg.insert( actionCollection(), "Kita" );
291     dlg.configure();
292 }
293
294 void KitaMainWindow::optionsConfigureToolbars()
295 {
296     // use the standard toolbar editor
297     KEditToolbar dlg( factory() );
298     connect( &dlg, SIGNAL( newToolbarConfig() ),
299              SLOT( newToolbarConfig() ) );
300     dlg.exec();
301 }
302
303 void KitaMainWindow::optionsPreferences()
304 {
305     // popup some sort of preference dialog, here
306     if ( KConfigDialog::showDialog( "Kita Preferences" ) ) {
307         return;
308     }
309
310     KitaPreferences* dialog = new KitaPreferences( this );
311
312     connect( dialog, SIGNAL( fontChanged( const QFont& ) ),
313              SLOT( setFont( const QFont& ) ) );
314
315     dialog->show();
316 }
317
318 void KitaMainWindow::settingsMenuAboutToShow()
319 {
320     m_toolbarAction->setChecked( toolBar() ->isVisible() );
321     m_statusbarAction->setChecked( statusBar() ->isVisible() );
322 }
323
324 void KitaMainWindow::setFont( const QFont& font )
325 {
326     m_boardTab->setFont( font );
327     m_bbsTab->setFont( font );
328 }
329
330 void KitaMainWindow::setUrl( const KURL& url )
331 {
332     m_urlLine->setText( url.url() );
333 }
334
335 void KitaMainWindow::windowToggleView()
336 {
337     //FIXME: m_boardDock->dockSite() & KDockWidget::DockCenter != 0 igai no toki ha dousuru?
338     kdDebug() << "Do toggle" << endl;
339     if ( !m_boardDock->isVisible()
340             || !m_boardDock->isActiveWindow() ) m_boardDock->slotShowDock();
341     else {
342         m_threadDock->slotShowDock();
343     }
344 }
345
346 void KitaMainWindow::slotCheckBoardToggleAction( bool check )
347 {
348     if ( m_boardListAction ) m_boardListAction->setChecked( check );
349 }
350
351 void KitaMainWindow::slotCheckSubjectToggleAction( bool check )
352 {
353     if ( m_subjectListAction ) m_subjectListAction->setChecked( check );
354 }
355
356 void KitaMainWindow::slotCheckWriteToggleAction( bool check )
357 {
358     if ( m_showWriteDockAction ) m_showWriteDockAction->setChecked( check );
359 }
360
361 void KitaMainWindow::slotEditCopy()
362 {
363     QWidget * widget = kapp->focusWidget();
364
365     if ( widget ) {
366         QKeyEvent e( QEvent::KeyPress, Key_C, 'C', ControlButton );
367         QApplication::sendEvent( widget, &e );
368     }
369 }
370
371 /* open url */
372 /*
373   If mimetype == "text/html", open url with web browser.
374   if mimetype == QString::null, use KIO::NetAccess::mimetype to decide mime type of url.
375  
376 */  /* public slot */
377 void KitaMainWindow::slotOpenURLRequestExt( const KURL& url, const QString mimetype )
378 {
379     /*  open url with web browser, etc. */
380     if ( mimetype != QString::null ) {
381         KRun::runURL( url, mimetype );
382         return ;
383     }
384
385     /* open thread with new thread tab */
386     if ( Kita::DatManager::isThreadEnrolled( url ) ) {
387         m_threadDock->slotShowThread( url );
388         return ;
389     }
390
391     QString url_mimetype = KIO::NetAccess::mimetype( url , this );
392     KRun::runURL( url, url_mimetype );
393 }
394
395 void KitaMainWindow::slotSetMainStatusbar( const QString& statusStr )
396 {
397     // display the text on the statusbar
398     statusBar() ->message( statusStr );
399 }
400
401 void KitaMainWindow::slotURLLine()
402 {
403     KURL url = m_urlLine->text();
404     KURL datURL = Kita::getDatURL( url );
405     m_threadDock->slotShowThread( datURL );
406 }
407
408 //
409 // private method
410 //
411
412 void KitaMainWindow::setupActions()
413 {
414     KStdAction::quit( this, SLOT( close() ), actionCollection() );
415     KStdAction::copy( this, SLOT( slotEditCopy() ), actionCollection() );
416
417     m_toolbarAction = KStdAction::showToolbar( this,
418                       SLOT( optionsShowToolbar() ),
419                       actionCollection() );
420
421     m_statusbarAction = KStdAction::showStatusbar( this,
422                         SLOT( optionsShowStatusbar() ),
423                         actionCollection() );
424
425     m_boardListAction = new KToggleAction( i18n( "Show board list" ),
426                                            0,
427                                            m_bbsDock,
428                                            SLOT( slotToggleShowHide() ),
429                                            actionCollection(),
430                                            "window_show_board_list" );
431
432     m_subjectListAction = new KToggleAction( i18n( "Show subject list" ),
433                           0,
434                           m_boardDock,
435                           SLOT( slotToggleShowHide() ),
436                           actionCollection(),
437                           "window_show_subject_list" );
438
439     m_showWriteDockAction = new KToggleAction( i18n( "Show Write Dock" ),
440                             0,
441                             m_writeDock,
442                             SLOT( slotToggleShowHide() ),
443                             actionCollection(),
444                             "window_show_writedock" );
445
446     m_urlLine = new KLineEdit( "", 0 );
447
448     new KWidgetAction( m_urlLine,
449                        i18n( "URL Line" ),
450                        0,
451                        this,
452                        SLOT( slotURLLine() ),
453                        actionCollection(), "url_line_action" );
454
455     KStdAction::keyBindings( this, SLOT( optionsConfigureKeys() ), actionCollection() );
456     KStdAction::configureToolbars( this, SLOT( optionsConfigureToolbars() ), actionCollection() );
457     KStdAction::preferences( this, SLOT( optionsPreferences() ), actionCollection() );
458
459     new KAction( i18n( "Load board list" ),
460                  0,
461                  m_bbsTab,
462                  SLOT( updateBoardList() ),
463                  actionCollection(),
464                  "load_board_list" );
465
466     m_toggleViewAction = new KAction(
467                              i18n( "&Toggle subject view and thread view" ),
468                              KShortcut( Qt::Key_F7 ),
469                              this,
470                              SLOT( windowToggleView() ),
471                              actionCollection(),
472                              "window_toggle_view" );
473
474     new KAction( i18n( "Login" ),
475                  0,
476                  this,
477                  SLOT( login() ),
478                  actionCollection(),
479                  "login" );
480
481     setXMLFile( "kitaui.rc" );
482     KMainWindow::createGUI();
483     factory() ->addClient( m_bbsTab );
484     factory() ->addClient( m_boardTab );
485     factory() ->addClient( m_threadTab );
486     factory() ->addClient( m_writeTab );
487 }
488
489 void KitaMainWindow::setupView()
490 {
491     ViewMediator::getInstance()->setMainWindow( this );
492
493     QWidget* mainWidget = new QWidget( this );
494     QBoxLayout* bl = new QVBoxLayout( mainWidget );
495     bl->addWidget( new QPushButton( mainWidget, "BBS" ) );
496     bl->addWidget( new QPushButton( mainWidget, "Subject" ) );
497     bl->addWidget( new QPushButton( mainWidget, "Thread" ) );
498     setView( mainWidget );
499
500     /* dummy Main Dock Widget */
501 /*    m_dummyDock = createDockWidget( "dummy", 0L, 0L, "dummy", "dummy" );
502     m_dummyDock->setDockSite( KDockWidget::DockFullSite );
503     m_dummyDock->setEnableDocking( KDockWidget::DockNone );
504     setView( m_dummyDock );
505     setMainDockWidget( m_dummyDock );*/
506
507     /* Subject View */
508     m_boardDock = new KitaBoardDock( manager(), "subject", 0L, 0L, i18n( "subject" ), i18n( "subject" ) );
509     m_boardTab = new KitaBoardTabWidget( this, "Subject" );
510     m_boardDock->setWidget( m_boardTab );
511     ViewMediator::getInstance()->setBoardDockWidget( m_boardDock );
512     ViewMediator::getInstance()->setBoardTabWidget( m_boardTab );
513     connect( m_boardDock, SIGNAL( checkToggleAction( bool ) ), SLOT( slotCheckSubjectToggleAction( bool ) ) );
514
515     /* Board View */
516     m_bbsDock = new KitaBBSDock( manager(), "board", 0L, 0L, i18n( "board" ), i18n( "board" ) );
517     m_bbsTab = new KitaBBSTabWidget( m_bbsDock, "Board" );
518     m_bbsDock->setWidget( m_bbsTab );
519     ViewMediator::getInstance()->setBBSDock( m_bbsDock );
520     connect( m_bbsDock, SIGNAL( checkToggleAction( bool ) ), SLOT( slotCheckBoardToggleAction( bool ) ) );
521
522     /* Thread View */
523     m_threadDock = new KitaThreadDock( manager(), "Thread", 0L, 0L, i18n( "Thread" ), i18n( "Thread" ) );
524     m_threadTab = m_threadDock->setupAsMainView();
525     ViewMediator::getInstance()->setThreadDock( m_threadDock );
526     ViewMediator::getInstance()->setThreadTabWidget( m_threadTab );
527     m_threadDock->setDockSite( KDockWidget::DockFullSite );
528
529     /* write dock */
530     m_writeDock = new KitaWriteDock( manager(), "Write", 0L, 0L, i18n( "Write" ), i18n( "Write" ) );
531     m_writeTab = new KitaWriteTabWidget( m_writeDock, "Write View" );
532     m_writeDock->setWidget( m_writeTab );
533     m_writeDock->setWriteTabWidget( m_writeTab );
534     m_writeDock->setup();
535     ViewMediator::getInstance()->setWriteDock( m_writeDock );
536     ViewMediator::getInstance()->setWriteTabWidget( m_writeTab );
537     connect( m_writeDock, SIGNAL( checkToggleAction( bool ) ), SLOT( slotCheckWriteToggleAction( bool ) ) );
538
539     /* reset dock status */
540     m_boardListAction = NULL;
541     m_subjectListAction = NULL;
542     m_showWriteDockAction = NULL;
543 }
544
545 void KitaMainWindow::loadCache()
546 {
547     KitaThreadInfo * cache = KitaThreadInfo::getInstance();
548     QString cacheConfigPath = locateLocal( "appdata", "cache" );
549     QFile file( cacheConfigPath );
550     if ( file.open( IO_ReadOnly ) ) {
551         QDataStream stream( &file );
552         stream >> *cache;
553     }
554 }
555
556 void KitaMainWindow::saveCache()
557 {
558     KitaThreadInfo * cache = KitaThreadInfo::getInstance();
559     QString cacheConfigPath = locateLocal( "appdata", "cache" );
560     QFile file( cacheConfigPath );
561     if ( file.open( IO_WriteOnly ) ) {
562         QDataStream stream( &file );
563         stream << *cache;
564     }
565 }
566
567 void KitaMainWindow::loadFavorites()
568 {
569     QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" );
570     QFile file( favoritesConfigPath );
571     if ( file.open( IO_ReadOnly ) ) {
572         QTextStream stream( &file );
573         stream.setEncoding( QTextStream::UnicodeUTF8 );
574
575         QString xml = stream.read();
576         FavoriteThreads::readFromXML( xml );
577     }
578 }
579
580 void KitaMainWindow::saveFavorites()
581 {
582     QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" );
583     QFile file( favoritesConfigPath );
584     if ( file.open( IO_WriteOnly ) ) {
585         QTextStream stream( &file );
586         stream.setEncoding( QTextStream::UnicodeUTF8 );
587         stream << FavoriteThreads::getInstance() ->toXML();
588     }
589 }
590
591 void KitaMainWindow::loadFavoriteBoards()
592 {
593     QString configPath = locateLocal( "appdata", "favorite_boards.xml" );
594     QFile file( configPath );
595     if ( file.open( IO_ReadOnly ) ) {
596         QTextStream stream( &file );
597         stream.setEncoding( QTextStream::UnicodeUTF8 );
598
599         QString xml = stream.read();
600         Kita::FavoriteBoards::readFromXML( xml );
601     }
602 }
603
604 void KitaMainWindow::saveFavoriteBoards()
605 {
606     QString configPath = locateLocal( "appdata", "favorite_boards.xml" );
607     QFile file( configPath );
608     if ( file.open( IO_WriteOnly ) ) {
609         QTextStream stream( &file );
610         stream.setEncoding( QTextStream::UnicodeUTF8 );
611         stream << Kita::FavoriteBoards::toXML();
612     }
613 }
614
615 void KitaMainWindow::loadCompletion()
616 {
617     QString configPath = locateLocal( "appdata", "completion" );
618     KSimpleConfig config( configPath );
619
620     Kita::Config::setNameCompletionList( config.readListEntry( "name" ) );
621 }
622
623 void KitaMainWindow::loadStyleSheet()
624 {
625     QString configPath = locateLocal( "appdata", "stylesheet" );
626     QFile file( configPath );
627     if ( file.open( IO_ReadOnly ) ) {
628         QTextStream stream( &file );
629         stream.setEncoding( QTextStream::UnicodeUTF8 );
630
631         QStringList list;
632         QString str;
633
634         while ( ( str = stream.readLine() ) != QString::null ) {
635             if ( ! str.isEmpty() ) {
636                 list << str;
637             }
638         }
639         KitaConfig::setStyleSheetText( list.join( "\n" ) );
640     }
641 }
642
643 void KitaMainWindow::saveStyleSheet()
644 {
645     QString configPath = locateLocal( "appdata", "stylesheet" );
646     QFile file( configPath );
647     if ( file.open( IO_WriteOnly ) ) {
648         QTextStream stream( &file ) ;
649         stream.setEncoding( QTextStream::UnicodeUTF8 );
650
651         stream << KitaConfig::styleSheetText();
652     }
653 }
654
655 void KitaMainWindow::loadAsciiArt()
656 {
657     QString configPath = locateLocal( "appdata", "asciiart" );
658     QFile file( configPath );
659     if ( file.open( IO_ReadOnly ) ) {
660         QTextStream stream( &file );
661         stream.setEncoding( QTextStream::UnicodeUTF8 );
662
663         QStringList list;
664         QString str;
665
666         while ( ( str = stream.readLine() ) != QString::null ) {
667             if ( ! str.isEmpty() ) {
668                 list << str;
669             }
670         }
671         Kita::AsciiArtConfig::setAsciiArtList( list );
672     }
673 }
674
675 void KitaMainWindow::loadAboneIDList()
676 {
677     QString configPath = locateLocal( "appdata", "abone_id" );
678     QFile file( configPath );
679     if ( file.open( IO_ReadOnly ) ) {
680         QTextStream stream( &file );
681         stream.setEncoding( QTextStream::UnicodeUTF8 );
682
683         QStringList list;
684         QString str;
685
686         while ( ( str = stream.readLine() ) != QString::null ) {
687             if ( ! str.isEmpty() ) {
688                 list << str;
689             }
690         }
691         Kita::AboneConfig::setAboneIDList( list );
692     }
693 }
694
695 void KitaMainWindow::loadAboneNameList()
696 {
697     QString configPath = locateLocal( "appdata", "abone_name" );
698     QFile file( configPath );
699     if ( file.open( IO_ReadOnly ) ) {
700         QTextStream stream( &file );
701         stream.setEncoding( QTextStream::UnicodeUTF8 );
702
703         QStringList list;
704         QString str;
705
706         while ( ( str = stream.readLine() ) != QString::null ) {
707             if ( ! str.isEmpty() ) {
708                 list << str;
709             }
710         }
711         Kita::AboneConfig::setAboneNameList( list );
712     }
713 }
714
715 void KitaMainWindow::loadAboneWordList()
716 {
717     QString configPath = locateLocal( "appdata", "abone_word" );
718     QFile file( configPath );
719     if ( file.open( IO_ReadOnly ) ) {
720         QTextStream stream( &file );
721         stream.setEncoding( QTextStream::UnicodeUTF8 );
722
723         QStringList list;
724         QString str;
725
726         while ( ( str = stream.readLine() ) != QString::null ) {
727             if ( ! str.isEmpty() ) {
728                 list << str;
729             }
730         }
731         Kita::AboneConfig::setAboneWordList( list );
732     }
733 }
734
735 #include "mainwindow.moc"