OSDN Git Service

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