D19230: [Digital Clock] Replace 12/24hr tri-state checkbox in config UI with combobox

Chris Holland noreply at phabricator.kde.org
Fri Feb 22 18:09:01 GMT 2019


Zren added a comment.


  https://doc.qt.io/qt-5/qt.html#CheckState-enum
  
  `i18n("Use locale default")` should be in the middle (`currentIndex=1`). 12h should be `currentIndex=0`, and 24h should be `currentIndex=2`
  
  https://github.com/KDE/plasma-workspace/blob/master/applets/digital-clock/package/contents/config/main.xml#L64
  
  People upgrading from 5.15 will have either "force 12h" (`0`) or "force 24h" (`2`) serialized to file. KConfig doesn't serialize the default values to file (`1`).
  
  Make sure to test changing `contents/config/main.xml` to simulate "loading" a different config value from file.
  
    <entry name="use24hFormat" type="UInt">
          <label>Force the clock to use 12/24 hour time, instead of following the user locale.</label>
          <default>1</default>
    </entry>
  
  with `0` and `2` to make sure it selects 12h/24h when the config opens.
  
  Right now the config should be selecting 12h (`currentIndex=1`), however `currentIndex` is the default `currentIndex=0` as mentioned in the Qt Docs.
  
  - https://doc.qt.io/qt-5.11/qml-qtquick-controls2-combobox.html#currentIndex-prop
  
  If you really want the "locale default" at the top, you'll need to use the following pattern for the model
  
    textRole: "label"
    model: [
      { label: i18n("Use locale default"), value: 1 },
      { label: i18n("12-hour"), value: 0 },
      { label: i18n("24-hour"), value: 2 },
    ]
    Component.onCompleted: {
      // select index with value == cfg_use24hFormat
      // watch cfg_use24hFormat for changes
    }
  
  
  
  - https://doc.qt.io/qt-5.11/qml-qtquick-controls2-combobox.html#model-prop
  - https://doc.qt.io/qt-5.11/qml-qtquick-controls2-combobox.html#textRole-prop

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D19230

To: ngraham, #plasma, Zren, #vdg
Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190222/5d6bdbf9/attachment-0001.html>


More information about the Plasma-devel mailing list