-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 6 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 6 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 10 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 5 |
4 files changed, 23 insertions, 4 deletions
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 @@ -43,8 +43,9 @@ $Id$ #include <kglobal.h> #include <klocale.h> #include <kstandarddirs.h> #include <kurlrequester.h> +#include <kmessagebox.h> #include "addressbook.h" #include "formatfactory.h" @@ -53,10 +54,8 @@ $Id$ #include "stdaddressbook.h" //US #include <qdir.h> -//US #include "../../formats/vcardformatplugin2.h" -//US #include "../../formats/binaryformat.h" #include "resourcedir.h" using namespace KABC; @@ -344,11 +343,14 @@ void ResourceDir::pathChanged() { if ( !addressBook() ) return; + QString text( i18n( "Dir resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mPath ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { load(); addressBook()->emitAddressBookChanged(); } +} void ResourceDir::removeAddressee( const Addressee& addr ) { QFile::remove( mPath + "/" + addr.uid() ); 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 @@ -41,8 +41,9 @@ $Id$ #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> #include "formatfactory.h" #include "resource.h" @@ -371,11 +372,16 @@ void ResourceFile::fileChanged() // There is a small theoretical chance that KDirWatch calls us before // we are fully constructed if (!addressBook()) return; + + + QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { load(); addressBook()->emitAddressBookChanged(); } +} void ResourceFile::removeAddressee( const Addressee &addr ) { QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); 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 @@ -39,8 +39,9 @@ $Id$ #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> //US #include "formatfactory.h" //US #include <qpe/qpeapplication.h> @@ -92,10 +93,8 @@ 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 ); } @@ -370,8 +369,15 @@ void ResourceOpie::fileChanged() // There is a small theoretical chance that KDirWatch calls us before // we are fully constructed if (!addressBook()) return; + + QString text( i18n( "Opie resource '%1'<br> has been changed by third party.<br>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 @@ -39,8 +39,9 @@ $Id$ #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> #include <qpe/pim/addressbookaccess.h> @@ -334,11 +335,15 @@ void ResourceQtopia::fileChanged() // There is a small theoretical chance that KDirWatch calls us before // we are fully constructed if (!addressBook()) return; + + QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); + if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { load(); addressBook()->emitAddressBookChanged(); } +} void ResourceQtopia::removeAddressee( const Addressee &addr ) { } |