mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#136 state:fixed] Add dropped folders to recent added folders list in the folder selection window.
This commit is contained in:
parent
883875e88e
commit
e9bb1c01f7
@ -10,6 +10,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
#import "HSOutline.h"
|
#import "HSOutline.h"
|
||||||
#import "PyDirectoryOutline.h"
|
#import "PyDirectoryOutline.h"
|
||||||
|
|
||||||
|
#define DGAddedFoldersNotification @"DGAddedFoldersNotification"
|
||||||
|
|
||||||
@interface DirectoryOutline : HSOutline {}
|
@interface DirectoryOutline : HSOutline {}
|
||||||
- (id)initWithPyParent:(id)aPyParent view:(HSOutlineView *)aOutlineView;
|
- (id)initWithPyParent:(id)aPyParent view:(HSOutlineView *)aOutlineView;
|
||||||
- (PyDirectoryOutline *)py;
|
- (PyDirectoryOutline *)py;
|
||||||
|
@ -49,12 +49,15 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
sourceDragMask = [info draggingSourceOperationMask];
|
sourceDragMask = [info draggingSourceOperationMask];
|
||||||
pboard = [info draggingPasteboard];
|
pboard = [info draggingPasteboard];
|
||||||
if ([[pboard types] containsObject:NSFilenamesPboardType]) {
|
if ([[pboard types] containsObject:NSFilenamesPboardType]) {
|
||||||
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
|
NSArray *foldernames = [pboard propertyListForType:NSFilenamesPboardType];
|
||||||
if (!(sourceDragMask & NSDragOperationLink))
|
if (!(sourceDragMask & NSDragOperationLink))
|
||||||
return NO;
|
return NO;
|
||||||
for (NSString *filename in filenames) {
|
for (NSString *foldername in foldernames) {
|
||||||
[[self py] addDirectory:filename];
|
[[self py] addDirectory:foldername];
|
||||||
}
|
}
|
||||||
|
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:foldernames forKey:@"foldernames"];
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:DGAddedFoldersNotification
|
||||||
|
object:self userInfo:userInfo];
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[self refreshRemoveButtonText];
|
[self refreshRemoveButtonText];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(directorySelectionChanged:)
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(directorySelectionChanged:)
|
||||||
name:NSOutlineViewSelectionDidChangeNotification object:outlineView];
|
name:NSOutlineViewSelectionDidChangeNotification object:outlineView];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(outlineAddedFolders:)
|
||||||
|
name:DGAddedFoldersNotification object:outline];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,4 +164,12 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[self refreshRemoveButtonText];
|
[self refreshRemoveButtonText];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)outlineAddedFolders:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSArray *foldernames = [[aNotification userInfo] objectForKey:@"foldernames"];
|
||||||
|
for (NSString *foldername in foldernames) {
|
||||||
|
[_recentDirectories addFile:foldername];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -45,6 +45,7 @@ class DirectoriesDialog(QMainWindow):
|
|||||||
self.app.recentResults.itemsChanged.connect(self._updateLoadResultsButton)
|
self.app.recentResults.itemsChanged.connect(self._updateLoadResultsButton)
|
||||||
self.recentFolders.itemsChanged.connect(self._updateAddButton)
|
self.recentFolders.itemsChanged.connect(self._updateAddButton)
|
||||||
self.recentFolders.mustOpenItem.connect(self.app.add_directory)
|
self.recentFolders.mustOpenItem.connect(self.app.add_directory)
|
||||||
|
self.directoriesModel.foldersAdded.connect(self.directoriesModelAddedFolders)
|
||||||
self.app.willSavePrefs.connect(self.appWillSavePrefs)
|
self.app.willSavePrefs.connect(self.appWillSavePrefs)
|
||||||
|
|
||||||
def _setupActions(self):
|
def _setupActions(self):
|
||||||
@ -188,6 +189,10 @@ class DirectoriesDialog(QMainWindow):
|
|||||||
def appWillSavePrefs(self):
|
def appWillSavePrefs(self):
|
||||||
self.app.prefs.directoriesWindowRect = self.geometry()
|
self.app.prefs.directoriesWindowRect = self.geometry()
|
||||||
|
|
||||||
|
def directoriesModelAddedFolders(self, folders):
|
||||||
|
for folder in folders:
|
||||||
|
self.recentFolders.insertItem(folder)
|
||||||
|
|
||||||
def loadResultsTriggered(self):
|
def loadResultsTriggered(self):
|
||||||
title = trmsg("SelectResultToLoadMsg")
|
title = trmsg("SelectResultToLoadMsg")
|
||||||
files = tr("dupeGuru Results (*.dupeguru)")
|
files = tr("dupeGuru Results (*.dupeguru)")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from PyQt4.QtCore import QModelIndex, Qt, QRect, QEvent, QPoint, QUrl
|
from PyQt4.QtCore import pyqtSignal, Qt, QRect, QEvent, QPoint, QUrl
|
||||||
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QMouseEvent, QApplication, QBrush, QStyle,
|
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QMouseEvent, QApplication, QBrush, QStyle,
|
||||||
QStyleOptionComboBox, QStyleOptionViewItemV4)
|
QStyleOptionComboBox, QStyleOptionViewItemV4)
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ class DirectoriesModel(TreeModel):
|
|||||||
paths = [str(QUrl(url).toLocalFile()) for url in urls if url]
|
paths = [str(QUrl(url).toLocalFile()) for url in urls if url]
|
||||||
for path in paths:
|
for path in paths:
|
||||||
self.model.add_directory(path)
|
self.model.add_directory(path)
|
||||||
|
self.foldersAdded.emit(paths)
|
||||||
self.reset()
|
self.reset()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -140,6 +141,8 @@ class DirectoriesModel(TreeModel):
|
|||||||
# work with ActionMove either. So screw that, and accept anything.
|
# work with ActionMove either. So screw that, and accept anything.
|
||||||
return Qt.ActionMask
|
return Qt.ActionMask
|
||||||
|
|
||||||
|
#--- Signals
|
||||||
|
foldersAdded = pyqtSignal(list)
|
||||||
#--- model --> view
|
#--- model --> view
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
self.reset()
|
self.reset()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user