Skip to content

Commit

Permalink
missing files, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWillner committed Mar 8, 2011
1 parent edddecb commit 529b229
Show file tree
Hide file tree
Showing 10 changed files with 1,971 additions and 2,891 deletions.
2 changes: 1 addition & 1 deletion Dependencies/GPGTools_Core
1,131 changes: 18 additions & 1,113 deletions English.lproj/MainMenu.nib/designable.nib

Large diffs are not rendered by default.

Binary file modified English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown.
1,909 changes: 1,909 additions & 0 deletions English.lproj/RecipientWindow.xib

Large diffs are not rendered by default.

63 changes: 30 additions & 33 deletions GPGServices.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "GPGServices.h"

#import "RecipientWindowController.h"

@implementation GPGServices

-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
Expand Down Expand Up @@ -134,55 +136,48 @@ -(NSString *)encryptTextString:(NSString *)inputString
{
GPGData *inputData, *outputData;
GPGContext *aContext = [[GPGContext alloc] init];
NSMutableArray *recipients = [[NSMutableArray alloc] init];
BOOL trustsAllKeys = NO;
BOOL sign = NO;

NSString* testPattern = @"moritz";

BOOL trustsAllKeys = YES;

[aContext setUsesArmor:YES];

[recipients addObjectsFromArray:[[aContext keyEnumeratorForSearchPattern:testPattern secretKeysOnly:NO] allObjects]];

RecipientWindowController* rcp = [[RecipientWindowController alloc] init];

//for(GPGKey* k in recipients)
// NSLog(@"%@", [k email]);
//NSLog(@"recipients: %@", recipients);

//todo: just ask the user for recipients and whether we should sign the text
//[self displayMessageWindowWithTitleText:@"BLABLABLA Encryption not implemented" bodyText:@"Please implement this funcionality if you're an developer."];
//[NSApp runModalForWindow:recipientWindow];
//[recipientWindow close];

inputData=[[GPGData alloc] initWithDataNoCopy:[inputString dataUsingEncoding:NSUTF8StringEncoding]];

NS_DURING
if(sign)
outputData=[aContext encryptedSignedData:inputData withKeys:recipients trustAllKeys:trustsAllKeys];
else
outputData=[aContext encryptedData:inputData withKeys:recipients trustAllKeys:trustsAllKeys];
NS_HANDLER
int ret = [rcp runModal];
if(ret != 0) {
[self displayMessageWindowWithTitleText:@"Encryption cancelled." bodyText:@"Encryption was cancelled."];
[aContext release];
return nil;
} else {
inputData=[[GPGData alloc] initWithDataNoCopy:[inputString dataUsingEncoding:NSUTF8StringEncoding]];
BOOL sign = rcp.sign;
NSArray* recipients = rcp.selectedKeys;
NS_DURING
if(sign)
outputData=[aContext encryptedSignedData:inputData withKeys:recipients trustAllKeys:trustsAllKeys];
else
outputData=[aContext encryptedData:inputData withKeys:recipients trustAllKeys:trustsAllKeys];
NS_HANDLER
outputData = nil;
switch(GPGErrorCodeFromError([[[localException userInfo] objectForKey:@"GPGErrorKey"] intValue]))
{
case GPGErrorNoData:
[self displayMessageWindowWithTitleText:@"Encryption failed." bodyText:@"No encryptable text was found within the selection."];
break;
case GPGErrorCancelled:
[self displayMessageWindowWithTitleText:@"Encryption cancelled." bodyText:@"Encryption was cancelled."];
break;
default:
[self displayMessageWindowWithTitleText:@"Encryption failed." bodyText:[NSString stringWithFormat:@"%@",GPGErrorDescription([[[localException userInfo] objectForKey:@"GPGErrorKey"] intValue])]];
for(GPGKey* key in [[aContext operationResults] objectForKey:@"keyErrors"])
NSLog(@"key: %@, error: %@", [key email], GPGErrorDescription([[[aContext operationResults] objectForKey:key] intValue]));
}
[inputData release];
[aContext release];
[recipients release];

return nil;
NS_ENDHANDLER
NS_ENDHANDLER
}

[inputData release];
[recipients release];
[aContext release];

return [[[NSString alloc] initWithData:[outputData data] encoding:NSUTF8StringEncoding] autorelease];
Expand Down Expand Up @@ -445,8 +440,10 @@ -(NSString *)context:(GPGContext *)context passphraseForKey:(GPGKey *)key again:
}


-(IBAction)closeModalWindow:(id)sender
{[NSApp stopModalWithCode:[sender tag]];}
-(IBAction)closeModalWindow:(id)sender{
[NSApp stopModalWithCode:[sender tag]];
[recipientWindow close];
}



Expand Down
12 changes: 9 additions & 3 deletions GPGServices.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
2260756D12EBA0B50026DBEA /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2260756C12EBA0B50026DBEA /* Icon.icns */; };
22D6D9CB13267E0C00622189 /* RecipientWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22D6D9CA13267E0C00622189 /* RecipientWindowController.m */; };
4B1906F80A4CBD6C00052798 /* MacGPGME.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B1906F70A4CBD6C00052798 /* MacGPGME.framework */; };
4B1907010A4CBDAF00052798 /* MacGPGME.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B1906F70A4CBD6C00052798 /* MacGPGME.framework */; };
4B1908C20A4CBF0B00052798 /* GPGServices.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B1908C00A4CBF0B00052798 /* GPGServices.m */; };
Expand Down Expand Up @@ -67,6 +68,8 @@
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
2260756C12EBA0B50026DBEA /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.icns; sourceTree = "<group>"; };
22CA686F12DFD8D300ED919C /* MacGPGME.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MacGPGME.xcodeproj; path = Dependencies/MacGPGME/MacGPGME.xcodeproj; sourceTree = "<group>"; };
22D6D9C913267E0C00622189 /* RecipientWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecipientWindowController.h; sourceTree = "<group>"; };
22D6D9CA13267E0C00622189 /* RecipientWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecipientWindowController.m; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
Expand All @@ -76,7 +79,7 @@
4B1908BF0A4CBF0B00052798 /* GPGServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPGServices.h; sourceTree = "<group>"; };
4B1908C00A4CBF0B00052798 /* GPGServices.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPGServices.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* GPGServices.service */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GPGServices.service; sourceTree = BUILT_PRODUCTS_DIR; };
8D1107320486CEB800E47090 /* GPGServices.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GPGServices.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -95,6 +98,8 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
22D6D9C913267E0C00622189 /* RecipientWindowController.h */,
22D6D9CA13267E0C00622189 /* RecipientWindowController.m */,
4B1908BF0A4CBF0B00052798 /* GPGServices.h */,
4B1908C00A4CBF0B00052798 /* GPGServices.m */,
);
Expand Down Expand Up @@ -123,7 +128,7 @@
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* GPGServices.service */,
8D1107320486CEB800E47090 /* GPGServices.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -208,7 +213,7 @@
name = GPGServices;
productInstallPath = "$(HOME)/Applications";
productName = GPGServices;
productReference = 8D1107320486CEB800E47090 /* GPGServices.service */;
productReference = 8D1107320486CEB800E47090 /* GPGServices.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -285,6 +290,7 @@
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
4B1908C20A4CBF0B00052798 /* GPGServices.m in Sources */,
22D6D9CB13267E0C00622189 /* RecipientWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 529b229

Please sign in to comment.