summaryrefslogtreecommitdiff
path: root/examples/simple-pim
authorzecke <zecke>2004-11-20 18:50:20 (UTC)
committer zecke <zecke>2004-11-20 18:50:20 (UTC)
commit047944e061799d24fa337e8a20fcb7ef6916805b (patch) (unidiff)
tree88e1868e06787544ebfb98d433c2057eeeaed89d /examples/simple-pim
parent244e3fd05f01859a82243347ddc11318788cefb2 (diff)
downloadopie-047944e061799d24fa337e8a20fcb7ef6916805b.zip
opie-047944e061799d24fa337e8a20fcb7ef6916805b.tar.gz
opie-047944e061799d24fa337e8a20fcb7ef6916805b.tar.bz2
Temporary compile fix. Needs better updating for
OPimOccurrences and some rethinking
Diffstat (limited to 'examples/simple-pim') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/simple-pim/simple.cpp33
-rw-r--r--examples/simple-pim/simple.h4
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
@@ -264,25 +264,25 @@ void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data
264 264
265/* overloaded member for shortcoming of libqpe */ 265/* overloaded member for shortcoming of libqpe */
266void MainWindow::slotLoadForDay(int y, int m, int d) { 266void 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
271void MainWindow::slotLoadForDay(const QDate& date) { 271void 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 */
280void MainWindow::slotShow() { 280void 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
@@ -399,58 +399,63 @@ void PIMListView::set( Opie::OPimTodoAccess::List list ) {
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
411void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) { 411void 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
423void PIMListView::showCurrentRecord() { 423void 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
439QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) { 439QString 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
@@ -76,24 +76,24 @@ private:
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 */
80class PIMListView : public QListView { 80class PIMListView : public QListView {
81 Q_OBJECT 81 Q_OBJECT
82public: 82public:
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
91signals: 91signals:
92 void showRecord( const Opie::OPimRecord& ); 92 void showRecord( const Opie::OPimRecord& );
93 93
94private: 94private:
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