Qtopia library API Documentation

datebookdb.h

00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef DATEBOOKDB_H
00022 #define DATEBOOKDB_H
00023 
00024 #include <qdatetime.h>
00025 #include <qfile.h>
00026 #include <qvaluelist.h>
00027 #include <qpe/event.h>
00028 
00029 // journal actions...
00030 enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE };
00031 
00032 class DateBookDBPrivate;
00033 class DateBookDB
00034 {
00035 public:
00036     DateBookDB();
00037     ~DateBookDB();
00038 
00039     // very depreciated now!!!
00040     QValueList<Event> getEvents( const QDate &from, const QDate &to );
00041     QValueList<Event> getEvents( const QDateTime &start );
00042 
00043     // USE THESE!!!
00044     QValueList<EffectiveEvent> getEffectiveEvents( const QDate &from,
00045                            const QDate &to );
00046     QValueList<EffectiveEvent> getEffectiveEvents( const QDateTime &start );
00047 
00048     QValueList<Event> getRawRepeats() const;
00049     QValueList<Event> getNonRepeatingEvents( const QDate &from,
00050                          const QDate &to ) const;
00051 
00052     // Use these when dealing with adding removing events...
00053     void addEvent( const Event &ev, bool doalarm=TRUE );
00054     void removeEvent( const Event &ev );
00055     void editEvent( const Event &old, Event &ev );
00056     // add/remove event without journaling ( these ended up in public by accident, never
00057     // use them unless you know what you are doing...),
00058     // please put them in private if we ever can change the class...
00059     void addJFEvent( const Event &ev, bool doalarm=TRUE );
00060     void removeJFEvent( const Event &ev );
00061 
00062     bool save();
00063     void reload();
00064 private:
00065     //find the real repeat...
00066     bool origRepeat( const Event &ev, Event &orig ) const;
00067     bool removeRepeat( const Event &ev );
00068     void init();
00069     void loadFile( const QString &strFile );
00070     // depreciated...
00071     void saveJournalEntry( const Event &ev, journal_action action );
00072     // new version, uncomment the "= -1" when we remove the above
00073     // function..
00074     bool saveJournalEntry( const Event &ev, journal_action action,
00075                int key/* = -1*/, bool origHadRepeat = false );
00076 
00077     QValueList<Event> eventList; // non-repeating events...
00078     QValueList<Event> repeatEvents; // the repeating events...
00079     DateBookDBPrivate *d;
00080     QFile journalFile;
00081 
00082     int recordIdMax;  // ADDITION
00083 };
00084 
00085 /* helper functions, also useful to other apps. */
00086 bool nextOccurance( const Event &e, const QDate &from, QDateTime &next);
00087 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:04 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001