Browse files

Don't accept drops of paths which have already been configured.'

  • Loading branch information...
1 parent d27f6b3 commit b31d9dc192476c7b9e8aad5516453b6977dfb76a @Manfred Manfred committed Mar 11, 2011
Showing with 14 additions and 4 deletions.
  1. +13 −3 app/controllers/PassengerPref.m
  2. +1 −1 doc/TODO
View
16 app/controllers/PassengerPref.m
@@ -98,6 +98,17 @@ - (void) authorizationViewDidDeauthorize:(SFAuthorizationView *)authorizationVie
#pragma NSTableViewDataSource protocol methods
+- (BOOL) hasApplicationWithPath:(id)path {
+ Application *application;
+
+ for (application in applications) {
+ if ([[application path] isEqualToString:path]) {
+ return YES;
+ }
+ }
+ return NO;
+}
+
- (NSDragOperation) tableView:(NSTableView *)aTableView validateDrop:(id)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation {
id items, path;
NSFileManager *fileManager = [[NSFileManager alloc] init];
@@ -109,8 +120,7 @@ - (NSDragOperation) tableView:(NSTableView *)aTableView validateDrop:(id)info pr
items = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];
for (path in items) {
- if (![fileManager fileExistsAtPath:path isDirectory:&isDir] || !isDir) {
- NSLog(@"%@ %d", path, isDir);
+ if (![fileManager fileExistsAtPath:path isDirectory:&isDir] || !isDir || [self hasApplicationWithPath:path]) {
return NSDragOperationNone;
}
}
@@ -133,7 +143,7 @@ - (BOOL) tableView:(NSTableView *)aTableView acceptDrop:(id)info row:(NSInteger)
[applicationsController addObjects:droppedApplications];
[applicationsController setSelectedObjects:[NSArray arrayWithObjects:[droppedApplications lastObject], nil]];
[self apply:self];
-
+
return YES;
}
View
2 doc/TODO
@@ -1,5 +1,5 @@
+- ppane shouldn't accept duplicate applications
- Disable debug logging unless in debug mode
-- Prevent duplicate folders. When the user tries to add a duplicate folder, select the configuration for the application that uses this folder in the source list.
- Do not accept characters in the Address and Aliases fields that can't be used for the domain name (including whitespace in the address field).
- Check for duplicate addresses and aliases after Apply has been clicked. Show a sheet with the following alert:
- The changes could not be applied because the address “cj.local” ia already in use.

0 comments on commit b31d9dc

Please sign in to comment.