|
99 | 99 | from picard.const.sys import ( |
100 | 100 | FROZEN_TEMP_PATH, |
101 | 101 | IS_FROZEN, |
| 102 | + IS_HAIKU, |
102 | 103 | IS_MACOS, |
103 | 104 | IS_WIN, |
104 | 105 | ) |
@@ -796,24 +797,18 @@ def update_browser_integration(self): |
796 | 797 | else: |
797 | 798 | self.browser_integration.stop() |
798 | 799 |
|
799 | | - # def event(self, event): |
800 | | - # if isinstance(event, thread.ProxyToMainEvent): |
801 | | - # event.run() |
802 | | - # elif event.type() == QtCore.QEvent.Type.FileOpen: |
803 | | - # url = event.url() |
804 | | - # log.debug('Received file open event: %r', url) |
805 | | - # if url.isLocalFile(): |
806 | | - # self.add_paths([url.toLocalFile()]) |
807 | | - # if IS_HAIKU: |
808 | | - # self.bring_tagger_front() |
809 | | - # # We should just return True here, except that seems to |
810 | | - # # cause the event's sender to get a -9874 error, so |
811 | | - # # apparently there's some magic inside QFileOpenEvent... |
812 | | - # return 1 |
813 | | - # elif url.scheme() == PICARD_PROTOCOL_SCHEME: |
814 | | - # self.browser_integration.url_handler(url) |
815 | | - # return 1 |
816 | | - # return super().event(event) |
| 800 | + def event(self, event): |
| 801 | + if isinstance(event, thread.ProxyToMainEvent): |
| 802 | + event.run() |
| 803 | + elif event.type() == QtCore.QEvent.Type.FileOpen: |
| 804 | + url = event.url() |
| 805 | + log.debug('Received file open event: %r', url) |
| 806 | + if url.isLocalFile(): |
| 807 | + self.add_paths([url.toLocalFile()]) |
| 808 | + if IS_HAIKU: |
| 809 | + self.bring_tagger_front() |
| 810 | + event.accept() |
| 811 | + return super().event(event) |
817 | 812 |
|
818 | 813 | def _file_loaded(self, file, target=None, remove_file=False, unmatched_files=None): |
819 | 814 | config = get_config() |
|
0 commit comments