From 59f727076930aada485db6531d4084f2bfe0b928 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Thu, 15 Jul 2004 05:06:06 +0000 Subject: ask for readwrite resources if the user wants them to reload in the case of an external change. --- (limited to 'kabc') diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 7825c6f..52863d5 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -44,6 +44,7 @@ $Id$ #include #include #include +#include #include "addressbook.h" @@ -54,8 +55,6 @@ $Id$ //US #include -//US #include "../../formats/vcardformatplugin2.h" -//US #include "../../formats/binaryformat.h" #include "resourcedir.h" @@ -345,8 +344,11 @@ void ResourceDir::pathChanged() if ( !addressBook() ) return; - load(); - addressBook()->emitAddressBookChanged(); + QString text( i18n( "Dir resource '%1'
has been changed by third party.
Do you want to reload?").arg( mPath ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { + load(); + addressBook()->emitAddressBookChanged(); + } } void ResourceDir::removeAddressee( const Addressee& addr ) diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 9f9b00f..1d3acec 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -42,6 +42,7 @@ $Id$ #include //US #include #include +#include #include "formatfactory.h" @@ -372,8 +373,13 @@ void ResourceFile::fileChanged() // we are fully constructed if (!addressBook()) return; - load(); - addressBook()->emitAddressBookChanged(); + + + QString text( i18n( "File resource '%1'
has been changed by third party.
Do you want to reload?").arg( mFileName ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { + load(); + addressBook()->emitAddressBookChanged(); + } } void ResourceFile::removeAddressee( const Addressee &addr ) diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index 1436508..aaee801 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -40,6 +40,7 @@ $Id$ #include //US #include #include +#include //US #include "formatfactory.h" //US #include @@ -92,9 +93,7 @@ void ResourceOpie::init( const QString &fileName ) connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); - - //US opie addressbook is always readonly -//US setReadOnly( true ); + setFileName( fileName ); @@ -371,6 +370,13 @@ void ResourceOpie::fileChanged() // we are fully constructed if (!addressBook()) return; + + QString text( i18n( "Opie resource '%1'
has been changed by third party.
Do you want to reload?").arg( mFileName ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { + load(); + addressBook()->emitAddressBookChanged(); + } + load(); addressBook()->emitAddressBookChanged(); } diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 4854197..7475685 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -40,6 +40,7 @@ $Id$ #include //US #include #include +#include #include @@ -335,8 +336,12 @@ void ResourceQtopia::fileChanged() // we are fully constructed if (!addressBook()) return; - load(); - addressBook()->emitAddressBookChanged(); + + QString text( i18n( "Qtopia resource '%1'
has been changed by third party.
Do you want to reload?").arg( mFileName ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { + load(); + addressBook()->emitAddressBookChanged(); + } } void ResourceQtopia::removeAddressee( const Addressee &addr ) -- cgit v0.9.0.2