Skip to content

Commit

Permalink
Add free-form text to qube for notes, comments, ...
Browse files Browse the repository at this point in the history
qubesadmin part of adding free-form text to each qube for comments,
notes, descriptions, remarks, reminders, etc.

fixes: QubesOS/qubes-issues#899
  • Loading branch information
alimirjamali committed Feb 17, 2025
1 parent 334419b commit 6ffd0d7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions icons/notes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions qubesmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
('devices', 3),
('applications', 4),
('services', 5),
('notes', 6),
))

# pylint: disable=too-many-positional-arguments
Expand Down Expand Up @@ -263,6 +264,9 @@ def __init__(self, vm_name, init_page="basic", qapp=None, qubesapp=None,
self.warn_template_missing_apps.setVisible(
self.app_list_manager.has_missing)

####### notes tab
self.__init_notes_tab__()

def setup_application(self):
self.qapp.setApplicationName(self.tr("Qube Settings"))
self.qapp.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))
Expand Down Expand Up @@ -344,6 +348,9 @@ def __save_changes__(self):
ret_tmp = self.__apply_services_tab__()
if ret_tmp:
ret += [self.tr("Sevices tab:")] + ret_tmp
ret_tmp = self.__apply_notes_tab__()
if ret_tmp:
ret += [self.tr("Notes tab:")] + ret_tmp
except qubesadmin.exc.QubesException as qex:
ret.append(self.tr('Error while saving changes: ') + str(qex))
except Exception as ex: # pylint: disable=broad-except
Expand Down Expand Up @@ -1429,6 +1436,16 @@ def __init_services_tab__(self):
self.service_line_edit.addItem(self.tr('(custom...)'))
self.service_line_edit.setEditText("")

def __init_notes_tab__(self):
self.notes.setPlainText(self.vm.get_notes())

def __apply_notes_tab__(self):
try:
if self.notes.toPlainText() != self.vm.get_notes():
self.vm.set_notes(self.notes.toPlainText())
except qubesadmin.exc.QubesException as ex:
return str(ex)

def __add_service__(self):
srv = str(self.service_line_edit.currentText()).strip()

Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<file alias="killvm">icons/kill.svg</file>
<file alias="log">icons/log.svg</file>
<file alias="networking">icons/netvm.svg</file>
<file alias="notes">icons/notes.svg</file>
<file alias="obsolete.svg">icons/obsolete.svg</file>
<file alias="outdated">icons/outdated.svg</file>
<file alias="paused">icons/paused.svg</file>
Expand Down
18 changes: 18 additions & 0 deletions ui/settingsdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,24 @@ The qube must be running to disable seamless mode. This setting is not persisten
</item>
</layout>
</widget>
<widget class="QWidget" name="notes_tab">
<attribute name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/notes</normaloff>:/notes</iconset>
</attribute>
<attribute name="title">
<string>Notes</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_notes_tab">
<item>
<layout class="QVBoxLayout" name="verticalLayout_notes">
<item>
<widget class="QPlainTextEdit" name="notes"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
Expand Down

0 comments on commit 6ffd0d7

Please sign in to comment.