author | ulf69 <ulf69> | 2004-08-17 00:15:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:15:05 (UTC) |
commit | 7d15927b7e7957a80da335587598e7b62dece1a4 (patch) (side-by-side diff) | |
tree | 607b15062fa09b278c764afbc221736a68dbd2c8 | |
parent | f3875aba68f175e8da32462f64b12fc46bc31102 (diff) | |
download | kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.zip kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.gz kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.bz2 |
added listener to access Ka/pi via QCop
-rw-r--r-- | korganizer/koeditordetails.cpp | 39 | ||||
-rw-r--r-- | korganizer/koeditordetails.h | 7 |
2 files changed, 43 insertions, 3 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index c0e7bdd..8e2fabe 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp @@ -34,13 +34,19 @@ #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kmessagebox.h> #ifndef KORG_NOKABC + +#ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> +#else //DESKTOP_VERSION +#include <externalapphandler.h> +#endif //DESKTOP_VERSION + #endif #include <libkcal/incidence.h> #include "koprefs.h" @@ -81,13 +87,13 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) mListView->addColumn(i18n("Role"),60); mListView->addColumn(i18n("Status"),100); mListView->addColumn(i18n("RSVP"),35); if ( KOPrefs::instance()->mCompactDialogs ) { //mListView->setFixedHeight(78); } - + connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateAttendeeInput())); QLabel *attendeeLabel = new QLabel(this); attendeeLabel->setText(i18n("Name:")); attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); @@ -192,12 +198,17 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) #ifdef KORG_NOKABC mAddressBookButton->hide(); #endif updateAttendeeInput(); + +//US listen for arriving address resultsets + connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), + this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); + } KOEditorDetails::~KOEditorDetails() { } @@ -218,18 +229,24 @@ void KOEditorDetails::removeAttendee() void KOEditorDetails::openAddressBook() { #ifndef KORG_NOKABC +#ifdef DESKTOP_VERSION KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); uint i=0; for (i=0; i < list.count(); i++) { insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); } - +#else + bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); + // the result should now arrive through method insertAttendees +#endif + + #if 0 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); if (!a.isEmpty()) { insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); } #endif @@ -260,12 +277,30 @@ void KOEditorDetails::addNewAttendee() #endif Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); insertAttendee(a); } +//the map includes name/email pairs, that comes from Ka/Pi +void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) +{ + if (uid == this->name()) + { + for ( int i = 0; i < nameList.count(); i++) + { + QString _name = nameList[i]; + QString _email = emailList[i]; + QString _uid = uidList[i]; + + Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); + insertAttendee(a); + } + } + +} + void KOEditorDetails::insertAttendee(Attendee *a) { AttendeeListItem *item = new AttendeeListItem(a,mListView); mListView->setSelected( item, true ); } diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h index 930b296..0cc807f 100644 --- a/korganizer/koeditordetails.h +++ b/korganizer/koeditordetails.h @@ -20,12 +20,13 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef _KOEDITORDETAILS_H #define _KOEDITORDETAILS_H +#include <qmap.h> #include <qframe.h> #include <qlabel.h> #include <qcheckbox.h> #include <qpushbutton.h> #include <qgroupbox.h> #include <qlineedit.h> @@ -67,12 +68,16 @@ class KOEditorDetails : public QWidget void cancelAttendeeEvent(Incidence *); /** Check if the input is valid. */ bool validateInput(); public slots: void insertAttendee(Attendee *); + // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi + // The first parameter is a uniqueid. It can be used to identify if event + void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); + protected slots: void addNewAttendee(); void removeAttendee(); void openAddressBook(); void updateAttendeeInput(); @@ -93,11 +98,11 @@ class KOEditorDetails : public QWidget QComboBox* mStatusCombo; QLabel *mOrganizerLabel; QPushButton* mAddButton; QPushButton* mRemoveButton; QPushButton* mAddressBookButton; - + QPtrList<Attendee> mdelAttendees; }; #endif |