summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-17 00:15:05 (UTC)
committer ulf69 <ulf69>2004-08-17 00:15:05 (UTC)
commit7d15927b7e7957a80da335587598e7b62dece1a4 (patch) (unidiff)
tree607b15062fa09b278c764afbc221736a68dbd2c8
parentf3875aba68f175e8da32462f64b12fc46bc31102 (diff)
downloadkdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.zip
kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.gz
kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.bz2
added listener to access Ka/pi via QCop
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditordetails.cpp39
-rw-r--r--korganizer/koeditordetails.h7
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 @@
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#ifndef KORG_NOKABC 39#ifndef KORG_NOKABC
40
41#ifdef DESKTOP_VERSION
40#include <kabc/addresseedialog.h> 42#include <kabc/addresseedialog.h>
43#else //DESKTOP_VERSION
44#include <externalapphandler.h>
45#endif //DESKTOP_VERSION
46
41#endif 47#endif
42 48
43#include <libkcal/incidence.h> 49#include <libkcal/incidence.h>
44 50
45#include "koprefs.h" 51#include "koprefs.h"
46 52
@@ -81,13 +87,13 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
81 mListView->addColumn(i18n("Role"),60); 87 mListView->addColumn(i18n("Role"),60);
82 mListView->addColumn(i18n("Status"),100); 88 mListView->addColumn(i18n("Status"),100);
83 mListView->addColumn(i18n("RSVP"),35); 89 mListView->addColumn(i18n("RSVP"),35);
84 if ( KOPrefs::instance()->mCompactDialogs ) { 90 if ( KOPrefs::instance()->mCompactDialogs ) {
85 //mListView->setFixedHeight(78); 91 //mListView->setFixedHeight(78);
86 } 92 }
87 93
88 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
89 SLOT(updateAttendeeInput())); 95 SLOT(updateAttendeeInput()));
90 96
91 QLabel *attendeeLabel = new QLabel(this); 97 QLabel *attendeeLabel = new QLabel(this);
92 attendeeLabel->setText(i18n("Name:")); 98 attendeeLabel->setText(i18n("Name:"));
93 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
@@ -192,12 +198,17 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
192 198
193#ifdef KORG_NOKABC 199#ifdef KORG_NOKABC
194 mAddressBookButton->hide(); 200 mAddressBookButton->hide();
195#endif 201#endif
196 202
197 updateAttendeeInput(); 203 updateAttendeeInput();
204
205//US listen for arriving address resultsets
206 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
207 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
208
198} 209}
199 210
200KOEditorDetails::~KOEditorDetails() 211KOEditorDetails::~KOEditorDetails()
201{ 212{
202} 213}
203 214
@@ -218,18 +229,24 @@ void KOEditorDetails::removeAttendee()
218 229
219 230
220void KOEditorDetails::openAddressBook() 231void KOEditorDetails::openAddressBook()
221{ 232{
222#ifndef KORG_NOKABC 233#ifndef KORG_NOKABC
223 234
235#ifdef DESKTOP_VERSION
224 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 236 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
225 uint i=0; 237 uint i=0;
226 for (i=0; i < list.count(); i++) { 238 for (i=0; i < list.count(); i++) {
227 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); 239 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) );
228 } 240 }
229 241#else
242 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
243 // the result should now arrive through method insertAttendees
244#endif
245
246
230#if 0 247#if 0
231 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 248 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
232 if (!a.isEmpty()) { 249 if (!a.isEmpty()) {
233 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); 250 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) );
234 } 251 }
235#endif 252#endif
@@ -260,12 +277,30 @@ void KOEditorDetails::addNewAttendee()
260#endif 277#endif
261 278
262 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); 279 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)"));
263 insertAttendee(a); 280 insertAttendee(a);
264} 281}
265 282
283//the map includes name/email pairs, that comes from Ka/Pi
284void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
285{
286 if (uid == this->name())
287 {
288 for ( int i = 0; i < nameList.count(); i++)
289 {
290 QString _name = nameList[i];
291 QString _email = emailList[i];
292 QString _uid = uidList[i];
293
294 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid);
295 insertAttendee(a);
296 }
297 }
298
299}
300
266 301
267void KOEditorDetails::insertAttendee(Attendee *a) 302void KOEditorDetails::insertAttendee(Attendee *a)
268{ 303{
269 AttendeeListItem *item = new AttendeeListItem(a,mListView); 304 AttendeeListItem *item = new AttendeeListItem(a,mListView);
270 mListView->setSelected( item, true ); 305 mListView->setSelected( item, true );
271} 306}
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 @@
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOEDITORDETAILS_H 23#ifndef _KOEDITORDETAILS_H
24#define _KOEDITORDETAILS_H 24#define _KOEDITORDETAILS_H
25 25
26#include <qmap.h>
26#include <qframe.h> 27#include <qframe.h>
27#include <qlabel.h> 28#include <qlabel.h>
28#include <qcheckbox.h> 29#include <qcheckbox.h>
29#include <qpushbutton.h> 30#include <qpushbutton.h>
30#include <qgroupbox.h> 31#include <qgroupbox.h>
31#include <qlineedit.h> 32#include <qlineedit.h>
@@ -67,12 +68,16 @@ class KOEditorDetails : public QWidget
67 void cancelAttendeeEvent(Incidence *); 68 void cancelAttendeeEvent(Incidence *);
68 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
69 bool validateInput(); 70 bool validateInput();
70 71
71 public slots: 72 public slots:
72 void insertAttendee(Attendee *); 73 void insertAttendee(Attendee *);
74 // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi
75 // The first parameter is a uniqueid. It can be used to identify if event
76 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
77
73 78
74 protected slots: 79 protected slots:
75 void addNewAttendee(); 80 void addNewAttendee();
76 void removeAttendee(); 81 void removeAttendee();
77 void openAddressBook(); 82 void openAddressBook();
78 void updateAttendeeInput(); 83 void updateAttendeeInput();
@@ -93,11 +98,11 @@ class KOEditorDetails : public QWidget
93 QComboBox* mStatusCombo; 98 QComboBox* mStatusCombo;
94 QLabel *mOrganizerLabel; 99 QLabel *mOrganizerLabel;
95 100
96 QPushButton* mAddButton; 101 QPushButton* mAddButton;
97 QPushButton* mRemoveButton; 102 QPushButton* mRemoveButton;
98 QPushButton* mAddressBookButton; 103 QPushButton* mAddressBookButton;
99 104
100 QPtrList<Attendee> mdelAttendees; 105 QPtrList<Attendee> mdelAttendees;
101}; 106};
102 107
103#endif 108#endif