Copy clipboard to Qubes clipboard.(#543)

This commit is contained in:
Agnieszka Kostrzewa 2012-05-06 20:55:52 +02:00
parent 3d46ae7997
commit b0d32f550d
4 changed files with 45 additions and 1 deletions

BIN
icons/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -229,7 +229,7 @@
<x>0</x>
<y>0</y>
<width>769</width>
<height>23</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menu_system">
@ -239,6 +239,7 @@
<addaction name="action_global_settings"/>
<addaction name="action_backup"/>
<addaction name="action_restore"/>
<addaction name="action_copy_clipboard"/>
</widget>
<widget class="QMenu" name="menu_view">
<property name="title">
@ -345,6 +346,7 @@
<addaction name="action_restore"/>
<addaction name="separator"/>
<addaction name="action_showallvms"/>
<addaction name="action_copy_clipboard"/>
</widget>
<action name="action_createvm">
<property name="icon">
@ -725,6 +727,18 @@
<string>Size on Disk</string>
</property>
</action>
<action name="action_copy_clipboard">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/copy.png</normaloff>:/copy.png</iconset>
</property>
<property name="text">
<string>Copy clipboard to Qubes clipboard</string>
</property>
<property name="toolTip">
<string>Copy Dom0 clipboard to Qubes clipboard</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>

View File

@ -22,6 +22,7 @@
import sys
import os
import fcntl
import dbus
from PyQt4.QtCore import *
from PyQt4.QtGui import *
@ -1493,6 +1494,34 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
def action_about_qubes_triggered(self):
QMessageBox.about(self, "About...", "<b>Qubes OS</b><br><br>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 <b>dom0</b>.", 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()

View File

@ -13,6 +13,7 @@
<file alias="mount.png">icons/mount.png</file>
<file alias="log.png">icons/log.png</file>
<file alias="kbd-layout.png">icons/kbd-layout.png</file>
<file alias="copy.png">icons/copy.png</file>
<file alias="pencil.png">icons/pencil.png</file>
<file alias="edit.png">icons/edit.png</file>
<file alias="add.png">icons/add.png</file>