summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/opie/resourceopie.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/opie/resourceopie.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.cpp12
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 )
89void ResourceOpie::init( const QString &fileName ) 90void 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
103ResourceOpie::~ResourceOpie() 102ResourceOpie::~ResourceOpie()
@@ -368,12 +367,19 @@ QString ResourceOpie::fileName() const
368void ResourceOpie::fileChanged() 367void 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
378void ResourceOpie::removeAddressee( const Addressee &addr ) 384void ResourceOpie::removeAddressee( const Addressee &addr )
379{ 385{