diff --git a/icons/copy.png b/icons/copy.png new file mode 100644 index 0000000..20b1ace Binary files /dev/null and b/icons/copy.png differ diff --git a/mainwindow.ui b/mainwindow.ui index 90afebb..2f716e0 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -229,7 +229,7 @@ 0 0 769 - 23 + 25 @@ -239,6 +239,7 @@ + @@ -345,6 +346,7 @@ + @@ -725,6 +727,18 @@ Size on Disk + + + + :/copy.png:/copy.png + + + Copy clipboard to Qubes clipboard + + + Copy Dom0 clipboard to Qubes clipboard + + diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 108c35a..a4bf1a4 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -22,6 +22,7 @@ import sys import os +import fcntl import dbus from PyQt4.QtCore import * from PyQt4.QtGui import * @@ -1493,7 +1494,35 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): def action_about_qubes_triggered(self): QMessageBox.about(self, "About...", "Qubes OS

Release 1.0") + @pyqtSlot(name='on_action_copy_clipboard_triggered') + def action_copy_clipboard_triggered(self): + clipboard = app.clipboard().text() + #inter-appviewer lock + try: + fd = os.open("/var/run/qubes/appviewer.lock", os.O_RDWR|os.O_CREAT, 0600); + fcntl.flock(fd, fcntl.LOCK_EX); + except IOError: + QMessageBox.warning (None, "Warning!", "Error while accessing Qubes clipboard!") + return + + qubes_clipboard = open("/var/run/qubes/qubes_clipboard.bin", 'w') + qubes_clipboard.write(clipboard) + qubes_clipboard.close() + + qubes_clip_source = open("/var/run/qubes/qubes_clipboard.source", 'w') + qubes_clip_source.write("dom0") + qubes_clip_source.close() + + trayIcon.showMessage ("Qubes VM Manager", "Qubes clipboard fetched from dom0.", msecs=3000) + try: + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + except IOError: + QMessageBox.warning (None, "Warning!", "Error while writing to Qubes clipboard!") + return + + def createPopupMenu(self): menu = QMenu() menu.addAction(self.action_toolbar) diff --git a/resources.qrc b/resources.qrc index a0ddc41..0ca3594 100644 --- a/resources.qrc +++ b/resources.qrc @@ -13,6 +13,7 @@ icons/mount.png icons/log.png icons/kbd-layout.png + icons/copy.png icons/pencil.png icons/edit.png icons/add.png