~ubuntu-branches/ubuntu/vivid/kdepim/vivid

« back to all changes in this revision

Viewing changes to incidenceeditor-ng/incidenceattendee.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Rohan Garg, Scott Kitterman
  • Date: 2012-11-21 13:12:36 UTC
  • mfrom: (0.2.33)
  • Revision ID: package-import@ubuntu.com-20121121131236-32ijw9a2txrar80k
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Rohan Garg ]
* Add nepomuk-core-dev to build-deps

[ Scott Kitterman ]
* Add new package, libpimcommon4
  - Add libpimcommon4.install
  - Add to debian/control, including kdepim-dbg and kdepim-dev depends
  - Add to kdepim-dev.install
* Remove usr/bin/backupmail and related files from kmail.install as they are
  not provided by upstream anymore
* Add usr/bin/pimsettingexporter and related files to kmail.install
* Add libnepomukwidgets-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
  mUi->mOrganizerStack->setCurrentIndex( 0 );
82
82
 
83
83
  fillOrganizerCombo();
84
 
  mUi->mSolveButton->setEnabled( true ); // always keep enabled, per bug295118
 
84
  mUi->mSolveButton->setEnabled( false );
85
85
  mUi->mOrganizerLabel->setVisible( false );
86
86
 
87
87
  mConflictResolver = new ConflictResolver( parent, parent );
222
222
    }
223
223
  }
224
224
 
225
 
  const KCalCore::Attendee::List origList = mLoadedIncidence->attendees();
 
225
  const KCalCore::Attendee::List originalList = mLoadedIncidence->attendees();
226
226
  AttendeeData::List newList = mAttendeeEditor->attendees();
227
227
 
228
228
  // The lists sizes *must* be the same. When the organizer is attending the
229
229
  // event as well, he should be in the attendees list as well.
230
 
  if ( origList.size() != newList.size() ) {
 
230
  if ( originalList.size() != newList.size() ) {
231
231
    return true;
232
232
  }
233
233
 
234
234
  // Okay, again not the most efficient algorithm, but I'm assuming that in the
235
235
  // bulk of the use cases, the number of attendees is not much higher than 10 or so.
236
 
  foreach ( const KCalCore::Attendee::Ptr &attendee, origList ) {
 
236
  foreach ( const KCalCore::Attendee::Ptr &attendee, originalList ) {
237
237
    bool found = false;
238
238
    for ( int i = 0; i < newList.size(); ++i ) {
239
239
      if ( *newList.at( i )->attendee() == *attendee ) {
422
422
 
423
423
void IncidenceAttendee::slotUpdateConflictLabel( int count )
424
424
{
425
 
  if ( count > 0 ) {
426
 
//    mUi->mSolveButton->setEnabled( true );  always keep enabled, per bug295118
427
 
    QString label( i18ncp( "@label Shows the number of scheduling conflicts",
428
 
                           "%1 conflict",
429
 
                           "%1 conflicts", count ) );
430
 
    mUi->mConflictsLabel->setText( label );
 
425
  if ( mAttendeeEditor->attendees().count() > 0 ) {
 
426
    mUi->mSolveButton->setEnabled( true );
 
427
    if ( count > 0 ) {
 
428
      QString label = i18ncp( "@label Shows the number of scheduling conflicts",
 
429
                              "%1 conflict",
 
430
                              "%1 conflicts", count );
 
431
      mUi->mConflictsLabel->setText( label );
 
432
      mUi->mConflictsLabel->setVisible( true );
 
433
    } else {
 
434
      mUi->mConflictsLabel->setVisible( false );
 
435
    }
431
436
  } else {
432
 
//    mUi->mSolveButton->setEnabled( false ); always keep enabled, per bug295118
433
 
    QString label( i18nc( "@label There are no scheduling conflicts.",
434
 
                          "No conflicts" ) );
435
 
    mUi->mConflictsLabel->setText( label );
 
437
    mUi->mSolveButton->setEnabled( false );
 
438
    mUi->mConflictsLabel->setVisible( false );
436
439
  }
437
440
}
438
441
 
539
542
  mOrganizer = newOrganizer;
540
543
}
541
544
 
 
545
void IncidenceAttendee::printDebugInfo() const
 
546
{
 
547
  kDebug() << "I'm organizer   : " << iAmOrganizer();
 
548
  kDebug() << "Loaded organizer: "<< mLoadedIncidence->organizer()->email();
 
549
 
 
550
  if ( iAmOrganizer() ) {
 
551
    KCalCore::Event tmp;
 
552
    tmp.setOrganizer( mUi->mOrganizerCombo->currentText() );
 
553
    kDebug() << "Organizer combo: " << tmp.organizer()->email();
 
554
  }
 
555
 
 
556
  const KCalCore::Attendee::List originalList = mLoadedIncidence->attendees();
 
557
  AttendeeData::List newList = mAttendeeEditor->attendees();
 
558
  kDebug() << "List sizes: " << originalList.count() << newList.count();
 
559
 
 
560
  if ( originalList.count() != newList.count() ) {
 
561
    return;
 
562
  }
 
563
 
 
564
  // Okay, again not the most efficient algorithm, but I'm assuming that in the
 
565
  // bulk of the use cases, the number of attendees is not much higher than 10 or so.
 
566
  foreach ( const KCalCore::Attendee::Ptr &attendee, originalList ) {
 
567
    bool found = false;
 
568
    for ( int i = 0; i < newList.count(); ++i ) {
 
569
      if ( *newList.at( i )->attendee() == *attendee ) {
 
570
        newList.removeAt( i );
 
571
        found = true;
 
572
        break;
 
573
      }
 
574
    }
 
575
 
 
576
    if ( !found ) {
 
577
      kDebug() << "Attendee not found: " << attendee->email()
 
578
               << attendee->status()
 
579
               << attendee->RSVP()
 
580
               << attendee->role()
 
581
               << attendee->uid()
 
582
               << "; we have:";
 
583
      for ( int i = 0; i < newList.count(); ++i ) {
 
584
        KCalCore::Attendee::Ptr attendee = newList.at( i )->attendee();
 
585
        kDebug() << "Attendee: " << attendee->email() << attendee->status()
 
586
                 << attendee->RSVP()
 
587
                 << attendee->role()
 
588
                 << attendee->uid();
 
589
      }
 
590
 
 
591
      return;
 
592
    }
 
593
  }
 
594
}