author | zecke <zecke> | 2003-08-31 15:20:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-31 15:20:46 (UTC) |
commit | ce4a99860d28e003871994cca88a82133c1921a7 (patch) (unidiff) | |
tree | b1ad7486a1703d772d96e1aecd0a49cfcfa90959 /examples/simple-pim/simple.h | |
parent | d868ed99b6018a969239d079767925c929c71fad (diff) | |
download | opie-ce4a99860d28e003871994cca88a82133c1921a7.zip opie-ce4a99860d28e003871994cca88a82133c1921a7.tar.gz opie-ce4a99860d28e003871994cca88a82133c1921a7.tar.bz2 |
Add an Example showing the udage of QCOP, PIM API and
some other nice parts
-rw-r--r-- | examples/simple-pim/simple.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/examples/simple-pim/simple.h b/examples/simple-pim/simple.h new file mode 100644 index 0000000..bf9ede7 --- a/dev/null +++ b/examples/simple-pim/simple.h | |||
@@ -0,0 +1,95 @@ | |||
1 | |||
2 | /* | ||
3 | * A Simple widget with a button to quit | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * The below sequence is called a guard and guards | ||
9 | * against multiple inclusion of header files | ||
10 | * NOTE: you need to use unique names among the header files | ||
11 | */ | ||
12 | #ifndef QUIET_SIMPLE_DEMO_H | ||
13 | #define QUIET_SIMPLE_DEMO_H | ||
14 | |||
15 | |||
16 | |||
17 | |||
18 | #include <qmainwindow.h> // from this class we will inherit | ||
19 | #include <qlistview.h> // A ListView for our PIM records | ||
20 | |||
21 | #include <opie/otodoaccess.h> | ||
22 | #include <opie/odatebookaccess.h> | ||
23 | |||
24 | class QPushButton; // forward declaration to not include the header. This can save time when compiling | ||
25 | class QAction; | ||
26 | class PIMListView; | ||
27 | class QDate; | ||
28 | class QCopChannel; | ||
29 | class OWait; | ||
30 | class OTabWidget; | ||
31 | |||
32 | /* | ||
33 | * A mainwindow is a special QWidget it helps layouting | ||
34 | * toolbar, statusbar, menubar. Got dockable areas | ||
35 | * So in one sentence it is a MainWindow :) | ||
36 | */ | ||
37 | class MainWindow : public QMainWindow { | ||
38 | Q_OBJECT | ||
39 | public: | ||
40 | static QString appName() { return QString::fromLatin1("simple-pim"); } | ||
41 | MainWindow( QWidget* parent, const char* name, WFlags fl ); | ||
42 | ~MainWindow(); | ||
43 | |||
44 | public slots: | ||
45 | void setDocument( const QString& ); | ||
46 | private slots: | ||
47 | void slotDesktopReceive( const QCString&, const QByteArray& ); | ||
48 | void slotLoad(); | ||
49 | void slotLoadForDay(int, int, int ); | ||
50 | void slotLoadForDay(const QDate&); | ||
51 | void slotShow(); | ||
52 | void slotDate(); | ||
53 | void slotShowRecord( const OPimRecord& ); | ||
54 | |||
55 | private: | ||
56 | void initUI(); | ||
57 | QAction *m_fire; | ||
58 | QAction *m_dateAction; | ||
59 | OTabWidget* m_tab; | ||
60 | |||
61 | OTodoAccess m_tb; | ||
62 | ODateBookAccess m_db; | ||
63 | PIMListView *m_todoView; | ||
64 | PIMListView *m_dateView; | ||
65 | |||
66 | int m_synced; // a counter for synced objects.. | ||
67 | QCopChannel *m_desktopChannel; | ||
68 | OWait *m_loading; | ||
69 | }; | ||
70 | |||
71 | /* | ||
72 | * Instead of the simple QWidgets we will design | ||
73 | * a new widget based on a QListView | ||
74 | * it should show either Todos or EffectiveEvents | ||
75 | */ | ||
76 | class PIMListView : public QListView { | ||
77 | Q_OBJECT | ||
78 | public: | ||
79 | PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); | ||
80 | ~PIMListView(); | ||
81 | |||
82 | |||
83 | void set( OTodoAccess::List ); | ||
84 | void set( const OEffectiveEvent::ValueList& ); | ||
85 | void showCurrentRecord(); | ||
86 | |||
87 | signals: | ||
88 | void showRecord( const OPimRecord& ); | ||
89 | |||
90 | private: | ||
91 | static QString makeString( const OEffectiveEvent& ev ); | ||
92 | |||
93 | }; | ||
94 | |||
95 | #endif | ||