[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KConfig
From:       Michael Kropfberger <michael.kropfberger () gmx ! net>
Date:       1999-02-24 13:31:59
[Download RAW message or body]

Ok... I compiled your proggy: my little changes are an extra output in
libkdecore:kconfigbase.cpp and the returnvalue of the writeConfig-call:

Before saving:
key : "TestConfigItem"
val : "Monkey"
there already is such a key [TestConfigItem]/[Arse]
got back [°qJ@°qJ@ ]
After saving:
key : "TestConfigItem"
val : "Monkey"

Before saving:
key : "TestConfigItem"
val : "Smack"
there already is such a key [TestConfigItem]/[Monkey]
got back [ÈqJ@ÈqJ@]
After saving:
key : "TestConfigItem"
val : "Smack"

Before saving:
key : "TestConfigItem"
val : "Arse"
there already is such a key [TestConfigItem]/[Smack]          
got back [°qJ@°qJ@]
After saving:
key : "TestConfigItem"
val : "Arse"    



so the return value is wrong in any case... but I do not care, I don't
use it in my app....


my code looks similar but it doesn't work:

----------SNIP-----------
void DiskList::applySettings()
{
 debug("  DiskList::applySettings");
 QString oldgroup=config->group();
 config->setGroup("DiskList");

 int i=0;
 QString devKey,pntKey,cmdKey,dev,pnt;
 devKey.sprintf("MountDevice%i",i);
 pntKey.sprintf("MountPoint%i",i);
 cmdKey.sprintf("MountCommand%i",i);

 QDictIterator<char> mit( mntCmds );
 // mntCmds["dev|pnt"]=cmd
 while ( mit.current() ) {
    dev=QString(mit.currentKey()).left(
                    QString(mit.currentKey()).find(SEPARATOR) );
    pnt=QString(mit.currentKey()).right(strlen(mit.currentKey())-1-
                    QString(mit.currentKey()).find(SEPARATOR)) ;
    config->writeEntry(devKey.data(), dev.data() );
    config->writeEntry(pntKey.data(), pnt.data() );

    debug("    DAVOR:saving %i: [%s]=[%s]",i,cmdKey.data(),
mit.current());
    QString s=QString(config->writeEntry(cmdKey.data(), mit.current()));
    debug("    DANACH:saving %i: [%s]=[%s]/return[%s]",i,cmdKey.data(),
mit.current(),s.data());
    ++mit;
    i++;
    devKey.sprintf("MountDevice%i",i);
    pntKey.sprintf("MountPoint%i",i);
    cmdKey.sprintf("MountCommand%i",i);
 }

 config->sync();
 config->setGroup(oldgroup.data());

}
----------SNIP-----------

this outputs something like:

  DiskList::applySettings
there already is such a key [MountDevice0]/[xclient1:/zip]
there already is such a key [MountPoint0]/[/zip]
    DAVOR:saving 0: [MountCommand0]=[/etc/scripts/mount/mount_zip]
there already is such a key
[MountCommand0]/[/etc/scripts/mount/mount_zip]
    DANACH:saving 0:
[MountCommand0]=[ÈQP@ÈQP@ipts/mount/mount_zip]/return[ÈQP@ÈQP@ipts/mount/mount_zip]   \


                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
and here you see it changes the original variable...   :(

bye,
  Mike
-- 
<      ....need an upgrade to Windoze95 or better? install LINUX!      >
<   To iterate is human, to recurse divine.     -- L. Peter Deutsch    >
<---------------------------------------------------------------------->
< /+++/ Michael Kropfberger       (mailto:michael.kropfberger@gmx.net) >
< A-9074 Keutschach 58, Tel.: (04273) 30 41  or (+43664)1233 068 /+++/ >
<---------------------------------------------------------------------->


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic