Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 37 additions & 42 deletions interfaces/web_desktop/apps/FriendShell/Scripts/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,92 +18,87 @@
*******************************************************************************/

// Extend the applicatino object with a run function
Application.run = function( packet )
{
Application.run = function (packet) {
this.fileName = 'test1';
var w = new View( {
title: 'New Shell',
width: 650,
/**
* View instance
* @type {View}
*/
var w = new View({
title: 'New Shell',
width: 650,
height: 340,
scrollable: true,
transparent: true
} );
});
/**
* @type {View}
*/
this.view = w;
w.onClose = function(){ Application.quit(); }
w.onClose = function () { Application.quit(); }

// Setup terminal shell instance
if ( typeof ( window.shell_instances ) == 'undefined' )
if (typeof (window.shell_instances) == 'undefined')
window.shell_instances = [];
for( var a = 1; a < 9999; a++ )
{
if ( typeof ( window.shell_instances[a] ) == 'undefined' || !window.shell_instances[a] )
{
for (var a = 1; a < 9999; a++) {
if (typeof (window.shell_instances[a]) == 'undefined' || !window.shell_instances[a]) {
window.shell_instances[a] = true;
break;
}
}
w.instanceId = a;
w.setFlag( 'title', 'New Shell' );
w.setFlag('title', 'New Shell');
w.currentPath = 'System:';
w.currentCLI = false;
w.cliTemplate = false;
w.instanceNum = a;
w.getInstanceNum = function()
{
w.getInstanceNum = function () {
return this.instanceNum;
}
w.onClose = function()
{
function doQuit()
{
w.onClose = function () {
function doQuit() {
w.onClose = null;
Application.quit();
}

var msg = {
command: 'quit_shell',
callbackId: addCallback( doQuit )
callbackId: addCallback(doQuit)
};
w.sendMessage( msg );

w.sendMessage(msg);
return false;
}

// Load resources
var f = new File( 'Progdir:Templates/terminal.html' );
f.onLoad = function( data )
{
w.setContent( data, function()
{
if( packet.args )
{
w.sendMessage( {
var f = new File('Progdir:Templates/terminal.html');
f.onLoad = function (data) {
w.setContent(data, function () {
if (packet.args) {
w.sendMessage({
command: 'execute',
args: packet.args
} );
});
}
} );
});
}
f.load();
};

Application.receiveMessage = function( msg )
{
if( msg.command )
{
switch( msg.command )
{
Application.receiveMessage = function (msg) {
if (msg.command) {
switch (msg.command) {
case 'activate':
this.view.activate();
break;
case 'quit':
this.quit();
break;
case 'listapplications':
this.view.sendMessage( { command: 'applicationlist', data: msg.data } );
this.view.sendMessage({ command: 'applicationlist', data: msg.data });
break;
case 'settitle':
this.view.setFlag( 'title', msg.text );
this.view.setFlag('title', msg.text);
break;
}
}
Expand Down
Loading