summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-14 19:20:59 (UTC)
committer zecke <zecke>2004-03-14 19:20:59 (UTC)
commitcbb87c7c24dfe46462602c73b10bd76ce81a3baf (patch) (unidiff)
treeff803045e142f3a5013895be2623a4b5c76531fb
parent601330a1173afbc7736d103a584b8bde20646dee (diff)
downloadopie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.zip
opie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.tar.gz
opie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.tar.bz2
Make use of ODP namespace
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp4
-rw-r--r--core/pim/todo/mainwindow.h4
-rw-r--r--core/pim/todo/otaskeditor.cpp1
-rw-r--r--core/pim/todo/otaskeditor.h2
-rw-r--r--core/pim/todo/quickeditimpl.cpp3
-rw-r--r--core/pim/todo/taskeditoralarms.cpp1
6 files changed, 10 insertions, 5 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index c2f422d..f0642c4 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,991 +1,993 @@
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 <opie2/opimrecurrence.h> 31#include <opie2/opimrecurrence.h>
32#include <opie2/opimnotifymanager.h> 32#include <opie2/opimnotifymanager.h>
33#include <opie2/otodoaccessvcal.h> 33#include <opie2/otodoaccessvcal.h>
34#include <opie2/oapplicationfactory.h> 34#include <opie2/oapplicationfactory.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/ir.h> 38#include <qpe/ir.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/alarmserver.h> 41#include <qpe/alarmserver.h>
42#include <qpe/qpeapplication.h> 42#include <qpe/qpeapplication.h>
43 43
44#include <qmenubar.h> 44#include <qmenubar.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qtimer.h> 48#include <qtimer.h>
49#include <qlayout.h> 49#include <qlayout.h>
50#include <qwhatsthis.h> 50#include <qwhatsthis.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
61using namespace Opie::Core;
61OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) 62OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
62 63
64 using namespace Opie;
63using namespace Todo; 65using namespace Todo;
64 66
65MainWindow::MainWindow( QWidget* parent, 67MainWindow::MainWindow( QWidget* parent,
66 const char* name, WFlags ) 68 const char* name, WFlags )
67 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 69 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
68{ 70{
69 if (!name) 71 if (!name)
70 setName("todo window"); 72 setName("todo window");
71 73
72 m_syncing = false; 74 m_syncing = false;
73 m_showing = false; 75 m_showing = false;
74 m_counter = 0; 76 m_counter = 0;
75 m_tempManager = new TemplateManager(); 77 m_tempManager = new TemplateManager();
76 m_tempManager->load(); 78 m_tempManager->load();
77 79
78 initUI(); 80 initUI();
79 initConfig(); 81 initConfig();
80 initViews(); 82 initViews();
81 initActions(); 83 initActions();
82 initEditor(); 84 initEditor();
83 initShow(); 85 initShow();
84 initTemplate(); 86 initTemplate();
85 87
86 populateTemplates(); 88 populateTemplates();
87 raiseCurrentView(); 89 raiseCurrentView();
88 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 90 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
89} 91}
90void MainWindow::initTemplate() { 92void MainWindow::initTemplate() {
91 m_curTempEd = new TemplateEditor( this, templateManager() ); 93 m_curTempEd = new TemplateEditor( this, templateManager() );
92} 94}
93void MainWindow::initActions() { 95void MainWindow::initActions() {
94 96
95 // Data menu 97 // Data menu
96 m_edit->insertItem(QWidget::tr("New from template"), m_template, 98 m_edit->insertItem(QWidget::tr("New from template"), m_template,
97 -1, 0 ); 99 -1, 0 );
98 100
99 QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), 101 QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
100 QString::null, 0, this, 0 ); 102 QString::null, 0, this, 0 );
101 connect(a, SIGNAL( activated() ), 103 connect(a, SIGNAL( activated() ),
102 this, SLOT( slotNew() ) ); 104 this, SLOT( slotNew() ) );
103 a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); 105 a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) );
104 a->addTo(m_tool ); 106 a->addTo(m_tool );
105 a->addTo(m_edit ); 107 a->addTo(m_edit );
106 108
107 a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), 109 a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ),
108 QString::null, 0, this, 0 ); 110 QString::null, 0, this, 0 );
109 connect(a, SIGNAL(activated() ), 111 connect(a, SIGNAL(activated() ),
110 this, SLOT( slotEdit() ) ); 112 this, SLOT( slotEdit() ) );
111 a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); 113 a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) );
112 a->addTo( m_tool ); 114 a->addTo( m_tool );
113 a->addTo( m_edit ); 115 a->addTo( m_edit );
114 m_editAction = a; 116 m_editAction = a;
115 117
116 a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); 118 a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 );
117 connect(a, SIGNAL( activated() ), 119 connect(a, SIGNAL( activated() ),
118 this, SLOT( slotShowDetails() ) ); 120 this, SLOT( slotShowDetails() ) );
119 a->addTo( m_edit ); 121 a->addTo( m_edit );
120 122
121 m_edit->insertSeparator(); 123 m_edit->insertSeparator();
122 124
123 a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), 125 a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ),
124 QString::null, 0, this, 0 ); 126 QString::null, 0, this, 0 );
125 connect(a, SIGNAL(activated() ), 127 connect(a, SIGNAL(activated() ),
126 this, SLOT(slotDelete() ) ); 128 this, SLOT(slotDelete() ) );
127 a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); 129 a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) );
128 a->addTo( m_tool ); 130 a->addTo( m_tool );
129 a->addTo( m_edit ); 131 a->addTo( m_edit );
130 m_deleteAction = a; 132 m_deleteAction = a;
131 133
132 a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); 134 a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 );
133 connect(a, SIGNAL( activated() ), 135 connect(a, SIGNAL( activated() ),
134 this, SLOT( slotDeleteAll() ) ); 136 this, SLOT( slotDeleteAll() ) );
135 a->addTo(m_edit ); 137 a->addTo(m_edit );
136 m_deleteAllAction = a; 138 m_deleteAllAction = a;
137 139
138 a = new QAction( QString::null, QWidget::tr("Delete completed"), 140 a = new QAction( QString::null, QWidget::tr("Delete completed"),
139 0, this, 0 ); 141 0, this, 0 );
140 connect(a, SIGNAL( activated() ), 142 connect(a, SIGNAL( activated() ),
141 this, SLOT( slotDeleteCompleted() ) ); 143 this, SLOT( slotDeleteCompleted() ) );
142 a->addTo(m_edit ); 144 a->addTo(m_edit );
143 a->setEnabled( TRUE ); 145 a->setEnabled( TRUE );
144 m_deleteCompleteAction = a; 146 m_deleteCompleteAction = a;
145 147
146 m_edit->insertSeparator(); 148 m_edit->insertSeparator();
147 149
148 a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); 150 a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 );
149 connect(a, SIGNAL( activated() ), 151 connect(a, SIGNAL( activated() ),
150 this, SLOT( slotDuplicate() ) ); 152 this, SLOT( slotDuplicate() ) );
151 a->addTo(m_edit ); 153 a->addTo(m_edit );
152 m_duplicateAction = a; 154 m_duplicateAction = a;
153 155
154 m_edit->insertSeparator(); 156 m_edit->insertSeparator();
155 157
156 if ( Ir::supported() ) { 158 if ( Ir::supported() ) {
157 a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); 159 a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 );
158 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 160 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
159 a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); 161 a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) );
160 a->addTo( m_edit ); 162 a->addTo( m_edit );
161 a->addTo( m_tool ); 163 a->addTo( m_tool );
162 } 164 }
163 165
164#if 0 166#if 0
165 // Options menu 167 // Options menu
166 a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), 168 a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ),
167 QString::null, 0, this, 0 ); 169 QString::null, 0, this, 0 );
168 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); 170 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
169 a->addTo( m_options ); 171 a->addTo( m_options );
170 m_findAction = a; 172 m_findAction = a;
171 173
172 174
173 m_options->insertSeparator(); 175 m_options->insertSeparator();
174#endif 176#endif
175 177
176 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), 178 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
177 0, this, 0, TRUE ); 179 0, this, 0, TRUE );
178 m_completedAction->addTo( m_options ); 180 m_completedAction->addTo( m_options );
179 m_completedAction->setOn( showCompleted() ); 181 m_completedAction->setOn( showCompleted() );
180 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 182 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
181 183
182 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), 184 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"),
183 0, this, 0, TRUE ); 185 0, this, 0, TRUE );
184 a->addTo( m_options ); 186 a->addTo( m_options );
185 a->setOn( showOverDue() ); 187 a->setOn( showOverDue() );
186 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 188 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
187 189
188 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), 190 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"),
189 0, this, 0, TRUE ); 191 0, this, 0, TRUE );
190 m_showDeadLineAction->addTo( m_options ); 192 m_showDeadLineAction->addTo( m_options );
191 m_showDeadLineAction->setOn( showDeadline() ); 193 m_showDeadLineAction->setOn( showDeadline() );
192 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); 194 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) );
193 195
194 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), 196 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"),
195 0, this, 0, TRUE ); 197 0, this, 0, TRUE );
196 m_showQuickTaskAction->addTo( m_options ); 198 m_showQuickTaskAction->addTo( m_options );
197 m_showQuickTaskAction->setOn( showQuickTask() ); 199 m_showQuickTaskAction->setOn( showQuickTask() );
198 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 200 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
199 201
200 m_options->insertSeparator(); 202 m_options->insertSeparator();
201 203
202 m_bar->insertItem( QWidget::tr("Data") ,m_edit ); 204 m_bar->insertItem( QWidget::tr("Data") ,m_edit );
203 m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); 205 m_bar->insertItem( QWidget::tr("Category"), m_catMenu );
204 m_bar->insertItem( QWidget::tr("Options"), m_options ); 206 m_bar->insertItem( QWidget::tr("Options"), m_options );
205 207
206 m_curQuick = new QuickEditImpl( this, m_quicktask ); 208 m_curQuick = new QuickEditImpl( this, m_quicktask );
207 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 209 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE );
208 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 210 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
209 211
210} 212}
211/* m_curCat from Config */ 213/* m_curCat from Config */
212void MainWindow::initConfig() { 214void MainWindow::initConfig() {
213 Config config( "todo" ); 215 Config config( "todo" );
214 config.setGroup( "View" ); 216 config.setGroup( "View" );
215 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 217 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
216 m_curCat = config.readEntry( "Category", QString::null ); 218 m_curCat = config.readEntry( "Category", QString::null );
217 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 219 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
218 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 220 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
219 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 221 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
220} 222}
221void MainWindow::initUI() { 223void MainWindow::initUI() {
222 224
223 m_stack = new OWidgetStack(this, "main stack"); 225 m_stack = new Opie::Ui::OWidgetStack(this, "main stack");
224 226
225 setCentralWidget( m_stack ); 227 setCentralWidget( m_stack );
226 228
227 setToolBarsMovable( FALSE ); 229 setToolBarsMovable( FALSE );
228 230
229 QToolBar *menubarholder = new QToolBar( this ); 231 QToolBar *menubarholder = new QToolBar( this );
230 menubarholder->setHorizontalStretchable( TRUE ); 232 menubarholder->setHorizontalStretchable( TRUE );
231 m_bar = new QMenuBar( menubarholder ); 233 m_bar = new QMenuBar( menubarholder );
232 234
233 m_tool = new QToolBar( this ); 235 m_tool = new QToolBar( this );
234 236
235 /** QPopupMenu */ 237 /** QPopupMenu */
236 m_edit = new QPopupMenu( this ); 238 m_edit = new QPopupMenu( this );
237 m_options = new QPopupMenu( this ); 239 m_options = new QPopupMenu( this );
238 m_catMenu = new QPopupMenu( this ); 240 m_catMenu = new QPopupMenu( this );
239 m_template = new QPopupMenu( this ); 241 m_template = new QPopupMenu( this );
240 242
241 m_catMenu->setCheckable( TRUE ); 243 m_catMenu->setCheckable( TRUE );
242 m_template->setCheckable( TRUE ); 244 m_template->setCheckable( TRUE );
243 245
244 connect(m_catMenu, SIGNAL(activated(int) ), 246 connect(m_catMenu, SIGNAL(activated(int) ),
245 this, SLOT(setCategory(int) ) ); 247 this, SLOT(setCategory(int) ) );
246 connect(m_template, SIGNAL(activated(int) ), 248 connect(m_template, SIGNAL(activated(int) ),
247 this, SLOT(slotNewFromTemplate(int) ) ); 249 this, SLOT(slotNewFromTemplate(int) ) );
248} 250}
249void MainWindow::initViews() { 251void MainWindow::initViews() {
250 252
251 TableView* tableView = new TableView( this, m_stack ); 253 TableView* tableView = new TableView( this, m_stack );
252 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." ) ); 254 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." ) );
253 m_stack->addWidget( tableView, m_counter++ ); 255 m_stack->addWidget( tableView, m_counter++ );
254 m_views.append( tableView ); 256 m_views.append( tableView );
255 m_curView = tableView; 257 m_curView = tableView;
256 connectBase( tableView ); 258 connectBase( tableView );
257 /* add QString type + QString configname to 259 /* add QString type + QString configname to
258 * the View menu 260 * the View menu
259 * and subdirs for multiple views 261 * and subdirs for multiple views
260 */ 262 */
261} 263}
262void MainWindow::initEditor() { 264void MainWindow::initEditor() {
263 m_curEdit = new Editor(); 265 m_curEdit = new Editor();
264} 266}
265void MainWindow::initShow() { 267void MainWindow::initShow() {
266 m_curShow = new TextViewShow(this, this); 268 m_curShow = new TextViewShow(this, this);
267 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 269 m_stack->addWidget( m_curShow->widget() , m_counter++ );
268} 270}
269MainWindow::~MainWindow() { 271MainWindow::~MainWindow() {
270 delete templateManager(); 272 delete templateManager();
271} 273}
272void MainWindow::connectBase( ViewBase* ) { 274void MainWindow::connectBase( ViewBase* ) {
273 // once templates and signals mix we'll use it again 275 // once templates and signals mix we'll use it again
274} 276}
275QPopupMenu* MainWindow::contextMenu( int , bool recur ) { 277QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
276 QPopupMenu* menu = new QPopupMenu(); 278 QPopupMenu* menu = new QPopupMenu();
277 279
278 m_editAction->addTo( menu ); 280 m_editAction->addTo( menu );
279 m_deleteAction->addTo( menu ); 281 m_deleteAction->addTo( menu );
280 m_duplicateAction->addTo( menu ); 282 m_duplicateAction->addTo( menu );
281 283
282 menu->insertSeparator(); 284 menu->insertSeparator();
283 285
284 /* 286 /*
285 * if this event recurs we allow 287 * if this event recurs we allow
286 * to detach it. 288 * to detach it.
287 * remove all 289 * remove all
288 */ 290 */
289 if ( recur ) { 291 if ( recur ) {
290 ; // FIXME 292 ; // FIXME
291 } 293 }
292 294
293 return menu; 295 return menu;
294} 296}
295QPopupMenu* MainWindow::options() { 297QPopupMenu* MainWindow::options() {
296 qWarning("Options"); 298 qWarning("Options");
297 return m_options; 299 return m_options;
298} 300}
299QPopupMenu* MainWindow::edit() { 301QPopupMenu* MainWindow::edit() {
300 return m_edit; 302 return m_edit;
301} 303}
302QToolBar* MainWindow::toolbar() { 304QToolBar* MainWindow::toolbar() {
303 return m_tool; 305 return m_tool;
304} 306}
305OPimTodoAccess::List MainWindow::list()const { 307OPimTodoAccess::List MainWindow::list()const {
306 return m_todoMgr.list(); 308 return m_todoMgr.list();
307} 309}
308OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { 310OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
309 int cat = 0; 311 int cat = 0;
310 if ( m_curCat != QWidget::tr("All Categories") ) 312 if ( m_curCat != QWidget::tr("All Categories") )
311 cat = currentCatId(); 313 cat = currentCatId();
312 if ( m_curCat == QWidget::tr("Unfiled") ) 314 if ( m_curCat == QWidget::tr("Unfiled") )
313 cat = -1; 315 cat = -1;
314 316
315 qWarning(" Category %d %s", cat, m_curCat.latin1() ); 317 qWarning(" Category %d %s", cat, m_curCat.latin1() );
316 318
317 int filter = 1; 319 int filter = 1;
318 320
319 if (!m_completed ) 321 if (!m_completed )
320 filter |= 4; 322 filter |= 4;
321 if (m_overdue) 323 if (m_overdue)
322 filter |= 2; 324 filter |= 2;
323 325
324 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 326 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
325} 327}
326OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 328OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
327 int cat = 0; 329 int cat = 0;
328 if ( m_curCat != QWidget::tr("All Categories") ) 330 if ( m_curCat != QWidget::tr("All Categories") )
329 cat = currentCatId(); 331 cat = currentCatId();
330 332
331 if ( m_curCat == QWidget::tr("Unfiled") ) 333 if ( m_curCat == QWidget::tr("Unfiled") )
332 cat = -1; 334 cat = -1;
333 335
334 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 336 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
335} 337}
336OPimTodo MainWindow::event( int uid ) { 338OPimTodo MainWindow::event( int uid ) {
337 return m_todoMgr.event( uid ); 339 return m_todoMgr.event( uid );
338} 340}
339bool MainWindow::isSyncing()const { 341bool MainWindow::isSyncing()const {
340 return m_syncing; 342 return m_syncing;
341} 343}
342TemplateManager* MainWindow::templateManager() { 344TemplateManager* MainWindow::templateManager() {
343 return m_tempManager; 345 return m_tempManager;
344} 346}
345Editor* MainWindow::currentEditor() { 347Editor* MainWindow::currentEditor() {
346 return m_curEdit; 348 return m_curEdit;
347} 349}
348TodoShow* MainWindow::currentShow() { 350TodoShow* MainWindow::currentShow() {
349 return m_curShow; 351 return m_curShow;
350} 352}
351void MainWindow::slotReload() { 353void MainWindow::slotReload() {
352 m_syncing = FALSE; 354 m_syncing = FALSE;
353 m_todoMgr.reload(); 355 m_todoMgr.reload();
354 currentView()->updateView( ); 356 currentView()->updateView( );
355 raiseCurrentView(); 357 raiseCurrentView();
356} 358}
357void MainWindow::closeEvent( QCloseEvent* e ) { 359void MainWindow::closeEvent( QCloseEvent* e ) {
358 if (m_stack->visibleWidget() == currentShow()->widget() ) { 360 if (m_stack->visibleWidget() == currentShow()->widget() ) {
359 m_showing = false; 361 m_showing = false;
360 raiseCurrentView(); 362 raiseCurrentView();
361 e->ignore(); 363 e->ignore();
362 return; 364 return;
363 } 365 }
364 /* 366 /*
365 * we should have flushed and now we're still saving 367 * we should have flushed and now we're still saving
366 * so there is no need to flush 368 * so there is no need to flush
367 */ 369 */
368 if (m_syncing ) { 370 if (m_syncing ) {
369 e->accept(); 371 e->accept();
370 return; 372 return;
371 } 373 }
372 bool quit = false; 374 bool quit = false;
373 if ( m_todoMgr.saveAll() ){ 375 if ( m_todoMgr.saveAll() ){
374 qWarning("saved"); 376 qWarning("saved");
375 quit = true; 377 quit = true;
376 }else { 378 }else {
377 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 379 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
378 QWidget::tr("Todo was unable\n" 380 QWidget::tr("Todo was unable\n"
379 "to save your changes.\n" 381 "to save your changes.\n"
380 "Free up some space\n" 382 "Free up some space\n"
381 "and try again.\n" 383 "and try again.\n"
382 "\nQuit Anyway?"), 384 "\nQuit Anyway?"),
383 QMessageBox::Yes|QMessageBox::Escape, 385 QMessageBox::Yes|QMessageBox::Escape,
384 QMessageBox::No|QMessageBox::Default) 386 QMessageBox::No|QMessageBox::Default)
385 != QMessageBox::No ) { 387 != QMessageBox::No ) {
386 e->accept(); 388 e->accept();
387 quit = true; 389 quit = true;
388 }else 390 }else
389 e->ignore(); 391 e->ignore();
390 392
391 } 393 }
392 394
393 if (quit ) { 395 if (quit ) {
394 Config config( "todo" ); 396 Config config( "todo" );
395 config.setGroup( "View" ); 397 config.setGroup( "View" );
396 config.writeEntry( "ShowComplete", showCompleted() ); 398 config.writeEntry( "ShowComplete", showCompleted() );
397 config.writeEntry( "Category", currentCategory() ); 399 config.writeEntry( "Category", currentCategory() );
398 config.writeEntry( "ShowDeadLine", showDeadline()); 400 config.writeEntry( "ShowDeadLine", showDeadline());
399 config.writeEntry( "ShowOverDue", showOverDue() ); 401 config.writeEntry( "ShowOverDue", showOverDue() );
400 config.writeEntry( "ShowQuickTask", showQuickTask() ); 402 config.writeEntry( "ShowQuickTask", showQuickTask() );
401 /* save templates */ 403 /* save templates */
402 templateManager()->save(); 404 templateManager()->save();
403 e->accept(); 405 e->accept();
404 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) ); 406 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()) );
405 } 407 }
406} 408}
407void MainWindow::populateTemplates() { 409void MainWindow::populateTemplates() {
408 m_template->clear(); 410 m_template->clear();
409 QStringList list = templateManager()->templates(); 411 QStringList list = templateManager()->templates();
410 QStringList::Iterator it; 412 QStringList::Iterator it;
411 for ( it = list.begin(); it != list.end(); ++it ) { 413 for ( it = list.begin(); it != list.end(); ++it ) {
412 m_template->insertItem( (*it) ); 414 m_template->insertItem( (*it) );
413 } 415 }
414} 416}
415/* 417/*
416 * slotNewFromTemplate 418 * slotNewFromTemplate
417 * We use the edit widget to do 419 * We use the edit widget to do
418 * the config but we setUid(1) 420 * the config but we setUid(1)
419 * to get a new uid 421 * to get a new uid
420 */ 422 */
421/* 423/*
422 * first we get the name of the template 424 * first we get the name of the template
423 * then we will use the TemplateManager 425 * then we will use the TemplateManager
424 */ 426 */
425void MainWindow::slotNewFromTemplate( int id ) { 427void MainWindow::slotNewFromTemplate( int id ) {
426 QString name = m_template->text( id ); 428 QString name = m_template->text( id );
427 429
428 OPimTodo event = templateManager()->templateEvent( name ); 430 OPimTodo event = templateManager()->templateEvent( name );
429 event = currentEditor()->edit(this, 431 event = currentEditor()->edit(this,
430 event ); 432 event );
431 433
432 if ( currentEditor()->accepted() ) { 434 if ( currentEditor()->accepted() ) {
433 /* assign new todo */ 435 /* assign new todo */
434 event.setUid( 1 ); 436 event.setUid( 1 );
435 handleAlarms( OPimTodo(), event ); 437 handleAlarms( OPimTodo(), event );
436 m_todoMgr.add( event ); 438 m_todoMgr.add( event );
437 currentView()->addEvent( event ); 439 currentView()->addEvent( event );
438 440
439 populateCategories(); 441 populateCategories();
440 } 442 }
441 raiseCurrentView(); 443 raiseCurrentView();
442} 444}
443void MainWindow::slotNew() { 445void MainWindow::slotNew() {
444 create(); 446 create();
445} 447}
446void MainWindow::slotDuplicate() { 448void MainWindow::slotDuplicate() {
447 if(m_syncing) { 449 if(m_syncing) {
448 QMessageBox::warning(this, QWidget::tr("Todo"), 450 QMessageBox::warning(this, QWidget::tr("Todo"),
449 QWidget::tr("Data can not be edited, currently syncing")); 451 QWidget::tr("Data can not be edited, currently syncing"));
450 return; 452 return;
451 } 453 }
452 OPimTodo ev = m_todoMgr.event( currentView()->current() ); 454 OPimTodo ev = m_todoMgr.event( currentView()->current() );
453 /* let's generate a new uid */ 455 /* let's generate a new uid */
454 ev.setUid(1); 456 ev.setUid(1);
455 m_todoMgr.add( ev ); 457 m_todoMgr.add( ev );
456 458
457 currentView()->addEvent( ev ); 459 currentView()->addEvent( ev );
458 raiseCurrentView(); 460 raiseCurrentView();
459} 461}
460void MainWindow::slotDelete() { 462void MainWindow::slotDelete() {
461 if (!currentView()->current() ) 463 if (!currentView()->current() )
462 return; 464 return;
463 465
464 if(m_syncing) { 466 if(m_syncing) {
465 QMessageBox::warning(this, QWidget::tr("Todo"), 467 QMessageBox::warning(this, QWidget::tr("Todo"),
466 QWidget::tr("Data can not be edited, currently syncing")); 468 QWidget::tr("Data can not be edited, currently syncing"));
467 return; 469 return;
468 } 470 }
469 QString strName = currentView()->currentRepresentation(); 471 QString strName = currentView()->currentRepresentation();
470 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) ) 472 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) )
471 return; 473 return;
472 474
473 handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() ); 475 handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() );
474 m_todoMgr.remove( currentView()->current() ); 476 m_todoMgr.remove( currentView()->current() );
475 currentView()->removeEvent( currentView()->current() ); 477 currentView()->removeEvent( currentView()->current() );
476 raiseCurrentView(); 478 raiseCurrentView();
477} 479}
478void MainWindow::slotDelete(int uid ) { 480void MainWindow::slotDelete(int uid ) {
479 if( uid == 0 ) return; 481 if( uid == 0 ) return;
480 if(m_syncing) { 482 if(m_syncing) {
481 QMessageBox::warning(this, QWidget::tr("Todo"), 483 QMessageBox::warning(this, QWidget::tr("Todo"),
482 QWidget::tr("Data can not be edited, currently syncing")); 484 QWidget::tr("Data can not be edited, currently syncing"));
483 return; 485 return;
484 } 486 }
485 OPimTodo to = m_todoMgr.event(uid); 487 OPimTodo to = m_todoMgr.event(uid);
486 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) ) 488 if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) )
487 return; 489 return;
488 490
489 handleAlarms(to, OPimTodo() ); 491 handleAlarms(to, OPimTodo() );
490 m_todoMgr.remove( to.uid() ); 492 m_todoMgr.remove( to.uid() );
491 currentView()->removeEvent( to.uid() ); 493 currentView()->removeEvent( to.uid() );
492 raiseCurrentView(); 494 raiseCurrentView();
493} 495}
494void MainWindow::slotDeleteAll() { 496void MainWindow::slotDeleteAll() {
495 if(m_syncing) { 497 if(m_syncing) {
496 QMessageBox::warning(this, QWidget::tr("Todo"), 498 QMessageBox::warning(this, QWidget::tr("Todo"),
497 QWidget::tr("Data can not be edited, currently syncing")); 499 QWidget::tr("Data can not be edited, currently syncing"));
498 return; 500 return;
499 } 501 }
500 502
501 503
502 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) ) 504 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all tasks?") ) )
503 return; 505 return;
504 506
505 m_todoMgr.removeAll(); 507 m_todoMgr.removeAll();
506 currentView()->clear(); 508 currentView()->clear();
507 509
508 raiseCurrentView(); 510 raiseCurrentView();
509} 511}
510void MainWindow::slotDeleteCompleted() { 512void MainWindow::slotDeleteCompleted() {
511 if(m_syncing) { 513 if(m_syncing) {
512 QMessageBox::warning(this, QWidget::tr("Todo"), 514 QMessageBox::warning(this, QWidget::tr("Todo"),
513 QWidget::tr("Data can not be edited, currently syncing")); 515 QWidget::tr("Data can not be edited, currently syncing"));
514 return; 516 return;
515 } 517 }
516 518
517 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) ) 519 if ( !QPEMessageBox::confirmDelete( this, QWidget::tr( "Todo" ), QWidget::tr("all completed tasks?") ) )
518 return; 520 return;
519 521
520 522
521 m_todoMgr.removeCompleted(); 523 m_todoMgr.removeCompleted();
522 currentView()->updateView( ); 524 currentView()->updateView( );
523} 525}
524void MainWindow::slotFind() { 526void MainWindow::slotFind() {
525 527
526} 528}
527void MainWindow::slotEdit() { 529void MainWindow::slotEdit() {
528 slotEdit( currentView()->current() ); 530 slotEdit( currentView()->current() );
529} 531}
530/* 532/*
531 * set the category 533 * set the category
532 */ 534 */
533void MainWindow::setCategory( int c) { 535void MainWindow::setCategory( int c) {
534 if ( c <= 0 ) return; 536 if ( c <= 0 ) return;
535 537
536 538
537 qWarning("Iterating over cats %d", c ); 539 qWarning("Iterating over cats %d", c );
538 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 540 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
539 m_catMenu->setItemChecked(i, c == (int)i ); 541 m_catMenu->setItemChecked(i, c == (int)i );
540 542
541 if (c == 1 ) { 543 if (c == 1 ) {
542 m_curCat = QString::null; 544 m_curCat = QString::null;
543 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); 545 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
544 546
545 }else if ( c == (int)m_catMenu->count() - 1 ) { 547 }else if ( c == (int)m_catMenu->count() - 1 ) {
546 m_curCat = QWidget::tr("Unfiled"); 548 m_curCat = QWidget::tr("Unfiled");
547 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") ); 549 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") );
548 }else { 550 }else {
549 m_curCat = m_todoMgr.categories()[c-2]; 551 m_curCat = m_todoMgr.categories()[c-2];
550 setCaption( QWidget::tr("Todo") + " - " + m_curCat ); 552 setCaption( QWidget::tr("Todo") + " - " + m_curCat );
551 } 553 }
552 m_catMenu->setItemChecked( c, true ); 554 m_catMenu->setItemChecked( c, true );
553 555
554 currentView()->setShowCategory( m_curCat ); 556 currentView()->setShowCategory( m_curCat );
555 raiseCurrentView(); 557 raiseCurrentView();
556} 558}
557void MainWindow::slotShowDeadLine( bool dead) { 559void MainWindow::slotShowDeadLine( bool dead) {
558 m_deadline = dead; 560 m_deadline = dead;
559 currentView()->setShowDeadline( dead ); 561 currentView()->setShowDeadline( dead );
560} 562}
561void MainWindow::slotShowCompleted( bool show) { 563void MainWindow::slotShowCompleted( bool show) {
562 m_completed = show; 564 m_completed = show;
563 currentView()->setShowCompleted( m_completed ); 565 currentView()->setShowCompleted( m_completed );
564} 566}
565void MainWindow::slotShowQuickTask( bool show ) { 567void MainWindow::slotShowQuickTask( bool show ) {
566 m_quicktask = show; 568 m_quicktask = show;
567 if ( m_quicktask ) 569 if ( m_quicktask )
568 m_curQuick->widget()->show(); 570 m_curQuick->widget()->show();
569 else 571 else
570 m_curQuick->widget()->hide(); 572 m_curQuick->widget()->hide();
571} 573}
572bool MainWindow::showOverDue()const { 574bool MainWindow::showOverDue()const {
573 return m_overdue; 575 return m_overdue;
574} 576}
575void MainWindow::setDocument( const QString& fi) { 577void MainWindow::setDocument( const QString& fi) {
576 DocLnk doc(fi); 578 DocLnk doc(fi);
577 if (doc.isValid() ) 579 if (doc.isValid() )
578 receiveFile(doc.file() ); 580 receiveFile(doc.file() );
579 else 581 else
580 receiveFile(fi ); 582 receiveFile(fi );
581} 583}
582 584
583static const char *beamfile = "/tmp/opie-todo.vcs"; 585static const char *beamfile = "/tmp/opie-todo.vcs";
584void MainWindow::slotBeam() { 586void MainWindow::slotBeam() {
585 beam( currentView()->current() ); 587 beam( currentView()->current() );
586} 588}
587void MainWindow::beamDone( Ir* ir) { 589void MainWindow::beamDone( Ir* ir) {
588 delete ir; 590 delete ir;
589 ::unlink( beamfile ); 591 ::unlink( beamfile );
590} 592}
591void MainWindow::receiveFile( const QString& filename ) { 593void MainWindow::receiveFile( const QString& filename ) {
592 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename ); 594 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename );
593 595
594 OPimTodoAccess acc( cal ); 596 OPimTodoAccess acc( cal );
595 acc.load(); 597 acc.load();
596 OPimTodoAccess::List list = acc.allRecords(); 598 OPimTodoAccess::List list = acc.allRecords();
597 599
598 if (list.count()){ 600 if (list.count()){
599 601
600 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 602 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
601 603
602 if ( QMessageBox::information(this, QWidget::tr("New Tasks"), 604 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
603 message, QMessageBox::Ok, 605 message, QMessageBox::Ok,
604 QMessageBox::Cancel ) == QMessageBox::Ok ) { 606 QMessageBox::Cancel ) == QMessageBox::Ok ) {
605 OPimTodoAccess::List::Iterator it; 607 OPimTodoAccess::List::Iterator it;
606 for ( it = list.begin(); it != list.end(); ++it ) 608 for ( it = list.begin(); it != list.end(); ++it )
607 m_todoMgr.add( (*it) ); 609 m_todoMgr.add( (*it) );
608 610
609 currentView()->updateView(); 611 currentView()->updateView();
610 } 612 }
611 } 613 }
612} 614}
613 615
614void MainWindow::slotFlush() { 616void MainWindow::slotFlush() {
615 m_syncing = TRUE; 617 m_syncing = TRUE;
616 m_todoMgr.save(); 618 m_todoMgr.save();
617} 619}
618void MainWindow::slotShowDetails() { 620void MainWindow::slotShowDetails() {
619 slotShow( currentView()->current() ); 621 slotShow( currentView()->current() );
620} 622}
621/* 623/*
622 * populate the Categories 624 * populate the Categories
623 * Menu 625 * Menu
624 */ 626 */
625void MainWindow::populateCategories() { 627void MainWindow::populateCategories() {
626 m_todoMgr.load(); 628 m_todoMgr.load();
627 629
628 m_catMenu->clear(); 630 m_catMenu->clear();
629 int id, rememberId; 631 int id, rememberId;
630 id = 1; 632 id = 1;
631 rememberId = 1; 633 rememberId = 1;
632 634
633 m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); 635 m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ );
634 m_catMenu->insertSeparator(); 636 m_catMenu->insertSeparator();
635 QStringList categories = m_todoMgr.categories(); 637 QStringList categories = m_todoMgr.categories();
636 categories.append( QWidget::tr( "Unfiled" ) ); 638 categories.append( QWidget::tr( "Unfiled" ) );
637 for ( QStringList::Iterator it = categories.begin(); 639 for ( QStringList::Iterator it = categories.begin();
638 it != categories.end(); ++it ) { 640 it != categories.end(); ++it ) {
639 m_catMenu->insertItem( *it, id ); 641 m_catMenu->insertItem( *it, id );
640 if ( *it == currentCategory() ) 642 if ( *it == currentCategory() )
641 rememberId = id; 643 rememberId = id;
642 ++id; 644 ++id;
643 } 645 }
644 setCategory( rememberId ); 646 setCategory( rememberId );
645} 647}
646bool MainWindow::showCompleted()const { 648bool MainWindow::showCompleted()const {
647 return m_completed; 649 return m_completed;
648} 650}
649bool MainWindow::showDeadline()const { 651bool MainWindow::showDeadline()const {
650 return m_deadline; 652 return m_deadline;
651} 653}
652bool MainWindow::showQuickTask()const { 654bool MainWindow::showQuickTask()const {
653 return m_quicktask; 655 return m_quicktask;
654} 656}
655QString MainWindow::currentCategory()const { 657QString MainWindow::currentCategory()const {
656 return m_curCat; 658 return m_curCat;
657} 659}
658int MainWindow::currentCatId() { 660int MainWindow::currentCatId() {
659 return m_todoMgr.catId( m_curCat ); 661 return m_todoMgr.catId( m_curCat );
660} 662}
661ViewBase* MainWindow::currentView() { 663ViewBase* MainWindow::currentView() {
662 return m_curView; 664 return m_curView;
663} 665}
664void MainWindow::raiseCurrentView() { 666void MainWindow::raiseCurrentView() {
665 // due QPE/Application/todolist show(int) 667 // due QPE/Application/todolist show(int)
666 // we might not have the populateCategories slot called once 668 // we might not have the populateCategories slot called once
667 // we would show the otodo but then imediately switch to the currentView 669 // we would show the otodo but then imediately switch to the currentView
668 // if we're initially showing we shouldn't raise the table 670 // if we're initially showing we shouldn't raise the table
669 // in returnFromView we fix up m_showing 671 // in returnFromView we fix up m_showing
670 if (m_showing ) return; 672 if (m_showing ) return;
671 673
672 m_stack->raiseWidget( m_curView->widget() ); 674 m_stack->raiseWidget( m_curView->widget() );
673} 675}
674void MainWindow::slotShowDue(bool ov) { 676void MainWindow::slotShowDue(bool ov) {
675 m_overdue = ov; 677 m_overdue = ov;
676 currentView()->showOverDue( ov ); 678 currentView()->showOverDue( ov );
677 raiseCurrentView(); 679 raiseCurrentView();
678} 680}
679void MainWindow::slotShow( int uid ) { 681void MainWindow::slotShow( int uid ) {
680 if ( uid == 0 ) return; 682 if ( uid == 0 ) return;
681 qWarning("slotShow"); 683 qWarning("slotShow");
682 currentShow()->slotShow( event( uid ) ); 684 currentShow()->slotShow( event( uid ) );
683 m_stack->raiseWidget( currentShow()->widget() ); 685 m_stack->raiseWidget( currentShow()->widget() );
684} 686}
685void MainWindow::slotShowNext() { 687void MainWindow::slotShowNext() {
686 int l = currentView()->next(); 688 int l = currentView()->next();
687 if (l!=0) 689 if (l!=0)
688 slotShow(l); 690 slotShow(l);
689} 691}
690void MainWindow::slotShowPrev() { 692void MainWindow::slotShowPrev() {
691 int l = currentView()->prev(); 693 int l = currentView()->prev();
692 if (l!=0) 694 if (l!=0)
693 slotShow(l); 695 slotShow(l);
694} 696}
695void MainWindow::slotEdit( int uid ) { 697void MainWindow::slotEdit( int uid ) {
696 if (uid == 0 ) return; 698 if (uid == 0 ) return;
697 if(m_syncing) { 699 if(m_syncing) {
698 QMessageBox::warning(this, QWidget::tr("Todo"), 700 QMessageBox::warning(this, QWidget::tr("Todo"),
699 QWidget::tr("Data can't be edited, currently syncing")); 701 QWidget::tr("Data can't be edited, currently syncing"));
700 return; 702 return;
701 } 703 }
702 704
703 OPimTodo old_todo = m_todoMgr.event( uid ); 705 OPimTodo old_todo = m_todoMgr.event( uid );
704 706
705 OPimTodo todo = currentEditor()->edit(this, old_todo ); 707 OPimTodo todo = currentEditor()->edit(this, old_todo );
706 708
707 /* if completed */ 709 /* if completed */
708 if ( currentEditor()->accepted() ) { 710 if ( currentEditor()->accepted() ) {
709 handleAlarms( old_todo, todo ); 711 handleAlarms( old_todo, todo );
710 m_todoMgr.update( todo.uid(), todo ); 712 m_todoMgr.update( todo.uid(), todo );
711 currentView()->replaceEvent( todo ); 713 currentView()->replaceEvent( todo );
712 /* a Category might have changed */ 714 /* a Category might have changed */
713 populateCategories(); 715 populateCategories();
714 } 716 }
715 717
716 raiseCurrentView(); 718 raiseCurrentView();
717} 719}
718/* 720/*
719void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) { 721void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
720 m_todoMgr.update( uid, ev ); 722 m_todoMgr.update( uid, ev );
721} 723}
722*/ 724*/
723void MainWindow::updateTodo( const OPimTodo& ev) { 725void MainWindow::updateTodo( const OPimTodo& ev) {
724 m_todoMgr.update( ev.uid() , ev ); 726 m_todoMgr.update( ev.uid() , ev );
725} 727}
726/* The view changed it's configuration 728/* The view changed it's configuration
727 * update the view menu 729 * update the view menu
728 */ 730 */
729void MainWindow::slotUpdate3( QWidget* ) { 731void MainWindow::slotUpdate3( QWidget* ) {
730 732
731} 733}
732void MainWindow::updateList() { 734void MainWindow::updateList() {
733 m_todoMgr.updateList(); 735 m_todoMgr.updateList();
734} 736}
735void MainWindow::setReadAhead( uint count ) { 737void MainWindow::setReadAhead( uint count ) {
736 if (m_todoMgr.todoDB() ) 738 if (m_todoMgr.todoDB() )
737 m_todoMgr.todoDB()->setReadAhead( count ); 739 m_todoMgr.todoDB()->setReadAhead( count );
738} 740}
739void MainWindow::slotQuickEntered() { 741void MainWindow::slotQuickEntered() {
740 qWarning("entered"); 742 qWarning("entered");
741 OPimTodo todo = quickEditor()->todo(); 743 OPimTodo todo = quickEditor()->todo();
742 if (todo.isEmpty() ) 744 if (todo.isEmpty() )
743 return; 745 return;
744 746
745 m_todoMgr.add( todo ); 747 m_todoMgr.add( todo );
746 currentView()->addEvent( todo ); 748 currentView()->addEvent( todo );
747 raiseCurrentView(); 749 raiseCurrentView();
748} 750}
749QuickEditBase* MainWindow::quickEditor() { 751QuickEditBase* MainWindow::quickEditor() {
750 return m_curQuick; 752 return m_curQuick;
751} 753}
752void MainWindow::slotComplete( int uid ) { 754void MainWindow::slotComplete( int uid ) {
753 slotComplete( event(uid) ); 755 slotComplete( event(uid) );
754} 756}
755void MainWindow::slotComplete( const OPimTodo& todo ) { 757void MainWindow::slotComplete( const OPimTodo& todo ) {
756 OPimTodo to = todo; 758 OPimTodo to = todo;
757 to.setCompleted( !to.isCompleted() ); 759 to.setCompleted( !to.isCompleted() );
758 to.setCompletedDate( QDate::currentDate() ); 760 to.setCompletedDate( QDate::currentDate() );
759 761
760 /* 762 /*
761 * if the item does recur 763 * if the item does recur
762 * we need to spin it off 764 * we need to spin it off
763 * and update the items duedate to the next 765 * and update the items duedate to the next
764 * possible recurrance of this item... 766 * possible recurrance of this item...
765 * the spinned off one will loose the 767 * the spinned off one will loose the
766 * recurrence. 768 * recurrence.
767 * We calculate the difference between the old due date and the 769 * We calculate the difference between the old due date and the
768 * new one and add this diff to start, completed and alarm dates 770 * new one and add this diff to start, completed and alarm dates
769 * -zecke 771 * -zecke
770 */ 772 */
771 if ( to.hasRecurrence() && to.isCompleted() ) { 773 if ( to.hasRecurrence() && to.isCompleted() ) {
772 OPimTodo to2( to ); 774 OPimTodo to2( to );
773 775
774 /* the spinned off one won't recur anymore */ 776 /* the spinned off one won't recur anymore */
775 to.setRecurrence( OPimRecurrence() ); 777 to.setRecurrence( OPimRecurrence() );
776 778
777 OPimRecurrence rec = to2.recurrence(); 779 OPimRecurrence rec = to2.recurrence();
778 rec.setStart( to.dueDate() ); 780 rec.setStart( to.dueDate() );
779 to2.setRecurrence( rec ); 781 to2.setRecurrence( rec );
780 /* 782 /*
781 * if there is a next occurence 783 * if there is a next occurence
782 * from the duedate of the last recurrance 784 * from the duedate of the last recurrance
783 */ 785 */
784 QDate date; 786 QDate date;
785 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 787 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
786 int dayDiff = to.dueDate().daysTo( date ); 788 int dayDiff = to.dueDate().daysTo( date );
787 qWarning("day diff is %d", dayDiff ); 789 qWarning("day diff is %d", dayDiff );
788 QDate inval; 790 QDate inval;
789 /* generate a new uid for the old record */ 791 /* generate a new uid for the old record */
790 to.setUid( 1 ); 792 to.setUid( 1 );
791 793
792 /* add the old one cause it has a new UID here cause it was spin off */ 794 /* add the old one cause it has a new UID here cause it was spin off */
793 m_todoMgr.add( to ); 795 m_todoMgr.add( to );
794 796
795 /* 797 /*
796 * update the due date 798 * update the due date
797 * start date 799 * start date
798 * and complete date 800 * and complete date
799 */ 801 */
800 to2.setDueDate( date ); 802 to2.setDueDate( date );
801 rec.setStart( date ); 803 rec.setStart( date );
802 to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week 804 to2.setRecurrence( rec ); // could be Monday, TuesDay, Thursday every week
803 805
804 /* move start date */ 806 /* move start date */
805 if (to2.hasStartDate() ) 807 if (to2.hasStartDate() )
806 to2.setStartDate( to2.startDate().addDays( dayDiff ) ); 808 to2.setStartDate( to2.startDate().addDays( dayDiff ) );
807 809
808 /* now the alarms */ 810 /* now the alarms */
809 if (to2.hasNotifiers() ) { 811 if (to2.hasNotifiers() ) {
810 OPimNotifyManager::Alarms _als = to2.notifiers().alarms(); 812 OPimNotifyManager::Alarms _als = to2.notifiers().alarms();
811 OPimNotifyManager::Alarms als; 813 OPimNotifyManager::Alarms als;
812 814
813 /* for every alarm move the day */ 815 /* for every alarm move the day */
814 for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) { 816 for ( OPimNotifyManager::Alarms::Iterator it = _als.begin(); it != _als.end(); ++it ) {
815 OPimAlarm al = (*it); 817 OPimAlarm al = (*it);
816 al.setDateTime( al.dateTime().addDays( dayDiff ) ); 818 al.setDateTime( al.dateTime().addDays( dayDiff ) );
817 als.append( al ); 819 als.append( al );
818 } 820 }
819 to2.notifiers().setAlarms( als ); 821 to2.notifiers().setAlarms( als );
820 handleAlarms( OPimTodo(), todo ); 822 handleAlarms( OPimTodo(), todo );
821 } 823 }
822 to2.setCompletedDate( inval ); 824 to2.setCompletedDate( inval );
823 to2.setCompleted( false ); 825 to2.setCompleted( false );
824 826
825 updateTodo( to2 ); 827 updateTodo( to2 );
826 }else 828 }else
827 updateTodo( to ); 829 updateTodo( to );
828 }else 830 }else
829 updateTodo( to ); 831 updateTodo( to );
830 832
831 currentView()->updateView(); 833 currentView()->updateView();
832 raiseCurrentView(); 834 raiseCurrentView();
833} 835}
834void MainWindow::flush() { 836void MainWindow::flush() {
835 slotFlush(); 837 slotFlush();
836} 838}
837void MainWindow::reload() { 839void MainWindow::reload() {
838 slotReload(); 840 slotReload();
839} 841}
840int MainWindow::create() { 842int MainWindow::create() {
841 int uid = 0; 843 int uid = 0;
842 if(m_syncing) { 844 if(m_syncing) {
843 QMessageBox::warning(this, QWidget::tr("Todo"), 845 QMessageBox::warning(this, QWidget::tr("Todo"),
844 QWidget::tr("Data can not be edited, currently syncing")); 846 QWidget::tr("Data can not be edited, currently syncing"));
845 return uid; 847 return uid;
846 } 848 }
847 m_todoMgr.load(); 849 m_todoMgr.load();
848 850
849 851
850 OPimTodo todo = currentEditor()->newTodo( currentCatId(), 852 OPimTodo todo = currentEditor()->newTodo( currentCatId(),
851 this ); 853 this );
852 854
853 if ( currentEditor()->accepted() ) { 855 if ( currentEditor()->accepted() ) {
854 //todo.assignUid(); 856 //todo.assignUid();
855 uid = todo.uid(); 857 uid = todo.uid();
856 handleAlarms( OPimTodo(), todo ); 858 handleAlarms( OPimTodo(), todo );
857 m_todoMgr.add( todo ); 859 m_todoMgr.add( todo );
858 currentView()->addEvent( todo ); 860 currentView()->addEvent( todo );
859 861
860 862
861 // I'm afraid we must call this every time now, otherwise 863 // I'm afraid we must call this every time now, otherwise
862 // spend expensive time comparing all these strings... 864 // spend expensive time comparing all these strings...
863 // but only call if we changed something -zecke 865 // but only call if we changed something -zecke
864 populateCategories(); 866 populateCategories();
865 } 867 }
866 raiseCurrentView( ); 868 raiseCurrentView( );
867 869
868 return uid; 870 return uid;
869} 871}
870/* delete it silently... */ 872/* delete it silently... */
871bool MainWindow::remove( int uid ) { 873bool MainWindow::remove( int uid ) {
872 if (m_syncing) return false; 874 if (m_syncing) return false;
873 875
874 /* argh need to get the whole OEvent... to disable alarms -zecke */ 876 /* argh need to get the whole OEvent... to disable alarms -zecke */
875 handleAlarms( OPimTodo(), m_todoMgr.event( uid ) ); 877 handleAlarms( OPimTodo(), m_todoMgr.event( uid ) );
876 878
877 return m_todoMgr.remove( uid ); 879 return m_todoMgr.remove( uid );
878} 880}
879void MainWindow::beam( int uid) { 881void MainWindow::beam( int uid) {
880 if( uid == 0 ) return; 882 if( uid == 0 ) return;
881 883
882 ::unlink( beamfile ); 884 ::unlink( beamfile );
883 m_todoMgr.load(); 885 m_todoMgr.load();
884 886
885 OPimTodo todo = event( uid ); 887 OPimTodo todo = event( uid );
886 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); 888 OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) );
887 OPimTodoAccess acc( cal ); 889 OPimTodoAccess acc( cal );
888 acc.load(); 890 acc.load();
889 acc.add( todo ); 891 acc.add( todo );
890 acc.save(); 892 acc.save();
891 Ir* ir = new Ir(this ); 893 Ir* ir = new Ir(this );
892 connect(ir, SIGNAL(done(Ir*) ), 894 connect(ir, SIGNAL(done(Ir*) ),
893 this, SLOT(beamDone(Ir*) ) ); 895 this, SLOT(beamDone(Ir*) ) );
894 ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); 896 ir->send(beamfile, todo.summary(), "text/x-vCalendar" );
895} 897}
896void MainWindow::show( int uid ) { 898void MainWindow::show( int uid ) {
897 m_todoMgr.load(); // might not be loaded yet 899 m_todoMgr.load(); // might not be loaded yet
898 m_showing = true; 900 m_showing = true;
899 slotShow( uid ); 901 slotShow( uid );
900 raise(); 902 raise();
901 QPEApplication::setKeepRunning(); 903 QPEApplication::setKeepRunning();
902} 904}
903void MainWindow::edit( int uid ) { 905void MainWindow::edit( int uid ) {
904 m_todoMgr.load(); 906 m_todoMgr.load();
905 slotEdit( uid ); 907 slotEdit( uid );
906} 908}
907void MainWindow::add( const OPimRecord& rec) { 909void MainWindow::add( const OPimRecord& rec) {
908 if ( rec.rtti() != OPimTodo::rtti() ) return; 910 if ( rec.rtti() != OPimTodo::rtti() ) return;
909 m_todoMgr.load(); // might not be loaded 911 m_todoMgr.load(); // might not be loaded
910 912
911 const OPimTodo& todo = static_cast<const OPimTodo&>(rec); 913 const OPimTodo& todo = static_cast<const OPimTodo&>(rec);
912 914
913 m_todoMgr.add(todo ); 915 m_todoMgr.add(todo );
914 currentView()->addEvent( todo ); 916 currentView()->addEvent( todo );
915 917
916 918
917 // I'm afraid we must call this every time now, otherwise 919 // I'm afraid we must call this every time now, otherwise
918 // spend expensive time comparing all these strings... 920 // spend expensive time comparing all these strings...
919 // but only call if we changed something -zecke 921 // but only call if we changed something -zecke
920 populateCategories(); 922 populateCategories();
921} 923}
922void MainWindow::slotReturnFromView() { 924void MainWindow::slotReturnFromView() {
923 m_showing = false; 925 m_showing = false;
924 raiseCurrentView(); 926 raiseCurrentView();
925} 927}
926 928
927namespace { 929namespace {
928 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, 930 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls,
929 const OPimNotifyManager::Alarms& newAls ) { 931 const OPimNotifyManager::Alarms& newAls ) {
930 OPimNotifyManager::Alarms nonMatching; 932 OPimNotifyManager::Alarms nonMatching;
931 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); 933 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin();
932 OPimNotifyManager::Alarms::ConstIterator newIt; 934 OPimNotifyManager::Alarms::ConstIterator newIt;
933 for ( ; oldIt != oldAls.end(); ++oldIt ) { 935 for ( ; oldIt != oldAls.end(); ++oldIt ) {
934 bool found = false; 936 bool found = false;
935 QDateTime oldDt = (*oldIt).dateTime(); 937 QDateTime oldDt = (*oldIt).dateTime();
936 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { 938 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) {
937 if ( oldDt == (*newIt).dateTime() ) { 939 if ( oldDt == (*newIt).dateTime() ) {
938 found = true; 940 found = true;
939 break; 941 break;
940 } 942 }
941 } 943 }
942 if (!found) 944 if (!found)
943 nonMatching.append( (*oldIt) ); 945 nonMatching.append( (*oldIt) );
944 } 946 }
945 return nonMatching; 947 return nonMatching;
946 } 948 }
947 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 949 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
948 OPimNotifyManager::Alarms::ConstIterator it; 950 OPimNotifyManager::Alarms::ConstIterator it;
949 for ( it = als.begin(); it != als.end(); ++it ) { 951 for ( it = als.begin(); it != als.end(); ++it ) {
950 qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() ); 952 qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() );
951 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 953 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
952 } 954 }
953 955
954 } 956 }
955 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 957 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
956 OPimNotifyManager::Alarms::ConstIterator it; 958 OPimNotifyManager::Alarms::ConstIterator it;
957 for ( it = als.begin(); it != als.end(); ++it ) { 959 for ( it = als.begin(); it != als.end(); ++it ) {
958 qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() ); 960 qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() );
959 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 961 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
960 } 962 }
961 } 963 }
962} 964}
963 965
964void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { 966void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {
965 /* 967 /*
966 * if oldTodo is not empty and has notifiers we need to find the deleted ones 968 * if oldTodo is not empty and has notifiers we need to find the deleted ones
967 */ 969 */
968 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) { 970 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
969 OPimNotifyManager::Alarms removed; 971 OPimNotifyManager::Alarms removed;
970 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms(); 972 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();
971 if (!newTodo.hasNotifiers() ) 973 if (!newTodo.hasNotifiers() )
972 removed = oldAls; 974 removed = oldAls;
973 else 975 else
974 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() ); 976 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() );
975 977
976 removeAlarms( removed, oldTodo.uid() ); 978 removeAlarms( removed, oldTodo.uid() );
977 } 979 }
978 if ( newTodo.hasNotifiers() ) { 980 if ( newTodo.hasNotifiers() ) {
979 OPimNotifyManager::Alarms added; 981 OPimNotifyManager::Alarms added;
980 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() ) 982 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() )
981 added = newTodo.notifiers().alarms(); 983 added = newTodo.notifiers().alarms();
982 else 984 else
983 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() ); 985 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() );
984 986
985 addAlarms( added, newTodo.uid() ); 987 addAlarms( added, newTodo.uid() );
986 } 988 }
987} 989}
988/* we might have not loaded the db */ 990/* we might have not loaded the db */
989void MainWindow::doAlarm( const QDateTime& dt, int uid ) { 991void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
990 m_todoMgr.load(); 992 m_todoMgr.load();
991 993
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index b35a42b..f0d6a42 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -1,211 +1,211 @@
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>
35#include <opie2/opimtodo.h> 35#include <opie2/opimtodo.h>
36#include <opie2/opimmainwindow.h> 36#include <opie2/opimmainwindow.h>
37#include <opie2/owidgetstack.h> 37#include <opie2/owidgetstack.h>
38 38
39#include "smalltodo.h" 39#include "smalltodo.h"
40#include "todoview.h" 40#include "todoview.h"
41#include "quickedit.h" 41#include "quickedit.h"
42#include "todomanager.h" 42#include "todomanager.h"
43 43
44class QPopupMenu; 44class 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; 57 class TemplateEditor;
58 struct QuickEditBase; 58 struct QuickEditBase;
59 59
60 class MainWindow : public Opie::OPimMainWindow { 60 class MainWindow : public Opie::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 friend class TodoShow; // avoid QObject
64 public: 64 public:
65 /* OApplicationFactory application Name */ 65 /* Opie::Core::OApplicationFactory application Name */
66 static QString appName() { return QString::fromLatin1("todolist"); } 66 static QString appName() { return QString::fromLatin1("todolist"); }
67 67
68 MainWindow( QWidget *parent = 0, 68 MainWindow( QWidget *parent = 0,
69 const char* name = 0, WFlags fl = 0 ); 69 const char* name = 0, WFlags fl = 0 );
70 ~MainWindow(); 70 ~MainWindow();
71 71
72 /** return a context menu for an OPimTodo */ 72 /** return a context menu for an OPimTodo */
73 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); 73 QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
74 QPopupMenu* options(); 74 QPopupMenu* options();
75 QPopupMenu* edit(); 75 QPopupMenu* edit();
76 QToolBar* toolbar(); 76 QToolBar* toolbar();
77 77
78 78
79 void updateList(); 79 void updateList();
80 OPimTodoAccess::List list()const; 80 OPimTodoAccess::List list()const;
81 OPimTodoAccess::List sorted( bool asc, int sortOrder ); 81 OPimTodoAccess::List sorted( bool asc, int sortOrder );
82 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); 82 OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
83 83
84 OPimTodo event(int uid ); 84 OPimTodo event(int uid );
85 85
86 bool isSyncing()const; 86 bool isSyncing()const;
87 bool showCompleted()const; 87 bool showCompleted()const;
88 bool showDeadline()const; 88 bool showDeadline()const;
89 bool showOverDue()const; 89 bool showOverDue()const;
90 bool showQuickTask()const; 90 bool showQuickTask()const;
91 QString currentCategory()const; 91 QString currentCategory()const;
92 int currentCatId(); 92 int currentCatId();
93 TemplateManager* templateManager(); 93 TemplateManager* templateManager();
94 QuickEditBase* quickEditor(); 94 QuickEditBase* quickEditor();
95 95
96 void updateTodo( const OPimTodo& ); 96 void updateTodo( const OPimTodo& );
97 void populateTemplates(); 97 void populateTemplates();
98 Editor* currentEditor(); 98 Editor* currentEditor();
99 void setReadAhead(uint count ); 99 void setReadAhead(uint count );
100private slots: 100private slots:
101 void slotQuickEntered(); 101 void slotQuickEntered();
102 void populateCategories(); 102 void populateCategories();
103 void slotReload(); 103 void slotReload();
104 void slotFlush(); 104 void slotFlush();
105 105
106 protected: 106 protected:
107 void closeEvent( QCloseEvent* e ); 107 void closeEvent( QCloseEvent* e );
108 108
109 private: 109 private:
110 /* handle setting and removing alarms */ 110 /* handle setting and removing alarms */
111 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); 111 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
112 void receiveFile( const QString& filename ); 112 void receiveFile( const QString& filename );
113 void connectBase( ViewBase* ); 113 void connectBase( ViewBase* );
114 void initUI(); 114 void initUI();
115 void initActions(); 115 void initActions();
116 void initConfig(); 116 void initConfig();
117 void initViews(); 117 void initViews();
118 void initEditor(); 118 void initEditor();
119 void initShow(); 119 void initShow();
120 void initTemplate(); 120 void initTemplate();
121 void raiseCurrentView(); 121 void raiseCurrentView();
122 ViewBase* currentView(); 122 ViewBase* currentView();
123 ViewBase* m_curView; 123 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 124 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; 125 QuickEditBase* m_curQuick;
126 Editor* m_curEdit; 126 Editor* m_curEdit;
127 TodoShow* currentShow(); 127 TodoShow* currentShow();
128 TodoShow* m_curShow; 128 TodoShow* m_curShow;
129 TemplateEditor* currentTemplateEditor(); 129 TemplateEditor* currentTemplateEditor();
130 TemplateEditor* m_curTempEd; 130 TemplateEditor* m_curTempEd;
131 131
132 QMenuBar* m_bar; 132 QMenuBar* m_bar;
133 QToolBar* m_tool; 133 QToolBar* m_tool;
134 QAction* m_editAction, 134 QAction* m_editAction,
135 *m_deleteAction, 135 *m_deleteAction,
136 *m_findAction, 136 *m_findAction,
137 *m_completedAction, 137 *m_completedAction,
138 *m_showDeadLineAction, 138 *m_showDeadLineAction,
139 *m_deleteAllAction, 139 *m_deleteAllAction,
140 *m_deleteCompleteAction, 140 *m_deleteCompleteAction,
141 *m_duplicateAction, 141 *m_duplicateAction,
142 *m_showOverDueAction, 142 *m_showOverDueAction,
143 *m_showQuickTaskAction, 143 *m_showQuickTaskAction,
144 *m_effectiveAction; 144 *m_effectiveAction;
145 Opie::OWidgetStack *m_stack; 145 Opie::Ui::OWidgetStack *m_stack;
146 QPopupMenu* m_catMenu, 146 QPopupMenu* m_catMenu,
147 *m_edit, 147 *m_edit,
148 *m_options, 148 *m_options,
149 *m_template; 149 *m_template;
150 150
151 bool m_syncing:1; 151 bool m_syncing:1;
152 bool m_deadline:1; 152 bool m_deadline:1;
153 bool m_completed:1; 153 bool m_completed:1;
154 bool m_overdue:1; 154 bool m_overdue:1;
155 bool m_quicktask:1; 155 bool m_quicktask:1;
156 TodoManager m_todoMgr; 156 TodoManager m_todoMgr;
157 QString m_curCat; 157 QString m_curCat;
158 QList<ViewBase> m_views; 158 QList<ViewBase> m_views;
159 uint m_counter; 159 uint m_counter;
160 TemplateManager* m_tempManager; 160 TemplateManager* m_tempManager;
161 161
162 162
163 private slots: 163 private slots:
164 void slotShow(int); 164 void slotShow(int);
165 void slotEdit(int); 165 void slotEdit(int);
166 void slotUpdate3( QWidget* ); 166 void slotUpdate3( QWidget* );
167 void slotComplete( int uid ); 167 void slotComplete( int uid );
168 void slotComplete( const OPimTodo& ev ); 168 void slotComplete( const OPimTodo& ev );
169 void slotNewFromTemplate(int id ); 169 void slotNewFromTemplate(int id );
170 void slotNew(); 170 void slotNew();
171 void slotDuplicate(); 171 void slotDuplicate();
172 172
173 void slotDelete(); 173 void slotDelete();
174 void slotDelete(int uid ); 174 void slotDelete(int uid );
175 void slotDeleteAll(); 175 void slotDeleteAll();
176 void slotDeleteCompleted(); 176 void slotDeleteCompleted();
177 177
178 void slotEdit(); 178 void slotEdit();
179 void slotFind(); 179 void slotFind();
180 180
181 void setCategory( int ); 181 void setCategory( int );
182 182
183 void slotShowDeadLine( bool ); 183 void slotShowDeadLine( bool );
184 void slotShowCompleted( bool ); 184 void slotShowCompleted( bool );
185 void slotShowQuickTask( bool ); 185 void slotShowQuickTask( bool );
186 186
187 void setDocument( const QString& ); 187 void setDocument( const QString& );
188 188
189 189
190 void slotBeam(); 190 void slotBeam();
191 void beamDone( Ir* ); 191 void beamDone( Ir* );
192 void slotShowDetails(); 192 void slotShowDetails();
193 void slotShowNext(); 193 void slotShowNext();
194 void slotShowPrev(); 194 void slotShowPrev();
195 void slotShowDue( bool ); 195 void slotShowDue( bool );
196 void slotReturnFromView(); // for TodoShow... 196 void slotReturnFromView(); // for TodoShow...
197 /* reimplementation from opimmainwindow */ 197 /* reimplementation from opimmainwindow */
198 protected slots: 198 protected slots:
199 void flush(); 199 void flush();
200 void reload(); 200 void reload();
201 int create(); 201 int create();
202 bool remove( int uid ); 202 bool remove( int uid );
203 void beam(int uid); 203 void beam(int uid);
204 void show( int uid ); 204 void show( int uid );
205 void edit( int uid ); 205 void edit( int uid );
206 void add( const Opie::OPimRecord& ); 206 void add( const Opie::OPimRecord& );
207 void doAlarm( const QDateTime& dt, int uid ); 207 void doAlarm( const QDateTime& dt, int uid );
208 }; 208 };
209} 209}
210 210
211#endif 211#endif
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index d1e50f7..f0128bc 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -1,90 +1,91 @@
1#include <qlayout.h> 1#include <qlayout.h>
2 2
3#include "taskeditoroverview.h" 3#include "taskeditoroverview.h"
4#include "taskeditorstatus.h" 4#include "taskeditorstatus.h"
5#include "taskeditoralarms.h" 5#include "taskeditoralarms.h"
6 6
7#include "otaskeditor.h" 7#include "otaskeditor.h"
8 8
9using namespace Opie::Ui;
9OTaskEditor::OTaskEditor(int cur) 10OTaskEditor::OTaskEditor(int cur)
10 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 11 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
11 init(); 12 init();
12 init( cur ); 13 init( cur );
13} 14}
14OTaskEditor::OTaskEditor( const OPimTodo& to) 15OTaskEditor::OTaskEditor( const OPimTodo& to)
15 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { 16 : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) {
16 init(); 17 init();
17 init( to ); 18 init( to );
18} 19}
19OTaskEditor::~OTaskEditor() { 20OTaskEditor::~OTaskEditor() {
20 21
21} 22}
22void OTaskEditor::init( int cur ) { 23void OTaskEditor::init( int cur ) {
23 OPimTodo to; 24 OPimTodo to;
24 to.setUid( 1 ); // generate a new uid 25 to.setUid( 1 ); // generate a new uid
25 if ( cur != 0 ) 26 if ( cur != 0 )
26 to.setCategories( cur ); 27 to.setCategories( cur );
27 load(to); 28 load(to);
28} 29}
29void OTaskEditor::init( const OPimTodo& to ) { 30void OTaskEditor::init( const OPimTodo& to ) {
30 load( to ); 31 load( to );
31} 32}
32OPimTodo OTaskEditor::todo()const{ 33OPimTodo OTaskEditor::todo()const{
33 qWarning("saving!"); 34 qWarning("saving!");
34 OPimTodo to ( m_todo ); 35 OPimTodo to ( m_todo );
35 m_overView->save( to ); 36 m_overView->save( to );
36 m_stat->save( to ); 37 m_stat->save( to );
37 to.setRecurrence( m_rec->recurrence() ); 38 to.setRecurrence( m_rec->recurrence() );
38 m_alarm->save( to ); 39 m_alarm->save( to );
39 40
40 return to; 41 return to;
41} 42}
42void OTaskEditor::load(const OPimTodo& to) { 43void OTaskEditor::load(const OPimTodo& to) {
43 m_overView->load( to ); 44 m_overView->load( to );
44 m_stat->load( to ); 45 m_stat->load( to );
45 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 46 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
46 m_alarm->load( to ); 47 m_alarm->load( to );
47 48
48 m_todo = to; 49 m_todo = to;
49} 50}
50void OTaskEditor::init() { 51void OTaskEditor::init() {
51 setCaption(tr("Task Editor") ); 52 setCaption(tr("Task Editor") );
52 53
53 QVBoxLayout* layo = new QVBoxLayout( this ); 54 QVBoxLayout* layo = new QVBoxLayout( this );
54 m_tab = new OTabWidget( this ); 55 m_tab = new OTabWidget( this );
55 layo->addWidget( m_tab ); 56 layo->addWidget( m_tab );
56 57
57 /* 58 /*
58 * Add the Widgets 59 * Add the Widgets
59 */ 60 */
60 m_overView = new TaskEditorOverView( m_tab ); 61 m_overView = new TaskEditorOverView( m_tab );
61 m_tab->addTab( m_overView, "todo/info", tr("Information") ); 62 m_tab->addTab( m_overView, "todo/info", tr("Information") );
62 63
63 m_stat = new TaskEditorStatus( m_tab ); 64 m_stat = new TaskEditorStatus( m_tab );
64 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); 65 m_tab->addTab( m_stat, "todo/TodoList", tr("Status") );
65 66
66 m_alarm = new TaskEditorAlarms( m_tab ); 67 m_alarm = new TaskEditorAlarms( m_tab );
67 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); 68 m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") );
68 69
69// m_remind = new TaskEditorAlarms( m_tab ); 70// m_remind = new TaskEditorAlarms( m_tab );
70// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); 71// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
71 72
72// QLabel* lbl = new QLabel( m_tab ); 73// QLabel* lbl = new QLabel( m_tab );
73// lbl->setText( tr("X-Ref") ); 74// lbl->setText( tr("X-Ref") );
74// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); 75// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
75 76
76 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); 77 m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this );
77 m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); 78 m_tab->addTab( m_rec, "repeat", tr("Recurrence") );
78 79
79 80
80 /* signal and slots */ 81 /* signal and slots */
81 connect(m_overView, SIGNAL(recurranceEnabled(bool) ), 82 connect(m_overView, SIGNAL(recurranceEnabled(bool) ),
82 m_rec, SLOT(setEnabled(bool) ) ); 83 m_rec, SLOT(setEnabled(bool) ) );
83 84
84 /* connect due date changed to the recurrence tab */ 85 /* connect due date changed to the recurrence tab */
85 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), 86 connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ),
86 m_rec, SLOT(setStartDate(const QDate&) ) ); 87 m_rec, SLOT(setStartDate(const QDate&) ) );
87 88
88 89
89 m_tab->setCurrentTab( m_overView ); 90 m_tab->setCurrentTab( m_overView );
90} 91}
diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h
index 7068df8..4a00018 100644
--- a/core/pim/todo/otaskeditor.h
+++ b/core/pim/todo/otaskeditor.h
@@ -1,43 +1,43 @@
1#ifndef OPIE_TASK_EDITOR_H 1#ifndef OPIE_TASK_EDITOR_H
2#define OPIE_TASK_EDITOR_H 2#define OPIE_TASK_EDITOR_H
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5 5
6#include <opie2/opimtodo.h> 6#include <opie2/opimtodo.h>
7#include <opie2/otabwidget.h> 7#include <opie2/otabwidget.h>
8#include <opie2/opimrecurrencewidget.h> 8#include <opie2/opimrecurrencewidget.h>
9 9
10class TaskEditorOverView; 10class TaskEditorOverView;
11class TaskEditorStatus; 11class TaskEditorStatus;
12class TaskEditorAlarms; 12class TaskEditorAlarms;
13class QMultiLineEdit; 13class QMultiLineEdit;
14 14
15class OTaskEditor : public QDialog { 15class OTaskEditor : public QDialog {
16 Q_OBJECT 16 Q_OBJECT
17public: 17public:
18 OTaskEditor(int cur); 18 OTaskEditor(int cur);
19 OTaskEditor( const OPimTodo& todo ); 19 OTaskEditor( const OPimTodo& todo );
20 ~OTaskEditor(); 20 ~OTaskEditor();
21 21
22 /* 22 /*
23 * same as the c'tor but this gives us the 23 * same as the c'tor but this gives us the
24 * power to 'preload' the dialog 24 * power to 'preload' the dialog
25 */ 25 */
26 void init( int cur ); 26 void init( int cur );
27 void init( const OPimTodo& todo ); 27 void init( const OPimTodo& todo );
28 28
29 OPimTodo todo()const; 29 OPimTodo todo()const;
30private: 30private:
31 void load( const OPimTodo& ); 31 void load( const OPimTodo& );
32 void init(); 32 void init();
33 33
34 OTabWidget *m_tab; 34 Opie::Ui::OTabWidget *m_tab;
35 TaskEditorOverView *m_overView; 35 TaskEditorOverView *m_overView;
36 TaskEditorStatus *m_stat; 36 TaskEditorStatus *m_stat;
37 TaskEditorAlarms *m_alarm; 37 TaskEditorAlarms *m_alarm;
38 TaskEditorAlarms *m_remind; 38 TaskEditorAlarms *m_remind;
39 OPimRecurrenceWidget *m_rec; 39 OPimRecurrenceWidget *m_rec;
40 OPimTodo m_todo; 40 OPimTodo m_todo;
41}; 41};
42 42
43#endif 43#endif
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 94ae97e..90ad19e 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,116 +1,117 @@
1#include <qaction.h> 1#include <qaction.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qwhatsthis.h> 3#include <qwhatsthis.h>
4 4
5#include <qpe/resource.h> 5#include <qpe/resource.h>
6 6
7#include <opie2/oclickablelabel.h> 7#include <opie2/oclickablelabel.h>
8 8
9#include "mainwindow.h" 9#include "mainwindow.h"
10#include "quickeditimpl.h" 10#include "quickeditimpl.h"
11 11
12 12
13
13QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) 14QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
14 : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { 15 : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
15 setHorizontalStretchable( TRUE ); 16 setHorizontalStretchable( TRUE );
16 17
17 // Load priority icons 18 // Load priority icons
18 // TODO - probably should be done globally somewhere else, 19 // TODO - probably should be done globally somewhere else,
19 // see also tableview.cpp/h, taskeditoroverview.cpp/h 20 // see also tableview.cpp/h, taskeditoroverview.cpp/h
20 priority1 = Resource::loadPixmap( "todo/priority1" ); 21 priority1 = Resource::loadPixmap( "todo/priority1" );
21 priority3 = Resource::loadPixmap( "todo/priority3" ); 22 priority3 = Resource::loadPixmap( "todo/priority3" );
22 priority5 = Resource::loadPixmap( "todo/priority5" ); 23 priority5 = Resource::loadPixmap( "todo/priority5" );
23 24
24 m_lbl = new Opie::OClickableLabel( this ); 25 m_lbl = new Opie::Ui::OClickableLabel( this );
25 m_lbl->setMinimumWidth( 15 ); 26 m_lbl->setMinimumWidth( 15 );
26 m_lbl->setPixmap( priority3 ); 27 m_lbl->setPixmap( priority3 );
27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 28 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
28 QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 29 QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
29 30
30 m_edit = new QLineEdit( this ); 31 m_edit = new QLineEdit( this );
31 setStretchableWidget( m_edit ); 32 setStretchableWidget( m_edit );
32 QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 33 QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
33 34
34 /* 35 /*
35 * it's not implemented and won't be implemented for 1.0 36 * it's not implemented and won't be implemented for 1.0
36 */ 37 */
37#if 0 38#if 0
38 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 39 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
39 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 40 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
40 a->addTo( this ); 41 a->addTo( this );
41 a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 42 a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
42#endif 43#endif
43 44
44 QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 45 QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
45 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 46 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
46 a->addTo( this ); 47 a->addTo( this );
47 a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 48 a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
48 49
49 a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 50 a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
50 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 51 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
51 a->addTo( this ); 52 a->addTo( this );
52 a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 53 a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
53 54
54 m_visible = visible; 55 m_visible = visible;
55 if ( !m_visible ) { 56 if ( !m_visible ) {
56 hide(); 57 hide();
57 } 58 }
58 59
59 m_menu = 0l; 60 m_menu = 0l;
60 reinit(); 61 reinit();
61} 62}
62QuickEditImpl::~QuickEditImpl() { 63QuickEditImpl::~QuickEditImpl() {
63 64
64} 65}
65OPimTodo QuickEditImpl::todo()const { 66OPimTodo QuickEditImpl::todo()const {
66 return m_todo; 67 return m_todo;
67} 68}
68QWidget* QuickEditImpl::widget() { 69QWidget* QuickEditImpl::widget() {
69 return this; 70 return this;
70} 71}
71void QuickEditImpl::slotEnter() { 72void QuickEditImpl::slotEnter() {
72 OPimTodo todo; 73 OPimTodo todo;
73 74
74 75
75 if (!m_edit->text().isEmpty() ) { 76 if (!m_edit->text().isEmpty() ) {
76 todo.setUid(1 ); // new uid 77 todo.setUid(1 ); // new uid
77 todo.setPriority( m_state ); 78 todo.setPriority( m_state );
78 todo.setSummary( m_edit->text() ); 79 todo.setSummary( m_edit->text() );
79 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) 80 if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
80 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); 81 todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
81 82
82 m_todo = todo; 83 m_todo = todo;
83 commit(); 84 commit();
84 } 85 }
85 m_todo = todo; 86 m_todo = todo;
86 reinit(); 87 reinit();
87} 88}
88void QuickEditImpl::slotPrio() { 89void QuickEditImpl::slotPrio() {
89 m_state -= 2; 90 m_state -= 2;
90 if ( m_state < 1 ) 91 if ( m_state < 1 )
91 m_state = 5; 92 m_state = 5;
92 93
93 switch( m_state ) { 94 switch( m_state ) {
94 case 1: 95 case 1:
95 m_lbl->setPixmap( priority1 ); 96 m_lbl->setPixmap( priority1 );
96 break; 97 break;
97 case 5: 98 case 5:
98 m_lbl->setPixmap( priority5 ); 99 m_lbl->setPixmap( priority5 );
99 break; 100 break;
100 case 3: 101 case 3:
101 default: 102 default:
102 m_lbl->setPixmap( priority3 ); 103 m_lbl->setPixmap( priority3 );
103 break; 104 break;
104 } 105 }
105} 106}
106void QuickEditImpl::slotMore() { 107void QuickEditImpl::slotMore() {
107 // TODO - implement 108 // TODO - implement
108} 109}
109void QuickEditImpl::slotCancel() { 110void QuickEditImpl::slotCancel() {
110 reinit(); 111 reinit();
111} 112}
112void QuickEditImpl::reinit() { 113void QuickEditImpl::reinit() {
113 m_state = 3; 114 m_state = 3;
114 m_lbl->setPixmap( priority3 ); 115 m_lbl->setPixmap( priority3 );
115 m_edit->clear(); 116 m_edit->clear();
116} 117}
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index a512fb0..62fc600 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -1,232 +1,233 @@
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 "taskeditoralarms.h" 29#include "taskeditoralarms.h"
30 30
31#include <opie2/opimnotifymanager.h> 31#include <opie2/opimnotifymanager.h>
32#include <opie2/otimepicker.h> 32#include <opie2/otimepicker.h>
33 33
34#include <qpe/datebookmonth.h> 34#include <qpe/datebookmonth.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36 36
37#include <qlistview.h> 37#include <qlistview.h>
38#include <qlayout.h> 38#include <qlayout.h>
39 39
40 40
41using namespace Opie::Ui;
41class AlarmItem : public QListViewItem { 42class AlarmItem : public QListViewItem {
42public: 43public:
43 AlarmItem( QListView*, const OPimAlarm& ); 44 AlarmItem( QListView*, const OPimAlarm& );
44 ~AlarmItem(); 45 ~AlarmItem();
45 46
46 OPimAlarm alarm()const; 47 OPimAlarm alarm()const;
47 void setAlarm( const OPimAlarm& ); 48 void setAlarm( const OPimAlarm& );
48private: 49private:
49 QDateTime m_dt; 50 QDateTime m_dt;
50 int m_type; 51 int m_type;
51}; 52};
52AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) 53AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
53 : QListViewItem(view) { 54 : QListViewItem(view) {
54 setAlarm( dt ); 55 setAlarm( dt );
55} 56}
56void AlarmItem::setAlarm( const OPimAlarm& dt ) { 57void AlarmItem::setAlarm( const OPimAlarm& dt ) {
57 m_dt = dt.dateTime(); 58 m_dt = dt.dateTime();
58 m_type = dt.sound(); 59 m_type = dt.sound();
59 setText( 0, TimeString::dateString( m_dt.date() ) ); 60 setText( 0, TimeString::dateString( m_dt.date() ) );
60 setText( 1, TimeString::timeString( m_dt.time() ) ); 61 setText( 1, TimeString::timeString( m_dt.time() ) );
61 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); 62 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
62} 63}
63AlarmItem::~AlarmItem() { 64AlarmItem::~AlarmItem() {
64} 65}
65OPimAlarm AlarmItem::alarm()const{ 66OPimAlarm AlarmItem::alarm()const{
66 OPimAlarm al( m_type, m_dt ); 67 OPimAlarm al( m_type, m_dt );
67 68
68 return al; 69 return al;
69} 70}
70 71
71TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) 72TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
72 : QWidget( parent, name, fl ) 73 : QWidget( parent, name, fl )
73{ 74{
74 m_date = m_type = m_time = 0; 75 m_date = m_type = m_time = 0;
75 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); 76 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
76 77
77 lstAlarms = new QListView( this ); 78 lstAlarms = new QListView( this );
78 lstAlarms->addColumn( tr("Date") ); 79 lstAlarms->addColumn( tr("Date") );
79 lstAlarms->addColumn( tr("Time") ); 80 lstAlarms->addColumn( tr("Time") );
80 lstAlarms->addColumn( tr("Type") ); 81 lstAlarms->addColumn( tr("Type") );
81 82
82 connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ), 83 connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ),
83 this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) ); 84 this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) );
84 85
85 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 86 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
86 87
87 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); 88 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this );
88 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 89 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
89 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 90 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
90 layout->addWidget( btn, 1, 0 ); 91 layout->addWidget( btn, 1, 0 );
91/* use when we've reminders too */ 92/* use when we've reminders too */
92#if 0 93#if 0
93 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 94 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this );
94 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 95 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 96 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
96 layout->addWidget( btn, 1, 1 ); 97 layout->addWidget( btn, 1, 1 );
97#endif 98#endif
98 99
99 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 100 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
100 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 101 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 102 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
102 layout->addWidget( btn, 1, 2 ); 103 layout->addWidget( btn, 1, 2 );
103} 104}
104 105
105TaskEditorAlarms::~TaskEditorAlarms(){ 106TaskEditorAlarms::~TaskEditorAlarms(){
106} 107}
107 108
108void TaskEditorAlarms::slotNew(){ 109void TaskEditorAlarms::slotNew(){
109 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); 110 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
110} 111}
111 112
112void TaskEditorAlarms::slotEdit(){ 113void TaskEditorAlarms::slotEdit(){
113} 114}
114 115
115void TaskEditorAlarms::slotDelete(){ 116void TaskEditorAlarms::slotDelete(){
116 QListViewItem* item = lstAlarms->currentItem(); 117 QListViewItem* item = lstAlarms->currentItem();
117 if (!item) return; 118 if (!item) return;
118 119
119 lstAlarms->takeItem( item ); delete item; 120 lstAlarms->takeItem( item ); delete item;
120 121
121 122
122} 123}
123 124
124void TaskEditorAlarms::load( const OPimTodo& todo) { 125void TaskEditorAlarms::load( const OPimTodo& todo) {
125 lstAlarms->clear(); 126 lstAlarms->clear();
126 if (!todo.hasNotifiers() ) return; 127 if (!todo.hasNotifiers() ) return;
127 128
128 OPimNotifyManager::Alarms als = todo.notifiers().alarms(); 129 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
129 130
130 if (als.isEmpty() ) return; 131 if (als.isEmpty() ) return;
131 132
132 OPimNotifyManager::Alarms::Iterator it = als.begin(); 133 OPimNotifyManager::Alarms::Iterator it = als.begin();
133 for ( ; it != als.end(); ++it ) 134 for ( ; it != als.end(); ++it )
134 (void)new AlarmItem( lstAlarms, (*it) ); 135 (void)new AlarmItem( lstAlarms, (*it) );
135 136
136 137
137} 138}
138void TaskEditorAlarms::save( OPimTodo& todo ) { 139void TaskEditorAlarms::save( OPimTodo& todo ) {
139 if (lstAlarms->childCount() <= 0 ) return; 140 if (lstAlarms->childCount() <= 0 ) return;
140 141
141 OPimNotifyManager::Alarms alarms; 142 OPimNotifyManager::Alarms alarms;
142 143
143 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) { 144 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) {
144 AlarmItem *alItem = static_cast<AlarmItem*>(item); 145 AlarmItem *alItem = static_cast<AlarmItem*>(item);
145 alarms.append( alItem->alarm() ); 146 alarms.append( alItem->alarm() );
146 } 147 }
147 148
148 OPimNotifyManager& manager = todo.notifiers(); 149 OPimNotifyManager& manager = todo.notifiers();
149 manager.setAlarms( alarms ); 150 manager.setAlarms( alarms );
150} 151}
151void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) { 152void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) {
152 if (!alarm) return; 153 if (!alarm) return;
153 154
154 AlarmItem* item = static_cast<AlarmItem*>(alarm); 155 AlarmItem* item = static_cast<AlarmItem*>(alarm);
155 switch( col ) { 156 switch( col ) {
156 // date 157 // date
157 case 0: 158 case 0:
158 return inlineSetDate( item, p ); 159 return inlineSetDate( item, p );
159 // time 160 // time
160 case 1: 161 case 1:
161 return inlineSetTime( item ); 162 return inlineSetTime( item );
162 // type 163 // type
163 case 2: 164 case 2:
164 return inlineSetType( item, p ); 165 return inlineSetType( item, p );
165 } 166 }
166} 167}
167void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) { 168void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) {
168 QPopupMenu* pop = popup( 0 ); 169 QPopupMenu* pop = popup( 0 );
169 m_dbMonth->setDate( item->alarm().dateTime().date() ); 170 m_dbMonth->setDate( item->alarm().dateTime().date() );
170 pop->exec(p); 171 pop->exec(p);
171 172
172 OPimAlarm al = item->alarm(); 173 OPimAlarm al = item->alarm();
173 QDateTime dt = al.dateTime(); 174 QDateTime dt = al.dateTime();
174 dt.setDate( m_dbMonth->selectedDate() ); 175 dt.setDate( m_dbMonth->selectedDate() );
175 al.setDateTime( dt ); 176 al.setDateTime( dt );
176 item->setAlarm( al ); 177 item->setAlarm( al );
177} 178}
178void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) { 179void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) {
179 int type; 180 int type;
180 QPopupMenu* pop = popup( 2 ); 181 QPopupMenu* pop = popup( 2 );
181 switch( pop->exec(p) ) { 182 switch( pop->exec(p) ) {
182 case 10: 183 case 10:
183 type = 1; 184 type = 1;
184 break; 185 break;
185 case 20: 186 case 20:
186 default: 187 default:
187 type = 0; 188 type = 0;
188 } 189 }
189 OPimAlarm al = item->alarm(); 190 OPimAlarm al = item->alarm();
190 al.setSound( type ); 191 al.setSound( type );
191 item->setAlarm( al ); 192 item->setAlarm( al );
192} 193}
193void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) { 194void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) {
194 OPimAlarm al = item->alarm(); 195 OPimAlarm al = item->alarm();
195 QDateTime dt = al.dateTime(); 196 QDateTime dt = al.dateTime();
196 197
197 OTimePickerDialog dialog; 198 OTimePickerDialog dialog;
198 dialog.setTime( dt.time() ); 199 dialog.setTime( dt.time() );
199 if ( dialog.exec() == QDialog::Accepted ) { 200 if ( dialog.exec() == QDialog::Accepted ) {
200 dt.setTime( dialog.time() ); 201 dt.setTime( dialog.time() );
201 al.setDateTime( dt ); 202 al.setDateTime( dt );
202 item->setAlarm( al ); 203 item->setAlarm( al );
203 } 204 }
204} 205}
205QPopupMenu* TaskEditorAlarms::popup( int column ) { 206QPopupMenu* TaskEditorAlarms::popup( int column ) {
206 QPopupMenu* pop = 0; 207 QPopupMenu* pop = 0;
207 switch( column ) { 208 switch( column ) {
208 case 0:{ 209 case 0:{
209 if (!m_date) { 210 if (!m_date) {
210 m_date = new QPopupMenu(this); 211 m_date = new QPopupMenu(this);
211 m_dbMonth = new DateBookMonth(m_date, 0, TRUE); 212 m_dbMonth = new DateBookMonth(m_date, 0, TRUE);
212 m_date->insertItem(m_dbMonth); 213 m_date->insertItem(m_dbMonth);
213 } 214 }
214 pop = m_date; 215 pop = m_date;
215 } 216 }
216 break; 217 break;
217 case 1: 218 case 1:
218 break; 219 break;
219 case 2:{ 220 case 2:{
220 if (!m_type) { 221 if (!m_type) {
221 m_type = new QPopupMenu(this); 222 m_type = new QPopupMenu(this);
222 m_type->insertItem( QObject::tr("loud"), 10 ); 223 m_type->insertItem( QObject::tr("loud"), 10 );
223 m_type->insertItem( QObject::tr("silent"), 20 ); 224 m_type->insertItem( QObject::tr("silent"), 20 );
224 } 225 }
225 pop = m_type; 226 pop = m_type;
226 } 227 }
227 break; 228 break;
228 default: 229 default:
229 break; 230 break;
230 } 231 }
231 return pop; 232 return pop;
232} 233}