зеркало из https://github.com/mozilla/pjs.git
add search fields to permissions and cookie sheets (bug 263336)
This commit is contained in:
Родитель
1dc8a1c9a4
Коммит
f3324e8389
|
@ -36,9 +36,11 @@
|
|||
mAskAboutCookies = NSButton;
|
||||
mAutoFillPasswords = NSButton;
|
||||
mCookieBehavior = NSMatrix;
|
||||
mCookiesFilterField = SearchTextField;
|
||||
mCookiesPanel = id;
|
||||
mCookiesTable = ExtendedTableView;
|
||||
mPermissionColumn = NSTableColumn;
|
||||
mPermissionFilterField = SearchTextField;
|
||||
mPermissionsPanel = id;
|
||||
mPermissionsTable = ExtendedTableView;
|
||||
mRemoveCookiesButton = NSButton;
|
||||
|
@ -46,7 +48,13 @@
|
|||
};
|
||||
SUPERCLASS = PreferencePaneBase;
|
||||
},
|
||||
{CLASS = PreferencePaneBase; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }
|
||||
{CLASS = PreferencePaneBase; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; },
|
||||
{
|
||||
ACTIONS = {selectText = id; };
|
||||
CLASS = SearchTextField;
|
||||
LANGUAGE = ObjC;
|
||||
SUPERCLASS = NSTextField;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,9 +3,14 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>139 60 356 240 0 0 1600 1002 </string>
|
||||
<string>103 55 356 240 0 0 1280 938 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<string>362.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
<integer>401</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7S215</string>
|
||||
</dict>
|
||||
|
|
Двоичные данные
camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib
сгенерированный
Двоичные данные
camino/PreferencePanes/Privacy/English.lproj/Privacy.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -3,6 +3,7 @@
|
|||
#import "PreferencePaneBase.h"
|
||||
#include "nsCOMArray.h"
|
||||
#import "ExtendedTableView.h"
|
||||
#import "SearchTextField.h"
|
||||
|
||||
class nsIPref;
|
||||
class nsIPermissionManager;
|
||||
|
@ -27,7 +28,7 @@ class nsICookie;
|
|||
IBOutlet id mPermissionsPanel;
|
||||
IBOutlet ExtendedTableView* mPermissionsTable;
|
||||
IBOutlet NSTableColumn* mPermissionColumn;
|
||||
|
||||
IBOutlet SearchTextField* mPermissionFilterField;
|
||||
nsIPermissionManager* mPermissionManager; // STRONG (should be nsCOMPtr)
|
||||
nsCOMArray<nsIPermission>* mCachedPermissions; // parallel list for speed, STRONG
|
||||
|
||||
|
@ -35,7 +36,7 @@ class nsICookie;
|
|||
IBOutlet id mCookiesPanel;
|
||||
IBOutlet ExtendedTableView* mCookiesTable;
|
||||
IBOutlet NSButton* mRemoveCookiesButton;
|
||||
|
||||
IBOutlet SearchTextField* mCookiesFilterField;
|
||||
nsICookieManager* mCookieManager;
|
||||
nsCOMArray<nsICookie>* mCachedCookies;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "STFPopUpButtonCell.h"
|
||||
|
||||
// we should really get this from "CHBrowserService.h",
|
||||
// but that requires linkage and extra search paths.
|
||||
|
@ -262,6 +263,10 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
NSPopUpButtonCell *popupButtonCell = [mPermissionColumn dataCell];
|
||||
[popupButtonCell setEditable:YES];
|
||||
[popupButtonCell addItemsWithTitles:[NSArray arrayWithObjects:[self getLocalizedString:@"Allow"], [self getLocalizedString:@"Deny"], nil]];
|
||||
|
||||
//remove the popup from the filter input fields
|
||||
[[mPermissionFilterField cell] setHasPopUpButton: NO];
|
||||
[[mCookiesFilterField cell] setHasPopUpButton: NO];
|
||||
}
|
||||
|
||||
-(void) mapCookiePrefToGUI: (int)pref
|
||||
|
@ -325,6 +330,10 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
}
|
||||
}
|
||||
|
||||
//clear the filter field
|
||||
//
|
||||
[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,
|
||||
// it just forgets to tell the scrollbar. *shrug*
|
||||
|
@ -442,6 +451,10 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
if ([mPermissionsTable respondsToSelector:@selector(setUsesAlternatingRowBackgroundColors:)])
|
||||
[mPermissionsTable setUsesAlternatingRowBackgroundColors:YES];
|
||||
|
||||
//clear the filter field
|
||||
//
|
||||
[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,
|
||||
// it just forgets to tell the scrollbar. *shrug*
|
||||
|
@ -800,4 +813,44 @@ PR_STATIC_CALLBACK(int) compareValues(nsICookie* aCookie1, nsICookie* aCookie2,
|
|||
CFRelease(fileSystemURL);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
NSString *filterString = [[aNotification object] stringValue];
|
||||
nsCAutoString host;
|
||||
|
||||
// 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 populatePermissionCache];
|
||||
if ([filterString length]) {
|
||||
for (int row = mCachedPermissions->Count() - 1; row >= 0; row--) {
|
||||
mCachedPermissions->ObjectAt(row)->GetHost(host);
|
||||
if ([[NSString stringWithUTF8String: host.get()] rangeOfString: filterString].location == NSNotFound)
|
||||
// remove from cookie permissions list
|
||||
mCachedPermissions->RemoveObjectAt(row);
|
||||
}
|
||||
}
|
||||
[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 populateCookieCache];
|
||||
|
||||
if ([filterString length]) {
|
||||
for (int row = mCachedCookies->Count() - 1; row >= 0; row--) {
|
||||
// only search on the host
|
||||
mCachedCookies->ObjectAt(row)->GetHost(host);
|
||||
|
||||
if ([[NSString stringWithUTF8String: host.get()] rangeOfString: filterString].location == NSNotFound)
|
||||
mCachedCookies->RemoveObjectAt(row);
|
||||
}
|
||||
}
|
||||
[mCookiesTable deselectAll: self]; // don't want any traces of previous selection
|
||||
[mCookiesTable reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Загрузка…
Ссылка в новой задаче