summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -84,6 +84,7 @@ ResourceFile::ResourceFile( const KConfig *config )
84 if ( cfg ) { 84 if ( cfg ) {
85 fileName = cfg->readEntry( "FileName", default_fileName ); 85 fileName = cfg->readEntry( "FileName", default_fileName );
86 formatName = cfg->readEntry( "FileFormat", "vcard" ); 86 formatName = cfg->readEntry( "FileFormat", "vcard" );
87 mFamily = cfg->readEntry( "ResourceName", "std" );
87 } else { 88 } else {
88 fileName = default_fileName; 89 fileName = default_fileName;
89 formatName = "vcard"; 90 formatName = "vcard";
@@ -121,18 +122,23 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
121 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 122 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
122#endif 123#endif
123 124
124 125 QString localKdeDir;
125 QString localKdeDir;
126 localKdeDir = readEnvPath("LOCALMICROKDEHOME"); 126 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
127 if ( ! localKdeDir.isEmpty() ) { 127 if ( ! localKdeDir.isEmpty() ) {
128 qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() ); 128 qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() );
129 QFileInfo fi ( fileName ); 129 QFileInfo fi ( fileName );
130 QString localname = localKdeDir + "/apps/kabc/" + fi.fileName (); 130 QString localname = localKdeDir + "/apps/kabc/" + fi.fileName ();
131 QFileInfo fi2 ( localname ); 131 QFileInfo fi2 ( localname );
132 if ( ! fi2.exists() ) { 132 if ( ! fi2.exists() || mFamily == "sync_res" ) {
133 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/") ); 133 if ( fi.exists() && mFamily == "sync_res") {
134 setFileName( localname ); 134 qDebug("LOCAL mode SYNC mode using absolute file path ");
135 return; 135 setFileName( fileName );
136 return;
137 } else {
138 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/") );
139 setFileName( localname );
140 return;
141 }
136 142
137 } else { 143 } else {
138 qDebug("Local resource file found. Changing filename to: %s",localname.latin1() ); 144 qDebug("Local resource file found. Changing filename to: %s",localname.latin1() );
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
@@ -147,6 +147,7 @@ protected:
147 void unlock( const QString &fileName ); 147 void unlock( const QString &fileName );
148 148
149private: 149private:
150 QString mFamily;
150 QString mFileName2; 151 QString mFileName2;
151 QString mFormatName; 152 QString mFormatName;
152 153