aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionControllerDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-13 18:50:40 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-13 18:50:40 +0000
commit1632c45fdd9d0b8fe1e0aef3e891e8bd5704df29 (patch)
treef2fc34195718108f7770900994443931b6b8807e /Source/SPConnectionControllerDelegate.m
parentc2cf0e39c3c59c3548bf39f0835ac552cdcd23f4 (diff)
downloadsequelpro-1632c45fdd9d0b8fe1e0aef3e891e8bd5704df29.tar.gz
sequelpro-1632c45fdd9d0b8fe1e0aef3e891e8bd5704df29.tar.bz2
sequelpro-1632c45fdd9d0b8fe1e0aef3e891e8bd5704df29.zip
Fix issue related to dragging a node to a group node that is being renamed as well as fix all warnings related to the connection outlinew view.
Diffstat (limited to 'Source/SPConnectionControllerDelegate.m')
-rw-r--r--Source/SPConnectionControllerDelegate.m28
1 files changed, 26 insertions, 2 deletions
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 31ec4099..b86e716f 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -24,14 +24,27 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPConnectionControllerDelegate.h"
+#import "SPFavoritesController.h"
#import "SPTableTextFieldCell.h"
+#import "SPPreferenceController.h"
+#import "SPGeneralPreferencePane.h"
+#import "SPAppController.h"
#import "SPFavoriteNode.h"
#import "SPGroupNode.h"
#import "SPTreeNode.h"
#define CELL(cell) (SPTableTextFieldCell *)cell
-static const NSString *SPDatabaseImage = @"database-small";
+static NSString *SPDatabaseImage = @"database-small";
+
+@interface SPConnectionController (PrivateAPI)
+
+- (void)_checkHost;
+- (void)_favoriteTypeDidChange;
+- (void)_reloadFavoritesViewData;
+- (void)_updateFavoritePasswordsFromField:(NSControl *)control;
+
+@end
@implementation SPConnectionController (SPConnectionControllerDelegate)
@@ -143,6 +156,17 @@ static const NSString *SPDatabaseImage = @"database-small";
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
{
+ // If the user is in the process of changing a node's name, trigger a save and prevent dragging.
+ if (isEditing) {
+ [favoritesController saveFavorites];
+
+ [self _reloadFavoritesViewData];
+
+ isEditing = NO;
+
+ return NO;
+ }
+
[pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:self];
[pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType];
@@ -327,7 +351,7 @@ static const NSString *SPDatabaseImage = @"database-small";
{
// Request a password refresh to keep keychain references in sync with favorites, but only if a favorite
// is selected, meaning we're editing an existing one, not a new one.
- if ((control != favoritesOutlineView) && ([self selectedFavoriteNode])) {
+ if (((id)control != (id)favoritesOutlineView) && ([self selectedFavoriteNode])) {
[self _updateFavoritePasswordsFromField:control];
}