[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim] /: Start importwizard if we find an other mailer at the first start
From: Montel Laurent <montel () kde ! org>
Date: 2012-08-31 22:05:22
Message-ID: 20120831220522.1D197A6094 () git ! kde ! org
[Download RAW message or body]
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, theMainWidgetList )
restoreCollectionFolderViewConfig();
if ( kmkernel->firstStart() ) {
- KMail::Util::launchAccountWizard( this );
+ if(MailCommon::Util::foundMailer()) {
+ if(KMessageBox::questionYesNo(this,i18n("An other mailer was found on system. \
Do you want to import data from it?")) == KMessageBox::Yes) { + const QString \
path = KStandardDirs::findExe( QLatin1String("importwizard" ) ); + if( \
!QProcess::startDetached( path ) ) { + KMessageBox::error( this, i18n( \
"Could not start the import wizard. " + "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 = 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 <incidenceeditor-ng/globalsettings.h>
#include <incidenceeditor-ng/incidencedialogfactory.h>
@@ -627,3 +636,23 @@ QString MailCommon::Util::convertFolderPathToCollectionStr( \
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 convertFolderPathToCollectionId( const \
QString& folder); MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr( const \
QString& 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&);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic