author | ulf69 <ulf69> | 2004-07-15 05:06:06 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-15 05:06:06 (UTC) |
commit | 59f727076930aada485db6531d4084f2bfe0b928 (patch) (side-by-side diff) | |
tree | d68ab61d9f78759d36d8ccb2cdd3312987bf7917 /kabc | |
parent | 2ada2bfd67b5488115268e6667e55a9b4b297fa2 (diff) | |
download | kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.zip kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.gz kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.bz2 |
ask for readwrite resources if the user wants them to reload in the case of an
external change.
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 10 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 10 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 12 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 9 |
4 files changed, 30 insertions, 11 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 @@ -45,4 +45,5 @@ $Id$ #include <kstandarddirs.h> #include <kurlrequester.h> +#include <kmessagebox.h> #include "addressbook.h" @@ -55,6 +56,4 @@ $Id$ //US #include <qdir.h> -//US #include "../../formats/vcardformatplugin2.h" -//US #include "../../formats/binaryformat.h" #include "resourcedir.h" @@ -346,6 +345,9 @@ void ResourceDir::pathChanged() return; - load(); - addressBook()->emitAddressBookChanged(); + 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(); + } } 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 @@ -43,4 +43,5 @@ $Id$ //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> #include "formatfactory.h" @@ -373,6 +374,11 @@ void ResourceFile::fileChanged() if (!addressBook()) return; - load(); - addressBook()->emitAddressBookChanged(); + + + 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(); + } } 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 @@ -41,4 +41,5 @@ $Id$ //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> //US #include "formatfactory.h" @@ -93,7 +94,5 @@ void ResourceOpie::init( const QString &fileName ) 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 ); @@ -372,4 +371,11 @@ void ResourceOpie::fileChanged() 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 @@ -41,4 +41,5 @@ $Id$ //US #include <ksavefile.h> #include <kstandarddirs.h> +#include <kmessagebox.h> #include <qpe/pim/addressbookaccess.h> @@ -336,6 +337,10 @@ void ResourceQtopia::fileChanged() if (!addressBook()) return; - load(); - addressBook()->emitAddressBookChanged(); + + 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(); + } } |