diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 87bca86e..2203aa52 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -1736,12 +1736,23 @@ def __init_services_tab__(self): self.service_line_edit.setEditText("") def __init_notes_tab__(self): + self.notes.textChanged.connect(self.__notes_changed) try: self.notes.setPlainText(self.vm.get_notes()) except qubesadmin.exc.QubesException: self.notes.setPlainText("Could not retrieve notes for this qube ") self.notes.setEnabled(False) + def __notes_changed(self): + length = len(self.notes.toPlainText().encode()) + self.notes_count.setText( + "{} / 256000".format(length) + ) + self.notes_count.setStyleSheet( + "" if bool(length < 256000) + else "QLabel#notes_count {color: red}" + ) + def __apply_notes_tab__(self): try: if self.notes.isEnabled(): diff --git a/ui/settingsdlg.ui b/ui/settingsdlg.ui index 06970737..df2ddbca 100644 --- a/ui/settingsdlg.ui +++ b/ui/settingsdlg.ui @@ -2022,6 +2022,16 @@ For user reference only. + + + + 0 of 256000 + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + +