author | zecke <zecke> | 2004-11-20 18:50:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-20 18:50:20 (UTC) |
commit | 047944e061799d24fa337e8a20fcb7ef6916805b (patch) (unidiff) | |
tree | 88e1868e06787544ebfb98d433c2057eeeaed89d /examples/simple-pim | |
parent | 244e3fd05f01859a82243347ddc11318788cefb2 (diff) | |
download | opie-047944e061799d24fa337e8a20fcb7ef6916805b.zip opie-047944e061799d24fa337e8a20fcb7ef6916805b.tar.gz opie-047944e061799d24fa337e8a20fcb7ef6916805b.tar.bz2 |
Temporary compile fix. Needs better updating for
OPimOccurrences and some rethinking
-rw-r--r-- | examples/simple-pim/simple.cpp | 33 | ||||
-rw-r--r-- | examples/simple-pim/simple.h | 4 |
2 files changed, 21 insertions, 16 deletions
diff --git a/examples/simple-pim/simple.cpp b/examples/simple-pim/simple.cpp index efd5070..d3ce2cc 100644 --- a/examples/simple-pim/simple.cpp +++ b/examples/simple-pim/simple.cpp | |||
@@ -180,277 +180,282 @@ void MainWindow::slotLoad() { | |||
180 | * | 180 | * |
181 | * To send you'll use QCopEnevelope | 181 | * To send you'll use QCopEnevelope |
182 | * | 182 | * |
183 | */ | 183 | */ |
184 | /* | 184 | /* |
185 | * What we will do is first is get to know if either | 185 | * What we will do is first is get to know if either |
186 | * datebook or todolist are running if so we will kindly | 186 | * datebook or todolist are running if so we will kindly |
187 | * asked to save the data for us. | 187 | * asked to save the data for us. |
188 | * If neither are running we can load directly | 188 | * If neither are running we can load directly |
189 | */ | 189 | */ |
190 | if (!QCopChannel::isRegistered("QPE/Application/todolist") && | 190 | if (!QCopChannel::isRegistered("QPE/Application/todolist") && |
191 | !QCopChannel::isRegistered("QPE/Application/datebook") ) { | 191 | !QCopChannel::isRegistered("QPE/Application/datebook") ) { |
192 | m_db.load(); | 192 | m_db.load(); |
193 | m_tb.load(); | 193 | m_tb.load(); |
194 | return slotLoadForDay( QDate::currentDate() ); | 194 | return slotLoadForDay( QDate::currentDate() ); |
195 | } | 195 | } |
196 | 196 | ||
197 | /* | 197 | /* |
198 | * prepare our answer machine the QCopChannel | 198 | * prepare our answer machine the QCopChannel |
199 | * QPE/Desktop will send "flushDone(QString)" when | 199 | * QPE/Desktop will send "flushDone(QString)" when |
200 | * the flush is done it emits a signal on receive | 200 | * the flush is done it emits a signal on receive |
201 | */ | 201 | */ |
202 | m_desktopChannel = new QCopChannel("QPE/Desktop"); | 202 | m_desktopChannel = new QCopChannel("QPE/Desktop"); |
203 | connect(m_desktopChannel, SIGNAL(received(const QCString&,const QByteArray&) ), | 203 | connect(m_desktopChannel, SIGNAL(received(const QCString&,const QByteArray&) ), |
204 | this, SLOT(slotDesktopReceive(const QCString&,const QByteArray&) ) ); | 204 | this, SLOT(slotDesktopReceive(const QCString&,const QByteArray&) ) ); |
205 | /* the numberof synced channels will be set to zero */ | 205 | /* the numberof synced channels will be set to zero */ |
206 | m_synced = 0; | 206 | m_synced = 0; |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * We use {} around the QCopEnvelope because it sends its | 209 | * We use {} around the QCopEnvelope because it sends its |
210 | * data on destruction of QCopEnvelope with | 210 | * data on destruction of QCopEnvelope with |
211 | */ | 211 | */ |
212 | /* check again if not present increment synced*/ | 212 | /* check again if not present increment synced*/ |
213 | if ( QCopChannel::isRegistered("QPE/Application/todolist") ) { | 213 | if ( QCopChannel::isRegistered("QPE/Application/todolist") ) { |
214 | QCopEnvelope env("QPE/Application/todolist", "flush()" ); | 214 | QCopEnvelope env("QPE/Application/todolist", "flush()" ); |
215 | // env << data; but we do not have any parameters here | 215 | // env << data; but we do not have any parameters here |
216 | }else | 216 | }else |
217 | m_synced++; | 217 | m_synced++; |
218 | 218 | ||
219 | if ( QCopChannel::isRegistered("QPE/Application/datebook") ) { | 219 | if ( QCopChannel::isRegistered("QPE/Application/datebook") ) { |
220 | QCopEnvelope env("QPE/Application/datebook", "flush()" ); | 220 | QCopEnvelope env("QPE/Application/datebook", "flush()" ); |
221 | }else | 221 | }else |
222 | m_synced++; | 222 | m_synced++; |
223 | 223 | ||
224 | /* we will provide a wait scrren */ | 224 | /* we will provide a wait scrren */ |
225 | m_loading = new Opie::Ui::OWait(this, "wait screen" ); | 225 | m_loading = new Opie::Ui::OWait(this, "wait screen" ); |
226 | } | 226 | } |
227 | 227 | ||
228 | void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { | 228 | void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { |
229 | /* the bytearray was filled with the QDataStream now | 229 | /* the bytearray was filled with the QDataStream now |
230 | * we open it read only to get the value(s) | 230 | * we open it read only to get the value(s) |
231 | */ | 231 | */ |
232 | QDataStream stream(data, IO_ReadOnly ); | 232 | QDataStream stream(data, IO_ReadOnly ); |
233 | /* | 233 | /* |
234 | * we're only interested in the flushDone | 234 | * we're only interested in the flushDone |
235 | */ | 235 | */ |
236 | if ( cmd == "flushDone(QString)" ) { | 236 | if ( cmd == "flushDone(QString)" ) { |
237 | QString appname; | 237 | QString appname; |
238 | stream >> appname; // get the first argument out of stream | 238 | stream >> appname; // get the first argument out of stream |
239 | if (appname == QString::fromLatin1("datebook") || | 239 | if (appname == QString::fromLatin1("datebook") || |
240 | appname == QString::fromLatin1("todolist") ) | 240 | appname == QString::fromLatin1("todolist") ) |
241 | m_synced++; | 241 | m_synced++; |
242 | } | 242 | } |
243 | 243 | ||
244 | /* | 244 | /* |
245 | * If we synced both we can go ahead | 245 | * If we synced both we can go ahead |
246 | * In future this is not needed anymore when we finally | 246 | * In future this is not needed anymore when we finally |
247 | * implemented X-Ref and other PIM features | 247 | * implemented X-Ref and other PIM features |
248 | */ | 248 | */ |
249 | if (m_synced >= 2 ) { | 249 | if (m_synced >= 2 ) { |
250 | delete m_loading; | 250 | delete m_loading; |
251 | delete m_desktopChannel; | 251 | delete m_desktopChannel; |
252 | /* now we finally can start doing the actual loading */ | 252 | /* now we finally can start doing the actual loading */ |
253 | m_tb.load(); | 253 | m_tb.load(); |
254 | m_db.load(); | 254 | m_db.load(); |
255 | { | 255 | { |
256 | /* tell the applications to reload */ | 256 | /* tell the applications to reload */ |
257 | QCopEnvelope("QPE/Application/todolist", "reload()"); | 257 | QCopEnvelope("QPE/Application/todolist", "reload()"); |
258 | QCopEnvelope("QPE/Application/datebook", "reload()"); | 258 | QCopEnvelope("QPE/Application/datebook", "reload()"); |
259 | } | 259 | } |
260 | slotLoadForDay( QDate::currentDate() ); | 260 | slotLoadForDay( QDate::currentDate() ); |
261 | } | 261 | } |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | /* overloaded member for shortcoming of libqpe */ | 265 | /* overloaded member for shortcoming of libqpe */ |
266 | void MainWindow::slotLoadForDay(int y, int m, int d) { | 266 | void MainWindow::slotLoadForDay(int y, int m, int d) { |
267 | /* year,month, day */ | 267 | /* year,month, day */ |
268 | slotLoadForDay( QDate(y, m, d ) ); | 268 | slotLoadForDay( QDate(y, m, d ) ); |
269 | } | 269 | } |
270 | 270 | ||
271 | void MainWindow::slotLoadForDay(const QDate& date) { | 271 | void MainWindow::slotLoadForDay(const QDate& date) { |
272 | 272 | ||
273 | 273 | ||
274 | /* all todos for today including the ones without dueDate */ | 274 | /* all todos for today including the ones without dueDate */ |
275 | m_todoView->set( m_tb.effectiveToDos(date, date ) ); | 275 | m_todoView->set( m_tb.effectiveToDos(date, date ) ); |
276 | m_dateView->set( m_db.effectiveEvents( date, date ) ); | 276 | m_dateView->set( m_db.occurrences( date, date ) ); |
277 | } | 277 | } |
278 | 278 | ||
279 | /* we want to show the current record */ | 279 | /* we want to show the current record */ |
280 | void MainWindow::slotShow() { | 280 | void MainWindow::slotShow() { |
281 | /* we only added PIMListViews so we can safely cast */ | 281 | /* we only added PIMListViews so we can safely cast */ |
282 | PIMListView *view = static_cast<PIMListView*>(m_tab->currentWidget() ); | 282 | PIMListView *view = static_cast<PIMListView*>(m_tab->currentWidget() ); |
283 | 283 | ||
284 | /* ask the view to send a signal */ | 284 | /* ask the view to send a signal */ |
285 | view->showCurrentRecord(); | 285 | view->showCurrentRecord(); |
286 | 286 | ||
287 | } | 287 | } |
288 | 288 | ||
289 | /* as answer this slot will be called */ | 289 | /* as answer this slot will be called */ |
290 | void MainWindow::slotShowRecord( const Opie::OPimRecord& rec) { | 290 | void MainWindow::slotShowRecord( const Opie::OPimRecord& rec) { |
291 | /* got a parent but still is a toplevel MODAL dialog */ | 291 | /* got a parent but still is a toplevel MODAL dialog */ |
292 | QDialog* dia = new QDialog(this,"dialog",TRUE ); | 292 | QDialog* dia = new QDialog(this,"dialog",TRUE ); |
293 | QVBoxLayout *box = new QVBoxLayout( dia ); | 293 | QVBoxLayout *box = new QVBoxLayout( dia ); |
294 | dia->setCaption( tr("View Record") ); | 294 | dia->setCaption( tr("View Record") ); |
295 | 295 | ||
296 | 296 | ||
297 | QTextView *view = new QTextView(dia ); | 297 | QTextView *view = new QTextView(dia ); |
298 | view->setText( rec.toRichText() ); | 298 | view->setText( rec.toRichText() ); |
299 | box->addWidget( view ); | 299 | box->addWidget( view ); |
300 | /* | 300 | /* |
301 | * execute via QPEApplication | 301 | * execute via QPEApplication |
302 | * this allows QPEApplication to make a sane decision | 302 | * this allows QPEApplication to make a sane decision |
303 | * on the size | 303 | * on the size |
304 | */ | 304 | */ |
305 | dia->showMaximized(); | 305 | dia->showMaximized(); |
306 | QPEApplication::execDialog( dia ); | 306 | QPEApplication::execDialog( dia ); |
307 | delete dia; | 307 | delete dia; |
308 | } | 308 | } |
309 | 309 | ||
310 | 310 | ||
311 | void MainWindow::slotDate() { | 311 | void MainWindow::slotDate() { |
312 | /* | 312 | /* |
313 | * called by the action we will show a Popup | 313 | * called by the action we will show a Popup |
314 | * at the current mouse position with a DateChooser | 314 | * at the current mouse position with a DateChooser |
315 | * to select the day | 315 | * to select the day |
316 | */ | 316 | */ |
317 | odebug << "slot Date" << oendl; | 317 | odebug << "slot Date" << oendl; |
318 | QPopupMenu *menu = new QPopupMenu(); | 318 | QPopupMenu *menu = new QPopupMenu(); |
319 | /* A Month to select a date from TRUE for auto close */ | 319 | /* A Month to select a date from TRUE for auto close */ |
320 | DateBookMonth *month = new DateBookMonth(menu, 0, true ); | 320 | DateBookMonth *month = new DateBookMonth(menu, 0, true ); |
321 | connect(month, SIGNAL(dateClicked(int,int,int) ), | 321 | connect(month, SIGNAL(dateClicked(int,int,int) ), |
322 | this, SLOT(slotLoadForDay(int,int,int) ) ); | 322 | this, SLOT(slotLoadForDay(int,int,int) ) ); |
323 | 323 | ||
324 | menu->insertItem( month ); | 324 | menu->insertItem( month ); |
325 | 325 | ||
326 | menu->exec( QCursor::pos() ); | 326 | menu->exec( QCursor::pos() ); |
327 | 327 | ||
328 | /* | 328 | /* |
329 | * we do not need to delete month because | 329 | * we do not need to delete month because |
330 | * we delete its parent menu | 330 | * we delete its parent menu |
331 | */ | 331 | */ |
332 | 332 | ||
333 | delete menu; | 333 | delete menu; |
334 | } | 334 | } |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * An anonymous namespace this symbol is only available here | 337 | * An anonymous namespace this symbol is only available here |
338 | * so truely private | 338 | * so truely private |
339 | */ | 339 | */ |
340 | namespace { | 340 | namespace { |
341 | /* not static cause namespace does that what static would do */ | 341 | /* not static cause namespace does that what static would do */ |
342 | const int RTTI = 5050; | 342 | const int RTTI = 5050; |
343 | /* | 343 | /* |
344 | * every ListView got Items. we've special pim items | 344 | * every ListView got Items. we've special pim items |
345 | * holding ownership and the pointer to a pim record | 345 | * holding ownership and the pointer to a pim record |
346 | * it can't hold a pimrecord directly because this | 346 | * it can't hold a pimrecord directly because this |
347 | * would introduce slicing... any break | 347 | * would introduce slicing... any break |
348 | */ | 348 | */ |
349 | /* | 349 | /* |
350 | * A struct is a special class. Everything is public by | 350 | * A struct is a special class. Everything is public by |
351 | * default. | 351 | * default. |
352 | */ | 352 | */ |
353 | struct PIMListViewItem : public QListViewItem { | 353 | struct PIMListViewItem : public QListViewItem { |
354 | /* | 354 | /* |
355 | *currently no hierachies are planed for the example | 355 | *currently no hierachies are planed for the example |
356 | * so only one constructor with a QListView as parent | 356 | * so only one constructor with a QListView as parent |
357 | */ | 357 | */ |
358 | PIMListViewItem( QListView*, Opie::OPimRecord* record ); | 358 | PIMListViewItem( QListView*, Opie::OPimRecord* record ); |
359 | ~PIMListViewItem(); | 359 | ~PIMListViewItem(); |
360 | 360 | ||
361 | /* used by the QListViewItem to easily allow identifiying of different | 361 | /* used by the QListViewItem to easily allow identifiying of different |
362 | * items. Values greater than 1000 should be used */ | 362 | * items. Values greater than 1000 should be used */ |
363 | int rtti()const; | 363 | int rtti()const; |
364 | Opie::OPimRecord* record()const; | 364 | Opie::OPimRecord* record()const; |
365 | 365 | ||
366 | private: | 366 | private: |
367 | Opie::OPimRecord* m_record; | 367 | Opie::OPimRecord* m_record; |
368 | }; | 368 | }; |
369 | 369 | ||
370 | PIMListViewItem::PIMListViewItem( QListView *p, Opie::OPimRecord* rec ) | 370 | PIMListViewItem::PIMListViewItem( QListView *p, Opie::OPimRecord* rec ) |
371 | : QListViewItem(p), m_record( rec ) { | 371 | : QListViewItem(p), m_record( rec ) { |
372 | } | 372 | } |
373 | 373 | ||
374 | PIMListViewItem::~PIMListViewItem() { | 374 | PIMListViewItem::~PIMListViewItem() { |
375 | /* we've the onwership so we need to delete it */ | 375 | /* we've the onwership so we need to delete it */ |
376 | delete m_record; | 376 | delete m_record; |
377 | } | 377 | } |
378 | 378 | ||
379 | Opie::OPimRecord* PIMListViewItem::record()const { | 379 | Opie::OPimRecord* PIMListViewItem::record()const { |
380 | return m_record; | 380 | return m_record; |
381 | } | 381 | } |
382 | 382 | ||
383 | } | 383 | } |
384 | 384 | ||
385 | 385 | ||
386 | PIMListView::PIMListView( QWidget* widget, const char* name, WFlags fl ) | 386 | PIMListView::PIMListView( QWidget* widget, const char* name, WFlags fl ) |
387 | : QListView(widget, name, fl ) | 387 | : QListView(widget, name, fl ) |
388 | { | 388 | { |
389 | addColumn("Summary"); | 389 | addColumn("Summary"); |
390 | } | 390 | } |
391 | 391 | ||
392 | PIMListView::~PIMListView() { | 392 | PIMListView::~PIMListView() { |
393 | 393 | ||
394 | } | 394 | } |
395 | 395 | ||
396 | void PIMListView::set( Opie::OPimTodoAccess::List list ) { | 396 | void PIMListView::set( Opie::OPimTodoAccess::List list ) { |
397 | /* clear first and then add new items */ | 397 | /* clear first and then add new items */ |
398 | clear(); | 398 | clear(); |
399 | 399 | ||
400 | Opie::OPimTodoAccess::List::Iterator it; | 400 | Opie::OPimTodoAccess::List::Iterator it; |
401 | for (it = list.begin(); it != list.end(); ++it ) { | 401 | for (it = list.begin(); it != list.end(); ++it ) { |
402 | /* | 402 | /* |
403 | * make a new item which automatically gets added to the listview | 403 | * make a new item which automatically gets added to the listview |
404 | * and call the copy c'tor to create a new OPimTodo | 404 | * and call the copy c'tor to create a new OPimTodo |
405 | */ | 405 | */ |
406 | PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimTodo( *it ) ); | 406 | PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimTodo( *it ) ); |
407 | i->setText(0, (*it).summary() ); | 407 | i->setText(0, (*it).summary() ); |
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) { | 411 | void PIMListView::set( const Opie::OPimOccurrence::List& lst ) { |
412 | /* clear first and then add items */ | 412 | /* clear first and then add items */ |
413 | clear(); | 413 | clear(); |
414 | 414 | ||
415 | Opie::OEffectiveEvent::ValueList::ConstIterator it; | 415 | Opie::OPimOccurrence::List::ConstIterator it; |
416 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 416 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
417 | PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).event() ) ); | 417 | PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).toEvent() ) ); |
418 | i->setText( 0, PIMListView::makeString( (*it) ) ); | 418 | i->setText( 0, PIMListView::makeString( (*it) ) ); |
419 | } | 419 | } |
420 | 420 | ||
421 | } | 421 | } |
422 | 422 | ||
423 | void PIMListView::showCurrentRecord() { | 423 | void PIMListView::showCurrentRecord() { |
424 | /* it could be possible that their is no currentItem */ | 424 | /* it could be possible that their is no currentItem */ |
425 | if (!currentItem() ) | 425 | if (!currentItem() ) |
426 | return; | 426 | return; |
427 | 427 | ||
428 | /* | 428 | /* |
429 | * we only add PIMListViewItems so it is save | 429 | * we only add PIMListViewItems so it is save |
430 | * to do this case. If this would not be the case | 430 | * to do this case. If this would not be the case |
431 | * use rtti() to check in a switch() case | 431 | * use rtti() to check in a switch() case |
432 | */ | 432 | */ |
433 | PIMListViewItem *item = static_cast<PIMListViewItem*>( currentItem() ); | 433 | PIMListViewItem *item = static_cast<PIMListViewItem*>( currentItem() ); |
434 | 434 | ||
435 | /* finally you see how to emit a signal */ | 435 | /* finally you see how to emit a signal */ |
436 | emit showRecord( (*item->record() ) ); | 436 | emit showRecord( (*item->record() ) ); |
437 | } | 437 | } |
438 | 438 | ||
439 | QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) { | 439 | QString PIMListView::makeString( const Opie::OPimOccurrence& _ev ) { |
440 | QString str; | 440 | QString str; |
441 | str += ev.description(); | 441 | str += _ev.summary(); |
442 | if ( !ev.event().isAllDay() ) { | 442 | |
443 | Opie::OPimEvent ev = _ev.toEvent(); | ||
444 | if ( !ev.isAllDay() ) { | ||
445 | #if 0 | ||
443 | if ( ev.startDate() != ev.endDate() ) { | 446 | if ( ev.startDate() != ev.endDate() ) { |
444 | str += tr("Start ") + TimeString::timeString( ev.event().startDateTime().time() ); | 447 | str += tr("Start ") + TimeString::timeString( ev.startDateTime().time() ); |
445 | str += " - " + TimeString::longDateString( ev.startDate() ); | 448 | str += " - " + TimeString::longDateString( ev.startDateTime().date() ); |
446 | str += tr("End ") + TimeString::timeString( ev.event().endDateTime().time() ); | 449 | str += tr("End ") + TimeString::timeString( ev.endDateTime().time() ); |
447 | str += " - " + TimeString::longDateString( ev.endDate() ); | 450 | str += " - " + TimeString::longDateString( ev.endDateTime().date() ); |
448 | }else{ | 451 | }else |
449 | str += tr("Time ") + TimeString::timeString( ev.startTime() ); | 452 | #endif |
450 | str += " - " + TimeString::timeString( ev.endTime() ); | 453 | { |
454 | str += tr("Time ") + TimeString::timeString( _ev.startTime() ); | ||
455 | str += " - " + TimeString::timeString( _ev.endTime() ); | ||
451 | } | 456 | } |
452 | }else | 457 | }else |
453 | str += tr(" This is an All-Day Event"); | 458 | str += tr(" This is an All-Day Event"); |
454 | 459 | ||
455 | return str; | 460 | return str; |
456 | } | 461 | } |
diff --git a/examples/simple-pim/simple.h b/examples/simple-pim/simple.h index 2a6e8ce..a537dde 100644 --- a/examples/simple-pim/simple.h +++ b/examples/simple-pim/simple.h | |||
@@ -1,99 +1,99 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * A Simple widget with a button to quit | 3 | * A Simple widget with a button to quit |
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * The below sequence is called a guard and guards | 8 | * The below sequence is called a guard and guards |
9 | * against multiple inclusion of header files | 9 | * against multiple inclusion of header files |
10 | * NOTE: you need to use unique names among the header files | 10 | * NOTE: you need to use unique names among the header files |
11 | */ | 11 | */ |
12 | #ifndef QUIET_SIMPLE_DEMO_H | 12 | #ifndef QUIET_SIMPLE_DEMO_H |
13 | #define QUIET_SIMPLE_DEMO_H | 13 | #define QUIET_SIMPLE_DEMO_H |
14 | 14 | ||
15 | 15 | ||
16 | 16 | ||
17 | 17 | ||
18 | #include <qmainwindow.h> // from this class we will inherit | 18 | #include <qmainwindow.h> // from this class we will inherit |
19 | #include <qlistview.h> // A ListView for our PIM records | 19 | #include <qlistview.h> // A ListView for our PIM records |
20 | 20 | ||
21 | #include <opie2/otodoaccess.h> | 21 | #include <opie2/otodoaccess.h> |
22 | #include <opie2/odatebookaccess.h> | 22 | #include <opie2/odatebookaccess.h> |
23 | 23 | ||
24 | class QPushButton; // forward declaration to not include the header. This can save time when compiling | 24 | class QPushButton; // forward declaration to not include the header. This can save time when compiling |
25 | class QAction; | 25 | class QAction; |
26 | class PIMListView; | 26 | class PIMListView; |
27 | class QDate; | 27 | class QDate; |
28 | class QCopChannel; | 28 | class QCopChannel; |
29 | namespace Opie{ | 29 | namespace Opie{ |
30 | namespace Ui { | 30 | namespace Ui { |
31 | class OWait; | 31 | class OWait; |
32 | class OTabWidget; | 32 | class OTabWidget; |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * A mainwindow is a special QWidget it helps layouting | 37 | * A mainwindow is a special QWidget it helps layouting |
38 | * toolbar, statusbar, menubar. Got dockable areas | 38 | * toolbar, statusbar, menubar. Got dockable areas |
39 | * So in one sentence it is a MainWindow :) | 39 | * So in one sentence it is a MainWindow :) |
40 | */ | 40 | */ |
41 | class MainWindow : public QMainWindow { | 41 | class MainWindow : public QMainWindow { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | static QString appName() { return QString::fromLatin1("simple-pim"); } | 44 | static QString appName() { return QString::fromLatin1("simple-pim"); } |
45 | MainWindow( QWidget* parent, const char* name, WFlags fl ); | 45 | MainWindow( QWidget* parent, const char* name, WFlags fl ); |
46 | ~MainWindow(); | 46 | ~MainWindow(); |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | void setDocument( const QString& ); | 49 | void setDocument( const QString& ); |
50 | private slots: | 50 | private slots: |
51 | void slotDesktopReceive( const QCString&, const QByteArray& ); | 51 | void slotDesktopReceive( const QCString&, const QByteArray& ); |
52 | void slotLoad(); | 52 | void slotLoad(); |
53 | void slotLoadForDay(int, int, int ); | 53 | void slotLoadForDay(int, int, int ); |
54 | void slotLoadForDay(const QDate&); | 54 | void slotLoadForDay(const QDate&); |
55 | void slotShow(); | 55 | void slotShow(); |
56 | void slotDate(); | 56 | void slotDate(); |
57 | void slotShowRecord( const Opie::OPimRecord& ); | 57 | void slotShowRecord( const Opie::OPimRecord& ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | void initUI(); | 60 | void initUI(); |
61 | QAction *m_fire; | 61 | QAction *m_fire; |
62 | QAction *m_dateAction; | 62 | QAction *m_dateAction; |
63 | Opie::Ui::OTabWidget* m_tab; | 63 | Opie::Ui::OTabWidget* m_tab; |
64 | 64 | ||
65 | Opie::OPimTodoAccess m_tb; | 65 | Opie::OPimTodoAccess m_tb; |
66 | Opie::ODateBookAccess m_db; | 66 | Opie::ODateBookAccess m_db; |
67 | PIMListView *m_todoView; | 67 | PIMListView *m_todoView; |
68 | PIMListView *m_dateView; | 68 | PIMListView *m_dateView; |
69 | 69 | ||
70 | int m_synced; // a counter for synced objects.. | 70 | int m_synced; // a counter for synced objects.. |
71 | QCopChannel *m_desktopChannel; | 71 | QCopChannel *m_desktopChannel; |
72 | Opie::Ui::OWait *m_loading; | 72 | Opie::Ui::OWait *m_loading; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * Instead of the simple QWidgets we will design | 76 | * Instead of the simple QWidgets we will design |
77 | * a new widget based on a QListView | 77 | * a new widget based on a QListView |
78 | * it should show either Todos or EffectiveEvents | 78 | * it should show either Todos or EffectiveEvents |
79 | */ | 79 | */ |
80 | class PIMListView : public QListView { | 80 | class PIMListView : public QListView { |
81 | Q_OBJECT | 81 | Q_OBJECT |
82 | public: | 82 | public: |
83 | PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); | 83 | PIMListView( QWidget* parent, const char* name, WFlags fl= 0 ); |
84 | ~PIMListView(); | 84 | ~PIMListView(); |
85 | 85 | ||
86 | 86 | ||
87 | void set( Opie::OPimTodoAccess::List ); | 87 | void set( Opie::OPimTodoAccess::List ); |
88 | void set( const Opie::OEffectiveEvent::ValueList& ); | 88 | void set( const Opie::OPimOccurrence::List& ); |
89 | void showCurrentRecord(); | 89 | void showCurrentRecord(); |
90 | 90 | ||
91 | signals: | 91 | signals: |
92 | void showRecord( const Opie::OPimRecord& ); | 92 | void showRecord( const Opie::OPimRecord& ); |
93 | 93 | ||
94 | private: | 94 | private: |
95 | static QString makeString( const Opie::OEffectiveEvent& ev ); | 95 | static QString makeString( const Opie::OPimOccurrence& ev ); |
96 | 96 | ||
97 | }; | 97 | }; |
98 | 98 | ||
99 | #endif | 99 | #endif |