diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConnectionController.m | 2 | ||||
-rw-r--r-- | Source/SPConnectionControllerDelegate.m | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 4938c09a..979f59bb 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -195,7 +195,7 @@ static const NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist"; SPTreeNode *favorite = [self _favoriteNodeForFavoriteID:[prefs integerForKey:([prefs boolForKey:SPSelectLastFavoriteUsed]) ? SPLastFavoriteID : SPDefaultFavorite]]; - if (favorite && [favorite representedObject]) { + if (favorite) { NSNumber *typeNumber = [[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey]; diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index da16fd57..8e2e03b2 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -125,7 +125,9 @@ - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item { - return ([[(SPTreeNode *)item parentNode] parentNode] == nil); + NSLog(@"%@", [(SPTreeNode *)item representedObject]); + + return ([[(SPTreeNode *)item parentNode] parentNode] == nil); } - (void)outlineViewSelectionDidChange:(NSNotification *)notification @@ -190,7 +192,7 @@ #pragma mark - #pragma mark Outline view drag & drop -/*- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard +- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { [pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:self]; [pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType]; @@ -217,8 +219,10 @@ if ((!item) || ([info draggingSource] != outlineView)) return acceptedDrop; - SPTreeNode *node = (item) ? item : favoritesRoot; - + SPTreeNode *node = (item) ? item : [[[[favoritesRoot childNodes] objectAtIndex:0] childNodes] objectAtIndex:0]; + + // TODO: Fix me, disable automatic sorting + // Disable all automatic sorting //currentSortItem = -1; //reverseFavoritesSort = NO; @@ -230,10 +234,10 @@ //[favorites sortUsingDescriptors:[NSArray array]]; // Uncheck sort by menu items - for (NSMenuItem *menuItem in [[favoritesSortByMenuItem submenu] itemArray]) + /*for (NSMenuItem *menuItem in [[favoritesSortByMenuItem submenu] itemArray]) { [menuItem setState:NSOffState]; - } + }*/ NSArray *nodes = [self selectedFavoriteNodes]; @@ -273,12 +277,14 @@ else { [[[treeNode parentNode] mutableChildNodes] removeObject:treeNode]; } - + [childNodeArray insertObject:treeNode atIndex:newIndex]; newIndex++; } + [favoritesController saveFavorites]; + [self _reloadFavoritesViewData]; [[[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; @@ -286,7 +292,7 @@ acceptedDrop = YES; return acceptedDrop; -}*/ +} #pragma mark - #pragma mark Textfield delegate methods |