-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 22 |
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 | |||
@@ -117,34 +117,40 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) | |||
117 | 117 | ||
118 | #ifndef NO_DIRWATCH | 118 | #ifndef NO_DIRWATCH |
119 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 119 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
120 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 120 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
121 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 121 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
122 | #endif | 122 | #endif |
123 | 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 | 129 | QFileInfo fi ( fileName ); | |
130 | 130 | QString localname = localKdeDir + "/apps/kabc/" + fi.fileName (); | |
131 | 131 | QFileInfo fi2 ( localname ); | |
132 | if ( ! fi2.exists() ) { | ||
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/") ); | ||
134 | setFileName( localname ); | ||
135 | return; | ||
136 | |||
137 | } else { | ||
138 | qDebug("Local resource file found. Changing filename to: %s",localname.latin1() ); | ||
139 | setFileName( localname ); | ||
140 | return; | ||
141 | } | ||
132 | 142 | ||
133 | } | 143 | } |
134 | qDebug("RESOURCE: %s ", fileName.latin1()); | 144 | setFileName( fileName ); |
135 | |||
136 | |||
137 | |||
138 | setFileName( fileName ); | ||
139 | } | 145 | } |
140 | 146 | ||
141 | ResourceFile::~ResourceFile() | 147 | ResourceFile::~ResourceFile() |
142 | { | 148 | { |
143 | delete mFormat; | 149 | delete mFormat; |
144 | mFormat = 0; | 150 | mFormat = 0; |
145 | } | 151 | } |
146 | 152 | ||
147 | void ResourceFile::writeConfig( KConfig *config ) | 153 | void ResourceFile::writeConfig( KConfig *config ) |
148 | { | 154 | { |
149 | 155 | ||
150 | config->setGroup( "Resource_" + identifier() ); | 156 | config->setGroup( "Resource_" + identifier() ); |