00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "kshowmail.h"
00019
00020 KShowmail::KShowmail() : KXmlGuiWindow()
00021 {
00022
00023 forceExit = false;
00024
00025
00026 accounts = new AccountList( this );
00027 connect( accounts, SIGNAL( sigMessageWindowOpened() ), this, SLOT( slotNormalCursor() ) );
00028 connect( accounts, SIGNAL( sigAllMessageWindowsClosed() ), this, SLOT( slotWaitingCursor() ) );
00029 connect( accounts, SIGNAL( sigRefreshReady() ), this, SLOT( slotRefreshReady() ) );
00030 connect( accounts, SIGNAL( sigDeleteReady() ), this, SLOT( slotDeletionReady() ) );
00031 connect( accounts, SIGNAL( sigShowBodiesReady() ), this, SLOT( slotShowMessageReady() ) );
00032
00033
00034
00035 accountModel = new AccountViewModel( accounts, this );
00036 connect( accountModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( slotConfChanged() ) );
00037 mailModel = new MailViewModel( accounts, this );
00038
00039
00040 mailSelectModel = new QItemSelectionModel( mailModel );
00041 accountSelectModel = new QItemSelectionModel( accountModel );
00042
00043
00044 view = new KShowmailView( accountModel, mailModel, mailSelectModel, accountSelectModel, this );
00045 setCentralWidget( view );
00046
00047
00048 initStatusBar();
00049
00050
00051 initActions();
00052
00053
00054 view->addActionToAccountList( actionRefresh );
00055 view->addActionToAccountList( actionSetupAccount );
00056 view->addActionToMailList( actionShowHeader );
00057 view->addActionToMailList( actionShowMessage );
00058 view->addActionToMailList( actionDelete );
00059 view->addActionToMailList( actionAddWhitelist );
00060 view->addActionToMailList( actionAddBlacklist );
00061
00062
00063
00064
00065
00066
00067
00068 setupGUI();
00069
00070
00071 config = KGlobal::config();
00072 configGeneral = new KConfigGroup( config, CONFIG_GROUP_GENERAL );
00073
00074
00075 trayIcon = new SystemTrayIcon( this, QIcon( KStandardDirs::locate( "data", "kshowmail/pics/trayIcon.png" ) ), actionRefresh );
00076 trayIcon->show();
00077
00078
00079 accounts->loadSetup();
00080 view->loadSetup();
00081
00082
00083 view->refreshViews( mailSelectModel );
00084
00085
00086
00087
00088
00089 mediaObject = new Phonon::MediaObject( this );
00090 audioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this );
00091 Phonon::createPath( mediaObject, audioOutput );
00092
00093
00094 newMailDlg = new NewMailDialog( this );
00095 connect( newMailDlg, SIGNAL( cancelClicked() ), this, SLOT( slotShowMainWindow() ) );
00096
00097
00098 refreshTimer = new QTimer( this );
00099 connect( refreshTimer, SIGNAL( timeout() ), this, SLOT( slotRefreshTimer() ) );
00100
00101
00102 state = idle;
00103
00104
00105 startAutomaticRefresh( true );
00106
00107
00108 }
00109
00110 KShowmail::~KShowmail()
00111 {
00112 }
00113
00114 void KShowmail::initActions()
00115 {
00116
00117 KStandardAction::quit( this, SLOT( slotFileQuit() ), actionCollection() );
00118
00119
00120 actionRefresh = actionCollection()->addAction( "refresh" );
00121 actionRefresh->setText( i18nc( "@action:inmenu look for new messages", "Refresh messages" ) );
00122 actionRefresh->setIcon( KIcon( "view-refresh" ) );
00123 actionRefresh->setShortcut( Qt::Key_F5 );
00124 connect( actionRefresh, SIGNAL( triggered() ), this, SLOT( slotRefresh() ) );
00125
00126 actionShowHeader = actionCollection()->addAction( "show_header" );
00127 actionShowHeader->setText( i18nc( "@action:inmenu show the headers of the selected mails", "Show header of highlighted messages" ) );
00128 actionShowHeader->setIcon( KIcon( "mail-mark-unread" ) );
00129 actionShowHeader->setShortcut( Qt::Key_F2 );
00130 connect( actionShowHeader, SIGNAL( triggered() ), this, SLOT( slotShowHeader() ) );
00131
00132 actionShowMessage = actionCollection()->addAction( "show_complete" );
00133 actionShowMessage->setText( i18nc( "@action:inmenu show the body of the selected mails", "Show complete highlighted messages" ) );
00134 actionShowMessage->setIcon( KIcon( "mail-mark-read" ) );
00135 actionShowMessage->setShortcut( Qt::Key_F3 );
00136 connect( actionShowMessage, SIGNAL( triggered() ), this, SLOT( slotShowMessage() ) );
00137
00138 actionDelete = actionCollection()->addAction( "delete" );
00139 actionDelete->setText( i18nc( "@action:inmenu delete selected mails", "Delete highlighted messages" ) );
00140 actionDelete->setIcon( KIcon( "draw-eraser" ) );
00141 actionDelete->setShortcut( Qt::Key_Delete );
00142 connect( actionDelete, SIGNAL( triggered() ), this, SLOT( slotDelete() ) );
00143
00144 actionStop = actionCollection()->addAction( "stop" );
00145 actionStop->setText( i18nc( "@action:inmenu cancle the current running task", "Stop current transfer" ) );
00146 actionStop->setIcon( KIcon( "dialog-cancel" ) );
00147 connect( actionStop, SIGNAL( triggered() ), this, SLOT( slotStop() ) );
00148
00149 actionShowFilterLog = actionCollection()->addAction( "show_filterlog" );
00150 actionShowFilterLog->setText( i18nc( "@action:inmenu open the filter log", "Show Filter Log" ) );
00151 actionShowFilterLog->setIcon( KIcon( "text-x-log" ) );
00152 actionShowFilterLog->setShortcut( Qt::Key_F4 );
00153 connect( actionShowFilterLog, SIGNAL( triggered() ), this, SLOT( slotShowFilterLog() ) );
00154
00155 actionAddWhitelist = actionCollection()->addAction( "addWhitelist" );
00156 actionAddWhitelist->setText( i18nc( "@action:inmenu add the senders of selected mails to the whitelist", "Add sender to whitelist" ) );
00157 actionAddWhitelist->setIcon( KIcon( "list-add-user" ) );
00158 connect( actionAddWhitelist, SIGNAL( triggered() ), this, SLOT( slotAddToWhitelist() ) );
00159
00160 actionAddBlacklist = actionCollection()->addAction( "addBlacklist" );
00161 actionAddBlacklist->setText( i18nc( "@action:inmenu add the senders of selected mails to the blacklist", "Add sender to blacklist" ) );
00162 actionAddBlacklist->setIcon( KIcon( "list-remove-user" ) );
00163 connect( actionAddBlacklist, SIGNAL( triggered() ), this, SLOT( slotAddToBlacklist() ) );
00164
00165
00166
00167 KStandardAction::preferences( this, SLOT( slotSetup() ), actionCollection() );
00168
00169
00170 KAction* actionSendFeedback = actionCollection()->addAction( "sendFeedback" );
00171 actionSendFeedback->setText( i18nc( "@action:inmenu open a dialog to send a feedback", "Send Feedback Mail" ) );
00172 actionSendFeedback->setIcon( KIcon( "mail-flag" ) );
00173 connect( actionSendFeedback, SIGNAL( triggered() ), this, SLOT( slotSendFeedbackMail() ) );
00174
00175
00176 actionSetupAccount = actionCollection()->addAction( "setupAccount" );
00177 actionSetupAccount->setText( i18nc( "@action:inmenu setup the selected account", "Setup this account") );
00178 actionSetupAccount->setIcon( KIcon( "configure") );
00179 connect( actionSetupAccount, SIGNAL( triggered() ), this, SLOT( slotSetupAccount() ) );
00180
00181
00182
00183 }
00184
00185 void KShowmail::slotRefresh() {
00186
00187
00188 if ( state != idle )
00189 {
00190 return;
00191 }
00192
00193
00194 refreshTimer->stop();
00195
00196
00197 state = refreshing;
00198
00199
00200 showStatusMessage( i18nc( "@info:status application is getting mails from the servers", "Refreshing ..." ) );
00201
00202
00203 trayIcon->showLooking();
00204
00205
00206 QApplication::setOverrideCursor( Qt::WaitCursor );
00207
00208
00209 accounts->refreshMailLists( &fLog );
00210 }
00211
00212 void KShowmail::slotShowHeader() {
00213
00214
00215 if( state != idle )
00216 {
00217 kapp->beep ();
00218 return;
00219 }
00220
00221
00222 QList<Mail> mailList = mailModel->getSelectedMails( mailSelectModel );
00223
00224
00225 QListIterator<Mail> itMails( mailList );
00226 int dialogReturnValue = KDialog::Accepted;
00227 while( itMails.hasNext() && dialogReturnValue == KDialog::Accepted )
00228 {
00229 Mail mail = itMails.next();
00230
00231
00232 QString account( mail.getAccountName() );
00233 QString subject( mail.getSubject() );
00234 QPointer<ShowHeaderDialog> dlg = new ShowHeaderDialog( this->centralWidget(), account , subject, mail.getHeader() );
00235 dialogReturnValue = dlg->exec();
00236
00237 delete dlg;
00238 }
00239 }
00240
00241 void KShowmail::slotShowMessage() {
00242
00243
00244 if( state != idle )
00245 {
00246 kapp->beep ();
00247 return;
00248 }
00249
00250
00251 if( !mailSelectModel->hasSelection() )
00252 return;
00253
00254
00255 state = showing;
00256
00257
00258 showStatusMessage( i18nc( "@info:status application is downloading mails to show", "Downloading ..." ) );
00259
00260
00261 QApplication::setOverrideCursor( Qt::WaitCursor );
00262
00263
00264 QList<Mail> mailsToShow = mailModel->getSelectedMails( mailSelectModel );
00265
00266
00267 QListIterator<Mail> itShow( mailsToShow );
00268 while( itShow.hasNext() ) {
00269
00270 Mail mail = itShow.next();
00271 mail.getAccount()->addMailToShow( mail.getNumber() );
00272 }
00273
00274 accounts->showMails();
00275
00276
00277 }
00278
00279 void KShowmail::slotDelete() {
00280
00281
00282 if( state != idle )
00283 {
00284 kapp->beep();
00285 return;
00286 }
00287
00288
00289 if( !mailSelectModel->hasSelection() )
00290 return;
00291
00292
00293 bool confirmDeletion = configGeneral->readEntry( CONFIG_ENTRY_CONFIRM_DELETE, DEFAULT_CONFIRM_DELETE );
00294
00295
00296
00297 if( confirmDeletion )
00298 {
00299
00300
00301 QStringList subjects = mailModel->getSelectedSubjects( mailSelectModel );
00302
00303
00304 int answer = KMessageBox::questionYesNoList( this, i18nc( "@info ask for delete the mails", "Do you want to delete these mails?"), subjects, i18nc( "@title:window ask for delete the mails", "Delete?" ) );
00305
00306 if( answer == KMessageBox::No )
00307 return;
00308 }
00309
00310
00311
00312 state = deleting;
00313
00314
00315 showStatusMessage( i18nc( "@info:status application is removing mails from server", "Deleting Mail(s) ..." ) );
00316
00317
00318 QApplication::setOverrideCursor( Qt::WaitCursor );
00319
00320
00321 QList<Mail> mailsToDelete = mailModel->getSelectedMails( mailSelectModel );
00322
00323
00324 QListIterator<Mail> itDel( mailsToDelete );
00325 while( itDel.hasNext() ) {
00326
00327 Mail mail = itDel.next();
00328
00329 QPointer<Account> acc = mail.getAccount();
00330
00331 int mailNumber = mail.getNumber();
00332
00333 acc->addMailToDelete( mailNumber );
00334
00335 }
00336
00337 accounts->deleteMails();
00338
00339 }
00340
00341 void KShowmail::slotStop() {
00342 accounts->cancelTasks();
00343 }
00344
00345 void KShowmail::slotShowFilterLog() {
00346
00347
00348 QPointer<FilterLogView> view = new FilterLogView( this, &fLog );
00349 view->exec();
00350
00351 delete view;
00352
00353 refreshFilterStatusBar();
00354 }
00355
00356 void KShowmail::slotAddToBlacklist() {
00357
00358
00359 QStringList senders = mailModel->getSelectedSenders( mailSelectModel );
00360 kdDebug() << senders << endl;
00361
00362
00363 KConfigGroup* config = new KConfigGroup( KGlobal::config(), CONFIG_GROUP_FILTER );
00364 QStringList blackList = config->readEntry( CONFIG_ENTRY_FILTER_BLACKLIST, QStringList() );
00365
00366
00367 blackList.append( senders );
00368
00369
00370 config->writeEntry( CONFIG_ENTRY_FILTER_BLACKLIST, blackList );
00371 config->sync();
00372
00373 delete config;
00374
00375
00376 accounts->refreshFilterSetup();
00377
00378 }
00379
00380 void KShowmail::slotAddToWhitelist() {
00381
00382
00383 QStringList senders = mailModel->getSelectedSenders( mailSelectModel );
00384 kdDebug() << senders << endl;
00385
00386
00387 KConfigGroup* config = new KConfigGroup( KGlobal::config(), CONFIG_GROUP_FILTER );
00388 QStringList whiteList = config->readEntry( CONFIG_ENTRY_FILTER_WHITELIST, QStringList() );
00389
00390
00391 whiteList.append( senders );
00392
00393
00394 config->writeEntry( CONFIG_ENTRY_FILTER_WHITELIST, whiteList );
00395 config->sync();
00396
00397 delete config;
00398
00399
00400 accounts->refreshFilterSetup();
00401 }
00402
00403 void KShowmail::slotSetup() {
00404
00405
00406 view->saveSetup();
00407
00408
00409 setupDialog = new KCMultiDialog( this );
00410 setupDialog->addModule( "kshowmailconfiggeneral.desktop" );
00411 setupDialog->addModule( "kshowmailconfigaccounts.desktop" );
00412 setupDialog->addModule( "kshowmailconfigactions.desktop" );
00413 setupDialog->addModule( "kshowmailconfigdisplay.desktop" );
00414 setupDialog->addModule( "kshowmailconfigfilter.desktop" );
00415 setupDialog->addModule( "kshowmailconfigspamcheck.desktop" );
00416 setupDialog->addModule( "kshowmailconfiglog.desktop" );
00417
00418
00419 connect( setupDialog, SIGNAL( configCommitted() ), this, SLOT( slotConfChanged() ) );
00420
00421
00422 setupDialog->exec();
00423
00424
00425 delete setupDialog;
00426
00427
00428 }
00429
00430 void KShowmail::slotSendFeedbackMail() {
00431 kDebug() << "slotSendFeedbackMail" << endl;
00432 }
00433
00434 void KShowmail::slotFileQuit() {
00435
00436
00437 if( configGeneral->readEntry( CONFIG_ENTRY_CONFIRM_CLOSE, DEFAULT_CONFIRM_CLOSE ) ) {
00438
00439 if( askCloseConfirmation() == false )
00440 return;
00441 }
00442
00443
00444 forceExit = true;
00445
00446
00447 kapp->closeAllWindows();
00448 }
00449
00450 bool KShowmail::queryClose() {
00451
00452
00453 fLog.save();
00454 config->sync();
00455 accounts->saveOptions();
00456 view->saveSetup();
00457
00458
00459 if( forceExit ) {
00460 return true;
00461 }
00462
00463
00464 if( configGeneral->readEntry( CONFIG_ENTRY_CLOSE_TO_TRAY, DEFAULT_CLOSE_TO_TRAY ) ) {
00465
00466 hide();
00467 return false;
00468 }
00469
00470
00471 if( configGeneral->readEntry( CONFIG_ENTRY_CONFIRM_CLOSE, DEFAULT_CONFIRM_CLOSE ) ) {
00472
00473 if( askCloseConfirmation() == true )
00474 return true;
00475 }
00476
00477 return true;
00478 }
00479
00480 void KShowmail::slotConfChanged() {
00481
00482 accounts->loadSetup();
00483 fLog.loadSetup();
00484 view->loadSetup();
00485
00486
00487 view->refreshViews( mailSelectModel );
00488
00489
00490 startAutomaticRefresh();
00491
00492
00493 }
00494
00495 void KShowmail::showStatusMessage( const QString& text)
00496 {
00497
00498 statusBar()->changeItem( text, STATUSBAR_FIELD_STATE );
00499 }
00500
00501 void KShowmail::initStatusBar()
00502 {
00503 statusBar()->insertPermanentItem( i18nc( "@info:status application is idle", "Ready" ), STATUSBAR_FIELD_STATE );
00504 statusBar()->insertPermanentItem( "", STATUSBAR_FIELD_FILTER, 1 );
00505 statusBar()->setItemAlignment( STATUSBAR_FIELD_FILTER, Qt::AlignLeft | Qt::AlignVCenter );
00506 statusBar()->insertPermanentItem( "", STATUSBAR_FIELD_NEXT_REFRESH );
00507 statusBar()->insertPermanentItem( "", STATUSBAR_FIELD_LAST_REFRESH );
00508
00509 statusBar()->setSizeGripEnabled( true );
00510
00511 statusBar()->setToolTip( i18nc( "@info:tooltip", "Shows the number of deleted, moved or ignored mails by the filter.\nThe positions denotes:\nby last refresh / since application start / listed by the log" ) );
00512 statusBar()->show();
00513
00514 refreshFilterStatusBar();
00515
00516 }
00517
00518 void KShowmail::slotRefreshReady()
00519 {
00520
00521 state = idle;
00522
00523
00524 while( QApplication::overrideCursor() )
00525 QApplication::restoreOverrideCursor();
00526
00527
00528 showStatusMessage( i18nc( "@info:status application is idle", "Ready" ) );
00529
00530
00531 view->refreshViews( mailSelectModel );
00532
00533
00534 refreshFilterStatusBar();
00535
00536
00537 trayIcon->drawNumber( accounts->getNumberMails(), accounts->getNumberNewMails() != 0 ? Qt::red : Qt::black );
00538
00539
00540 QString sTime = QTime::currentTime().toString ();
00541 statusBar()->changeItem( i18nc( "@info:status time of the last refresh", "Last Refresh: %1", sTime ), STATUSBAR_FIELD_LAST_REFRESH );
00542
00543
00544 if( accounts->getNumberNewMails() > 0 ) {
00545
00546 handleNewMails();
00547
00548 } else {
00549
00550 handleNoNewMails();
00551 }
00552
00553
00554 startAutomaticRefresh();
00555
00556 }
00557
00558 void KShowmail::slotNormalCursor( )
00559 {
00560
00561 while( QApplication::overrideCursor() )
00562 QApplication::restoreOverrideCursor();
00563
00564 }
00565
00566 void KShowmail::slotWaitingCursor( )
00567 {
00568
00569 if( state != idle )
00570 QApplication::setOverrideCursor( Qt::WaitCursor );
00571 }
00572
00573 void KShowmail::slotDeletionReady( )
00574 {
00575
00576 state = idle;
00577
00578
00579 while( QApplication::overrideCursor() )
00580 QApplication::restoreOverrideCursor();
00581
00582
00583 showStatusMessage( i18nc( "@info:status application is idle", "Ready." ) );
00584
00585
00586 slotRefresh();
00587 }
00588
00589 void KShowmail::refreshFilterStatusBar( )
00590 {
00591 int numberDeletedLastRefresh = accounts->numberDeletedMailsLastRefresh();
00592 int numberDeletedSinceStart = accounts->numberDeletedMailsStart();
00593 int numberDeletedLog = fLog.numberDeletedMails();
00594
00595 int numberMovedLastRefresh = accounts->numberMovedMailsLastRefresh();
00596 int numberMovedSinceStart = accounts->numberMovedMailsStart();
00597 int numberMovedLog = fLog.numberMovedMails();
00598
00599 int numberIgnored = accounts->numberIgnoredMails();
00600
00601 statusBar()->changeItem( i18nc( "@info:status numbers of filtered mails", "Filter: Deleted: %1/%2/%3; Moved: %4/%5/%6; Ignored: %7", numberDeletedLastRefresh, numberDeletedSinceStart, numberDeletedLog, numberMovedLastRefresh, numberMovedSinceStart, numberMovedLog, numberIgnored ), STATUSBAR_FIELD_FILTER );
00602 }
00603
00604 void KShowmail::slotShowMessageReady( )
00605 {
00606
00607 state = idle;
00608
00609
00610 while( QApplication::overrideCursor() )
00611 QApplication::restoreOverrideCursor();
00612
00613
00614 showStatusMessage( i18nc( "@info:status application is idle", "Ready." ) );
00615
00616
00617 }
00618
00619 void KShowmail::startAutomaticRefresh( bool initiate ) {
00620
00621
00622 if( configGeneral->readEntry( CONFIG_ENTRY_AUTO_REFRESH, DEFAULT_AUTO_REFRESH ) ) {
00623
00624
00625 if( initiate ) {
00626
00627 timeToRefresh = configGeneral->readEntry( CONFIG_ENTRY_INITIAL_TIME, DEFAULT_INITIAL_TIME );
00628
00629 } else {
00630
00631 timeToRefresh = configGeneral->readEntry( CONFIG_ENTRY_INTERVAL_TIME, DEFAULT_INTERVAL_TIME ) * 60;
00632 }
00633
00634
00635 refreshTimer->start( 1000 );
00636
00637 } else {
00638
00639 refreshTimer->stop();
00640 }
00641
00642
00643 }
00644
00645 void KShowmail::slotRefreshTimer() {
00646
00647
00648 timeToRefresh--;
00649
00650
00651 QTime time;
00652 time = time.addSecs( timeToRefresh );
00653
00654 statusBar()->changeItem( i18nc( "@info:status time to next refresh", "Next Refresh: %1" ).arg( time.toString() ), STATUSBAR_FIELD_NEXT_REFRESH );
00655
00656
00657 if( timeToRefresh == 0 ) {
00658
00659 stopAutomaticRefresh();
00660 slotRefresh();
00661 }
00662
00663 }
00664
00665 void KShowmail::stopAutomaticRefresh() {
00666
00667 refreshTimer->stop();
00668 timeToRefresh = 0;
00669
00670 }
00671
00672 void KShowmail::slotSetupAccount() {
00673
00674 if( !accountSelectModel->hasSelection() ) return;
00675
00676
00677
00678 QModelIndex selIndex = accountSelectModel->selectedRows().first();
00679 Account* acc = accountModel->getAccount( selIndex );
00680
00681
00682 QPointer<AccountSetupDialogContext> dlg = new AccountSetupDialogContext( this, acc->getName() );
00683 int res = dlg->exec();
00684
00685
00686 if( res == KDialog::Accepted )
00687 slotConfChanged();
00688
00689
00690 delete dlg;
00691
00692 }
00693
00694 void KShowmail::handleNewMails()
00695 {
00696
00697 KConfigGroup* conf = new KConfigGroup( KGlobal::config(), CONFIG_GROUP_ACTIONS );
00698
00699
00700 if( conf->readEntry( CONFIG_ENTRY_NEW_MAIL_SOUND, DEFAULT_ACTION_NEW_MAIL_SOUND ) ) {
00701
00702
00703 QString file = conf->readEntry( CONFIG_ENTRY_NEW_MAIL_SOUNDPATH, "" );
00704 if( file.length() != 0 )
00705 {
00706 mediaObject->setCurrentSource( Phonon::MediaSource( file ) );
00707 mediaObject->play();
00708
00709 }
00710
00711 }
00712
00713 if( conf->readEntry( CONFIG_ENTRY_NEW_MAIL_ALERTWINDOW, DEFAULT_ACTION_NEW_MAIL_ALERTWINDOW) ) {
00714
00715 newMailDlg->show();
00716 }
00717
00718 if( conf->readEntry( CONFIG_ENTRY_NEW_MAIL_MAINWINDOW, DEFAULT_ACTION_NEW_MAIL_MAINWINDOW ) ) {
00719
00720 slotShowMainWindow();
00721 }
00722
00723 if( conf->readEntry( CONFIG_ENTRY_NEW_MAIL_BEEP, DEFAULT_ACTION_NEW_MAIL_BEEP ) ) {
00724
00725 kapp->beep();
00726 }
00727
00728 if( conf->readEntry( CONFIG_ENTRY_NEW_MAIL_COMMAND, DEFAULT_ACTION_NEW_MAIL_COMMAND ) ) {
00729
00730
00731 QString command = conf->readEntry( CONFIG_ENTRY_NEW_MAIL_COMMANDPATH, "" );
00732
00733
00734 if( command.length() > 0 ) {
00735
00736 QStringList parts = command.split( ' ', QString::SkipEmptyParts );
00737
00738 if( !command.isEmpty() )
00739 {
00740 KProcess::execute( parts );
00741 }
00742
00743 }
00744
00745 }
00746
00747 delete conf;
00748
00749 }
00750
00751 void KShowmail::slotShowMainWindow()
00752 {
00753 show();
00754 setWindowState( windowState() & ~Qt::WindowMinimized );
00755 }
00756
00757 void KShowmail::handleNoNewMails()
00758 {
00759
00760
00761 KConfigGroup* conf = new KConfigGroup( KGlobal::config(), CONFIG_GROUP_ACTIONS );
00762
00763 if( conf->readEntry( CONFIG_ENTRY_NO_NEW_MAIL_MINIMIZE, DEFAULT_ACTION_NO_NEW_MAIL_MINIMIZE ) ) {
00764
00765 hide();
00766 }
00767
00768 if( conf->readEntry( CONFIG_ENTRY_NO_NEW_MAIL_TERMINATE, DEFAULT_ACTION_NO_NEW_MAIL_TERMINATE ) ) {
00769
00770 forceExit = true;
00771 kapp->closeAllWindows();
00772 }
00773 }
00774
00775 bool KShowmail::askCloseConfirmation()
00776 {
00777 return KMessageBox::questionYesNo( this, i18nc( "@info ask for closing the application", "KShowmail will be closed.\nAre you sure?") ) == KMessageBox::Yes;
00778
00779 }
00780
00781
00782 #include "kshowmail.moc"