From 7c56fe6b9e6ab474fff6149aa74e865f8cf95e2a Mon Sep 17 00:00:00 2001 From: Till Adam Date: Sun, 25 May 2008 20:50:09 +0000 Subject: [PATCH] Make sure to reset the db id (in the sqlite index) otherwise it will be reused in the target folder, on move, and overwrite the entry for any existing entry at that row, thereby bringing the index out of sync with reality. svn path=/trunk/KDE/kdepim/; revision=812625 --- kmfoldermaildir.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kmfoldermaildir.cpp b/kmfoldermaildir.cpp index 275b7aa94..accf86f7b 100644 --- a/kmfoldermaildir.cpp +++ b/kmfoldermaildir.cpp @@ -403,11 +403,10 @@ if( fileD0.open( QIODevice::WriteOnly ) ) { fileD0.close(); // If data is 0 we just create a zero length file. } */ - KMFolder* msgParent; int idx(-1); // take message out of the folder it is currently in, if any - msgParent = aMsg->parent(); + KMFolder* msgParent = aMsg->parent(); if (msgParent) { if (msgParent==folder() && !kmkernel->folderIsDraftOrOutbox(folder())) @@ -514,6 +513,9 @@ if( fileD0.open( QIODevice::WriteOnly ) ) { if (mAutoCreateIndex) { #ifdef KMAIL_SQLITE_INDEX + // reset the db id, in case we have one, we are about to change folders + // and can't reuse it there + aMsg->setDbId( 0 ); #else assert(mIndexStream != 0); clearerr(mIndexStream);