2 * This file is part of NixNote/NeighborNote
\r
3 * Copyright 2009 Randy Baumgarte
\r
5 * This file may be licensed under the terms of of the
\r
6 * GNU General Public License Version 2 (the ``GPL'').
\r
8 * Software distributed under the License is distributed
\r
9 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
\r
10 * express or implied. See the GPL for the specific language
\r
11 * governing rights and limitations.
\r
13 * You should have received a copy of the GPL along with this
\r
14 * program. If not, go to http://www.gnu.org/licenses/gpl.html
\r
15 * or write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 package cx.fbn.nevernote.filters;
\r
22 import java.text.SimpleDateFormat;
\r
24 import com.evernote.edam.type.Note;
\r
25 import com.trolltech.qt.core.QDateTime;
\r
27 public abstract class DateAttributeFilter extends AttributeFilter {
\r
28 protected boolean checkSince;
\r
29 private final boolean checkCreated;
\r
31 public DateAttributeFilter (boolean since, boolean created) {
\r
34 checkCreated=created;
\r
38 public abstract boolean attributeCheck(Note n);
\r
40 protected QDateTime noteTime(Note n) {
\r
41 String dateTimeFormat = new String("MM/dd/yyyy HH:mm:ss");
\r
42 SimpleDateFormat simple = new SimpleDateFormat(dateTimeFormat);
\r
45 StringBuilder creationDate = new StringBuilder(simple.format(n.getCreated()));
\r
46 return QDateTime.fromString(creationDate.toString(), "MM/dd/yyyy HH:mm:ss");
\r
48 StringBuilder updatedDate = new StringBuilder(simple.format(n.getUpdated()));
\r
49 return QDateTime.fromString(updatedDate.toString(), "MM/dd/yyyy HH:mm:ss");
\r
53 protected QDateTime currentTime() {
\r
54 return QDateTime.currentDateTime();
\r