diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
commit | cc29364f06178f8f6b457384f2ec37a042bd9d43 (patch) | |
tree | 7c77a3184c698bbf9d98cef09fb1ba8124daceba /korganizer/koeditorfreebusy.cpp | |
parent | 4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff) | |
download | tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip |
* 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
Diffstat (limited to 'korganizer/koeditorfreebusy.cpp')
-rw-r--r-- | korganizer/koeditorfreebusy.cpp | 106 |
1 files changed, 89 insertions, 17 deletions
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<KCal::Period> busyPeriods = fb->busyPeriods(); for( TQValueList<KCal::Period>::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 += "<b>" + (*it).summary() + "</b><br/>"; - if ( !(*it).location().isEmpty() ) - toolTip += i18n( "Location: %1" ).arg( (*it).location() ); - if ( !toolTip.isEmpty() ) - newSubItem->setTooltipText( toolTip ); + + TQString toolTip = "<qt>"; + toolTip += "<b>" + i18n( "Freebusy Period" ) + "</b>"; + toolTip += "<br>----------------------<br>"; + if ( !per.summary().isEmpty() ) { + toolTip += "<i>" + i18n( "Summary:" ) + "</i>" + " "; + toolTip += per.summary(); + toolTip += "<br>"; + } + if ( !per.location().isEmpty() ) { + toolTip += "<i>" + i18n( "Location:" ) + "</i>" + " "; + toolTip += per.location(); + toolTip += "<br>"; + } + toolTip += "<i>" + i18n( "Start:" ) + "</i>" + " "; + toolTip += KGlobal::locale()->formatDateTime( per.start() ); + toolTip += "<br>"; + toolTip += "<i>" + i18n( "End:" ) + "</i>" + " "; + toolTip += KGlobal::locale()->formatDateTime( per.end() ); + toolTip += "<br>"; + toolTip += "</qt>"; + 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( "<qt>The next available time slot for the meeting is:<br>" + "Start: %1<br>End: %2<br>" + "Would you like to move the meeting to this time slot?</qt>" ). + 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<FreeBusyItem*>( item->nextSibling() ); + if( mGanttView->childCount() == 1 ) + nextSelectedItem = 0; + if( mGanttView->childCount() > 1 && item == mGanttView->lastItem() ) + nextSelectedItem = static_cast<FreeBusyItem*>( 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<FreeBusyItem*>( 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<FreeBusyItem*>( 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<FreeBusyItem *>( mGanttView->firstChild() ); item; + item = static_cast<FreeBusyItem*>( item->nextSibling() ) ) { + Attendee *attendee = item->attendee(); + Q_ASSERT( attendee ); + if ( isExampleAttendee( attendee ) ) + return item; + } + return 0; +} + #include "koeditorfreebusy.moc" |