summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.h
authordrw <drw>2005-01-30 00:32:33 (UTC)
committer drw <drw>2005-01-30 00:32:33 (UTC)
commit114c5c468032a08205b2d8b7da3966bff6d47875 (patch) (unidiff)
treebbd79021246e747f7292eda140e424cf9d750ac5 /core/pim/todo/mainwindow.h
parent43f82d5c68e1d7a5b26f862c26a76253a85e7518 (diff)
downloadopie-114c5c468032a08205b2d8b7da3966bff6d47875.zip
opie-114c5c468032a08205b2d8b7da3966bff6d47875.tar.gz
opie-114c5c468032a08205b2d8b7da3966bff6d47875.tar.bz2
Convert Todo to use new OPimMainWindow functionality, plus some other code clean-ups
Diffstat (limited to 'core/pim/todo/mainwindow.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.h77
1 files changed, 32 insertions, 45 deletions
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index f0d6a42..c0fe805 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -1,34 +1,34 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2 =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 3 .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
4           .>+-= 4 .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5_;:, .> :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.-- : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i, .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9- . .-<_> .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10 ._= =} : or (at your option) any later version.
11    .%`+i>       _;_. 11 .%`+i> _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 .i_,=:_. -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14 : .. .:, . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.= = ; Library General Public License for more
18++=   -.     .`     .: details. 18++= -. .` .: details.
19 :     =  ...= . :.=- 19: = ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20-. .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21 -_. . . )=. = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef TODO_MAIN_WINDOW_H 29#ifndef TODO_MAIN_WINDOW_H
30#define TODO_MAIN_WINDOW_H 30#define TODO_MAIN_WINDOW_H
31 31
32#include <qlist.h> 32#include <qlist.h>
33 33
34#include <opie2/otodoaccess.h> 34#include <opie2/otodoaccess.h>
@@ -45,158 +45,145 @@ class QPopupMenu;
45class QMenuBar; 45class QMenuBar;
46class QToolBar; 46class QToolBar;
47class QAction; 47class QAction;
48class Ir; 48class Ir;
49class QVBox; 49class QVBox;
50class QLineEdit; 50class QLineEdit;
51 51
52namespace Todo { 52namespace Todo {
53 typedef TodoView View; 53 typedef TodoView View;
54 class TemplateManager; 54 class TemplateManager;
55 class Editor; 55 class Editor;
56 class TodoShow; 56 class TodoShow;
57 class TemplateEditor;
58 struct QuickEditBase; 57 struct QuickEditBase;
59 58
60 class MainWindow : public Opie::OPimMainWindow { 59 class MainWindow : public Opie::OPimMainWindow {
61 Q_OBJECT 60 Q_OBJECT
62 friend class TodoView; // avoid QObject here.... 61 friend class TodoView; // avoid QObject here....
63 friend class TodoShow; // avoid QObject 62 friend class TodoShow; // avoid QObject
64 public: 63 public:
65 /* Opie::Core::OApplicationFactory application Name */ 64 /* Opie::Core::OApplicationFactory application Name */
66 static QString appName() { return QString::fromLatin1("todolist"); } 65 static QString appName() { return QString::fromLatin1("todolist"); }
67 66
68 MainWindow( QWidget *parent = 0, 67 MainWindow( QWidget *parent = 0,
69 const char* name = 0, WFlags fl = 0 ); 68 const char* name = 0, WFlags fl = 0 );
70 ~MainWindow(); 69 ~MainWindow();
71 70
72 /** return a context menu for an OPimTodo */ 71 /** return a context menu for an OPimTodo */
73 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); 72 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
74 QPopupMenu* options();
75 QPopupMenu* edit();
76 QToolBar* toolbar();
77
78 73
79 void updateList(); 74 void updateList();
80 OPimTodoAccess::List list()const; 75 OPimTodoAccess::List list()const;
81 OPimTodoAccess::List sorted( bool asc, int sortOrder ); 76 OPimTodoAccess::List sorted( bool asc, int sortOrder );
82 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 77 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
83 78
84 OPimTodo event(int uid ); 79 OPimTodo event(int uid );
85 80
86 bool isSyncing()const; 81 bool isSyncing()const;
87 bool showCompleted()const; 82 bool showCompleted()const;
88 bool showDeadline()const; 83 bool showDeadline()const;
89 bool showOverDue()const; 84 bool showOverDue()const;
90 bool showQuickTask()const; 85 bool showQuickTask()const;
91 QString currentCategory()const; 86 QString currentCategory()const;
92 int currentCatId(); 87 int currentCatId();
93 TemplateManager* templateManager(); 88 TemplateManager* templateManager();
94 QuickEditBase* quickEditor(); 89 QuickEditBase* quickEditor();
95 90
96 void updateTodo( const OPimTodo& ); 91 void updateTodo( const OPimTodo& );
97 void populateTemplates();
98 Editor* currentEditor(); 92 Editor* currentEditor();
99 void setReadAhead(uint count ); 93 void setReadAhead(uint count );
100private slots: 94private slots:
101 void slotQuickEntered(); 95 void slotQuickEntered();
102 void populateCategories();
103 void slotReload(); 96 void slotReload();
104 void slotFlush(); 97 void slotFlush();
105 98
106 protected: 99 protected:
107 void closeEvent( QCloseEvent* e ); 100 void closeEvent( QCloseEvent* e );
108 101
109 private: 102 private:
110 /* handle setting and removing alarms */ 103 /* handle setting and removing alarms */
111 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); 104 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
112 void receiveFile( const QString& filename ); 105 void receiveFile( const QString& filename );
113 void connectBase( ViewBase* ); 106 void connectBase( ViewBase* );
114 void initUI(); 107 void initUI();
115 void initActions(); 108 void initActions();
116 void initConfig(); 109 void initConfig();
117 void initViews(); 110 void initViews();
118 void initEditor(); 111 void initEditor();
119 void initShow(); 112 void initShow();
120 void initTemplate();
121 void raiseCurrentView(); 113 void raiseCurrentView();
122 ViewBase* currentView(); 114 ViewBase* currentView();
123 ViewBase* m_curView; 115 ViewBase* m_curView;
124 bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table 116 bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table
125 QuickEditBase* m_curQuick; 117 QuickEditBase* m_curQuick;
126 Editor* m_curEdit; 118 Editor* m_curEdit;
127 TodoShow* currentShow(); 119 TodoShow* currentShow();
128 TodoShow* m_curShow; 120 TodoShow* m_curShow;
129 TemplateEditor* currentTemplateEditor();
130 TemplateEditor* m_curTempEd;
131 121
132 QMenuBar* m_bar;
133 QToolBar* m_tool;
134 QAction* m_editAction, 122 QAction* m_editAction,
135 *m_deleteAction, 123 *m_deleteAction,
136 *m_findAction, 124 *m_findAction,
137 *m_completedAction, 125 *m_completedAction,
138 *m_showDeadLineAction, 126 *m_showDeadLineAction,
139 *m_deleteAllAction, 127 *m_deleteAllAction,
140 *m_deleteCompleteAction, 128 *m_deleteCompleteAction,
141 *m_duplicateAction, 129 *m_duplicateAction,
142 *m_showOverDueAction, 130 *m_showOverDueAction,
143 *m_showQuickTaskAction, 131 *m_showQuickTaskAction,
144 *m_effectiveAction; 132 *m_effectiveAction;
145 Opie::Ui::OWidgetStack *m_stack; 133 Opie::Ui::OWidgetStack *m_stack;
146 QPopupMenu* m_catMenu,
147 *m_edit,
148 *m_options,
149 *m_template;
150 134
151 bool m_syncing:1; 135 bool m_syncing:1;
152 bool m_deadline:1; 136 bool m_deadline:1;
153 bool m_completed:1; 137 bool m_completed:1;
154 bool m_overdue:1; 138 bool m_overdue:1;
155 bool m_quicktask:1; 139 bool m_quicktask:1;
156 TodoManager m_todoMgr; 140 TodoManager m_todoMgr;
157 QString m_curCat; 141 QString m_curCat;
158 QList<ViewBase> m_views; 142 QList<ViewBase> m_views;
159 uint m_counter; 143 uint m_counter;
160 TemplateManager* m_tempManager; 144 TemplateManager* m_tempManager;
161 145
162 146
163 private slots: 147 private slots:
148 void initStuff();
149
150 void slotItemNew();
151 void slotItemEdit();
152 void slotItemDuplicate();
153 void slotItemDelete();
154 void slotItemBeam();
155 void slotItemFind();
156 void slotConfigure();
157
164 void slotShow(int); 158 void slotShow(int);
165 void slotEdit(int); 159 void slotEdit(int);
166 void slotUpdate3( QWidget* ); 160 void slotUpdate3( QWidget* );
167 void slotComplete( int uid ); 161 void slotComplete( int uid );
168 void slotComplete( const OPimTodo& ev ); 162 void slotComplete( const OPimTodo& ev );
169 void slotNewFromTemplate(int id );
170 void slotNew();
171 void slotDuplicate();
172 163
173 void slotDelete();
174 void slotDelete(int uid ); 164 void slotDelete(int uid );
175 void slotDeleteAll(); 165 void slotDeleteAll();
176 void slotDeleteCompleted(); 166 void slotDeleteCompleted();
177 167
178 void slotEdit();
179 void slotFind();
180 168
181 void setCategory( int ); 169 void setCategory( const QString &category );
182 170
183 void slotShowDeadLine( bool ); 171 void slotShowDeadLine( bool );
184 void slotShowCompleted( bool ); 172 void slotShowCompleted( bool );
185 void slotShowQuickTask( bool ); 173 void slotShowQuickTask( bool );
186 174
187 void setDocument( const QString& ); 175 void setDocument( const QString& );
188 176
189 177
190 void slotBeam();
191 void beamDone( Ir* ); 178 void beamDone( Ir* );
192 void slotShowDetails(); 179 void slotShowDetails();
193 void slotShowNext(); 180 void slotShowNext();
194 void slotShowPrev(); 181 void slotShowPrev();
195 void slotShowDue( bool ); 182 void slotShowDue( bool );
196 void slotReturnFromView(); // for TodoShow... 183 void slotReturnFromView(); // for TodoShow...
197 /* reimplementation from opimmainwindow */ 184 /* reimplementation from opimmainwindow */
198 protected slots: 185 protected slots:
199 void flush(); 186 void flush();
200 void reload(); 187 void reload();
201 int create(); 188 int create();
202 bool remove( int uid ); 189 bool remove( int uid );