summaryrefslogtreecommitdiff
path: root/examples/simple-pim/simple.h
authorzecke <zecke>2003-08-31 15:20:46 (UTC)
committer zecke <zecke>2003-08-31 15:20:46 (UTC)
commitce4a99860d28e003871994cca88a82133c1921a7 (patch) (unidiff)
treeb1ad7486a1703d772d96e1aecd0a49cfcfa90959 /examples/simple-pim/simple.h
parentd868ed99b6018a969239d079767925c929c71fad (diff)
downloadopie-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
Diffstat (limited to 'examples/simple-pim/simple.h') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/simple-pim/simple.h95
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
24class QPushButton; // forward declaration to not include the header. This can save time when compiling
25class QAction;
26class PIMListView;
27class QDate;
28class QCopChannel;
29class OWait;
30class 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 */
37class MainWindow : public QMainWindow {
38 Q_OBJECT
39public:
40 static QString appName() { return QString::fromLatin1("simple-pim"); }
41 MainWindow( QWidget* parent, const char* name, WFlags fl );
42 ~MainWindow();
43
44public slots:
45 void setDocument( const QString& );
46private 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
55private:
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 */
76class PIMListView : public QListView {
77 Q_OBJECT
78public:
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
87signals:
88 void showRecord( const OPimRecord& );
89
90private:
91 static QString makeString( const OEffectiveEvent& ev );
92
93};
94
95#endif