summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-08 10:34:22 (UTC)
committer zautrix <zautrix>2005-06-08 10:34:22 (UTC)
commit793d117812b4da36c9c11d90cccba347cbc6e208 (patch) (side-by-side diff)
tree5bc77e2b7a32a541c2a3b3c3d6d50f873216deef /korganizer
parent39d84e2fc3099bd5d7596e8be5dc6783826cec01 (diff)
downloadkdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.zip
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.gz
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.bz2
changed incidence type to a faster access method
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp62
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp16
-rw-r--r--korganizer/kolistview.cpp12
-rw-r--r--korganizer/kotodoview.cpp4
-rw-r--r--korganizer/kowhatsnextview.cpp10
-rw-r--r--korganizer/mainwindow.cpp10
7 files changed, 59 insertions, 59 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 720ad78..7c7466b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -157,39 +157,39 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
#ifdef DESKTOP_VERSION
mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
#else
mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
#endif
//mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
Incidence * inc = getNextInc( start );
int time = 0;
//mText += "<table>";
while ( inc ) {
QDateTime dt ;
QString tempText = "<a ";
bool ok;
dt = inc->getNextOccurence( start, &ok );
if ( !ok ) continue;
- if ( inc->type() == "Event" ) {
+ if ( inc->typeID() == eventID ) {
tempText += "href=\"event:";
- } else if ( inc->type() == "Todo" ) {
+ } else if ( inc->typeID() == todoID ) {
tempText += "href=\"todo:";
}
tempText += inc->uid() + "\">";
- if ( inc->type() == "Todo" )
+ if ( inc->typeID() == todoID )
tempText += i18n("Todo: ");
if ( inc->summary().length() > 0 )
tempText += inc->summary();
else
tempText += i18n("-no summary-");
QString timestr;
if (!inc->doesFloat())
timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
else
timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
if ( dt.date() < QDate::currentDate() && time == 0 ) {
mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
mText += "<table>";
time = 1;
}
if ( dt.date() == QDate::currentDate() && time <= 1 ) {
@@ -960,38 +960,38 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
full = true;
if ( mode < SYNC_PREF_ASK )
mode = SYNC_PREF_ASK;
} else {
if ( localMod == remoteMod )
// if ( local->revision() == remote->revision() )
return 0;
}
// qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
//qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
//qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
//full = true; //debug only
if ( full ) {
bool equ = false;
- if ( local->type() == "Event" ) {
+ if ( local->typeID() == eventID ) {
equ = (*((Event*) local) == *((Event*) remote));
}
- else if ( local->type() =="Todo" )
+ else if ( local->typeID() == todoID )
equ = (*((Todo*) local) == (*(Todo*) remote));
- else if ( local->type() =="Journal" )
+ else if ( local->typeID() == journalID )
equ = (*((Journal*) local) == *((Journal*) remote));
if ( equ ) {
//qDebug("equal ");
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
}
if ( mode < SYNC_PREF_FORCE_LOCAL )
return 0;
}//else //debug only
//qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
}
int result;
bool localIsNew;
//qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
@@ -1086,43 +1086,43 @@ Event* CalendarView::getLastSyncEvent()
lse->setReadOnly( true );
mCalendar->addEvent( lse );
}
return lse;
}
// we check, if the to delete event has a id for a profile
// if yes, we set this id in the profile to delete
void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
{
if ( lastSync.count() == 0 ) {
//qDebug(" lastSync.count() == 0");
return;
}
- if ( toDelete->type() == "Journal" )
+ if ( toDelete->typeID() == journalID )
return;
Event* eve = lastSync.first();
while ( eve ) {
QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
if ( !id.isEmpty() ) {
QString des = eve->description();
QString pref = "e";
- if ( toDelete->type() == "Todo" )
+ if ( toDelete->typeID() == todoID )
pref = "t";
des += pref+ id + ",";
eve->setReadOnly( false );
eve->setDescription( des );
//qDebug("setdes %s ", des.latin1());
eve->setReadOnly( true );
}
eve = lastSync.next();
}
}
void CalendarView::checkExternalId( Incidence * inc )
{
QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
checkExternSyncEvent( lastSync, inc );
@@ -1273,33 +1273,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( mSyncManager->syncWithDesktop() )
inL->setPilotId( pid );
inL->setIDStr( idS );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
}
local->addIncidence( inL );
++changedLocal;
}
}
} else { // no conflict ********** add or delete remote
if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
QString des = eventLSync->description();
QString pref = "e";
- if ( inR->type() == "Todo" )
+ if ( inR->typeID() == todoID )
pref = "t";
if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
++deletedEventR;
} else {
inR->setLastModified( modifiedCalendar );
inL = inR->clone();
inL->setIDStr( ":" );
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
local->addIncidence( inL );
++addedEvent;
}
} else {
@@ -1330,33 +1330,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
bar.setTotalSteps ( el.count() ) ;
bar.show();
incCounter = 0;
while ( inL ) {
qApp->processEvents();
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inL->uid();
bool skipIncidence = false;
if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidence( uid );
if ( ! inR ) {
if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
// no conflict ********** add or delete local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! mSyncManager->mWriteBackExistingOnly ) {
inL->removeID(mCurrentSyncDevice );
++addedEventR;
//qDebug("remote added Incidence %s ", inL->summary().latin1());
@@ -1386,40 +1386,40 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
++filteredOUT;
}
}
}
inL = el.next();
}
int delFut = 0;
int remRem = 0;
if ( mSyncManager->mWriteBackInFuture ) {
er = remote->rawIncidences();
remRem = er.count();
inR = er.first();
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
while ( inR ) {
- if ( inR->type() == "Todo" ) {
+ if ( inR->typeID() == todoID ) {
Todo * t = (Todo*)inR;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
- else if (inR->type() == "Event" ) {
+ else if (inR->typeID() == eventID ) {
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
else
dt = inR->dtStart();
if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
++delFut;
}
inR = er.next();
}
}
bar.hide();
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
@@ -2464,54 +2464,54 @@ void CalendarView::updateUnmanagedViews()
int CalendarView::msgItemDelete(const QString name)
{
return KMessageBox::warningContinueCancel(this,name +"\n\n"+
i18n("This item will be\npermanently deleted."),
i18n("KO/Pi Confirmation"),i18n("Delete"));
}
void CalendarView::edit_cut()
{
Event *anEvent=0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
factory.cutIncidence(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
}
void CalendarView::edit_copy()
{
Event *anEvent=0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
factory.copyIncidence(anEvent);
}
void CalendarView::edit_paste()
{
QDate date = mNavigator->selectedDates().first();
@@ -2537,64 +2537,64 @@ void CalendarView::edit_options()
qDebug("KO: Timezone change ");
openCalendar( MainWindow::defaultFileName() );
setModified(true);
}
else
qDebug("KO: No tz change ");
}
void CalendarView::slotSelectPickerDate( QDate d)
{
mDateFrame->hide();
if ( mDatePickerMode == 1 ) {
mNavigator->slotDaySelect( d );
} else if ( mDatePickerMode == 2 ) {
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
QTime tim;
int len = 0;
if ( to->hasStartDate() && to->hasDueDate() )
len = to->dtStart().secsTo( to->dtDue());
if ( to->hasDueDate() )
tim = to->dtDue().time();
else {
tim = QTime ( 0,0,0 );
to->setFloats( true );
to->setHasDueDate( true );
}
QDateTime dt ( d,tim );
to->setDtDue( dt );
if ( to->hasStartDate() ) {
if ( len>0 )
to->setDtStart(to->dtDue().addSecs( -len ));
else
if (to->dtStart() > to->dtDue() )
to->setDtStart(to->dtDue().addDays( -3 ));
}
todoChanged( to );
} else {
if ( mMoveIncidence->doesRecur() ) {
#if 0
// PENDING implement this
Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
mCalendar()->addIncidence( newInc );
- if ( mMoveIncidence->type() == "Todo" )
+ if ( mMoveIncidence->typeID() == todoID )
emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
mMoveIncidence = newInc;
#endif
}
QTime tim = mMoveIncidence->dtStart().time();
int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
QDateTime dt ( d,tim );
mMoveIncidence->setDtStart( dt );
((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
}
mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
@@ -2754,33 +2754,33 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
void CalendarView::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
topLevelWidget()->raise();
}
void CalendarView::moveIncidence(Incidence * inc )
{
if ( !inc ) return;
showDatePickerPopup();
mDatePickerMode = 2;
mMoveIncidence = inc ;
QDate da;
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
if ( to->hasDueDate() )
da = to->dtDue().date();
else
da = QDate::currentDate();
} else {
da = mMoveIncidence->dtStart().date();
}
//PENDING set date for recurring incidence to date of recurrence
//mMoveIncidenceOldDate;
mDatePicker->setDate( da );
}
void CalendarView::showDatePickerPopup()
{
if ( mDateFrame->isVisible() )
mDateFrame->hide();
@@ -2887,33 +2887,33 @@ void CalendarView::toggleCancelIncidence()
cancelIncidence(incidence);
}
}
void CalendarView::cancelIncidence(Incidence * inc )
{
inc->setCancelled( ! inc->cancelled() );
changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
updateView();
}
void CalendarView::cloneIncidence(Incidence * orgInc )
{
Incidence * newInc = orgInc->clone();
newInc->recreate();
- if ( newInc->type() == "Todo" ) {
+ if ( newInc->typeID() == todoID ) {
Todo* t = (Todo*) newInc;
bool cloneSub = false;
if ( orgInc->relations().count() ) {
int result = KMessageBox::warningYesNoCancel(this,
i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
i18n("Todo has subtodos"),
i18n("Yes"),
i18n("No"));
if ( result == KMessageBox::Cancel ) {
delete t;
return;
}
if (result == KMessageBox::Yes) cloneSub = true;
}
showTodoEditor();
@@ -3151,73 +3151,73 @@ void CalendarView::showJournal( Journal *jour )
// // kdDebug() << "Todo modified and open" << endl;
// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
// // temp->modified (changed);
// // }
// mViewManager->updateView();
// }
void CalendarView::appointment_show()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
showEvent(anEvent);
}
void CalendarView::appointment_edit()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
editEvent(anEvent);
}
void CalendarView::appointment_delete()
{
Event *anEvent = 0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
deleteEvent(anEvent);
}
void CalendarView::todo_resub( Todo * parent, Todo * sub )
{
if (!sub) return;
if ( sub->relatedTo() == parent )
@@ -3392,33 +3392,33 @@ void CalendarView::action_mail()
Incidence *incidence = currentSelection();
if (!incidence) {
KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
return;
}
if(incidence->attendeeCount() == 0 ) {
KMessageBox::sorry(this,
i18n("Can't generate mail:\nNo attendees defined.\n"));
return;
}
CalendarLocal cal_tmp;
Event *event = 0;
Event *ev = 0;
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
ev = new Event(*event);
cal_tmp.addEvent(ev);
}
ICalFormat mForm();
QString attachment = mForm.toString( &cal_tmp );
if (ev) delete(ev);
mailClient.mailAttendees(currentSelection(), attachment);
#endif
#if 0
Event *anEvent = 0;
if (mViewManager->currentView()->isEventView()) {
anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
@@ -3437,36 +3437,36 @@ void CalendarView::action_mail()
mailobject.emailEvent(anEvent);
#endif
}
void CalendarView::schedule_publish(Incidence *incidence)
{
Event *event = 0;
Todo *todo = 0;
if (incidence == 0) {
incidence = mViewManager->currentView()->selectedIncidences().first();
if (incidence == 0) {
incidence = mTodoList->selectedIncidences().first();
}
}
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
} else {
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
todo = static_cast<Todo *>(incidence);
}
}
if (!event && !todo) {
KMessageBox::sorry(this,i18n("No event selected."));
return;
}
PublishDialog *publishdlg = new PublishDialog();
if (incidence->attendeeCount()>0) {
QPtrList<Attendee> attendees = incidence->attendees();
attendees.first();
while ( attendees.current()!=0 ) {
publishdlg->addAttendee(attendees.current());
attendees.next();
@@ -3552,36 +3552,36 @@ void CalendarView::schedule_publish_freebusy(int daysToPublish)
}
}
delete publishdlg;
}
void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
{
Event *event = 0;
Todo *todo = 0;
if (incidence == 0) {
incidence = mViewManager->currentView()->selectedIncidences().first();
if (incidence == 0) {
incidence = mTodoList->selectedIncidences().first();
}
}
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
}
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
todo = static_cast<Todo *>(incidence);
}
if (!event && !todo) {
KMessageBox::sorry(this,i18n("No event selected."));
return;
}
if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
KMessageBox::sorry(this,i18n("The event has no attendees."));
return;
}
Event *ev = 0;
if (event) ev = new Event(*event);
Todo *to = 0;
@@ -3759,71 +3759,71 @@ void CalendarView::processMainViewSelection( Incidence *incidence )
void CalendarView::processTodoListSelection( Incidence *incidence )
{
if ( incidence && mViewManager->currentView() ) {
mViewManager->currentView()->clearSelection();
}
processIncidenceSelection( incidence );
}
void CalendarView::processIncidenceSelection( Incidence *incidence )
{
if ( incidence == mSelectedIncidence ) return;
mSelectedIncidence = incidence;
emit incidenceSelected( mSelectedIncidence );
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
Event *event = static_cast<Event *>( incidence );
if ( event->organizer() == KOPrefs::instance()->email() ) {
emit organizerEventsSelected( true );
} else {
emit organizerEventsSelected(false);
}
if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email() ) ) {
emit groupEventsSelected( true );
} else {
emit groupEventsSelected(false);
}
return;
} else {
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
Todo *event = static_cast<Todo *>( incidence );
if ( event->organizer() == KOPrefs::instance()->email() ) {
emit organizerEventsSelected( true );
} else {
emit organizerEventsSelected(false);
}
if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email() ) ) {
emit groupEventsSelected( true );
} else {
emit groupEventsSelected(false);
}
return;
} else {
emit todoSelected( false );
emit organizerEventsSelected(false);
emit groupEventsSelected(false);
}
return;
}
- /* if ( incidence && incidence->type() == "Todo" ) {
+ /* if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
} else {
emit todoSelected( false );
}*/
}
void CalendarView::checkClipboard()
{
#ifndef KORG_NODND
if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
emit pasteEnabled(true);
} else {
emit pasteEnabled(false);
}
#endif
@@ -4052,38 +4052,38 @@ void CalendarView::toggleExpand()
//qDebug(" CalendarView::toggleExpand()");
globalFlagBlockAgenda = 1;
emit calendarViewExpanded( !mLeftFrame->isHidden() );
globalFlagBlockAgenda = 5;
mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
//mViewManager->showView( 0, true );
}
void CalendarView::calendarModified( bool modified, Calendar * )
{
setModified( modified );
}
Todo *CalendarView::selectedTodo()
{
Incidence *incidence = currentSelection();
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
return static_cast<Todo *>( incidence );
}
incidence = mTodoList->selectedIncidences().first();
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
return static_cast<Todo *>( incidence );
}
return 0;
}
void CalendarView::dialogClosing(Incidence *in)
{
// mDialogList.remove(in);
}
void CalendarView::showIncidence()
{
mViewerCallerIsSearchDialog = false;
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2a2acb1..fc213d8 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -740,33 +740,33 @@ void KOAgenda::startItemAction(QPoint viewportPos)
int gridDistanceX = (x - gx * mGridSpacingX);
if (gridDistanceX < mResizeBorderWidth &&
mActionItem->cellX() == mCurrentCellX) {
mActionType = RESIZELEFT;
setCursor(sizeHorCursor);
} else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
mActionItem->cellXWidth() == mCurrentCellX) {
mActionType = RESIZERIGHT;
setCursor(sizeHorCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
setCursor(sizeAllCursor);
}
} else {
int gridDistanceY = (y - gy * mGridSpacingY);
- bool allowResize = ( mActionItem->incidence()->type() != "Todo" );
+ bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
if (allowResize && gridDistanceY < mResizeBorderWidth &&
mActionItem->cellYTop() == mCurrentCellY &&
!mActionItem->firstMultiItem()) {
mActionType = RESIZETOP;
setCursor(sizeVerCursor);
} else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
mActionItem->cellYBottom() == mCurrentCellY &&
!mActionItem->lastMultiItem()) {
mActionType = RESIZEBOTTOM;
setCursor(sizeVerCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
setCursor(sizeAllCursor);
}
}
@@ -899,33 +899,33 @@ void KOAgenda::endItemAction()
if ( !placeItem ) {
placeItem = mActionItem;
}
if ( placeItem->incidence()->recurrence()->doesRecur() ) {
Incidence* oldInc = placeItem->incidence();
placeItem->recreateIncidence();
emit addToCalSignal(placeItem->incidence(), oldInc );
}
int type = mActionType;
if ( mAllDayMode )
type = -1;
KOAgendaItem *modifiedItem = placeItem;
//emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
KOAgendaItem *item;
- if ( placeItem->incidence()->type() == "Todo" ) {
+ if ( placeItem->incidence()->typeID() == todoID ) {
mSelectedItem = 0;
//qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
modifiedItem->mLastMoveXPos = mCurrentCellX;
emit itemModified( modifiedItem, mActionType );
}
else {
globalFlagBlockAgendaItemPaint = 1;
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
placeSubCells(item);
}
while ( placeItem ) {
//qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
oldconflictItems = placeItem->conflictItems();
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df2e478..5a3c4d2 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -93,51 +93,51 @@ QString KOAgendaItem::getWhatsThisText()
if ( mIncidence )
return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return "KOAgendaItem::getWhatsThisText()::internal error";
}
void KOAgendaItem::init ( Incidence *incidence, QDate qd )
{
mIncidence = incidence;
mDate = qd;
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
- if ( (incidence->type() == "Todo") &&
+ if ( (incidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(incidence))->isCompleted()) &&
((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
QString cat = categories.first();
if (cat.isEmpty()) {
- if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
+ if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
mBackgroundColor =KOPrefs::instance()->mEventColor;
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
- if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
+ if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
}
}
}
mColorGroup = QColorGroup( mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
setBackgroundColor( mBackgroundColor );
mConflictItems.clear();
setCellXY(0,0,1);
setCellXWidth(0);
setSubCell(0);
setSubCells(1);
@@ -346,33 +346,33 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
bool small = ( h < maxhei );
if ( ! small )
paint->setFont(KOPrefs::instance()->mAgendaViewFont);
else {
QFont f = KOPrefs::instance()->mAgendaViewFont;
f.setBold( false );
int fh = f.pointSize();
nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
if ( nfh < 6 )
nfh = 6;
f.setPointSize( nfh );
paint->setFont(f);
}
paint->fillRect ( x, yy, w, h, mBackgroundColor );
static const QPixmap completedPxmp = SmallIcon("greenhook16");
static const QPixmap overduePxmp = SmallIcon("redcross16");
- if ( mIncidence->type() == "Todo" ) {
+ if ( mIncidence->typeID() == todoID ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
int xx = pos().x()+(width()-completedPxmp.width()-3 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
paint->drawPixmap ( xx, yyy, completedPxmp );
else {
paint->drawPixmap ( xx, yyy, overduePxmp );
}
}
bool addIcon = false;
if ( ! small || w > 3 * h || h > 3* w )
addIcon = updateIcons( paint, horLayout );
qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
//qDebug("draw rect %d %d %d %d ",x, yy, w, h );
@@ -527,81 +527,81 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
return;
}
}
if ( paintFrom->width() < xx+rw ) {
rw = paintFrom->width() - xx;
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
return;
}
}
//qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
}
void KOAgendaItem::computeText()
{
mDisplayedText = mIncidence->summary();
- if ( (mIncidence->type() == "Todo") ) {
+ if ( (mIncidence->typeID() == todoID ) ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
}
} else {
if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
if ( mAllDay ) {
if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
if ( mIncidence->doesRecur() ) {
mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
} else {
mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
}
}
}
}
if ( !mIncidence->location().isEmpty() ) {
if ( mAllDay )
mDisplayedText += " (";
else
mDisplayedText += "\n(";
mDisplayedText += mIncidence->location() +")";
}
#ifdef DESKTOP_VERSION
QString tipText = mIncidence->summary();
if ( !mIncidence->doesFloat() ) {
- if ( mIncidence->type() == "Event" ) {
+ if ( mIncidence->typeID() == eventID ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
}
else {
tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
}
}
- else if ( mIncidence->type() == "Todo" ) {
+ else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
}
- } else if ( mIncidence->type() == "Todo" ) {
+ } else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
}
if (!mIncidence->location().isEmpty()) {
tipText += "\n"+i18n("Location: ")+mIncidence->location();
}
QToolTip::add(this,tipText,toolTipGroup(),"");
#endif
}
void KOAgendaItem::updateItem()
{
computeText();
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7022e02..be51694 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -387,34 +387,34 @@ void KOListView::addCat( )
}
void KOListView::setCat()
{
setCategories( true );
}
void KOListView::setAlarm()
{
KOAlarmPrefs kap( this);
if ( !kap.exec() )
return;
QStringList itemList;
QPtrList<KOListViewItem> sel ;
QListViewItem *qitem = mListView->firstChild ();
while ( qitem ) {
if ( qitem->isSelected() ) {
Incidence* inc = ((KOListViewItem *) qitem)->data();
- if ( inc->type() != "Journal" ) {
- if ( inc->type() == "Todo" ) {
+ if ( inc->typeID() != journalID ) {
+ if ( inc->typeID() == todoID ) {
if ( ((Todo*)inc)->hasDueDate() )
sel.append(((KOListViewItem *)qitem));
} else
sel.append(((KOListViewItem *)qitem));
}
}
qitem = qitem->nextSibling();
}
int count = 0;
KOListViewItem * item, *temp;
item = sel.first();
Incidence* inc;
while ( item ) {
inc = item->data();
++count;
if (kap.mAlarmButton->isChecked()) {
@@ -475,33 +475,33 @@ void KOListView::setCategories( bool removeOld )
QString categoriesStr = catList.join(",");
int i;
QStringList itemList;
QPtrList<KOListViewItem> sel ;
QListViewItem *qitem = mListView->firstChild ();
while ( qitem ) {
if ( qitem->isSelected() ) {
sel.append(((KOListViewItem *)qitem));
}
qitem = qitem->nextSibling();
}
KOListViewItem * item, *temp;
item = sel.first();
if( item ) {
Incidence* inc = item->data() ;
bool setSub = false;
- if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
+ if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
int result = KMessageBox::warningYesNoCancel(this,
i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
i18n("Todo has subtodos"),
i18n("Yes"),
i18n("No"));
if (result == KMessageBox::Cancel) item = 0;
if (result == KMessageBox::Yes) setSub = true;
}
while ( item ) {
inc = item->data();
if ( removeOld ) {
inc->setCategories( catList, setSub );
} else {
inc->addCategories( catList, setSub );
}
ListItemVisitor v(item, mStartDate );
@@ -598,43 +598,43 @@ void KOListView::saveDescriptionToFile()
bool createbup = true;
if ( info. exists() ) {
mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
i18n("Overwrite!"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
createbup = false;
}
}
if ( createbup ) {
QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
Incidence *incidence = delSel.first();
icount = 0;
while ( incidence ) {
- if ( incidence->type() == "Journal" ) {
+ if ( incidence->typeID() == journalID ) {
text += "\n************************************\n";
text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
++icount;
} else {
if ( !incidence->description().isEmpty() ) {
text += "\n************************************\n";
- if ( incidence->type() == "Todo" )
+ if ( incidence->typeID() == todoID )
text += i18n("To-Do: ");
text += incidence->summary();
if ( incidence->hasStartDate() )
text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
if ( !incidence->location().isEmpty() )
text += "\n" +i18n("Location: ") + incidence->location();
text += "\n" + i18n("Description: ") + "\n" + incidence->description();
++icount;
}
}
incidence = delSel.next();
}
QFile file( fn );
if (!file.open( IO_WriteOnly ) ) {
@@ -656,33 +656,33 @@ void KOListView::saveToFileVCS()
writeToFile( false );
}
void KOListView::saveToFile()
{
writeToFile( true );
}
void KOListView::writeToFile( bool iCal )
{
int icount = 0;
QPtrList<Incidence> delSel ;
QListViewItem *item = mListView->firstChild ();
bool journal = iCal; // warn only for vCal
while ( item ) {
if ( item->isSelected() ) {
if ( !journal )
- if ( ((KOListViewItem *)item)->data()->type() == "Journal")
+ if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
journal = true;
delSel.append(((KOListViewItem *)item)->data());
++icount;
}
item = item->nextSibling();
}
if ( !iCal && journal ) {
int result = KMessageBox::warningContinueCancel(this,
i18n("The journal entries can not be\nexported to a vCalendar file."),
i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
true);
if (result != KMessageBox::Continue) return;
}
if ( icount ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 5aaf360..2602487 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -689,33 +689,33 @@ void KOTodoView::updateView()
kdDebug() << " - relation: " << c->getSummary() << endl;
}
}
*/
// Put for each Event a KOTodoViewItem in the list view. Don't rely on a
// specific order of events. That means that we have to generate parent items
// recursively for proper hierarchical display of Todos.
mTodoMap.clear();
Todo *todo;
todo = todoList.first();// todo; todo = todoList.next()) {
while ( todo ) {
bool next = true;
// qDebug("todo %s ", todo->summary().latin1());
Incidence *incidence = todo->relatedTo();
while ( incidence ) {
- if ( incidence->type() == "Todo") {
+ if ( incidence->typeID() == todoID ) {
//qDebug("related %s ",incidence->summary().latin1() );
if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
//qDebug("related not found ");
todoList.remove( );
todo = todoList.current();
next = false;
incidence = 0;
} else {
//qDebug("related found ");
incidence = incidence->relatedTo();
}
} else
incidence = 0;
}
if ( next )
@@ -831,33 +831,33 @@ void KOTodoView::restoreItemState( QListViewItem *item )
todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
item = item->nextSibling();
}
}
QMap<Todo *,KOTodoViewItem *>::ConstIterator
KOTodoView::insertTodoItem(Todo *todo)
{
// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
// TODO: Check, if dynmaic cast is necessary
pendingSubtodo = 0;
Incidence *incidence = todo->relatedTo();
- if (incidence && incidence->type() == "Todo") {
+ if (incidence && incidence->typeID() == todoID ) {
Todo *relatedTodo = static_cast<Todo *>(incidence);
// kdDebug() << " has Related" << endl;
QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
itemIterator = mTodoMap.find(relatedTodo);
if (itemIterator == mTodoMap.end()) {
// kdDebug() << " related not yet in list" << endl;
itemIterator = insertTodoItem (relatedTodo);
}
// isn't this pretty stupid? We give one Todo to the KOTodoViewItem
// and one into the map. Sure finding is more easy but why? -zecke
KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
return mTodoMap.insert(todo,todoItem);
} else {
// kdDebug() << " no Related" << endl;
// see above -zecke
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 62d7ede..e8574a0 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -476,40 +476,40 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
}
}
bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
{
if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
return false;
QDateTime cdt = QDateTime::currentDateTime();
QDateTime noc;
QString tempText;
if ( appendTable && !notRed ) {
tempText = "<table>";
}
bool ok = true;
if ( reply ) {
noc = ev->getNextOccurence( cdt, &ok );
- if (! ok && ev->type() == "Event")
+ if (! ok && ev->typeID() == eventID)
return false;
}
bool bDay = false;
if ( ev->isBirthday() || ev->isAnniversary() )
bDay = true;
tempText += "<tr><td><b>";
- if (ev->type()=="Event") {
+ if (ev->typeID() == eventID ) {
if (reply) {
if (!ev->doesFloat())
tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
else
tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
} else {
if (!ev->doesFloat()) {
Event *event = static_cast<Event *>(ev);
QDateTime st,end;
if ( event->recurrence()->doesRecur() ) {
QDate recDate= mEventDate;
int days = event->dtStart().date().daysTo (event->dtEnd().date() );
while ( ! event->recursOn( recDate ) ) {
recDate = recDate.addDays( -1 );
@@ -607,44 +607,44 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
tempText +="[";
tempText += "i";
needClose =true;
}
if ( ev->recurrence()->doesRecur() ) {
if ( !needClose)
tempText +="[";
tempText += "r";
needClose =true;
}
if ( needClose ) {
tempText += "] ";
}
if ( ev->cancelled() )
tempText += "</font>";
tempText += "<a ";
- if (ev->type()=="Event") tempText += "href=\"event:";
- if (ev->type()=="Todo") tempText += "href=\"todo:";
+ if (ev->typeID() == eventID ) tempText += "href=\"event:";
+ if (ev->typeID() == todoID ) tempText += "href=\"todo:";
tempText += ev->uid() + "\">";
if ( ev->summary().length() > 0 )
tempText += ev->summary();
else
tempText += i18n("-no summary-");
if ( bDay ) {
noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
if ( ok ) {
int years = 0;
- if ( ev->type() =="Todo" ) {
+ if ( ev->typeID() == todoID ) {
years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
} else
years = noc.date().year() - ev->dtStart().date().year();
tempText += i18n(" (%1 y.)"). arg( years );
}
}
tempText += "</a>";
if ( KOPrefs::instance()->mWNViewShowLocation )
if ( !ev->location().isEmpty() )
tempText += " ("+ev->location() +")";
if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
tempText += " ["+ev->relatedTo()->summary() +"]";
tempText += "</td></tr>\n";
mText += tempText;
return true;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 53b65b2..481eab4 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1319,37 +1319,37 @@ void MainWindow::exportToPhone( int mode )
KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
int inFuture = 0;
if ( ex2phone.mWriteBackFuture->isChecked() )
inFuture = ex2phone.mWriteBackFutureWeeks->value();
QPtrList<Incidence> delSel;
if ( mode == 1 )
delSel = mCalendar->rawIncidences();
if ( mode == 2 )
delSel = mCalendar->incidences();
CalendarLocal* cal = new CalendarLocal();
cal->setLocalTime();
Incidence *incidence = delSel.first();
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
while ( incidence ) {
- if ( incidence->type() != "Journal" ) {
+ if ( incidence->typeID() != journalID ) {
bool add = true;
if ( inFuture ) {
QDateTime dt;
- if ( incidence->type() == "Todo" ) {
+ if ( incidence->typeID() == todoID ) {
Todo * t = (Todo*)incidence;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else {
bool ok;
dt = incidence->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
if ( dt < cur || dt > end ) {
add = false;
}
}
@@ -1583,33 +1583,33 @@ void MainWindow::updateWeekNum(const DateList &selectedDates)
updateWeek( selectedDates.first() );
}
void MainWindow::processIncidenceSelection( Incidence *incidence )
{
if ( !incidence ) {
enableIncidenceActions( false );
mNewSubTodoAction->setEnabled( false );
setCaptionToDates();
return;
}
//KGlobal::locale()->formatDateTime(nextA, true);
QString startString = "";
- if ( incidence->type() != "Todo" ) {
+ if ( incidence->typeID() != todoID ) {
if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
if ( incidence->doesFloat() ) {
startString += ": "+incidence->dtStartDateStr( true );
startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
} else {
startString = ": "+incidence->dtStartStr(true);
startString += " --- "+((Event*)incidence)->dtEndStr(true);
}
} else {
if ( incidence->dtStart().time() != incidence->dtEnd().time() )
startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
"-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
@@ -1621,39 +1621,39 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
startString += i18n(" (%1 y.)"). arg( years );
}
}
else
startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
}
}
else
startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
if ( !incidence->location().isEmpty() )
startString += " (" +incidence->location()+")";
setCaption( incidence->summary()+startString);
enableIncidenceActions( true );
- if ( incidence->type() == "Event" ) {
+ if ( incidence->typeID() == eventID ) {
mShowAction->setText( i18n("Show Event...") );
mEditAction->setText( i18n("Edit Event...") );
mDeleteAction->setText( i18n("Delete Event...") );
mNewSubTodoAction->setEnabled( false );
- } else if ( incidence->type() == "Todo" ) {
+ } else if ( incidence->typeID() == todoID ) {
mShowAction->setText( i18n("Show Todo...") );
mEditAction->setText( i18n("Edit Todo...") );
mDeleteAction->setText( i18n("Delete Todo...") );
mNewSubTodoAction->setEnabled( true );
} else {
mShowAction->setText( i18n("Show...") );
mShowAction->setText( i18n("Edit...") );
mShowAction->setText( i18n("Delete...") );
mNewSubTodoAction->setEnabled( false );
}
}
void MainWindow::enableIncidenceActions( bool enabled )
{