Exemplo n.º 1
0
void
JCheckExpirationDate
	(
	const time_t		expireTime,
	const JCharacter*	map[],
	const JSize			size
	)
{
	const time_t t = time(NULL);
	if (t > expireTime)
		{
		map[1] = "";
		const JString msg = JGetString(kExpiredID, map, size);
		(JGetUserNotification())->DisplayMessage(msg);
		exit(0);
		}
	else if (t > expireTime - 14*24*3600)
		{
		JCharacter date[100];
		strftime(date, 100, "%B %e, %Y", localtime(&expireTime));
		map[1] = date;
		const JString msg = JGetString(kWarnExpireID, map, size);
		(JGetUserNotification())->DisplayMessage(msg);
		}
}
Exemplo n.º 2
0
JBoolean
GMApp::NewMailbox
	(
	const JCharacter*	filename,
	const JBoolean		openFile
	)
{
	JString path;
	JString name;
	JSplitPathAndName(filename, &path, &name);
	if (path.IsEmpty())
		{
		path = JGetCurrentDirectory();
		}
	if (!(JDirectoryExists(path) && JDirectoryReadable(path)))
		{
		JString notice = "You do not have write permissions in directory \"" + path + "\"";
		JGetUserNotification()->ReportError(notice);
		return kJFalse;
		}
	ofstream os(filename);
	if (!os.good())
		{
		JString notice = "Unable to create file \"" + path + name + "\"";
		JGetUserNotification()->ReportError(notice);
		return kJFalse;
		}
	os.close();
	if (openFile)
		{
		OpenMailbox(filename);
		}
	return kJTrue;
}
void
GXDataDocument::LoadFile
	(
	const JCharacter* fileName
	)
{
	std::ifstream is(fileName);

	if (is.bad())
		{
		JGetUserNotification()->ReportError("Error opening file.");
		}
	else
		{
		const JString str = JReadLine(is);
		if (str == kGloveFileSignature)
			{
			if (!LoadNativeFile(is))
				{
				JGetUserNotification()->ReportError(
					"This file was created by a newer version of Glove.  "
					"You need the newest version in order to open it.");
				}
			}
		else
			{
			is.close();
			FileChanged(fileName, kJFalse);
			itsCurrentFileName = fileName;
			ChooseFileFilter();
			}
		}
}
JBoolean
JXGetNewDirDialog::OKToDeactivate()
{
	if (!JXGetStringDialog::OKToDeactivate())
		{
		return kJFalse;
		}
	else if (Cancelled())
		{
		return kJTrue;
		}

	const JString pathName = GetNewDirName();
	if (JDirectoryExists(pathName))
		{
		(JGetUserNotification())->ReportError(JGetString(kDirectoryExistsID));
		return kJFalse;
		}
	else if (JNameUsed(pathName))
		{
		(JGetUserNotification())->ReportError(JGetString(kNameUsedID));
		return kJFalse;
		}
	else
		{
		return kJTrue;
		}
}
void
JXFSBindingTable::RemovePattern()
{
	JPoint cell;
	if ((GetTableSelection()).GetFirstSelectedCell(&cell))
		{
		if ((itsBindingList->GetBinding(cell.y))->IsSystemBinding())
			{
			JGetUserNotification()->ReportError(JGetString(kCantRemoveSystemBindingID));
			}
		else
			{
			CancelEditing();
			if (itsBindingList->DeleteBinding(cell.y))
				{
				RemoveRow(cell.y);
				}
			else
				{
				TableRefreshRow(cell.y);
				GetWindow()->Update();
				(JGetUserNotification())->DisplayMessage(JGetString(kReplacedBySystemID));
				}
			UpdateButtons();
			Broadcast(DataChanged());
			}
		}
}
JBoolean
JXExprEditor::EIPGetExternalClipboard
	(
	JString* text
	)
{
	text->Clear();

	JBoolean gotData = kJFalse;
	JXSelectionManager* selManager = GetSelectionManager();

	JArray<Atom> typeList;
	if (selManager->GetAvailableTypes(kJXClipboardName, CurrentTime, &typeList))
		{
		JBoolean canGetText = kJFalse;
		Atom textType       = None;

		const JSize typeCount = typeList.GetElementCount();
		for (JIndex i=1; i<=typeCount; i++)
			{
			Atom type = typeList.GetElement(i);
			if (type == XA_STRING ||
				(!canGetText && type == selManager->GetUtf8StringXAtom()))
				{
				canGetText = kJTrue;
				textType   = type;
				break;
				}
			}

		Atom returnType;
		unsigned char* data = NULL;
		JSize dataLength;
		JXSelectionManager::DeleteMethod delMethod;
		if (canGetText &&
			selManager->GetData(kJXClipboardName, CurrentTime, textType,
								&returnType, &data, &dataLength, &delMethod))
			{
			if (returnType == XA_STRING)
				{
				*text = JString(reinterpret_cast<JCharacter*>(data), dataLength);
				gotData = kJTrue;
				}
			selManager->DeleteData(&data, delMethod);
			}
		else
			{
			(JGetUserNotification())->ReportError(
				"Unable to paste the current contents of the X Clipboard.");
			}
		}
	else
		{
		(JGetUserNotification())->ReportError("The X Clipboard is empty.");
		}

	return gotData;
}
Exemplo n.º 7
0
JBoolean
CBCClass::ViewDeclaration
	(
	const JCharacter*	fnName,
	const JBoolean		caseSensitive,
	const JBoolean		reportNotFound
	)
	const
{
	JBoolean found = kJFalse;

	JString headerName;
	if (!Implements(fnName, caseSensitive))
		{
		found = ViewInheritedDeclaration(fnName, caseSensitive, reportNotFound);
		if (!found && reportNotFound)
			{
			JString msg = "Unable to find any declaration for \"";
			msg += fnName;
			msg += "\".";
			(JGetUserNotification())->ReportError(msg);
			}
		}
	else if (GetFileName(&headerName))
		{
		CBDocumentManager* docMgr = CBGetDocumentManager();

		JIndex lineIndex;
		if (docMgr->SearchFile(headerName, fnName, caseSensitive, &lineIndex))
			{
			docMgr->OpenTextDocument(headerName, lineIndex);
			found = kJTrue;
			}
		else if (reportNotFound)
			{
			JString msg = "Unable to find the declaration of \"";
			msg += fnName;
			msg += "\".";
			(JGetUserNotification())->ReportError(msg);
			}
		}
	else if (reportNotFound)
		{
		JString msg = GetFullName();
		msg.PrependCharacter('"');
		msg += "\" is a ghost class, so no information is available for it.";
		(JGetUserNotification())->ReportError(msg);
		}

	return found;
}
void
TestDecisionEquality
	(
	const JCharacter* fileName
	)
{
	std::ifstream input(fileName);

	TestVarList theVarList(input);

	JDecision* d1 = NULL;
	JDecision* d2 = NULL;
	while (1)
		{
		if (!GetDecision(input, &theVarList, &d1))
			{
			break;
			}
		else if (d1 == NULL)
			{
			continue;
			}
		d1->Print(std::cout);
		std::cout << std::endl;

		if (!GetDecision(input, &theVarList, &d2))
			{
			jdelete d1;
			break;
			}
		else if (d2 == NULL)
			{
			jdelete d1;
			continue;
			}
		d2->Print(std::cout);
		std::cout << std::endl;

		if (*d1 == *d2)
			{
			(JGetUserNotification())->DisplayMessage("These decisions are the same");
			}
		else
			{
			(JGetUserNotification())->DisplayMessage("These decisions are not the same");
			}

		jdelete d1;
		jdelete d2;
		}
}
JBoolean
JX2DPlotPrintEPSDialog::OKToDeactivate()
{
	if (!JXEPSPrintSetupDialog::OKToDeactivate())
		{
		return kJFalse;
		}
	else if (Cancelled())
		{
		return kJTrue;
		}
	else if (!itsWidthInput->InputValid())
		{
		itsWidthInput->Focus();
		return kJFalse;
		}
	else if (!itsHeightInput->InputValid())
		{
		itsHeightInput->Focus();
		return kJFalse;
		}

	JCoordinate w,h;
	Unit u;
	GetPlotSize(&w, &h, &u);
	if (w < 50 || h < 50)
		{
		(JGetUserNotification())->ReportError(JGetString(kTooSmallID));
		return kJFalse;
		}
	else
		{
		return kJTrue;
		}
}
Exemplo n.º 10
0
void
GMApp::Receive
(
    JBroadcaster*					sender,
    const JBroadcaster::Message&	message
)
{
    if (sender == itsAboutDialog && message.Is(JXDialogDirector::kDeactivated))
    {
        const JXDialogDirector::Deactivated* info =
            dynamic_cast(const JXDialogDirector::Deactivated*, &message);
        assert(info != NULL);
        if (info->Successful() && itsOpenPrefsAfterAbout)
        {
            if (!itsPrefsNew)
            {
                JGetUserNotification()->DisplayMessage("Your mail preferences have been converted, please verify that they are correct.");
            }
            GGetAccountMgr()->EditAccounts();
        }
        itsAboutDialog			= NULL;
        itsOpenPrefsAfterAbout	= kJFalse;
        itsPrefsNew				= kJFalse;
    }

    else
    {
Exemplo n.º 11
0
void
CBCommand::ReportInfiniteLoop
	(
	const CBFunctionStack&	fnStack,
	const JIndex			startIndex
	)
{
	const JSize cmdCount = fnStack.GetElementCount();
	JString loop;
	for (JIndex i=startIndex; i>=1; i--)
		{
		if (!loop.IsEmpty())
			{
			loop += " -> ";
			}
		loop += fnStack.Peek(i);
		}
	loop += " -> ";
	loop += fnStack.Peek(startIndex);

	const JCharacter* map[] =
		{
		"loop", loop.GetCString()
		};
	const JString msg = JGetString("InfiniteLoop::CBCommand", map, sizeof(map));
	(JGetUserNotification())->ReportError(msg);
}
JBoolean
TestInputFieldsDialog::OKToDeactivate()
{
JInteger v1,v2;

	if (!JXDialogDirector::OKToDeactivate())
		{
		return kJFalse;
		}
	else if (Cancelled())
		{
		return kJTrue;
		}

	else if (itsLowerValue->GetValue(&v1) &&
			 itsUpperValue->GetValue(&v2) &&
			 v1 >= v2)
		{
		(JGetUserNotification())->ReportError("Low must be less than high.");
		itsLowerValue->Focus();
		return kJFalse;
		}

	else
		{
		return kJTrue;
		}
}
void
ClipboardWidget::HandleEditMenu
	(
	const JIndex index
	)
{
	if (index == kCopyCmd)
		{
		// We instantiate a selection object that is appropriate for
		// our data. 
		JXTextSelection* data = new JXTextSelection(GetDisplay(), itsText);
		assert(data != NULL);

		// The selection data is then given to the selection manager.
		if (!(GetSelectionManager())->SetData(kJXClipboardName, data))
			{
			(JGetUserNotification())->ReportError("Unable to copy to the X Clipboard.");
			}
		}
	else if (index == kPasteCmd)
		{
		// Paste if the clipboard has the type we need.
		Paste();
		}
}
JBoolean
SCCircuitVarList::AddFunction
	(
	const JCharacter*	name,
	const JFunction&	f,
	const JBoolean		visible
	)
{
	JIndex index;
	if (!JNameValid(name))
		{
		return kJFalse;
		}
	else if (ParseVariableName(name, strlen(name), &index))
		{
		(JGetUserNotification())->ReportError("This variable name is already used.");
		return kJFalse;
		}
	else
		{
		VarInfo info;

		info.name = new JString(name);
		assert( info.name != NULL );

		info.f       = f.Copy();
		info.visible = visible;

		itsVars->AppendElement(info);
		Broadcast(VarInserted(GetElementCount()));
		return kJTrue;
		}
}
Exemplo n.º 15
0
JBoolean
SVNTabBase::Prepare
	(
	JString*			cmd,
	const JCharacter*	warnMsgID,
	const JBoolean		includeDeleted
	)
{
	JPtrArray<JString> list(JPtrArrayT::kDeleteAll);
	GetSelectedFiles(&list, includeDeleted);
	if (list.IsEmpty())
		{
		return kJFalse;
		}

	if (warnMsgID != NULL && !(JGetUserNotification())->AskUserNo(JGetString(warnMsgID)))
		{
		return kJFalse;
		}

	const JSize count = list.GetElementCount();
	JString fileList;
	for (JIndex i=1; i<=count; i++)
		{
		fileList += JPrepArgForExec(*(list.NthElement(i)));
		fileList += " ";
		}

	JSubstitute subst;
	subst.DefineVariable("file_name", fileList);
	subst.Substitute(cmd);

	return kJTrue;
}
void
JCheckSiteName
	(
	const JCharacter*	encSiteSuffix,
	const JCharacter	siteCode,
	const JCharacter*	map[],
	const JSize			size
	)
{
	JString siteSuffix = encSiteSuffix;
	const JSize len    = siteSuffix.GetLength();
	for (JIndex i=1; i<=len; i++)
		{
		siteSuffix.SetCharacter(i, siteSuffix.GetCharacter(i) ^ siteCode);
		}

	map[1] = siteSuffix.GetCString();

	if (!(JGetHostName()).EndsWith(siteSuffix, kJFalse))
		{
		const JString msg = JGetString(kWrongSiteID, map, size);
		(JGetUserNotification())->DisplayMessage(msg);
		exit(0);
		}
}
void
JCheckForNewerVersion
	(
	JPrefsManager*	prefsMgr,
	const JPrefID&	prefID
	)
{
	const JString& versionURL = JGetString("VERSION_URL");

	JString protocol, host, path;
	JIndex port;
	if (!JParseURL(versionURL, &protocol, &host, &port, &path))
		{
		cerr << "unable to parse url: " << versionURL << endl;
		return;
		}

	if (port == 0 && !JGetDefaultPort(protocol, &port))
		{
		cerr << "unknown protocol in versionURL: " << versionURL << endl;
		return;
		}

	VersionSocket* socket = new VersionSocket(host, path, prefsMgr, prefID);
	assert( socket != NULL );

	const JString vers = socket->GetLatestVersion();
	if (socket->TimeToRemind())
		{
		const JCharacter* map[] =
			{
			"vers", vers,
			"site", host
			};
		const JString msg = JGetString("JRemindNewVersion", map, sizeof(map));
		if ((JGetUserNotification())->AskUserYes(msg))
			{
			(JGetWebBrowser())->ShowURL(JGetString("DOWNLOAD_URL"));
			}
		}

	if (socket->TimeToCheck())
		{
		ACE_INET_Addr addr(port, host);

		VersionConnector* connector = new VersionConnector;
		assert( connector != NULL );

		if (connector->connect(socket, addr, ACE_Synch_Options::asynch) == -1 &&
			jerrno() != EAGAIN)
			{
//			cerr << "unable to open socket: " << versionURL << endl;
			delete connector;
			}
		}
	else
		{
		delete socket;
		}
}
Exemplo n.º 18
0
void
CBFileNode::OpenComplementFile()
	const
{
	JString fullName;
	if (GetFullName(&fullName))
		{
		const CBTextFileType type = (CBGetPrefsManager())->GetFileType(fullName);
		if (type == kCBHTMLFT || type == kCBXMLFT)
			{
			(JXGetWebBrowser())->ShowFileContent(fullName);
			}
		else
			{
			(CBGetDocumentManager())->OpenComplementFile(fullName, type);
			}
		}
	else
		{
		JString msg = "Unable to find complement of \"";
		msg += GetFileName();
		msg.AppendCharacter('"');
		(JGetUserNotification())->ReportError(msg);
		}
}
Exemplo n.º 19
0
JBoolean
JXApplication::OpenDisplay
	(
	const JCharacter*	displayName,
	JIndex*				displayIndex
	)
{
	assert( displayName != NULL && displayName[0] != '\0' );

	JXDisplay* display;
	if (JXDisplay::Create(displayName, &display))
		{
		// DisplayOpened() appends new JXDisplay* to our list
		*displayIndex = itsDisplayList->GetElementCount();
		return kJTrue;
		}
	else
		{
		JString errorStr = "Unable to connect to ";
		errorStr += displayName;
		(JGetUserNotification())->ReportError(errorStr);

		*displayIndex = 0;
		return kJFalse;
		}
}
JBoolean
SCCircuitVarList::SetVariableName
	(
	const JIndex		varIndex,
	const JCharacter*	name
	)
{
	JIndex index;
	if (!JNameValid(name))
		{
		return kJFalse;
		}
	else if (ParseVariableName(name, strlen(name), &index) && index != varIndex)
		{
		(JGetUserNotification())->ReportError("This variable name is already used.");
		return kJFalse;
		}
	else
		{
		VarInfo info = itsVars->GetElement(varIndex);
		*(info.name) = name;
		Broadcast(VarNameChanged(varIndex));
		return kJTrue;
		}
}
Exemplo n.º 21
0
void
TestFunctionEquality
	(
	const JCharacter* fileName
	)
{
	std::ifstream input(fileName);

	TestVarList theVarList(input);

	JFunction* f1 = NULL;
	JFunction* f2 = NULL;
	while (1)
		{
		if (!GetFunction(input, &theVarList, &f1))
			{
			break;
			}
		else if (f1 == NULL)
			{
			continue;
			}

		if (!GetFunction(input, &theVarList, &f2))
			{
			jdelete f1;
			break;
			}
		else if (f2 == NULL)
			{
			jdelete f1;
			continue;
			}

		if (*f1 == *f2)
			{
			(JGetUserNotification())->DisplayMessage("These functions are the same");
			}
		else
			{
			(JGetUserNotification())->DisplayMessage("These functions are not the same");
			}

		jdelete f1;
		jdelete f2;
		}
}
Exemplo n.º 22
0
void
CBApp::Quit()
{
	if (!itsWarnBeforeQuitFlag ||
		(JGetUserNotification())->AskUserNo("Are you sure you want to quit?"))
		{
		JXApplication::Quit();
		}
}
Exemplo n.º 23
0
void
SMTPMessage::Receive
	(
	JBroadcaster*					sender,
	const JBroadcaster::Message&	message
	)
{
	if (sender == itsLink && !itsIsFinished)
		{
		if (message.Is(JMessageProtocolT::kMessageReady))
			{
			itsSomethingRead = kJTrue;
			if (itsTimeoutTask != NULL)
				{
				delete itsTimeoutTask;
				itsTimeoutTask	= NULL;
				}
			ReadReturnValue();
			}
		else if (message.Is(JMessageProtocolT::kReceivedDisconnect))
			{
			JGetUserNotification()->ReportError("The connection to sendmail closed early.");
			Broadcast(SendFailure());
			itsDeleteTask = new JXTimerTask(1000,kJTrue);
			assert( itsDeleteTask != NULL );
			itsDeleteTask->Start();
			ListenTo(itsDeleteTask);
//			itsLink = NULL;
			}
		}
	else if (sender == itsTimeoutTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		JGetUserNotification()->ReportError("The connection to the SMTP server timed out.");
		Broadcast(SendFailure());
		itsLink		= NULL;
		itsTimeoutTask	= NULL;
		delete this;
		}
	else if (sender == itsDeleteTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		itsDeleteTask	= NULL;
		delete this;
		}
}
Exemplo n.º 24
0
JBoolean
JXFileInput::InputValid()
{
	if (itsAllowInvalidFileFlag)
		{
		return kJTrue;
		}
	else if (!JXInputField::InputValid())
		{
		return kJFalse;
		}

	const JString& text = GetText();
	if (text.IsEmpty())
		{
		return JNegate(IsRequired());
		}

	JString fullName;
	const JCharacter* errID = NULL;
	if (JIsRelativePath(text) && !HasBasePath())
		{
		errID = kNoRelPathID;
		RecalcAll(kJTrue);
		}
	else if (!JConvertToAbsolutePath(text, itsBasePath, &fullName) ||
			 !JFileExists(fullName))
		{
		errID = kDoesNotExistID;
		}
	else if (itsRequireReadFlag && !JFileReadable(fullName))
		{
		errID = kUnreadableID;
		}
	else if (itsRequireWriteFlag && !JFileWritable(fullName))
		{
		errID = kUnwritableID;
		}
	else if (itsRequireExecFlag && !JFileExecutable(fullName))
		{
		errID = kCannotExecID;
		}

	if (JStringEmpty(errID))
		{
		return kJTrue;
		}
	else
		{
		(JGetUserNotification())->ReportError(JGetString(errID));
		return kJFalse;
		}
}
JBoolean
JDiscreteValueNameValid
	(
	const JCharacter* str
	)
{
JIndex i;

	const JSize length = strlen(str);
	if (length == 0)
		{
		(JGetUserNotification())->ReportError("Discrete values cannot be empty");
		return kJFalse;
		}

	for (i=1; i<=length; i++)
		{
		if (isspace(str[i-1]))
			{
			(JGetUserNotification())->ReportError("Discrete values cannot contain spaces");
			return kJFalse;
			}
		}

	const JSize opCount                 = JPGetComparisonOpCount();
	const JDecisionOperatorInfo* opInfo = JPGetComparisonOpInfo();

	for (i=0; i<opCount; i++)
		{
		JSize offset;
		if (JStringContains(str, length, opInfo[i].name, &offset))
			{
			(JGetUserNotification())->ReportError(
				"Discrete values cannot contain comparison operators");
			return kJFalse;
			}
		}

	return kJTrue;
}
JBoolean
JXFSBindingTable::ExtractInputData
	(
	const JPoint& cell
	)
{
	assert( itsTextInput != NULL );

	const JString& s = itsTextInput->GetText();
	JBoolean ok      = itsTextInput->InputValid();

	if (ok && cell.x == kPatternColumn)
		{
		const JFSBinding* b    = itsBindingList->GetBinding(cell.y);
		const JBoolean changed = JI2B(b->GetPattern() != s);

		if (JFSBinding::WillBeRegex(s))
			{
			const JError err = itsTestRegex->SetPattern(s);
			err.ReportIfError();
			ok = err.OK();
			}

		JIndex newIndex;
		if (ok && changed && itsBindingList->SetPattern(cell.y, s, &newIndex))
			{
			JTableSelection& s = GetTableSelection();
			s.ClearSelection();
			s.SelectCell(newIndex, kPatternColumn);
			Broadcast(DataChanged());
			}
		else if (ok && changed)
			{
			ok = kJFalse;

			const JCharacter* map[] =
				{
				"pattern", s.GetCString()
				};
			const JString msg = JGetString(kPatternUsedID, map, sizeof(map));
			(JGetUserNotification())->ReportError(msg);
			}
		}

	else if (ok && cell.x == kCommandColumn &&
			 itsBindingList->SetCommand(cell.y, s))
		{
		Broadcast(DataChanged());
		}

	return ok;
}
JBoolean
CBCommandTable::ExtractInputData
	(
	const JPoint& cell
	)
{
	assert( itsTextInput != NULL && cell.x != kOptionsColumn );

	CBCommandManager::CmdInfo info = itsCmdList->GetElement(cell.y);

	const JString& text = itsTextInput->GetText();

	JString* s = NULL;
	if (cell.x == kMenuTextColumn)
		{
		s = info.menuText;
		}
	else if (cell.x == kMenuShortcutColumn)
		{
		s = info.menuShortcut;
		}
	else if (cell.x == kScriptNameColumn)
		{
		if (illegalNamePattern.Match(text))
			{
			(JGetUserNotification())->ReportError(JGetString(kNoSpacesInCmdNameID));
			return kJFalse;
			}
		s = info.name;
		}
	else if (cell.x == kCommandColumn)
		{
		s = info.cmd;
		}
	else if (cell.x == kPathColumn)
		{
		s = info.path;
		}
	assert( s != NULL );

	if (itsTextInput->InputValid())
		{
		*s = text;
		s->TrimWhitespace();
		return kJTrue;
		}
	else
		{
		return kJFalse;
		}
}
Exemplo n.º 28
0
JBoolean
SyGGetTrashDirectory
	(
	JString*		path,
	const JBoolean	reportErrors
	)
{
	if (!theTrashDir.IsEmpty())
		{
		*path = theTrashDir;
		return kJTrue;
		}

	if (!JGetPrefsDirectory(path))
		{
		if (reportErrors)
			{
			(JGetUserNotification())->ReportError(JGetString(kNoPrefsDirID));
			}
		return kJFalse;
		}

	*path = JCombinePathAndName(*path, kTrashDirName);

	JError err = JNoError();
	if (!JDirectoryExists(*path))
		{
		err = JCreateDirectory(*path, kTrashCanPerms);
		}
	else
		{
		err = JSetPermissions(*path, kTrashCanPerms);
		}

	if (err.OK())
		{
		theTrashDir       = *path;
		const JBoolean ok = JDirInfo::Create(theTrashDir, &theTrashDirInfo);
		assert( ok );
		return kJTrue;
		}
	else
		{
		path->Clear();
		if (reportErrors)
			{
			(JGetStringManager())->ReportError(kCreateTrashErrorID, err);
			}
		return kJFalse;
		}
}
JBoolean
GLPolyFitDialog::OKToDeactivate()
{
	if (!JXDialogDirector::OKToDeactivate())
		{
		return kJFalse;
		}
	if (Cancelled())
		{
		return kJTrue;
		}
	JString name	= itsNameInput->GetText();
	name.TrimWhitespace();
	if (name.IsEmpty())
		{
		JGetUserNotification()->ReportError("You must specify a name for this fit.");
		itsNameInput->Focus();
		return kJFalse;
		}

	JBoolean checked	= kJFalse;
	const JSize count	= 10;
	for (JIndex i = 1; i <= count; i++)
		{
		if (itsCB[i-1]->IsChecked())
			{
			checked		= kJTrue;
			break;
			}
		}

	if (!checked)
		{
		JGetUserNotification()->ReportError("You must add at least one power.");
		}

	return checked;
}
JBoolean 
GXCreatePlotDialog::OKToDeactivate()
{
	if (Cancelled())
		{
		return kJTrue;
		}
	if (GetLabel().IsEmpty())
		{
		JGetUserNotification()->ReportError("You must specify a curve label.");
		return kJFalse;
		}
	return kJTrue;
}