on xenial help sign in
unbreak the clash between our timezone model and the one from system settings
2bb7773Lukáš Tinkl
plugins/Wizard/timezonemodel.cpp+4−4
@@ -28,7 +28,7 @@ TimeZoneLocationModel::TimeZoneLocationModel(QObject *parent):
28 QAbstractListModel(parent),
28 QAbstractListModel(parent),
29 m_workerThread(new TimeZonePopulateWorker())
29 m_workerThread(new TimeZonePopulateWorker())
30{
30{
31− qRegisterMetaType<TzLocation>();
31+ qRegisterMetaType<TzLocationWizard>();
32
32
33 m_roleNames[Qt::DisplayRole] = "displayName";
33 m_roleNames[Qt::DisplayRole] = "displayName";
34 m_roleNames[TimeZoneRole] = "timeZone";
34 m_roleNames[TimeZoneRole] = "timeZone";
@@ -66,7 +66,7 @@ void TimeZoneLocationModel::store()
66 endResetModel();
66 endResetModel();
67}
67}
68
68
69−void TimeZoneLocationModel::processModelResult(const TzLocation &location)
69+void TimeZoneLocationModel::processModelResult(const TzLocationWizard &location)
70{
70{
71 m_locations.append(location);
71 m_locations.append(location);
72}
72}
@@ -83,7 +83,7 @@ QVariant TimeZoneLocationModel::data(const QModelIndex &index, int role) const
83 if (index.row() >= m_locations.count() || index.row() < 0)
83 if (index.row() >= m_locations.count() || index.row() < 0)
84 return QVariant();
84 return QVariant();
85
85
86− const TzLocation tz = m_locations.at(index.row());
86+ const TzLocationWizard tz = m_locations.at(index.row());
87
87
88 const QString country(tz.full_country.isEmpty() ? tz.country : tz.full_country);
88 const QString country(tz.full_country.isEmpty() ? tz.country : tz.full_country);
89
89
@@ -130,7 +130,7 @@ void TimeZonePopulateWorker::buildCityMap()
130 TzDB *tzdb = tz_load_db();
130 TzDB *tzdb = tz_load_db();
131 GPtrArray *tz_locations = tz_get_locations(tzdb);
131 GPtrArray *tz_locations = tz_get_locations(tzdb);
132
132
133− TimeZoneLocationModel::TzLocation tmpTz;
133+ TimeZoneLocationModel::TzLocationWizard tmpTz;
134
134
135 for (guint i = 0; i < tz_locations->len; ++i) {
135 for (guint i = 0; i < tz_locations->len; ++i) {
136 auto tmp = static_cast<CcTimezoneLocation *>(g_ptr_array_index(tz_locations, i));
136 auto tmp = static_cast<CcTimezoneLocation *>(g_ptr_array_index(tz_locations, i));
plugins/Wizard/timezonemodel.h+5−5
@@ -42,7 +42,7 @@ public:
42 LongitudeRole
42 LongitudeRole
43 };
43 };
44
44
45− struct TzLocation {
45+ struct TzLocationWizard {
46 QString city;
46 QString city;
47 QString country;
47 QString country;
48 QString timezone;
48 QString timezone;
@@ -57,17 +57,17 @@ public:
57 QHash<int, QByteArray> roleNames() const override;
57 QHash<int, QByteArray> roleNames() const override;
58
58
59private Q_SLOTS:
59private Q_SLOTS:
60− void processModelResult(const TzLocation &location);
60+ void processModelResult(const TzLocationWizard &location);
61 void store();
61 void store();
62
62
63private:
63private:
64 void init();
64 void init();
65 QHash<int, QByteArray> m_roleNames;
65 QHash<int, QByteArray> m_roleNames;
66− QList<TzLocation> m_locations;
66+ QList<TzLocationWizard> m_locations;
67 TimeZonePopulateWorker *m_workerThread;
67 TimeZonePopulateWorker *m_workerThread;
68};
68};
69
69
70−Q_DECLARE_METATYPE (TimeZoneLocationModel::TzLocation)
70+Q_DECLARE_METATYPE (TimeZoneLocationModel::TzLocationWizard)
71
71
72class TimeZonePopulateWorker: public QThread
72class TimeZonePopulateWorker: public QThread
73{
73{
@@ -76,7 +76,7 @@ public:
76 void run() override;
76 void run() override;
77
77
78Q_SIGNALS:
78Q_SIGNALS:
79− void resultReady(const TimeZoneLocationModel::TzLocation &tz);
79+ void resultReady(const TimeZoneLocationModel::TzLocationWizard &tz);
80
80
81private:
81private:
82 void buildCityMap();
82 void buildCityMap();