00001 00002 /* 00003 * A Simple widget with a button to quit 00004 * 00005 */ 00006 00007 /* 00008 * The below sequence is called a guard and guards 00009 * against multiple inclusion of header files 00010 * NOTE: you need to use unique names among the header files 00011 */ 00012 #ifndef QUIET_SIMPLE_DEMO_H 00013 #define QUIET_SIMPLE_DEMO_H 00014 00015 00016 00017 00018 #include <qmainwindow.h> // from this class we will inherit 00019 #include <qlistview.h> // A ListView for our PIM records 00020 00021 #include <opie2/otodoaccess.h> 00022 #include <opie2/odatebookaccess.h> 00023 00024 class QPushButton; // forward declaration to not include the header. This can save time when compiling 00025 class QAction; 00026 class PIMListView; 00027 class QDate; 00028 class QCopChannel; 00029 namespace Opie{ 00030 namespace Ui { 00031 class OWait; 00032 class OTabWidget; 00033 } 00034 } 00035 00036 /* 00037 * A mainwindow is a special QWidget it helps layouting 00038 * toolbar, statusbar, menubar. Got dockable areas 00039 * So in one sentence it is a MainWindow :) 00040 */ 00041 class MainWindow : public QMainWindow { 00042 Q_OBJECT 00043 public: 00044 static QString appName() { return QString::fromLatin1("simple-pim"); } 00045 MainWindow( QWidget* parent, const char* name, WFlags fl ); 00046 ~MainWindow(); 00047 00048 public slots: 00049 void setDocument( const QString& ); 00050 private slots: 00051 void slotDesktopReceive( const QCString&, const QByteArray& ); 00052 void slotLoad(); 00053 void slotLoadForDay(int, int, int ); 00054 void slotLoadForDay(const QDate&); 00055 void slotShow(); 00056 void slotDate(); 00057 void slotShowRecord( const Opie::OPimRecord& ); 00058 00059 private: 00060 void initUI(); 00061 QAction *m_fire; 00062 QAction *m_dateAction; 00063 Opie::Ui::OTabWidget* m_tab; 00064 00065 Opie::OPimTodoAccess m_tb; 00066 Opie::ODateBookAccess m_db; 00067 PIMListView *m_todoView; 00068 PIMListView *m_dateView; 00069 00070 int m_synced; // a counter for synced objects.. 00071 QCopChannel *m_desktopChannel; 00072 Opie::Ui::OWait *m_loading; 00073 }; 00074 00075 /* 00076 * Instead of the simple QWidgets we will design 00077 * a new widget based on a QListView 00078 * it should show either Todos or EffectiveEvents 00079 */ 00080 class PIMListView : public QListView { 00081 Q_OBJECT 00082 public: 00083 PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); 00084 ~PIMListView(); 00085 00086 00087 void set( Opie::OPimTodoAccess::List ); 00088 void set( const Opie::OPimOccurrence::List& ); 00089 void showCurrentRecord(); 00090 00091 signals: 00092 void showRecord( const Opie::OPimRecord& ); 00093 00094 private: 00095 static QString makeString( const Opie::OPimOccurrence& ev ); 00096 00097 }; 00098 00099 #endif
1.4.2