cog/Feedback/FeedbackController.m

78 lines
2.1 KiB
Matlab
Raw Normal View History

2005-06-02 18:16:43 +00:00
//
// FeedbackController.m
// Cog
//
// Created by Vincent Spader on 3/26/05.
2005-07-02 21:02:06 +00:00
// Copyright 2005 Vincent Spader All rights reserved.
2005-06-02 18:16:43 +00:00
//
#import "FeedbackController.h"
@implementation FeedbackController
- (IBAction)openFeedbackWindow:(id)sender
{
[fromView setStringValue:@""];
[subjectView setStringValue:@""];
[messageView setString:@""];
[feedbackWindow makeFirstResponder:fromView];
[feedbackWindow makeKeyAndOrderFront: sender];
}
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (contextInfo == YES)
{
[feedbackWindow close];
}
2005-06-02 18:16:43 +00:00
}
- (void)FeedbackErrorOccurred:(NSNotification *)aNotification
{
DBLog(@"Error sending feedback");
[sendingIndicator stopAnimation:self];
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
2005-07-11 20:22:53 +00:00
[alert setMessageText:NSLocalizedString(@"FeedbackFailedMessageText", @"")];
[alert setInformativeText:NSLocalizedString(@"FeedbackFailedInformativeText", @"")];
2005-06-02 18:16:43 +00:00
[alert beginSheetModalForWindow:feedbackWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:NO];
2005-06-02 18:16:43 +00:00
}
- (void)FeedbackSent:(NSNotification *)aNotification
{
// DBLog(@"Feedback Sent");
[sendingIndicator stopAnimation:self];
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
2005-07-11 20:22:53 +00:00
[alert setMessageText:NSLocalizedString(@"FeedbackSuccessMessageText", @"")];
[alert setInformativeText:NSLocalizedString(@"FeedbackSuccessInformativeText", @"")];
2005-06-02 18:16:43 +00:00
[alert beginSheetModalForWindow:feedbackWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:YES];
2005-06-02 18:16:43 +00:00
}
- (IBAction)sendFeedback:(id)sender
{
// DBLog(@"Sending feedback...");
[sendingIndicator startAnimation:self];
//Using this so that if its a bad connection, it doesnt sit there looking stupid..or should it
feedbackSocket = [[FeedbackSocket alloc] init];
[feedbackSocket setDelegate:self];
[feedbackSocket sendFeedback:[fromView stringValue] subject:[subjectView stringValue] message:[messageView string]];
}
- (IBAction)cancel:(id)sender
{
[feedbackWindow close];
}
@end