summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/file/resourcefile.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/file/resourcefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index dc5932f..4ab7f02 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -56,5 +56,4 @@ $Id$
56 56
57 57
58
59using namespace KABC; 58using namespace KABC;
60 59
@@ -99,4 +98,7 @@ ResourceFile::ResourceFile( const QString &fileName ,
99{ 98{
100// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); 99// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
100
101
102
101 init( fileName, formatName ); 103 init( fileName, formatName );
102} 104}
@@ -119,4 +121,19 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
119 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 121 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
120#endif 122#endif
123
124
125 QString localKdeDir;
126 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
127 if ( ! localKdeDir.isEmpty() ) {
128 qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() );
129
130
131
132
133 }
134 qDebug("RESOURCE: %s ", fileName.latin1());
135
136
137
121 setFileName( fileName ); 138 setFileName( fileName );
122} 139}
@@ -134,5 +151,5 @@ void ResourceFile::writeConfig( KConfig *config )
134 Resource::writeConfig( config ); 151 Resource::writeConfig( config );
135 152
136 config->writeEntry( "FileName", mFileName ); 153 config->writeEntry( "FileName", fileName() );
137 config->writeEntry( "FileFormat", mFormatName ); 154 config->writeEntry( "FileFormat", mFormatName );
138 155
@@ -159,6 +176,6 @@ Ticket *ResourceFile::requestSaveTicket()
159bool ResourceFile::doOpen() 176bool ResourceFile::doOpen()
160{ 177{
161 QFile file( mFileName ); 178 QFile file( fileName() );
162 qDebug("ResourceFile::openfile %s ", mFileName.latin1()); 179 qDebug("ResourceFile::openfile %s ", fileName().latin1());
163 180
164 if ( !file.exists() ) { 181 if ( !file.exists() ) {
@@ -192,7 +209,7 @@ bool ResourceFile::load()
192{ 209{
193 210
194 QFile file( mFileName ); 211 QFile file( fileName() );
195 if ( !file.open( IO_ReadOnly ) ) { 212 if ( !file.open( IO_ReadOnly ) ) {
196 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); 213 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) );
197 return false; 214 return false;
198 } 215 }
@@ -230,5 +247,5 @@ bool ResourceFile::save( Ticket *ticket )
230#endif 247#endif
231 QFile info; 248 QFile info;
232 info.setName( mFileName ); 249 info.setName( fileName() );
233 bool ok = info.open( IO_WriteOnly ); 250 bool ok = info.open( IO_WriteOnly );
234 if ( ok ) { 251 if ( ok ) {
@@ -243,5 +260,5 @@ bool ResourceFile::save( Ticket *ticket )
243 260
244 if ( !ok ) 261 if ( !ok )
245 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); 262 addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) );
246#ifndef NO_DIRWATCH 263#ifndef NO_DIRWATCH
247 mDirWatch.startScan(); 264 mDirWatch.startScan();
@@ -335,5 +352,5 @@ void ResourceFile::setFileName( const QString &fileName )
335 mDirWatch.startScan(); 352 mDirWatch.startScan();
336#else 353#else
337 mFileName = fileName; 354 mFileName2 = fileName;
338#endif 355#endif
339 356
@@ -344,5 +361,5 @@ void ResourceFile::setFileName( const QString &fileName )
344QString ResourceFile::fileName() const 361QString ResourceFile::fileName() const
345{ 362{
346 return mFileName; 363 return mFileName2;
347} 364}
348 365
@@ -383,5 +400,5 @@ void ResourceFile::fileChanged()
383 400
384 401
385 QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); 402 QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) );
386 if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { 403 if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {
387 load(); 404 load();
@@ -399,5 +416,5 @@ void ResourceFile::removeAddressee( const Addressee &addr )
399void ResourceFile::cleanUp() 416void ResourceFile::cleanUp()
400{ 417{
401 unlock( mFileName ); 418 unlock( fileName() );
402} 419}
403 420