diff --git a/src/libcalamares/locale/TimeZone.cpp b/src/libcalamares/locale/TimeZone.cpp index 9a8c605a1..eb82bb3fa 100644 --- a/src/libcalamares/locale/TimeZone.cpp +++ b/src/libcalamares/locale/TimeZone.cpp @@ -180,6 +180,15 @@ TZRegionModel::data( const QModelIndex& index, int role ) const return region.tr(); } +const TZRegion& +TZRegionModel::region( int index ) const +{ + if ( ( index < 0 ) || ( index >= m_regions.count() ) ) + { + index = 0; + } + return m_regions[ index ]; +} } // namespace Locale } // namespace CalamaresUtils diff --git a/src/libcalamares/locale/TimeZone.h b/src/libcalamares/locale/TimeZone.h index c08aa6499..98d87b1b4 100644 --- a/src/libcalamares/locale/TimeZone.h +++ b/src/libcalamares/locale/TimeZone.h @@ -54,6 +54,8 @@ public: /// @brief Give the localized human-readable form virtual QString tr() const = 0; + const char* key() const { return m_key; } + protected: char* m_human = nullptr; char* m_key = nullptr; @@ -91,6 +93,8 @@ public: QVariant data( const QModelIndex& index, int role ) const override; + const TZRegion& region( int index ) const; + private: QVector< TZRegion > m_regions; };