mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-05 04:44:27 -04:00
Communicate the receive mode dir to the GUI, so clicking the open folder button opens the file manager to the correct directory
This commit is contained in:
parent
2c45f6851e
commit
0bab7be444
7 changed files with 52 additions and 4 deletions
|
@ -118,6 +118,7 @@ class UploadHistoryItemFile(QtWidgets.QWidget):
|
|||
self.common.log('UploadHistoryItemFile', '__init__', 'filename: {}'.format(filename))
|
||||
|
||||
self.filename = filename
|
||||
self.dir = None
|
||||
self.started = datetime.now()
|
||||
|
||||
# Filename label
|
||||
|
@ -158,13 +159,20 @@ class UploadHistoryItemFile(QtWidgets.QWidget):
|
|||
self.filename = new_filename
|
||||
self.filename_label.setText(self.filename)
|
||||
|
||||
def set_dir(self, dir):
|
||||
self.dir = dir
|
||||
|
||||
def open_folder(self):
|
||||
"""
|
||||
Open the downloads folder, with the file selected, in a cross-platform manner
|
||||
"""
|
||||
self.common.log('UploadHistoryItemFile', 'open_folder')
|
||||
|
||||
abs_filename = os.path.join(self.common.settings.get('downloads_dir'), self.filename)
|
||||
if not self.dir:
|
||||
self.common.log('UploadHistoryItemFile', 'open_folder', "dir has not been set yet, can't open folder")
|
||||
return
|
||||
|
||||
abs_filename = os.path.join(self.dir, self.filename)
|
||||
|
||||
# Linux
|
||||
if self.common.platform == 'Linux' or self.common.platform == 'BSD':
|
||||
|
@ -266,6 +274,9 @@ class UploadHistoryItem(HistoryItem):
|
|||
self.files[data['old_filename']].rename(data['new_filename'])
|
||||
self.files[data['new_filename']] = self.files.pop(data['old_filename'])
|
||||
|
||||
elif data['action'] == 'set_dir':
|
||||
self.files[data['filename']].set_dir(data['dir'])
|
||||
|
||||
elif data['action'] == 'finished':
|
||||
# Hide the progress bar
|
||||
self.progress_bar.hide()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue