summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-15 05:06:06 (UTC)
committer ulf69 <ulf69>2004-07-15 05:06:06 (UTC)
commit59f727076930aada485db6531d4084f2bfe0b928 (patch) (unidiff)
treed68ab61d9f78759d36d8ccb2cdd3312987bf7917
parent2ada2bfd67b5488115268e6667e55a9b4b297fa2 (diff)
downloadkdepimpi-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 (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/dir/resourcedir.cpp10
-rw-r--r--kabc/plugins/file/resourcefile.cpp10
-rw-r--r--kabc/plugins/opie/resourceopie.cpp12
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp9
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/kabcore.cpp1
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
@@ -44,6 +44,7 @@ $Id$
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
@@ -54,8 +55,6 @@ $Id$
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
@@ -345,8 +344,11 @@ void ResourceDir::pathChanged()
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
352void ResourceDir::removeAddressee( const Addressee& addr ) 354void 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$
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
@@ -372,8 +373,13 @@ void ResourceFile::fileChanged()
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
379void ResourceFile::removeAddressee( const Addressee &addr ) 385void 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$
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>
@@ -92,9 +93,7 @@ void ResourceOpie::init( const QString &fileName )
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
@@ -371,6 +370,13 @@ void ResourceOpie::fileChanged()
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}
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$
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
@@ -335,8 +336,12 @@ void ResourceQtopia::fileChanged()
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
342void ResourceQtopia::removeAddressee( const Addressee &addr ) 347void ResourceQtopia::removeAddressee( const Addressee &addr )
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
@@ -134,8 +134,9 @@ void ViewContainer::slotStyleSelected( int index )
134} 134}
135void ViewContainer::refreshView() 135void ViewContainer::refreshView()
136{ 136{
137 if ( mCurrentLook ) 137 if ( mCurrentLook ) {
138 mCurrentLook->setAddressee( mCurrentAddressee ); 138 mCurrentLook->setAddressee( mCurrentAddressee );
139 }
139} 140}
140 141
141void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 142void ViewContainer::setAddressee( const KABC::Addressee& addressee )
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2b07541..a7ca0ce 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1124,6 +1124,7 @@ void KABCore::addressBookChanged()
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}