-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 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 1 |
6 files changed, 33 insertions, 12 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 | |||
@@ -41,24 +41,23 @@ $Id$ | |||
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | //US #include <kgenericfactory.h> | 42 | //US #include <kgenericfactory.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | #include <klocale.h> | 44 | #include <klocale.h> |
45 | #include <kstandarddirs.h> | 45 | #include <kstandarddirs.h> |
46 | #include <kurlrequester.h> | 46 | #include <kurlrequester.h> |
47 | #include <kmessagebox.h> | ||
47 | 48 | ||
48 | #include "addressbook.h" | 49 | #include "addressbook.h" |
49 | 50 | ||
50 | #include "formatfactory.h" | 51 | #include "formatfactory.h" |
51 | 52 | ||
52 | #include "resourcedirconfig.h" | 53 | #include "resourcedirconfig.h" |
53 | #include "stdaddressbook.h" | 54 | #include "stdaddressbook.h" |
54 | 55 | ||
55 | //US | 56 | //US |
56 | #include <qdir.h> | 57 | #include <qdir.h> |
57 | //US #include "../../formats/vcardformatplugin2.h" | ||
58 | //US #include "../../formats/binaryformat.h" | ||
59 | 58 | ||
60 | #include "resourcedir.h" | 59 | #include "resourcedir.h" |
61 | 60 | ||
62 | using namespace KABC; | 61 | using namespace KABC; |
63 | 62 | ||
64 | extern "C" | 63 | extern "C" |
@@ -342,14 +341,17 @@ QString ResourceDir::format() const | |||
342 | 341 | ||
343 | void ResourceDir::pathChanged() | 342 | void ResourceDir::pathChanged() |
344 | { | 343 | { |
345 | if ( !addressBook() ) | 344 | if ( !addressBook() ) |
346 | return; | 345 | return; |
347 | 346 | ||
348 | load(); | 347 | QString text( i18n( "Dir resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mPath ) ); |
349 | addressBook()->emitAddressBookChanged(); | 348 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { |
349 | load(); | ||
350 | addressBook()->emitAddressBookChanged(); | ||
351 | } | ||
350 | } | 352 | } |
351 | 353 | ||
352 | void ResourceDir::removeAddressee( const Addressee& addr ) | 354 | void ResourceDir::removeAddressee( const Addressee& addr ) |
353 | { | 355 | { |
354 | QFile::remove( mPath + "/" + addr.uid() ); | 356 | QFile::remove( mPath + "/" + addr.uid() ); |
355 | } | 357 | } |
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 | |||
@@ -39,12 +39,13 @@ $Id$ | |||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kmessagebox.h> | ||
45 | 46 | ||
46 | #include "formatfactory.h" | 47 | #include "formatfactory.h" |
47 | 48 | ||
48 | #include "resource.h" | 49 | #include "resource.h" |
49 | #include "resourcefileconfig.h" | 50 | #include "resourcefileconfig.h" |
50 | #include "stdaddressbook.h" | 51 | #include "stdaddressbook.h" |
@@ -369,14 +370,19 @@ QString ResourceFile::format() const | |||
369 | void ResourceFile::fileChanged() | 370 | void ResourceFile::fileChanged() |
370 | { | 371 | { |
371 | // There is a small theoretical chance that KDirWatch calls us before | 372 | // There is a small theoretical chance that KDirWatch calls us before |
372 | // we are fully constructed | 373 | // we are fully constructed |
373 | if (!addressBook()) | 374 | if (!addressBook()) |
374 | return; | 375 | return; |
375 | load(); | 376 | |
376 | addressBook()->emitAddressBookChanged(); | 377 | |
378 | QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); | ||
379 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | ||
380 | load(); | ||
381 | addressBook()->emitAddressBookChanged(); | ||
382 | } | ||
377 | } | 383 | } |
378 | 384 | ||
379 | void ResourceFile::removeAddressee( const Addressee &addr ) | 385 | void ResourceFile::removeAddressee( const Addressee &addr ) |
380 | { | 386 | { |
381 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); | 387 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); |
382 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); | 388 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + 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 | |||
@@ -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 | { |
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 | |||
@@ -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 | #include <qpe/pim/addressbookaccess.h> | 45 | #include <qpe/pim/addressbookaccess.h> |
45 | 46 | ||
46 | 47 | ||
47 | #include "resourceqtopiaconfig.h" | 48 | #include "resourceqtopiaconfig.h" |
48 | #include "stdaddressbook.h" | 49 | #include "stdaddressbook.h" |
@@ -332,14 +333,18 @@ QString ResourceQtopia::fileName() const | |||
332 | void ResourceQtopia::fileChanged() | 333 | void ResourceQtopia::fileChanged() |
333 | { | 334 | { |
334 | // There is a small theoretical chance that KDirWatch calls us before | 335 | // There is a small theoretical chance that KDirWatch calls us before |
335 | // we are fully constructed | 336 | // we are fully constructed |
336 | if (!addressBook()) | 337 | if (!addressBook()) |
337 | return; | 338 | return; |
338 | load(); | 339 | |
339 | addressBook()->emitAddressBookChanged(); | 340 | QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); |
341 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | ||
342 | load(); | ||
343 | addressBook()->emitAddressBookChanged(); | ||
344 | } | ||
340 | } | 345 | } |
341 | 346 | ||
342 | void ResourceQtopia::removeAddressee( const Addressee &addr ) | 347 | void ResourceQtopia::removeAddressee( const Addressee &addr ) |
343 | { | 348 | { |
344 | } | 349 | } |
345 | 350 | ||
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index 8f566cf..a42499f 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -131,14 +131,15 @@ void ViewContainer::slotStyleSelected( int index ) | |||
131 | 131 | ||
132 | mCurrentLook->restoreSettings( config ); | 132 | mCurrentLook->restoreSettings( config ); |
133 | mCurrentLook->setAddressee( addr ); | 133 | mCurrentLook->setAddressee( addr ); |
134 | } | 134 | } |
135 | void ViewContainer::refreshView() | 135 | void ViewContainer::refreshView() |
136 | { | 136 | { |
137 | if ( mCurrentLook ) | 137 | if ( mCurrentLook ) { |
138 | mCurrentLook->setAddressee( mCurrentAddressee ); | 138 | mCurrentLook->setAddressee( mCurrentAddressee ); |
139 | } | ||
139 | } | 140 | } |
140 | 141 | ||
141 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 142 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) |
142 | { | 143 | { |
143 | if ( mCurrentLook != 0 ) { | 144 | if ( mCurrentLook != 0 ) { |
144 | if ( addressee == mCurrentAddressee ) | 145 | if ( addressee == mCurrentAddressee ) |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2b07541..a7ca0ce 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1121,12 +1121,13 @@ void KABCore::addressBookChanged() | |||
1121 | KMessageBox::information( this, text ); | 1121 | KMessageBox::information( this, text ); |
1122 | } | 1122 | } |
1123 | QString currentuid = mEditorDialog->addressee().uid(); | 1123 | QString currentuid = mEditorDialog->addressee().uid(); |
1124 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1124 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1125 | } | 1125 | } |
1126 | mViewManager->refreshView(); | 1126 | mViewManager->refreshView(); |
1127 | // mDetails->refreshView(); | ||
1127 | 1128 | ||
1128 | 1129 | ||
1129 | } | 1130 | } |
1130 | 1131 | ||
1131 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1132 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1132 | const char *name ) | 1133 | const char *name ) |