summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp18
-rw-r--r--kabc/plugins/file/resourcefile.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 0e6c2a3..af76558 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -81,12 +81,13 @@ ResourceFile::ResourceFile( const KConfig *config )
default_fileName = StdAddressBook::fileName();
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
fileName = cfg->readEntry( "FileName", default_fileName );
formatName = cfg->readEntry( "FileFormat", "vcard" );
+ mFamily = cfg->readEntry( "ResourceName", "std" );
} else {
fileName = default_fileName;
formatName = "vcard";
}
init( fileName, formatName );
@@ -118,24 +119,29 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
#ifndef NO_DIRWATCH
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
#endif
-
- QString localKdeDir;
+ QString localKdeDir;
localKdeDir = readEnvPath("LOCALMICROKDEHOME");
if ( ! localKdeDir.isEmpty() ) {
qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() );
QFileInfo fi ( fileName );
QString localname = localKdeDir + "/apps/kabc/" + fi.fileName ();
QFileInfo fi2 ( localname );
- if ( ! fi2.exists() ) {
- KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") );
- setFileName( localname );
- return;
+ if ( ! fi2.exists() || mFamily == "sync_res" ) {
+ if ( fi.exists() && mFamily == "sync_res") {
+ qDebug("LOCAL mode SYNC mode using absolute file path ");
+ setFileName( fileName );
+ return;
+ } else {
+ KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") );
+ setFileName( localname );
+ return;
+ }
} else {
qDebug("Local resource file found. Changing filename to: %s",localname.latin1() );
setFileName( localname );
return;
}
diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h
index dd38a9d..3e9edfc 100644
--- a/kabc/plugins/file/resourcefile.h
+++ b/kabc/plugins/file/resourcefile.h
@@ -144,12 +144,13 @@ protected:
void init( const QString &fileName, const QString &format );
bool lock( const QString &fileName );
void unlock( const QString &fileName );
private:
+ QString mFamily;
QString mFileName2;
QString mFormatName;
FormatPlugin *mFormat;
QString mLockUniqueName;