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

List:       kde-commits
Subject:    Re: KDE_3_2_BRANCH: kdelibs/kdeui
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-03-23 13:56:11
Message-ID: 200403231504.34596.bastian () kde ! org
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't like the terms "static default" / "dynamic default" very much. 

What about the attached patch?

Cheers,
Waldo

On Tue March 23 2004 11:54, Klas Kalaß wrote:
> Am Montag, 22. März 2004 19:50 schrieb David Faure:
> > On Monday 22 March 2004 19:42, Klas Kalass wrote:
> > > CVS commit by kalass:
> > >
> > > if not hasDefault ; then
> > >   restoreToDefault
> > >
> > > simply does not make sense :-)
> >
> > It does! Please read kconfigbase.h
> >   /**
> >    * Returns whether a default is specified for an entry in either the
> >    * system wide configuration file or the global KDE config file.
> >    *
> >    * If an application uses a dynamically determined default value for
> >    * a certain entry, it may wish to make the following check before
> >    * writing back changes:
> >    * \code
> >    * if ( (value == dynamicDefault) && !config->hasDefault(key) )
> >    *    revertToDefault(key)
> >    * else
> >    *    writeEntry(key, value)
> >    * \endcode
> >    *
> >    * This ensures that as long as the entry is not modified to differ
> >    * from the dynamically determined default, the application will
> >    * follow changes of the default.
> >    * @param key The key of the entry to check.
> >    * @since 3.2
> >    */
> >   bool hasDefault(const QString &key) const;
>
> After (re)reading the code I think I understand the intention, and would
> like to commit the attached patch to the documentation, which makes it
> clearer IMHO.
>
> May I commit  or should I post it to core-devel?

- -- 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
^ bastian@kde.org | Is your software SUSE LINUX READY? | bastian@suse.com
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAYEPyN4pvrENfboIRAi6AAJ94+vMqWnIfQ5oz+2B1KKaopBrlyACeIzaN
K5oMtYb8g4JL7epuZ2ddTLg=
=+1Ng
-----END PGP SIGNATURE-----

["kconfig.doc.patch" (text/x-diff)]

Index: kconfigbase.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kconfigbase.h,v
retrieving revision 1.109
diff -u -p -r1.109 kconfigbase.h
--- kconfigbase.h	26 Feb 2004 03:14:48 -0000	1.109
+++ kconfigbase.h	23 Mar 2004 13:54:24 -0000
@@ -1852,19 +1852,25 @@ public:
    * Returns whether a default is specified for an entry in either the
    * system wide configuration file or the global KDE config file.
    *
-   * If an application uses a dynamically determined default value for
-   * a certain entry, it may wish to make the following check before
+   * If an application computes a default value at runtime for
+   * a certain entry, e.g. like:
+   * \code
+   * QColor computedDefault = kapp->palette().color(QPalette::Active, QColorGroup::Text)
+   * QColor color = config->readEntry(key, computedDefault);
+   * \encode
+   *
+   * Then it may wish to make the following check before
    * writing back changes:
    * \code
-   * if ( (value == dynamicDefault) && !config->hasDefault(key) )
-   *    revertToDefault(key)
+   * if ( (value == computedDefault) && !config->hasDefault(key) )
+   *    config->revertToDefault(key)
    * else
-   *    writeEntry(key, value)
+   *    config->writeEntry(key, value)
    * \endcode
    *
-   * This ensures that as long as the entry is not modified to differ
-   * from the dynamically determined default, the application will
-   * follow changes of the default.
+   * This ensures that as long as the entry is not modified to differ from 
+   * the computed default, the application will keep using the computed default
+   * and will follow changes the computed default makes over time.
    * @param key The key of the entry to check.
    * @since 3.2
    */


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

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