summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile263
-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
5 files changed, 151 insertions, 152 deletions
diff --git a/Makefile b/Makefile
index 6eb89e7..d770a05 100644
--- a/Makefile
+++ b/Makefile
@@ -1,147 +1,118 @@
-#############################################################################
-# Makefile for building: kopi-desktop
-# Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 14:00:48 2004
-# Project: kopi-desktop.pro
-# Template: subdirs
-# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
-#############################################################################
-
-MAKEFILE = Makefile
-QMAKE = qmake
-DEL_FILE = rm -f
-CHK_DIR_EXISTS= test -d
-MKDIR = mkdir -p
-INSTALL_FILE=
-INSTALL_DIR =
-SUBTARGETS = \
- sub-libical \
- sub-libkcal \
- sub-microkde \
- sub-libkdepim \
- sub-kabc \
- sub-korganizer \
- sub-kaddressbook \
- sub-kabc-plugins-file \
- sub-kabc-plugins-dir
-
-first: all
-
-all: Makefile $(SUBTARGETS)
-
-libical/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
- cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-libical: libical/$(MAKEFILE) FORCE
- cd libical && $(MAKE) -f $(MAKEFILE)
-
-libkcal/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
- cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-libkcal: libkcal/$(MAKEFILE) FORCE
- cd libkcal && $(MAKE) -f $(MAKEFILE)
-
-microkde/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
- cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-microkde: microkde/$(MAKEFILE) FORCE
- cd microkde && $(MAKE) -f $(MAKEFILE)
-
-libkdepim/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
- cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
- cd libkdepim && $(MAKE) -f $(MAKEFILE)
-
-kabc/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
- cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-kabc: kabc/$(MAKEFILE) FORCE
- cd kabc && $(MAKE) -f $(MAKEFILE)
-
-korganizer/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
- cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-korganizer: korganizer/$(MAKEFILE) FORCE
- cd korganizer && $(MAKE) -f $(MAKEFILE)
-
-kaddressbook/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
- cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
- cd kaddressbook && $(MAKE) -f $(MAKEFILE)
-
-kabc/plugins/file/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
- cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
- cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
-
-kabc/plugins/dir/$(MAKEFILE):
- @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
- cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
-sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
- cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
-
-Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf
- $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
-qmake: qmake_all
- @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro
-
-all: $(SUBTARGETS)
-qmake_all: libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE)
- ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
- ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
-clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
- ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
- ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
-uninstall_subdirs: qmake_all FORCE
- ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
- ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
-install_subdirs: qmake_all FORCE
- ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
- ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
-distclean: qmake_all FORCE
- ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
- ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
-
-install: install_subdirs
-
-uninstall: uninstall_subdirs
-
-FORCE:
+DISTPATH = $(shell pwd)
+DISTDIR = $(shell basename $(DISTPATH))
+
+SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \
+ libkcal libkdepim kabc kabc/converter/opie kabc/formats/binary kabc/plugins/file kabc/plugins/dir \
+ kabc/plugins/opie \
+ korganizer kalarmd kaddressbook kmicromail/libetpan kmicromail/libmailwrapper kmicromail
+all: tmake
+ for i in $(SUBDIRS); do pushd $$i; \
+ make -f Makefile$(PLATFORM) || exit 1; popd; \
+ done
+
+objects:
+ for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
+ for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
+ mkdir -p libical/lib/$(PLATFORM)
+
+clean:
+ rm -f libical/lib/$(PLATFORM)/*;
+ for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
+ rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
+ done
+install:
+ cd bin/kdepim; make install
+ cp db2file/db2file $(QPEDIR)/bin/db2file
+ cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
+ cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kmicromail.desktop
+ cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
+
+dist:
+ @echo Dont forget to do "make install" before "make dist"
+ rm -f *arm.ipk
+ rm -f *~
+ cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim
+ mkipks kmicrokdelibs.control
+ mkipks korganizer.control
+ mkipks kaddressbook.control
+ mkipks kopiemail.control
+ mkipks korganizer-alarm.control
+
+tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \
+ libkcal/Makefile$(PLATFORM) \
+ libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \
+ kalarmd/Makefile$(PLATFORM) \
+ libical/src/libical/Makefile$(PLATFORM) \
+ libical/src/libicalss/Makefile$(PLATFORM) \
+ kabc/Makefile$(PLATFORM) \
+ kabc/converter/opie/Makefile$(PLATFORM) \
+ kabc/formats/binary/Makefile$(PLATFORM) \
+ kabc/plugins/file/Makefile$(PLATFORM) \
+ kabc/plugins/dir/Makefile$(PLATFORM) \
+ kabc/plugins/ldap/Makefile$(PLATFORM) \
+ kabc/plugins/opie/Makefile$(PLATFORM) \
+ kaddressbook/Makefile$(PLATFORM) \
+ kmicromail/Makefile$(PLATFORM) \
+ kmicromail/libetpan/Makefile$(PLATFORM) \
+ kmicromail/libmailwrapper/Makefile$(PLATFORM)
+
+
+
+qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
+ cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
+
+microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
+ cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
+
+libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
+ cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
+
+
+libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
+ cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM)
+
+kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
+ cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM)
+
+korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
+ cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM)
+
+libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
+ cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM)
+
+libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
+ cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM)
+
+kabc/Makefile$(PLATFORM): kabc/kabcE.pro
+ cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM)
+
+kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieconverterE.pro
+ cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieconverterE.pro -o Makefile$(PLATFORM)
+
+kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
+ cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
+
+kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/kabc_fileE.pro
+ cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_fileE.pro -o Makefile$(PLATFORM)
+
+kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/kabc_dirE.pro
+ cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_dirE.pro -o Makefile$(PLATFORM)
+
+kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/kabc_ldapE.pro
+ cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_ldapE.pro -o Makefile$(PLATFORM)
+
+kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/kabc_opieE.pro
+ cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" kabc_opieE.pro -o Makefile$(PLATFORM)
+
+
+kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
+ cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM)
+
+
+kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
+ cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM)
+kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
+ cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM)
+kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
+ cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM)
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 737b3f2..4cbec94 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -1,120 +1,132 @@
#include <qfile.h>
#include <qtextstream.h>
#include <qwidget.h>
#include "kdebug.h"
#include "kurl.h"
#include "kstandarddirs.h"
#include "kconfig.h"
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 += "/";
}
//US
QString KConfig::group() const {
return mGroup;
}
//US added method
QValueList<int> KConfig::readIntListEntry( const QString & key)
{
// qDebug("KConfig::readIntListEntry key=%s:", key.latin1());
QValueList<int> result;
QMap<QString,QString>::ConstIterator mit = mStringMap.find( mGroup + key );
if ( mit == mStringMap.end() ) {
return result;
}
QStringList valuesAsStrings = QStringList::split(":", *mit );
bool ok = false;
bool ok2 = true;
int val;
for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) {
val = (*sit).toInt(&ok);
result << val;
if (ok == false) {
qDebug("KConfig::readIntListEntry str=%s , int=%n:", (*sit).latin1(), &val);
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;
}
int KConfig::readNumEntry( const QString & key, int def )
{
QString res = readEntry(key, QString::number(def ) );
bool ok = false;
int result = res.toInt(&ok);
if ( ok )
return result;
return def;
}
QString KConfig::readEntry( const QString &key, const QString &def )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return def;
}
return *it;
}
QStringList KConfig::readListEntry( const QString &key )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return QStringList();
}
return QStringList::split(":", *it );
}
bool KConfig::readBoolEntry( const QString &key, bool def )
{
QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key );
if ( it == mBoolMap.end() ) {
return def;
}
return *it;
}
@@ -182,97 +194,97 @@ void KConfig::writeEntry( const QString & key , int num )
void KConfig::writeEntry( const QString &key, const QString &value )
{
mStringMap.insert( mGroup + key, value );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, const QStringList &value )
{
mStringMap.insert( mGroup + key, value.join(":") );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, bool value)
{
mBoolMap.insert( mGroup + key, value );
mDirty = true;
}
void KConfig::writeEntry( const QString & e, const QColor & c )
{
QStringList l;
l.append( QString::number ( c.red() ) );
l.append( QString::number ( c.green() ) );
l.append( QString::number ( c.blue() ) );
writeEntry( e, l );
}
void KConfig::writeEntry( const QString & e , const QFont & f )
{
QStringList font;
font.append( f.family());
font.append( (!f.bold ()?"nonbold":"bold") );
font.append( QString::number ( f.pointSize () ) );
font.append( !f.italic ()?"nonitalic":"italic" );
writeEntry( e, font );
}
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;
}
mBoolMap.clear();
mStringMap.clear();
QTextStream t( &f );
QString line = t.readLine();
while ( !line.isNull() ) {
QStringList tokens = QStringList::split( ",", line );
if ( tokens[0] == "bool" ) {
bool value = false;
if ( tokens[2] == "1" ) value = true;
mBoolMap.insert( tokens[1], value );
} else if ( tokens[0] == "QString" ) {
QString value = tokens[2];
mStringMap.insert( tokens[1], value );
} else if ( tokens[0] == "QDateTime" ) {
#if 0
int year = tokens[2].toInt();
QDateTime dt( QDate( year,
tokens[3].toInt(),
tokens[4].toInt() ),
QTime( tokens[5].toInt(), tokens[6].toInt(),
tokens[7].toInt() ) );
mDateTimeMap.insert( tokens[1], dt );
#endif
}
line = t.readLine();
}
}
void KConfig::sync()
{
if ( !mDirty ) return;
//qDebug("KConfig::sync() %s ",mFileName.latin1() );
//kdDebug() << "KConfig::sync(): " << mFileName << endl;
//US I took the following code from a newer version of KDE
// Create the containing dir if needed
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index bfedf53..a01b1a5 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -1,100 +1,104 @@
#ifndef MINIKDE_KCONFIG_H
#define MINIKDE_KCONFIG_H
#include <qstring.h>
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qmap.h>
#include <qdatetime.h>
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.
*
* @return The current group.
*/
QString group() const;
//US I took the following deleteGroup method from a newer version from KDE.
/**
* Deletes a configuration entry group
*
* If the group is not empty and bDeep is false, nothing gets
* deleted and false is returned.
* If this group is the current group and it is deleted, the
* current group is undefined and should be set with setGroup()
* before the next operation on the configuration object.
*
* @param group The name of the group
* returns true if we deleted at least one entry.
*/
bool deleteGroup( const QString& group);
//US I took the following hasGroup method from a newer version from KDE.
/**
* Returns true if the specified group is known about.
*
* @param group The group to search for.
* @return Whether the group exists.
*/
bool hasGroup(const QString &group) const;
QString getFileName();
//US added method readIntListEntry
QValueList<int> readIntListEntry( const QString &);
int readNumEntry( const QString &, int def=0 );
QString readEntry( const QString &, const QString &def=QString::null );
QStringList readListEntry( const QString & );
bool readBoolEntry( const QString &, bool def=false );
QColor readColorEntry( const QString &, QColor * );
QFont readFontEntry( const QString &, QFont * );
QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 );
bool hasKey( const QString &);
void writeEntry( const QString &, const QValueList<int>& );
void writeEntry( const QString &, int );
void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); }
void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); }
void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QString & );
void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QStringList & );
void writeEntry( const QString &, bool );
void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QColor & );
void writeEntry( const QString &, const QFont & );
void writeEntry( const QString &, const QDateTime & );
void deleteEntry( const QString &);
void load();
void sync();
private:
static QString mGroup;
+ QString mTempGroup;
QString mFileName;
QMap<QString,bool> mBoolMap;
QMap<QString,QString> mStringMap;
QMap<QString,QDateTime> mDateTimeMap;
bool mDirty;
};
#endif
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
@@ -208,102 +208,107 @@ QStringList ManagerImpl::resourceNames()
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( (*it)->resourceName() );
}
return result;
}
Resource::List *ManagerImpl::resourceList()
{
return &mResources;
}
QPtrList<Resource> ManagerImpl::resources()
{
QPtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( *it );
}
return result;
}
QPtrList<Resource> ManagerImpl::resources( bool active )
{
QPtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
if ( (*it)->isActive() == active ) {
result.append( *it );
}
}
return result;
}
void ManagerImpl::setListener( ManagerImplListener *listener )
{
mListener = listener;
}
Resource* ManagerImpl::readResourceConfig( const QString& identifier,
bool checkActive )
{
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 );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( standardKey == identifier ) {
mStandard = resource;
}
if ( checkActive ) {
QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
resource->setActive( activeKeys.contains( identifier ) );
}
mResources.append( resource );
return resource;
}
void ManagerImpl::writeResourceConfig( Resource *resource,
bool checkActive )
{
QString key = resource->identifier();
kdDebug(5650) << "Saving resource " << key << endl;
if ( !mConfig ) createStandardConfig();
mConfig->setGroup( "Resource_" + key );
resource->writeConfig( mConfig );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( resource == mStandard && standardKey != key )
mConfig->writeEntry( "Standard", resource->identifier() );
else if ( resource != mStandard && standardKey == key )
mConfig->writeEntry( "Standard", "" );
if ( checkActive ) {
QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
if ( resource->isActive() && !activeKeys.contains( key ) ) {
activeKeys.append( resource->identifier() );
mConfig->writeEntry( "ResourceKeys", activeKeys );
} else if ( !resource->isActive() && activeKeys.contains( key ) ) {
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
@@ -8,96 +8,103 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <kapplication.h>
#include <kconfig.h>
#include "resource.h"
using namespace KRES;
class Resource::ResourcePrivate
{
public:
#ifdef QT_THREAD_SUPPORT
QMutex mMutex;
#endif
int mOpenCount;
QString mType;
QString mIdentifier;
bool mReadOnly;
QString mName;
bool mActive;
bool mIsOpen;
};
Resource::Resource( const KConfig* config )
: QObject( 0, "" ), d( new ResourcePrivate )
{
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 {
d->mType = "type";
d->mName = "resource-name";
d->mReadOnly = false;
d->mActive = true;
d->mIdentifier = KApplication::randomString( 10 );
}
}
Resource::~Resource()
{
delete d;
d = 0;
}
void Resource::writeConfig( KConfig* config )
{
config->writeEntry( "ResourceType", d->mType );
config->writeEntry( "ResourceName", d->mName );
config->writeEntry( "ResourceIsReadOnly", d->mReadOnly );
config->writeEntry( "ResourceIsActive", d->mActive );
config->writeEntry( "ResourceIdentifier", d->mIdentifier );
}
bool Resource::open()
{
d->mIsOpen = true;
#ifdef QT_THREAD_SUPPORT
QMutexLocker guard( &(d->mMutex) );
#endif
if ( !d->mOpenCount ) {
kdDebug(5650) << "Opening resource " << resourceName() << endl;
d->mIsOpen = doOpen();
}
d->mOpenCount++;
return d->mIsOpen;
}
void Resource::close()
{
#ifdef QT_THREAD_SUPPORT