summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
authorzautrix <zautrix>2005-03-30 13:24:56 (UTC)
committer zautrix <zautrix>2005-03-30 13:24:56 (UTC)
commit056f171723a9301aea5a65340dffeda34e078abf (patch) (side-by-side diff)
tree7930525c801dd9c5d9a910b71bca7dc79e10f666 /kabc/plugins
parentb5222dd7a607f78235b1ea39fea0f95a9c08ccd3 (diff)
downloadkdepimpi-056f171723a9301aea5a65340dffeda34e078abf.zip
kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.gz
kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.bz2
fixes
Diffstat (limited to 'kabc/plugins') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 4ab7f02..0e6c2a3 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -113,42 +113,48 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
#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;
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;
+
+ } else {
+ qDebug("Local resource file found. Changing filename to: %s",localname.latin1() );
+ setFileName( localname );
+ return;
+ }
}
- qDebug("RESOURCE: %s ", fileName.latin1());
-
-
-
- setFileName( fileName );
+ setFileName( fileName );
}
ResourceFile::~ResourceFile()
{
delete mFormat;
mFormat = 0;
}
void ResourceFile::writeConfig( KConfig *config )
{
config->setGroup( "Resource_" + identifier() );
Resource::writeConfig( config );
config->writeEntry( "FileName", fileName() );
config->writeEntry( "FileFormat", mFormatName );