// Text of project E:\DOCS\Dev\Newton\NewtPGP\NewtPGP.ntk written on: 02/19/98 21:49:46 // Beginning of text file constants.txt /* JKD - 8/9/97 - Some of the following code came from the MiniMail code provided by Apple DTS */ constant kPGP2PubKeyViewDefSym := '|PGP2PubKey:Names:Rubicon|; constant kPGP2PubKeySlotSym := '|PGP2PubKey:Names:Rubicon|; // End of text file E:\DOCS\Dev\Newton\NewtPGP\constants.txt // Beginning of file PGP2PubKeyViewDef.lyt PGP2KeyViewDefSym := {viewBounds: {left: 0, top: 0, bottom: 312, right: 232}, viewFlags: 1, viewFormat: 0, infoFrame: { checkPaths: [kPGP2PubKeySlotSym], checkPrefix: [true, nil], formatFunc: func(data) begin if StrFilled(data[0]) then "PGP (v2.x) Public Key: (Tap here to view)" else ""; end, }, type: 'editor, name: "PGP v2 Public Key", protection: 'private, symbol: kPGP2PubKeyViewDefSym, debug: "PGP2KeyViewDefSym", viewClass: 74 }; PGP2KeyText := /* child of PGP2KeyViewDefSym */ {path: kPGP2PubKeySlotSym, viewJustify: 8240, viewBounds: {left: 0, top: 0, bottom: 292, right: 0}, viewFormat: 20480, viewFont: simpleFont9, debug: "PGP2KeyText", _proto: @415 }; constant |layout_PGP2PubKeyViewDef.lyt| := PGP2KeyViewDefSym; // End of file PGP2PubKeyViewDef.lyt // Beginning of text file Install and Remove.txt /* JKD - 8/9/97 - Some of the following code came from the MiniMail code provided by Apple DTS */ InstallScript := func(partFrame, removeFrame) begin // We created a reference to our protoTransport object using // SetPartFrameSlot. See the "NewtPGPTransport.lyt" layout's beforeScript. RegTransport(kAppSymbol, partFrame.(kAppSymbol)); // Code for registering a field in the names app local dataDefSym := EnsureInternal('person); RegisterViewDef(GetLayout("PGP2PubKeyViewDef"), dataDefSym); end; RemoveScript := func(removeFrame) begin UnRegTransport(kAppSymbol); // Code for cleaning up PGP field in names app UnRegisterViewDef(kPGP2PubKeyViewDefSym, 'person); end; SetPartFrameSlot('DeletionScript, func(removeFrame) begin // If the user scrubs out the package, this function will be called. // We do NOT want to do this during debugging because it will be called often. // When you download a new version with NTK, it will delete the old one // and call it's DeletionScript. Note that DeleteTransport removes the preferences // for the transport! Here, you might want to delete your temporary data (in our // case, we might delete our temp soups entirely) if NOT kDebugOn then DeleteTransport(kAppSymbol) end); // End of text file E:\DOCS\Dev\Newton\NewtPGP\Install and Remove.txt // Beginning of file MailSlip.lyt NewtPGPSlip := {viewBounds: {left: 8, top: 24, right: 232, bottom: 288}, PrepareToSend: func(when) begin local item := fields; if (not toLine.selected or (length(toLine.selected) = 0)) then :Notify(kNotifyAlert, kAppName, "You must select a recipient"); // extract information from your 'recipient pickers' and add them to the item item.toRef := toLine.selected; item.cc := ccLine.selected; if not TargetIsCursor(item.body) then call kItemToTextFunc with (item, target, kAppSymbol, true, nil); inherited:?PrepareToSend(when); // inherited method submits item via :ContinueSend... Print(item); end;, OwnerInfoChanged: // OwnerInfoChanged is called when the user changes the sender // (the picker in the upper-left hand corner of the route slip) func() begin local item := fields; // get sender info ("who am I") local persona := GetUserConfig('currentPersona); // find the data definition for our addressing class (for instance, '|nameRef.email|) local dataDef := GetDataDefs(transport.addressingClass); // store the sender info in the item's fromRef slot if dataDef then item.fromRef := dataDef:MakeNameRef(persona, transport.addressingClass); item; end, debug: "NewtPGPSlip", _proto: @655 }; toLine := /* child of NewtPGPSlip */ {viewBounds: {left: 50, top: 45, right: -10, bottom: 60}, text: "To:", OtherText: "Other Names", selected: nil, alternatives: nil, single: nil, class: '|nameRef.email|, _picker: protoPeoplePopup, viewJustify: 8388656, debug: "toLine", _proto: @259 }; // View toLine is declared to NewtPGPSlip ccLine := /* child of NewtPGPSlip */ {viewBounds: {left: 50, top: 60, right: -10, bottom: 75}, text: "Cc:", OtherText: "Other Names", selected: nil, alternatives: nil, single: nil, class: '|nameRef.email|, _picker: protoPeoplePopup, viewJustify: 8388656, debug: "ccLine", _proto: @259 }; // View ccLine is declared to NewtPGPSlip constant |layout_MailSlip.lyt| := NewtPGPSlip; // End of file MailSlip.lyt // Beginning of file NewtPGPTransport.lyt // Before Script for "NewtPGPTransport" /* ** Newton Developer Technical Support Sample Code ** ** MinMail, a Newton 2.0 transport example ** ** by J. Christopher Bell, Newton Developer Technical Support ** ** Copyright © 1994-6 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ NewtPGPTransport := {actionTitle: "Send", appSymbol: kAppSymbol, CancelRequest: func(why) begin // Most REAL transports would set a flag here and/or notify their protoBasicEndpoint that the user wants to cancel. end, dataTypes: [ 'text ]; // We only support sending text, not 'frame (like Beam) or 'view (like Print and Fax) , icon: BuildPictureViewSlot({ imageFile1: "NewtPGPIcon.bmp", imageFile2: "NewtPGPIcon16.BMP", maskOption: 0}), routingSlip: GetLayout("MailSlip.lyt");, title: kAppName, viewBounds: {left: 10, top: 10, right: 250, bottom: 250}, preferencesForm: // This slot is supposed to be optional. However, on some ROMs there is a bug // which requires the appSymbol value to be present in the preferencesForm frame. { _proto: protoTransportPrefs, appSymbol: kAppSymbol }, VerifyRoutingInfo: // This method is called multiple times when multiple items are selected from an overview. func(item, default, target, format) begin // Export the item to text call kItemToTextFunc with (item, target, kAppSymbol, true, nil); return nil; // if error, return true from VerifyRoutingInfo end;, NewItem: func(context) begin // first call inherited transport method to get default new item local item := inherited:NewItem(context); // get sender info ("who am I") local persona:= GetUserConfig('currentPersona); // find the data definition for our addressing class (for instance, '|nameRef.email|) local dataDef := GetDataDefs(addressingClass); // store the sender info in the item's fromRef slot if dataDef then item.fromRef := dataDef:MakeNameRef(persona, addressingClass); // add other slots info here, if necessary if kDebugOn then Print(item); item; end;, addressingClass: '|nameRef.email|, group: 'cryptMail, groupTitle: "Mail w/ PGP", groupIcon: BuildPictureViewSlot({ imageFile1: "NewtPGPIcon.bmp", imageFile2: "NewtPGPIcon16.BMP", imageFile4: "NewtPGPIcon16.BMP", imageFile8: "NewtPGPIcon16.BMP", maskOption: 0}), SendRequest: func(request) begin // Do I encrypt the text here? end, debug: "NewtPGPTransport", _proto: @389 }; // After Script for "NewtPGPTransport" thisView := NewtPGPTransport; // reference this layout in the part frame. See this part's installScript to see how this is used. SetPartFrameSlot(kAppSymbol, thisView); // NTK adds a viewBounds slot to this layout, but it's unnecessary. RemoveSlot(thisview, 'viewBounds); constant |layout_NewtPGPTransport.lyt| := NewtPGPTransport; // End of file NewtPGPTransport.lyt