summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditordetails.cpp35
-rw-r--r--korganizer/koeditordetails.h5
2 files changed, 40 insertions, 0 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index c0e7bdd..8e2fabe 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -24,33 +24,39 @@
#include <qtooltip.h>
#include <qfiledialog.h>
#include <qlayout.h>
#include <qvbox.h>
#include <qbuttongroup.h>
#include <qvgroupbox.h>
#include <qwidgetstack.h>
#include <qdatetime.h>
#include <qapp.h>
#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"
#include "koeditordetails.h"
template <>
CustomListViewItem<class Attendee *>::~CustomListViewItem()
{
delete mData;
}
template <>
void CustomListViewItem<class Attendee *>::updateItem()
@@ -182,63 +188,74 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
// topLayout->addWidget(statusLabel,4,3);
// // topLayout->addWidget(mStatusCombo,4,3);
// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5);
// #endif
// // topLayout->setRowStretch(5,1);
// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1);
// topLayout->addMultiCellWidget(buttonBox,2,3,5,5);
// topLayout->setRowStretch(1,5);
// topLayout->setColStretch(0,0);
#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()
{
}
void KOEditorDetails::removeAttendee()
{
AttendeeListItem *aItem = (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);
delete aItem;
updateAttendeeInput();
}
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
#endif
}
void KOEditorDetails::addNewAttendee()
{
#if 0
// this is cool. If they didn't enter an email address,
// try to look it up in the address book and fill it in for them.
@@ -250,32 +267,50 @@ void KOEditorDetails::addNewAttendee()
if (addrBook.init() == AddressBook::NoError) {
if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) {
kdDebug() << "positive match" << endl;
// take first email address
if (!entries.front().emails.isEmpty() &&
entries.front().emails.first().length()>0)
mEmailEdit->setText(entries.front().emails.first());
}
}
}
#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 );
}
void KOEditorDetails::setDefaults()
{
mRsvpButton->setChecked(true);
mListView->clear();
mdelAttendees.clear();
clearAttendeeInput();
mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
mNameEdit->setText("");
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h
index 930b296..0cc807f 100644
--- a/korganizer/koeditordetails.h
+++ b/korganizer/koeditordetails.h
@@ -10,32 +10,33 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
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>
#include <qcombobox.h>
#include <qmultilineedit.h>
#include <klistview.h>
#include <qradiobutton.h>
#include <qptrlist.h>
#include <kapplication.h>
#include <libkcal/event.h>
@@ -57,32 +58,36 @@ class KOEditorDetails : public QWidget
virtual ~KOEditorDetails();
/** Set widgets to default values */
void setDefaults();
/** Read event object and setup widgets accordingly */
void readEvent(Incidence *);
/** Write event settings to event object */
void writeEvent(Incidence *);
/** return a clone of the event with attendees to be canceld*/
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();
void clearAttendeeInput();
void fillAttendeeInput(AttendeeListItem *);
void updateAttendeeItem();
void setEnabledAttendeeInput(bool);
private:
bool mDisableItemUpdate;
QLineEdit *mNameEdit;
QLineEdit *mUidEdit;