Add checkbox on import window to change tasks on demand

This commit is contained in:
Fabian 2022-11-08 21:03:39 +01:00
parent 72d7e56b6e
commit 72a3291d6b
3 changed files with 11 additions and 3 deletions

View File

@ -28,6 +28,9 @@ class ImportTask(QtWidgets.QDialog):
self.completer.running.connect(self.spin)
self.completer.stopped.connect(self.no_spin)
self.auto_change_task_check_box = QtWidgets.QCheckBox()
self.auto_change_task_check_box.setText("Set as active task after import")
ok_button = QtWidgets.QPushButton()
ok_button.setText("OK")
ok_button.setIcon(get_icon("dialog-ok"))
@ -57,6 +60,7 @@ class ImportTask(QtWidgets.QDialog):
blayout = QtWidgets.QHBoxLayout()
blayout.addSpacing(300)
blayout.addWidget(self.auto_change_task_check_box)
blayout.addWidget(cancel_button)
blayout.addWidget(ok_button)
@ -78,7 +82,12 @@ class ImportTask(QtWidgets.QDialog):
def task_text(self):
return self.line_edit.text()
@property
def change_task(self):
return self.auto_change_task_check_box.isChecked()
def showEvent(self, _):
self.auto_change_task_check_box.setChecked(self.config.import_auto_change_task)
# pick up config changes
self.completer.update_urls()
self.line_edit.setText("")

View File

@ -79,7 +79,7 @@ class App:
def new_task_imported(self):
if self.import_task.task_text:
self.tasks.add_jira_task(self.import_task.task_text)
if self.config.import_auto_change_task:
if self.import_task.change_task:
self.change_task(self.import_task.task_text)
self.update_tray_menu()

View File

@ -51,8 +51,7 @@ class Settings(QtWidgets.QDialog):
settings_layout.addWidget(self.flip_menu_check_box, 3, 1, QtCore.Qt.AlignRight)
import_auto_change_task_label = QtWidgets.QLabel()
import_auto_change_task_label.setText("Automatically select as active task\n after task import")
#import_auto_change_task_label.setTextFormat(QtCore.Qt.)
import_auto_change_task_label.setText("Automatically select task as active task\nafter task import")
settings_layout.addWidget(import_auto_change_task_label, 4, 0)
self.import_auto_change_task_check_box = QtWidgets.QCheckBox()
settings_layout.addWidget(self.import_auto_change_task_check_box, 4, 1, QtCore.Qt.AlignRight)