mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ask for confirmation if the user tries to open the containing folder for more than 3 books at a time
This commit is contained in:
parent
a5b4012059
commit
63e9296f3b
@ -2162,14 +2162,25 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
format = d.format()
|
format = d.format()
|
||||||
self.view_format(row, format)
|
self.view_format(row, format)
|
||||||
|
|
||||||
|
def _view_check(self, num, max_=3):
|
||||||
|
if num <= max_:
|
||||||
|
return True
|
||||||
|
return question_dialog(self, _('Multiple Books Selected'),
|
||||||
|
_('You are attempting to open %d books. Opening too many '
|
||||||
|
'books at once can be slow and have a negative effect on the '
|
||||||
|
'responsiveness of your computer. Once started the process '
|
||||||
|
'cannot be stopped until complete. Do you wish to continue?'
|
||||||
|
) % num)
|
||||||
|
|
||||||
def view_folder(self, *args):
|
def view_folder(self, *args):
|
||||||
rows = self.current_view().selectionModel().selectedRows()
|
rows = self.current_view().selectionModel().selectedRows()
|
||||||
if self.current_view() is self.library_view:
|
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self, _('Cannot open folder'),
|
d = error_dialog(self, _('Cannot open folder'),
|
||||||
_('No book selected'))
|
_('No book selected'))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
return
|
return
|
||||||
|
if not self._view_check(len(rows)):
|
||||||
|
return
|
||||||
for row in rows:
|
for row in rows:
|
||||||
path = self.library_view.model().db.abspath(row.row())
|
path = self.library_view.model().db.abspath(row.row())
|
||||||
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
|
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
|
||||||
@ -2187,13 +2198,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self._launch_viewer()
|
self._launch_viewer()
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(rows) >= 3:
|
if not self._view_check(len(rows)):
|
||||||
if not question_dialog(self, _('Multiple Books Selected'),
|
|
||||||
_('You are attempting to open %d books. Opening too many '
|
|
||||||
'books at once can be slow and have a negative effect on the '
|
|
||||||
'responsiveness of your computer. Once started the process '
|
|
||||||
'cannot be stopped until complete. Do you wish to continue?'
|
|
||||||
)% len(rows)):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.current_view() is self.library_view:
|
if self.current_view() is self.library_view:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user