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/koeditordetails.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/koeditordetails.cpp')
-rw-r--r-- | korganizer/koeditordetails.cpp | 87 |
1 files changed, 72 insertions, 15 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 0b8c6159f..a882363da 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp @@ -72,7 +72,8 @@ template <> CustomListViewItem<KCal::Attendee *>::~CustomListViewItem() { - delete mData; + // do not delete mData here +// delete mData; } template <> @@ -152,18 +153,15 @@ void KOAttendeeListView::dropEvent( TQDropEvent *e ) { #ifndef KORG_NODND TQString text; - TQString vcards; #ifndef KORG_NOKABC - if ( KVCardDrag::decode( e, vcards ) ) { - KABC::VCardConverter converter; - - KABC::Addressee::List list = converter.parseVCards( vcards ); + KABC::Addressee::List list; + if ( KVCardDrag::decode( e, list ) ) { KABC::Addressee::List::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { TQString em( (*it).fullEmail() ); - if (em.isEmpty()) { - em=(*it).realName(); + if ( em.isEmpty() ) { + em = (*it).realName(); } addAttendee( em ); } @@ -240,13 +238,22 @@ void KOEditorDetails::removeAttendee() static_cast<AttendeeListItem *>( mListView->selectedItem() ); if ( !aItem ) return; - Attendee *delA = new Attendee( aItem->data()->name(), aItem->data()->email(), - aItem->data()->RSVP(), aItem->data()->status(), - aItem->data()->role(), aItem->data()->uid() ); - mdelAttendees.append( delA ); + AttendeeListItem *nextSelectedItem = static_cast<AttendeeListItem*>( aItem->nextSibling() ); + if( mListView->childCount() == 1 ) + nextSelectedItem = 0; + if( mListView->childCount() > 1 && aItem == mListView->lastItem() ) + nextSelectedItem = static_cast<AttendeeListItem*>( mListView->firstChild() ); + Attendee *attendee = aItem->data(); + Attendee *delA = new Attendee( attendee->name(), attendee->email(), + attendee->RSVP(), attendee->status(), + attendee->role(), attendee->uid() ); + mdelAttendees.append( delA ); delete aItem; + if( nextSelectedItem ) { + mListView->setSelected( nextSelectedItem, true ); + } updateAttendeeInput(); emit updateAttendeeSummary( mListView->childCount() ); } @@ -257,12 +264,25 @@ void KOEditorDetails::insertAttendee( Attendee *a, bool goodEmailAddress ) Q_UNUSED( goodEmailAddress ); // lastItem() is O(n), but for n very small that should be fine - AttendeeListItem *item = new AttendeeListItem( a, mListView, - static_cast<KListViewItem*>( mListView->lastItem() ) ); + AttendeeListItem *item = new AttendeeListItem( + a, mListView, static_cast<KListViewItem*>( mListView->lastItem() ) ); mListView->setSelected( item, true ); emit updateAttendeeSummary( mListView->childCount() ); } +void KOEditorDetails::removeAttendee( Attendee *attendee ) +{ + TQListViewItem *item; + for ( item = mListView->firstChild(); item; item = item->nextSibling() ) { + AttendeeListItem *anItem = static_cast<AttendeeListItem *>( item ); + Attendee *att = anItem->data(); + if ( att == attendee ) { + delete anItem; + break; + } + } +} + void KOEditorDetails::setDefaults() { mRsvpButton->setChecked( true ); @@ -350,9 +370,34 @@ void KOEditorDetails::updateCurrentItem() item->updateItem(); } -void KOEditorDetails::slotInsertAttendee(Attendee * a) +void KOEditorDetails::slotInsertAttendee( Attendee *a ) { insertAttendee( a ); + mnewAttendees.append( a ); +} + +void KOEditorDetails::setSelected( int index ) +{ + int count = 0; + for ( TQListViewItemIterator it( mListView ); it.current(); ++it ) { + if ( count == index ) { + mListView->setSelected( *it, true ); + return; + } + count++; + } +} + +int KOEditorDetails::selectedIndex() +{ + int index = 0; + for ( TQListViewItemIterator it( mListView ); it.current(); ++it ) { + if ( mListView->isSelected( *it ) ) { + break; + } + index++; + } + return index; } void KOEditorDetails::changeStatusForMe(Attendee::PartStat status) @@ -369,4 +414,16 @@ void KOEditorDetails::changeStatusForMe(Attendee::PartStat status) } } +TQListViewItem* KOEditorDetails::hasExampleAttendee() const +{ + for ( TQListViewItemIterator it( mListView ); it.current(); ++it ) { + AttendeeListItem *item = static_cast<AttendeeListItem*>( it.current() ); + Attendee *attendee = item->data(); + Q_ASSERT( attendee ); + if ( isExampleAttendee( attendee ) ) + return item; + } + return 0; +} + #include "koeditordetails.moc" |