Camino only - Bug 357560: Switch to native NSSearchField in Privacy sheets. r=smurph sr=pink
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@232283 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
IBClasses = (
|
||||
{CLASS = CookieDateFormatter; LANGUAGE = ObjC; SUPERCLASS = NSDateFormatter; },
|
||||
{CLASS = ExtendedTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; },
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
@@ -18,14 +19,15 @@
|
||||
ACTIONS = {
|
||||
blockCookiesFromSites = id;
|
||||
clickAskAboutCookies = id;
|
||||
clickAutoFillPasswords = id;
|
||||
clickCookieBehavior = id;
|
||||
clickStorePasswords = id;
|
||||
cookieFilterChanged = id;
|
||||
editCookies = id;
|
||||
editCookiesDone = id;
|
||||
editPermissions = id;
|
||||
editPermissionsDone = id;
|
||||
launchKeychainAccess = id;
|
||||
permissionFilterChanged = id;
|
||||
removeAllCookiePermissions = id;
|
||||
removeAllCookies = id;
|
||||
removeCookiePermissions = id;
|
||||
@@ -37,11 +39,11 @@
|
||||
OUTLETS = {
|
||||
mAskAboutCookies = NSButton;
|
||||
mCookieBehavior = NSMatrix;
|
||||
mCookiesFilterField = SearchTextField;
|
||||
mCookiesFilterField = NSSearchField;
|
||||
mCookiesPanel = id;
|
||||
mCookiesTable = ExtendedTableView;
|
||||
mPermissionColumn = NSTableColumn;
|
||||
mPermissionFilterField = SearchTextField;
|
||||
mPermissionFilterField = NSSearchField;
|
||||
mPermissionsPanel = id;
|
||||
mPermissionsTable = ExtendedTableView;
|
||||
mStorePasswords = NSButton;
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>401</integer>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8J135</string>
|
||||
<string>8R2232</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Binary file not shown.
@@ -42,9 +42,6 @@
|
||||
|
||||
#import "nsCOMArray.h"
|
||||
|
||||
#import "ExtendedTableView.h"
|
||||
#import "SearchTextField.h"
|
||||
|
||||
class nsIPref;
|
||||
class nsIPermissionManager;
|
||||
class nsIPermission;
|
||||
@@ -84,14 +81,14 @@ typedef enum ECookiePolicyPopupIndex
|
||||
IBOutlet id mPermissionsPanel;
|
||||
IBOutlet ExtendedTableView* mPermissionsTable;
|
||||
IBOutlet NSTableColumn* mPermissionColumn;
|
||||
IBOutlet SearchTextField* mPermissionFilterField;
|
||||
IBOutlet NSSearchField* mPermissionFilterField;
|
||||
nsIPermissionManager* mPermissionManager; // STRONG (should be nsCOMPtr)
|
||||
nsCOMArray<nsIPermission>* mCachedPermissions; // parallel list for speed, STRONG
|
||||
|
||||
// cookie sheet
|
||||
IBOutlet id mCookiesPanel;
|
||||
IBOutlet ExtendedTableView* mCookiesTable;
|
||||
IBOutlet SearchTextField* mCookiesFilterField;
|
||||
IBOutlet NSSearchField* mCookiesFilterField;
|
||||
nsICookieManager* mCookieManager;
|
||||
nsCOMArray<nsICookie>* mCachedCookies;
|
||||
}
|
||||
@@ -133,7 +130,9 @@ typedef enum ECookiePolicyPopupIndex
|
||||
- (void)sortCookiesByColumn:(NSTableColumn *)aTableColumn inAscendingOrder:(BOOL)ascending;
|
||||
- (void)sortPermissionsByColumn:(NSTableColumn *)aTableColumn inAscendingOrder:(BOOL)ascending;
|
||||
|
||||
//filtering methods
|
||||
// filtering methods
|
||||
- (IBAction)cookieFilterChanged:(id)sender;
|
||||
- (IBAction)permissionFilterChanged:(id)sender;
|
||||
- (void) filterCookiesPermissionsWithString: (NSString*) inFilterString;
|
||||
- (void) filterCookiesWithString: (NSString*) inFilterString;
|
||||
@end
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#import "NSString+Utils.h"
|
||||
#import "NSArray+Utils.h"
|
||||
#import "ExtendedTableView.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@@ -59,8 +60,6 @@
|
||||
// but that requires linkage and extra search paths.
|
||||
static NSString* XPCOMShutDownNotificationName = @"XPCOMShutDown";
|
||||
|
||||
#import "ExtendedTableView.h"
|
||||
|
||||
// prefs for keychain password autofill
|
||||
static const char* const gUseKeychainPref = "chimera.store_passwords_with_keychain";
|
||||
|
||||
@@ -282,12 +281,8 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
||||
[popupButtonCell setEditable:YES];
|
||||
[popupButtonCell addItemsWithTitles:[NSArray arrayWithObjects:[self getLocalizedString:@"Allow"],
|
||||
[self getLocalizedString:@"Allow for Session"],
|
||||
[self getLocalizedString:@"Deny"],
|
||||
nil]];
|
||||
|
||||
//remove the popup from the filter input fields
|
||||
[[mPermissionFilterField cell] setHasPopUpButton: NO];
|
||||
[[mCookiesFilterField cell] setHasPopUpButton: NO];
|
||||
[self getLocalizedString:@"Deny"],
|
||||
nil]];
|
||||
}
|
||||
|
||||
-(void) mapCookiePrefToGUI:(int)pref
|
||||
@@ -359,7 +354,7 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
||||
}
|
||||
|
||||
//clear the filter field
|
||||
[mCookiesFilterField setStringValue: @""];
|
||||
[mCookiesFilterField setStringValue:@""];
|
||||
|
||||
// we shouldn't need to do this, but the scrollbar won't enable unless we
|
||||
// force the table to reload its data. Oddly it gets the number of rows correct,
|
||||
@@ -553,7 +548,7 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
||||
[mPermissionsTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
|
||||
//clear the filter field
|
||||
[mPermissionFilterField setStringValue: @""];
|
||||
[mPermissionFilterField setStringValue:@""];
|
||||
|
||||
// we shouldn't need to do this, but the scrollbar won't enable unless we
|
||||
// force the table to reload its data. Oddly it gets the number of rows correct,
|
||||
@@ -960,32 +955,56 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
||||
}
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
NSString *filterString = [[aNotification object] stringValue];
|
||||
// Delegate method for the filter search fields. Watches for an Enter or
|
||||
// Return in the filter, and passes it off to the sheet to trigger the default
|
||||
// button to dismiss the sheet.
|
||||
- (void)controlTextDidEndEditing:(NSNotification *)aNotification {
|
||||
id source = [aNotification object];
|
||||
if (!(source == mCookiesFilterField || source == mPermissionFilterField))
|
||||
return;
|
||||
|
||||
// find out if we are filtering the permission or the cookies
|
||||
if (([aNotification object] == mPermissionFilterField) && mCachedPermissions && mPermissionManager) {
|
||||
// the user wants to filter down the list of cookies. Reinitialize the list of permission in case
|
||||
// they deleted or replaced a letter.
|
||||
[self filterCookiesPermissionsWithString:filterString];
|
||||
// re-sort
|
||||
[self sortPermissionsByColumn:[mPermissionsTable highlightedTableColumn] inAscendingOrder:mSortedAscending];
|
||||
|
||||
[mPermissionsTable deselectAll: self]; // don't want any traces of previous selection
|
||||
[mPermissionsTable reloadData];
|
||||
}
|
||||
else if (([aNotification object] == mCookiesFilterField) && mCachedCookies && mCookieManager) {
|
||||
// reinitialize the list of cookies in case user deleted a letter or replaced a letter
|
||||
[self filterCookiesWithString:filterString];
|
||||
// re-sort
|
||||
[self sortCookiesByColumn:[mCookiesTable highlightedTableColumn] inAscendingOrder:mSortedAscending];
|
||||
|
||||
[mCookiesTable deselectAll: self]; // don't want any traces of previous selection
|
||||
[mCookiesTable reloadData];
|
||||
NSEvent* currentEvent = [NSApp currentEvent];
|
||||
if (([currentEvent type] == NSKeyDown) && [[currentEvent characters] length] > 0) {
|
||||
unichar character = [[currentEvent characters] characterAtIndex:0];
|
||||
if ((character == NSCarriageReturnCharacter) || (character == NSEnterCharacter)) {
|
||||
if (source == mCookiesFilterField)
|
||||
[mCookiesPanel performKeyEquivalent:currentEvent];
|
||||
else
|
||||
[mPermissionsPanel performKeyEquivalent:currentEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)cookieFilterChanged:(id)sender
|
||||
{
|
||||
if (!mCachedCookies || !mCookieManager)
|
||||
return;
|
||||
|
||||
NSString* filterString = [sender stringValue];
|
||||
|
||||
// reinitialize the list of cookies in case user deleted or replaced a letter
|
||||
[self filterCookiesWithString:filterString];
|
||||
// re-sort
|
||||
[self sortCookiesByColumn:[mCookiesTable highlightedTableColumn] inAscendingOrder:mSortedAscending];
|
||||
[mCookiesTable deselectAll:self]; // don't want any traces of previous selection
|
||||
[mCookiesTable reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)permissionFilterChanged:(id)sender
|
||||
{
|
||||
if (!mCachedPermissions || !mPermissionManager)
|
||||
return;
|
||||
|
||||
NSString* filterString = [sender stringValue];
|
||||
|
||||
// reinitialize the list of permission in case user deleted or replaced a letter.
|
||||
[self filterCookiesPermissionsWithString:filterString];
|
||||
// re-sort
|
||||
[self sortPermissionsByColumn:[mPermissionsTable highlightedTableColumn] inAscendingOrder:mSortedAscending];
|
||||
[mPermissionsTable deselectAll:self]; // don't want any traces of previous selection
|
||||
[mPermissionsTable reloadData];
|
||||
}
|
||||
|
||||
- (void) filterCookiesPermissionsWithString: (NSString*) inFilterString
|
||||
{
|
||||
// the user wants to filter down the list of cookies. Reinitialize the list of permission in case
|
||||
|
||||
Reference in New Issue
Block a user