mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
Pushed some action confirmation logic down from GUI layers to the core.
This commit is contained in:
@@ -123,21 +123,12 @@ class DupeGuru(QObject):
|
||||
self.model.options['escape_filter_regexp'] = self.prefs.use_regexp
|
||||
self.model.options['clean_empty_dirs'] = self.prefs.remove_empty_folders
|
||||
self.model.options['ignore_hardlink_matches'] = self.prefs.ignore_hardlink_matches
|
||||
self.model.options['copymove_dest_type'] = self.prefs.destination_type
|
||||
|
||||
#--- Public
|
||||
def add_selected_to_ignore_list(self):
|
||||
self.model.add_selected_to_ignore_list()
|
||||
|
||||
def copy_or_move_marked(self, copy):
|
||||
opname = tr("copy") if copy else tr("move")
|
||||
title = tr("Select a directory to {} marked files to").format(opname)
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
destination = str(QFileDialog.getExistingDirectory(self.resultWindow, title, '', flags))
|
||||
if not destination:
|
||||
return
|
||||
recreate_path = self.prefs.destination_type
|
||||
self.model.copy_or_move_marked(copy, destination, recreate_path)
|
||||
|
||||
def remove_selected(self):
|
||||
self.model.remove_selected(self)
|
||||
|
||||
@@ -271,3 +262,7 @@ class DupeGuru(QObject):
|
||||
def show_problem_dialog(self):
|
||||
self.problemDialog.show()
|
||||
|
||||
def select_dest_folder(self, prompt):
|
||||
flags = QFileDialog.ShowDirsOnly
|
||||
return QFileDialog.getExistingDirectory(self.resultWindow, prompt, '', flags)
|
||||
|
||||
|
||||
@@ -230,16 +230,10 @@ class ResultWindow(QMainWindow):
|
||||
self.app.model.clear_ignore_list()
|
||||
|
||||
def copyTriggered(self):
|
||||
self.app.copy_or_move_marked(True)
|
||||
self.app.model.copy_or_move_marked(True)
|
||||
|
||||
def deleteTriggered(self):
|
||||
count = self.app.model.results.mark_count
|
||||
if not count:
|
||||
return
|
||||
title = tr("Delete duplicates")
|
||||
msg = tr("You are about to send %d files to Trash. Continue?") % count
|
||||
if self.app.confirm(title, msg):
|
||||
self.app.model.delete_marked()
|
||||
self.app.model.delete_marked()
|
||||
|
||||
def deltaTriggered(self, state=None):
|
||||
# The sender can be either the action or the checkbox, but both have a isChecked() method.
|
||||
@@ -256,13 +250,7 @@ class ResultWindow(QMainWindow):
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
def hardlinkTriggered(self):
|
||||
count = self.app.model.results.mark_count
|
||||
if not count:
|
||||
return
|
||||
title = tr("Delete and hardlink duplicates")
|
||||
msg = tr("You are about to send %d files to Trash (and hardlink them afterwards). Continue?") % count
|
||||
if self.app.confirm(title, msg):
|
||||
self.app.model.delete_marked(replace_with_hardlinks=True)
|
||||
self.app.model.delete_marked(replace_with_hardlinks=True)
|
||||
|
||||
def makeReferenceTriggered(self):
|
||||
self.app.model.make_selected_reference()
|
||||
@@ -280,7 +268,7 @@ class ResultWindow(QMainWindow):
|
||||
self.app.model.toggle_selected_mark_state()
|
||||
|
||||
def moveTriggered(self):
|
||||
self.app.copy_or_move_marked(False)
|
||||
self.app.model.copy_or_move_marked(False)
|
||||
|
||||
def openTriggered(self):
|
||||
self.app.model.open_selected()
|
||||
|
||||
Reference in New Issue
Block a user