aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPQueryFavoriteManager.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-26 08:42:53 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-26 08:42:53 +0000
commit6a8f423169cb76dec7e672ba8e34f5e5196f7283 (patch)
treeecb301f956763f82f82824713abb0f1697d9307b /Source/SPQueryFavoriteManager.m
parent58962687fd345782a012a8a4412627c691db522f (diff)
downloadsequelpro-6a8f423169cb76dec7e672ba8e34f5e5196f7283.tar.gz
sequelpro-6a8f423169cb76dec7e672ba8e34f5e5196f7283.tar.bz2
sequelpro-6a8f423169cb76dec7e672ba8e34f5e5196f7283.zip
• fixed/improved several things for the SPQueryFavoriteManager:
- allow favorites with the same name (it's the user's responsibility) - fixed removing of all menu items (beginning from the end) - "Save Query to Favorites" will save the selected text, or if no selection the CURRENT query, or if no current query can be detected the entire textView string (since the tooltip says '...or save the current query...) - ensure after editing the favorites ALL changes will be saved first before closing the sheet
Diffstat (limited to 'Source/SPQueryFavoriteManager.m')
-rw-r--r--Source/SPQueryFavoriteManager.m22
1 files changed, 20 insertions, 2 deletions
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m
index 39cae4e1..6c2c48b0 100644
--- a/Source/SPQueryFavoriteManager.m
+++ b/Source/SPQueryFavoriteManager.m
@@ -38,7 +38,7 @@
{
if ((self = [super initWithWindowNibName:@"QueryFavoriteManager"])) {
delegate = managerDelegate;
-
+
prefs = [NSUserDefaults standardUserDefaults];
delegateRespondsToFavoriteUpdates = [delegate respondsToSelector:@selector(queryFavoritesHaveBeenUpdated:)];
@@ -105,6 +105,8 @@
[favoritesTableView reloadData];
[favoritesTableView scrollRowToVisible:[favoritesTableView selectedRow]];
+ [prefs synchronize];
+
// Inform the delegate that the query favorites have been updated
if (delegateRespondsToFavoriteUpdates) {
[delegate queryFavoritesHaveBeenUpdated:self];
@@ -120,7 +122,12 @@
[queryFavoritesController removeObjectAtArrangedObjectIndex:[favoritesTableView selectedRow]];
[favoritesTableView reloadData];
-
+
+ [prefs synchronize];
+
+ // Set focus to favorite list to avoid an unstable state
+ [[self window] makeFirstResponder:favoritesTableView];
+
// Inform the delegate that the query favorites have been updated
if (delegateRespondsToFavoriteUpdates) {
[delegate queryFavoritesHaveBeenUpdated:self];
@@ -196,8 +203,19 @@
*/
- (IBAction)closeQueryManagerSheet:(id)sender
{
+
+ // Ensure taht last changes will be written to prefs
+ [[self window] makeFirstResponder:favoritesTableView];
+ [prefs synchronize];
+
[NSApp endSheet:[self window] returnCode:0];
[[self window] orderOut:self];
+
+ // Inform the delegate that the query favorites have been updated
+ if (delegateRespondsToFavoriteUpdates) {
+ [delegate queryFavoritesHaveBeenUpdated:self];
+ }
+
}
#pragma mark -