summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -35,36 +35,35 @@ $Id$
#include <qregexp.h>
#include <qtimer.h>
#include <qwidget.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
//US #include <kgenericfactory.h>
#include <kglobal.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
+#include <kmessagebox.h>
#include "addressbook.h"
#include "formatfactory.h"
#include "resourcedirconfig.h"
#include "stdaddressbook.h"
//US
#include <qdir.h>
-//US #include "../../formats/vcardformatplugin2.h"
-//US #include "../../formats/binaryformat.h"
#include "resourcedir.h"
using namespace KABC;
extern "C"
#ifdef _WIN32_
__declspec(dllexport)
#else
{
#endif
@@ -336,26 +335,29 @@ qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1());
}
QString ResourceDir::format() const
{
return mFormatName;
}
void ResourceDir::pathChanged()
{
if ( !addressBook() )
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();
+ }
}
void ResourceDir::removeAddressee( const Addressee& addr )
{
QFile::remove( mPath + "/" + addr.uid() );
}
void ResourceDir::cleanUp()
{
unlock( mPath );
}
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
@@ -33,24 +33,25 @@ $Id$
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
+#include <kmessagebox.h>
#include "formatfactory.h"
#include "resource.h"
#include "resourcefileconfig.h"
#include "stdaddressbook.h"
#include "resourcefile.h"
using namespace KABC;
extern "C"
@@ -363,26 +364,31 @@ void ResourceFile::setFormat( const QString &format )
QString ResourceFile::format() const
{
return mFormatName;
}
void ResourceFile::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
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();
+ }
}
void ResourceFile::removeAddressee( const Addressee &addr )
{
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) );
QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) );
}
void ResourceFile::cleanUp()
{
unlock( mFileName );
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
@@ -31,24 +31,25 @@ $Id$
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
+#include <kmessagebox.h>
//US #include "formatfactory.h"
//US #include <qpe/qpeapplication.h>
#include <opie/ocontactaccess.h>
#include <opie/ocontactaccessbackend_xml.h>
#include "resourceopieconfig.h"
#include "stdaddressbook.h"
#include "opieconverter.h"
@@ -83,27 +84,25 @@ ResourceOpie::ResourceOpie( const QString &fileName )
: Resource( 0 )
{
// qDebug("ResourceOpie::ResourceOpie : 3 %s", fileName.latin1());
init( fileName );
}
void ResourceOpie::init( const QString &fileName )
{
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
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 );
}
ResourceOpie::~ResourceOpie()
{
if (mConverter != 0)
delete mConverter;
}
void ResourceOpie::writeConfig( KConfig *config )
@@ -362,24 +361,31 @@ void ResourceOpie::setFileName( const QString &fileName )
QString ResourceOpie::fileName() const
{
return mFileName;
}
void ResourceOpie::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
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();
}
void ResourceOpie::removeAddressee( const Addressee &addr )
{
}
void ResourceOpie::cleanUp()
{
// qDebug("ResourceOpie::cleanup() %s", mFileName.latin1());
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
@@ -31,24 +31,25 @@ $Id$
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
//US #include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
+#include <kmessagebox.h>
#include <qpe/pim/addressbookaccess.h>
#include "resourceqtopiaconfig.h"
#include "stdaddressbook.h"
#include "qtopiaconverter.h"
#include "resourceqtopia.h"
using namespace KABC;
@@ -326,26 +327,30 @@ void ResourceQtopia::setFileName( const QString &fileName )
QString ResourceQtopia::fileName() const
{
return mFileName;
}
void ResourceQtopia::fileChanged()
{
// There is a small theoretical chance that KDirWatch calls us before
// we are fully constructed
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();
+ }
}
void ResourceQtopia::removeAddressee( const Addressee &addr )
{
}
void ResourceQtopia::cleanUp()
{
unlock( mFileName );
}
//US #include "resourceqtopia.moc"
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
@@ -125,26 +125,27 @@ void ViewContainer::slotStyleSelected( int index )
connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
SIGNAL( sendEmail( const QString& ) ) );
connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
SIGNAL( browse( const QString& ) ) );
}
mCurrentLook->restoreSettings( config );
mCurrentLook->setAddressee( addr );
}
void ViewContainer::refreshView()
{
- if ( mCurrentLook )
+ if ( mCurrentLook ) {
mCurrentLook->setAddressee( mCurrentAddressee );
+ }
}
void ViewContainer::setAddressee( const KABC::Addressee& addressee )
{
if ( mCurrentLook != 0 ) {
if ( addressee == mCurrentAddressee )
return;
else {
mCurrentAddressee = addressee;
mCurrentLook->setAddressee( mCurrentAddressee );
}
}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2b07541..a7ca0ce 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1115,24 +1115,25 @@ void KABCore::addressBookChanged()
if (mEditorDialog)
{
if (mEditorDialog->dirty())
{
QString text = i18n( "Data has been changed externally. Unsaved "
"changes will be lost." );
KMessageBox::information( this, text );
}
QString currentuid = mEditorDialog->addressee().uid();
mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
}
mViewManager->refreshView();
+// mDetails->refreshView();
}
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
if ( mEditorDialog == 0 ) {
mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );