author | ulf69 <ulf69> | 2004-07-15 05:06:06 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-15 05:06:06 (UTC) |
commit | 59f727076930aada485db6531d4084f2bfe0b928 (patch) (unidiff) | |
tree | d68ab61d9f78759d36d8ccb2cdd3312987bf7917 /kabc/plugins/opie/resourceopie.cpp | |
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.
Diffstat (limited to 'kabc/plugins/opie/resourceopie.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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 | |||
@@ -37,12 +37,13 @@ $Id$ | |||
37 | #include <kapplication.h> | 37 | #include <kapplication.h> |
38 | #include <kconfig.h> | 38 | #include <kconfig.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | //US #include <ksavefile.h> | 41 | //US #include <ksavefile.h> |
42 | #include <kstandarddirs.h> | 42 | #include <kstandarddirs.h> |
43 | #include <kmessagebox.h> | ||
43 | 44 | ||
44 | //US #include "formatfactory.h" | 45 | //US #include "formatfactory.h" |
45 | //US #include <qpe/qpeapplication.h> | 46 | //US #include <qpe/qpeapplication.h> |
46 | 47 | ||
47 | #include <opie/ocontactaccess.h> | 48 | #include <opie/ocontactaccess.h> |
48 | #include <opie/ocontactaccessbackend_xml.h> | 49 | #include <opie/ocontactaccessbackend_xml.h> |
@@ -89,15 +90,13 @@ ResourceOpie::ResourceOpie( const QString &fileName ) | |||
89 | void ResourceOpie::init( const QString &fileName ) | 90 | void ResourceOpie::init( const QString &fileName ) |
90 | { | 91 | { |
91 | 92 | ||
92 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 93 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
93 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 94 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
94 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 95 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
95 | 96 | ||
96 | //US opie addressbook is always readonly | ||
97 | //US setReadOnly( true ); | ||
98 | 97 | ||
99 | setFileName( fileName ); | 98 | setFileName( fileName ); |
100 | 99 | ||
101 | } | 100 | } |
102 | 101 | ||
103 | ResourceOpie::~ResourceOpie() | 102 | ResourceOpie::~ResourceOpie() |
@@ -368,12 +367,19 @@ QString ResourceOpie::fileName() const | |||
368 | void ResourceOpie::fileChanged() | 367 | void ResourceOpie::fileChanged() |
369 | { | 368 | { |
370 | // There is a small theoretical chance that KDirWatch calls us before | 369 | // There is a small theoretical chance that KDirWatch calls us before |
371 | // we are fully constructed | 370 | // we are fully constructed |
372 | if (!addressBook()) | 371 | if (!addressBook()) |
373 | return; | 372 | return; |
373 | |||
374 | QString text( i18n( "Opie resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); | ||
375 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | ||
376 | load(); | ||
377 | addressBook()->emitAddressBookChanged(); | ||
378 | } | ||
379 | |||
374 | load(); | 380 | load(); |
375 | addressBook()->emitAddressBookChanged(); | 381 | addressBook()->emitAddressBookChanged(); |
376 | } | 382 | } |
377 | 383 | ||
378 | void ResourceOpie::removeAddressee( const Addressee &addr ) | 384 | void ResourceOpie::removeAddressee( const Addressee &addr ) |
379 | { | 385 | { |