00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef TODO_MAIN_WINDOW_H
00032 #define TODO_MAIN_WINDOW_H
00033
00034 #include <qlist.h>
00035
00036 #include <opie2/otodoaccess.h>
00037 #include <opie2/opimtodo.h>
00038 #include <opie2/opimmainwindow.h>
00039 #include <opie2/owidgetstack.h>
00040
00041 #include "smalltodo.h"
00042 #include "todoview.h"
00043 #include "quickedit.h"
00044 #include "todomanager.h"
00045
00046 class QPopupMenu;
00047 class QMenuBar;
00048 class QToolBar;
00049 class QAction;
00050 class Ir;
00051 class QVBox;
00052 class QLineEdit;
00053
00054 namespace Todo {
00055 typedef TodoView View;
00056 class TemplateManager;
00057 class Editor;
00058 class TodoShow;
00059 struct QuickEditBase;
00060
00061 class MainWindow : public Opie::OPimMainWindow {
00062 Q_OBJECT
00063 friend class TodoView;
00064 friend class TodoShow;
00065 public:
00066
00067 static QString appName() { return QString::fromLatin1("todolist"); }
00068
00069 MainWindow( QWidget *parent = 0,
00070 const char* name = 0, WFlags fl = 0 );
00071 ~MainWindow();
00072
00074 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
00075
00076 void updateList();
00077 OPimTodoAccess::List list()const;
00078 OPimTodoAccess::List sorted( bool asc, int sortOrder );
00079 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
00080
00081 OPimTodo event(int uid );
00082
00083 bool isSyncing()const;
00084 bool showCompleted()const;
00085 bool showDeadline()const;
00086 bool showOverDue()const;
00087 bool showQuickTask()const;
00088 QString currentCategory()const;
00089 int currentCatId();
00090 TemplateManager* templateManager();
00091 QuickEditBase* quickEditor();
00092
00093 void updateTodo( const OPimTodo& );
00094 Editor* currentEditor();
00095 void setReadAhead(uint count );
00096 private slots:
00097 void slotQuickEntered();
00098 void slotReload();
00099 void slotFlush();
00100
00101 protected:
00102 void closeEvent( QCloseEvent* e );
00103
00104 private:
00105
00106 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
00107 void receiveFile( const QString& filename );
00108 void connectBase( ViewBase* );
00109 void initUI();
00110 void initActions();
00111 void initConfig();
00112 void initViews();
00113 void initEditor();
00114 void initShow();
00115 void raiseCurrentView();
00116 ViewBase* currentView();
00117 ViewBase* m_curView;
00118 bool m_showing : 1;
00119 QuickEditBase* m_curQuick;
00120 Editor* m_curEdit;
00121 TodoShow* currentShow();
00122 TodoShow* m_curShow;
00123
00124 QAction* m_editAction,
00125 *m_deleteAction,
00126 *m_findAction,
00127 *m_completedAction,
00128 *m_showDeadLineAction,
00129 *m_deleteAllAction,
00130 *m_deleteCompleteAction,
00131 *m_duplicateAction,
00132 *m_showOverDueAction,
00133 *m_showQuickTaskAction,
00134 *m_effectiveAction;
00135 Opie::Ui::OWidgetStack *m_stack;
00136
00137 bool m_syncing:1;
00138 bool m_deadline:1;
00139 bool m_completed:1;
00140 bool m_overdue:1;
00141 bool m_quicktask:1;
00142 TodoManager m_todoMgr;
00143 QString m_curCat;
00144 QList<ViewBase> m_views;
00145 uint m_counter;
00146 TemplateManager* m_tempManager;
00147
00148
00149 private slots:
00150 void initStuff();
00151
00152 void slotItemNew();
00153 void slotItemEdit();
00154 void slotItemDuplicate();
00155 void slotItemDelete();
00156 void slotItemBeam();
00157 void slotItemFind();
00158 void slotConfigure();
00159
00160 void slotShow(int);
00161 void slotEdit(int);
00162 void slotUpdate3( QWidget* );
00163 void slotComplete( int uid );
00164 void slotComplete( const OPimTodo& ev );
00165
00166 void slotDelete(int uid );
00167 void slotDeleteAll();
00168 void slotDeleteCompleted();
00169
00170
00171 void setCategory( const QString &category );
00172
00173 void slotShowDeadLine( bool );
00174 void slotShowCompleted( bool );
00175 void slotShowQuickTask( bool );
00176
00177 void setDocument( const QString& );
00178
00179
00180 void beamDone( Ir* );
00181 void slotShowDetails();
00182 void slotShowNext();
00183 void slotShowPrev();
00184 void slotShowDue( bool );
00185 void slotReturnFromView();
00186
00187 protected slots:
00188 void flush();
00189 void reload();
00190 int create();
00191 bool remove( int uid );
00192 void beam(int uid);
00193 void show( int uid );
00194 void edit( int uid );
00195 void add( const Opie::OPimRecord& );
00196 void doAlarm( const QDateTime& dt, int uid );
00197 };
00198 }
00199
00200 #endif