-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 8 | ||||
-rw-r--r-- | kabc/stdaddressbook.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | microkde/kresources/factory.cpp | 10 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 3 |
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 | |||
@@ -238,33 +238,33 @@ void AddressBook::init(const QString &config) | |||
238 | 238 | ||
239 | //US d->mErrorHandler = 0; | 239 | //US d->mErrorHandler = 0; |
240 | d->mManager = new KRES::Manager<Resource>( "contact" ); | 240 | d->mManager = new KRES::Manager<Resource>( "contact" ); |
241 | d->mManager->readConfig( d->mConfig ); | 241 | d->mManager->readConfig( d->mConfig ); |
242 | } | 242 | } |
243 | 243 | ||
244 | AddressBook::~AddressBook() | 244 | AddressBook::~AddressBook() |
245 | { | 245 | { |
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 | ||
252 | bool AddressBook::load() | 252 | bool 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() ) ); |
263 | ok = false; | 263 | ok = false; |
264 | } | 264 | } |
265 | 265 | ||
266 | // mark all addressees as unchanged | 266 | // mark all addressees as unchanged |
267 | Addressee::List::Iterator addrIt; | 267 | Addressee::List::Iterator addrIt; |
268 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) | 268 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) |
269 | (*addrIt).setChanged( false ); | 269 | (*addrIt).setChanged( false ); |
270 | 270 | ||
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 | |||
@@ -181,49 +181,49 @@ bool ResourceFile::doOpen() | |||
181 | return true; | 181 | return true; |
182 | } | 182 | } |
183 | 183 | ||
184 | bool ok = mFormat->checkFormat( &file ); | 184 | bool ok = mFormat->checkFormat( &file ); |
185 | file.close(); | 185 | file.close(); |
186 | 186 | ||
187 | return ok; | 187 | return ok; |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void ResourceFile::doClose() | 191 | void ResourceFile::doClose() |
192 | { | 192 | { |
193 | } | 193 | } |
194 | 194 | ||
195 | bool ResourceFile::load() | 195 | bool 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 | ||
210 | bool ResourceFile::save( Ticket *ticket ) | 210 | bool 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 ); |
222 | 222 | ||
223 | KSaveFile saveFile( mFileName ); | 223 | KSaveFile saveFile( mFileName ); |
224 | bool ok = false; | 224 | bool ok = false; |
225 | if ( saveFile.status() == 0 && saveFile.file() ) | 225 | if ( saveFile.status() == 0 && saveFile.file() ) |
226 | { | 226 | { |
227 | mFormat->saveAll( addressBook(), this, saveFile.file() ); | 227 | mFormat->saveAll( addressBook(), this, saveFile.file() ); |
228 | ok = saveFile.close(); | 228 | ok = saveFile.close(); |
229 | } | 229 | } |
@@ -244,44 +244,44 @@ bool ResourceFile::save( Ticket *ticket ) | |||
244 | } | 244 | } |
245 | 245 | ||
246 | if ( !ok ) | 246 | if ( !ok ) |
247 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); | 247 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); |
248 | 248 | ||
249 | delete ticket; | 249 | delete ticket; |
250 | unlock( mFileName ); | 250 | unlock( mFileName ); |
251 | 251 | ||
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 | ||
258 | bool ResourceFile::lock( const QString &fileName ) | 258 | bool 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 ); |
280 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 280 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
281 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 281 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
282 | 282 | ||
283 | // Create unique file | 283 | // Create unique file |
284 | QFile file( mLockUniqueName ); | 284 | QFile file( mLockUniqueName ); |
285 | file.open( IO_WriteOnly ); | 285 | file.open( IO_WriteOnly ); |
286 | file.close(); | 286 | file.close(); |
287 | 287 | ||
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 075f12f..1e00cc6 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -139,33 +139,33 @@ void StdAddressBook::init( bool ) | |||
139 | KRES::Manager<Resource>::ActiveIterator it; | 139 | KRES::Manager<Resource>::ActiveIterator it; |
140 | 140 | ||
141 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 141 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
142 | (*it)->setAddressBook( this ); | 142 | (*it)->setAddressBook( this ); |
143 | if ( !(*it)->open() ) | 143 | if ( !(*it)->open() ) |
144 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); | 144 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); |
145 | } | 145 | } |
146 | 146 | ||
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 | ||
164 | bool StdAddressBook::save() | 164 | bool StdAddressBook::save() |
165 | { | 165 | { |
166 | kdDebug(5700) << "StdAddressBook::save()" << endl; | 166 | kdDebug(5700) << "StdAddressBook::save()" << endl; |
167 | 167 | ||
168 | bool ok = true; | 168 | bool ok = true; |
169 | AddressBook *ab = self(); | 169 | AddressBook *ab = self(); |
170 | 170 | ||
171 | ab->deleteRemovedAddressees(); | 171 | ab->deleteRemovedAddressees(); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3ae23e8..a0fec91 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -118,33 +118,33 @@ KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, con | |||
118 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 118 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
119 | #else //KAB_EMBEDDED | 119 | #else //KAB_EMBEDDED |
120 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 120 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
122 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 122 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
123 | mReadWrite( readWrite ), mModified( false ) | 123 | mReadWrite( readWrite ), mModified( false ) |
124 | #endif //KAB_EMBEDDED | 124 | #endif //KAB_EMBEDDED |
125 | { | 125 | { |
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 | ||
143 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 143 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
144 | "X-Department", "KADDRESSBOOK" ); | 144 | "X-Department", "KADDRESSBOOK" ); |
145 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 145 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
146 | "X-Profession", "KADDRESSBOOK" ); | 146 | "X-Profession", "KADDRESSBOOK" ); |
147 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 147 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
148 | "X-AssistantsName", "KADDRESSBOOK" ); | 148 | "X-AssistantsName", "KADDRESSBOOK" ); |
149 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 149 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
150 | "X-ManagersName", "KADDRESSBOOK" ); | 150 | "X-ManagersName", "KADDRESSBOOK" ); |
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 | |||
@@ -27,33 +27,33 @@ | |||
27 | #include <kstandarddirs.h> | 27 | #include <kstandarddirs.h> |
28 | #include <kstaticdeleter.h> | 28 | #include <kstaticdeleter.h> |
29 | #include <klibloader.h> | 29 | #include <klibloader.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | #include "factory.h" | 34 | #include "factory.h" |
35 | 35 | ||
36 | using namespace KRES; | 36 | using namespace KRES; |
37 | 37 | ||
38 | QDict<Factory> *Factory::mSelves = 0; | 38 | QDict<Factory> *Factory::mSelves = 0; |
39 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 39 | static KStaticDeleter< QDict<Factory> > staticDeleter; |
40 | 40 | ||
41 | Factory *Factory::self( const QString& resourceFamily ) | 41 | Factory *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 ); |
52 | 52 | ||
53 | if ( !factory ) { | 53 | if ( !factory ) { |
54 | factory = new Factory( resourceFamily ); | 54 | factory = new Factory( resourceFamily ); |
55 | mSelves->insert( resourceFamily, factory ); | 55 | mSelves->insert( resourceFamily, factory ); |
56 | } | 56 | } |
57 | 57 | ||
58 | return factory; | 58 | return factory; |
59 | } | 59 | } |
@@ -66,45 +66,45 @@ Factory::Factory( const QString& resourceFamily ) : | |||
66 | /*US | 66 | /*US |
67 | 67 | ||
68 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) | 68 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) |
69 | .arg( resourceFamily ) ); | 69 | .arg( resourceFamily ) ); |
70 | KTrader::OfferList::ConstIterator it; | 70 | KTrader::OfferList::ConstIterator it; |
71 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 71 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
72 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); | 72 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); |
73 | if ( !type.toString().isEmpty() ) | 73 | if ( !type.toString().isEmpty() ) |
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; |
103 | info->library = libname; | 103 | info->library = libname; |
104 | info->nameLabel = i18n( "opie" ); | 104 | info->nameLabel = i18n( "opie" ); |
105 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); | 105 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); |
106 | mTypeMap.insert( "opie", info ); | 106 | mTypeMap.insert( "opie", info ); |
107 | } | 107 | } |
108 | 108 | ||
109 | //US add qtopia plugin only, if the library exists | 109 | //US add qtopia plugin only, if the library exists |
110 | libname = "microkabc_qtopia"; | 110 | libname = "microkabc_qtopia"; |
@@ -187,33 +187,33 @@ QString Factory::typeName( const QString &type ) const | |||
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | QString Factory::typeDescription( const QString &type ) const | 190 | QString Factory::typeDescription( const QString &type ) const |
191 | { | 191 | { |
192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
193 | return QString(); | 193 | return QString(); |
194 | 194 | ||
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 | ||
201 | Resource *Factory::resource( const QString& type, const KConfig *config ) | 201 | Resource *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 ) { |
212 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 212 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | */ | 215 | */ |
216 | PluginInfo* pi = mTypeMap[ type ]; | 216 | PluginInfo* pi = mTypeMap[ type ]; |
217 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | 217 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); |
218 | if ( !factory ) { | 218 | if ( !factory ) { |
219 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); | 219 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); |
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 | |||
@@ -62,33 +62,33 @@ Resource::Resource( const KConfig* config ) | |||
62 | d->mType = "type"; | 62 | d->mType = "type"; |
63 | d->mName = "resource-name"; | 63 | d->mName = "resource-name"; |
64 | d->mReadOnly = false; | 64 | d->mReadOnly = false; |
65 | d->mActive = true; | 65 | d->mActive = true; |
66 | d->mIdentifier = KApplication::randomString( 10 ); | 66 | d->mIdentifier = KApplication::randomString( 10 ); |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | Resource::~Resource() | 70 | Resource::~Resource() |
71 | { | 71 | { |
72 | delete d; | 72 | delete d; |
73 | d = 0; | 73 | d = 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | void Resource::writeConfig( KConfig* config ) | 76 | void 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 | ||
87 | bool Resource::open() | 87 | bool Resource::open() |
88 | { | 88 | { |
89 | d->mIsOpen = true; | 89 | d->mIsOpen = true; |
90 | #ifdef QT_THREAD_SUPPORT | 90 | #ifdef QT_THREAD_SUPPORT |
91 | QMutexLocker guard( &(d->mMutex) ); | 91 | QMutexLocker guard( &(d->mMutex) ); |
92 | #endif | 92 | #endif |
93 | if ( !d->mOpenCount ) { | 93 | if ( !d->mOpenCount ) { |
94 | kdDebug(5650) << "Opening resource " << resourceName() << endl; | 94 | kdDebug(5650) << "Opening resource " << resourceName() << endl; |
@@ -161,25 +161,26 @@ QString Resource::resourceName() const | |||
161 | { | 161 | { |
162 | return d->mName; | 162 | return d->mName; |
163 | } | 163 | } |
164 | 164 | ||
165 | void Resource::setActive( bool value ) | 165 | void Resource::setActive( bool value ) |
166 | { | 166 | { |
167 | d->mActive = value; | 167 | d->mActive = value; |
168 | } | 168 | } |
169 | 169 | ||
170 | bool Resource::isActive() const | 170 | bool Resource::isActive() const |
171 | { | 171 | { |
172 | return d->mActive; | 172 | return d->mActive; |
173 | } | 173 | } |
174 | 174 | ||
175 | void Resource::dump() const | 175 | void 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; |
185 | } | 186 | } |