[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/akonadi-ports/kdepim/kmail
From: Volker Krause <vkrause () kde ! org>
Date: 2010-01-15 15:19:03
Message-ID: 1263568743.147127.19103.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1075120 by vkrause:
Run the migrator if needed.
M +32 -0 kmkernel.cpp
--- branches/work/akonadi-ports/kdepim/kmail/kmkernel.cpp #1075119:1075120
@@ -60,6 +60,7 @@
#include <kdebug.h>
#include <kio/jobuidelegate.h>
#include <kio/netaccess.h>
+#include <kprocess.h>
#include <kmime/kmime_message.h>
#include <kmime/kmime_util.h>
@@ -109,6 +110,37 @@
mIdentityManager(0), mConfigureDialog(0), mMailService(0),
mContextMenuShown( false )
{
+ // Akonadi migration
+ KConfig config( "kmail-migratorrc" );
+ KConfigGroup migrationCfg( &config, "Migration" );
+ const bool enabled = migrationCfg.readEntry( "Enabled", false );
+ const int currentVersion = migrationCfg.readEntry( "Version", 0 );
+ const int targetVersion = migrationCfg.readEntry( "TargetVersion", 1 );
+ if ( enabled && currentVersion < targetVersion ) {
+ kDebug() << "Performing Akonadi migration. Good luck!";
+ KProcess proc;
+ QStringList args = QStringList() << "--interactive-on-change";
+ proc.setProgram( "kmail-migrator", args );
+ proc.start();
+ bool result = proc.waitForStarted();
+ if ( result ) {
+ result = proc.waitForFinished();
+ }
+ if ( result && proc.exitCode() == 0 ) {
+ kDebug() << "Akonadi migration has been successful";
+ migrationCfg.writeEntry( "Version", targetVersion );
+ migrationCfg.sync();
+ } else {
+ // exit code 1 means it is already running, so we are probably called by a migrator instance
+ kError() << "Akonadi migration failed!";
+ kError() << "command was: " << proc.program();
+ kError() << "exit code: " << proc.exitCode();
+ kError() << "stdout: " << proc.readAllStandardOutput();
+ kError() << "stderr: " << proc.readAllStandardError();
+ exit( 42 );
+ }
+ }
+
#ifdef __GNUC__
#warning Remove before the 4.5 release
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic