annotate content/collections.js @ 238:d1a66c6f41c4

make unsubscribe work again
author Myk Melez <myk@mozilla.org>
date Tue, 05 Aug 2008 12:44:46 -0700
parents b324ba5e93f0
children 5982695f4890
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
229
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
1 /* ***** BEGIN LICENSE BLOCK *****
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
3 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
4 * The contents of this file are subject to the Mozilla Public License Version
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
5 * 1.1 (the "License"); you may not use this file except in compliance with
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
6 * the License. You may obtain a copy of the License at
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
7 * http://www.mozilla.org/MPL/
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
8 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
9 * Software distributed under the License is distributed on an "AS IS" basis,
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
11 * for the specific language governing rights and limitations under the
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
12 * License.
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
13 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
14 * The Original Code is Snowl.
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
15 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
16 * The Initial Developer of the Original Code is Mozilla.
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
17 * Portions created by the Initial Developer are Copyright (C) 2008
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
18 * the Initial Developer. All Rights Reserved.
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
19 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
20 * Contributor(s):
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
21 * Myk Melez <myk@mozilla.org>
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
22 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
23 * Alternatively, the contents of this file may be used under the terms of
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
26 * in which case the provisions of the GPL or the LGPL are applicable instead
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
27 * of those above. If you wish to allow use of your version of this file only
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
28 * under the terms of either the GPL or the LGPL, and not to allow others to
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
29 * use your version of this file under the terms of the MPL, indicate your
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
30 * decision by deleting the provisions above and replace them with the notice
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
31 * and other provisions required by the GPL or the LGPL. If you do not delete
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
32 * the provisions above, a recipient may use your version of this file under
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
33 * the terms of any one of the MPL, the GPL or the LGPL.
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
34 *
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
35 * ***** END LICENSE BLOCK ***** */
b324ba5e93f0 add license header blocks to all CSS & JS files
Myk Melez <myk@mozilla.org>
parents: 225
diff changeset
36
45
a3811857c5dc register the resource alias to the top-level directory rather than the modules directory for consistency with resource://gre/modules/ URLs and so we can use it to load resources from elsewhere in the extension later; this means converting chrome://snowl/module.js URLs into chrome://snowl/modules/module.js URLs
Myk Melez <myk@mozilla.org>
parents: 39
diff changeset
37 Cu.import("resource://snowl/modules/service.js");
a3811857c5dc register the resource alias to the top-level directory rather than the modules directory for consistency with resource://gre/modules/ URLs and so we can use it to load resources from elsewhere in the extension later; this means converting chrome://snowl/module.js URLs into chrome://snowl/modules/module.js URLs
Myk Melez <myk@mozilla.org>
parents: 39
diff changeset
38 Cu.import("resource://snowl/modules/datastore.js");
a3811857c5dc register the resource alias to the top-level directory rather than the modules directory for consistency with resource://gre/modules/ URLs and so we can use it to load resources from elsewhere in the extension later; this means converting chrome://snowl/module.js URLs into chrome://snowl/modules/module.js URLs
Myk Melez <myk@mozilla.org>
parents: 39
diff changeset
39 Cu.import("resource://snowl/modules/log4moz.js");
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
40 Cu.import("resource://snowl/modules/source.js");
106
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
41 Cu.import("resource://snowl/modules/feed.js");
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
42 Cu.import("resource://snowl/modules/URI.js");
165
91524ab2554c allow listing by person
Myk Melez <myk@mozilla.org>
parents: 138
diff changeset
43 Cu.import("resource://snowl/modules/identity.js");
169
d5cc6dfafc40 basic support for grouping in the collection object
Myk Melez <myk@mozilla.org>
parents: 167
diff changeset
44 Cu.import("resource://snowl/modules/collection.js");
16
8efec269810d get rid of init.js and a bunch of unused code in snowl.js
Myk Melez <myk@mozilla.org>
parents: 12
diff changeset
45
194
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
46 // FIXME: make this configurable.
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
47 const SNOWL_COLLECTIONS_HIERARCHICAL = false;
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
48
187
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
49 let SourcesView = {
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
50 _log: null,
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
51
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
52 // Observer Service
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
53 get _obsSvc() {
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
54 let obsSvc = Cc["@mozilla.org/observer-service;1"].
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
55 getService(Ci.nsIObserverService);
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
56 delete this._obsSvc;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
57 this._obsSvc = obsSvc;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
58 return this._obsSvc;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
59 },
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
60
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
61 get _tree() {
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
62 delete this._tree;
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
63 return this._tree = document.getElementById("sourcesView");
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
64 },
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
65
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
66 get _children() {
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
67 delete this._children;
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
68 return this._children = this._tree.getElementsByTagName("treechildren")[0];
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
69 },
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
70
106
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
71
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
72 //**************************************************************************//
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
73 // Initialization & Destruction
2a08b4a82802 integrate OPML import into the sidebar
Myk Melez <myk@mozilla.org>
parents: 105
diff changeset
74
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
75 init: function() {
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
76 this._log = Log4Moz.Service.getLogger("Snowl.Sidebar");
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
77 this._obsSvc.addObserver(this, "sources:changed", true);
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
78 this._getCollections();
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
79 this._tree.view = this;
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
80
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
81 // Add a capturing click listener to the tree so we can find out if the user
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
82 // clicked on a row that is already selected (in which case we let them edit
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
83 // the collection name).
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
84 // FIXME: disable this for names that can't be changed.
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
85 this._tree.addEventListener("mousedown", function(aEvent) { SourcesView.onClick(aEvent) }, true);
212
cf89d5c676c0 persist collection and group in the URL, and delay loading content until the collections sidebar has loaded
Myk Melez <myk@mozilla.org>
parents: 211
diff changeset
86
cf89d5c676c0 persist collection and group in the URL, and delay loading content until the collections sidebar has loaded
Myk Melez <myk@mozilla.org>
parents: 211
diff changeset
87 gMessageViewWindow.SnowlMessageView.onCollectionsLoaded();
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
88 },
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
89
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
90
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
91 //**************************************************************************//
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
92 // nsITreeView
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
93
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
94 selection: null,
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
95
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
96 get rowCount() {
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
97 return this._rows.length;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
98 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
99
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
100 // FIXME: consolidate these two references.
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
101 _treebox: null,
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
102 setTree: function(treeBox) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
103 this._treeBox = treeBox;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
104 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
105
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
106 getCellText : function(row, column) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
107 return this._rows[row].name;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
108 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
109
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
110 isContainer: function(row) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
111 //this._log.info("isContainer: " + (this._rows[row].groups ? true : false));
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
112 return (this._rows[row].groups ? true : false);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
113 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
114 isContainerOpen: function(row) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
115 //this._log.info("isContainerOpen: " + this._rows[row].isOpen);
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
116 return this._rows[row].isOpen;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
117 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
118 isContainerEmpty: function(row) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
119 //this._log.info("isContainerEmpty: " + row + " " + this._rows[row].groups.length + " " + (this._rows[row].groups.length == 0));
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
120 return (this._rows[row].groups.length == 0);
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
121 },
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
122
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
123 isSeparator: function(row) { return false },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
124 isSorted: function() { return false },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
125
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
126 // FIXME: make this return true for collection names that are editable,
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
127 // and then implement name editing on the new architecture.
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
128 isEditable: function(row, column) { return false },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
129
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
130 getParentIndex: function(row) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
131 //this._log.info("getParentIndex: " + row);
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
132
179
ab9b528514e6 don't indent the All collection, and support more flexible hierarchy
Myk Melez <myk@mozilla.org>
parents: 178
diff changeset
133 let thisLevel = this.getLevel(row);
ab9b528514e6 don't indent the All collection, and support more flexible hierarchy
Myk Melez <myk@mozilla.org>
parents: 178
diff changeset
134
194
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
135 if (thisLevel == 0)
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
136 return -1;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
137 for (let t = row - 1; t >= 0; t--)
179
ab9b528514e6 don't indent the All collection, and support more flexible hierarchy
Myk Melez <myk@mozilla.org>
parents: 178
diff changeset
138 if (this.getLevel(t) < thisLevel)
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
139 return t;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
140
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
141 throw "getParentIndex: couldn't figure out parent index for row " + row;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
142 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
143
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
144 getLevel: function(row) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
145 //this._log.info("getLevel: " + row);
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
146
194
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
147 if (!SNOWL_COLLECTIONS_HIERARCHICAL)
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
148 return 0;
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
149
179
ab9b528514e6 don't indent the All collection, and support more flexible hierarchy
Myk Melez <myk@mozilla.org>
parents: 178
diff changeset
150 return this._rows[row].level;
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
151 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
152
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
153 hasNextSibling: function(idx, after) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
154 //this._log.info("hasNextSibling: " + idx + " " + after);
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
155
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
156 let thisLevel = this.getLevel(idx);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
157 for (let t = idx + 1; t < this._rows.length; t++) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
158 let nextLevel = this.getLevel(t);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
159 if (nextLevel == thisLevel)
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
160 return true;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
161 if (nextLevel < thisLevel)
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
162 return false;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
163 }
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
164
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
165 return false;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
166 },
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
167
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
168 getImageSrc: function(row, column) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
169 if (column.id == "nameCol") {
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
170 let iconURL = this._rows[row].iconURL;
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
171 if (iconURL)
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
172 return iconURL.spec;
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
173 }
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
174
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
175 return null;
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
176 },
28
0d34d2108b49 use a custom view for the message pane
Myk Melez <myk@mozilla.org>
parents: 21
diff changeset
177
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
178 toggleOpenState: function(idx) {
177
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
179 //this._log.info("toggleOpenState: " + idx);
06a3197f71b1 make favicons work
Myk Melez <myk@mozilla.org>
parents: 176
diff changeset
180
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
181 let item = this._rows[idx];
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
182 if (!item.groups)
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
183 return;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
184
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
185 if (item.isOpen) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
186 item.isOpen = false;
28
0d34d2108b49 use a custom view for the message pane
Myk Melez <myk@mozilla.org>
parents: 21
diff changeset
187
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
188 let thisLevel = this.getLevel(idx);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
189 let numToDelete = 0;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
190 for (let t = idx + 1; t < this._rows.length; t++) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
191 if (this.getLevel(t) > thisLevel)
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
192 numToDelete++;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
193 else
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
194 break;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
195 }
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
196 if (numToDelete) {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
197 this._rows.splice(idx + 1, numToDelete);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
198 this._treeBox.rowCountChanged(idx + 1, -numToDelete);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
199 }
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
200 }
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
201 else {
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
202 item.isOpen = true;
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
203
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
204 let groups = this._rows[idx].groups;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
205 for (let i = 0; i < groups.length; i++)
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
206 this._rows.splice(idx + 1 + i, 0, groups[i]);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
207 this._treeBox.rowCountChanged(idx + 1, groups.length);
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
208 }
108
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
209 },
ec5e374be495 show favicons in the subscriptions sidebar
Myk Melez <myk@mozilla.org>
parents: 106
diff changeset
210
195
1abed11b59f9 display icons for people
Myk Melez <myk@mozilla.org>
parents: 194
diff changeset
211 getRowProperties: function (row, properties) {},
1abed11b59f9 display icons for people
Myk Melez <myk@mozilla.org>
parents: 194
diff changeset
212 getCellProperties: function (row, column, properties) {},
1abed11b59f9 display icons for people
Myk Melez <myk@mozilla.org>
parents: 194
diff changeset
213 getColumnProperties: function(columnID, column, properties) {},
28
0d34d2108b49 use a custom view for the message pane
Myk Melez <myk@mozilla.org>
parents: 21
diff changeset
214
0d34d2108b49 use a custom view for the message pane
Myk Melez <myk@mozilla.org>
parents: 21
diff changeset
215 setCellText: function(aRow, aCol, aValue) {
75
877a7694445f update the sources table schema, changing the title column to name and differentiating between machine-processable and human-readable URIs
Myk Melez <myk@mozilla.org>
parents: 45
diff changeset
216 let statement = SnowlDatastore.createStatement("UPDATE sources SET name = :name WHERE id = :id");
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
217 statement.params.name = this._rows[aRow].name = aValue;
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
218 statement.params.id = this._rows[aRow].id;
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
219
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
220 try {
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
221 statement.execute();
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
222 }
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
223 finally {
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
224 statement.reset();
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
225 }
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
226 },
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
227
28
0d34d2108b49 use a custom view for the message pane
Myk Melez <myk@mozilla.org>
parents: 21
diff changeset
228
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
229 //**************************************************************************//
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
230 // Misc XPCOM Interface Implementations
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
231
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
232 // nsISupports
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
233 QueryInterface: function(aIID) {
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
234 if (aIID.equals(Ci.nsIObserver) ||
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
235 aIID.equals(Ci.nsISupportsWeakReference) ||
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
236 aIID.equals(Ci.nsISupports))
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
237 return this;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
238
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
239 throw Cr.NS_ERROR_NO_INTERFACE;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
240 },
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
241
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
242 // nsIObserver
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
243 observe: function(subject, topic, data) {
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
244 switch (topic) {
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
245 case "sources:changed":
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
246 this._getCollections();
105
cd3267665afd reinit the sidebar view when the number of rows changes
Myk Melez <myk@mozilla.org>
parents: 75
diff changeset
247 // Rebuild the view to reflect the new collection of messages.
cd3267665afd reinit the sidebar view when the number of rows changes
Myk Melez <myk@mozilla.org>
parents: 75
diff changeset
248 // Since the number of rows might have changed, we do this by reinitializing
cd3267665afd reinit the sidebar view when the number of rows changes
Myk Melez <myk@mozilla.org>
parents: 75
diff changeset
249 // the view instead of merely invalidating the box object (which doesn't
cd3267665afd reinit the sidebar view when the number of rows changes
Myk Melez <myk@mozilla.org>
parents: 75
diff changeset
250 // expect changes to the number of rows).
cd3267665afd reinit the sidebar view when the number of rows changes
Myk Melez <myk@mozilla.org>
parents: 75
diff changeset
251 this._tree.view = this;
10
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
252 break;
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
253 }
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
254 },
64defcf896f1 update the list of sources when the user subscribes to one
Myk Melez <myk@mozilla.org>
parents: 9
diff changeset
255
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
256 _collections: null,
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
257 _getCollections: function() {
178
1a27019af73e reimplement the 'All' collection on the new architecture
Myk Melez <myk@mozilla.org>
parents: 177
diff changeset
258 this._collections = [];
1a27019af73e reimplement the 'All' collection on the new architecture
Myk Melez <myk@mozilla.org>
parents: 177
diff changeset
259
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
260 let statement = SnowlDatastore.createStatement(
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
261 "SELECT id, name, iconURL, grouped, groupIDColumn, groupNameColumn, " +
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
262 "groupHomeURLColumn, groupIconURLColumn FROM collections ORDER BY orderKey"
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
263 );
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
264
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
265 statement.QueryInterface(Ci.mozIStorageStatementWrapper);
165
91524ab2554c allow listing by person
Myk Melez <myk@mozilla.org>
parents: 138
diff changeset
266
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
267 try {
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
268 while (statement.step()) {
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
269 this._collections.push(new SnowlCollection(statement.row.id,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
270 statement.row.name,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
271 URI.get(statement.row.iconURL),
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
272 null,
212
cf89d5c676c0 persist collection and group in the URL, and delay loading content until the collections sidebar has loaded
Myk Melez <myk@mozilla.org>
parents: 211
diff changeset
273 null,
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
274 statement.row.grouped ? true : false,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
275 statement.row.groupIDColumn,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
276 statement.row.groupNameColumn,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
277 statement.row.groupHomeURLColumn,
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
278 statement.row.groupIconURLColumn));
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
279 }
175
5409a8759186 collection object rearch: encapsulate grouping info into grouping object
Myk Melez <myk@mozilla.org>
parents: 174
diff changeset
280 }
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
281 finally {
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
282 statement.reset();
180
33e517403dc8 add the people view
Myk Melez <myk@mozilla.org>
parents: 179
diff changeset
283 }
33e517403dc8 add the people view
Myk Melez <myk@mozilla.org>
parents: 179
diff changeset
284
172
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
285 // Build the list of rows in the tree. By default, all containers
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
286 // are closed, so this is the same as the list of collections, although
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
287 // in the future we might persist and restore the open state.
3ec4ba145105 support for a hierarchical tree view
Myk Melez <myk@mozilla.org>
parents: 171
diff changeset
288 // XXX Should this work be in a separate function?
194
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
289 if (SNOWL_COLLECTIONS_HIERARCHICAL) {
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
290 this._rows = [collection for each (collection in this._collections)];
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
291 }
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
292 else {
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
293 this._rows = [];
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
294 for each (let collection in this._collections) {
211
9c5fdc76cb35 store the list of collections in the database
Myk Melez <myk@mozilla.org>
parents: 202
diff changeset
295 if (collection.grouped)
194
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
296 for each (let group in collection.groups)
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
297 this._rows.push(group);
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
298 else
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
299 this._rows.push(collection);
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
300 }
bdb8643cbeab flatten the list of collections
Myk Melez <myk@mozilla.org>
parents: 187
diff changeset
301 }
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
302 },
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
303
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
304 onSelect: function(aEvent) {
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
305 if (this._tree.currentIndex == -1)
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
306 return;
173
4d59aa183d57 get loading of a group into the list view working
Myk Melez <myk@mozilla.org>
parents: 172
diff changeset
307
4d59aa183d57 get loading of a group into the list view working
Myk Melez <myk@mozilla.org>
parents: 172
diff changeset
308 let collection = this._rows[this._tree.currentIndex];
184
e005621994a3 basic integration of collections view into river view, except that collection selections don't persist
Myk Melez <myk@mozilla.org>
parents: 183
diff changeset
309 gMessageViewWindow.SnowlMessageView.setCollection(collection);
9
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
310 },
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
311
21
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
312 onClick: function(aEvent) {
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
313 this._log.info("on click");
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
314 //this._log.info(Log4Moz.enumerateProperties(aEvent).join("\n"));
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
315 //this._log.info(aEvent.target.nodeName);
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
316
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
317 let row = {}, col = {}, child = {};
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
318 this._tree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, child);
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
319 if (this._tree.view.selection.isSelected(row.value))
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
320 this._log.info(row.value + " is selected");
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
321 else
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
322 this._log.info(row.value + " is not selected");
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
323 },
df5025ed1a7b supress some log messages
Myk Melez <myk@mozilla.org>
parents: 16
diff changeset
324
138
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
325 subscribe: function(event) {
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
326 gBrowserWindow.gBrowser.selectedTab =
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
327 gBrowserWindow.gBrowser.addTab("chrome://snowl/content/subscribe.xul");
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
328 },
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
329
58b04d16257c integrate subscription UI into a single page
Myk Melez <myk@mozilla.org>
parents: 137
diff changeset
330 unsubscribe: function(aEvent) {
238
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
331 let collection = this._rows[this._tree.currentIndex];
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
332
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
333 if (!collection.parent || collection.parent.groupIDColumn != "sources.id")
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
334 return;
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
335
d1a66c6f41c4 make unsubscribe work again
Myk Melez <myk@mozilla.org>
parents: 229
diff changeset
336 let sourceID = this._rows[this._tree.currentIndex].groupID;
11
40c49a0e9e34 update the list of sources when the user unsubscribes from one
Myk Melez <myk@mozilla.org>
parents: 10
diff changeset
337
9
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
338 SnowlDatastore.dbConnection.beginTransaction();
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
339 try {
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
340 SnowlDatastore.dbConnection.executeSimpleSQL("DELETE FROM metadata WHERE messageID IN (SELECT id FROM messages WHERE sourceID = " + sourceID + ")");
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
341 SnowlDatastore.dbConnection.executeSimpleSQL("DELETE FROM parts WHERE messageID IN (SELECT id FROM messages WHERE sourceID = " + sourceID + ")");
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
342 SnowlDatastore.dbConnection.executeSimpleSQL("DELETE FROM messages WHERE sourceID = " + sourceID);
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
343 SnowlDatastore.dbConnection.executeSimpleSQL("DELETE FROM sources WHERE id = " + sourceID);
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
344 SnowlDatastore.dbConnection.commitTransaction();
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
345 }
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
346 catch(ex) {
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
347 SnowlDatastore.dbConnection.rollbackTransaction();
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
348 throw ex;
d8abd85fc94d implement basic subscribe and unsubscribe
Myk Melez <myk@mozilla.org>
parents: 8
diff changeset
349 }
11
40c49a0e9e34 update the list of sources when the user unsubscribes from one
Myk Melez <myk@mozilla.org>
parents: 10
diff changeset
350
12
dfd64db41b8a make sure both sources and messages get updated when the user unsubscribes
Myk Melez <myk@mozilla.org>
parents: 11
diff changeset
351 this._obsSvc.notifyObservers(null, "sources:changed", null);
dfd64db41b8a make sure both sources and messages get updated when the user unsubscribes
Myk Melez <myk@mozilla.org>
parents: 11
diff changeset
352 this._obsSvc.notifyObservers(null, "messages:changed", null);
167
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
353 },
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
354
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
355
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
356 //**************************************************************************//
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
357 // OPML Export
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
358 // Based on code in Thunderbird's feed-subscriptions.js
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
359
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
360 exportOPML: function() {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
361 let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
362 fp.init(window, "Export feeds as an OPML file", Ci.nsIFilePicker.modeSave);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
363 fp.appendFilter("OPML Files", "*.opml");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
364 fp.appendFilters(Ci.nsIFilePicker.filterXML | Ci.nsIFilePicker.filterAll);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
365 fp.defaultString = "feeds.opml";
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
366 fp.defaultExtension = "opml";
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
367
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
368 let rv = fp.show();
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
369
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
370 if (rv == Ci.nsIFilePicker.returnCancel)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
371 return;
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
372
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
373 let doc = this._createOPMLDocument();
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
374
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
375 // Format the document with newlines and indentation so it's easier
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
376 // for humans to read.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
377 this._prettifyNode(doc.documentElement, 0);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
378
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
379 let serializer = new XMLSerializer();
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
380 let foStream = Cc["@mozilla.org/network/file-output-stream;1"].
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
381 createInstance(Ci.nsIFileOutputStream);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
382 // default mode: write | create | truncate
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
383 let mode = 0x02 | 0x08 | 0x20;
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
384 foStream.init(fp.file, mode, 0666, 0);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
385 serializer.serializeToStream(doc, foStream, "utf-8");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
386 },
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
387
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
388 _createOPMLDocument: function() {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
389 let doc = document.implementation.createDocument("", "opml", null);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
390 let root = doc.documentElement;
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
391 root.setAttribute("version", "1.0");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
392
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
393 // Create the <head> element.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
394 let head = doc.createElement("head");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
395 root.appendChild(head);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
396
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
397 let title = doc.createElement("title");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
398 head.appendChild(title);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
399 title.appendChild(doc.createTextNode("Snowl OPML Export"));
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
400
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
401 let dt = doc.createElement("dateCreated");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
402 head.appendChild(dt);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
403 dt.appendChild(doc.createTextNode((new Date()).toGMTString()));
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
404
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
405 // Create the <body> element.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
406 let body = doc.createElement("body");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
407 root.appendChild(body);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
408
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
409 // Populate the <body> element with <outline> elements.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
410 let sources = SnowlSource.getAll();
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
411 for each (let source in sources) {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
412 let outline = doc.createElement("outline");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
413 // XXX Should we specify the |type| attribute, and should we specify
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
414 // type="atom" for Atom feeds or just type="rss" for all feeds?
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
415 // This document says the latter but is three years old:
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
416 // http://www.therssweblog.com/?guid=20051003145153
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
417 //outline.setAttribute("type", "rss");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
418 outline.setAttribute("text", source.name);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
419 outline.setAttribute("url", source.humanURI.spec);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
420 outline.setAttribute("xmlUrl", source.machineURI.spec);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
421 body.appendChild(outline);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
422 }
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
423
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
424 return doc;
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
425 },
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
426
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
427 _prettifyNode: function(node, level) {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
428 let doc = node.ownerDocument;
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
429
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
430 // Create a string containing two spaces for every level deep we are.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
431 let indentString = new Array(level + 1).join(" ");
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
432
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
433 // Indent the tag.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
434 if (level > 0)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
435 node.parentNode.insertBefore(doc.createTextNode(indentString), node);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
436
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
437 // Grab the list of nodes to format. We can't just use node.childNodes
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
438 // because it'd change under us as we insert formatting nodes.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
439 let childNodesToFormat = [];
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
440 for (let i = 0; i < node.childNodes.length; i++)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
441 if (node.childNodes[i].nodeType == node.ELEMENT_NODE)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
442 childNodesToFormat.push(node.childNodes[i]);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
443
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
444 if (childNodesToFormat.length > 0) {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
445 for each (let childNode in childNodesToFormat)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
446 this._prettifyNode(childNode, level + 1);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
447
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
448 // Insert a newline after the opening tag.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
449 node.insertBefore(doc.createTextNode("\n"), node.firstChild);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
450
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
451 // Indent the closing tag.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
452 node.appendChild(doc.createTextNode(indentString));
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
453 }
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
454
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
455 // Insert a newline after the tag.
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
456 if (level > 0) {
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
457 if (node.nextSibling)
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
458 node.parentNode.insertBefore(doc.createTextNode("\n"),
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
459 node.nextSibling);
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
460 else
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
461 node.parentNode.appendChild(doc.createTextNode("\n"));
66b70768d5be first take at OPML export
Myk Melez <myk@mozilla.org>
parents: 165
diff changeset
462 }
8
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
463 }
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
464
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
465 };
87c6af76db52 add a sidebar listing subscriptions with basic support for selecting a subscription and seeing just its messages
Myk Melez <myk@mozilla.org>
parents:
diff changeset
466
187
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
467 // We can't listen for load and initialize then because load has already
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
468 // happened when we get overlaid onto the river view, so we just set a timeout
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
469 // by which time we hope the overlay has been loaded enough for this to work.
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
470 // FIXME: figure out a better solution here. In theory we should be able
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
471 // to make the river view observe xul-overlay-merged and then initialize us,
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
472 // but that doesn't work because of bug 392515.
dc76bd76b8bc make the collections view load into the river view even when query params have been altered
Myk Melez <myk@mozilla.org>
parents: 184
diff changeset
473 window.setTimeout(function() { SourcesView.init() }, 100);