kshowmail.cpp

00001 /***************************************************************************
00002                           kshowmail.cpp  -  description
00003                              -------------------
00004     begin                : Sat May  6 12:13:57 MEST 2000
00005     copyright            : (C) 2000-2002 by Eggert Ehmke
00006     email                : eggert.ehmke@berlin.de
00007 
00008     26 Sep 2002 - Allow for columns to be hidden. Allistar Melville
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00020 #include "kshowmail.h"
00021 
00022 using namespace TDEIO;
00023 
00024 TDEAboutData* KShowMailApp::m_pAbout;
00025 
00026 KShowMailApp::KShowMailApp()
00027 {
00028   //set up actions
00029   initActions();
00030 
00031   // create GUI from ui resource file
00032   setXMLFile( "kshowmailui.rc" );
00033   createGUI();
00034 
00035   //the main window settings will be saved automatically
00036   setAutoSaveSettings();
00037 
00038   //initiate GUI parts
00039   initStatusBar();
00040   initDocument();
00041   initView();
00042 
00043   //the application is idle at beginning
00044   m_state = idle;
00045 
00046   //the setup dialog will be created in slotSetup() at first use
00047   SetupDialog = NULL;
00048 
00049   m_pTimer = new TQTimer (this);
00050   m_pAlertDialog = NULL;
00051   m_pDockWindow = new KShowMailDock (this, m_actionRefresh);
00052   m_bForceClose = false;
00053 
00054 
00055   //read the setup
00056   m_ConfigList.refreshSetup( m_pView->m_pListAccounts );
00057 
00058   readOptions();
00059 
00060   //load stored mails
00061   m_ConfigList.readStoredMails();
00062 
00063   //connect signals with slots
00064 
00065   connect (m_pDockWindow, SIGNAL (quitSelected ()), SLOT (slotForceClose ()));
00066   connect (m_pTimer, SIGNAL (timeout ()), SLOT (slotRefresh ()));
00067   connect (m_pView->m_pListAccounts, SIGNAL (currentChanged(TQListViewItem*)), SLOT(slotAccountActivated(TQListViewItem*)));
00068   connect (m_pView, SIGNAL (signalActiveChanged()), SLOT (slotRefreshView()));
00069 
00070   connect( &m_ConfigList, SIGNAL( sigDeleteReady() ), this, SLOT( slotDeletionReady() ) );
00071   connect( &m_ConfigList, SIGNAL( sigShowBodiesReady() ), this, SLOT( slotShowMessageReady() ) );
00072   connect( &m_ConfigList, SIGNAL( sigMessageWindowOpened() ), this, SLOT( slotNormalCursor() ) );
00073   connect( &m_ConfigList, SIGNAL( sigAllMessageWindowsClosed() ), this, SLOT( slotWaitingCursor() ) );
00074   connect( &m_ConfigList, SIGNAL( sigRefreshReady() ), this, SLOT( slotRefreshReady() ) );
00075 
00076   // this starts the one-second-interval timer
00077   // this is a TQObject method
00078   startTimer (1000);
00079 
00080 
00081   //we are ready to take off! Lets initiate the first refresh (if desired)
00082   initFirstRefresh();
00083 }
00084 
00085 KShowMailApp::~KShowMailApp()
00086 {
00087   kdDebug() << "cleaning up" << endl;
00088   delete m_pTimer;
00089   delete m_pDockWindow;
00090   kdDebug() << "cleanup finished" << endl;
00091 }
00092 
00096 void KShowMailApp::timerEvent (TQTimerEvent *)
00097 {
00098   if (m_nSecondsToGo)
00099   {
00100     TQTime time;
00101     time = time.addSecs (m_nSecondsToGo--);
00102     TQCString msg (i18n("Autorefresh: %1").arg (time.toString()));
00103     statusBar()->changeItem(msg, 3);
00104   }
00105   else
00106     statusBar()->changeItem("", 3);
00107 
00108   // if busy, animate the traybar
00109   if ( m_state == refreshing || m_state == deleting )
00110   {
00111     static int color = 0;
00112     color = (color+1)%2;
00113     switch (color)
00114     {
00115       case 0:
00116         m_pDockWindow->clear ();
00117         break;
00118       default:
00119         m_pDockWindow->drawText ("?", TQt::red);
00120     }
00121   }
00122 }
00123 
00124 
00125 
00126 void KShowMailApp::initActions ()
00127 {
00128   // file menu
00129   m_actionSave = KStdAction::saveOptions( this, SLOT( slotSaveOptions() ), actionCollection() );
00130   KStdAction::quit( this, SLOT( slotFileQuit() ), actionCollection() );
00131 
00132   // action menu
00133   m_actionRefresh = new TDEAction( i18n( "&Refresh messages" ), "reload", Key_F5, this, SLOT( slotRefresh() ), actionCollection(), "refresh" );
00134   new TDEAction( i18n( "Show &header of highlighted messages" ), "letter-closed", Key_F2, this, SLOT( slotShowHeader() ), actionCollection(), "show_header" );
00135   new TDEAction( i18n( "Show &complete highlighted messages" ), "letter-open", Key_F3, this, SLOT( slotShowMessage() ), actionCollection(), "show_complete" );
00136   new TDEAction( i18n( "&Delete highlighted messages" ), "eraser", Key_Delete, this, SLOT( slotDelete() ), actionCollection(), "delete" );
00137   new TDEAction( i18n( "S&top current transfer" ), "stop", 0, this, SLOT( slotStop() ), actionCollection(), "stop" );
00138 
00139   // setup menu
00140   KStdAction::preferences( this, SLOT( slotSetup() ), actionCollection() );
00141   new TDEAction( i18n( "Setup &filters" ), "filter", 0, this, SLOT( slotSetupFilters() ), actionCollection(), "filters" );
00142   KStdAction::configureToolbars( this, SLOT( slotEditToolbars() ), actionCollection() );
00143 
00144   //create menu items for toggle tool and status bar
00145   setStandardToolBarMenuEnabled( true );
00146   createStandardStatusBarAction();
00147 
00148   //help menu
00149   new TDEAction( i18n( "Send &Feedback Mail" ), "email", 0, this, SLOT( slotSendFeedbackMail() ),actionCollection(), "sendFeedback" );
00150 
00151   //for account context menu
00152   new TDEAction(i18n( "Setup &account" ), "tool", 0, this, SLOT( slotSetupAccount() ), actionCollection(), "setupAccount" );
00153 }
00154 
00155 void KShowMailApp::initStatusBar()
00156 {
00158   // STATUSBAR
00159   TQCString user = getenv( "LOGNAME" );
00160   TQCString server = getenv( "HOSTNAME" );
00161   TQCString  mesg (TQString ("%1@%2").arg(user).arg(server));
00162 
00163   statusBar()->insertItem(i18n("Ready."), 1);
00164   statusBar()->insertItem(mesg, 2, 1);
00165   statusBar()->insertItem("", 3);
00166   statusBar()->insertItem("", 4);
00167 }
00168 
00169 void KShowMailApp::initDocument()
00170 {
00171   m_pDoc = new KshowmailDoc(this);
00172   m_pDoc->newDocument();
00173 }
00174 
00175 void KShowMailApp::initView()
00176 {
00178   // create the main widget here that is managed by TDEMainWindow's view-region and
00179   // connect the widget to your document to display document contents.
00180 
00181   m_pView = new KshowmailView(this);
00182   m_pDoc->addView(m_pView);
00183   setCentralWidget(m_pView);
00184 }
00185 
00186 void KShowMailApp::slotSaveOptions()
00187 {
00188   TDEConfig* config = TDEGlobal::config();
00189 
00190   //order application parts to save their setup
00191   m_pView->saveOptions( config );
00192   Filter::saveOptions( config );
00193   m_ConfigList.saveOptions ();
00194 
00195   //save config to file
00196   config->sync ();
00197 
00198   //disable save action
00199   m_actionSave->setEnabled( false );
00200 }
00201 
00202 void KShowMailApp::readOptions()
00203 {
00204   TDEConfig* config = TDEGlobal::config();
00205 
00206   Filter::readOptions (config);
00207   m_actionSave->setEnabled (false);
00208 }
00209 
00210 bool KShowMailApp::queryClose()
00211 {
00212     bool result;
00213     kdDebug() << "KShowMailApp::queryClose()" << endl;
00214 
00215     if (m_bForceClose) {
00216         // We are forced to close app - so just do it
00217         kdDebug() << "forced exit" << endl;
00218         result = true;
00219     } else if( m_ConfigList.closeToTray() ) {
00220         // Don't close - close button must minimize the window
00221         result = false;
00222         kdDebug() << "ignoring close request and minimizing the window" << endl;
00223         TDEMainWindow* w = memberList->first();
00224         w->hide();
00225     } else {
00226         // Need to ask user first
00227         result = askCloseConfirmation();
00228     }
00229     return result;
00230 }
00231 
00232 bool KShowMailApp::queryExit()
00233 {
00234   kdDebug() << "KShowMailApp::queryExit()" << endl;
00235   slotSaveOptions ();
00236 
00237   return true;
00238 }
00239 
00241 // SLOT IMPLEMENTATION
00243 
00244 void KShowMailApp::slotFileQuit()
00245 {
00246   kdDebug () << "KShowMailApp::slotFileQuit()" << endl;
00247   if(memberList && askCloseConfirmation())
00248   {
00249     m_bForceClose = true;   // Forcing the closing
00250     TDEMainWindow* w = memberList->first();
00251     w->close();
00252   }
00253 }
00254 
00255 
00256 void KShowMailApp::slotSetupAccount()
00257 {
00258   //just open the dialog, if the app is idle
00259   if (m_state != idle)
00260   {
00261     kapp->beep();
00262     return;
00263   }
00264 
00265   //set application state
00266   m_state = configure;
00267 
00268   //stop the refresh timer
00269   stopRefreshTimer();
00270 
00271   //get account to configure
00272   ConfigElem* pConfig = m_ConfigList.getSelectedAccount();
00273 
00274   if( pConfig != NULL )
00275   {
00276     //open dialog
00277     //the dialog sets the new options directly in the account
00278     ServerDialog dlg( this, pConfig );
00279 
00280     if( dlg.exec() == TQDialog::Accepted )
00281     {
00282       //if OK was clicked, refresh the account list view
00283       slotConfChanged();
00284     }
00285   }
00286 
00287   //we are ready, set application state to idle and initiate next refresh
00288   m_state = idle;
00289   initNextRefresh();
00290 }
00291 
00292 void KShowMailApp::slotAccountActivated (TQListViewItem* pItem)
00293 {
00294   TQPtrListIterator<ConfigElem> it(m_ConfigList);
00295   // this is = not == !!!
00296   while (ConfigElem* pConfig = it())
00297   {
00298     if (pConfig->getListViewItem() == pItem)
00299     {
00300       setCaption (pConfig->getAccountName());
00301       return;
00302     }
00303   }
00304 }
00305 
00306 void KShowMailApp::slotAlertDestroyed()
00307 {
00308   m_pAlertDialog = NULL;
00309 }
00310 
00311 void KShowMailApp::slotAlertOk ()
00312 {
00313   //switch main window to normal view
00314   showNormal();
00315   raise();
00316 }
00317 
00318 void KShowMailApp::slotRefresh()
00319 {
00320   //return, if the app is not idle
00321   if ( m_state != idle )
00322   {
00323     kapp->beep();
00324     initNextRefresh();
00325     return;
00326   }
00327 
00328   //stop the refresh timer
00329   stopRefreshTimer();
00330 
00331   //set the state
00332   m_state = refreshing;
00333 
00334   //show status message
00335   slotStatusMsg( i18n( "Refreshing ..." ) );
00336 
00337   //set waiting cursor
00338   TQApplication::setOverrideCursor( TQt::waitCursor );
00339 
00340   //order the account list to refresh its mail lists
00341   m_ConfigList.refreshMailLists();
00342 
00343   return;
00344 }
00345 
00346 void KShowMailApp::slotStop ()
00347 {
00348   if (m_state == idle)
00349   {
00350     kapp->beep ();
00351     return;
00352   }
00353   kdDebug() << "KShowMailApp::slotStop" << endl;
00354 
00355   //kill all running pop3 jobs
00356   m_ConfigList.killPOP3Jobs();
00357 
00358   slotRefreshView ();
00359 
00360   // make sure the view is refreshed before the state gets idle again
00361   // bug #853651
00362 
00363   //set state to idle
00364   m_state = idle;
00365 
00366   //set normal cursor
00367   //might be more than one override cursor ...
00368   while (TQApplication::overrideCursor())
00369     TQApplication::restoreOverrideCursor ();
00370 
00371   //print status message
00372   slotStatusMsg(i18n("Job was stopped"));
00373 }
00374 
00375 void KShowMailApp::slotRefreshView ()
00376 {
00377 
00378   //clear mail list view
00379   m_pView->clearMailListView();
00380 
00381   //fill mail list view
00382   m_ConfigList.fillMailListView( m_pView );
00383 
00384   //refresh account list
00385   m_ConfigList.refreshAccountList();
00386 
00387   //get some informations
00388   int numberMails = m_ConfigList.getNumberMails();
00389   bool hasNewMails = m_ConfigList.getNumberNewMails() > 0;
00390 
00391   //draw number of mails into dock
00392   if( hasNewMails )
00393     //draw red number, because we have new mails
00394      m_pDockWindow->drawNumber( numberMails, TQt::red );
00395   else
00396     //we haven't new mails, draw black
00397     m_pDockWindow->drawNumber( numberMails, TQt::black );
00398 
00399   //show message in status bar
00400   long totalSize = m_ConfigList.getTotalSize();
00401   slotStatusMsg( i18n( "%1 message(s) with a total of %2 bytes are waiting" ).arg( numberMails ).arg( totalSize ) );
00402 }
00403 
00404 void KShowMailApp::slotDelete()
00405 {
00406   //just delete, if no operation is running
00407   if( m_state != idle )
00408   {
00409     kapp->beep();
00410     return;
00411   }
00412 
00413   //return, if no mails are selected
00414   if( !m_ConfigList.hasSelectedMails() )
00415     return;
00416 
00417   //confirm deletion if required
00418   if( m_ConfigList.confirmDeletion() )
00419   {
00420     //get subjects off all selected mails
00421     TQStringList subjects = m_ConfigList.getSelectedSubjects();
00422 
00423     //show question
00424     int answer = KMessageBox::questionYesNoList( this, i18n( "Do you want to delete these mails?"), subjects, i18n( "Delete?" ) );
00425 
00426     if( answer == KMessageBox::No )
00427       return;
00428   }
00429 
00430   //set the state
00431   m_state = deleting;
00432 
00433   //show status message
00434   slotStatusMsg( i18n( "Deleting Mail(s) ..." ) );
00435 
00436   //set waiting cursor
00437   TQApplication::setOverrideCursor( TQt::waitCursor );
00438 
00439   //order the account list to delete the selected mails
00440   //test!
00441   m_ConfigList.deleteSelectedMails();
00442 }
00443 
00444 void KShowMailApp::slotShowHeader ()
00445 {
00446   //only show headers, if the app is idle
00447   if( m_state != idle )
00448   {
00449     kapp->beep ();
00450     return;
00451   }
00452 
00453   //show the headers
00454   m_ConfigList.showSelectedHeaders();
00455 
00456 }
00457 
00458 void KShowMailApp::slotShowMessage ()
00459 {
00460   //return, if application is not idle
00461   if( m_state != idle )
00462   {
00463     kapp->beep ();
00464     return;
00465   }
00466 
00467   //return, if no mails are selected
00468   if( !m_ConfigList.hasSelectedMails() )
00469     return;
00470 
00471   //set the state
00472   m_state = showing;
00473 
00474   //show status message
00475   slotStatusMsg( i18n( "Downloading ..." ) );
00476 
00477   //set waiting cursor
00478   TQApplication::setOverrideCursor( TQt::waitCursor );
00479 
00480   //order the account list to show the selected mails
00481   m_ConfigList.showSelectedMails();
00482 }
00483 
00484 void KShowMailApp::slotStatusMsg(const TQString& text)
00485 {
00486   //get current time
00487   // added by Gustavo Zamorano to include time
00488   TQString sTime = TQTime::currentTime ().toString ();
00489 
00490   //clear status bar
00491   statusBar()->clear();
00492 
00493   //set given text
00494   statusBar()->changeItem(text, 1);
00495 
00496   //set current time
00497   statusBar()->changeItem(sTime, 4);
00498 }
00499 
00500 void KShowMailApp::slotStatusHelpMsg(const TQString &text)
00501 {
00502   statusBar()->message(text, 2000);
00503 }
00504 
00505 
00506 
00507 
00508 bool KShowMailApp::event(TQEvent *e)
00509 {
00510   // to hide the taskbar button; any better solution ??
00511   if ((e->type() == TQEvent::Hide) && m_ConfigList.minimizesToTray() ) {
00512     hide ();
00513   }
00514 
00515   return(TDEMainWindow::event(e));
00516 }
00517 
00518 void KShowMailApp::slotSetupFilters ()
00519 {
00520   if (m_state != idle)
00521   {
00522     kapp->beep ();
00523     return;
00524   }
00525   m_state = configure;
00526   FilterDialog dlg (this, "Filters");
00527   if (dlg.exec () == TQDialog::Accepted)
00528     m_actionSave->setEnabled (true);
00529   m_state = idle;
00530 }
00531 
00532 void KShowMailApp::slotForceClose()
00533 {
00534     m_bForceClose = true;
00535 }
00536 
00537 bool KShowMailApp::askCloseConfirmation()
00538 {
00539     bool result;
00540 
00541     if( m_ConfigList.confirmClose() ) {
00542         // Need to ask user
00543         result = (KMessageBox::questionYesNo (this, i18n ("KShowmail will be closed.\n"
00544                                     "Are you sure?")) == KMessageBox::Yes);
00545     } else {
00546         // User doesn't want to be asked - just close it
00547         result = true;
00548     }
00549 
00550     return result;
00551 }
00552 
00553 void KShowMailApp::slotDeletionReady( )
00554 {
00555   //set state to idle
00556   m_state = idle;
00557 
00558   //set normal cursor
00559   while( TQApplication::overrideCursor() )
00560     TQApplication::restoreOverrideCursor();
00561 
00562   //show status message
00563   slotStatusMsg( i18n( "Ready." ) );
00564 
00565   //refresh mail list
00566   slotRefresh();
00567 }
00568 
00569 void KShowMailApp::slotShowMessageReady( )
00570 {
00571   //set state to idle
00572   m_state = idle;
00573 
00574   //set normal cursor
00575   while( TQApplication::overrideCursor() )
00576     TQApplication::restoreOverrideCursor();
00577 
00578   //show status message
00579   slotStatusMsg( i18n( "Ready." ) );
00580 
00581 
00582 }
00583 
00584 void KShowMailApp::slotNormalCursor( )
00585 {
00586   //set normal cursor
00587   while( TQApplication::overrideCursor() )
00588     TQApplication::restoreOverrideCursor();
00589 
00590 }
00591 
00592 void KShowMailApp::slotWaitingCursor( )
00593 {
00594   //set waiting cursor
00595   TQApplication::setOverrideCursor( TQt::waitCursor );
00596 }
00597 
00598 void KShowMailApp::slotRefreshReady( )
00599 {
00600   //set state to idle
00601   m_state = idle;
00602 
00603   //set normal cursor
00604   while( TQApplication::overrideCursor() )
00605     TQApplication::restoreOverrideCursor();
00606 
00607   //refresh mail list view
00608   slotRefreshView();
00609 
00610   //inform the user about new mails
00611   bool hasNewMails = m_ConfigList.getNumberNewMails() > 0;
00612   if ( hasNewMails )
00613   {
00614     //show main window if desired
00615     if( m_ConfigList.showMainWindowForNewMails() )
00616     {
00617       showNormal();
00618       raise();
00619     }
00620 
00621     //get out some sounds
00622     m_ConfigList.beep();
00623     m_ConfigList.playSound();
00624 
00625     //execute a command
00626     m_ConfigList.executeNewMailCommand();
00627 
00628     //show alert message if desired
00629     if( m_ConfigList.showAlertMessageForNewMails() )
00630     {
00631       //have we created one already?
00632       if( m_pAlertDialog != NULL )
00633       {
00634         //yes, we have one
00635         m_pAlertDialog->show();
00636         m_pAlertDialog->raise();
00637       }
00638       else
00639       {
00640         //create a message dialog
00641         m_pAlertDialog = new AlertDialog( this );
00642         connect( m_pAlertDialog, SIGNAL( destroyed() ), SLOT( slotAlertDestroyed() ) );
00643         connect( m_pAlertDialog, SIGNAL( signalOk() ), SLOT( slotAlertOk() ) );
00644       }
00645     }
00646 
00647   }
00648   else
00649   {
00650     //no new mails was received
00651     //perform configured actions
00652 
00653     //terminate app if desired
00654     if( m_ConfigList.quitNoNewMails() )
00655       slotFileQuit();
00656     else if( m_ConfigList.minimizeMainWindowNoNewMails() )
00657     {
00658       showMinimized();
00659       hide();
00660     }
00661   }
00662 
00663   //show status message
00664   slotStatusMsg( i18n( "Ready." ) );
00665 
00666 
00667   //prepare next refresh cycle
00668   initNextRefresh();
00669 
00670   //apply filters
00671   m_ConfigList.applyFilters();
00672 
00673   //perform automatic delete if desired
00674   if (Filter::_status == Filter::automatic)
00675   {
00676     slotDelete ();
00677   }
00678 }
00679 
00680 void KShowMailApp::initFirstRefresh( )
00681 {
00682   //is auto refresh on? if not, we do nothing
00683   if( m_ConfigList.AutoRefreshOn() )
00684   {
00685     //is an initial time configured? if not, we refresh immediately
00686     if( m_ConfigList.hasInitTime() )
00687     {
00688       //starts refresh timer with the configured initial time to first refresh
00689       m_pTimer->start( m_ConfigList.getInitTime() * 1000, true );
00690       m_nSecondsToGo = m_ConfigList.getInitTime();
00691     }
00692     else
00693     {
00694       //just to set a defined state
00695       m_pTimer->stop();
00696       m_nSecondsToGo = 0;
00697 
00698       //start refresh cycle
00699       slotRefresh();
00700     }
00701   }
00702   else
00703   {
00704     //set a defined state
00705     m_pTimer->stop();
00706     m_nSecondsToGo = 0;
00707   }
00708 }
00709 
00710 void KShowMailApp::stopRefreshTimer( )
00711 {
00712   m_pTimer->stop();
00713   m_nSecondsToGo = 0;
00714 }
00715 
00716 void KShowMailApp::initNextRefresh( )
00717 {
00718   if( m_ConfigList.AutoRefreshOn() )
00719   {
00720     //auto refresh is activated
00721     //restart the refresh timer
00722     m_pTimer->start( m_ConfigList.getRefreshTimeInterval() * 60000, true );
00723     m_nSecondsToGo = m_ConfigList.getRefreshTimeInterval() * 60;
00724   }
00725   else
00726   {
00727     //auto refresh is not activated
00728     //set a defined state of the refresh timer
00729     m_pTimer->stop();
00730     m_nSecondsToGo = 0;
00731   }
00732 }
00733 
00734 void KShowMailApp::delayNextRefresh( )
00735 {
00736   const unsigned long DELAY_TIME = 60;
00737 
00738   //delay only if the timer is active and the remaining time is less than one minute
00739   if( m_pTimer->isActive() )
00740   {
00741     if( m_nSecondsToGo < DELAY_TIME )
00742     {
00743       m_pTimer->start( DELAY_TIME * 1000, true );
00744       m_nSecondsToGo = DELAY_TIME;
00745     }
00746   }
00747 }
00748 
00749 void KShowMailApp::slotEditToolbars()
00750 {
00751   //create the toolbar config dialog
00752   KEditToolbar *dlg = new KEditToolbar(guiFactory());
00753   if( dlg->exec() )
00754   {
00755     //if dialog closed by OK, create the GUI new
00756     //the dialog has changed the kshowmailui.rc file
00757     createGUI();
00758   }
00759 
00760   //destruct dialog
00761   delete dlg;
00762 }
00763 
00764 void KShowMailApp::slotSetup( )
00765 {
00766   //just open the dialog, if the app is idle
00767   if (m_state != idle)
00768   {
00769     kapp->beep();
00770     return;
00771   }
00772 
00773   //set application state
00774   m_state = configure;
00775 
00776   //stop the refresh timer
00777   stopRefreshTimer();
00778 
00779   if ( SetupDialog == NULL )
00780   {
00781     //if no preferences dialog was created as yet, create one
00782     SetupDialog = new KCMultiDialog( KCMultiDialog::IconList, i18n( "Options" ), this, "SetupDialog" );
00783     SetupDialog->addModule( "kshowmailconfigaccounts.desktop" );
00784     SetupDialog->addModule( "kshowmailconfiggeneral.desktop" );
00785     SetupDialog->addModule( "kshowmailconfigdisplay.desktop" );
00786     SetupDialog->addModule( "kshowmailconfigactions.desktop" );
00787 
00788     //If the configuration was changed, it will call slotConfChanged
00789     connect( SetupDialog, SIGNAL( configCommitted() ), this, SLOT( slotConfChanged() ) );
00790   }
00791 
00792   //execute preferences dialog
00793   SetupDialog->exec();
00794 
00795   //we are ready, set application state to idle and initiate next refresh
00796   m_state = idle;
00797   initNextRefresh();
00798 
00799 }
00800 
00801 void KShowMailApp::slotConfChanged( )
00802 {
00803   //read the new setup
00804   m_ConfigList.refreshSetup( m_pView->m_pListAccounts );
00805   m_pView->refreshSetup();
00806 }
00807 

Generated on Thu Jul 5 19:36:06 2007 for kshowmail by  doxygen 1.5.0