#3661 sort the file list alphabetically
This commit is contained in:
parent
775c258bda
commit
7b343c4ba0
|
@ -50,6 +50,6 @@
|
|||
- (uint64_t) size;
|
||||
- (NSImage *) icon;
|
||||
|
||||
- (NSArray *) children;
|
||||
- (NSMutableArray *) children;
|
||||
|
||||
@end
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
return fIcon;
|
||||
}
|
||||
|
||||
- (NSArray *) children
|
||||
- (NSMutableArray *) children
|
||||
{
|
||||
NSAssert(fIsFolder, @"method can only be invoked on folders");
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
- (void) createFileList;
|
||||
- (void) insertPath: (NSMutableArray *) components forParent: (FileListNode *) parent fileSize: (uint64_t) size
|
||||
index: (NSInteger) index flatList: (NSMutableArray *) flatFileList;
|
||||
- (void) sortFileList: (NSMutableArray *) fileNodes;
|
||||
|
||||
- (void) completenessChange: (NSDictionary *) statusInfo;
|
||||
- (void) ratioLimitHit;
|
||||
|
@ -1710,6 +1711,9 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
}
|
||||
|
||||
[self sortFileList: fileList];
|
||||
[self sortFileList: flatFileList];
|
||||
|
||||
fFileList = [[NSArray alloc] initWithArray: fileList];
|
||||
fFlatFileList = [[NSArray alloc] initWithArray: flatFileList];
|
||||
}
|
||||
|
@ -1761,6 +1765,17 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
}
|
||||
|
||||
- (void) sortFileList: (NSMutableArray *) fileNodes
|
||||
{
|
||||
NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
|
||||
selector: @selector(compareFinder:)] autorelease];
|
||||
[fileNodes sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
|
||||
|
||||
for (FileListNode * node in fileNodes)
|
||||
if ([node isFolder])
|
||||
[self sortFileList: [node children]];
|
||||
}
|
||||
|
||||
//status has been retained
|
||||
- (void) completenessChange: (NSDictionary *) statusInfo
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue