author | zautrix <zautrix> | 2004-07-08 11:20:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-08 11:20:17 (UTC) |
commit | 3f84322a2da502f95be386372da9f75ed17df574 (patch) (unidiff) | |
tree | 9a4ccd4568c38d60bb1efa7a6713f4d0914aae86 /microkde/kresources | |
parent | 40cf8102d2f38b5e952b889ffbd19cb1d428fc9b (diff) | |
download | kdepimpi-3f84322a2da502f95be386372da9f75ed17df574.zip kdepimpi-3f84322a2da502f95be386372da9f75ed17df574.tar.gz kdepimpi-3f84322a2da502f95be386372da9f75ed17df574.tar.bz2 |
Fixes for resource plugin handling on wintendo
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 11 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 1baa6be..785b6b4 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -240,39 +240,44 @@ QPtrList<Resource> ManagerImpl::resources( bool active ) | |||
240 | return result; | 240 | return result; |
241 | } | 241 | } |
242 | 242 | ||
243 | void ManagerImpl::setListener( ManagerImplListener *listener ) | 243 | void ManagerImpl::setListener( ManagerImplListener *listener ) |
244 | { | 244 | { |
245 | mListener = listener; | 245 | mListener = listener; |
246 | } | 246 | } |
247 | 247 | ||
248 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, | 248 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, |
249 | bool checkActive ) | 249 | bool checkActive ) |
250 | { | 250 | { |
251 | kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; | 251 | kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; |
252 | 252 | ||
253 | // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); | 253 | // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); |
254 | 254 | ||
255 | mConfig->setGroup( "Resource_" + identifier ); | 255 | mConfig->setGroup( "Resource_" + identifier ); |
256 | 256 | #ifdef _WIN32_ | |
257 | // we use plugins on win32. the group is stored in a static variable | ||
258 | // such that gourp info not avail on win32 plugins | ||
259 | // to fix that, it would be a looooot of work | ||
260 | mConfig->setTempGroup( "Resource_" + identifier ); | ||
261 | #endif | ||
257 | QString type = mConfig->readEntry( "ResourceType" ); | 262 | QString type = mConfig->readEntry( "ResourceType" ); |
258 | QString name = mConfig->readEntry( "ResourceName" ); | 263 | QString name = mConfig->readEntry( "ResourceName" ); |
259 | Resource *resource = mFactory->resource( type, mConfig ); | 264 | Resource *resource = mFactory->resource( type, mConfig ); |
260 | if ( !resource ) { | 265 | if ( !resource ) { |
261 | kdDebug(5650) << "Failed to create resource with id " << identifier << endl; | 266 | qDebug("Failed to create resource with id %s ",identifier.latin1() ); |
262 | return 0; | 267 | return 0; |
263 | } | 268 | } |
264 | 269 | ||
265 | if ( resource->identifier().isEmpty() ) | 270 | if ( resource->identifier().isEmpty() ) |
266 | resource->setIdentifier( identifier ); | 271 | resource->setIdentifier( identifier ); |
267 | 272 | ||
268 | mConfig->setGroup( "General" ); | 273 | mConfig->setGroup( "General" ); |
269 | 274 | ||
270 | QString standardKey = mConfig->readEntry( "Standard" ); | 275 | QString standardKey = mConfig->readEntry( "Standard" ); |
271 | if ( standardKey == identifier ) { | 276 | if ( standardKey == identifier ) { |
272 | mStandard = resource; | 277 | mStandard = resource; |
273 | } | 278 | } |
274 | 279 | ||
275 | if ( checkActive ) { | 280 | if ( checkActive ) { |
276 | QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" ); | 281 | QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" ); |
277 | resource->setActive( activeKeys.contains( identifier ) ); | 282 | resource->setActive( activeKeys.contains( identifier ) ); |
278 | } | 283 | } |
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index 7827a67..991d53d 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp | |||
@@ -40,32 +40,39 @@ class Resource::ResourcePrivate | |||
40 | QString mIdentifier; | 40 | QString mIdentifier; |
41 | bool mReadOnly; | 41 | bool mReadOnly; |
42 | QString mName; | 42 | QString mName; |
43 | bool mActive; | 43 | bool mActive; |
44 | bool mIsOpen; | 44 | bool mIsOpen; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | Resource::Resource( const KConfig* config ) | 47 | Resource::Resource( const KConfig* config ) |
48 | : QObject( 0, "" ), d( new ResourcePrivate ) | 48 | : QObject( 0, "" ), d( new ResourcePrivate ) |
49 | { | 49 | { |
50 | d->mOpenCount = 0; | 50 | d->mOpenCount = 0; |
51 | d->mIsOpen = false; | 51 | d->mIsOpen = false; |
52 | 52 | ||
53 | //US compiler claimed that const discards qualifier | 53 | //US compiler claimed that const discards qualifier |
54 | KConfig* cfg = (KConfig*)config; | 54 | KConfig* cfg = (KConfig*)config; |
55 | if ( cfg ) { | 55 | if ( cfg ) { |
56 | #ifdef _WIN32_ | ||
57 | // we use plugins on win32. the group is stored in a static variable | ||
58 | // such that group info not available on win32 plugins | ||
59 | // to fix that, it would be a looooot of work | ||
60 | if ( !cfg->tempGroup().isEmpty() ) | ||
61 | cfg->setGroup( cfg->tempGroup() ); | ||
62 | #endif | ||
56 | d->mType = cfg->readEntry( "ResourceType" ); | 63 | d->mType = cfg->readEntry( "ResourceType" ); |
57 | d->mName = cfg->readEntry( "ResourceName" ); | 64 | d->mName = cfg->readEntry( "ResourceName" ); |
58 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); | 65 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); |
59 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); | 66 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); |
60 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); | 67 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); |
61 | } else { | 68 | } else { |
62 | d->mType = "type"; | 69 | d->mType = "type"; |
63 | d->mName = "resource-name"; | 70 | d->mName = "resource-name"; |
64 | d->mReadOnly = false; | 71 | d->mReadOnly = false; |
65 | d->mActive = true; | 72 | d->mActive = true; |
66 | d->mIdentifier = KApplication::randomString( 10 ); | 73 | d->mIdentifier = KApplication::randomString( 10 ); |
67 | } | 74 | } |
68 | } | 75 | } |
69 | 76 | ||
70 | Resource::~Resource() | 77 | Resource::~Resource() |
71 | { | 78 | { |