[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kalarm/lib
From: David Jarvie <djarvie () kde ! org>
Date: 2009-07-23 21:54:41
Message-ID: 1248386081.630013.24941.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1001666 by djarvie:
Display translated time zone names in time zone selection combo box.
M +14 -14 timezonecombo.cpp
M +5 -1 timezonecombo.h
--- trunk/KDE/kdepim/kalarm/lib/timezonecombo.cpp #1001665:1001666
@@ -1,7 +1,7 @@
/*
* timezonecombo.cpp - time zone selection combo box
* Program: kalarm
- * Copyright © 2006,2008 by David Jarvie <djarvie@kde.org>
+ * Copyright © 2006,2008,2009 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,38 +18,38 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "timezonecombo.moc"
#include <ksystemtimezone.h>
-#include "timezonecombo.moc"
+#include <kglobal.h>
+#include <klocale.h>
TimeZoneCombo::TimeZoneCombo(QWidget* parent)
: ComboBox(parent)
{
+ KGlobal::locale()->insertCatalog( "timezones4" ); // for time zone translations
QString utc = KTimeZone::utc().name();
addItem(utc); // put UTC at start of list
+ mZoneNames << utc;
const KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
for (KTimeZones::ZoneMap::ConstIterator it = zones.constBegin(); it != zones.constEnd(); ++it)
if (it.key() != utc)
- addItem(it.key());
+ {
+ mZoneNames << it.key();
+ addItem(i18n(it.key().toUtf8()).replace('_', ' '));
+ }
}
KTimeZone TimeZoneCombo::timeZone() const
{
- return KSystemTimeZones::zone(currentText());
+ return KSystemTimeZones::zone(mZoneNames[currentIndex()]);
}
void TimeZoneCombo::setTimeZone(const KTimeZone& tz)
{
if (!tz.isValid())
return;
- QString zone = tz.name();
- int limit = count();
- for (int index = 0; index < limit; ++index)
- {
- if (itemText(index) == zone)
- {
- setCurrentIndex(index);
- break;
- }
- }
+ int index = mZoneNames.indexOf(tz.name());
+ if (index >= 0)
+ setCurrentIndex(index);
}
--- trunk/KDE/kdepim/kalarm/lib/timezonecombo.h #1001665:1001666
@@ -1,7 +1,7 @@
/*
* timezonecombo.cpp - time zone selection combo box
* Program: kalarm
- * Copyright © 2006 by David Jarvie <software@astrojar.org.uk>
+ * Copyright © 2006,2009 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
#define TIMEZONECOMBO_H
#include <combobox.h>
+#include <QStringList>
class KTimeZone;
@@ -45,6 +46,9 @@
KTimeZone timeZone() const;
/** Selects the specified time zone. */
void setTimeZone(const KTimeZone& tz);
+
+ private:
+ QStringList mZoneNames;
};
#endif // TIMEZONECOMBO_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic