forked from sparkle-project/Sparkle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6960045
commit 4ba453f
Showing
10 changed files
with
2,118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// SUPasswordPrompt.h | ||
// Sparkle | ||
// | ||
// Created by rudy on 8/18/09. | ||
// Copyright 2009 Ambrosia Software, Inc.. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "Sparkle/SUWindowController.h" | ||
|
||
@interface SUPasswordPrompt : SUWindowController | ||
{ | ||
IBOutlet NSImageView *mIconView; | ||
IBOutlet NSTextField *mTextDescription; | ||
IBOutlet NSSecureTextField *mPasswordField; | ||
NSString *mPassword; | ||
NSString *mName; | ||
NSImage *mIcon; | ||
} | ||
|
||
- (id)initWithHost:(SUHost *)aHost; | ||
- (void)awakeFromNib; | ||
- (void)setName:(NSString*)name; | ||
- (NSString*)name; | ||
- (void)setIcon:(NSImage*)icon; | ||
- (NSImage*)icon; | ||
- (NSString *)password; | ||
- (void)setPassword:(NSString*)password; | ||
- (NSInteger)run; | ||
- (IBAction)accept:(id)sender; | ||
- (IBAction)cancel:(id)sender; | ||
- (void)replaceTitle:(NSString*)name; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// | ||
// SUPasswordPrompt.m | ||
// Sparkle | ||
// | ||
// Created by rudy on 8/18/09. | ||
// Copyright 2009 Ambrosia Software, Inc.. All rights reserved. | ||
// | ||
|
||
#import "SUPasswordPrompt.h" | ||
|
||
|
||
@implementation SUPasswordPrompt | ||
|
||
- (id)initWithHost:(SUHost *)aHost | ||
{ | ||
self = [super initWithHost:aHost windowNibName:@"SUPasswordPrompt"]; | ||
if (self) | ||
{ | ||
[self setName:[aHost name]]; | ||
[self setIcon:[aHost icon]]; | ||
mPassword = nil; | ||
[self setShouldCascadeWindows:NO]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)awakeFromNib | ||
{ | ||
[self replaceTitle:[self name]]; | ||
[mIconView setImage:[self icon]]; | ||
} | ||
|
||
- (void)setName:(NSString*)name | ||
{ | ||
[mName release]; | ||
mName = [name retain]; | ||
} | ||
|
||
- (NSString*)name | ||
{ | ||
return mName; | ||
} | ||
|
||
- (void)setIcon:(NSImage*)icon | ||
{ | ||
[mIcon release]; | ||
mIcon = [icon retain]; | ||
} | ||
|
||
- (NSImage*)icon | ||
{ | ||
return mIcon; | ||
} | ||
|
||
- (NSString *)password | ||
{ | ||
return mPassword; | ||
} | ||
|
||
- (void)setPassword:(NSString*)password | ||
{ | ||
[mPassword release]; | ||
mPassword = [password retain]; | ||
} | ||
|
||
- (NSInteger)run | ||
{ | ||
//modally run a password prompt | ||
NSInteger result = [NSApp runModalForWindow:[self window]]; | ||
if(result) | ||
[self setPassword:[mPasswordField stringValue]]; | ||
return result; | ||
} | ||
|
||
- (IBAction)accept:(id)sender | ||
{ | ||
[[self window] orderOut:self]; | ||
[NSApp stopModalWithCode:1]; | ||
} | ||
|
||
- (IBAction)cancel:(id)sender | ||
{ | ||
[[self window] orderOut:self]; | ||
[NSApp stopModalWithCode:0]; | ||
} | ||
|
||
- (void)replaceTitle:(NSString*)name | ||
{ | ||
NSString *textString = [mTextDescription stringValue]; | ||
NSString *replacementString = [textString stringByReplacingOccurrencesOfString:@"<APPLICATION>" withString:name]; | ||
[mTextDescription setStringValue:replacementString]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.