Permalink
Browse files

Adding support for fennec

  • Loading branch information...
1 parent 4d52910 commit 35cffc21ee6d8ce1225e8b2795a9243d3a10afc1 @prefiks prefiks committed Dec 5, 2009
View
@@ -1,4 +1,6 @@
content oneweb file:chrome/content/
locale oneweb en-US file:chrome/locale/en-US/
skin oneweb classic/1.0 file:chrome/skin/
-overlay chrome://browser/content/browser.xul chrome://oneweb/content/overlays/browserOverlay.xul
+overlay chrome://browser/content/browser.xul chrome://oneweb/content/overlays/browserOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+overlay chrome://browser/content/browser.xul chrome://oneweb/content/overlays/fennecOverlay.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
+override chrome://oneweb/content/preferences.xul chrome://oneweb/content/fennec-preferences.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- ***** BEGIN LICENSE BLOCK *****
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ -
+ - The contents of this file are subject to the Mozilla Public License Version
+ - 1.1 (the "License"); you may not use this file except in compliance with
+ - the License. You may obtain a copy of the License at
+ - http://www.mozilla.org/MPL/
+ -
+ - Software distributed under the License is distributed on an "AS IS" basis,
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ - for the specific language governing rights and limitations under the
+ - License.
+ -
+ - The Original Code is OneWeb.
+ -
+ - The Initial Developer of the Original Code is
+ - ProcessOne.
+ - Portions created by the Initial Developer are Copyright (C) 2009
+ - the Initial Developer. All Rights Reserved.
+ -
+ - Contributor(s):
+ -
+ - Alternatively, the contents of this file may be used under the terms of
+ - either the GNU General Public License Version 2 or later (the "GPL"), or
+ - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ - in which case the provisions of the GPL or the LGPL are applicable instead
+ - of those above. If you wish to allow use of your version of this file only
+ - under the terms of either the GPL or the LGPL, and not to allow others to
+ - use your version of this file under the terms of the MPL, indicate your
+ - decision by deleting the provisions above and replace them with the notice
+ - and other provisions required by the LGPL or the GPL. If you do not delete
+ - the provisions above, a recipient may use your version of this file under
+ - the terms of any one of the MPL, the GPL or the LGPL.
+ -
+ - ***** END LICENSE BLOCK ***** -->
+
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://oneweb/skin/preferences/preferences.css" type="text/css"?>
+<?xml-stylesheet href="chrome://oneweb/content/bindings/bindings.css" type="text/css"?>
+<?xml-stylesheet href="chrome://oneweb/skin/dialog.css" type="text/css"?>
+
+<box xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <setting id="oneweb-jid" type="string" title="Jabber ID"/>
+
+ <setting id="oneweb-pass" type="string" inputtype="password" title="Password"/>
+
+ <setting id="oneweb-connection-save" type="control" title="Save account information">
+ <button label="Save" oncommand="OneWeb.saveAccount()"/>
+ </setting>
+
+ <setting id="oneweb-perm-gettabs" title="_('Get all opened tabs')"
+ desc="_('That action may only be run by')" type="control">
+ <menulist pref="oneweb.permissions.openedtabs"
+ oncommand="OneWeb.updatePrefs(this.getAttribute('pref'), this.selectedIndex)">
+ <menupopup>
+ <menuitem value="0" label="_('My other clients')"/>
+ <menuitem value="1" label="_('My contacts')"/>
+ <menuitem value="2" label="_('Everyone')"/>
+ </menupopup>
+ </menulist>
+ </setting>
+
+ <setting id="oneweb-perm-opentab" title="_('Open URL in new tab')"
+ desc="_('That action may only be run by')" type="control">
+ <menulist pref="oneweb.permissions.openurl"
+ oncommand="OneWeb.updatePrefs(this.getAttribute('pref'), this.selectedIndex)">
+ <menupopup>
+ <menuitem value="0" label="_('My other clients')"/>
+ <menuitem value="1" label="_('My contacts')"/>
+ <menuitem value="2" label="_('Everyone')"/>
+ </menupopup>
+ </menulist>
+ </setting>
+
+ <setting id="oneweb-perm-search" title="_('Search bookmarks')"
+ desc="_('That action may only be run by')" type="control">
+ <menulist pref="oneweb.permissions.searchbookmarks"
+ oncommand="OneWeb.updatePrefs(this.getAttribute('pref'), this.selectedIndex)">
+ <menupopup>
+ <menuitem value="0" label="_('My other clients')"/>
+ <menuitem value="1" label="_('My contacts')"/>
+ <menuitem value="2" label="_('Everyone')"/>
+ </menupopup>
+ </menulist>
+ </setting>
+
+ <setting id="oneweb-last" type="string" onsyncfrompreference="OneWeb.fillPrefs(this)"/>
+</box>
@@ -50,9 +50,11 @@ var adhocCmds = {
msgHtml += "<br/>Tabs opened in window "+numWindows+":<br/>";
}
+ var browsers = w.gBrowser ? w.gBrowser.browsers : w.Browser.browsers;
+
msgHtml += "<ul>"
- for (var i = 0; i < w.gBrowser.browsers.length; i++) {
- var b = w.gBrowser.browsers[i];
+ for (var i = 0; i < browsers.length; i++) {
+ var b = browsers[i];
msg += " "+b.contentTitle+" [ "+b.currentURI.spec+" ]\n";
msgHtml += "<li><a href=\""+xmlEscape(b.currentURI.spec)+"\">"+
xmlEscape(b.contentTitle||"(empty title)")+"</a></li>";
@@ -152,7 +154,7 @@ var adhocCmds = {
var queryObj = hs.getNewQuery();
options.queryType = options.QUERY_TYPE_BOOKMARKS;
- queryObj.setFolders([bs.bookmarksMenuFolder], 1);
+ queryObj.setFolders([bs.placesRoot], 1);
queryObj.searchTerms = terms;
var result = hs.executeQuery(queryObj, options);
@@ -153,7 +153,10 @@ function openLink(uri)
browser = wm.getMostRecentWindow("navigator:browser");
if (browser) {
- browser.getBrowser().addTab(uri, null, null);
+ if (browser.BrowserUI)
+ browser.BrowserUI.newTab(uri, true);
+ else
+ browser.getBrowser().addTab(uri, null, null);
return false;
}
@@ -48,6 +48,7 @@ var uiUpdater = {
dump(name+"("+Array.join(Array.map(args, uneval), ", ")+")\n");
},
+
windows: function() {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
@@ -57,7 +58,7 @@ var uiUpdater = {
while (br.hasMoreElements()) {
var win = br.getNext();
var doc = win.document;
- var el = doc.getElementById("oneweb-status");
+ var el = doc.getElementById("oneweb-status") || doc.getElementById("oneweb-panel");
if (el)
yield [win, doc, el];
@@ -103,7 +104,7 @@ var uiUpdater = {
},
pageIsShared: function(url) {
- return bookmarksSharing.pageIsShared(url);
+ return url ? bookmarksSharing.pageIsShared(url) : false;
},
sharePage: function(url, title) {
@@ -112,22 +113,47 @@ var uiUpdater = {
unsharePage: function(url) {
bookmarksSharing.unsharePage(url);
+ },
+
+ get jid() {
+ return account.myJID ? account.myJID.shortJID.toString() : '';
+ },
+
+ get password() {
+ return account.connectionInfo.pass;
+ },
+
+ getPref: function(name) {
+ return prefManager.getPref(name);
+ },
+
+ setPref: function(name, value) {
+ prefManager.setPref(name, value);
+ },
+
+ setUserAndPass: function(jid, pass) {
+ dump("SET USER AND PASS: "+jid+", "+pass+"\n");
+ account.setUserAndPass(jid, pass, true);
+ },
+
+ setGlob: function(name, value) {
+ __parent__[name] = value;
}
},
handleEvent: function(event) {
if (event.type != "load")
return;
-
event.target.removeEventListener("load", this, false);
var el = event.target.getElementById("oneweb-status");
- if (!el)
+ if (el) {
+ if (this._showPrefs)
+ account.showPrefs();
+ } else if ((el = event.target.getElementById("oneweb-panel"))) {
+ } else
return;
- if (this._showPrefs)
- account.showPrefs();
-
this._firstWindowOpened = true;
this._showPrefs = false;
@@ -179,7 +205,7 @@ var uiUpdater = {
if (!account.connected) {
if (!this.selfDisconnect)
- setTimeout(this._tryConnect, 5000);
+ setTimeout(function(t){t._tryConnect}, 5000, this);
} else
this.selfDisconnect = false;
},
@@ -269,9 +295,19 @@ var uiUpdater = {
}
},
+ _tryConnectLazy: function() {
+ if (this._lazyConnectTimeout)
+ clearTimeout(this._lazyConnectTimeout)
+
+ this._lazyConnectTimeout = setTimeout(function(t) {
+ t._tryConnect(false);
+ }, 5000, this);
+ },
+
_tryConnect: function(showPrefs) {
this._trace(arguments);
var ci = account.connectionInfo;
+ showPrefs = false;
if (ci.host && ci.user && ci.pass) {
if (!account.connected)
@@ -309,7 +345,7 @@ var uiUpdater = {
ww.registerNotification(this);
if (!this._tryConnect(true))
- account.registerView(new Callback(this._tryConnect, this).addArgs(false), null,
+ account.registerView(new Callback(this._tryConnectLazy, this).addArgs(false), null,
"connectionInfo");
}
}
Oops, something went wrong.

0 comments on commit 35cffc2

Please sign in to comment.