[Kde-pim] kabc file resources plugin - backup
Tom Albers
tomalbers at kde.nl
Tue Feb 6 11:21:06 GMT 2007
At Tuesday 06 February 2007 11:38, you wrote:
> Hi,
>
> i have a question about the backup function in the file resource plugin of
> kabc. In the file resource plugin the ResourceFile::doOpen() function is able
> to restore backups. When is it intended to restore those backups? At the
> moment the ResourceFile::doOpen() function checks if the file is empty and
> restore all backups if there are any backups avaliable.
>
> If you try to delete _all_ entries of your addressbook they got restored
> immediately. So you have to keep at least one entry in the addressbook to
> get rid of most entries, or empty the file and remove all entries by hand.
>
> Is this intendend?
> See small and ugly patch to avoid restoring the backup.
>
> best regards,
> Daniel
>
> --- kabc/plugins/file/resourcefile.cpp.orig 2007-02-03 12:06:00.000000000 +0100
> +++ kabc/plugins/file/resourcefile.cpp 2007-02-03 13:01:13.000000000 +0100
> @@ -161,10 +164,10 @@ bool ResourceFile::doOpen()
> if ( !file.open( IO_ReadWrite ) )
> return false;
> }
> -
> if ( file.size() == 0 ) {
> file.close();
> - kdDebug() << "File size is zero. Evaluating backups" << endl;
> + kdDebug() << "File size is zero." << endl;
> + /*
> for (int i=0; i!=20; i++)
> {
> QFile backup( mFileName + "__" + QString::number(i) );
> @@ -193,6 +196,7 @@ bool ResourceFile::doOpen()
> return true;
> }
> }
> + */
> return true;
> }
The story is that sometimes the addressbook was deleted completely, that's why I wrote the auto-restore feature when that is detected. I've never considered someone deleting all addressess from the addressbook ;-)
Toma
--
http://www.mailody.net
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
More information about the kde-pim
mailing list