summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-07-08 11:20:17 (UTC)
committer zautrix <zautrix>2004-07-08 11:20:17 (UTC)
commit3f84322a2da502f95be386372da9f75ed17df574 (patch) (side-by-side diff)
tree9a4ccd4568c38d60bb1efa7a6713f4d0914aae86 /microkde
parent40cf8102d2f38b5e952b889ffbd19cb1d428fc9b (diff)
downloadkdepimpi-3f84322a2da502f95be386372da9f75ed17df574.zip
kdepimpi-3f84322a2da502f95be386372da9f75ed17df574.tar.gz
kdepimpi-3f84322a2da502f95be386372da9f75ed17df574.tar.bz2
Fixes for resource plugin handling on wintendo
Diffstat (limited to 'microkde') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kconfig.cpp20
-rw-r--r--microkde/kconfig.h4
-rw-r--r--microkde/kresources/managerimpl.cpp9
-rw-r--r--microkde/kresources/resource.cpp7
4 files changed, 34 insertions, 6 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 737b3f2..4cbec94 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -11,27 +11,39 @@
QString KConfig::mGroup = "";
//QString KConfig::mGroup = "General";
KConfig::KConfig( const QString &fileName )
: mFileName( fileName ), mDirty( false )
{
- kdDebug() << "KConfig::KConfig(): '" << fileName << "'" << endl;
+ mTempGroup = "";
load();
}
KConfig::~KConfig()
{
sync();
}
+// we need the temp group for plugins on windows
+void KConfig::setTempGroup( const QString &group )
+{
+ mTempGroup = group;
+
+ if ( mTempGroup.right( 1 ) != "/" ) mTempGroup += "/";
+}
+
+
+QString KConfig::tempGroup() const {
+ return mTempGroup;
+}
void KConfig::setGroup( const QString &group )
{
- kdDebug() << "KConfig::setGroup(): '" << group << "'" << endl;
+
mGroup = group;
if ( mGroup.right( 1 ) != "/" ) mGroup += "/";
}
@@ -66,13 +78,13 @@ QValueList<int> KConfig::readIntListEntry( const QString & key)
ok2 = false;
}
}
if (ok2 == false)
{
- kdDebug() << "KConfig::readIntListEntry: error while reading one of the intvalues." << endl;
+
qDebug("KConfig::readIntListEntry: error while reading one of the intvalues.");
}
return result;
}
@@ -224,13 +236,13 @@ void KConfig::writeEntry( const QString &key, const QDateTime &dt )
{
mDateTimeMap.insert( mGroup + key, dt );
}
void KConfig::load()
{
- kdDebug() << "KConfig::load(): " << mFileName << endl;
+
QFile f( mFileName );
if ( !f.open( IO_ReadOnly ) ) {
qDebug("KConfig: could not open file %s ",mFileName.latin1() );
return;
}
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index bfedf53..a01b1a5 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -12,12 +12,15 @@
class KConfig
{
public:
KConfig( const QString & );
~KConfig();
+ void setTempGroup( const QString &group );
+ QString tempGroup() const;
+
void setGroup( const QString & );
//US
/**
* Returns the name of the group in which we are
* searching for keys and from which we are retrieving entries.
@@ -84,12 +87,13 @@ class KConfig
void load();
void sync();
private:
static QString mGroup;
+ QString mTempGroup;
QString mFileName;
QMap<QString,bool> mBoolMap;
QMap<QString,QString> mStringMap;
QMap<QString,QDateTime> mDateTimeMap;
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
@@ -250,18 +250,23 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier,
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
-
+#ifdef _WIN32_
+ // we use plugins on win32. the group is stored in a static variable
+ // such that gourp info not avail on win32 plugins
+ // to fix that, it would be a looooot of work
+ mConfig->setTempGroup( "Resource_" + identifier );
+#endif
QString type = mConfig->readEntry( "ResourceType" );
QString name = mConfig->readEntry( "ResourceName" );
Resource *resource = mFactory->resource( type, mConfig );
if ( !resource ) {
- kdDebug(5650) << "Failed to create resource with id " << identifier << endl;
+ qDebug("Failed to create resource with id %s ",identifier.latin1() );
return 0;
}
if ( resource->identifier().isEmpty() )
resource->setIdentifier( identifier );
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
@@ -50,12 +50,19 @@ Resource::Resource( const KConfig* config )
d->mOpenCount = 0;
d->mIsOpen = false;
//US compiler claimed that const discards qualifier
KConfig* cfg = (KConfig*)config;
if ( cfg ) {
+#ifdef _WIN32_
+ // we use plugins on win32. the group is stored in a static variable
+ // such that group info not available on win32 plugins
+ // to fix that, it would be a looooot of work
+ if ( !cfg->tempGroup().isEmpty() )
+ cfg->setGroup( cfg->tempGroup() );
+#endif
d->mType = cfg->readEntry( "ResourceType" );
d->mName = cfg->readEntry( "ResourceName" );
d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false );
d->mActive = cfg->readBoolEntry( "ResourceIsActive", true );
d->mIdentifier = cfg->readEntry( "ResourceIdentifier" );
} else {