00001 #ifndef OPIE_DATE_BOOK_VIEW_H
00002 #define OPIE_DATE_BOOK_VIEW_H
00003
00004 #include <qpixmap.h>
00005 #include <qwidget.h>
00006
00007 #include <opie/oevent.h>
00008 #include <opie/odatebookaccess.h>
00009
00010 class Config;
00011 namespace Datebook {
00012 class MainWindow;
00013 class View {
00014 public:
00015 View( MainWindow* window, QWidget* parent );
00016 virtual ~View();
00017
00018 static QDate dateFromWeek( int week, int year, bool startOnMonda );
00019 static bool calcWeek( const QDate& d, int &week, int &year, bool startOnMonday = false );
00020
00021 virtual QPixmap pixmap()const = 0;
00022
00026 virtual QCString type()const = 0;
00027
00031 virtual QString name()const = 0;
00032 virtual QString description()const = 0;
00033
00037 virtual int currentItem()const = 0;
00038
00043 void loadConfig( Config* );
00044 void saveConfig( Config* );
00045
00051 virtual void currentRange( const QDateTime& src, const QDateTime& from) = 0;
00052
00056 virtual void clockChanged() = 0;
00057
00062 virtual void dayChanged() = 0;
00063
00068 virtual void showDay( const QDate& date ) = 0;
00069
00073 virtual QWidget* widget() = 0;
00074
00078 virtual void reschedule() = 0;
00079 protected:
00080 void popup( int uid);
00081 QString toShortText(const OEffectiveEvent& eff)const;
00082 QString toText(const OEffectiveEvent& eff)const;
00083 virtual void doLoadConfig( Config* ) = 0;
00084 virtual void doSaveConfig( Config* ) = 0;
00085
00090 void add( const QDate& start );
00091
00095 void add( const QDateTime& start, const QDateTime& end );
00096
00100 void edit( int uid );
00101
00105 void remove( int uid );
00106
00110 ODateBookAccess::List allEvents()const;
00111
00115 OEffectiveEvent::ValueList events( const QDate& start, const QDate& end );
00116
00120 OEvent event( int uid )const;
00121
00125 bool isAP()const;
00126
00130 bool weekStartOnMonday()const;
00131
00135 QList<OPimRecord> records( const QDate& on );
00136 QList<OPimRecord> records( const QDate& start, const QDate& to );
00137
00138 private:
00139 MainWindow* m_win;
00140 };
00141 }
00142
00143 #endif