summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/plugins/file/resourcefile.cpp8
-rw-r--r--kabc/stdaddressbook.cpp2
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--microkde/kresources/factory.cpp10
-rw-r--r--microkde/kresources/resource.cpp3
6 files changed, 14 insertions, 13 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 97bd3ef..0838157 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -246,17 +246,17 @@ AddressBook::~AddressBook()
246 delete d->mConfig; d->mConfig = 0; 246 delete d->mConfig; d->mConfig = 0;
247 delete d->mManager; d->mManager = 0; 247 delete d->mManager; d->mManager = 0;
248//US delete d->mErrorHandler; d->mErrorHandler = 0; 248//US delete d->mErrorHandler; d->mErrorHandler = 0;
249 delete d; d = 0; 249 delete d; d = 0;
250} 250}
251 251
252bool AddressBook::load() 252bool AddressBook::load()
253{ 253{
254 kdDebug(5700) << "AddressBook::load()" << endl; 254
255 255
256 clear(); 256 clear();
257 257
258 KRES::Manager<Resource>::ActiveIterator it; 258 KRES::Manager<Resource>::ActiveIterator it;
259 bool ok = true; 259 bool ok = true;
260 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) 260 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
261 if ( !(*it)->load() ) { 261 if ( !(*it)->load() ) {
262 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); 262 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 80af841..3920f69 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -189,33 +189,33 @@ bool ResourceFile::doOpen()
189} 189}
190 190
191void ResourceFile::doClose() 191void ResourceFile::doClose()
192{ 192{
193} 193}
194 194
195bool ResourceFile::load() 195bool ResourceFile::load()
196{ 196{
197 kdDebug(5700) << "ResourceFile::load(): '" << mFileName << "'" << endl; 197
198 198
199 QFile file( mFileName ); 199 QFile file( mFileName );
200 if ( !file.open( IO_ReadOnly ) ) { 200 if ( !file.open( IO_ReadOnly ) ) {
201 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); 201 addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) );
202 return false; 202 return false;
203 } 203 }
204 204
205// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); 205// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
206 206
207 return mFormat->loadAll( addressBook(), this, &file ); 207 return mFormat->loadAll( addressBook(), this, &file );
208} 208}
209 209
210bool ResourceFile::save( Ticket *ticket ) 210bool ResourceFile::save( Ticket *ticket )
211{ 211{
212// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); 212// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
213 kdDebug(5700) << "ResourceFile::save()" << endl; 213
214 214
215 // create backup file 215 // create backup file
216 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); 216 QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
217 217
218/*US we use a simpler method to create a backupfile 218/*US we use a simpler method to create a backupfile
219 219
220 (void) KSaveFile::backupFile( mFileName, QString::null 220 (void) KSaveFile::backupFile( mFileName, QString::null
221 ,extension ); 221 ,extension );
@@ -252,28 +252,28 @@ bool ResourceFile::save( Ticket *ticket )
252 return ok; 252 return ok;
253 253
254 qDebug("ResourceFile::save has to be changed"); 254 qDebug("ResourceFile::save has to be changed");
255 return true; 255 return true;
256} 256}
257 257
258bool ResourceFile::lock( const QString &fileName ) 258bool ResourceFile::lock( const QString &fileName )
259{ 259{
260 kdDebug(5700) << "ResourceFile::lock()" << endl; 260
261 261
262 QString fn = fileName; 262 QString fn = fileName;
263 263
264//US change the implementation how the lockfilename is getting created 264//US change the implementation how the lockfilename is getting created
265//US fn.replace( QRegExp("/"), "_" ); 265//US fn.replace( QRegExp("/"), "_" );
266//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 266//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
267 267
268 KURL url(fn); 268 KURL url(fn);
269 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 269 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
270 270
271 kdDebug(5700) << "-- lock name: " << lockName << endl; 271
272 272
273 if (QFile::exists( lockName )) return false; 273 if (QFile::exists( lockName )) return false;
274 274
275 QString lockUniqueName; 275 QString lockUniqueName;
276 lockUniqueName = fn + KApplication::randomString( 8 ); 276 lockUniqueName = fn + KApplication::randomString( 8 );
277 277
278 url = lockUniqueName; 278 url = lockUniqueName;
279//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); 279//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 075f12f..1e00cc6 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -147,17 +147,17 @@ void StdAddressBook::init( bool )
147 Resource *res = standardResource(); 147 Resource *res = standardResource();
148 if ( !res ) { 148 if ( !res ) {
149 res = manager->createResource( "file" ); 149 res = manager->createResource( "file" );
150 if ( res ) 150 if ( res )
151 { 151 {
152 addResource( res ); 152 addResource( res );
153 } 153 }
154 else 154 else
155 kdDebug(5700) << "No resource available!!!" << endl; 155 qDebug(" No resource available!!!");
156 } 156 }
157 157
158 setStandardResource( res ); 158 setStandardResource( res );
159 manager->writeConfig(); 159 manager->writeConfig();
160 160
161 load(); 161 load();
162} 162}
163 163
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3ae23e8..a0fec91 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -126,17 +126,17 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
126#ifdef KAB_EMBEDDED 126#ifdef KAB_EMBEDDED
127 //US we define here our own global actioncollection. 127 //US we define here our own global actioncollection.
128 //mActionCollection = new KActionCollection(this); 128 //mActionCollection = new KActionCollection(this);
129#endif //KAB_EMBEDDED 129#endif //KAB_EMBEDDED
130 mExtensionBarSplitter = 0; 130 mExtensionBarSplitter = 0;
131 mIsPart = !parent->inherits( "KAddressBookMain" ); 131 mIsPart = !parent->inherits( "KAddressBookMain" );
132 132
133 mAddressBook = KABC::StdAddressBook::self(); 133 mAddressBook = KABC::StdAddressBook::self();
134 KABC::StdAddressBook::setAutomaticSave( true ); 134 KABC::StdAddressBook::setAutomaticSave( false );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 137 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 140 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
141 SLOT( addressBookChanged() ) ); 141 SLOT( addressBookChanged() ) );
142 142
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index 56b0ef3..827ec38 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -35,17 +35,17 @@
35 35
36using namespace KRES; 36using namespace KRES;
37 37
38QDict<Factory> *Factory::mSelves = 0; 38QDict<Factory> *Factory::mSelves = 0;
39static KStaticDeleter< QDict<Factory> > staticDeleter; 39static KStaticDeleter< QDict<Factory> > staticDeleter;
40 40
41Factory *Factory::self( const QString& resourceFamily ) 41Factory *Factory::self( const QString& resourceFamily )
42{ 42{
43 kdDebug(5650) << "Factory::self()" << endl; 43
44 44
45 Factory *factory = 0; 45 Factory *factory = 0;
46 if ( !mSelves ) 46 if ( !mSelves )
47 { 47 {
48 mSelves = staticDeleter.setObject( new QDict<Factory> ); 48 mSelves = staticDeleter.setObject( new QDict<Factory> );
49 } 49 }
50 50
51 factory = mSelves->find( resourceFamily ); 51 factory = mSelves->find( resourceFamily );
@@ -74,29 +74,29 @@ Factory::Factory( const QString& resourceFamily ) :
74 mTypeMap.insert( type.toString(), *it ); 74 mTypeMap.insert( type.toString(), *it );
75 } 75 }
76*/ 76*/
77 77
78//US new 78//US new
79 PluginInfo* info = new PluginInfo; 79 PluginInfo* info = new PluginInfo;
80 info->library = "microkabc_file"; 80 info->library = "microkabc_file";
81 info->nameLabel = i18n( "file" ); 81 info->nameLabel = i18n( "file" );
82 info->descriptionLabel = i18n( "No description available." ); 82 info->descriptionLabel = i18n( "Choose one file" );
83 mTypeMap.insert( "file", info ); 83 mTypeMap.insert( "file", info );
84 84
85 info = new PluginInfo; 85 info = new PluginInfo;
86 info->library = "microkabc_dir"; 86 info->library = "microkabc_dir";
87 info->nameLabel = i18n( "dir" ); 87 info->nameLabel = i18n( "dir" );
88 info->descriptionLabel = i18n( "No description available." ); 88 info->descriptionLabel = i18n( "Choose a directory with may files" );
89 mTypeMap.insert( "dir", info ); 89 mTypeMap.insert( "dir", info );
90 90
91 info = new PluginInfo; 91 info = new PluginInfo;
92 info->library = "microkabc_ldap"; 92 info->library = "microkabc_ldap";
93 info->nameLabel = i18n( "ldap" ); 93 info->nameLabel = i18n( "ldap" );
94 info->descriptionLabel = i18n( "No description available." ); 94 info->descriptionLabel = i18n( "No description available" );
95 mTypeMap.insert( "ldap", info ); 95 mTypeMap.insert( "ldap", info );
96 96
97 //US add opie plugin only, if the library exists 97 //US add opie plugin only, if the library exists
98 QString libname = "microkabc_opie"; 98 QString libname = "microkabc_opie";
99 QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); 99 QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) );
100 if ( !path.isEmpty() ) 100 if ( !path.isEmpty() )
101 { 101 {
102 info = new PluginInfo; 102 info = new PluginInfo;
@@ -195,17 +195,17 @@ QString Factory::typeDescription( const QString &type ) const
195//US KService::Ptr ptr = mTypeMap[ type ]; 195//US KService::Ptr ptr = mTypeMap[ type ];
196//US return ptr->comment(); 196//US return ptr->comment();
197 PluginInfo* pi = mTypeMap[ type ]; 197 PluginInfo* pi = mTypeMap[ type ];
198 return pi->descriptionLabel; 198 return pi->descriptionLabel;
199} 199}
200 200
201Resource *Factory::resource( const QString& type, const KConfig *config ) 201Resource *Factory::resource( const QString& type, const KConfig *config )
202{ 202{
203 kdDebug() << "Factory::resource( " << type << ", config)" << endl; 203
204 204
205 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 205 if ( type.isEmpty() || !mTypeMap.contains( type ) )
206 return 0; 206 return 0;
207 207
208/*US load the lib not dynamicly. !! 208/*US load the lib not dynamicly. !!
209 KService::Ptr ptr = mTypeMap[ type ]; 209 KService::Ptr ptr = mTypeMap[ type ];
210 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); 210 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
211 if ( !factory ) { 211 if ( !factory ) {
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp
index 169eaa4..7827a67 100644
--- a/microkde/kresources/resource.cpp
+++ b/microkde/kresources/resource.cpp
@@ -70,17 +70,17 @@ Resource::Resource( const KConfig* config )
70Resource::~Resource() 70Resource::~Resource()
71{ 71{
72 delete d; 72 delete d;
73 d = 0; 73 d = 0;
74} 74}
75 75
76void Resource::writeConfig( KConfig* config ) 76void Resource::writeConfig( KConfig* config )
77{ 77{
78 kdDebug(5650) << "Resource::writeConfig()" << endl; 78
79 79
80 config->writeEntry( "ResourceType", d->mType ); 80 config->writeEntry( "ResourceType", d->mType );
81 config->writeEntry( "ResourceName", d->mName ); 81 config->writeEntry( "ResourceName", d->mName );
82 config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); 82 config->writeEntry( "ResourceIsReadOnly", d->mReadOnly );
83 config->writeEntry( "ResourceIsActive", d->mActive ); 83 config->writeEntry( "ResourceIsActive", d->mActive );
84 config->writeEntry( "ResourceIdentifier", d->mIdentifier ); 84 config->writeEntry( "ResourceIdentifier", d->mIdentifier );
85} 85}
86 86
@@ -169,16 +169,17 @@ void Resource::setActive( bool value )
169 169
170bool Resource::isActive() const 170bool Resource::isActive() const
171{ 171{
172 return d->mActive; 172 return d->mActive;
173} 173}
174 174
175void Resource::dump() const 175void Resource::dump() const
176{ 176{
177 qDebug("Resource::dump() ");
177 kdDebug(5650) << "Resource:" << endl; 178 kdDebug(5650) << "Resource:" << endl;
178 kdDebug(5650) << " Name: " << d->mName << endl; 179 kdDebug(5650) << " Name: " << d->mName << endl;
179 kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; 180 kdDebug(5650) << " Identifier: " << d->mIdentifier << endl;
180 kdDebug(5650) << " Type: " << d->mType << endl; 181 kdDebug(5650) << " Type: " << d->mType << endl;
181 kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; 182 kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl;
182 kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; 183 kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl;
183 kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; 184 kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl;
184 kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; 185 kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl;