Diffstat (limited to 'examples/simple-pim/simple.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | examples/simple-pim/simple.cpp | 33 |
1 files changed, 19 insertions, 14 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 @@ -252,49 +252,49 @@ void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data /* now we finally can start doing the actual loading */ m_tb.load(); m_db.load(); { /* tell the applications to reload */ QCopEnvelope("QPE/Application/todolist", "reload()"); QCopEnvelope("QPE/Application/datebook", "reload()"); } slotLoadForDay( QDate::currentDate() ); } } /* overloaded member for shortcoming of libqpe */ void MainWindow::slotLoadForDay(int y, int m, int d) { /* year,month, day */ slotLoadForDay( QDate(y, m, d ) ); } void MainWindow::slotLoadForDay(const QDate& date) { /* all todos for today including the ones without dueDate */ m_todoView->set( m_tb.effectiveToDos(date, date ) ); - m_dateView->set( m_db.effectiveEvents( date, date ) ); + m_dateView->set( m_db.occurrences( date, date ) ); } /* we want to show the current record */ void MainWindow::slotShow() { /* we only added PIMListViews so we can safely cast */ PIMListView *view = static_cast<PIMListView*>(m_tab->currentWidget() ); /* ask the view to send a signal */ view->showCurrentRecord(); } /* as answer this slot will be called */ void MainWindow::slotShowRecord( const Opie::OPimRecord& rec) { /* got a parent but still is a toplevel MODAL dialog */ QDialog* dia = new QDialog(this,"dialog",TRUE ); QVBoxLayout *box = new QVBoxLayout( dia ); dia->setCaption( tr("View Record") ); QTextView *view = new QTextView(dia ); view->setText( rec.toRichText() ); box->addWidget( view ); /* @@ -387,70 +387,75 @@ PIMListView::PIMListView( QWidget* widget, const char* name, WFlags fl ) : QListView(widget, name, fl ) { addColumn("Summary"); } PIMListView::~PIMListView() { } void PIMListView::set( Opie::OPimTodoAccess::List list ) { /* clear first and then add new items */ clear(); Opie::OPimTodoAccess::List::Iterator it; for (it = list.begin(); it != list.end(); ++it ) { /* * make a new item which automatically gets added to the listview * and call the copy c'tor to create a new OPimTodo */ PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimTodo( *it ) ); i->setText(0, (*it).summary() ); } } -void PIMListView::set( const Opie::OEffectiveEvent::ValueList& lst ) { +void PIMListView::set( const Opie::OPimOccurrence::List& lst ) { /* clear first and then add items */ clear(); - Opie::OEffectiveEvent::ValueList::ConstIterator it; + Opie::OPimOccurrence::List::ConstIterator it; for ( it = lst.begin(); it != lst.end(); ++it ) { - PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).event() ) ); + PIMListViewItem *i = new PIMListViewItem(this, new Opie::OPimEvent( (*it).toEvent() ) ); i->setText( 0, PIMListView::makeString( (*it) ) ); } } void PIMListView::showCurrentRecord() { /* it could be possible that their is no currentItem */ if (!currentItem() ) return; /* * we only add PIMListViewItems so it is save * to do this case. If this would not be the case * use rtti() to check in a switch() case */ PIMListViewItem *item = static_cast<PIMListViewItem*>( currentItem() ); /* finally you see how to emit a signal */ emit showRecord( (*item->record() ) ); } -QString PIMListView::makeString( const Opie::OEffectiveEvent& ev ) { +QString PIMListView::makeString( const Opie::OPimOccurrence& _ev ) { QString str; - str += ev.description(); - if ( !ev.event().isAllDay() ) { + str += _ev.summary(); + + Opie::OPimEvent ev = _ev.toEvent(); + if ( !ev.isAllDay() ) { +#if 0 if ( ev.startDate() != ev.endDate() ) { - str += tr("Start ") + TimeString::timeString( ev.event().startDateTime().time() ); - str += " - " + TimeString::longDateString( ev.startDate() ); - str += tr("End ") + TimeString::timeString( ev.event().endDateTime().time() ); - str += " - " + TimeString::longDateString( ev.endDate() ); - }else{ - str += tr("Time ") + TimeString::timeString( ev.startTime() ); - str += " - " + TimeString::timeString( ev.endTime() ); + str += tr("Start ") + TimeString::timeString( ev.startDateTime().time() ); + str += " - " + TimeString::longDateString( ev.startDateTime().date() ); + str += tr("End ") + TimeString::timeString( ev.endDateTime().time() ); + str += " - " + TimeString::longDateString( ev.endDateTime().date() ); + }else +#endif + { + str += tr("Time ") + TimeString::timeString( _ev.startTime() ); + str += " - " + TimeString::timeString( _ev.endTime() ); } }else str += tr(" This is an All-Day Event"); return str; } |