aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-03-02 23:51:06 +0000
committerstuconnolly <stuart02@gmail.com>2009-03-02 23:51:06 +0000
commitedd1d6f093a5d6d3301a8f8cade43b051bd69083 (patch)
tree771c716cf18a63aad8563a8c118674efbe330ff9 /Source
parent0c76ebee65bdbb8a7319baf54743b0f68483d143 (diff)
downloadsequelpro-edd1d6f093a5d6d3301a8f8cade43b051bd69083.tar.gz
sequelpro-edd1d6f093a5d6d3301a8f8cade43b051bd69083.tar.bz2
sequelpro-edd1d6f093a5d6d3301a8f8cade43b051bd69083.zip
- Re-design the custom query favourties editor and get rid of the nasty plus/minus buttons. Also add some interface element validation.
- Tidy up CustomQuery.h by getting rid of the definition of all datasource and delegate method signatures which don't need to be declared.
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.h45
-rw-r--r--Source/CustomQuery.m15
2 files changed, 21 insertions, 39 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 61dbc7b8..8e81c7e5 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -28,7 +28,6 @@
#import "CMMCPConnection.h"
#import "CMMCPResult.h"
-
@interface CustomQuery : NSObject {
IBOutlet id tableWindow;
@@ -42,62 +41,34 @@
IBOutlet id valueTextField;
IBOutlet id queryFavoritesSheet;
IBOutlet id queryFavoritesView;
+ IBOutlet id removeQueryFavoriteButton;
+ IBOutlet id copyQueryFavoriteButton;
- CMMCPConnection *mySQLConnection;
NSArray *queryResult;
NSUserDefaults *prefs;
NSMutableArray *queryFavorites;
+
+ CMMCPConnection *mySQLConnection;
}
-//IBAction methods
+// IBAction methods
- (IBAction)performQuery:(id)sender;
- (IBAction)chooseQueryFavorite:(id)sender;
- (IBAction)chooseQueryHistory:(id)sender;
- (IBAction)closeSheet:(id)sender;
-//queryFavoritesSheet methods
+// queryFavoritesSheet methods
- (IBAction)addQueryFavorite:(id)sender;
- (IBAction)removeQueryFavorite:(id)sender;
- (IBAction)copyQueryFavorite:(id)sender;
- (IBAction)closeQueryFavoritesSheet:(id)sender;
-//getter methods
+// Accessors
- (NSArray *)currentResult;
-//additional methods
+// Other
- (void)setConnection:(CMMCPConnection *)theConnection;
- (void)setFavorites;
- (void)doPerformQueryService:(NSString *)query;
-//tableView datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
-- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
-- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
-
-//tableView drag&drop datasource methods
-- (BOOL)tableView:(NSTableView *)aTableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard;
-- (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation;
-- (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation;
-
-//tableView delegate methods
-- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
-
-//splitView delegate methods
-- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview;
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset;
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset;
-
-//textView delegate methods
-- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector;
-
-//last but not least
-- (id)init;
-- (void)dealloc;
-
@end
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 7936e962..04b4b9f8 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -723,8 +723,20 @@ traps enter key and
return NO;
}
+/*
+ * Updates various interface elements based on the current table view selection.
+ */
+- (void)tableViewSelectionDidChange:(NSNotification *)notification
+{
+ if ([notification object] == queryFavoritesView) {
+
+ // Enable/disable buttons
+ [removeQueryFavoriteButton setEnabled:([queryFavoritesView numberOfSelectedRows] == 1)];
+ [copyQueryFavoriteButton setEnabled:([queryFavoritesView numberOfSelectedRows] == 1)];
+ }
+}
-//last but not least
+// Last but not least
- (id)init;
{
self = [super init];
@@ -740,5 +752,4 @@ traps enter key and
[super dealloc];
}
-
@end