[PATCH] Bug 158444: Pager can't display name of desktop
Aaron J. Seigo
aseigo at kde.org
Thu Mar 13 16:11:28 CET 2008
On Thursday 13 March 2008, Rafał Miłecki wrote:
> 2008/3/12, Aaron J. Seigo <aseigo at kde.org>:
> > On Wednesday 12 March 2008, Rafał Miłecki wrote:
> > > I prepared patch for bug https://bugs.kde.org/show_bug.cgi?id=158444
> > >
> > > Could someone check it and apply if everything is fine?
> >
> > + int m_displayedText; // 0==desktop number ; 1==desktop name ;
> > 2==none
> >
> > using an enumeration rather than an integer with magic values that have
> > the be documented in this way would make it more readable and
> > maintainable.
>
> Could you give me some tip, how can I use
> KConfigGroup cg = config();
> cg.writeEntry("displayedText", m_displayedText);
> when m_displayedText is an enum? writeEntry doesn't acceps such a
> values and doesn't let me read it later.
there are two (well, probably more than two =) ways of doing it:
* the simple way: cast it to an integer when writing and to your enum when
reading.
* the slightly more involved way (which is what is shown in kaccount.cpp
there): store it internally as an integer or string and then use conversion
methods to query the staticMetaObject (that's one of the Magic Things created
by the Q_OBJECT macro) for the value of that item as an enum
honestly, in this case ... casting to/from an int is probably good enough =)
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080313/4605a9ef/attachment.pgp
More information about the Panel-devel
mailing list