on xenial help sign in
remove commented out code, fix setting filter
defdbbdLukáš Tinkl
plugins/Wizard/timezonemodel.cpp+7−6
@@ -170,9 +170,8 @@ bool TimeZoneFilterModel::filterAcceptsRow(int row, const QModelIndex &parentInd
170
170
171 if (!m_filter.isEmpty()) { // filtering by freeform text input, cf setFilter(QString)
171 if (!m_filter.isEmpty()) { // filtering by freeform text input, cf setFilter(QString)
172 const QString city = sourceModel()->index(row, 0, parentIndex).data(TimeZoneLocationModel::CityRole).toString();
172 const QString city = sourceModel()->index(row, 0, parentIndex).data(TimeZoneLocationModel::CityRole).toString();
173− //const QString country = sourceModel()->index(row, 0, parentIndex).data(TimeZoneLocationModel::CountryRole).toString();
174
173
175− if (m_stringMatcher.indexIn(city) == 0 /*|| m_stringMatcher.indexIn(country) == 0*/) { // match at the beginning of the city name
174+ if (m_stringMatcher.indexIn(city) == 0) { // match at the beginning of the city name
176 return true;
175 return true;
177 }
176 }
178 } else if (!m_country.isEmpty()) { // filter by country code
177 } else if (!m_country.isEmpty()) { // filter by country code
@@ -190,10 +189,12 @@ QString TimeZoneFilterModel::filter() const
190
189
191void TimeZoneFilterModel::setFilter(const QString &filter)
190void TimeZoneFilterModel::setFilter(const QString &filter)
192{
191{
192+ if (filter != m_filter) {
193− m_filter = filter;
193+ m_filter = filter;
194− m_stringMatcher.setPattern(m_filter);
194+ m_stringMatcher.setPattern(m_filter);
195− Q_EMIT filterChanged();
195+ Q_EMIT filterChanged();
196− invalidate();
196+ invalidate();
197+ }
197}
198}
198
199
199QString TimeZoneFilterModel::country() const
200QString TimeZoneFilterModel::country() const