Skip to content

Commit

Permalink
Merge branch 'master' of github.com:funkatron/spaz-desktop-air
Browse files Browse the repository at this point in the history
  • Loading branch information
funkatron committed Jun 29, 2011
2 parents 5ef3d66 + d5cdd4d commit df6d2c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
13 changes: 12 additions & 1 deletion app/controllers/spaz.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,24 @@ Spaz.Controller.setKeyboardShortcuts = function() {
target:$('#entrybox')[0],
propagate:false
});
shortcut.add('Enter', function() {

shortcut.add('Enter', function() {
if (!Spaz.Prefs.get('keyboard-enterInsertsNewline')) {
Spaz.postPanel.submit();
}
}, {
target:$('#entrybox')[0],
propagate:true
});

shortcut.add('Shift+Enter', function() {
Spaz.postPanel.submit();
}, {
target:$('#entrybox')[0],
propagate:false
});


// ****************************************
// Username/password prefs -> save
// ****************************************
Expand Down
23 changes: 19 additions & 4 deletions app/models/spaz.prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ Spaz.Prefs.defaultPreferences = {
'key-reloadTimeline': "Shift+F5",
'key-showShortenWindow': "+Shift+A",
'key-showUploadImageWindow': "+Shift+U",
'key-highlight-code': "+R"
'key-highlight-code': "+R",

'key-enterIsNewline' : false
};


Expand Down Expand Up @@ -998,8 +1000,20 @@ Spaz.Prefs.changeMethods = {
onChange: function(value) {
Spaz.Dock.setShape(value);
}
}

},

'keyboard-enterInsertsNewline' : {
setUI: function(value) {
$('#keyboard-enterInsertsNewline').attr('checked', value);
},
onGet: function(key, value) {
return !!value;
},
onSet: function(key, value) {
return !!value;
}
}

};


Expand Down Expand Up @@ -1108,7 +1122,8 @@ Spaz.Prefs.initUI = function() {
$('#dock-displayunreadbadge').bind('change', Spaz.Prefs.setFromUI);
$('#dock-unreadbadgecolor').bind('change', Spaz.Prefs.setFromUI);
$('#dock-unreadbadgeshape').bind('change', Spaz.Prefs.setFromUI);


$('#keyboard-enterInsertsNewline').bind('change', Spaz.Prefs.setFromUI);
};


Expand Down
6 changes: 5 additions & 1 deletion app/views/spaz.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ Spaz.UI.setCurrentPage = function(tabEl, newpage) {
$('#' + panel + ' .timeline-pager-number').html(newpage);
};
Spaz.UI.showEntryboxTip = function() {
Spaz.UI.statusBar('Logged in as <span class="statusbar-username">' + Spaz.Prefs.getUsername() + '@'+Spaz.Prefs.getAccountType()+'</span>. ENTER sends.');
var enter_does_what = 'ENTER sends.';
if (Spaz.Prefs.get('keyboard-enterInsertsNewline')) {
enter_does_what = 'SHIFT+ENTER sends.';
}
Spaz.UI.statusBar('Logged in as <span class="statusbar-username">' + Spaz.Prefs.getUsername() + '@'+Spaz.Prefs.getAccountType()+'</span>. '+enter_does_what);
}

Spaz.UI.showLocationOnMap = function(location) {
Expand Down
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ <h2 class="CollapsiblePanelTab" tabindex="0">
id="timeline-keyboardnavwrap" />
<label for="timeline-keyboardnavwrap" class="checkbox">Wraparound keyboard nav.</label>
</div>
<div class="formrow">
<input type="checkbox" name="keyboard-enterInsertsNewline" value="1"
id="keyboard-enterInsertsNewline" />
<label for="keyboard-enterInsertsNewline" class="checkbox">ENTER key inserts newline.</label>
</div>


</fieldset>
Expand Down

0 comments on commit df6d2c3

Please sign in to comment.