From 4d381ca5293e70e50d2e203e072b693de7be8610 Mon Sep 17 00:00:00 2001 From: Andreas Gungl Date: Sun, 15 Feb 2004 20:09:29 +0000 Subject: [PATCH] make the scan for anti spam tools semi non-blocking; fix the anchor in the call to the online help for the wizard svn path=/trunk/kdepim/; revision=288286 --- antispamwizard.cpp | 33 +++++++++++++++++++++++++++------ antispamwizard.h | 3 +++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/antispamwizard.cpp b/antispamwizard.cpp index 40315d6d5..5e3e92f64 100644 --- a/antispamwizard.cpp +++ b/antispamwizard.cpp @@ -108,10 +108,11 @@ AntiSpamWizard::AntiSpamWizard( QWidget* parent, KMFolderTree * mainFolderTree, connect( this, SIGNAL( helpClicked( void) ), this, SLOT( slotHelpClicked( void ) ) ); + setNextEnabled( infoPage, false ); setNextEnabled( programsPage, false ); setNextEnabled( rulesPage, false ); - QTimer::singleShot( 1000, this, SLOT( checkToolAvailability( void ) ) ); + QTimer::singleShot( 500, this, SLOT( checkToolAvailability( void ) ) ); } @@ -385,10 +386,15 @@ void AntiSpamWizard::checkToolAvailability() QValueListIterator it = toolList.begin(); while ( it != toolList.end() ) { + QString text( i18n("Scanning for ") + (*it).getId() + " ..." ); + infoPage->setScanProgressText( text ); + KApplication::kApplication()->processEvents( 200 ); int rc = checkForProgram( (*it).getExecutable() ); programsPage->setProgramAsFound( (*it).getVisibleName(), !rc ); it++; } + infoPage->setScanProgressText( i18n("Scanning for anti spam tools finished.") ); + setNextEnabled( infoPage, true ); } @@ -405,10 +411,7 @@ int AntiSpamWizard::checkForProgram( QString executable ) void AntiSpamWizard::slotHelpClicked() { - KApplication::kApplication()->invokeHelp(); -// FIXME Here we need to specify the anchor and perhaps explicitly kmail -// as application if it is necessary when running in Kontact -// KApplication::kApplication()->invokeHelp( "using-kmail", "kmail" ); + KApplication::kApplication()->invokeHelp( "the-anti-spam-wizard", "kmail" ); } @@ -540,7 +543,7 @@ ASWizInfoPage::ASWizInfoPage( QWidget * parent, const char * name ) KDialog::spacingHint() ); grid->setColStretch( 1, 10 ); - QLabel *introText = new QLabel( this ); + introText = new QLabel( this ); introText->setText( i18n( "

Here you get some assistance in setting up KMail's filter " "rules to use some commonly known anti spam tools.

" @@ -551,6 +554,24 @@ ASWizInfoPage::ASWizInfoPage( QWidget * parent, const char * name ) "consideration but will append new rules in any case.

" ) ); grid->addWidget( introText, 0, 0 ); + + scanProgressText = new QLabel( this ); + scanProgressText->setText( "" ) ; + grid->addWidget( scanProgressText, 1, 0 ); +} + +void ASWizInfoPage::setScanProgressText( const QString &toolName ) +{ + scanProgressText->setText( toolName ); +/* FIXME + if ( toolName.isEmpty() ) + scanProgressText->setText( "" ); + else + { + QString text( i18n("Scanning for ") + toolName + " ..." ); + scanProgressText->setText( text ); + } +*/ } //--------------------------------------------------------------------------- diff --git a/antispamwizard.h b/antispamwizard.h index c39d928fe..97fe3d0d2 100644 --- a/antispamwizard.h +++ b/antispamwizard.h @@ -223,9 +223,12 @@ namespace KMail { { public: ASWizInfoPage( QWidget *parent, const char *name ); + + void setScanProgressText( const QString &toolName ); private: QLabel *introText; + QLabel *scanProgressText; }; //---------------------------------------------------------------------------