From 6a8f423169cb76dec7e672ba8e34f5e5196f7283 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 26 Aug 2009 08:42:53 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed/improved=20several=20things=20for=20t?= =?UTF-8?q?he=20SPQueryFavoriteManager:=20-=20allow=20favorites=20with=20t?= =?UTF-8?q?he=20same=20name=20(it's=20the=20user's=20responsibility)=20-?= =?UTF-8?q?=20fixed=20removing=20of=20all=20menu=20items=20(beginning=20fr?= =?UTF-8?q?om=20the=20end)=20-=20"Save=20Query=20to=20Favorites"=20will=20?= =?UTF-8?q?save=20the=20selected=20text,=20or=20if=20no=20selection=20the?= =?UTF-8?q?=20CURRENT=20query,=20or=20if=20no=20current=20query=20can=20be?= =?UTF-8?q?=20detected=20the=20entire=20textView=20string=20(since=20the?= =?UTF-8?q?=20tooltip=20says=20'...or=20save=20the=20current=20query...)?= =?UTF-8?q?=20-=20ensure=20after=20editing=20the=20favorites=20ALL=20chang?= =?UTF-8?q?es=20will=20be=20saved=20first=20before=20closing=20the=20sheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPQueryFavoriteManager.m | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Source/SPQueryFavoriteManager.m') 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 - -- cgit v1.2.3