korganizer

koattendeeeditor.cpp

00001 /*
00002     Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
00003     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00004     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00005 
00006         This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <config.h> // for KDEPIM_NEW_DISTRLISTS
00022 
00023 #include "koattendeeeditor.h"
00024 #include "koprefs.h"
00025 #include "koglobals.h"
00026 
00027 #ifndef KORG_NOKABC
00028 #include <kabc/addresseedialog.h>
00029 #include <libkdepim/addressesdialog.h>
00030 #include <libkdepim/addresseelineedit.h>
00031 #endif
00032 
00033 #include <libkcal/incidence.h>
00034 
00035 #include <libemailfunctions/email.h>
00036 
00037 #ifdef KDEPIM_NEW_DISTRLISTS
00038 #include "distributionlist.h"
00039 #else
00040 #include <kabc/distributionlist.h>
00041 #endif
00042 #include <kabc/stdaddressbook.h>
00043 
00044 #include <kiconloader.h>
00045 #include <klocale.h>
00046 #include <kmessagebox.h>
00047 
00048 #include <qcheckbox.h>
00049 #include <qcombobox.h>
00050 #include <qhbox.h>
00051 #include <qlabel.h>
00052 #include <qlayout.h>
00053 #include <qpushbutton.h>
00054 #include <qwhatsthis.h>
00055 
00056 using namespace KCal;
00057 
00058 KOAttendeeEditor::KOAttendeeEditor( QWidget * parent, const char *name ) :
00059     QWidget( parent, name ),
00060     mDisableItemUpdate( true )
00061 {
00062 }
00063 
00064 void KOAttendeeEditor::initOrganizerWidgets(QWidget * parent, QBoxLayout * layout)
00065 {
00066   mOrganizerHBox = new QHBox( parent );
00067   layout->addWidget( mOrganizerHBox );
00068   // If creating a new event, then the user is the organizer -> show the
00069   // identity combo
00070   // readEvent will delete it and set another label text instead, if the user
00071   // isn't the organizer.
00072   // Note that the i18n text below is duplicated in readEvent
00073   QString whatsThis = i18n("Sets the identity corresponding to "
00074                            "the organizer of this to-do or event. "
00075                            "Identities can be set in the 'Personal' "
00076                            "section of the KOrganizer configuration, or in the "
00077                            "'Security & Privacy'->'Password & User Account' "
00078                            "section of the KDE Control Center. In addition, "
00079                            "identities are gathered from your KMail settings "
00080                            "and from your address book. If you choose "
00081                            "to set it globally for KDE in the Control Center, "
00082                            "be sure to check 'Use email settings from "
00083                            "Control Center' in the 'Personal' section of the "
00084                            "KOrganizer configuration.");
00085   mOrganizerLabel = new QLabel( i18n( "Identity as organizer:" ),
00086                                 mOrganizerHBox );
00087   mOrganizerCombo = new QComboBox( mOrganizerHBox );
00088   QWhatsThis::add( mOrganizerLabel, whatsThis );
00089   QWhatsThis::add( mOrganizerCombo, whatsThis );
00090   fillOrganizerCombo();
00091   mOrganizerHBox->setStretchFactor( mOrganizerCombo, 100 );
00092 }
00093 
00094 void KOAttendeeEditor::initEditWidgets(QWidget * parent, QBoxLayout * layout)
00095 {
00096   QGridLayout *topLayout = new QGridLayout();
00097   layout->addLayout( topLayout );
00098 
00099   QString whatsThis = i18n("Edits the name of the attendee selected in the list "
00100                            "above, or adds a new attendee if there are no attendees"
00101                            "in the list.");
00102   QLabel *attendeeLabel = new QLabel( parent );
00103   QWhatsThis::add( attendeeLabel, whatsThis );
00104   attendeeLabel->setText( i18n("Na&me:") );
00105   topLayout->addWidget( attendeeLabel, 0, 0 );
00106 
00107   mNameEdit = new KPIM::AddresseeLineEdit( parent );
00108   QWhatsThis::add( mNameEdit, whatsThis );
00109   mNameEdit->setClickMessage( i18n("Click to add a new attendee") );
00110   attendeeLabel->setBuddy( mNameEdit );
00111   mNameEdit->installEventFilter( this );
00112   connect( mNameEdit, SIGNAL( textChanged( const QString & ) ),
00113            SLOT( updateAttendee() ) );
00114   connect( mNameEdit, SIGNAL(returnPressed()), SLOT(expandAttendee()) );
00115   topLayout->addMultiCellWidget( mNameEdit, 0, 0, 1, 2 );
00116 
00117   whatsThis = i18n("Edits the role of the attendee selected "
00118                    "in the list above.");
00119   QLabel *attendeeRoleLabel = new QLabel( parent );
00120   QWhatsThis::add( attendeeRoleLabel, whatsThis );
00121   attendeeRoleLabel->setText( i18n("Ro&le:") );
00122   topLayout->addWidget( attendeeRoleLabel, 1, 0 );
00123 
00124   mRoleCombo = new QComboBox( false, parent );
00125   QWhatsThis::add( mRoleCombo, whatsThis );
00126   mRoleCombo->insertStringList( Attendee::roleList() );
00127   attendeeRoleLabel->setBuddy( mRoleCombo );
00128   connect( mRoleCombo, SIGNAL( activated( int ) ),
00129            SLOT( updateAttendee() ) );
00130   topLayout->addWidget( mRoleCombo, 1, 1 );
00131 
00132   mDelegateLabel = new QLabel( parent );
00133   topLayout->addWidget( mDelegateLabel, 1, 2 );
00134 
00135   whatsThis = i18n("Edits the current attendance status of the attendee "
00136                    "selected in the list above.");
00137   QLabel *statusLabel = new QLabel( parent );
00138   QWhatsThis::add( statusLabel, whatsThis );
00139   statusLabel->setText( i18n("Stat&us:") );
00140   topLayout->addWidget( statusLabel, 2, 0 );
00141 
00142   mStatusCombo = new QComboBox( false, parent );
00143   QWhatsThis::add( mStatusCombo, whatsThis );
00144 //   mStatusCombo->insertStringList( Attendee::statusList() );
00145   mStatusCombo->insertItem( SmallIcon( "help" ), Attendee::statusName( Attendee::NeedsAction ) );
00146   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "ok" ), Attendee::statusName( Attendee::Accepted ) );
00147   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "no" ), Attendee::statusName( Attendee::Declined ) );
00148   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "apply" ), Attendee::statusName( Attendee::Tentative ) );
00149   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "mail_forward" ), Attendee::statusName( Attendee::Delegated ) );
00150   mStatusCombo->insertItem( Attendee::statusName( Attendee::Completed ) );
00151   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "help" ), Attendee::statusName( Attendee::InProcess ) );
00152 
00153   statusLabel->setBuddy( mStatusCombo );
00154   connect( mStatusCombo, SIGNAL( activated( int ) ),
00155            SLOT( updateAttendee() ) );
00156   topLayout->addWidget( mStatusCombo, 2, 1 );
00157 
00158   topLayout->setColStretch( 2, 1 );
00159 
00160   mRsvpButton = new QCheckBox( parent );
00161   QWhatsThis::add( mRsvpButton,
00162            i18n("Edits whether to send an email to the attendee "
00163             "selected in the list above to request "
00164             "a response concerning attendance.") );
00165   mRsvpButton->setText( i18n("Re&quest response") );
00166   connect( mRsvpButton, SIGNAL( clicked() ), SLOT( updateAttendee() ) );
00167   topLayout->addWidget( mRsvpButton, 2, 2 );
00168 
00169   QWidget *buttonBox = new QWidget( parent );
00170   QVBoxLayout *buttonLayout = new QVBoxLayout( buttonBox );
00171 
00172   mAddButton = new QPushButton( i18n("&New"), buttonBox );
00173   QWhatsThis::add( mAddButton,
00174            i18n("Adds a new attendee to the list. Once the "
00175             "attendee is added, you will be able to "
00176             "edit the attendee's name, role, attendance "
00177             "status, and whether or not the attendee is required "
00178             "to respond to the invitation. To select an attendee "
00179             "from your addressbook, click the 'Select Addressee' "
00180             "button instead.") );
00181   buttonLayout->addWidget( mAddButton );
00182   connect( mAddButton, SIGNAL( clicked() ), SLOT( addNewAttendee() ) );
00183 
00184   mRemoveButton = new QPushButton( i18n("&Remove"), buttonBox );
00185   QWhatsThis::add( mRemoveButton,
00186            i18n("Removes the attendee selected in "
00187             "the list above.") );
00188   buttonLayout->addWidget( mRemoveButton );
00189 
00190   mAddressBookButton = new QPushButton( i18n("Select Addressee..."),
00191                                         buttonBox );
00192   QWhatsThis::add( mAddressBookButton,
00193            i18n("Opens your address book, allowing you to select "
00194             "new attendees from it.") );
00195   buttonLayout->addWidget( mAddressBookButton );
00196   connect( mAddressBookButton, SIGNAL( clicked() ), SLOT( openAddressBook() ) );
00197 
00198   topLayout->addMultiCellWidget( buttonBox, 0, 3, 3, 3 );
00199 
00200 #ifdef KORG_NOKABC
00201   mAddressBookButton->hide();
00202 #endif
00203 }
00204 
00205 void KOAttendeeEditor::openAddressBook()
00206 {
00207 #ifndef KORG_NOKABC
00208   KPIM::AddressesDialog *dia = new KPIM::AddressesDialog( this, "adddialog" );
00209   dia->setShowCC( false );
00210   dia->setShowBCC( false );
00211   if ( dia->exec() ) {
00212     KABC::Addressee::List aList = dia->allToAddressesNoDuplicates();
00213     for ( KABC::Addressee::List::iterator itr = aList.begin();
00214           itr != aList.end(); ++itr ) {
00215       insertAttendeeFromAddressee( (*itr) );
00216     }
00217   }
00218   delete dia;
00219   return;
00220 #endif
00221 }
00222 
00223 void KOAttendeeEditor::insertAttendeeFromAddressee(const KABC::Addressee &a, const Attendee * at)
00224 {
00225   bool myself = KOPrefs::instance()->thatIsMe( a.preferredEmail() );
00226   bool sameAsOrganizer = mOrganizerCombo &&
00227   KPIM::compareEmail( a.preferredEmail(), mOrganizerCombo->currentText(), false );
00228   KCal::Attendee::PartStat partStat = at? at->status() : KCal::Attendee::NeedsAction;
00229   bool rsvp = at? at->RSVP() : true;
00230 
00231   if ( myself && sameAsOrganizer ) {
00232     partStat = KCal::Attendee::Accepted;
00233     rsvp = false;
00234   }
00235   Attendee *newAt = new Attendee( a.realName(),
00236                                a.preferredEmail(),
00237                                !myself, partStat,
00238                                at ? at->role() : Attendee::ReqParticipant,
00239                                a.uid() );
00240   newAt->setRSVP( rsvp );
00241   insertAttendee( newAt, true );
00242 }
00243 
00244 void KOAttendeeEditor::fillOrganizerCombo()
00245 {
00246   Q_ASSERT( mOrganizerCombo );
00247   // Get all emails from KOPrefs (coming from various places),
00248   // and insert them - removing duplicates
00249   const QStringList lst = KOPrefs::instance()->fullEmails();
00250   QStringList uniqueList;
00251   for( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
00252     if ( uniqueList.find( *it ) == uniqueList.end() )
00253       uniqueList << *it;
00254   }
00255   mOrganizerCombo->insertStringList( uniqueList );
00256 }
00257 
00258 void KOAttendeeEditor::addNewAttendee()
00259 {
00260   // check if there's still an unchanged example entry, and if so
00261   // suggest to edit that first
00262   if ( QListViewItem* item = hasExampleAttendee() ) {
00263       KMessageBox::information( this,
00264           i18n( "Please edit the example attendee, before adding more." ), QString::null,
00265           "EditExistingExampleAttendeeFirst" );
00266       // make sure the example attendee is selected
00267       item->setSelected( true );
00268       item->listView()->setCurrentItem( item );
00269       return;
00270   }
00271   Attendee *a = new Attendee( i18n("Firstname Lastname"),
00272                               i18n("name") + "@example.net", true );
00273   insertAttendee( a, false );
00274   mnewAttendees.append(a);
00275   updateAttendeeInput();
00276   // We don't want the hint again
00277   mNameEdit->setClickMessage( "" );
00278   mNameEdit->setFocus();
00279   QTimer::singleShot( 0, mNameEdit, SLOT( selectAll() ) );
00280 }
00281 
00282 void KOAttendeeEditor::readEvent(KCal::Incidence * incidence)
00283 {
00284   mdelAttendees.clear();
00285   mnewAttendees.clear();
00286   if ( KOPrefs::instance()->thatIsMe( incidence->organizer().email() ) || incidence->organizer().isEmpty() ) {
00287     if ( !mOrganizerCombo ) {
00288       mOrganizerCombo = new QComboBox( mOrganizerHBox );
00289       fillOrganizerCombo();
00290     }
00291     mOrganizerLabel->setText( i18n( "Identity as organizer:" ) );
00292 
00293     int found = -1;
00294     QString fullOrganizer = incidence->organizer().fullName();
00295     for ( int i = 0 ; i < mOrganizerCombo->count(); ++i ) {
00296       if ( mOrganizerCombo->text( i ) == fullOrganizer ) {
00297         found = i;
00298         mOrganizerCombo->setCurrentItem( i );
00299         break;
00300       }
00301     }
00302     if ( found < 0 ) {
00303       mOrganizerCombo->insertItem( fullOrganizer, 0 );
00304       mOrganizerCombo->setCurrentItem( 0 );
00305     }
00306   } else { // someone else is the organizer
00307     if ( mOrganizerCombo ) {
00308       delete mOrganizerCombo;
00309       mOrganizerCombo = 0;
00310     }
00311     mOrganizerLabel->setText( i18n( "Organizer: %1" ).arg( incidence->organizer().fullName() ) );
00312   }
00313 
00314   Attendee::List al = incidence->attendees();
00315   Attendee::List::ConstIterator it;
00316   Attendee *first = 0;
00317   for( it = al.begin(); it != al.end(); ++it ) {
00318     Attendee *a = new Attendee( **it );
00319     if ( !first ) {
00320       first = a;
00321     }
00322     insertAttendee( a, true );
00323   }
00324 
00325   // Set the initial editing values to the first attendee in the list.
00326   if ( first ) {
00327     mNameEdit->setText( first->fullName() );
00328     mUid = first->uid();
00329     mRoleCombo->setCurrentItem( first->role() );
00330     if ( first->status() != KCal::Attendee::None ) {
00331       mStatusCombo->setCurrentItem( first->status() );
00332     } else {
00333       mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00334     }
00335     mRsvpButton->setChecked( first->RSVP() );
00336     mRsvpButton->setEnabled( true );
00337   }
00338 }
00339 
00340 void KOAttendeeEditor::writeEvent(KCal::Incidence * incidence)
00341 {
00342   if ( mOrganizerCombo ) {
00343     // TODO: Don't take a string and split it up... Is there a better way?
00344     incidence->setOrganizer( mOrganizerCombo->currentText() );
00345   }
00346 }
00347 
00348 void KOAttendeeEditor::setEnableAttendeeInput(bool enabled)
00349 {
00350   //mNameEdit->setEnabled( enabled );
00351   mRoleCombo->setEnabled( enabled );
00352   mStatusCombo->setEnabled( enabled );
00353   mRsvpButton->setEnabled( enabled );
00354 
00355   mRemoveButton->setEnabled( enabled );
00356 }
00357 
00358 void KOAttendeeEditor::clearAttendeeInput()
00359 {
00360   mNameEdit->setText("");
00361   mUid = QString::null;
00362   mRoleCombo->setCurrentItem(0);
00363   mStatusCombo->setCurrentItem(0);
00364   mRsvpButton->setChecked(true);
00365   setEnableAttendeeInput( false );
00366   mDelegateLabel->setText( QString() );
00367 }
00368 
00369 void KOAttendeeEditor::expandAttendee()
00370 {
00371   KABC::Addressee::List aList = expandDistList( mNameEdit->text() );
00372   if ( !aList.isEmpty() ) {
00373     for ( KABC::Addressee::List::iterator itr = aList.begin(); itr != aList.end(); ++itr ) {
00374       insertAttendeeFromAddressee( (*itr) );
00375     }
00376     removeAttendee( currentAttendee() );
00377   }
00378 }
00379 
00380 void KOAttendeeEditor::updateAttendee()
00381 {
00382   Attendee *a = currentAttendee();
00383   if ( !a || mDisableItemUpdate )
00384     return;
00385 
00386   QString text = mNameEdit->text();
00387   if ( !mNameEdit->text().startsWith( "\"" ) ) {
00388     // Quote the text as it might contain commas and other quotable chars.
00389     text = KPIM::quoteNameIfNecessary( text );
00390   }
00391 
00392   QString name, email;
00393   if ( KPIM::getNameAndMail( text, name, email ) ) {
00394     name.remove( '"' );
00395     email.remove( '"' ).remove( '>' );
00396   } else {
00397     name = QString();
00398     email = mNameEdit->text();
00399   }
00400 
00401   bool iAmTheOrganizer = mOrganizerCombo &&
00402     KOPrefs::instance()->thatIsMe( mOrganizerCombo->currentText() );
00403   if ( iAmTheOrganizer ) {
00404     bool myself =
00405       KPIM::compareEmail( email, mOrganizerCombo->currentText(), false );
00406     bool wasMyself =
00407       KPIM::compareEmail( a->email(), mOrganizerCombo->currentText(), false );
00408     if ( myself ) {
00409       mRsvpButton->setChecked( false );
00410       mRsvpButton->setEnabled( false );
00411     } else if ( wasMyself ) {
00412       // this was me, but is no longer, reset
00413       mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00414       mRsvpButton->setChecked( true );
00415       mRsvpButton->setEnabled( true );
00416     }
00417   }
00418   a->setName( name );
00419   a->setUid( mUid );
00420   a->setEmail( email );
00421   a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
00422   a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
00423   a->setRSVP( mRsvpButton->isChecked() );
00424 
00425   updateCurrentItem();
00426 }
00427 
00428 void KOAttendeeEditor::fillAttendeeInput( KCal::Attendee *a )
00429 {
00430   mDisableItemUpdate = true;
00431 
00432   QString tname, temail;
00433   QString username = a->name();
00434   if ( !a->email().isEmpty() ) {
00435     username = KPIM::quoteNameIfNecessary( username );
00436 
00437     KPIM::getNameAndMail( username, tname, temail ); // ignore return value
00438                                                      // which is always false
00439     tname += " <" + a->email() + '>';
00440   }
00441 
00442   bool myself = KOPrefs::instance()->thatIsMe( a->email() );
00443   bool sameAsOrganizer = mOrganizerCombo &&
00444           KPIM::compareEmail( a->email(),
00445                                    mOrganizerCombo->currentText(), false );
00446   KCal::Attendee::PartStat partStat = a->status();
00447   bool rsvp = a->RSVP();
00448 
00449   if ( myself && sameAsOrganizer && a->status() == KCal::Attendee::None ) {
00450       partStat = KCal::Attendee::Accepted;
00451       rsvp = false;
00452   }
00453 
00454   mNameEdit->setText(tname);
00455   mUid = a->uid();
00456   mRoleCombo->setCurrentItem(a->role());
00457   if ( partStat != KCal::Attendee::None ) {
00458     mStatusCombo->setCurrentItem( partStat );
00459   } else {
00460     mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00461   }
00462   mRsvpButton->setChecked( rsvp );
00463 
00464   mDisableItemUpdate = false;
00465   setEnableAttendeeInput( true );
00466 
00467   if ( a->status() == Attendee::Delegated ) {
00468     if ( !a->delegate().isEmpty() )
00469       mDelegateLabel->setText( i18n( "Delegated to %1" ).arg( a->delegate() ) );
00470     else if ( !a->delegator().isEmpty() )
00471       mDelegateLabel->setText( i18n( "Delegated from %1" ).arg( a->delegator() ) );
00472     else
00473       mDelegateLabel->setText( i18n( "Not delegated" ) );
00474   }
00475   if( myself )
00476     mRsvpButton->setEnabled( false );
00477 
00478 }
00479 
00480 void KOAttendeeEditor::updateAttendeeInput()
00481 {
00482   setEnableAttendeeInput(!mNameEdit->text().isEmpty());
00483   Attendee* a = currentAttendee();
00484   if ( a ) {
00485     fillAttendeeInput( a );
00486   } else {
00487     clearAttendeeInput();
00488   }
00489 }
00490 
00491 void KOAttendeeEditor::cancelAttendeeEvent( KCal::Incidence *incidence )
00492 {
00493   incidence->clearAttendees();
00494   Attendee * att;
00495   for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
00496     bool isNewAttendee = false;
00497     for (Attendee *newAtt=mnewAttendees.first();newAtt;newAtt=mnewAttendees.next()) {
00498       if (*att==*newAtt) {
00499         isNewAttendee = true;
00500         break;
00501       }
00502     }
00503     if (!isNewAttendee) {
00504       incidence->addAttendee(new Attendee(*att));
00505     }
00506   }
00507   mdelAttendees.clear();
00508 }
00509 
00510 void KOAttendeeEditor::acceptForMe()
00511 {
00512   changeStatusForMe( Attendee::Accepted );
00513 }
00514 
00515 void KOAttendeeEditor::declineForMe()
00516 {
00517   changeStatusForMe( Attendee::Declined );
00518 }
00519 
00520 bool KOAttendeeEditor::eventFilter(QObject *watched, QEvent *ev)
00521 {
00522   if ( watched && watched == mNameEdit && ev->type() == QEvent::FocusIn &&
00523        currentAttendee() == 0 ) {
00524     addNewAttendee();
00525   }
00526 
00527   return QWidget::eventFilter( watched, ev );
00528 }
00529 
00530 bool KOAttendeeEditor::isExampleAttendee( const KCal::Attendee* attendee ) const
00531 {
00532     if ( !attendee ) return false;
00533     if ( attendee->name() == i18n( "Firstname Lastname" )
00534         && attendee->email().endsWith( "example.net" ) ) {
00535         return true;
00536     }
00537     return false;
00538 }
00539 
00540 KABC::Addressee::List KOAttendeeEditor::expandDistList( const QString &text )  const
00541 {
00542   KABC::Addressee::List aList;
00543   KABC::AddressBook *abook = KABC::StdAddressBook::self( true );
00544 
00545 #ifdef KDEPIM_NEW_DISTRLISTS
00546   const QValueList<KPIM::DistributionList::Entry> eList =
00547     KPIM::DistributionList::findByName( abook, text ).entries( abook );
00548   QValueList<KPIM::DistributionList::Entry>::ConstIterator eit;
00549   for ( eit = eList.begin(); eit != eList.end(); ++eit ) {
00550     KABC::Addressee a = (*eit).addressee;
00551     if ( !a.preferredEmail().isEmpty() && aList.find( a ) == aList.end() ) {
00552       aList.append( a ) ;
00553     }
00554   }
00555 
00556 #else
00557   KABC::DistributionListManager manager( abook );
00558   manager.load();
00559   const QStringList dList = manager.listNames();
00560   for ( QStringList::ConstIterator it = dList.begin(); it != dList.end(); ++it ) {
00561     if ( (*it) == text ) {
00562       const QValueList<KABC::DistributionList::Entry> eList = manager.list( *it )->entries();
00563       QValueList<KABC::DistributionList::Entry>::ConstIterator eit;
00564       for ( eit = eList.begin(); eit != eList.end(); ++eit ) {
00565         KABC::Addressee a = (*eit).addressee;
00566         if ( !a.preferredEmail().isEmpty() && aList.find( a ) == aList.end() ) {
00567           aList.append( a ) ;
00568         }
00569       }
00570     }
00571   }
00572 #endif
00573   return aList;
00574 }
00575 
00576 
00577 #include "koattendeeeditor.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys