diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 3a84555..7eb68cb 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -1264,14 +1264,13 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): while self.qvm_collection.get_vm_by_name(name_format % name_number): name_number += 1 - cmd = ['kdialog', '--title', 'Qubes clone VM', '--inputbox', 'Enter name for VM '+vm.name+' clone:', name_format % name_number] - kdialog = subprocess.Popen(cmd, stdout = subprocess.PIPE) - clone_name = kdialog.stdout.read().strip() - if clone_name == "": + (clone_name, ok) = QInputDialog.getText(self, 'Qubes clone VM', + 'Enter name for VM '+vm.name+' clone:', text=name_format % name_number) + if not ok or clone_name == "": return thread_monitor = ThreadMonitor() - thread = threading.Thread (target=self.do_clone_vm, args=(vm, clone_name, thread_monitor)) + thread = threading.Thread (target=self.do_clone_vm, args=(vm, str(clone_name), thread_monitor)) thread.daemon = True thread.start() @@ -1496,8 +1495,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): def action_run_command_in_vm_triggered(self): vm = self.get_selected_vm() + (command_to_run, ok) = QInputDialog.getText(self, 'Qubes command entry', + 'Run command in '+vm.name+':') + if not ok or command_to_run == "": + return thread_monitor = ThreadMonitor() - thread = threading.Thread (target=self.do_run_command_in_vm, args=(vm, thread_monitor)) + thread = threading.Thread (target=self.do_run_command_in_vm, args=(vm, str(command_to_run), thread_monitor)) thread.daemon = True thread.start() @@ -1509,17 +1512,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): QMessageBox.warning (None, "Error while running command", "Exception while running command:
{0}".format(thread_monitor.error_msg)) - def do_run_command_in_vm(self, vm, thread_monitor): - cmd = ['kdialog', '--title', 'Qubes command entry', '--inputbox', 'Run command in '+vm.name+':'] - kdialog = subprocess.Popen(cmd, stdout = subprocess.PIPE) - command_to_run = kdialog.stdout.read() - command_to_run = command_to_run.strip() - if command_to_run != "": - try: - vm.run(command_to_run, verbose=False, autostart=True, - notify_function=lambda lvl, msg: trayIcon.showMessage(msg, msecs=3000) ) - except Exception as ex: - thread_monitor.set_error_msg(str(ex)) + def do_run_command_in_vm(self, vm, command_to_run, thread_monitor): + try: + vm.run(command_to_run, verbose=False, autostart=True, + notify_function=lambda lvl, msg: trayIcon.showMessage(msg, msecs=3000) ) + except Exception as ex: + thread_monitor.set_error_msg(str(ex)) thread_monitor.set_finished() @pyqtSlot(name='on_action_set_keyboard_layout_triggered') diff --git a/qubesmanager/mount_for_backup.sh b/qubesmanager/mount_for_backup.sh index 6c7ae2f..15d05f2 100755 --- a/qubesmanager/mount_for_backup.sh +++ b/qubesmanager/mount_for_backup.sh @@ -9,10 +9,17 @@ if [ ! -e $1 ]; then exit 1; #no such path fi +if type kdialog &> /dev/null; then + PROMPT="kdialog --title Qubes --password" +else + PROMPT="zenity --entry --title Qubes --hide-text --text" +fi + + #check if luks-encrypted if sudo cryptsetup isLuks $1 ; then # Is a luks device - if ! kdialog --password "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then + if ! $PROMPT "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then exit 1; fi else diff --git a/rpm_spec/qmgr.spec b/rpm_spec/qmgr.spec index e382e3d..88595d6 100644 --- a/rpm_spec/qmgr.spec +++ b/rpm_spec/qmgr.spec @@ -11,7 +11,7 @@ Group: Qubes Vendor: Invisible Things Lab License: GPL URL: http://fixme -Requires: python, PyQt4, qubes-core-dom0 > 1.7.23, kdebase +Requires: python, PyQt4, qubes-core-dom0 > 1.7.23 Requires: pmount, cryptsetup, wmctrl Requires: dbus BuildRequires: PyQt4-devel