Skip to content

Commit

Permalink
Disable contact fields, when unchecked. Switch to bindings for includ…
Browse files Browse the repository at this point in the history
…e email address.

Signed-off-by: Jonathan 'Wolf' Rentzsch <jwr.git@redshed.net>
  • Loading branch information
ddribin authored and rentzsch committed May 2, 2009
1 parent 7b7f735 commit 7f76a3f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 34 deletions.
5 changes: 4 additions & 1 deletion lib/JRFeedbackController.h
Expand Up @@ -17,18 +17,21 @@ typedef enum {
@interface JRFeedbackController : NSWindowController {
IBOutlet NSTextView *textView;
IBOutlet NSButton *includeHardwareDetailsCheckbox;
IBOutlet NSButton *includeEmailAddressCheckbox;
IBOutlet NSTextField *nameTextField;
IBOutlet NSComboBox *emailAddressComboBox;
IBOutlet NSProgressIndicator *progress;

NSAttributedString *sectionStrings[JRFeedbackController_SectionCount];
JRFeedbackController_Section currentSection;
BOOL includeEmailAddress;
}

+ (void)showFeedback;
+ (void)showFeedbackWithBugDetails:(NSString *)details;

- (BOOL)includeEmailAddress;
- (void)setIncludeEmailAddress:(BOOL)flag;

- (IBAction)switchSectionAction:(NSSegmentedControl*)sender;
- (IBAction)submitAction:(id)sender;
- (IBAction)cancelAction:(id)sender;
Expand Down
12 changes: 10 additions & 2 deletions lib/JRFeedbackController.m
Expand Up @@ -41,6 +41,7 @@ - (id)init {
self = [super initWithWindowNibName:@"JRFeedbackProvider"];
if (self) {
//[self window];
includeEmailAddress = YES;
}
return self;
}
Expand Down Expand Up @@ -82,6 +83,13 @@ - (void)windowDidLoad {
}
}

- (BOOL)includeEmailAddress {
return includeEmailAddress;
}
- (void)setIncludeEmailAddress:(BOOL)flag {
includeEmailAddress = flag;
}

- (IBAction)switchSectionAction:(NSSegmentedControl*)sender {
[sectionStrings[currentSection] release];
sectionStrings[currentSection] = [[textView textStorage] copy];
Expand All @@ -92,7 +100,7 @@ - (IBAction)switchSectionAction:(NSSegmentedControl*)sender {
[textView moveDown:self];

if (JRFeedbackController_SupportRequest == currentSection) {
[includeEmailAddressCheckbox setIntValue:YES];
[self setIncludeEmailAddress:YES];
}
}

Expand Down Expand Up @@ -144,7 +152,7 @@ - (void)postFeedback:(NSString*)systemProfile {
}

NSString *email = @"<email suppressed>";
if ([includeEmailAddressCheckbox intValue]) {
if ([self includeEmailAddress]) {
if ([[nameTextField stringValue] length]) {
NSMutableString *name = [[[nameTextField stringValue] mutableCopy] autorelease];
[name replaceOccurrencesOfString:@"\"" withString:@"\\\"" options:0 range:NSMakeRange(0, [name length])];
Expand Down
83 changes: 52 additions & 31 deletions lib/JRFeedbackProvider.xib
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1040</int>
<string key="IBDocument.SystemVersion">9G55</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.InterfaceBuilderVersion">672</string>
<string key="IBDocument.AppKitVersion">949.43</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
Expand All @@ -14,15 +14,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
Expand Down Expand Up @@ -667,14 +658,6 @@ ZWxwIHlvdT8KA</bytes>
</object>
<int key="connectionID">89</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">includeEmailAddressCheckbox</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="10421984"/>
</object>
<int key="connectionID">104</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">emailAddressComboBox</string>
Expand All @@ -685,19 +668,59 @@ ZWxwIHlvdT8KA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">nameTextFiend</string>
<string key="label">nameTextField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="526656399"/>
</object>
<int key="connectionID">111</int>
<int key="connectionID">112</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">nameTextField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="526656399"/>
<object class="IBBindingConnection" key="connection">
<string key="label">value: includeEmailAddress</string>
<reference key="source" ref="10421984"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="10421984"/>
<reference key="NSDestination" ref="1001"/>
<string key="NSLabel">value: includeEmailAddress</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">includeEmailAddress</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">112</int>
<int key="connectionID">113</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: includeEmailAddress</string>
<reference key="source" ref="784824271"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="784824271"/>
<reference key="NSDestination" ref="1001"/>
<string key="NSLabel">enabled: includeEmailAddress</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">includeEmailAddress</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">118</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: includeEmailAddress</string>
<reference key="source" ref="526656399"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="526656399"/>
<reference key="NSDestination" ref="1001"/>
<string key="NSLabel">enabled: includeEmailAddress</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">includeEmailAddress</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">119</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
Expand Down Expand Up @@ -932,12 +955,12 @@ ZWxwIHlvdT8KA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{602, 651}, {492, 428}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<integer value="0"/>
<string>{{602, 651}, {492, 428}}</string>
<reference ref="8"/>
<string>{196, 240}</string>
<string>{{49, 462}, {492, 394}}</string>
<boolean value="YES" id="5"/>
<integer value="1" id="5"/>
<reference ref="5"/>
<string>{492, 5000}</string>
<string>{492, 393}</string>
Expand Down Expand Up @@ -983,7 +1006,7 @@ ZWxwIHlvdT8KA</bytes>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">112</int>
<int key="maxID">119</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -1011,7 +1034,6 @@ ZWxwIHlvdT8KA</bytes>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>emailAddressComboBox</string>
<string>includeEmailAddressCheckbox</string>
<string>includeHardwareDetailsCheckbox</string>
<string>nameTextField</string>
<string>progress</string>
Expand All @@ -1021,7 +1043,6 @@ ZWxwIHlvdT8KA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSComboBox</string>
<string>NSButton</string>
<string>NSButton</string>
<string>NSTextField</string>
<string>NSProgressIndicator</string>
<string>NSTextView</string>
Expand Down

0 comments on commit 7f76a3f

Please sign in to comment.