From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/koeditorfreebusy.cpp | 106 +++++++++++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 17 deletions(-) (limited to 'korganizer/koeditorfreebusy.cpp') diff --git a/korganizer/koeditorfreebusy.cpp b/korganizer/koeditorfreebusy.cpp index 19691e807..c56ff033f 100644 --- a/korganizer/koeditorfreebusy.cpp +++ b/korganizer/koeditorfreebusy.cpp @@ -130,7 +130,8 @@ class FreeBusyItem : public KDGanttViewTaskItem void FreeBusyItem::updateItem() { - setListViewText( 0, mAttendee->fullName() ); + TQString text = mAttendee->name() + " <" + mAttendee->email() + '>'; + setListViewText( 0, text ); switch ( mAttendee->status() ) { case Attendee::Accepted: setPixmap( 0, KOGlobals::self()->smallIcon( "ok" ) ); @@ -166,17 +167,34 @@ void FreeBusyItem::setFreeBusyPeriods( FreeBusy* fb ) TQValueList busyPeriods = fb->busyPeriods(); for( TQValueList::Iterator it = busyPeriods.begin(); it != busyPeriods.end(); ++it ) { - KDGanttViewTaskItem* newSubItem = new KDGanttViewTaskItem( this ); - newSubItem->setStartTime( (*it).start() ); - newSubItem->setEndTime( (*it).end() ); + Period per = *it; + + KDGanttViewTaskItem *newSubItem = new KDGanttViewTaskItem( this ); + newSubItem->setStartTime( per.start() ); + newSubItem->setEndTime( per.end() ); newSubItem->setColors( Qt::red, Qt::red, Qt::red ); - TQString toolTip; - if ( !(*it).summary().isEmpty() ) - toolTip += "" + (*it).summary() + "
"; - if ( !(*it).location().isEmpty() ) - toolTip += i18n( "Location: %1" ).arg( (*it).location() ); - if ( !toolTip.isEmpty() ) - newSubItem->setTooltipText( toolTip ); + + TQString toolTip = ""; + toolTip += "" + i18n( "Freebusy Period" ) + ""; + toolTip += "
----------------------
"; + if ( !per.summary().isEmpty() ) { + toolTip += "" + i18n( "Summary:" ) + "" + " "; + toolTip += per.summary(); + toolTip += "
"; + } + if ( !per.location().isEmpty() ) { + toolTip += "" + i18n( "Location:" ) + "" + " "; + toolTip += per.location(); + toolTip += "
"; + } + toolTip += "" + i18n( "Start:" ) + "" + " "; + toolTip += KGlobal::locale()->formatDateTime( per.start() ); + toolTip += "
"; + toolTip += "" + i18n( "End:" ) + "" + " "; + toolTip += KGlobal::locale()->formatDateTime( per.end() ); + toolTip += "
"; + toolTip += "
"; + newSubItem->setTooltipText( toolTip ); } setFreeBusy( fb ); setShowNoInformation( false ); @@ -529,12 +547,18 @@ void KOEditorFreeBusy::slotPickDate() i18n( "The meeting already has suitable start/end times." ), TQString::null, "MeetingTimeOKFreeBusy" ); } else { - emit dateTimesChanged( start, end ); - slotUpdateGanttView( start, end ); - KMessageBox::information( this, - i18n( "The meeting has been moved to\nStart: %1\nEnd: %2." ) - .arg( start.toString() ).arg( end.toString() ), TQString::null, - "MeetingMovedFreeBusy" ); + if ( KMessageBox::questionYesNo( + this, + i18n( "The next available time slot for the meeting is:
" + "Start: %1
End: %2
" + "Would you like to move the meeting to this time slot?
" ). + arg( start.toString(), end.toString() ), + TQString::null, + KStdGuiItem::yes(), KStdGuiItem::no(), + "MeetingMovedFreeBusy" ) == KMessageBox::Yes ) { + emit dateTimesChanged( start, end ); + slotUpdateGanttView( start, end ); + } } } else KMessageBox::sorry( this, i18n( "No suitable date found." ) ); @@ -664,6 +688,7 @@ void KOEditorFreeBusy::updateStatusSummary() case Attendee::Delegated: case Attendee::Completed: case Attendee::InProcess: + case Attendee::None: /* just to shut up the compiler */ break; } @@ -803,6 +828,12 @@ void KOEditorFreeBusy::removeAttendee() if ( !item ) return; + FreeBusyItem *nextSelectedItem = static_cast( item->nextSibling() ); + if( mGanttView->childCount() == 1 ) + nextSelectedItem = 0; + if( mGanttView->childCount() > 1 && item == mGanttView->lastItem() ) + nextSelectedItem = static_cast( mGanttView->firstChild() ); + Attendee *delA = new Attendee( item->attendee()->name(), item->attendee()->email(), item->attendee()->RSVP(), item->attendee()->status(), item->attendee()->role(), item->attendee()->uid() ); @@ -810,6 +841,8 @@ void KOEditorFreeBusy::removeAttendee() delete item; updateStatusSummary(); + if( nextSelectedItem ) + mGanttView->setSelected( nextSelectedItem, true ); updateAttendeeInput(); emit updateAttendeeSummary( mGanttView->childCount() ); } @@ -823,6 +856,32 @@ void KOEditorFreeBusy::clearSelection() const item->repaint(); } +void KOEditorFreeBusy::setSelected( int index ) +{ + int count = 0; + for( KDGanttViewItem *it = mGanttView->firstChild(); it; it = it->nextSibling() ) { + FreeBusyItem *item = static_cast( it ); + if ( count == index ) { + mGanttView->setSelected( item, true ); + return; + } + count++; + } +} + +int KOEditorFreeBusy::selectedIndex() +{ + int index = 0; + for ( KDGanttViewItem *it = mGanttView->firstChild(); it; it = it->nextSibling() ) { + FreeBusyItem *item = static_cast( it ); + if ( item->isSelected() ) { + break; + } + index++; + } + return index; +} + void KOEditorFreeBusy::changeStatusForMe(KCal::Attendee::PartStat status) { const TQStringList myEmails = KOPrefs::instance()->allEmails(); @@ -911,6 +970,7 @@ void KOEditorFreeBusy::slotOrganizerChanged(const TQString & newOrganizer) if (!newOrganizerAttendee) { Attendee *a = new Attendee( name, email, true ); insertAttendee( a, false ); + mnewAttendees.append( a ); updateAttendee(); } } @@ -928,4 +988,16 @@ bool KOEditorFreeBusy::eventFilter( TQObject *watched, TQEvent *event ) } } +TQListViewItem* KOEditorFreeBusy::hasExampleAttendee() const +{ + for ( FreeBusyItem *item = static_cast( mGanttView->firstChild() ); item; + item = static_cast( item->nextSibling() ) ) { + Attendee *attendee = item->attendee(); + Q_ASSERT( attendee ); + if ( isExampleAttendee( attendee ) ) + return item; + } + return 0; +} + #include "koeditorfreebusy.moc" -- cgit v1.2.1