[Kde-games-devel] Making carddeckinfo and friends i18n friendly

Albert Astals Cid aacid at kde.org
Fri Dec 26 21:09:22 CET 2008


A Dijous 25 Desembre 2008, Andreas Pakulat va escriure:
> On 24.12.08 16:51:52, Albert Astals Cid wrote:
> > Due to http://bugs.kde.org/show_bug.cgi?id=178535 i'd say the kpat
> > crasher known as https://bugs.kde.org/show_bug.cgi?id=173932 is due to
> > carddeckinfo storing the current deck in translated way, which is not a
> > good idea.
> >
> > The following patch fixes the crash that happens when you try to load a
> > theme that does not exist (because you had played first in french and now
> > are playing in english) makes it return untranslated names so in the
> > future we don't have to care about people changing languages.
>
> That stems from the original code in kpat/lskat which also used the
> translated name. Sorry for not paying attention to that detail :)
>
> I guess this is the reason you pinged me yesterday?

Yes

>
> > Ok to commit?
>
> Patch looks fine to me, except a few minor things:
> > Index: carddeckinfo_p.h
> > ===================================================================
> > --- carddeckinfo_p.h	(revision 899240)
> > +++ carddeckinfo_p.h	(working copy)
> > @@ -69,6 +69,8 @@
> >     bool isDefault;
> >  };
> >
> > +QDebug operator<<(QDebug debug, const KCardThemeInfo &cn);
> > +
>
> Was this intentional, or just some leftover from debugging?

Intentional, but i've commited it in a separate commit as it's not part of the 
bugfix, i just want to be able of piping KCardThemeInfo though a kDebug() in 
the future.

>
> > @@ -218,9 +219,15 @@
> >    }
> >    else
> >    {
> > -    QList<QListWidgetItem*> items = d->ui.frontList->findItems(name,
> > Qt::MatchExactly ); -    if(!items.isEmpty())
> > -        items.first()->setSelected(true);
> > +    for (int i = 0; i < d->ui.frontList->count(); ++i)
> > +    {
> > +      QListWidgetItem *item = d->ui.frontList->item(i);
> > +      if (item->data(Qt::UserRole).toString() == name)
> > +      {
> > +        item->setSelected(true);
> > +        break;
> > +      }
> > +    }
>
> Hmm, this would probably benefit from a rewrite to real
> StandardItemModel/View instead of a QListWidget - in the long-run at least.
> But thats something for 4.3.

Agreed.

Albert

>
> Andreas




More information about the kde-games-devel mailing list