-rw-r--r-- | core/pim/datebook2/view.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/core/pim/datebook2/view.h b/core/pim/datebook2/view.h new file mode 100644 index 0000000..a7bc1d8 --- a/dev/null +++ b/core/pim/datebook2/view.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef OPIE_DATE_BOOK_VIEW_H | ||
2 | #define OPIE_DATE_BOOK_VIEW_H | ||
3 | |||
4 | #include <qpixmap.h> | ||
5 | #include <qwidget.h> | ||
6 | |||
7 | #include <opie/oevent.h> | ||
8 | #include <opie/odatebookaccess.h> | ||
9 | |||
10 | class Config; | ||
11 | namespace Datebook { | ||
12 | class MainWindow; | ||
13 | class View { | ||
14 | public: | ||
15 | View( MainWindow* window, QWidget* parent ); | ||
16 | virtual ~View() = 0; | ||
17 | |||
18 | static QDate dateFromWeek( int week, int year, bool startOnMonda ); | ||
19 | static bool calcWeek( const QDate& d, int &week, int &year, bool startOnMonday = false ); | ||
20 | |||
21 | virtual QPixmap pixmap()const = 0; | ||
22 | virtual QString description()const = 0; | ||
23 | |||
24 | /** | ||
25 | * loadConfig | ||
26 | * saveConfig | ||
27 | */ | ||
28 | void loadConfig( Config* ); | ||
29 | void saveConfig( Config* ); | ||
30 | |||
31 | /** | ||
32 | * the current range | ||
33 | */ | ||
34 | void currentRange( const QDateTime& src, const QDateTime& from); | ||
35 | |||
36 | /** | ||
37 | * the clock format changed | ||
38 | */ | ||
39 | virtual void clockChanged() = 0; | ||
40 | |||
41 | /** | ||
42 | * the day change means that either | ||
43 | * monday or sunday is the week start | ||
44 | */ | ||
45 | virtual void dayChanged() = 0; | ||
46 | |||
47 | /** | ||
48 | * show date in your view!! | ||
49 | */ | ||
50 | virtual void showDay( const QDate& date ) = 0; | ||
51 | |||
52 | /** | ||
53 | * return the widget | ||
54 | */ | ||
55 | virtual QWidget* widget(); | ||
56 | |||
57 | /** | ||
58 | * the view needs an update! | ||
59 | */ | ||
60 | virtual void reschedule() = 0 | ||
61 | protected: | ||
62 | void popup( int ); | ||
63 | QString toShortText(const OEffectiveEvent& eff)const; | ||
64 | QString toText(const OEffectiveEvent& eff)const; | ||
65 | virtual void doLoadConfig( Config* ) = 0; | ||
66 | virtual void doSaveConfig( Config* ) = 0; | ||
67 | |||
68 | /** | ||
69 | * create a new event starting | ||
70 | * on start | ||
71 | */ | ||
72 | void add( const QDate& start ); | ||
73 | |||
74 | /** | ||
75 | * create a new event in a given range | ||
76 | */ | ||
77 | void add( const QDateTime& start, const QDateTime& end ); | ||
78 | |||
79 | /** | ||
80 | * will make the MainWindow to open the editor | ||
81 | */ | ||
82 | void edit( int uid ); | ||
83 | |||
84 | /** | ||
85 | * remove item with uid | ||
86 | */ | ||
87 | void remove( int uid ); | ||
88 | |||
89 | /** | ||
90 | * give access to all events | ||
91 | */ | ||
92 | ODateBookAccess::List allEvents()const; | ||
93 | |||
94 | /** | ||
95 | * return events | ||
96 | */ | ||
97 | OEffectiveEvent::ValueList events( const QDate& start, const QDate& end ); | ||
98 | |||
99 | /** | ||
100 | * return an Event | ||
101 | */ | ||
102 | OEvent event( int uid )const; | ||
103 | |||
104 | /** | ||
105 | * Is the clock AP/PM or 24h? | ||
106 | */ | ||
107 | bool isAP()const; | ||
108 | |||
109 | /** | ||
110 | * if the week starts on monday? | ||
111 | */ | ||
112 | bool weekStartOnMonday()const; | ||
113 | |||
114 | /** | ||
115 | * return related records for days | ||
116 | */ | ||
117 | QPtrList<OPimRecord> records( const QDate& on ); | ||
118 | QPtrList<OPimRecord> records( const QDate& start, const QDate& to ); | ||
119 | }; | ||
120 | } | ||
121 | |||
122 | #endif | ||