Monday, November 08, 2010 at 12:04 AM.

system.verbs.builtins.radio.callbacks.systemTrayIconRightClick

on systemTrayIconRightClick (adradrmenu) {
	<<Changes
		<<1/3/03; 12:46:07 PM by JES
			<<Added support for serial number renewals. If the serial number is expired, add a command to renew your license instead of the Update Radio.root command.
		<<9/2/02; 8:49:32 PM by JES
			<<For the Windows-only Exit and Shut Down Radio command, call through the windowTypes Quit command handler instead of calling filemenu.quit directly. This makes sure that all changed databases will get saved when quitting, and is the same thing that the File -> Quit command does in the Radio application.
		<<12/18/01; 3:57:29 PM by PBS
			<<New commands: Update Radio.root, Upstreaming, Work Offline, Open www folder.
		<<12/2/01; 7:44:41 PM by JES
			<<If user.radio.settings.flExpired is true, only add the Enter Serial Number and Exit and Shut Down Radio commands.
		<<11/12/01; 8:57:45 PM by PBS
			<<Only add Open Radio and Exit and Shut Down Radio commands on Windows.
			<<Because: for Open Radio, Radio isn't really hidden.
			<<For Exit..., there's automatically a Quit menu item in the contextual menu. (Placed there by the OS.)
	
	local (adrMenu = @system.temp.systemTrayRightClickMenu);
	new (menubartype, adrmenu);
	local (oldtarget = target.set (adrmenu));
	local (menuname = "Right-Click Menu");
	op.firstSummit ();
	op.setLineText (menuname);
	
	on addCommand (itemName, scriptString) {
		menu.addMenuCommand (adrMenu, menuName, itemName, scriptString)};
	on addSeparator () {
		op.insert ("-", down)};
	
	if user.radio.settings.flExpired {
		addCommand ("Enter Serial Number", "radio.menuCommands.openPage (radio.data.systemUrls.serialNumber)")}
	else { //add the Home Page command
		addCommand ("Home Page", "radio.menuCommands.openPage (radio.data.systemUrls.weblogEditor)")};
	if system.environment.isWindows {
		if not user.radio.settings.flExpired {
			addCommand ("Open Radio", "Frontier.bringToFront ()")}};
	addSeparator ();
	bundle { //PBS 12/18/01: Update Radio.root
		local (command = "Update Radio.root");
		if tcp.isOffline () {
			addCommand ("(" + command, "")}
		else { //JES 1/3/03: update or renew
			local (flEnabled = true);
			if defined (user.radio.settings.whenSNExpires) { //sn check
				local (whenExpires = date (user.radio.settings.whenSNExpires));
				if whenExpires < clock.now () {
					flEnabled = false}};
			if flEnabled {
				addCommand (command, "rootUpdates.threadedUpdate (@root)")}
			else { //instead add a command for entering your renewal code
				local (url = string.replace (radio.data.cloudUrls.renew, "<%serialNumber%>", user.radio.prefs.serialNumber));
				addCommand ("Renew Radio...", "radio.menuCommands.openCloudPage (\"" + url + "\")");
				addSeparator ()}}};
	if not (date.versionLessThan (Frontier.version (), "7.1b42")) { //needs kernel support for checked menu items
		bundle { //PBS 12/18/01: Upstreaming
			local (command = radio.upstream.menuFormula ());
			addCommand (command, "radio.upstream.menuCommand ()")};
		bundle { //PBS 12/18/01: Work Offline
			local (command = "Work Offline");
			local (flChecked = Frontier.tools.windowTypes.isFileMenuItemChecked ("workoffline"));
			if flChecked {
				command = "!" + command};
			addCommand (command, "Frontier.tools.windowTypes.commands.workOffline ()")}};
	bundle { //PBS 12/18/01: Open www folder
		local (scriptString = "file.openfolder (user.radio.prefs.wwwfolder);if system.environment.isMac{Finder.bringToFront ()}");
		local (command = "Open www folder");
		addCommand (command, scriptString)};
	
	if system.environment.isWindows {
		addSeparator ();
		addCommand ("Exit and Shut Down Radio", "Frontier.tools.windowTypes.runFileMenuScript (\"quit\")")};
	
	try {target.set (oldTarget)};
	
	adradrmenu^ = adrmenu;
	return (true)}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.