Copy clipboard to Qubes clipboard.(#543)
This commit is contained in:
		
							parent
							
								
									3d46ae7997
								
							
						
					
					
						commit
						b0d32f550d
					
				
							
								
								
									
										
											BIN
										
									
								
								icons/copy.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icons/copy.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 4.3 KiB | 
| @ -229,7 +229,7 @@ | |||||||
|      <x>0</x> |      <x>0</x> | ||||||
|      <y>0</y> |      <y>0</y> | ||||||
|      <width>769</width> |      <width>769</width> | ||||||
|      <height>23</height> |      <height>25</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
|    <widget class="QMenu" name="menu_system"> |    <widget class="QMenu" name="menu_system"> | ||||||
| @ -239,6 +239,7 @@ | |||||||
|     <addaction name="action_global_settings"/> |     <addaction name="action_global_settings"/> | ||||||
|     <addaction name="action_backup"/> |     <addaction name="action_backup"/> | ||||||
|     <addaction name="action_restore"/> |     <addaction name="action_restore"/> | ||||||
|  |     <addaction name="action_copy_clipboard"/> | ||||||
|    </widget> |    </widget> | ||||||
|    <widget class="QMenu" name="menu_view"> |    <widget class="QMenu" name="menu_view"> | ||||||
|     <property name="title"> |     <property name="title"> | ||||||
| @ -345,6 +346,7 @@ | |||||||
|    <addaction name="action_restore"/> |    <addaction name="action_restore"/> | ||||||
|    <addaction name="separator"/> |    <addaction name="separator"/> | ||||||
|    <addaction name="action_showallvms"/> |    <addaction name="action_showallvms"/> | ||||||
|  |    <addaction name="action_copy_clipboard"/> | ||||||
|   </widget> |   </widget> | ||||||
|   <action name="action_createvm"> |   <action name="action_createvm"> | ||||||
|    <property name="icon"> |    <property name="icon"> | ||||||
| @ -725,6 +727,18 @@ | |||||||
|     <string>Size on Disk</string> |     <string>Size on Disk</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </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> |  </widget> | ||||||
|  <resources> |  <resources> | ||||||
|   <include location="resources.qrc"/> |   <include location="resources.qrc"/> | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ | |||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
|  | import fcntl | ||||||
| import dbus | import dbus | ||||||
| from PyQt4.QtCore import * | from PyQt4.QtCore import * | ||||||
| from PyQt4.QtGui import * | from PyQt4.QtGui import * | ||||||
| @ -1493,6 +1494,34 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow): | |||||||
|     def action_about_qubes_triggered(self): |     def action_about_qubes_triggered(self): | ||||||
|         QMessageBox.about(self, "About...", "<b>Qubes OS</b><br><br>Release 1.0") |         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): |     def createPopupMenu(self): | ||||||
|         menu = QMenu() |         menu = QMenu() | ||||||
|  | |||||||
| @ -13,6 +13,7 @@ | |||||||
|     <file alias="mount.png">icons/mount.png</file> |     <file alias="mount.png">icons/mount.png</file> | ||||||
|     <file alias="log.png">icons/log.png</file> |     <file alias="log.png">icons/log.png</file> | ||||||
|     <file alias="kbd-layout.png">icons/kbd-layout.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="pencil.png">icons/pencil.png</file> | ||||||
|     <file alias="edit.png">icons/edit.png</file> |     <file alias="edit.png">icons/edit.png</file> | ||||||
|     <file alias="add.png">icons/add.png</file> |     <file alias="add.png">icons/add.png</file> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Agnieszka Kostrzewa
						Agnieszka Kostrzewa