author | zecke <zecke> | 2003-02-11 18:42:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-11 18:42:42 (UTC) |
commit | 986afbabdd7c291f2fcbecd865e8c7075623bbf8 (patch) (unidiff) | |
tree | 7b00ad1e26a47666c05b7040d2218d134f698007 | |
parent | cb85b004afe2750733cef1663961539f6a3968e6 (diff) | |
download | opie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.zip opie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.tar.gz opie-986afbabdd7c291f2fcbecd865e8c7075623bbf8.tar.bz2 |
Add switching the views with the ActionKey..
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 9 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 2 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 21 | ||||
-rw-r--r-- | core/pim/todo/tableview.h | 1 | ||||
-rw-r--r-- | core/pim/todo/textviewshow.cpp | 17 | ||||
-rw-r--r-- | core/pim/todo/textviewshow.h | 5 | ||||
-rw-r--r-- | core/pim/todo/todoshow.cpp | 9 | ||||
-rw-r--r-- | core/pim/todo/todoshow.h | 7 |
8 files changed, 58 insertions, 13 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c90166b..d328558 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -1,350 +1,350 @@ | |||
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 <> | 3 | .=l. Copyright (c) 2002 <> |
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 | -_. . . )=. = General Public License along with | 21 | -_. . . )=. = 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 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include <qmenubar.h> | 31 | #include <qmenubar.h> |
32 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qwidgetstack.h> | 35 | #include <qwidgetstack.h> |
36 | #include <qaction.h> | 36 | #include <qaction.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | #include <qvbox.h> | 38 | #include <qvbox.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | 41 | ||
42 | #include <qpe/applnk.h> | 42 | #include <qpe/applnk.h> |
43 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
44 | #include <qpe/ir.h> | 44 | #include <qpe/ir.h> |
45 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
46 | #include <qpe/qpemessagebox.h> | 46 | #include <qpe/qpemessagebox.h> |
47 | #include <qpe/qpetoolbar.h> | 47 | #include <qpe/qpetoolbar.h> |
48 | 48 | ||
49 | #include <opie/orecur.h> | 49 | #include <opie/orecur.h> |
50 | #include <opie/otodoaccessvcal.h> | 50 | #include <opie/otodoaccessvcal.h> |
51 | 51 | ||
52 | #include "quickeditimpl.h" | 52 | #include "quickeditimpl.h" |
53 | #include "todotemplatemanager.h" | 53 | #include "todotemplatemanager.h" |
54 | #include "templateeditor.h" | 54 | #include "templateeditor.h" |
55 | #include "tableview.h" | 55 | #include "tableview.h" |
56 | 56 | ||
57 | #include "textviewshow.h" | 57 | #include "textviewshow.h" |
58 | #include "todoeditor.h" | 58 | #include "todoeditor.h" |
59 | #include "mainwindow.h" | 59 | #include "mainwindow.h" |
60 | 60 | ||
61 | 61 | ||
62 | using namespace Todo; | 62 | using namespace Todo; |
63 | 63 | ||
64 | MainWindow::MainWindow( QWidget* parent, | 64 | MainWindow::MainWindow( QWidget* parent, |
65 | const char* name ) | 65 | const char* name ) |
66 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) | 66 | : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) |
67 | { | 67 | { |
68 | m_syncing = false; | 68 | m_syncing = false; |
69 | m_counter = 0; | 69 | m_counter = 0; |
70 | m_tempManager = new TemplateManager(); | 70 | m_tempManager = new TemplateManager(); |
71 | m_tempManager->load(); | 71 | m_tempManager->load(); |
72 | 72 | ||
73 | initUI(); | 73 | initUI(); |
74 | initConfig(); | 74 | initConfig(); |
75 | initViews(); | 75 | initViews(); |
76 | initActions(); | 76 | initActions(); |
77 | initEditor(); | 77 | initEditor(); |
78 | initShow(); | 78 | initShow(); |
79 | initTemplate(); | 79 | initTemplate(); |
80 | 80 | ||
81 | populateTemplates(); | 81 | populateTemplates(); |
82 | raiseCurrentView(); | 82 | raiseCurrentView(); |
83 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); | 83 | QTimer::singleShot(0, this, SLOT(populateCategories() ) ); |
84 | } | 84 | } |
85 | void MainWindow::initTemplate() { | 85 | void MainWindow::initTemplate() { |
86 | m_curTempEd = new TemplateEditor( this, templateManager() ); | 86 | m_curTempEd = new TemplateEditor( this, templateManager() ); |
87 | } | 87 | } |
88 | void MainWindow::initActions() { | 88 | void MainWindow::initActions() { |
89 | 89 | ||
90 | // Data menu | 90 | // Data menu |
91 | m_edit->insertItem(QWidget::tr("New from template"), m_template, | 91 | m_edit->insertItem(QWidget::tr("New from template"), m_template, |
92 | -1, 0 ); | 92 | -1, 0 ); |
93 | 93 | ||
94 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), | 94 | QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), |
95 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
96 | connect(a, SIGNAL( activated() ), | 96 | connect(a, SIGNAL( activated() ), |
97 | this, SLOT( slotNew() ) ); | 97 | this, SLOT( slotNew() ) ); |
98 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); | 98 | a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); |
99 | a->addTo(m_tool ); | 99 | a->addTo(m_tool ); |
100 | a->addTo(m_edit ); | 100 | a->addTo(m_edit ); |
101 | 101 | ||
102 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), | 102 | a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), |
103 | QString::null, 0, this, 0 ); | 103 | QString::null, 0, this, 0 ); |
104 | connect(a, SIGNAL(activated() ), | 104 | connect(a, SIGNAL(activated() ), |
105 | this, SLOT( slotEdit() ) ); | 105 | this, SLOT( slotEdit() ) ); |
106 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); | 106 | a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); |
107 | a->addTo( m_tool ); | 107 | a->addTo( m_tool ); |
108 | a->addTo( m_edit ); | 108 | a->addTo( m_edit ); |
109 | m_editAction = a; | 109 | m_editAction = a; |
110 | 110 | ||
111 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); | 111 | a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); |
112 | connect(a, SIGNAL( activated() ), | 112 | connect(a, SIGNAL( activated() ), |
113 | this, SLOT( slotShowDetails() ) ); | 113 | this, SLOT( slotShowDetails() ) ); |
114 | a->addTo( m_edit ); | 114 | a->addTo( m_edit ); |
115 | 115 | ||
116 | m_edit->insertSeparator(); | 116 | m_edit->insertSeparator(); |
117 | 117 | ||
118 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), | 118 | a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), |
119 | QString::null, 0, this, 0 ); | 119 | QString::null, 0, this, 0 ); |
120 | connect(a, SIGNAL(activated() ), | 120 | connect(a, SIGNAL(activated() ), |
121 | this, SLOT(slotDelete() ) ); | 121 | this, SLOT(slotDelete() ) ); |
122 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); | 122 | a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); |
123 | a->addTo( m_tool ); | 123 | a->addTo( m_tool ); |
124 | a->addTo( m_edit ); | 124 | a->addTo( m_edit ); |
125 | m_deleteAction = a; | 125 | m_deleteAction = a; |
126 | 126 | ||
127 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); | 127 | a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); |
128 | connect(a, SIGNAL( activated() ), | 128 | connect(a, SIGNAL( activated() ), |
129 | this, SLOT( slotDeleteAll() ) ); | 129 | this, SLOT( slotDeleteAll() ) ); |
130 | a->addTo(m_edit ); | 130 | a->addTo(m_edit ); |
131 | m_deleteAllAction = a; | 131 | m_deleteAllAction = a; |
132 | 132 | ||
133 | a = new QAction( QString::null, QWidget::tr("Delete completed"), | 133 | a = new QAction( QString::null, QWidget::tr("Delete completed"), |
134 | 0, this, 0 ); | 134 | 0, this, 0 ); |
135 | connect(a, SIGNAL( activated() ), | 135 | connect(a, SIGNAL( activated() ), |
136 | this, SLOT( slotDeleteCompleted() ) ); | 136 | this, SLOT( slotDeleteCompleted() ) ); |
137 | a->addTo(m_edit ); | 137 | a->addTo(m_edit ); |
138 | a->setEnabled( TRUE ); | 138 | a->setEnabled( TRUE ); |
139 | m_deleteCompleteAction = a; | 139 | m_deleteCompleteAction = a; |
140 | 140 | ||
141 | m_edit->insertSeparator(); | 141 | m_edit->insertSeparator(); |
142 | 142 | ||
143 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); | 143 | a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); |
144 | connect(a, SIGNAL( activated() ), | 144 | connect(a, SIGNAL( activated() ), |
145 | this, SLOT( slotDuplicate() ) ); | 145 | this, SLOT( slotDuplicate() ) ); |
146 | a->addTo(m_edit ); | 146 | a->addTo(m_edit ); |
147 | m_duplicateAction = a; | 147 | m_duplicateAction = a; |
148 | 148 | ||
149 | m_edit->insertSeparator(); | 149 | m_edit->insertSeparator(); |
150 | 150 | ||
151 | if ( Ir::supported() ) { | 151 | if ( Ir::supported() ) { |
152 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); | 152 | a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); |
153 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 153 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
154 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); | 154 | a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); |
155 | a->addTo( m_edit ); | 155 | a->addTo( m_edit ); |
156 | a->addTo( m_tool ); | 156 | a->addTo( m_tool ); |
157 | } | 157 | } |
158 | 158 | ||
159 | // Options menu | 159 | // Options menu |
160 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), | 160 | a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), |
161 | QString::null, 0, this, 0 ); | 161 | QString::null, 0, this, 0 ); |
162 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 162 | connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
163 | a->addTo( m_options ); | 163 | a->addTo( m_options ); |
164 | m_findAction = a; | 164 | m_findAction = a; |
165 | 165 | ||
166 | m_options->insertSeparator(); | 166 | m_options->insertSeparator(); |
167 | 167 | ||
168 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), | 168 | m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), |
169 | 0, this, 0, TRUE ); | 169 | 0, this, 0, TRUE ); |
170 | m_completedAction->addTo( m_options ); | 170 | m_completedAction->addTo( m_options ); |
171 | m_completedAction->setOn( showCompleted() ); | 171 | m_completedAction->setOn( showCompleted() ); |
172 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); | 172 | connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); |
173 | 173 | ||
174 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), | 174 | a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), |
175 | 0, this, 0, TRUE ); | 175 | 0, this, 0, TRUE ); |
176 | a->addTo( m_options ); | 176 | a->addTo( m_options ); |
177 | a->setOn( showOverDue() ); | 177 | a->setOn( showOverDue() ); |
178 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); | 178 | connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); |
179 | 179 | ||
180 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), | 180 | m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), |
181 | 0, this, 0, TRUE ); | 181 | 0, this, 0, TRUE ); |
182 | m_showDeadLineAction->addTo( m_options ); | 182 | m_showDeadLineAction->addTo( m_options ); |
183 | m_showDeadLineAction->setOn( showDeadline() ); | 183 | m_showDeadLineAction->setOn( showDeadline() ); |
184 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); | 184 | connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) ); |
185 | 185 | ||
186 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), | 186 | m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), |
187 | 0, this, 0, TRUE ); | 187 | 0, this, 0, TRUE ); |
188 | m_showQuickTaskAction->addTo( m_options ); | 188 | m_showQuickTaskAction->addTo( m_options ); |
189 | m_showQuickTaskAction->setOn( showQuickTask() ); | 189 | m_showQuickTaskAction->setOn( showQuickTask() ); |
190 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); | 190 | connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); |
191 | 191 | ||
192 | m_options->insertSeparator(); | 192 | m_options->insertSeparator(); |
193 | 193 | ||
194 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); | 194 | m_bar->insertItem( QWidget::tr("Data") ,m_edit ); |
195 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); | 195 | m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); |
196 | m_bar->insertItem( QWidget::tr("Options"), m_options ); | 196 | m_bar->insertItem( QWidget::tr("Options"), m_options ); |
197 | 197 | ||
198 | m_curQuick = new QuickEditImpl( this, m_quicktask ); | 198 | m_curQuick = new QuickEditImpl( this, m_quicktask ); |
199 | addToolBar( (QPEToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); | 199 | addToolBar( (QPEToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); |
200 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); | 200 | m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); |
201 | 201 | ||
202 | } | 202 | } |
203 | /* m_curCat from Config */ | 203 | /* m_curCat from Config */ |
204 | void MainWindow::initConfig() { | 204 | void MainWindow::initConfig() { |
205 | Config config( "todo" ); | 205 | Config config( "todo" ); |
206 | config.setGroup( "View" ); | 206 | config.setGroup( "View" ); |
207 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); | 207 | m_completed = config.readBoolEntry( "ShowComplete", TRUE ); |
208 | m_curCat = config.readEntry( "Category", QString::null ); | 208 | m_curCat = config.readEntry( "Category", QString::null ); |
209 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); | 209 | m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); |
210 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); | 210 | m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); |
211 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); | 211 | m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); |
212 | } | 212 | } |
213 | void MainWindow::initUI() { | 213 | void MainWindow::initUI() { |
214 | m_stack = new QWidgetStack(this, "main stack"); | 214 | m_stack = new QWidgetStack(this, "main stack"); |
215 | setCentralWidget( m_stack ); | 215 | setCentralWidget( m_stack ); |
216 | 216 | ||
217 | setToolBarsMovable( FALSE ); | 217 | setToolBarsMovable( FALSE ); |
218 | 218 | ||
219 | m_tool = new QPEToolBar( this ); | 219 | m_tool = new QPEToolBar( this ); |
220 | m_tool->setHorizontalStretchable( TRUE ); | 220 | m_tool->setHorizontalStretchable( TRUE ); |
221 | 221 | ||
222 | m_bar = new QMenuBar( m_tool ); | 222 | m_bar = new QMenuBar( m_tool ); |
223 | 223 | ||
224 | /** QPopupMenu */ | 224 | /** QPopupMenu */ |
225 | m_edit = new QPopupMenu( this ); | 225 | m_edit = new QPopupMenu( this ); |
226 | m_options = new QPopupMenu( this ); | 226 | m_options = new QPopupMenu( this ); |
227 | m_catMenu = new QPopupMenu( this ); | 227 | m_catMenu = new QPopupMenu( this ); |
228 | m_template = new QPopupMenu( this ); | 228 | m_template = new QPopupMenu( this ); |
229 | 229 | ||
230 | m_catMenu->setCheckable( TRUE ); | 230 | m_catMenu->setCheckable( TRUE ); |
231 | m_template->setCheckable( TRUE ); | 231 | m_template->setCheckable( TRUE ); |
232 | 232 | ||
233 | connect(m_catMenu, SIGNAL(activated(int) ), | 233 | connect(m_catMenu, SIGNAL(activated(int) ), |
234 | this, SLOT(setCategory(int) ) ); | 234 | this, SLOT(setCategory(int) ) ); |
235 | connect(m_template, SIGNAL(activated(int) ), | 235 | connect(m_template, SIGNAL(activated(int) ), |
236 | this, SLOT(slotNewFromTemplate(int) ) ); | 236 | this, SLOT(slotNewFromTemplate(int) ) ); |
237 | } | 237 | } |
238 | void MainWindow::initViews() { | 238 | void MainWindow::initViews() { |
239 | TableView* tableView = new TableView( this, m_stack ); | 239 | TableView* tableView = new TableView( this, m_stack ); |
240 | QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); | 240 | QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); |
241 | m_stack->addWidget( tableView, m_counter++ ); | 241 | m_stack->addWidget( tableView, m_counter++ ); |
242 | m_views.append( tableView ); | 242 | m_views.append( tableView ); |
243 | m_curView = tableView; | 243 | m_curView = tableView; |
244 | connectBase( tableView ); | 244 | connectBase( tableView ); |
245 | /* add QString type + QString configname to | 245 | /* add QString type + QString configname to |
246 | * the View menu | 246 | * the View menu |
247 | * and subdirs for multiple views | 247 | * and subdirs for multiple views |
248 | */ | 248 | */ |
249 | } | 249 | } |
250 | void MainWindow::initEditor() { | 250 | void MainWindow::initEditor() { |
251 | m_curEdit = new Editor(); | 251 | m_curEdit = new Editor(); |
252 | } | 252 | } |
253 | void MainWindow::initShow() { | 253 | void MainWindow::initShow() { |
254 | m_curShow = new TextViewShow(this); | 254 | m_curShow = new TextViewShow(this, this); |
255 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); | 255 | m_stack->addWidget( m_curShow->widget() , m_counter++ ); |
256 | } | 256 | } |
257 | MainWindow::~MainWindow() { | 257 | MainWindow::~MainWindow() { |
258 | delete templateManager(); | 258 | delete templateManager(); |
259 | } | 259 | } |
260 | void MainWindow::connectBase( ViewBase* ) { | 260 | void MainWindow::connectBase( ViewBase* ) { |
261 | // once templates and signals mix we'll use it again | 261 | // once templates and signals mix we'll use it again |
262 | } | 262 | } |
263 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { | 263 | QPopupMenu* MainWindow::contextMenu( int , bool recur ) { |
264 | QPopupMenu* menu = new QPopupMenu(); | 264 | QPopupMenu* menu = new QPopupMenu(); |
265 | 265 | ||
266 | m_editAction->addTo( menu ); | 266 | m_editAction->addTo( menu ); |
267 | m_deleteAction->addTo( menu ); | 267 | m_deleteAction->addTo( menu ); |
268 | m_duplicateAction->addTo( menu ); | 268 | m_duplicateAction->addTo( menu ); |
269 | 269 | ||
270 | menu->insertSeparator(); | 270 | menu->insertSeparator(); |
271 | 271 | ||
272 | /* | 272 | /* |
273 | * if this event recurs we allow | 273 | * if this event recurs we allow |
274 | * to detach it. | 274 | * to detach it. |
275 | * remove all | 275 | * remove all |
276 | */ | 276 | */ |
277 | if ( recur ) { | 277 | if ( recur ) { |
278 | ; // FIXME | 278 | ; // FIXME |
279 | } | 279 | } |
280 | 280 | ||
281 | return menu; | 281 | return menu; |
282 | } | 282 | } |
283 | QPopupMenu* MainWindow::options() { | 283 | QPopupMenu* MainWindow::options() { |
284 | qWarning("Options"); | 284 | qWarning("Options"); |
285 | return m_options; | 285 | return m_options; |
286 | } | 286 | } |
287 | QPopupMenu* MainWindow::edit() { | 287 | QPopupMenu* MainWindow::edit() { |
288 | return m_edit; | 288 | return m_edit; |
289 | } | 289 | } |
290 | QToolBar* MainWindow::toolbar() { | 290 | QToolBar* MainWindow::toolbar() { |
291 | return m_tool; | 291 | return m_tool; |
292 | } | 292 | } |
293 | OTodoAccess::List MainWindow::list()const { | 293 | OTodoAccess::List MainWindow::list()const { |
294 | return m_todoMgr.list(); | 294 | return m_todoMgr.list(); |
295 | } | 295 | } |
296 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { | 296 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { |
297 | int cat = 0; | 297 | int cat = 0; |
298 | if ( m_curCat != QWidget::tr("All Categories") ) | 298 | if ( m_curCat != QWidget::tr("All Categories") ) |
299 | cat = currentCatId(); | 299 | cat = currentCatId(); |
300 | 300 | ||
301 | int filter = 1; | 301 | int filter = 1; |
302 | 302 | ||
303 | if (!m_completed ) | 303 | if (!m_completed ) |
304 | filter |= 4; | 304 | filter |= 4; |
305 | if (m_overdue) | 305 | if (m_overdue) |
306 | filter |= 2; | 306 | filter |= 2; |
307 | 307 | ||
308 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); | 308 | return m_todoMgr.sorted( asc, sortOrder, filter, cat ); |
309 | } | 309 | } |
310 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { | 310 | OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { |
311 | int cat = 0; | 311 | int cat = 0; |
312 | if ( m_curCat != QWidget::tr("All Categories") ) | 312 | if ( m_curCat != QWidget::tr("All Categories") ) |
313 | cat = currentCatId(); | 313 | cat = currentCatId(); |
314 | 314 | ||
315 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); | 315 | return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); |
316 | } | 316 | } |
317 | OTodo MainWindow::event( int uid ) { | 317 | OTodo MainWindow::event( int uid ) { |
318 | return m_todoMgr.event( uid ); | 318 | return m_todoMgr.event( uid ); |
319 | } | 319 | } |
320 | bool MainWindow::isSyncing()const { | 320 | bool MainWindow::isSyncing()const { |
321 | return m_syncing; | 321 | return m_syncing; |
322 | } | 322 | } |
323 | TemplateManager* MainWindow::templateManager() { | 323 | TemplateManager* MainWindow::templateManager() { |
324 | return m_tempManager; | 324 | return m_tempManager; |
325 | } | 325 | } |
326 | Editor* MainWindow::currentEditor() { | 326 | Editor* MainWindow::currentEditor() { |
327 | return m_curEdit; | 327 | return m_curEdit; |
328 | } | 328 | } |
329 | TodoShow* MainWindow::currentShow() { | 329 | TodoShow* MainWindow::currentShow() { |
330 | return m_curShow; | 330 | return m_curShow; |
331 | } | 331 | } |
332 | void MainWindow::slotReload() { | 332 | void MainWindow::slotReload() { |
333 | m_todoMgr.reload(); | 333 | m_todoMgr.reload(); |
334 | currentView()->updateView( ); | 334 | currentView()->updateView( ); |
335 | raiseCurrentView(); | 335 | raiseCurrentView(); |
336 | } | 336 | } |
337 | void MainWindow::closeEvent( QCloseEvent* e ) { | 337 | void MainWindow::closeEvent( QCloseEvent* e ) { |
338 | if (m_stack->visibleWidget() == currentShow()->widget() ) { | 338 | if (m_stack->visibleWidget() == currentShow()->widget() ) { |
339 | raiseCurrentView(); | 339 | raiseCurrentView(); |
340 | e->ignore(); | 340 | e->ignore(); |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | /* | 343 | /* |
344 | * we should have flushed and now we're still saving | 344 | * we should have flushed and now we're still saving |
345 | * so there is no need to flush | 345 | * so there is no need to flush |
346 | */ | 346 | */ |
347 | if (m_syncing ) { | 347 | if (m_syncing ) { |
348 | e->accept(); | 348 | e->accept(); |
349 | return; | 349 | return; |
350 | } | 350 | } |
@@ -720,96 +720,99 @@ void MainWindow::slotComplete( const OTodo& todo ) { | |||
720 | to.setUid( 1 ); | 720 | to.setUid( 1 ); |
721 | 721 | ||
722 | /* add the old one cause it has a new UID here cause it was spin off */ | 722 | /* add the old one cause it has a new UID here cause it was spin off */ |
723 | m_todoMgr.add( to ); | 723 | m_todoMgr.add( to ); |
724 | 724 | ||
725 | /* | 725 | /* |
726 | * update the due date | 726 | * update the due date |
727 | * start date | 727 | * start date |
728 | * and complete date | 728 | * and complete date |
729 | */ | 729 | */ |
730 | to2.setDueDate( date ); | 730 | to2.setDueDate( date ); |
731 | to2.setStartDate( inval ); | 731 | to2.setStartDate( inval ); |
732 | to2.setCompletedDate( inval ); | 732 | to2.setCompletedDate( inval ); |
733 | to2.setCompleted( false ); | 733 | to2.setCompleted( false ); |
734 | updateTodo( to2 ); | 734 | updateTodo( to2 ); |
735 | }else | 735 | }else |
736 | updateTodo( to ); | 736 | updateTodo( to ); |
737 | }else | 737 | }else |
738 | updateTodo( to ); | 738 | updateTodo( to ); |
739 | 739 | ||
740 | currentView()->updateView(); | 740 | currentView()->updateView(); |
741 | raiseCurrentView(); | 741 | raiseCurrentView(); |
742 | } | 742 | } |
743 | void MainWindow::flush() { | 743 | void MainWindow::flush() { |
744 | slotFlush(); | 744 | slotFlush(); |
745 | } | 745 | } |
746 | void MainWindow::reload() { | 746 | void MainWindow::reload() { |
747 | slotReload(); | 747 | slotReload(); |
748 | } | 748 | } |
749 | int MainWindow::create() { | 749 | int MainWindow::create() { |
750 | int uid = 0; | 750 | int uid = 0; |
751 | if(m_syncing) { | 751 | if(m_syncing) { |
752 | QMessageBox::warning(this, QWidget::tr("Todo"), | 752 | QMessageBox::warning(this, QWidget::tr("Todo"), |
753 | QWidget::tr("Can not edit data, currently syncing")); | 753 | QWidget::tr("Can not edit data, currently syncing")); |
754 | return uid; | 754 | return uid; |
755 | } | 755 | } |
756 | 756 | ||
757 | 757 | ||
758 | OTodo todo = currentEditor()->newTodo( currentCatId(), | 758 | OTodo todo = currentEditor()->newTodo( currentCatId(), |
759 | this ); | 759 | this ); |
760 | 760 | ||
761 | if ( currentEditor()->accepted() ) { | 761 | if ( currentEditor()->accepted() ) { |
762 | //todo.assignUid(); | 762 | //todo.assignUid(); |
763 | uid = todo.uid(); | 763 | uid = todo.uid(); |
764 | m_todoMgr.add( todo ); | 764 | m_todoMgr.add( todo ); |
765 | currentView()->addEvent( todo ); | 765 | currentView()->addEvent( todo ); |
766 | 766 | ||
767 | 767 | ||
768 | // I'm afraid we must call this every time now, otherwise | 768 | // I'm afraid we must call this every time now, otherwise |
769 | // spend expensive time comparing all these strings... | 769 | // spend expensive time comparing all these strings... |
770 | // but only call if we changed something -zecke | 770 | // but only call if we changed something -zecke |
771 | populateCategories(); | 771 | populateCategories(); |
772 | } | 772 | } |
773 | raiseCurrentView( ); | 773 | raiseCurrentView( ); |
774 | 774 | ||
775 | return uid; | 775 | return uid; |
776 | } | 776 | } |
777 | /* delete it silently... */ | 777 | /* delete it silently... */ |
778 | bool MainWindow::remove( int uid ) { | 778 | bool MainWindow::remove( int uid ) { |
779 | if (m_syncing) return false; | 779 | if (m_syncing) return false; |
780 | 780 | ||
781 | return m_todoMgr.remove( uid ); | 781 | return m_todoMgr.remove( uid ); |
782 | } | 782 | } |
783 | void MainWindow::beam( int uid, int ) { | 783 | void MainWindow::beam( int uid, int ) { |
784 | ::unlink( beamfile ); | 784 | ::unlink( beamfile ); |
785 | OTodo todo = event( uid ); | 785 | OTodo todo = event( uid ); |
786 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | 786 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); |
787 | OTodoAccess acc( cal ); | 787 | OTodoAccess acc( cal ); |
788 | acc.load(); | 788 | acc.load(); |
789 | acc.add( todo ); | 789 | acc.add( todo ); |
790 | acc.save(); | 790 | acc.save(); |
791 | Ir* ir = new Ir(this ); | 791 | Ir* ir = new Ir(this ); |
792 | connect(ir, SIGNAL(done(Ir*) ), | 792 | connect(ir, SIGNAL(done(Ir*) ), |
793 | this, SLOT(beamDone(Ir*) ) ); | 793 | this, SLOT(beamDone(Ir*) ) ); |
794 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | 794 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); |
795 | } | 795 | } |
796 | void MainWindow::show( int uid ) { | 796 | void MainWindow::show( int uid ) { |
797 | slotShow( uid ); | 797 | slotShow( uid ); |
798 | } | 798 | } |
799 | void MainWindow::edit( int uid ) { | 799 | void MainWindow::edit( int uid ) { |
800 | slotEdit( uid ); | 800 | slotEdit( uid ); |
801 | } | 801 | } |
802 | void MainWindow::add( const OPimRecord& rec) { | 802 | void MainWindow::add( const OPimRecord& rec) { |
803 | if ( rec.rtti() != OTodo::rtti() ) return; | 803 | if ( rec.rtti() != OTodo::rtti() ) return; |
804 | 804 | ||
805 | const OTodo& todo = static_cast<const OTodo&>(rec); | 805 | const OTodo& todo = static_cast<const OTodo&>(rec); |
806 | 806 | ||
807 | m_todoMgr.add(todo ); | 807 | m_todoMgr.add(todo ); |
808 | currentView()->addEvent( todo ); | 808 | currentView()->addEvent( todo ); |
809 | 809 | ||
810 | 810 | ||
811 | // I'm afraid we must call this every time now, otherwise | 811 | // I'm afraid we must call this every time now, otherwise |
812 | // spend expensive time comparing all these strings... | 812 | // spend expensive time comparing all these strings... |
813 | // but only call if we changed something -zecke | 813 | // but only call if we changed something -zecke |
814 | populateCategories(); | 814 | populateCategories(); |
815 | } | 815 | } |
816 | void MainWindow::slotReturnFromView() { | ||
817 | raiseCurrentView(); | ||
818 | } | ||
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index d756d64..f880505 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -1,199 +1,201 @@ | |||
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 <opie/otodoaccess.h> | 34 | #include <opie/otodoaccess.h> |
35 | #include <opie/otodo.h> | 35 | #include <opie/otodo.h> |
36 | #include <opie/opimmainwindow.h> | 36 | #include <opie/opimmainwindow.h> |
37 | 37 | ||
38 | #include "smalltodo.h" | 38 | #include "smalltodo.h" |
39 | #include "todoview.h" | 39 | #include "todoview.h" |
40 | #include "quickedit.h" | 40 | #include "quickedit.h" |
41 | #include "todomanager.h" | 41 | #include "todomanager.h" |
42 | 42 | ||
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QMenuBar; | 44 | class QMenuBar; |
45 | class QToolBar; | 45 | class QToolBar; |
46 | class QAction; | 46 | class QAction; |
47 | class QWidgetStack; | 47 | class QWidgetStack; |
48 | class Ir; | 48 | class Ir; |
49 | class QVBox; | 49 | class QVBox; |
50 | class QLineEdit; | 50 | class QLineEdit; |
51 | 51 | ||
52 | namespace Todo { | 52 | namespace 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; | 57 | class TemplateEditor; |
58 | struct QuickEditBase; | 58 | struct QuickEditBase; |
59 | 59 | ||
60 | class MainWindow : public OPimMainWindow { | 60 | class MainWindow : public OPimMainWindow { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | friend class TodoView; // avoid QObject here.... | 62 | friend class TodoView; // avoid QObject here.... |
63 | friend class TodoShow; // avoid QObject | ||
63 | public: | 64 | public: |
64 | MainWindow( QWidget *parent = 0, | 65 | MainWindow( QWidget *parent = 0, |
65 | const char* name = 0 ); | 66 | const char* name = 0 ); |
66 | ~MainWindow(); | 67 | ~MainWindow(); |
67 | 68 | ||
68 | /** return a context menu for an OTodo */ | 69 | /** return a context menu for an OTodo */ |
69 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); | 70 | QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); |
70 | QPopupMenu* options(); | 71 | QPopupMenu* options(); |
71 | QPopupMenu* edit(); | 72 | QPopupMenu* edit(); |
72 | QToolBar* toolbar(); | 73 | QToolBar* toolbar(); |
73 | 74 | ||
74 | 75 | ||
75 | void updateList(); | 76 | void updateList(); |
76 | OTodoAccess::List list()const; | 77 | OTodoAccess::List list()const; |
77 | OTodoAccess::List sorted( bool asc, int sortOrder ); | 78 | OTodoAccess::List sorted( bool asc, int sortOrder ); |
78 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); | 79 | OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); |
79 | 80 | ||
80 | OTodo event(int uid ); | 81 | OTodo event(int uid ); |
81 | 82 | ||
82 | bool isSyncing()const; | 83 | bool isSyncing()const; |
83 | bool showCompleted()const; | 84 | bool showCompleted()const; |
84 | bool showDeadline()const; | 85 | bool showDeadline()const; |
85 | bool showOverDue()const; | 86 | bool showOverDue()const; |
86 | bool showQuickTask()const; | 87 | bool showQuickTask()const; |
87 | QString currentCategory()const; | 88 | QString currentCategory()const; |
88 | int currentCatId(); | 89 | int currentCatId(); |
89 | TemplateManager* templateManager(); | 90 | TemplateManager* templateManager(); |
90 | QuickEditBase* quickEditor(); | 91 | QuickEditBase* quickEditor(); |
91 | 92 | ||
92 | void updateTodo( const OTodo& ); | 93 | void updateTodo( const OTodo& ); |
93 | void populateTemplates(); | 94 | void populateTemplates(); |
94 | Editor* currentEditor(); | 95 | Editor* currentEditor(); |
95 | void setReadAhead(uint count ); | 96 | void setReadAhead(uint count ); |
96 | private slots: | 97 | private slots: |
97 | void slotQuickEntered(); | 98 | void slotQuickEntered(); |
98 | void populateCategories(); | 99 | void populateCategories(); |
99 | void slotReload(); | 100 | void slotReload(); |
100 | void slotFlush(); | 101 | void slotFlush(); |
101 | 102 | ||
102 | protected: | 103 | protected: |
103 | void closeEvent( QCloseEvent* e ); | 104 | void closeEvent( QCloseEvent* e ); |
104 | 105 | ||
105 | private: | 106 | private: |
106 | void receiveFile( const QString& filename ); | 107 | void receiveFile( const QString& filename ); |
107 | void connectBase( ViewBase* ); | 108 | void connectBase( ViewBase* ); |
108 | void initUI(); | 109 | void initUI(); |
109 | void initActions(); | 110 | void initActions(); |
110 | void initConfig(); | 111 | void initConfig(); |
111 | void initViews(); | 112 | void initViews(); |
112 | void initEditor(); | 113 | void initEditor(); |
113 | void initShow(); | 114 | void initShow(); |
114 | void initTemplate(); | 115 | void initTemplate(); |
115 | void raiseCurrentView(); | 116 | void raiseCurrentView(); |
116 | ViewBase* currentView(); | 117 | ViewBase* currentView(); |
117 | ViewBase* m_curView; | 118 | ViewBase* m_curView; |
118 | QuickEditBase* m_curQuick; | 119 | QuickEditBase* m_curQuick; |
119 | Editor* m_curEdit; | 120 | Editor* m_curEdit; |
120 | TodoShow* currentShow(); | 121 | TodoShow* currentShow(); |
121 | TodoShow* m_curShow; | 122 | TodoShow* m_curShow; |
122 | TemplateEditor* currentTemplateEditor(); | 123 | TemplateEditor* currentTemplateEditor(); |
123 | TemplateEditor* m_curTempEd; | 124 | TemplateEditor* m_curTempEd; |
124 | 125 | ||
125 | QMenuBar* m_bar; | 126 | QMenuBar* m_bar; |
126 | QToolBar* m_tool; | 127 | QToolBar* m_tool; |
127 | QAction* m_editAction, | 128 | QAction* m_editAction, |
128 | *m_deleteAction, | 129 | *m_deleteAction, |
129 | *m_findAction, | 130 | *m_findAction, |
130 | *m_completedAction, | 131 | *m_completedAction, |
131 | *m_showDeadLineAction, | 132 | *m_showDeadLineAction, |
132 | *m_deleteAllAction, | 133 | *m_deleteAllAction, |
133 | *m_deleteCompleteAction, | 134 | *m_deleteCompleteAction, |
134 | *m_duplicateAction, | 135 | *m_duplicateAction, |
135 | *m_showOverDueAction, | 136 | *m_showOverDueAction, |
136 | *m_showQuickTaskAction, | 137 | *m_showQuickTaskAction, |
137 | *m_effectiveAction; | 138 | *m_effectiveAction; |
138 | QWidgetStack *m_stack; | 139 | QWidgetStack *m_stack; |
139 | QPopupMenu* m_catMenu, | 140 | QPopupMenu* m_catMenu, |
140 | *m_edit, | 141 | *m_edit, |
141 | *m_options, | 142 | *m_options, |
142 | *m_template; | 143 | *m_template; |
143 | 144 | ||
144 | bool m_syncing:1; | 145 | bool m_syncing:1; |
145 | bool m_deadline:1; | 146 | bool m_deadline:1; |
146 | bool m_completed:1; | 147 | bool m_completed:1; |
147 | bool m_overdue:1; | 148 | bool m_overdue:1; |
148 | bool m_quicktask:1; | 149 | bool m_quicktask:1; |
149 | TodoManager m_todoMgr; | 150 | TodoManager m_todoMgr; |
150 | QString m_curCat; | 151 | QString m_curCat; |
151 | QList<ViewBase> m_views; | 152 | QList<ViewBase> m_views; |
152 | uint m_counter; | 153 | uint m_counter; |
153 | TemplateManager* m_tempManager; | 154 | TemplateManager* m_tempManager; |
154 | 155 | ||
155 | 156 | ||
156 | private slots: | 157 | private slots: |
157 | void slotShow(int); | 158 | void slotShow(int); |
158 | void slotEdit(int); | 159 | void slotEdit(int); |
159 | void slotUpdate3( QWidget* ); | 160 | void slotUpdate3( QWidget* ); |
160 | void slotComplete( int uid ); | 161 | void slotComplete( int uid ); |
161 | void slotComplete( const OTodo& ev ); | 162 | void slotComplete( const OTodo& ev ); |
162 | void slotNewFromTemplate(int id ); | 163 | void slotNewFromTemplate(int id ); |
163 | void slotNew(); | 164 | void slotNew(); |
164 | void slotDuplicate(); | 165 | void slotDuplicate(); |
165 | 166 | ||
166 | void slotDelete(); | 167 | void slotDelete(); |
167 | void slotDeleteAll(); | 168 | void slotDeleteAll(); |
168 | void slotDeleteCompleted(); | 169 | void slotDeleteCompleted(); |
169 | 170 | ||
170 | void slotEdit(); | 171 | void slotEdit(); |
171 | void slotFind(); | 172 | void slotFind(); |
172 | 173 | ||
173 | void setCategory( int ); | 174 | void setCategory( int ); |
174 | 175 | ||
175 | void slotShowDeadLine( bool ); | 176 | void slotShowDeadLine( bool ); |
176 | void slotShowCompleted( bool ); | 177 | void slotShowCompleted( bool ); |
177 | void slotShowQuickTask( bool ); | 178 | void slotShowQuickTask( bool ); |
178 | 179 | ||
179 | void setDocument( const QString& ); | 180 | void setDocument( const QString& ); |
180 | 181 | ||
181 | 182 | ||
182 | void slotBeam(); | 183 | void slotBeam(); |
183 | void beamDone( Ir* ); | 184 | void beamDone( Ir* ); |
184 | void slotShowDetails(); | 185 | void slotShowDetails(); |
185 | void slotShowDue( bool ); | 186 | void slotShowDue( bool ); |
187 | void slotReturnFromView(); // for TodoShow... | ||
186 | /* reimplementation from opimmainwindow */ | 188 | /* reimplementation from opimmainwindow */ |
187 | protected slots: | 189 | protected slots: |
188 | void flush(); | 190 | void flush(); |
189 | void reload(); | 191 | void reload(); |
190 | int create(); | 192 | int create(); |
191 | bool remove( int uid ); | 193 | bool remove( int uid ); |
192 | void beam(int uid, int transport = IrDa ); | 194 | void beam(int uid, int transport = IrDa ); |
193 | void show( int uid ); | 195 | void show( int uid ); |
194 | void edit( int uid ); | 196 | void edit( int uid ); |
195 | void add( const OPimRecord& ); | 197 | void add( const OPimRecord& ); |
196 | }; | 198 | }; |
197 | }; | 199 | }; |
198 | 200 | ||
199 | #endif | 201 | #endif |
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 61d1edd..cec8b5e 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -1,185 +1,185 @@ | |||
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 <zecke> | 3 | .=l. Copyright (c) 2002 <zecke> |
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 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <cmath> | 29 | #include <cmath> |
30 | 30 | ||
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | #include <qpoint.h> | 34 | #include <qpoint.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | 36 | ||
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | 39 | ||
40 | #include <opie/orecur.h> | 40 | #include <opie/orecur.h> |
41 | 41 | ||
42 | #include "mainwindow.h" | 42 | #include "mainwindow.h" |
43 | //#include "tableitems.h" | 43 | //#include "tableitems.h" |
44 | #include "tableview.h" | 44 | #include "tableview.h" |
45 | 45 | ||
46 | using namespace Todo; | 46 | using namespace Todo; |
47 | 47 | ||
48 | namespace { | 48 | namespace { |
49 | static const int BoxSize = 14; | 49 | static const int BoxSize = 14; |
50 | static const int RowHeight = 20; | 50 | static const int RowHeight = 20; |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void TableView::initConfig() { | 54 | void TableView::initConfig() { |
55 | Config config( "todo" ); | 55 | Config config( "todo" ); |
56 | config.setGroup( "Options" ); | 56 | config.setGroup( "Options" ); |
57 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); | 57 | m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); |
58 | } | 58 | } |
59 | 59 | ||
60 | TableView::TableView( MainWindow* window, QWidget* wid ) | 60 | TableView::TableView( MainWindow* window, QWidget* wid ) |
61 | : QTable( wid ), TodoView( window ) { | 61 | : QTable( wid ), TodoView( window ) { |
62 | 62 | ||
63 | // Load icons | 63 | // Load icons |
64 | // TODO - probably should be done globally somewhere else, | 64 | // TODO - probably should be done globally somewhere else, |
65 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h | 65 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h |
66 | m_pic_completed = Resource::loadPixmap( "todo/completed" ); | 66 | m_pic_completed = Resource::loadPixmap( "todo/completed" ); |
67 | QString namestr; | 67 | QString namestr; |
68 | for ( unsigned int i = 1; i < 6; i++ ) { | 68 | for ( unsigned int i = 1; i < 6; i++ ) { |
69 | namestr = "todo/priority"; | 69 | namestr = "todo/priority"; |
70 | namestr.append( QString::number( i ) ); | 70 | namestr.append( QString::number( i ) ); |
71 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); | 71 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); |
72 | } | 72 | } |
73 | 73 | ||
74 | setUpdatesEnabled( false ); | 74 | setUpdatesEnabled( false ); |
75 | viewport()->setUpdatesEnabled( false ); | 75 | viewport()->setUpdatesEnabled( false ); |
76 | m_enablePaint = false; | 76 | m_enablePaint = false; |
77 | setNumRows(0); | 77 | setNumRows(0); |
78 | setNumCols(4); | 78 | setNumCols(4); |
79 | 79 | ||
80 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); | 80 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); |
81 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); | 81 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); |
82 | horizontalHeader()->setLabel( 2, QWidget::tr("Description" ) ); | 82 | horizontalHeader()->setLabel( 2, QWidget::tr("Description" ) ); |
83 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); | 83 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); |
84 | 84 | ||
85 | setShowDeadline( todoWindow()->showDeadline() ); | 85 | setShowDeadline( todoWindow()->showDeadline() ); |
86 | 86 | ||
87 | setSorting( TRUE ); | 87 | setSorting( TRUE ); |
88 | setSelectionMode( NoSelection ); | 88 | setSelectionMode( NoSelection ); |
89 | 89 | ||
90 | setLeftMargin( 0 ); | 90 | setLeftMargin( 0 ); |
91 | verticalHeader()->hide(); | 91 | verticalHeader()->hide(); |
92 | 92 | ||
93 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), | 93 | connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), |
94 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); | 94 | this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); |
95 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), | 95 | connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), |
96 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); | 96 | this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); |
97 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), | 97 | connect((QTable*)this, SIGNAL(valueChanged(int, int) ), |
98 | this, SLOT( slotValueChanged(int, int) ) ); | 98 | this, SLOT( slotValueChanged(int, int) ) ); |
99 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), | 99 | connect((QTable*)this, SIGNAL(currentChanged(int, int) ), |
100 | this, SLOT( slotCurrentChanged(int, int) ) ); | 100 | this, SLOT( slotCurrentChanged(int, int) ) ); |
101 | 101 | ||
102 | m_menuTimer = new QTimer( this ); | 102 | m_menuTimer = new QTimer( this ); |
103 | connect( m_menuTimer, SIGNAL(timeout()), | 103 | connect( m_menuTimer, SIGNAL(timeout()), |
104 | this, SLOT(slotShowMenu()) ); | 104 | this, SLOT(slotShowMenu()) ); |
105 | 105 | ||
106 | m_enablePaint = true; | 106 | m_enablePaint = true; |
107 | setUpdatesEnabled( true ); | 107 | setUpdatesEnabled( true ); |
108 | viewport()->setUpdatesEnabled( true ); | 108 | viewport()->setUpdatesEnabled( true ); |
109 | viewport()->update(); | 109 | viewport()->update(); |
110 | setSortOrder( 0 ); | 110 | setSortOrder( 0 ); |
111 | setAscending( TRUE ); | 111 | setAscending( TRUE ); |
112 | m_first = true; | 112 | m_first = true; |
113 | 113 | ||
114 | /* now let's init the config */ | 114 | /* now let's init the config */ |
115 | initConfig(); | 115 | initConfig(); |
116 | } | 116 | } |
117 | /* a new day has started | 117 | /* a new day has started |
118 | * update the day | 118 | * update the day |
119 | */ | 119 | */ |
120 | void TableView::newDay() { | 120 | void TableView::newDay() { |
121 | clear(); | 121 | clear(); |
122 | updateView(); | 122 | updateView(); |
123 | } | 123 | } |
124 | TableView::~TableView() { | 124 | TableView::~TableView() { |
125 | 125 | ||
126 | } | 126 | } |
127 | void TableView::slotShowMenu() { | 127 | void TableView::slotShowMenu() { |
128 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); | 128 | QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); |
129 | menu->exec(QCursor::pos() ); | 129 | menu->exec(QCursor::pos() ); |
130 | delete menu; | 130 | delete menu; |
131 | } | 131 | } |
132 | QString TableView::type() const { | 132 | QString TableView::type() const { |
133 | return QString::fromLatin1( tr("Table View") ); | 133 | return QString::fromLatin1( tr("Table View") ); |
134 | } | 134 | } |
135 | int TableView::current() { | 135 | int TableView::current() { |
136 | int uid = sorted().uidAt(currentRow() ); | 136 | int uid = sorted().uidAt(currentRow() ); |
137 | 137 | ||
138 | return uid; | 138 | return uid; |
139 | } | 139 | } |
140 | QString TableView::currentRepresentation() { | 140 | QString TableView::currentRepresentation() { |
141 | OTodo to = sorted()[currentRow()]; | 141 | OTodo to = sorted()[currentRow()]; |
142 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; | 142 | return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; |
143 | } | 143 | } |
144 | /* show overdue */ | 144 | /* show overdue */ |
145 | void TableView::showOverDue( bool ) { | 145 | void TableView::showOverDue( bool ) { |
146 | clear(); | 146 | clear(); |
147 | updateView(); | 147 | updateView(); |
148 | } | 148 | } |
149 | 149 | ||
150 | void TableView::updateView( ) { | 150 | void TableView::updateView( ) { |
151 | qWarning("update view"); | 151 | qWarning("update view"); |
152 | m_row = false; | 152 | m_row = false; |
153 | static int id; | 153 | static int id; |
154 | id = startTimer(4000 ); | 154 | id = startTimer(4000 ); |
155 | /* FIXME we want one page to be read! | 155 | /* FIXME we want one page to be read! |
156 | * | 156 | * |
157 | * Calculate that screensize | 157 | * Calculate that screensize |
158 | */ | 158 | */ |
159 | todoWindow()->setReadAhead( 4 ); | 159 | todoWindow()->setReadAhead( 4 ); |
160 | sort(); | 160 | sort(); |
161 | OTodoAccess::List::Iterator it, end; | 161 | OTodoAccess::List::Iterator it, end; |
162 | it = sorted().begin(); | 162 | it = sorted().begin(); |
163 | end = sorted().end(); | 163 | end = sorted().end(); |
164 | 164 | ||
165 | qWarning("setTodos"); | 165 | qWarning("setTodos"); |
166 | QTime time; | 166 | QTime time; |
167 | time.start(); | 167 | time.start(); |
168 | m_enablePaint = false; | 168 | m_enablePaint = false; |
169 | setUpdatesEnabled( false ); | 169 | setUpdatesEnabled( false ); |
170 | viewport()->setUpdatesEnabled( false ); | 170 | viewport()->setUpdatesEnabled( false ); |
171 | 171 | ||
172 | setNumRows( it.count() ); | 172 | setNumRows( it.count() ); |
173 | if ( it.count() == 0 ) | 173 | if ( it.count() == 0 ) |
174 | killTimer(id); | 174 | killTimer(id); |
175 | 175 | ||
176 | // int elc = time.elapsed(); | 176 | // int elc = time.elapsed(); |
177 | setUpdatesEnabled( true ); | 177 | setUpdatesEnabled( true ); |
178 | viewport()->setUpdatesEnabled( true ); | 178 | viewport()->setUpdatesEnabled( true ); |
179 | viewport()->update(); | 179 | viewport()->update(); |
180 | 180 | ||
181 | m_enablePaint = true; | 181 | m_enablePaint = true; |
182 | // int el = time.elapsed(); | 182 | // int el = time.elapsed(); |
183 | } | 183 | } |
184 | void TableView::setTodo( int, const OTodo&) { | 184 | void TableView::setTodo( int, const OTodo&) { |
185 | sort(); | 185 | sort(); |
@@ -275,258 +275,269 @@ void TableView::slotClicked(int row, int col, int, | |||
275 | case 2: { | 275 | case 2: { |
276 | m_menuTimer->stop(); | 276 | m_menuTimer->stop(); |
277 | showTodo( ui ); | 277 | showTodo( ui ); |
278 | break; | 278 | break; |
279 | } | 279 | } |
280 | case 3: { | 280 | case 3: { |
281 | m_menuTimer->stop(); | 281 | m_menuTimer->stop(); |
282 | TodoView::edit( ui ); | 282 | TodoView::edit( ui ); |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | } | 288 | } |
289 | void TableView::slotPressed(int row, int col, int, | 289 | void TableView::slotPressed(int row, int col, int, |
290 | const QPoint& point) { | 290 | const QPoint& point) { |
291 | 291 | ||
292 | qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); | 292 | qWarning("pressed row %d col %d x:%d+y:%d", row,col,point.x(),point.y() ); |
293 | m_prevP = point; | 293 | m_prevP = point; |
294 | /* TextColumn column */ | 294 | /* TextColumn column */ |
295 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) | 295 | if ( col == 2 && cellGeometry( row, col ).contains( point ) ) |
296 | m_menuTimer->start( 750, TRUE ); | 296 | m_menuTimer->start( 750, TRUE ); |
297 | } | 297 | } |
298 | void TableView::slotValueChanged( int, int ) { | 298 | void TableView::slotValueChanged( int, int ) { |
299 | qWarning("Value Changed"); | 299 | qWarning("Value Changed"); |
300 | } | 300 | } |
301 | void TableView::slotCurrentChanged(int, int ) { | 301 | void TableView::slotCurrentChanged(int, int ) { |
302 | m_menuTimer->stop(); | 302 | m_menuTimer->stop(); |
303 | } | 303 | } |
304 | QWidget* TableView::widget() { | 304 | QWidget* TableView::widget() { |
305 | return this; | 305 | return this; |
306 | } | 306 | } |
307 | /* | 307 | /* |
308 | * We need to overwrite sortColumn | 308 | * We need to overwrite sortColumn |
309 | * because we want to sort whole row | 309 | * because we want to sort whole row |
310 | * based | 310 | * based |
311 | * We event want to set the setOrder | 311 | * We event want to set the setOrder |
312 | * to a sort() and update() | 312 | * to a sort() and update() |
313 | */ | 313 | */ |
314 | void TableView::sortColumn( int col, bool asc, bool ) { | 314 | void TableView::sortColumn( int col, bool asc, bool ) { |
315 | qWarning("bool %d", asc ); | 315 | qWarning("bool %d", asc ); |
316 | setSortOrder( col ); | 316 | setSortOrder( col ); |
317 | setAscending( asc ); | 317 | setAscending( asc ); |
318 | updateView(); | 318 | updateView(); |
319 | } | 319 | } |
320 | void TableView::viewportPaintEvent( QPaintEvent* e) { | 320 | void TableView::viewportPaintEvent( QPaintEvent* e) { |
321 | if (m_enablePaint ) | 321 | if (m_enablePaint ) |
322 | QTable::viewportPaintEvent( e ); | 322 | QTable::viewportPaintEvent( e ); |
323 | } | 323 | } |
324 | /* | 324 | /* |
325 | * This segment is copyrighted by TT | 325 | * This segment is copyrighted by TT |
326 | * it was taken from their todolist | 326 | * it was taken from their todolist |
327 | * application this code is GPL | 327 | * application this code is GPL |
328 | */ | 328 | */ |
329 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 329 | void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
330 | const QColorGroup &cg = colorGroup(); | 330 | const QColorGroup &cg = colorGroup(); |
331 | 331 | ||
332 | p->save(); | 332 | p->save(); |
333 | 333 | ||
334 | OTodo task = sorted()[row]; | 334 | OTodo task = sorted()[row]; |
335 | 335 | ||
336 | // TODO - give user option for grid or bars? | 336 | // TODO - give user option for grid or bars? |
337 | 337 | ||
338 | // Paint alternating background bars | 338 | // Paint alternating background bars |
339 | if ( (row % 2 ) == 0 ) { | 339 | if ( (row % 2 ) == 0 ) { |
340 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 340 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
341 | p->setPen( QPen( cg.text() ) ); | 341 | p->setPen( QPen( cg.text() ) ); |
342 | } | 342 | } |
343 | else { | 343 | else { |
344 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 344 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
345 | p->setPen( QPen( cg.buttonText() ) ); | 345 | p->setPen( QPen( cg.buttonText() ) ); |
346 | } | 346 | } |
347 | 347 | ||
348 | // Paint grid | 348 | // Paint grid |
349 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 349 | //p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
350 | //QPen op = p->pen(); | 350 | //QPen op = p->pen(); |
351 | //p->setPen(cg.mid()); | 351 | //p->setPen(cg.mid()); |
352 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); | 352 | //p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); |
353 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); | 353 | //p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); |
354 | //p->setPen(op); | 354 | //p->setPen(op); |
355 | 355 | ||
356 | QFont f = p->font(); | 356 | QFont f = p->font(); |
357 | QFontMetrics fm(f); | 357 | QFontMetrics fm(f); |
358 | 358 | ||
359 | int marg = ( cr.width() - BoxSize ) / 2; | 359 | int marg = ( cr.width() - BoxSize ) / 2; |
360 | int x = 0; | 360 | int x = 0; |
361 | int y = ( cr.height() - BoxSize ) / 2; | 361 | int y = ( cr.height() - BoxSize ) / 2; |
362 | 362 | ||
363 | switch(col) { | 363 | switch(col) { |
364 | case 0: // completed field | 364 | case 0: // completed field |
365 | { | 365 | { |
366 | //p->setPen( QPen( cg.text() ) ); | 366 | //p->setPen( QPen( cg.text() ) ); |
367 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); | 367 | //p->drawRect( x + marg, y, BoxSize, BoxSize ); |
368 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); | 368 | //p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); |
369 | if ( task.isCompleted() ) { | 369 | if ( task.isCompleted() ) { |
370 | p->drawPixmap( x + marg, y, m_pic_completed ); | 370 | p->drawPixmap( x + marg, y, m_pic_completed ); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | break; | 373 | break; |
374 | case 1: // priority field | 374 | case 1: // priority field |
375 | { | 375 | { |
376 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); | 376 | p->drawPixmap( x + marg, y, m_pic_priority[ task.priority() - 1 ] ); |
377 | } | 377 | } |
378 | break; | 378 | break; |
379 | case 2: // description field | 379 | case 2: // description field |
380 | { | 380 | { |
381 | QString text = task.summary().isEmpty() ? | 381 | QString text = task.summary().isEmpty() ? |
382 | task.description().left(20) : | 382 | task.description().left(20) : |
383 | task.summary(); | 383 | task.summary(); |
384 | p->drawText(2,2 + fm.ascent(), text); | 384 | p->drawText(2,2 + fm.ascent(), text); |
385 | } | 385 | } |
386 | break; | 386 | break; |
387 | case 3: | 387 | case 3: |
388 | { | 388 | { |
389 | QString text; | 389 | QString text; |
390 | if (task.hasDueDate()) { | 390 | if (task.hasDueDate()) { |
391 | int off = QDate::currentDate().daysTo( task.dueDate() ); | 391 | int off = QDate::currentDate().daysTo( task.dueDate() ); |
392 | text = tr( "%1 day(s)").arg(QString::number(off)); | 392 | text = tr( "%1 day(s)").arg(QString::number(off)); |
393 | /* | 393 | /* |
394 | * set color if not completed | 394 | * set color if not completed |
395 | */ | 395 | */ |
396 | if (!task.isCompleted() ) { | 396 | if (!task.isCompleted() ) { |
397 | QColor color = Qt::black; | 397 | QColor color = Qt::black; |
398 | if ( off < 0 ) | 398 | if ( off < 0 ) |
399 | color = Qt::red; | 399 | color = Qt::red; |
400 | else if ( off == 0 ) | 400 | else if ( off == 0 ) |
401 | color = Qt::yellow; | 401 | color = Qt::yellow; |
402 | else if ( off > 0 ) | 402 | else if ( off > 0 ) |
403 | color = Qt::green; | 403 | color = Qt::green; |
404 | p->setPen(color ); | 404 | p->setPen(color ); |
405 | } | 405 | } |
406 | } else { | 406 | } else { |
407 | text = tr("None"); | 407 | text = tr("None"); |
408 | } | 408 | } |
409 | p->drawText(2,2 + fm.ascent(), text); | 409 | p->drawText(2,2 + fm.ascent(), text); |
410 | } | 410 | } |
411 | break; | 411 | break; |
412 | } | 412 | } |
413 | p->restore(); | 413 | p->restore(); |
414 | } | 414 | } |
415 | QWidget* TableView::createEditor(int row, int col, bool )const { | 415 | QWidget* TableView::createEditor(int row, int col, bool )const { |
416 | switch( col ) { | 416 | switch( col ) { |
417 | case 1: { | 417 | case 1: { |
418 | /* the priority stuff */ | 418 | /* the priority stuff */ |
419 | QComboBox* combo = new QComboBox( viewport() ); | 419 | QComboBox* combo = new QComboBox( viewport() ); |
420 | for ( int i = 0; i < 5; i++ ) { | 420 | for ( int i = 0; i < 5; i++ ) { |
421 | combo->insertItem( m_pic_priority[ i ] ); | 421 | combo->insertItem( m_pic_priority[ i ] ); |
422 | } | 422 | } |
423 | combo->setCurrentItem( sorted()[row].priority()-1 ); | 423 | combo->setCurrentItem( sorted()[row].priority()-1 ); |
424 | return combo; | 424 | return combo; |
425 | } | 425 | } |
426 | /* summary */ | 426 | /* summary */ |
427 | case 2:{ | 427 | case 2:{ |
428 | QLineEdit* edit = new QLineEdit( viewport() ); | 428 | QLineEdit* edit = new QLineEdit( viewport() ); |
429 | edit->setText( sorted()[row].summary() ); | 429 | edit->setText( sorted()[row].summary() ); |
430 | return edit; | 430 | return edit; |
431 | } | 431 | } |
432 | case 0: | 432 | case 0: |
433 | default: | 433 | default: |
434 | return 0l; | 434 | return 0l; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | void TableView::setCellContentFromEditor(int row, int col ) { | 437 | void TableView::setCellContentFromEditor(int row, int col ) { |
438 | if ( col == 1 ) { | 438 | if ( col == 1 ) { |
439 | QWidget* wid = cellWidget(row, 1 ); | 439 | QWidget* wid = cellWidget(row, 1 ); |
440 | if ( wid->inherits("QComboBox") ) { | 440 | if ( wid->inherits("QComboBox") ) { |
441 | int pri = ((QComboBox*)wid)->currentItem() + 1; | 441 | int pri = ((QComboBox*)wid)->currentItem() + 1; |
442 | OTodo todo = sorted()[row]; | 442 | OTodo todo = sorted()[row]; |
443 | if ( todo.priority() != pri ) { | 443 | if ( todo.priority() != pri ) { |
444 | todo.setPriority( pri ); | 444 | todo.setPriority( pri ); |
445 | TodoView::update( todo.uid(), todo ); | 445 | TodoView::update( todo.uid(), todo ); |
446 | updateView(); | 446 | updateView(); |
447 | } | 447 | } |
448 | } | 448 | } |
449 | }else if ( col == 2) { | 449 | }else if ( col == 2) { |
450 | QWidget* wid = cellWidget(row, 2); | 450 | QWidget* wid = cellWidget(row, 2); |
451 | if ( wid->inherits("QLineEdit") ) { | 451 | if ( wid->inherits("QLineEdit") ) { |
452 | QString text = ((QLineEdit*)wid)->text(); | 452 | QString text = ((QLineEdit*)wid)->text(); |
453 | OTodo todo = sorted()[row]; | 453 | OTodo todo = sorted()[row]; |
454 | if ( todo.summary() != text ) { | 454 | if ( todo.summary() != text ) { |
455 | todo.setSummary( text ); | 455 | todo.setSummary( text ); |
456 | TodoView::update( todo.uid(), todo ); | 456 | TodoView::update( todo.uid(), todo ); |
457 | updateView(); | 457 | updateView(); |
458 | } | 458 | } |
459 | } | 459 | } |
460 | } | 460 | } |
461 | } | 461 | } |
462 | void TableView::slotPriority() { | 462 | void TableView::slotPriority() { |
463 | setCellContentFromEditor( currentRow(), currentColumn() ); | 463 | setCellContentFromEditor( currentRow(), currentColumn() ); |
464 | } | 464 | } |
465 | /* | 465 | /* |
466 | * We'll use the TimerEvent to read ahead or to keep the cahce always | 466 | * We'll use the TimerEvent to read ahead or to keep the cahce always |
467 | * filled enough. | 467 | * filled enough. |
468 | * We will try to read ahead 4 items in both ways | 468 | * We will try to read ahead 4 items in both ways |
469 | * up and down. On odd or even we will currentRow()+-4 or +-9 | 469 | * up and down. On odd or even we will currentRow()+-4 or +-9 |
470 | * | 470 | * |
471 | */ | 471 | */ |
472 | void TableView::timerEvent( QTimerEvent* ev ) { | 472 | void TableView::timerEvent( QTimerEvent* ) { |
473 | // qWarning("sorted %d", sorted().count() ); | 473 | // qWarning("sorted %d", sorted().count() ); |
474 | if (sorted().count() == 0 ) | 474 | if (sorted().count() == 0 ) |
475 | return; | 475 | return; |
476 | 476 | ||
477 | int row = currentRow(); | 477 | int row = currentRow(); |
478 | if ( m_row ) { | 478 | if ( m_row ) { |
479 | int ro = row-4; | 479 | int ro = row-4; |
480 | if (ro < 0 ) ro = 0; | 480 | if (ro < 0 ) ro = 0; |
481 | sorted()[ro]; | 481 | sorted()[ro]; |
482 | 482 | ||
483 | ro = row+4; | 483 | ro = row+4; |
484 | sorted()[ro]; | 484 | sorted()[ro]; |
485 | } else { | 485 | } else { |
486 | int ro = row + 8; | 486 | int ro = row + 8; |
487 | sorted()[ro]; | 487 | sorted()[ro]; |
488 | 488 | ||
489 | ro = row-8; | 489 | ro = row-8; |
490 | if (ro < 0 ) ro = 0; | 490 | if (ro < 0 ) ro = 0; |
491 | sorted()[ro]; | 491 | sorted()[ro]; |
492 | } | 492 | } |
493 | 493 | ||
494 | m_row = !m_row; | 494 | m_row = !m_row; |
495 | } | 495 | } |
496 | 496 | ||
497 | // We want a strike through completed ;) | 497 | // We want a strike through completed ;) |
498 | // durchstreichen to complete | 498 | // durchstreichen to complete |
499 | /* | 499 | /* |
500 | * MouseTracking is off this mean we only receive | 500 | * MouseTracking is off this mean we only receive |
501 | * these events if the mouse button is pressed | 501 | * these events if the mouse button is pressed |
502 | * We've the previous point saved | 502 | * We've the previous point saved |
503 | * We check if the previous and current Point are | 503 | * We check if the previous and current Point are |
504 | * in the same row. | 504 | * in the same row. |
505 | * Then we check if they're some pixel horizontal away | 505 | * Then we check if they're some pixel horizontal away |
506 | * if the distance between the two points is greater than | 506 | * if the distance between the two points is greater than |
507 | * 8 we mark the underlying todo as completed and do a repaint | 507 | * 8 we mark the underlying todo as completed and do a repaint |
508 | * | 508 | * |
509 | * BUG: When clicking on the Due column and it's scrollable | 509 | * BUG: When clicking on the Due column and it's scrollable |
510 | * the todo is marked as completed... | 510 | * the todo is marked as completed... |
511 | * REASON: QTable is doing auto scrolling which leads to a move | 511 | * REASON: QTable is doing auto scrolling which leads to a move |
512 | * in the x coordinate and this way it's able to pass the | 512 | * in the x coordinate and this way it's able to pass the |
513 | * m_completeStrokeWidth criteria | 513 | * m_completeStrokeWidth criteria |
514 | * WORKAROUND: strike through needs to strike through the same | 514 | * WORKAROUND: strike through needs to strike through the same |
515 | * row and two columns! | 515 | * row and two columns! |
516 | */ | 516 | */ |
517 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { | 517 | void TableView::contentsMouseReleaseEvent( QMouseEvent* e) { |
518 | int row = rowAt(m_prevP.y()); | 518 | int row = rowAt(m_prevP.y()); |
519 | int colOld = columnAt(m_prevP.x() ); | 519 | int colOld = columnAt(m_prevP.x() ); |
520 | int colNew = columnAt(e->x() ); | 520 | int colNew = columnAt(e->x() ); |
521 | qWarning("colNew: %d colOld: %d", colNew, colOld ); | 521 | qWarning("colNew: %d colOld: %d", colNew, colOld ); |
522 | if ( row == rowAt( e->y() ) && row != -1 && | 522 | if ( row == rowAt( e->y() ) && row != -1 && |
523 | colOld != colNew ) { | 523 | colOld != colNew ) { |
524 | TodoView::complete( sorted()[row] ); | 524 | TodoView::complete( sorted()[row] ); |
525 | return; | 525 | return; |
526 | } | 526 | } |
527 | QTable::contentsMouseReleaseEvent( e ); | 527 | QTable::contentsMouseReleaseEvent( e ); |
528 | } | 528 | } |
529 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { | 529 | void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { |
530 | m_menuTimer->stop(); | 530 | m_menuTimer->stop(); |
531 | QTable::contentsMouseMoveEvent( e ); | 531 | QTable::contentsMouseMoveEvent( e ); |
532 | } | 532 | } |
533 | void TableView::keyPressEvent( QKeyEvent* event) { | ||
534 | switch( event->key() ) { | ||
535 | case Qt::Key_F33: | ||
536 | case Qt::Key_Enter: | ||
537 | case Qt::Key_Return: | ||
538 | showTodo( sorted().uidAt( currentRow() ) ); | ||
539 | break; | ||
540 | default: | ||
541 | QTable::keyPressEvent( event ); | ||
542 | } | ||
543 | } | ||
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 2b6ea2b..689c496 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -1,111 +1,112 @@ | |||
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 <> | 3 | .=l. Copyright (c) 2002 <> |
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 OPIE_TABLE_VIEW_H | 29 | #ifndef OPIE_TABLE_VIEW_H |
30 | #define OPIE_TABLE_VIEW_H | 30 | #define OPIE_TABLE_VIEW_H |
31 | 31 | ||
32 | #include <qtable.h> | 32 | #include <qtable.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | 35 | ||
36 | #include "todoview.h" | 36 | #include "todoview.h" |
37 | 37 | ||
38 | class QTimer; | 38 | class QTimer; |
39 | 39 | ||
40 | namespace Todo { | 40 | namespace Todo { |
41 | class CheckItem; | 41 | class CheckItem; |
42 | class DueTextItem; | 42 | class DueTextItem; |
43 | class TableView : public QTable, public TodoView { | 43 | class TableView : public QTable, public TodoView { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | TableView( MainWindow*, QWidget* parent ); | 46 | TableView( MainWindow*, QWidget* parent ); |
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | 49 | ||
50 | QString type()const; | 50 | QString type()const; |
51 | int current(); | 51 | int current(); |
52 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
53 | 53 | ||
54 | void clear(); | 54 | void clear(); |
55 | void showOverDue( bool ); | 55 | void showOverDue( bool ); |
56 | void updateView(); | 56 | void updateView(); |
57 | void setTodo( int uid, const OTodo& ); | 57 | void setTodo( int uid, const OTodo& ); |
58 | void addEvent( const OTodo& event ); | 58 | void addEvent( const OTodo& event ); |
59 | void replaceEvent( const OTodo& ); | 59 | void replaceEvent( const OTodo& ); |
60 | void removeEvent( int uid ); | 60 | void removeEvent( int uid ); |
61 | void setShowCompleted( bool ); | 61 | void setShowCompleted( bool ); |
62 | void setShowDeadline( bool ); | 62 | void setShowDeadline( bool ); |
63 | 63 | ||
64 | void setShowCategory(const QString& =QString::null ); | 64 | void setShowCategory(const QString& =QString::null ); |
65 | void newDay(); | 65 | void newDay(); |
66 | QWidget* widget(); | 66 | QWidget* widget(); |
67 | void sortColumn(int, bool, bool ); | 67 | void sortColumn(int, bool, bool ); |
68 | 68 | ||
69 | /* | 69 | /* |
70 | * we do our drawing ourselves | 70 | * we do our drawing ourselves |
71 | * because we don't want to have | 71 | * because we don't want to have |
72 | * 40.000 QTableItems for 10.000 | 72 | * 40.000 QTableItems for 10.000 |
73 | * OTodos where we only show 10 at a time! | 73 | * OTodos where we only show 10 at a time! |
74 | */ | 74 | */ |
75 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | 75 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); |
76 | private: | 76 | private: |
77 | /* reimplented for internal reasons */ | 77 | /* reimplented for internal reasons */ |
78 | void viewportPaintEvent( QPaintEvent* ); | 78 | void viewportPaintEvent( QPaintEvent* ); |
79 | QTimer *m_menuTimer; | 79 | QTimer *m_menuTimer; |
80 | bool m_enablePaint:1; | 80 | bool m_enablePaint:1; |
81 | QString m_oleCat; | 81 | QString m_oleCat; |
82 | bool m_first : 1; | 82 | bool m_first : 1; |
83 | 83 | ||
84 | QPixmap m_pic_completed; | 84 | QPixmap m_pic_completed; |
85 | QPixmap m_pic_priority[ 5 ]; | 85 | QPixmap m_pic_priority[ 5 ]; |
86 | 86 | ||
87 | protected: | 87 | protected: |
88 | void keyPressEvent( QKeyEvent* ); | ||
88 | void contentsMouseReleaseEvent( QMouseEvent* ); | 89 | void contentsMouseReleaseEvent( QMouseEvent* ); |
89 | void contentsMouseMoveEvent( QMouseEvent* ); | 90 | void contentsMouseMoveEvent( QMouseEvent* ); |
90 | void timerEvent( QTimerEvent* e ); | 91 | void timerEvent( QTimerEvent* e ); |
91 | QWidget* createEditor(int row, int col, bool initFromCell )const; | 92 | QWidget* createEditor(int row, int col, bool initFromCell )const; |
92 | void setCellContentFromEditor( int row, int col ); | 93 | void setCellContentFromEditor( int row, int col ); |
93 | 94 | ||
94 | private slots: | 95 | private slots: |
95 | void slotShowMenu(); | 96 | void slotShowMenu(); |
96 | void slotClicked(int, int, int, | 97 | void slotClicked(int, int, int, |
97 | const QPoint& ); | 98 | const QPoint& ); |
98 | void slotPressed(int, int, int, | 99 | void slotPressed(int, int, int, |
99 | const QPoint& ); | 100 | const QPoint& ); |
100 | void slotValueChanged(int, int); | 101 | void slotValueChanged(int, int); |
101 | void slotCurrentChanged(int, int ); | 102 | void slotCurrentChanged(int, int ); |
102 | void slotPriority(); | 103 | void slotPriority(); |
103 | private: | 104 | private: |
104 | void initConfig(); | 105 | void initConfig(); |
105 | int m_completeStrokeWidth; | 106 | int m_completeStrokeWidth; |
106 | bool m_row : 1; | 107 | bool m_row : 1; |
107 | QPoint m_prevP; | 108 | QPoint m_prevP; |
108 | }; | 109 | }; |
109 | }; | 110 | }; |
110 | 111 | ||
111 | #endif | 112 | #endif |
diff --git a/core/pim/todo/textviewshow.cpp b/core/pim/todo/textviewshow.cpp index 24c8c0e..fe8a9c8 100644 --- a/core/pim/todo/textviewshow.cpp +++ b/core/pim/todo/textviewshow.cpp | |||
@@ -1,19 +1,32 @@ | |||
1 | #include "mainwindow.h" | ||
1 | #include "textviewshow.h" | 2 | #include "textviewshow.h" |
2 | 3 | ||
3 | using namespace Todo; | 4 | using namespace Todo; |
4 | 5 | ||
5 | TextViewShow::TextViewShow( QWidget* parent) | 6 | TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) |
6 | : QTextView( parent ), TodoShow() { | 7 | : QTextView( parent ), TodoShow(win) { |
7 | 8 | ||
8 | } | 9 | } |
9 | TextViewShow::~TextViewShow() { | 10 | TextViewShow::~TextViewShow() { |
10 | } | 11 | } |
11 | QString TextViewShow::type()const { | 12 | QString TextViewShow::type()const { |
12 | return QString::fromLatin1("TextViewShow"); | 13 | return QString::fromLatin1("TextViewShow"); |
13 | } | 14 | } |
14 | void TextViewShow::slotShow( const OTodo& ev ) { | 15 | void TextViewShow::slotShow( const OTodo& ev ) { |
15 | setText( ev.toRichText() ); | 16 | setText( ev.toRichText() ); |
16 | } | 17 | } |
17 | QWidget* TextViewShow::widget() { | 18 | QWidget* TextViewShow::widget() { |
18 | return this; | 19 | return this; |
19 | } | 20 | } |
21 | void TextViewShow::keyPressEvent( QKeyEvent* event ) { | ||
22 | switch( event->key() ) { | ||
23 | case Qt::Key_F33: | ||
24 | case Qt::Key_Enter: | ||
25 | case Qt::Key_Return: | ||
26 | escapeView(); | ||
27 | break; | ||
28 | default: | ||
29 | QTextView::keyPressEvent( event ); | ||
30 | break; | ||
31 | } | ||
32 | } | ||
diff --git a/core/pim/todo/textviewshow.h b/core/pim/todo/textviewshow.h index f58026b..498de81 100644 --- a/core/pim/todo/textviewshow.h +++ b/core/pim/todo/textviewshow.h | |||
@@ -1,17 +1,20 @@ | |||
1 | #include <qtextview.h> | 1 | #include <qtextview.h> |
2 | 2 | ||
3 | #include "todoshow.h" | 3 | #include "todoshow.h" |
4 | 4 | ||
5 | namespace Todo { | 5 | namespace Todo { |
6 | 6 | ||
7 | class TextViewShow : public QTextView, public TodoShow { | 7 | class TextViewShow : public QTextView, public TodoShow { |
8 | public: | 8 | public: |
9 | TextViewShow( QWidget* parent ); | 9 | TextViewShow( QWidget* parent, MainWindow* ); |
10 | ~TextViewShow(); | 10 | ~TextViewShow(); |
11 | 11 | ||
12 | QString type()const; | 12 | QString type()const; |
13 | void slotShow( const OTodo& ev ); | 13 | void slotShow( const OTodo& ev ); |
14 | QWidget* widget(); | 14 | QWidget* widget(); |
15 | 15 | ||
16 | protected: | ||
17 | void keyPressEvent( QKeyEvent* ); | ||
18 | |||
16 | }; | 19 | }; |
17 | }; | 20 | }; |
diff --git a/core/pim/todo/todoshow.cpp b/core/pim/todo/todoshow.cpp index c84a08f..4dbc9aa 100644 --- a/core/pim/todo/todoshow.cpp +++ b/core/pim/todo/todoshow.cpp | |||
@@ -1,9 +1,16 @@ | |||
1 | |||
2 | #include "mainwindow.h" | ||
1 | #include "todoshow.h" | 3 | #include "todoshow.h" |
2 | 4 | ||
3 | using namespace Todo; | 5 | using namespace Todo; |
4 | 6 | ||
5 | TodoShow::TodoShow() { | 7 | TodoShow::TodoShow(MainWindow* win) { |
8 | m_win = win; | ||
6 | } | 9 | } |
7 | TodoShow::~TodoShow() { | 10 | TodoShow::~TodoShow() { |
8 | } | 11 | } |
12 | void TodoShow::escapeView() { | ||
13 | if (m_win ) | ||
14 | m_win->slotReturnFromView(); | ||
15 | } | ||
9 | 16 | ||
diff --git a/core/pim/todo/todoshow.h b/core/pim/todo/todoshow.h index 198e9ae..7267b13 100644 --- a/core/pim/todo/todoshow.h +++ b/core/pim/todo/todoshow.h | |||
@@ -1,53 +1,58 @@ | |||
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 <> | 3 | .=l. Copyright (c) 2002 <> |
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 | #ifndef TODO_TODO_SHOW_H | 28 | #ifndef TODO_TODO_SHOW_H |
29 | #define TODO_TODO_SHOW_H | 29 | #define TODO_TODO_SHOW_H |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | #include <opie/otodo.h> | 34 | #include <opie/otodo.h> |
35 | 35 | ||
36 | namespace Todo { | 36 | namespace Todo { |
37 | class MainWindow; | ||
37 | /** | 38 | /** |
38 | * TodoShow is the baseclass of | 39 | * TodoShow is the baseclass of |
39 | * of all TodoShows. | 40 | * of all TodoShows. |
40 | * The first implementation is a QTextView | 41 | * The first implementation is a QTextView |
41 | * implementation showing the Todo as richtext | 42 | * implementation showing the Todo as richtext |
42 | */ | 43 | */ |
43 | class TodoShow { | 44 | class TodoShow { |
44 | public: | 45 | public: |
45 | TodoShow(); | 46 | TodoShow( MainWindow* win); |
46 | virtual ~TodoShow(); | 47 | virtual ~TodoShow(); |
47 | virtual QString type()const = 0; | 48 | virtual QString type()const = 0; |
48 | virtual void slotShow( const OTodo& ev ) = 0; | 49 | virtual void slotShow( const OTodo& ev ) = 0; |
49 | virtual QWidget* widget() = 0; | 50 | virtual QWidget* widget() = 0; |
51 | protected: | ||
52 | void escapeView(); | ||
53 | private: | ||
54 | MainWindow *m_win; | ||
50 | }; | 55 | }; |
51 | }; | 56 | }; |
52 | 57 | ||
53 | #endif | 58 | #endif |