[Kde-games-devel] Making carddeckinfo and friends i18n friendly
Andreas Pakulat
apaku at gmx.de
Thu Dec 25 10:22:45 CET 2008
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?
> 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?
> @@ -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.
Andreas
--
You will gain money by a speculation or lottery.
More information about the kde-games-devel
mailing list