From kde-commits Fri Aug 31 22:05:22 2012 From: Montel Laurent Date: Fri, 31 Aug 2012 22:05:22 +0000 To: kde-commits Subject: [kdepim] /: Start importwizard if we find an other mailer at the first start Message-Id: <20120831220522.1D197A6094 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=134645073227589 Git commit a4a52b348f113198b8b5d13e13e94664c8dc10cf by Montel Laurent. Committed on 01/09/2012 at 00:04. Pushed by mlaurent into branch 'master'. Start importwizard if we find an other mailer at the first start M +14 -1 kmail/kmmainwidget.cpp M +29 -0 mailcommon/mailutil.cpp M +2 -0 mailcommon/mailutil.h M +1 -1 mailimporter/filterbalsa.h http://commits.kde.org/kdepim/a4a52b348f113198b8b5d13e13e94664c8dc10cf diff --git a/kmail/kmmainwidget.cpp b/kmail/kmmainwidget.cpp index 07d8eaf..f3aeb9d 100644 --- a/kmail/kmmainwidget.cpp +++ b/kmail/kmmainwidget.cpp @@ -312,7 +312,20 @@ K_GLOBAL_STATIC( KMMainWidget::PtrList, theMainWidgetL= ist ) restoreCollectionFolderViewConfig(); = if ( kmkernel->firstStart() ) { - KMail::Util::launchAccountWizard( this ); + if(MailCommon::Util::foundMailer()) { + if(KMessageBox::questionYesNo(this,i18n("An other mailer was found o= n system. Do you want to import data from it?")) =3D=3D KMessageBox::Yes) { + const QString path =3D KStandardDirs::findExe( QLatin1String("impo= rtwizard" ) ); + if( !QProcess::startDetached( path ) ) { + KMessageBox::error( this, i18n( "Could not start the import wiza= rd. " + "Please check your installation." ), + i18n( "Unable to start import wizard" ) ); + } + } else { + KMail::Util::launchAccountWizard( this ); + } + } else { + KMail::Util::launchAccountWizard( this ); + } } // must be the last line of the constructor: mStartupDone =3D true; diff --git a/mailcommon/mailutil.cpp b/mailcommon/mailutil.cpp index b724de6..e49f7ec 100644 --- a/mailcommon/mailutil.cpp +++ b/mailcommon/mailutil.cpp @@ -47,6 +47,15 @@ #include "mailkernel.h" #include "filter/filteractionmissingargumentdialog.h" = +#include "mailimporter/filterbalsa.h" +#include "mailimporter/filter_evolution.h" +#include "mailimporter/filter_evolution_v2.h" +#include "mailimporter/filter_evolution_v3.h" +#include "mailimporter/filter_clawsmail.h" +#include "mailimporter/filter_sylpheed.h" +#include "mailimporter/filter_thunderbird.h" +#include "mailimporter/filter_opera.h" + #include #include = @@ -627,3 +636,23 @@ QString MailCommon::Util::convertFolderPathToCollectio= nStr( const QString& folde return QString::number(newFolderId); } = +bool MailCommon::Util::foundMailer() +{ + QStringList lst; + lst << MailImporter::FilterEvolution::defaultSettingsPath(); + lst << MailImporter::FilterEvolution_v2::defaultSettingsPath(); + lst << MailImporter::FilterEvolution_v3::defaultSettingsPath(); + lst << MailImporter::FilterBalsa::defaultSettingsPath(); + lst << MailImporter::FilterClawsMail::defaultSettingsPath(); + lst << MailImporter::FilterOpera::defaultSettingsPath(); + lst << MailImporter::FilterSylpheed::defaultSettingsPath(); + lst << MailImporter::FilterThunderbird::defaultSettingsPath(); + + Q_FOREACH(const QString& path, lst) { + QDir directory( path ); + if ( directory.exists() ) { + return true; + } + } + return false; +} diff --git a/mailcommon/mailutil.h b/mailcommon/mailutil.h index 3e06421..22ddab7 100644 --- a/mailcommon/mailutil.h +++ b/mailcommon/mailutil.h @@ -129,6 +129,8 @@ namespace Util { = MAILCOMMON_EXPORT Akonadi::Collection::Id convertFolderPathToCollectionI= d( const QString& folder); MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr( const QStrin= g& folder); + + MAILCOMMON_EXPORT bool foundMailer(); } = } diff --git a/mailimporter/filterbalsa.h b/mailimporter/filterbalsa.h index cd252e1..8ed34eb 100644 --- a/mailimporter/filterbalsa.h +++ b/mailimporter/filterbalsa.h @@ -30,7 +30,7 @@ public: void import(); void importMails( const QString& maildir ); static QString defaultSettingsPath(); - + QString localMailDirPath(); private: void importDirContents(const QString&); void importFiles(const QString&);