[Pound-commit] pound: many fixups for first screen including nickname handling....
Status: Beta
Brought to you by:
rubin
From: Mercurial C. M. <pou...@li...> - 2010-03-30 05:25:59
|
details: http://pound.hg.sourceforge.net:8000/hgroot/pound/pound/rev/9836eb42e125 changeset: 38:9836eb42e125 user: Alex Schumann <ru...@us...> date: Tue Mar 30 00:25:42 2010 -0500 description: many fixups for first screen including nickname handling. Fix for error swiping away channels diffstat: app/assistants/channel-assistant.js | 9 ++++- app/assistants/first-assistant.js | 58 ++++++++++++++++++++++++++++-------- app/views/first/first-scene.html | 4 +- libs/irc.js | 20 ++++++++++-- stylesheets/ir.css | 1 + 5 files changed, 71 insertions(+), 21 deletions(-) diffs (296 lines): diff -r ce655f7360f7 -r 9836eb42e125 app/assistants/channel-assistant.js --- a/app/assistants/channel-assistant.js Sun Mar 28 03:10:23 2010 -0500 +++ b/app/assistants/channel-assistant.js Tue Mar 30 00:25:42 2010 -0500 @@ -44,6 +44,7 @@ // activity lights in the dropdown otherwise. // For now, just update the buffer. + Mojo.Log.info("Running updateCallback()..."); this.updateBuffer(); }; @@ -62,6 +63,7 @@ this.controller.modelChanged(this.titleButtonModel, this); } + Mojo.Log.info("updateBuffer() completed updating titleButton"); if(!this.dataScroller || !this.dataScroller.mojo) { // this happens if we get called from inside setup(), I guess. return; @@ -82,6 +84,7 @@ // We were at the bottom, scroll all the way down this.dataScroller.mojo.revealBottom(); } + Mojo.Log.info("updateBuffer() complete."); }; ChannelAssistant.prototype.tabEventsCallback = function(type, tab) { @@ -90,6 +93,7 @@ // DELETE (the buffer requested itself closed - not sure if we'll use this) //TODO: prefs check for auto-open new tabs // 'tab' means some element with a buffer: server, channel, or query etc. + Mojo.Log.info("tabEventsCallback() running..."); this.currentEventTab = tab; if(type === "NEW") { // Add channel buffer to buffer list dropdown. @@ -117,7 +121,10 @@ //TODO: delete from buffer list dropdown // if its the active one, change? show static log? alert user? idk. Mojo.Log.info("Got a tabEventCallback 'DELETE' on "+tab.type+" "+tab.name); + this.updateTabList(); + // be lame right now and switch to the 1st tab + this.attachBuffer(this.tabListModel.items[0].tabObj); } else if(type === "DISCONNECTED") { if(!tab) { @@ -321,8 +328,6 @@ Mojo.Log.info("handleTabDelete(): got a tabDelete event: "+ item.tabName); var tab = item.tabObj; tab.close("Leaving"); - - //TODO: if channel part it I guess. }; ChannelAssistant.prototype.handleTabTap = function(event) { diff -r ce655f7360f7 -r 9836eb42e125 app/assistants/first-assistant.js --- a/app/assistants/first-assistant.js Sun Mar 28 03:10:23 2010 -0500 +++ b/app/assistants/first-assistant.js Tue Mar 30 00:25:42 2010 -0500 @@ -31,12 +31,12 @@ //TODO: we can get name from webos somehow right? Lets use that as default nick! return { networks: [ - {name: "AfterNET", url: "http://www.afternet.org:6690", nick1: "Pound-user", autoJoin: "#afternet"}, - {name: "Freenode", url: "http://webchat.freenode.net", nick1: "Pound-user", autoJoin: "#palm,#webos"}, - {name: "QuakeNet", url: "http://webchat.quakenet.org", nick1: "Pound-user"}, - {name: "Rizon", url: "http://qchat.rizon.net/", nick1: "Pound-user"}, // untested.. - {name: "Borknet", url: "http://www.borknet.org:8000/", nick1: "Pound-user"}, //untested.. - {name: "WarIRC", url: "http://desktop.tpwch.com:443/", nick1: "Pound-user"} //untested.. + {name: "AfterNET", url: "http://www.afternet.org:6690", nick1: "", autoJoin: "#afternet"}, + {name: "Freenode", url: "http://webchat.freenode.net", nick1: "", autoJoin: "#palm,#webos"}, + {name: "QuakeNet", url: "http://webchat.quakenet.org", nick1: ""}, + {name: "Rizon", url: "http://qchat.rizon.net/", nick1: ""}, // untested.. + {name: "Borknet", url: "http://www.borknet.org:8000/", nick1: ""}, //untested.. + {name: "WarIRC", url: "http://desktop.tpwch.com:443/", nick1: ""} //untested.. ] }; }; @@ -58,7 +58,7 @@ }; FirstAssistant.prototype.getPrefsSuccess = function(prefs) { // this.prefs is set now. yay. -// Mojo.Log.info("Depot.get Success: "); + Mojo.Log.info("Depot.get Success: "); if(prefs === null) { Mojo.Log.info("Creating first time prefs.."); this.prefs = this.generateStockPrefs(); @@ -67,7 +67,6 @@ else { this.prefs = prefs; } - //TODO: activate the controls? this.onLoaded(); }; FirstAssistant.prototype.getPrefsFailure = function(result) { @@ -95,11 +94,10 @@ /* use Mojo.View.render to render view templates and add them to the scene, if needed. */ + this.prefDepot = new Mojo.Depot({name:"irc", version:1, replace: false }, this.dbSuccess.bind(this), this.dbFailure.bind(this)); /* setup widgets here */ /* add event handlers to listen to events from widgets */ - this.prefDepot = new Mojo.Depot({name:"irc", version:1, replace: false }, this.dbSuccess.bind(this), this.dbFailure.bind(this)); - // Now we wait for the callbacks to tell us the db is loaded so we can continue // Connect Button this.connectButtonAttributes = {}; @@ -150,7 +148,15 @@ try { this.fieldNicknameAttributes = { -hintText: '', multiline: false, enterSubmits: false, focus: false, textCase: Mojo.Widget.steModeLowerCase, autoReplace: false, focusMode: Mojo.Widget.focusSelectMode, charsAllow: irc.isValidNicknameChar.bind(this)}; + hintText: 'Enter a Nickname', + multiline: false, + enterSubmits: false, + focus: false, + textCase: Mojo.Widget.steModeTitleCase, + autoReplace: false, + changeOnKeyPress: true, + focusMode: Mojo.Widget.focusSelectMode, + charsAllow: irc.isValidNicknameChar.bind(this)}; this.fieldNicknameModel = {value: 'Undefined', disabled: false}; this.controller.setupWidget("fieldNickname", this.fieldNicknameAttributes, this.fieldNicknameModel); this.fieldNickname = this.controller.get("fieldNickname"); @@ -168,7 +174,7 @@ // and enable them. FirstAssistant.prototype.onLoaded = function() { // Make the buttons and selector list enabled -// Mojo.Log.info("in onLoaded()."); + Mojo.Log.info("in onLoaded()."); this.netListSelectorModel.selectedNetworkNum = 0; // TODO: get from prefs this.loadForm(); @@ -181,14 +187,20 @@ Mojo.Log.info("No prefs set in loadForm. Don't load yet"); return; } + if(!this.connectButtonModel) { + // we arent fully setup yet, don't try to run + return; + } try { // save so we can re-order or w/e later on var selection = this.netListSelectorModel.selectedNetworkNum; this.connectButtonModel.disabled = false; - this.controller.modelChanged(this.connectButtonModel, this); + //this.controller.modelChanged(this.connectButtonModel, this); + Mojo.Log.info("DEBUG: before connectButtonModel"); this.controller.modelChanged(this.connectButtonModel, this); this.editButtonModel.disabled = false; + Mojo.Log.info("DEBUG: before editButtonModel"); this.controller.modelChanged(this.editButtonModel, this); var networks = this.prefs.networks; this.netListSelectorModel.choices = []; @@ -206,11 +218,14 @@ this.selectedNetwork = this.prefs.networks[selection]; this.fieldNicknameModel.value = this.selectedNetwork.nick1; + Mojo.Log.info("DEBUG: before fieldNickname"); this.controller.modelChanged(this.fieldNicknameModel, this); //this.fieldNickname.blur(); //this.fieldNickname.focus(); //this.fieldNickname.setCursorPosition(0,99999); + this.setConnectButtonActiveState(); + } catch(loadErr) { Mojo.Log.error("loadForm(): "+loadErr); } Mojo.Log.info("Done with loadForm()"); }; @@ -279,6 +294,21 @@ this.selectedNetwork.nick1 = event.value; this.useNickname = event.value; //TODO: save this nick to selected network prefs + + // disable the connect button (or enable it) + this.setConnectButtonActiveState(); +}; + +// Enable or disable the connect button, depending if nickname is filled out +FirstAssistant.prototype.setConnectButtonActiveState = function() { + Mojo.Log.info("Setting connect button state.."); + if(this.fieldNicknameModel.value == '') { + this.connectButtonModel.disabled = true; + } + else { + this.connectButtonModel.disabled = false; + } + this.controller.modelChanged(this.connectButtonModel, this); }; FirstAssistant.prototype.activate = function(event) { @@ -286,7 +316,7 @@ example, key handlers that are observing the document */ // Refresh network selector widget -// Mojo.Log.info("first-assistant activate()"); + Mojo.Log.info("first-assistant activate()"); this.loadForm(); }; diff -r ce655f7360f7 -r 9836eb42e125 app/views/first/first-scene.html --- a/app/views/first/first-scene.html Sun Mar 28 03:10:23 2010 -0500 +++ b/app/views/first/first-scene.html Tue Mar 30 00:25:42 2010 -0500 @@ -8,7 +8,9 @@ <div id="fieldTitleNickname" class="xxfieldtitle">NICKNAME</div> - <div id="fieldNickname" name="fieldNickname" x-mojo-element="TextField"></div> + <div style="height: 50px;" class="nickContainer"> + <div id="fieldNickname" name="fieldNickname" x-mojo-element="TextField"></div> + </div> <div id="editButton" name="editButton" x-mojo-element="Button"></div> diff -r ce655f7360f7 -r 9836eb42e125 libs/irc.js --- a/libs/irc.js Sun Mar 28 03:10:23 2010 -0500 +++ b/libs/irc.js Tue Mar 30 00:25:42 2010 -0500 @@ -416,12 +416,17 @@ // For now, on part just remove the tab. Later on // we may want to try and auto-rejoin, or leave the // dead tab open so you can see it. + Mojo.Log.info("DEBUG: cOnPart: "+ from.nick + ", " + this.server.currentNick); + //this.print("DEBUG: cOnPART: "+ from.nick + ", "+ this.server.currentNick); if(from.nick === this.server.currentNick) { + Mojo.Log.info("cOnPART() Deleting channel..."); this.server.delChannel(this); //todo: send UI an event so it knows to update the tablist? } else { + Mojo.Log.info("cOnPART() printing has left message"); this.print("* "+from.nick+" ("+from.user+"@"+from.host+") has left "+this.name); + Mojo.Log.info("cOnPART() deleting user from list"); this.userList.del(from.nick); } }, @@ -917,12 +922,16 @@ }, onPART: function(command, from, args) { var to = args[0]; + Mojo.Log.info("doing onPART().."); if( to.startsWith("#") && (tab = this.findTab(to)) ) { //TODO: if its me, part the channel, close the tab etc + Mojo.Log.info("onPART() passing to tab.handle()"); tab.handle(command, from, args); } else { + Mojo.Log.info("onPART() tab not found"); if(from.nick === this.currentNick) { + Mojo.Log.info("onPART(): You have left"+to); this.print("* You have left "+to); } //this.print("Extranious: "+from.nick + " has parted "+ to); @@ -958,7 +967,9 @@ this[handler](command, from, args); } catch(err) { Mojo.Log.error("parseline handler("+command+","+from+",args) error: "+err); - this.print("Error parsing "+command+" from "+ from + " ("+args.join(" ")+"):"+err); + this.print("DEBUG: Error parsing "+command+" from "+ from + " ("+args.join(" ")+"):"+err); + //this.print("DEBUG: Line: "+err.number); + this.print("DEBUG: test"); } } else { @@ -990,7 +1001,8 @@ }, _poll_successCallback: function(transport) { //Mojo.Log.info("Got success callback:" + transport.status); - var response = transport.responseText || ""; + //var response = transport.responseText || ""; + var response = transport.responseText; Mojo.Log.info("RESPONSE: "+response); var json = {}; try { @@ -1000,8 +1012,8 @@ json = JSON.parse(response); } else { - Mojo.Log.info("poll reply is empty!"); - this.print("*** Empty response from poll. Is qWebIRC url correct? :"+transport.status+'/'+transport.readyState); + Mojo.Log.info("poll reply is empty! type: "+ typeof(response) +"."); + this.print("*** Empty response from poll. http:"+transport.status+' state '+transport.readyState); //this.print("* Poll reply is empty, giving up. Is the network qWebIRC url correct?"); //TODO: get here when https with bad cert. alert or something? //Hmm. apparently this also comes up in other situations.. diff -r ce655f7360f7 -r 9836eb42e125 stylesheets/ir.css --- a/stylesheets/ir.css Sun Mar 28 03:10:23 2010 -0500 +++ b/stylesheets/ir.css Tue Mar 30 00:25:42 2010 -0500 @@ -192,6 +192,7 @@ #fieldTitleNickname { font-size: 0.7em; color: #56F; + color: #256BB3; width: 30%; padding-top: 15px; } |