Prominent notice in TFUSBController.m.
[MacTF.git] / UKFeedbackProvider.m
blob0a338649abed2271264dc507a333794a2c9e12a7
1 //
2 //  UKFeedbackProvider.m
3 //  NiftyFeatures
4 //
5 //  Created by Uli Kusterer on Mon Nov 24 2003.
6 //  Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
7 //
9 #import "UKFeedbackProvider.h"
10 #import <Message/NSMailDelivery.h>
13 @implementation UKFeedbackProvider
16 -(void) dealloc
18         // Release all top-level objects from our NIB:
19         [feedbackWindow release];
20         [super dealloc];
23 -(IBAction) sendFeedback: (id)sender
25         [self orderFrontFeedbackWindow: sender];
28 -(IBAction) orderFrontFeedbackWindow: (id)sender
30         if( !feedbackWindow )
31                 [NSBundle loadNibNamed: @"UKFeedbackProvider" owner: self];
32         [feedbackWindow makeKeyAndOrderFront: sender];
36 -(IBAction) sendFeedbackButtonAction: (id)sender
38         NSString*               msgText = [messageText string];
39         NSString*               msgSubjPre = NSLocalizedString(@"FEEDBACK_SUBJECT_PREFIX", @"Prefix to use in front of subject so you can filter by it.");
40         NSString*               msgSubj = [msgSubjPre stringByAppendingString: [subjectField stringValue]];
41         NSString*               msgDest = NSLocalizedString(@"FEEDBACK_EMAIL", @"E-Mail address user's feedack should be sent to.");
42         
43         if( ![NSMailDelivery deliverMessage: msgText subject: msgSubj to: msgDest] )
44         {
45                 NSBeginAlertSheet( NSLocalizedString(@"Couldn't send message", @"FEEDBACK_ERROR_TITLE"),
46                                                         NSLocalizedString(@"OK",@"FEEDBACK_ERRORR_BUTTON"), nil, nil,
47                                                         feedbackWindow, self, @selector(errorSheetDidEnd:returnCode:contextInfo:), 0, nil,
48                                                         NSLocalizedString(@"An error occurred while trying to send off your bug report, try using your e-mail client instead.", @"FEEDBACK_ERROR_MESSAGE"));
49         }
50         else
51                 [self closeFeedbackWindow: sender];
55 -(void) errorSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
57         
61 -(IBAction) closeFeedbackWindow: (id)sender
63         [messageText setString: @""];
64         [subjectField selectItemAtIndex: 0];
65         [feedbackWindow orderOut: sender];
69 -(IBAction) openURL: (id)sender
71         // This URL may be a "mailto:user@domain.net?subject=Feedback%20about%20NiftyFeatures" URL as well:
72         [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: NSLocalizedString(@"FEEDBACK_URL", @"URL where the user can provide feedback.")]];
76 @end