324306 No interface for allowing a user to manually specify which cert to log in with. Patch by stridey@gmail.com. r=kreeger r=ardisonne sr=pink

This commit is contained in:
mark%moxienet.com 2006-08-15 15:32:49 +00:00
parent e882f5192c
commit 4cc0e48b57
5 changed files with 51 additions and 14 deletions

View File

@ -14,6 +14,7 @@
},
{
ACTIONS = {
clickCertificateSelectionBehavior = id;
clickEnableLeaveEncrypted = id;
clickEnableLoadLowGrade = id;
clickEnableViewMixed = id;
@ -21,7 +22,12 @@
};
CLASS = OrgMozillaChimeraPreferenceSecurity;
LANGUAGE = ObjC;
OUTLETS = {mLeaveEncrypted = NSButton; mLoadLowGrade = NSButton; mViewMixed = NSButton; };
OUTLETS = {
mCertificateBehavior = NSMatrix;
mLeaveEncrypted = NSButton;
mLoadLowGrade = NSButton;
mViewMixed = NSButton;
};
SUPERCLASS = PreferencePaneBase;
},
{CLASS = PreferencePaneBase; LANGUAGE = ObjC; SUPERCLASS = NSPreferencePane; }

View File

@ -3,10 +3,26 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>56 71 356 240 0 0 1600 1002 </string>
<string>21 1 356 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>437.0</string>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8C46</string>
<string>8I127</string>
<key>IBUserGuides</key>
<dict>
<key>5</key>
<dict>
<key>guideLocations</key>
<array>
<string>Vertical:297.000000</string>
</array>
<key>guidesLocked</key>
<false/>
</dict>
</dict>
</dict>
</plist>

View File

@ -47,12 +47,15 @@ class nsIPref;
IBOutlet NSButton* mLeaveEncrypted;
IBOutlet NSButton* mLoadLowGrade;
IBOutlet NSButton* mViewMixed;
IBOutlet NSMatrix* mCertificateBehavior;
}
-(IBAction) clickEnableLeaveEncrypted:(id)sender;
-(IBAction) clickEnableLoadLowGrade:(id)sender;
-(IBAction) clickEnableViewMixed:(id)sender;
-(IBAction)clickCertificateSelectionBehavior:(id)sender;
-(IBAction)showCertificates:(id)sender;
@end

View File

@ -41,10 +41,11 @@
#include "nsIPref.h"
// prefs for showing security dialogs
#define WEAK_SITE_PREF "security.warn_entering_weak"
#define LEAVE_SITE_PREF "security.warn_leaving_secure"
#define MIXEDCONTENT_PREF "security.warn_viewing_mixed"
const unsigned int kSelectAutomaticallyMatrixRowValue = 0;
const unsigned int kAskEveryTimeMatrixRowValue = 1;
@implementation OrgMozillaChimeraPreferenceSecurity
@ -59,14 +60,20 @@
PRBool leaveEncrypted = PR_TRUE;
mPrefService->GetBoolPref(LEAVE_SITE_PREF, &leaveEncrypted);
[mLeaveEncrypted setState:(leaveEncrypted ? NSOnState : NSOffState)];
PRBool loadLowGrade = PR_TRUE;
mPrefService->GetBoolPref(WEAK_SITE_PREF, &loadLowGrade);
[mLoadLowGrade setState:(loadLowGrade ? NSOnState : NSOffState)];
PRBool viewMixed = PR_TRUE;
mPrefService->GetBoolPref(MIXEDCONTENT_PREF, &viewMixed);
[mViewMixed setState:(viewMixed ? NSOnState : NSOffState)];
BOOL gotPref;
NSString* certificateBehavior = [self getStringPref:"security.default_personal_cert" withSuccess:&gotPref];
if (gotPref) {
if ([certificateBehavior isEqual:@"Select Automatically"])
[mCertificateBehavior selectCellAtRow:kSelectAutomaticallyMatrixRowValue column:0];
else if ([certificateBehavior isEqual:@"Ask Every Time"])
[mCertificateBehavior selectCellAtRow:kAskEveryTimeMatrixRowValue column:0];
}
}
@ -96,16 +103,21 @@
[self setPref:MIXEDCONTENT_PREF toBoolean:[sender state] == NSOnState];
}
-(IBAction) clickEnableLoadLowGrade:(id)sender
{
[self setPref:WEAK_SITE_PREF toBoolean:[sender state] == NSOnState];
}
-(IBAction) clickEnableLeaveEncrypted:(id)sender
{
[self setPref:LEAVE_SITE_PREF toBoolean:[sender state] == NSOnState];
}
-(IBAction)clickCertificateSelectionBehavior:(id)sender
{
unsigned int row = [mCertificateBehavior selectedRow];
if (row == kSelectAutomaticallyMatrixRowValue)
[self setPref:"security.default_personal_cert" toString:@"Select Automatically"];
else // row == kAskEveryTimeMatrixRowValue
[self setPref:"security.default_personal_cert" toString:@"Ask Every Time"];
}
-(IBAction)showCertificates:(id)sender
{
// we'll just fire off a notification and let the application show the UI