add support for newer filter to collections
authorDan Mills <thunder@mozilla.com>
Tue, 10 Feb 2009 00:12:11 -0800
changeset 45226 b504719bb4fdbc6f6faeb084488c5cf1f80fccfd
parent 45220 3ed81bd05076ce782c3558b909ffbb29690360c6
child 45227 81b80edd7bfda8b7ba4aaa4f0c430c70f113ca9c
push idunknown
push userunknown
push dateunknown
add support for newer filter to collections
services/sync/modules/base_records/collection.js
--- a/services/sync/modules/base_records/collection.js
+++ b/services/sync/modules/base_records/collection.js
@@ -61,48 +61,58 @@ Collection.prototype = {
   __proto__: Resource.prototype,
   _logName: "Collection",
 
   _Coll_init: function Coll_init(uri) {
     this._init(uri);
     this.pushFilter(new JsonFilter());
     this._full = true;
     this._older = 0;
+    this._newer = 0;
     this._data = [];
   },
 
   _rebuildURL: function Coll__rebuildURL() {
     // XXX should consider what happens if it's not a URL...
     this.uri.QueryInterface(Ci.nsIURL);
 
     let args = [];
     if (this.older)
       args.push('older=' + this.older);
+    else if (this.newer)
+      args.push('newer=' + this.newer);
     if (this.full)
       args.push('full=1');
     if (this.sort)
       args.push('sort=' + this.sort);
 
     this.uri.query = (args.length > 0)? '?' + args.join('&') : '';
   },
 
   // get full items
   get full() { return this._full; },
   set full(value) {
     this._full = value;
     this._rebuildURL();
   },
 
-  // get only items modified since some date
+  // get only items modified before some date
   get older() { return this._older; },
   set older(value) {
     this._older = value;
     this._rebuildURL();
   },
 
+  // get only items modified since some date
+  get newer() { return this._newer; },
+  set newer(value) {
+    this._newer = value;
+    this._rebuildURL();
+  },
+
   // get items sorted by some criteria. valid values:
   // oldest (oldest first)
   // newest (newest first)
   // index
   // depthindex
   get sort() { return this._sort; },
   set sort(value) {
     this._sort = value;