mirror of
https://github.com/MacPass/MacPass.git
synced 2026-02-02 05:18:15 +00:00
Disable and enable the UI according to type settings
This commit is contained in:
@@ -33,7 +33,6 @@ typedef NS_ENUM(NSUInteger, MPOTPUpdateSource) {
|
|||||||
MPOTPUpdateSourceTimeSlice,
|
MPOTPUpdateSourceTimeSlice,
|
||||||
MPOTPUpdateSourceType,
|
MPOTPUpdateSourceType,
|
||||||
MPOTPUpdateSourceEntry
|
MPOTPUpdateSourceEntry
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, MPOTPType) {
|
typedef NS_ENUM(NSUInteger, MPOTPType) {
|
||||||
@@ -63,6 +62,19 @@ typedef NS_ENUM(NSUInteger, MPOTPType) {
|
|||||||
if(sender != self.typePopUpButton) {
|
if(sender != self.typePopUpButton) {
|
||||||
return; // wrong sender
|
return; // wrong sender
|
||||||
}
|
}
|
||||||
|
MPOTPType type = self.typePopUpButton.selectedItem.tag;
|
||||||
|
switch(type) {
|
||||||
|
case MPOTPTypeRFC:
|
||||||
|
case MPOTPTypeSteam:
|
||||||
|
self.algorithmPopUpButton.enabled = NO;
|
||||||
|
self.digitCountPopUpButton.enabled = NO;
|
||||||
|
self.timeStepStepper.enabled = NO;
|
||||||
|
break;
|
||||||
|
case MPOTPTypeCustom:
|
||||||
|
self.algorithmPopUpButton.enabled = YES;
|
||||||
|
self.digitCountPopUpButton.enabled = YES;
|
||||||
|
self.timeStepStepper.enabled = YES;
|
||||||
|
}
|
||||||
[self _updateView:MPOTPUpdateSourceType];
|
[self _updateView:MPOTPUpdateSourceType];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +85,16 @@ typedef NS_ENUM(NSUInteger, MPOTPType) {
|
|||||||
[self _updateView:MPOTPUpdateSourceQRImage];
|
[self _updateView:MPOTPUpdateSourceQRImage];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)cancel:(id)sender {
|
||||||
|
[self.presentingViewController dismissViewController:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)save:(id)sender {
|
||||||
|
// Update entry settings!
|
||||||
|
// adhere to change observation for history?
|
||||||
|
[self.presentingViewController dismissViewController:self];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)_setupView {
|
- (void)_setupView {
|
||||||
/* algorithm */
|
/* algorithm */
|
||||||
NSMenuItem *sha1Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA1", "SHA 1 hash algoritm menu item") action:NULL keyEquivalent:@""];
|
NSMenuItem *sha1Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA1", "SHA 1 hash algoritm menu item") action:NULL keyEquivalent:@""];
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
|
<customView misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="354" height="362"/>
|
<rect key="frame" x="0.0" y="0.0" width="324" height="362"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<gridView horizontalHuggingPriority="251" xPlacement="leading" yPlacement="center" rowAlignment="firstBaseline" rowSpacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="4gl-4p-0WY">
|
<gridView horizontalHuggingPriority="251" xPlacement="leading" yPlacement="center" rowAlignment="firstBaseline" rowSpacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="4gl-4p-0WY">
|
||||||
<rect key="frame" x="20" y="60" width="314" height="282"/>
|
<rect key="frame" x="20" y="60" width="284" height="282"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="GJN-85-eYH" firstAttribute="trailing" secondItem="Bt8-9X-91R" secondAttribute="trailing" id="9fv-9s-YwU"/>
|
<constraint firstItem="GJN-85-eYH" firstAttribute="trailing" secondItem="Bt8-9X-91R" secondAttribute="trailing" id="9fv-9s-YwU"/>
|
||||||
<constraint firstItem="AdN-zI-C65" firstAttribute="top" secondItem="caF-Au-ey8" secondAttribute="bottom" constant="8" symbolic="YES" id="GFv-3D-Ejx"/>
|
<constraint firstItem="AdN-zI-C65" firstAttribute="top" secondItem="caF-Au-ey8" secondAttribute="bottom" constant="8" symbolic="YES" id="GFv-3D-Ejx"/>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
</gridCell>
|
</gridCell>
|
||||||
<gridCell row="leK-j9-Cah" column="Ecc-pj-MX9" headOfMergedCell="q9e-Zx-LIY" yPlacement="center" id="q9e-Zx-LIY">
|
<gridCell row="leK-j9-Cah" column="Ecc-pj-MX9" yPlacement="center" id="q9e-Zx-LIY">
|
||||||
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bt8-9X-91R">
|
<textField key="contentView" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bt8-9X-91R">
|
||||||
<rect key="frame" x="109" y="148" width="150" height="21"/>
|
<rect key="frame" x="109" y="148" width="150" height="21"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
</gridCell>
|
</gridCell>
|
||||||
<gridCell row="leK-j9-Cah" column="aZO-dP-SsW" headOfMergedCell="q9e-Zx-LIY" id="gOO-ed-C7I"/>
|
<gridCell row="leK-j9-Cah" column="aZO-dP-SsW" id="gOO-ed-C7I"/>
|
||||||
<gridCell row="J7I-Uw-OQv" column="Ar1-qh-iHT" id="LYj-ea-Ou9">
|
<gridCell row="J7I-Uw-OQv" column="Ar1-qh-iHT" id="LYj-ea-Ou9">
|
||||||
<textField key="contentView" horizontalHuggingPriority="252" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W8L-ah-Kdc">
|
<textField key="contentView" horizontalHuggingPriority="252" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W8L-ah-Kdc">
|
||||||
<rect key="frame" x="71" y="121" width="34" height="16"/>
|
<rect key="frame" x="71" y="121" width="34" height="16"/>
|
||||||
@@ -115,6 +115,9 @@
|
|||||||
<font key="font" metaFont="menu"/>
|
<font key="font" metaFont="menu"/>
|
||||||
<menu key="menu" id="ger-Fr-8BF"/>
|
<menu key="menu" id="ger-Fr-8BF"/>
|
||||||
</popUpButtonCell>
|
</popUpButtonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="changeType:" target="-2" id="0cg-oY-afM"/>
|
||||||
|
</connections>
|
||||||
</popUpButton>
|
</popUpButton>
|
||||||
</gridCell>
|
</gridCell>
|
||||||
<gridCell row="J7I-Uw-OQv" column="aZO-dP-SsW" id="mka-sc-dDD"/>
|
<gridCell row="J7I-Uw-OQv" column="aZO-dP-SsW" id="mka-sc-dDD"/>
|
||||||
@@ -210,14 +213,17 @@
|
|||||||
</gridCells>
|
</gridCells>
|
||||||
</gridView>
|
</gridView>
|
||||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ppm-aD-yti">
|
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ppm-aD-yti">
|
||||||
<rect key="frame" x="223" y="13" width="118" height="32"/>
|
<rect key="frame" x="193" y="13" width="118" height="32"/>
|
||||||
<buttonCell key="cell" type="push" title="Save Settings" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="YGn-qt-RrI">
|
<buttonCell key="cell" type="push" title="Save Settings" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="YGn-qt-RrI">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="save:" target="-2" id="k3D-gK-Tch"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5a5-df-HAb">
|
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5a5-df-HAb">
|
||||||
<rect key="frame" x="149" y="13" width="76" height="32"/>
|
<rect key="frame" x="119" y="13" width="76" height="32"/>
|
||||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ynh-bE-30s">
|
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ynh-bE-30s">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -225,6 +231,9 @@
|
|||||||
Gw
|
Gw
|
||||||
</string>
|
</string>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="cancel:" target="-2" id="Z99-2L-Le6"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
@@ -238,7 +247,7 @@ Gw
|
|||||||
<constraint firstItem="4gl-4p-0WY" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="g3C-GL-weQ"/>
|
<constraint firstItem="4gl-4p-0WY" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="g3C-GL-weQ"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="Ppm-aD-yti" secondAttribute="trailing" constant="20" symbolic="YES" id="gxW-QO-gFu"/>
|
<constraint firstAttribute="trailing" secondItem="Ppm-aD-yti" secondAttribute="trailing" constant="20" symbolic="YES" id="gxW-QO-gFu"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<point key="canvasLocation" x="-1272" y="-930"/>
|
<point key="canvasLocation" x="-1402" y="-1030"/>
|
||||||
</customView>
|
</customView>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
Reference in New Issue
Block a user