author | zautrix <zautrix> | 2005-06-08 10:56:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-08 10:56:24 (UTC) |
commit | 2448916479b456ca7c880427a80e8e32e95b2fba (patch) (side-by-side diff) | |
tree | 83be907f0eccb43ffc44a7f1bc07995c32760cb5 /korganizer | |
parent | 793d117812b4da36c9c11d90cccba347cbc6e208 (diff) | |
download | kdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.zip kdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.tar.gz kdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.tar.bz2 |
more type API changes
-rw-r--r-- | korganizer/incomingdialog.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 14 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 12 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 4 | ||||
-rw-r--r-- | korganizer/outgoingdialog.cpp | 12 |
6 files changed, 29 insertions, 29 deletions
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index 50e3077..fe78356 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp @@ -169,25 +169,25 @@ void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) void IncomingDialog::retrieve() { QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); ScheduleMessage *message; for(message = messages.first();message;message = messages.next()) { IncidenceBase *inc = message->event(); Scheduler::Method method = (Scheduler::Method)message->method(); ScheduleMessage::Status status = message->status(); ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); - if(inc->type()!="FreeBusy") { + if(inc->typeID() != freebusyID ) { Incidence *incidence = static_cast<Incidence *>(inc); ScheduleItemVisitor v(item); if (!incidence->accept(v)) delete item; } else { FreeBusy *fb = static_cast<FreeBusy *>(item->event()); item->setText(0, "FreeBusy"); item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); item->setText(5, fb->organizer()); } @@ -246,25 +246,25 @@ void IncomingDialog::rejectMessage() { ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); if (item) { mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); } } void IncomingDialog::showEvent(QListViewItem *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); - if( incidence && incidence->type() == "Event" ) { + if( incidence && incidence->typeID() == eventID ) { Event *event = static_cast<Event *>(incidence); KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); eventViewer->setEvent(event); eventViewer->show(); } } bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) { Event *ev = mCalendar->event(item->event()->uid()); if (ev) { //user interaction before?? @@ -281,25 +281,25 @@ bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeCounter(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); // currently only events supportet - attetion at insertion below! - if ( incidence->type() != "Event" ) return false; + if ( incidence->typeID() != eventID ) return false; Event *counterEvent = static_cast<Event *>( incidence ); Event *even = mCalendar->event(counterEvent->uid()); KOCounterDialog *eventViewer = new KOCounterDialog(this); eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>")); eventViewer->addEvent(counterEvent); eventViewer->addText("<hr>"); eventViewer->addText(i18n("<b>Original event:</b><p>")); if (even) eventViewer->addEvent(even); else eventViewer->addText(i18n("A corresponding event is missing in your calendar!")); @@ -359,25 +359,25 @@ bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) emit numMessagesChanged(mMessageListView->childCount()); return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeAdd(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); - if (incidence->type() == "Event" ) { + if (incidence->typeID() == eventID ) { Event *refr = static_cast<Event *>( incidence ); mOutgoing->addMessage(refr,Scheduler::Refresh); mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); @@ -393,25 +393,25 @@ bool IncomingDialog::incomeDefault(ScheduleItemIn *item) return true; } else { KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; return false; } return false; } bool IncomingDialog::incomeRequest(ScheduleItemIn *item) { - if (item->event()->type()=="FreeBusy") { + if (item->event()->typeID() == freebusyID ) { //handel freebusy request IncidenceBase *inc = item->event(); QDateTime start = inc->dtStart(); QDateTime end = start.addDays(inc->duration()/86400); FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); freebusy->setOrganizer(inc->organizer()); Attendee *att = new Attendee(KOPrefs::instance()->fullName(), KOPrefs::instance()->email()); freebusy->addAttendee(att); kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " @@ -428,25 +428,25 @@ bool IncomingDialog::incomeRequest(ScheduleItemIn *item) } else { return incomeDefault(item); } return false; } bool IncomingDialog::automaticAction(ScheduleItemIn *item) { bool autoAction = false; IncidenceBase *inc = item->event(); Scheduler::Method method = item->method(); - if( inc->type()=="FreeBusy" ) { + if( inc->typeID() == freebusyID ) { if ( method==Scheduler::Request ) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // reply freebusy information if ( checkOrganizerInAddressbook(inc->organizer()) ) { incomeRequest(item); } } else return false; } else { if ( method==Scheduler::Reply ) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // insert freebusy information @@ -456,25 +456,25 @@ bool IncomingDialog::automaticAction(ScheduleItemIn *item) } else { if ( method==Scheduler::Publish) { if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { // insert freebusy information //if ( checkOrganizerInAddressbook(inc->organizer()) ) } } else return false; } } } - if ( inc->type()=="Event" ) { + if ( inc->typeID() == eventID ) { if ( method==Scheduler::Request || method==Scheduler::Publish ) { if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) { // insert event if ( checkOrganizerInAddressbook(inc->organizer()) ) autoAction = acceptMessage(item); } else return false; } else { if ( method==Scheduler::Reply ) { if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) { // update event information if ( checkAttendeesInAddressbook(inc) ) diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1320a2e..b2b136a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -572,25 +572,25 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : } void KOAgendaView::toggleAllDay() { if ( mSplitterAgenda->firstHandle() ) mSplitterAgenda->firstHandle()->toggle(); } void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) { calendar()->addIncidence( inc ); if ( incOld ) { - if ( incOld->type() == "Todo" ) + if ( incOld->typeID() == todoID ) emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); else emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); } } KOAgendaView::~KOAgendaView() { delete mAllAgendaPopup; //delete mAllDayAgendaPopup; delete KOAgendaItem::paintPix(); @@ -958,49 +958,49 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) if ( mMaxY.at(xxx) < item->cellYBottom() ) mMaxY.at(xxx) = item->cellYBottom(); QDateTime startDt,endDt; QDate startDate; int lenInSecs; // if ( type == KOAgenda::RESIZETOP ) // qDebug("RESIZETOP "); // if ( type == KOAgenda::RESIZEBOTTOM ) // qDebug("RESIZEBOTTOM "); // if ( type == KOAgenda::MOVE ) // qDebug("MOVE "); - if ( item->incidence()->type() == "Event" ) { + if ( item->incidence()->typeID() == eventID ) { startDt =item->incidence()->dtStart(); endDt = item->incidence()->dtEnd(); lenInSecs = startDt.secsTo( endDt ); } // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); - if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { + if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) { startDate = mSelectedDates[item->mLastMoveXPos]; } else { if (item->cellX() < 0) { startDate = (mSelectedDates.first()).addDays(item->cellX()); } else { startDate = mSelectedDates[item->cellX()]; } } startDt.setDate(startDate); if (item->incidence()->doesFloat()) { endDt.setDate(startDate.addDays(item->cellWidth() - 1)); } else { if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) startDt.setTime(mAgenda->gyToTime(item->cellYTop())); - if ( item->incidence()->type() == "Event" ) { + if ( item->incidence()->typeID() == eventID ) { if ( type == KOAgenda::MOVE ) { endDt = startDt.addSecs(lenInSecs); } else if ( type == KOAgenda::RESIZEBOTTOM ) { if (item->lastMultiItem()) { endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); endDt.setDate(startDate); } @@ -1012,42 +1012,42 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) endDt.setDate(startDate. addDays(item->lastMultiItem()->cellX() - item->cellX())); } else { //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); if ( item->cellYBottom() > 0 ) endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); else endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); endDt.setDate(startDate); } } } - if ( item->incidence()->type() == "Event" ) { + if ( item->incidence()->typeID() == eventID ) { item->incidence()->setDtStart(startDt); (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); - } else if ( item->incidence()->type() == "Todo" ) { + } else if ( item->incidence()->typeID() == todoID ) { Todo* to = static_cast<Todo*>(item->incidence()); to->setDtDue(endDt); if ( to->hasStartDate() ) { if (to->dtStart() >= to->dtDue() ) to->setDtStart(to->dtDue().addDays( -2 )); } } //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); item->incidence()->setRevision(item->incidence()->revision()+1); item->setItemDate(startDt.date()); //item->updateItem(); - if ( item->incidence()->type() == "Todo" ) { + if ( item->incidence()->typeID() == todoID ) { emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); } else emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); item->updateItem(); } void KOAgendaView::showDates( const QDate &start, const QDate &end ) { // kdDebug() << "KOAgendaView::selectDates" << endl; diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index e165017..dea8981 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -862,25 +862,25 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) mMonthly->setFrequency( 1 ); mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); mMonthly->setByDay( from.date().day()-1 ); mYearly->setFrequency( 1 ); mYearly->setByDay( from.date().dayOfYear() ); mYearly->setByMonth( from.date().month(), from.date().day() ); } void KOEditorRecurrence::readEvent(Incidence *event) { QDateTime dtEnd; - if ( event->type() == "Event" ) + if ( event->typeID() == eventID ) dtEnd = ((Event*)event)->dtEnd(); else dtEnd = ((Todo*)event)->dtDue(); setDefaults( event->dtStart(), dtEnd, true ); QBitArray rDays( 7 ); QPtrList<Recurrence::rMonthPos> rmp; QPtrList<int> rmd; int day = 0; int count = 0; int month = 0; setDateTimes( event->dtStart(), dtEnd ); diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index e5ff8af..02f13c7 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp @@ -139,38 +139,38 @@ void KOEventViewerDialog::updateConfig() void KOEventViewerDialog::setEvent(Event *event) { mEventViewer->setEvent(event); mIncidence = event; mEventViewer->setFocus(); //findButton( Close )->setFocus(); if ( !mSyncMode ) { findButton( User1 )->setText( i18n("Agenda")); } } void KOEventViewerDialog::setIncidence(Incidence *in ) { - if ( in->type() == "Event" ) + if ( in->typeID() == eventID ) setEvent( (Event*) in ); - else if ( in->type() =="Todo" ) + else if ( in->typeID() == todoID ) setTodo( (Todo*) in ); - else if ( in->type() =="Journal" ) + else if ( in->typeID() == journalID ) setJournal( (Journal*) in ); } void KOEventViewerDialog::addIncidence(Incidence *in) { - if ( in->type() == "Event" ) + if ( in->typeID() == eventID ) addEvent( (Event*) in ); - else if ( in->type() =="Todo" ) + else if ( in->typeID() == todoID ) mEventViewer->setTodo( (Todo*) in, false ); - else if ( in->type() =="Journal" ) + else if ( in->typeID() == journalID ) mEventViewer->setJournal( (Journal*) in, false ); if ( mSyncMode ) { findButton( User1 )->setFocus(); setCaption(i18n("Conflict! Please choose entry")); } } void KOEventViewerDialog::addEvent(Event *event) { mEventViewer->addEvent(event); mIncidence = event; mEventViewer->setFocus(); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 678cab6..c868270 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -373,25 +373,25 @@ void MonthViewItem::paint(QPainter *p) p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); } if ( mMultiday == 3 ) { // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); } x += sizeM/2 + 1; x += sizeM + 1; } - if ( mIncidence->type() == "Todo" ){ + if ( mIncidence->typeID() == todoID ){ Todo* td = ( Todo* ) mIncidence; if ( td->isCompleted() ) { int half = size/2; p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; x += half+half + 4; } else { int val = td->percentComplete()/20; p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); p->drawRect ( x, y-2,7,size+4); x += size + 3; @@ -1934,25 +1934,25 @@ void KOMonthView::computeLayout() //mWeekLabels[mNumWeeks]->setText( i18n("W")); } void KOMonthView::showContextMenu( Incidence *incidence ) { if( incidence ) mContextMenu->showIncidencePopup(incidence); else { //qDebug("KOMonthView::showContextMenu "); mNewItemMenu->popup(QCursor::pos()); } /* - if( incidence && incidence->type() == "Event" ) { + if( incidence && incidence->typeID() == eventID ) { Event *event = static_cast<Event *>(incidence); mContextMenu->showEventPopup(event); } else { kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; } */ } MonthViewCell * KOMonthView::selectedCell( ) { return mSelectedCell; } void KOMonthView::setSelectedCell( MonthViewCell *cell ) diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp index 0fc90c4..7253c8e 100644 --- a/korganizer/outgoingdialog.cpp +++ b/korganizer/outgoingdialog.cpp @@ -46,76 +46,76 @@ ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, Scheduler::Method method, const QString &recipients) : QListViewItem(parent) { mIncidence = ev; mMethod = method; mRecipients = recipients; // kdDebug() << "ScheduleItemOut: setting the summary" << endl; //Set the summary - if(ev->type() != "FreeBusy") { + if(ev->typeID() != freebusyID ) { Incidence *incidence = static_cast<Incidence *>(ev); setText(0,incidence->summary()); } else { setText(0,i18n("Free Busy Object")); } // kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; //If the object is an event - if(ev->type()=="Event") { + if(ev->typeID()== eventID ) { Event *event = static_cast<Event *>(ev); setText(1,event->dtStartDateStr()); if (event->doesFloat()) { //If the event floats set the start and end times to no time setText(2,i18n("no time")); setText(4,i18n("no time")); } else { //If it does not float setText(2,event->dtStartTimeStr()); if (event->hasDuration()) { setText(4,event->dtEndTimeStr()); } else { setText(4,i18n("no time")); } } if (event->hasEndDate()) { setText(3,event->dtEndDateStr()); } else { setText(3,i18n("no time")); } } //If the object is an Todo - if(ev->type()=="Todo") { + if(ev->typeID() == todoID ) { Todo *event = static_cast<Todo *>(ev); if (event->hasStartDate()) { setText(1,event->dtStartDateStr()); if (!event->doesFloat()) { setText(2,event->dtStartTimeStr()); } } if (event->hasDueDate()) { setText(3,event->dtDueDateStr()); if (!event->doesFloat()) { setText(4,event->dtDueTimeStr()); } } } // kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl; //If the object is a freebusy object - if(ev->type() == "FreeBusy") { + if(ev->typeID() == freebusyID ) { FreeBusy *freebusy = static_cast<FreeBusy *>(ev); setText(1,freebusy->dtStartDateStr()); setText(2,freebusy->dtStartTimeStr()); //Must try and get this to the users local settings setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); } // kdDebug() << "ScheduleItemOut: Setting the method" << endl; //Set the Method setText(5,Scheduler::translatedMethodName(mMethod)); @@ -232,28 +232,28 @@ void OutgoingDialog::deleteItem() return; deleteMessage(item->event()); delete(item->event()); mMessageListView->takeItem(item); emit numMessagesChanged(mMessageListView->childCount()); } void OutgoingDialog::showEvent(QListViewItem *qitem) { ScheduleItemOut *item = (ScheduleItemOut *)qitem; Event *event = 0; Todo *todo = 0; - if ( item->event()->type()=="Event" ) { + if ( item->event()->typeID() == eventID ) { event = static_cast<Event *>(item->event()); } - if ( item->event()->type()=="Todo" ) { + if ( item->event()->typeID() == todoID ) { todo = static_cast<Todo *>(item->event()); } QString sendText; if (event || todo) { KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); if (event) eventViewer->setEvent(event); if (todo) eventViewer->setTodo(todo); sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; switch (item->method()) { case Scheduler::Publish: { sendText += item->recipients(); break; } |