@@ -12,8 +12,6 @@
1212 *
1313 * You should have received a copy of the GNU General Public License along
1414 * with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Author: Lukáš Tinkl <lukas.tinkl@canonical.com>
1715 */
1816
1917#include <QTimeZone>
@@ -26,6 +24,13 @@
2624TimeZoneModel::TimeZoneModel(QObject *parent)
2725 : QAbstractListModel(parent)
2826{
27+ m_roleNames = {{IdRole, "id"},
28+ {Abbreviation, "abbreviation"},
29+ {Country, "country"},
30+ {CountryCode, "countryCode"},
31+ {City, "city"},
32+ {Comment, "comment"},
33+ {Time, "time"}};
2934 init();
3035}
3136
@@ -67,8 +72,11 @@ QVariant TimeZoneModel::data(const QModelIndex &index, int role) const
6772 return tz.abbreviation(QDateTime::currentDateTime());
6873 case Country:
6974 return LocaleAttached::countryToString(tz.country());
75+ case CountryCode: {
76+ return LocaleAttached::qlocToCountryCode(tz.country());
77+ }
7078 case City: {
71− const QString cityName = QString::fromUtf8(tzid.split('/').last().replace("_", " ")); // take the last part, replace _ by a space
79+ const QString cityName = QString::fromUtf8(tzid.split('/').last().replace('_', ' ')); // take the last part, replace _ by a space
7280 return cityName;
7381 }
7482 case Comment:
@@ -86,7 +94,7 @@ QVariant TimeZoneModel::data(const QModelIndex &index, int role) const
8694
8795QHash<int, QByteArray> TimeZoneModel::roleNames() const
8896{
89− return {{IdRole, "id"}, {Abbreviation, "abbreviation"}, {Country, "country"}, {City, "city"}, {Comment, "comment"}, {Time, "time"}};
97+ return m_roleNames;
9098}
9199
92100void TimeZoneModel::init()