From f1f0f635294d0d837f41ae36b620575918a2f1ca Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Fri, 11 Dec 2009 13:14:45 +0000 Subject: [PATCH] Remove duplicate code svn path=/branches/work/akonadi-ports/kdepim/; revision=1061318 --- kmmainwidget.cpp | 9 +-------- kmmainwin.cpp | 9 ++------- util.cpp | 14 ++++++++++++++ util.h | 2 ++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 2c755ce48..a7ac47c59 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -4541,14 +4541,7 @@ void KMMainWidget::slotAntiVirusWizard() //----------------------------------------------------------------------------- void KMMainWidget::slotAccountWizard() { - QStringList lst; - lst.append( "--type" ); - lst.append( "\"message/rfc822\"" ); - - if( !QProcess::startDetached("accountwizard", lst ) ) - KMessageBox::error( this, i18n( "Could not start accountwizard " - "please check your installation." ), - i18n( "KMail Error" ) ); + KMail::Util::launchAccountWizard( this ); } //----------------------------------------------------------------------------- diff --git a/kmmainwin.cpp b/kmmainwin.cpp index 86ecb5f19..6c5db0f72 100644 --- a/kmmainwin.cpp +++ b/kmmainwin.cpp @@ -26,6 +26,7 @@ #include "progressdialog.h" #include "statusbarprogresswidget.h" #include "broadcaststatus.h" +#include "util.h" #include #include @@ -96,13 +97,7 @@ KMMainWin::KMMainWin(QWidget *) #endif if ( kmkernel->firstStart() ) { - QStringList lst; - lst.append( "--type" ); - lst.append( "\"message/rfc822\"" ); - if( !QProcess::startDetached("accountwizard", lst) ) - KMessageBox::error( this, i18n( "Could not start accountwizard " - "please check your installation." ), - i18n( "KMail Error" ) ); + KMail::Util::launchAccountWizard( this ); } if ( kmkernel->firstInstance() ) QTimer::singleShot( 200, this, SLOT( slotShowTipOnStart() ) ); diff --git a/util.cpp b/util.cpp index efcdeac26..c9ae5a2b0 100644 --- a/util.cpp +++ b/util.cpp @@ -316,3 +316,17 @@ OrgKdeAkonadiImapSettingsInterface *KMail::Util::createImapSettingsInterface( co return new OrgKdeAkonadiImapSettingsInterface("org.freedesktop.Akonadi.Resource." + ident, "/Settings", QDBusConnection::sessionBus() ); } + +void KMail::Util::launchAccountWizard( QWidget *w ) +{ + QStringList lst; + lst.append( "--type" ); + lst.append( "\"message/rfc822\"" ); + + if( !QProcess::startDetached("accountwizard", lst ) ) + KMessageBox::error( w, i18n( "Could not start accountwizard " + "please check your installation." ), + i18n( "KMail Error" ) ); + +} + diff --git a/util.h b/util.h index c27d81d1b..3ca80032b 100644 --- a/util.h +++ b/util.h @@ -130,6 +130,8 @@ namespace Util { KUrl findSieveUrlForAccount( OrgKdeAkonadiImapSettingsInterface *a, const QString &ident); OrgKdeAkonadiImapSettingsInterface *createImapSettingsInterface( const QString &ident ); + + void launchAccountWizard( QWidget * ); } }