ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Source/MiscKit/MiscInfoController.m

This is MiscInfoController.m in view mode; [Download] [Up]

//
//	MiscInfoController.m -- a class to handle the guts under an Info menu
//		Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
//				Version 1.2.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import <misckit/misckit.h>

#define mailMessage [strings valueForStringKey:"MailMessage"]
#define authorEmail [strings valueForStringKey:"AuthorEMail"]
#define authorName [strings valueForStringKey:"AuthorName"]

@implementation MiscInfoController

- init
{
	if (![super init]) return nil;
	strings = nil;
	info = nil;
	orderForm = nil;
	registration = nil;
	_licenseFileName = [MiscString newWithString:"/License.rtfd"];
	_releaseNotesFileName = [MiscString newWithString:"/ReleaseNotes.rtfd"];
	return self;
}

- free
{
	[_releaseNotesFileName free];
	[_licenseFileName free];
	return [super free];
}

- (MiscString *)licenseFile { return [_licenseFileName copy]; }
- (MiscString *)releaseNotesFile { return [_releaseNotesFileName copy]; }
- setLicenseFile:(MiscString *)aPath
{
	[_licenseFileName takeStringValueFrom:aPath];
	return self;
}

- setReleaseNotesFile:(MiscString *)aPath
{
	[_releaseNotesFileName takeStringValueFrom:aPath];
	return self;
}

- strings
{
	// attempt to get the string table if it isn't already set up.
	// Try (1) .lproj directories or (2) app delegate.
	if (!strings) {
		// .lproj?
	}
	if (!strings) {
		// NXApp?
		if ([NXApp respondsTo:@selector(strings)])
			strings = [NXApp strings];
	}
	if (!strings) {
		// [NXApp delegate]?
		if ([[NXApp delegate] respondsTo:@selector(strings)])
			strings = [[NXApp delegate] strings];
	}
	return strings;
}

- info
{
	if (!info) { // create the object if needed
		info = [[MiscInfo alloc] init];
		[info setController:self];
	}
	return info;
}

- orderForm		// return the orderFormPanel, load it if needed.
{
	if (!orderForm) { // create the object if needed
		orderForm = [[MiscOrderForm alloc] init];
		[orderForm setController:self];
	}
	return orderForm;
}

- registration		// return the registerPanel, load it if needed.
{
	if (!registration) { // create the object if needed
		registration = [[MiscRegistration alloc] init];
		[registration setController:self];
	}
	return registration;
}

- info:sender
{ // forward the message on to the MiscInfo object.
	[[self info] info:sender];
	return self;
}

- orderForm:sender
{ // forward the message on to the MiscInfo object.
	[[self orderForm] orderForm:sender];
	return self;
}

- registration:sender
{ // forward the message on to the MiscInfo object.
	[[self registration] registration:sender];
	return self;
}

- releaseNotes:sender	// make the README panel be up there.
{
	id helpPanel = [NXHelpPanel new];
	id path = [MiscString newWithString:[helpPanel helpDirectory]];
	[path concatenate:_releaseNotesFileName];
	[helpPanel showFile:[path stringValue] atMarker:NULL];
	[helpPanel makeKeyAndOrderFront:self];
	[path free];
	return self;
}

- license:sender	// make the license panel be up there.
{
	id helpPanel = [NXHelpPanel new];
	id path = [MiscString newWithString:[helpPanel helpDirectory]];
	[path concatenate:_licenseFileName];
	[helpPanel showFile:[path stringValue] atMarker:NULL];
	[helpPanel makeKeyAndOrderFront:self];
	[path free];
	return self;
}

- suggestion:sender	// This is pretty much lifted from Opener.
{
	id to, body = [[MiscString alloc] init];
	id subject = [[MiscString alloc] init];

	[self strings]; // make sure we have a string table
	// now we prepare the message to send
	to = [MiscString newWithString:authorEmail];
    [subject setFromFormat:"Comments and suggestions for ``%s'' ",
			[NXApp appName]];
	[subject catStrings:[info versionString], " (",
			[registration serialNumber], ")", NULL];
	[body setFromFormat:mailMessage, authorName, [NXApp appName]];
    [body catStrings:[NXApp userRealName], "\n", NULL];

	[MISC_MAILAPP sendMailTo:to subject:subject body:body];
    FREE_OBJECT(subject);
    FREE_OBJECT(body);
    FREE_OBJECT(to);
    return self;
}

- hideOrShowMenus:sender
{
    [[MiscExplodingMenu sharedInstance] explodeMenus:sender];
    return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.