Commit 4d801019 authored by Dan Pascu's avatar Dan Pascu

Allow opening outgoing transfers as well

parent ed7aaf8d
...@@ -83,11 +83,14 @@ class FileTransferWindow(base_class, ui_class): ...@@ -83,11 +83,14 @@ class FileTransferWindow(base_class, ui_class):
if index.isValid(): if index.isValid():
item = index.data(Qt.UserRole) item = index.data(Qt.UserRole)
if item.ended: if item.ended:
if item.direction == 'incoming' and item.ended and not item.failed: if not item.failed:
menu.addAction(self.actions.open_file) menu.addAction(self.actions.open_file)
menu.addAction(self.actions.open_file_folder) menu.addAction(self.actions.open_file_folder)
menu.addAction(self.actions.remove_entry) menu.addAction(self.actions.remove_entry)
else: else:
if item.direction == 'outgoing':
menu.addAction(self.actions.open_file)
menu.addAction(self.actions.open_file_folder)
menu.addAction(self.actions.cancel_transfer) menu.addAction(self.actions.cancel_transfer)
menu.addSeparator() menu.addSeparator()
menu.addAction(self.actions.open_downloads_folder) menu.addAction(self.actions.open_downloads_folder)
......
...@@ -3931,9 +3931,21 @@ class FileTransferDelegate(QStyledItemDelegate): ...@@ -3931,9 +3931,21 @@ class FileTransferDelegate(QStyledItemDelegate):
def editorEvent(self, event, model, option, index): def editorEvent(self, event, model, option, index):
if event.type()==QEvent.MouseButtonDblClick and event.button()==Qt.LeftButton and event.modifiers()==Qt.NoModifier: if event.type()==QEvent.MouseButtonDblClick and event.button()==Qt.LeftButton and event.modifiers()==Qt.NoModifier:
item = index.data(Qt.UserRole) item = index.data(Qt.UserRole)
if item.direction == 'incoming' and item.ended and not item.failed and os.path.isfile(item.filename): if item.ended and not item.failed:
QDesktopServices.openUrl(QUrl.fromLocalFile(item.filename)) QDesktopServices.openUrl(QUrl.fromLocalFile(item.filename))
return True return True
elif item.direction == 'outgoing' and not item.ended:
item = index.data(Qt.UserRole)
indicator = item.widget.state_indicator
margin = indicator.margin()
indicator_rect = indicator.contentsRect().adjusted(margin, margin, -margin, -margin)
size = min(indicator_rect.width(), indicator_rect.height())
rect = QRect(0, 0, size, size)
rect.moveCenter(indicator.geometry().center())
rect.translate(option.rect.topLeft())
if not rect.contains(event.pos()):
QDesktopServices.openUrl(QUrl.fromLocalFile(item.filename))
return True
elif event.type()==QEvent.MouseButtonRelease and event.button()==Qt.LeftButton and event.modifiers()==Qt.NoModifier: elif event.type()==QEvent.MouseButtonRelease and event.button()==Qt.LeftButton and event.modifiers()==Qt.NoModifier:
item = index.data(Qt.UserRole) item = index.data(Qt.UserRole)
indicator = item.widget.state_indicator indicator = item.widget.state_indicator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment