aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPQueryFavoriteManager.h
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-08-26 02:21:53 +0000
committerstuconnolly <stuart02@gmail.com>2009-08-26 02:21:53 +0000
commit86085ceb7de7772dd3f85fb61f397e240b4a0e66 (patch)
tree5351e3d467288fd056a191db11c645606f2052a1 /Source/SPQueryFavoriteManager.h
parent7de1a9a8517c2004e6a97543fbb1462d9c32f4d1 (diff)
downloadsequelpro-86085ceb7de7772dd3f85fb61f397e240b4a0e66.tar.gz
sequelpro-86085ceb7de7772dd3f85fb61f397e240b4a0e66.tar.bz2
sequelpro-86085ceb7de7772dd3f85fb61f397e240b4a0e66.zip
Completely redesigned query favorite manager, including:
- The ability to name query favorites - The ability to edit query favorites using the same editor in the cutom query view - The ability to save your query favorites to a file Note that any already saved query favorites will be upgraded to accommodate the new format, that is including a name associated with the query. The default name is the first 32 chars of the query with '...' appended. Also, added menu item validation to the 'Save Query to Favorites' menu item.
Diffstat (limited to 'Source/SPQueryFavoriteManager.h')
-rw-r--r--Source/SPQueryFavoriteManager.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/Source/SPQueryFavoriteManager.h b/Source/SPQueryFavoriteManager.h
new file mode 100644
index 00000000..bc0d7e2d
--- /dev/null
+++ b/Source/SPQueryFavoriteManager.h
@@ -0,0 +1,74 @@
+//
+// $Id$
+//
+// SPQueryFavoriteManager.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on Aug 23, 2009
+// Copyright (c) 2009 Stuart Connolly. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// More info at <http://code.google.com/p/sequel-pro/>
+
+#import <Cocoa/Cocoa.h>
+
+// Query favorite addition constants
+typedef enum {
+ SPQueryFavoriteAdded = 0,
+ SPQueryFavoriteIsBlank = 1,
+ SPQueryFavoriteExists = 2
+} SPQueryFavoriteAddition;
+
+@interface NSObject (SPQueryFavoriteManagerDelegate)
+
+- (void)queryFavoritesHaveBeenUpdated:(id)manager;
+
+@end
+
+@interface SPQueryFavoriteManager : NSWindowController
+{
+ id delegate;
+
+ NSUserDefaults *prefs;
+
+ BOOL delegateRespondsToFavoriteUpdates;
+
+ IBOutlet NSPopUpButton *encodingPopUp;
+ IBOutlet NSTableView *favoritesTableView;
+ IBOutlet NSTextField *favoriteNameTextField;
+ IBOutlet NSTextView *favoriteQueryTextView;
+ IBOutlet NSArrayController *queryFavoritesController;
+}
+
+- (id)initWithDelegate:(id)managerDelegate;
+
+// Accessors
+- (NSMutableArray *)queryFavorites;
+- (id)customQueryInstance;
+
+// IBAction methods
+- (IBAction)addQueryFavorite:(id)sender;
+- (IBAction)removeQueryFavorite:(id)sender;
+- (IBAction)removeAllQueryFavorites:(id)sender;
+- (IBAction)copyQueryFavorite:(id)sender;
+- (IBAction)saveFavoriteToFile:(id)sender;
+- (IBAction)closeQueryManagerSheet:(id)sender;
+
+// Favorite methods
+- (NSString *)queryFavoriteAtIndex:(NSInteger)index;
+- (SPQueryFavoriteAddition)addQueryToFavorites:(NSString *)query;
+
+@end