korganizer
koattendeeeditor.h
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 #ifndef KOATTENDEEEDITOR_H 00022 #define KOATTENDEEEDITOR_H 00023 00024 #include <qwidget.h> 00025 #include <libkcal/attendee.h> 00026 00027 class QBoxLayout; 00028 class QComboBox; 00029 class QCheckBox; 00030 class QLabel; 00031 class QPushButton; 00032 class QHBox; 00033 00034 namespace KPIM { 00035 class AddresseeLineEdit; 00036 } 00037 00038 namespace KABC { 00039 class Addressee; 00040 } 00041 00042 namespace KCal { 00043 class Incidence; 00044 } 00045 00049 class KOAttendeeEditor : public QWidget 00050 { 00051 Q_OBJECT 00052 public: 00053 KOAttendeeEditor( QWidget *parent, const char *name = 0 ); 00054 00055 virtual void insertAttendee( KCal::Attendee* attendee, bool fetchFB = true ) = 0; 00056 00057 virtual void readEvent( KCal::Incidence *incidence ); 00058 virtual void writeEvent( KCal::Incidence *incidence ); 00059 00061 void cancelAttendeeEvent( KCal::Incidence *incidence ); 00062 00063 public slots: 00064 void acceptForMe(); 00065 void declineForMe(); 00066 00067 signals: 00068 void updateAttendeeSummary( int count ); 00069 00070 protected: 00071 void initOrganizerWidgets( QWidget *parent, QBoxLayout *layout ); 00072 void initEditWidgets( QWidget *parent, QBoxLayout *layout ); 00073 00079 void insertAttendeeFromAddressee( const KABC::Addressee &a, const KCal::Attendee* at=0 ); 00080 00081 void fillOrganizerCombo(); 00082 virtual bool hasExampleAttendee() const = 0; 00083 bool isExampleAttendee( const KCal::Attendee* ) const; 00084 virtual KCal::Attendee* currentAttendee() const = 0; 00085 virtual void updateCurrentItem() = 0; 00086 00087 virtual void changeStatusForMe( KCal::Attendee::PartStat status ) = 0; 00088 00089 virtual bool eventFilter( QObject *, QEvent *); 00090 00091 protected slots: 00092 void addNewAttendee(); 00093 void openAddressBook(); 00094 00095 void setEnableAttendeeInput( bool enabled ); 00096 void updateAttendeeInput(); 00097 void clearAttendeeInput(); 00098 void fillAttendeeInput( KCal::Attendee *a ); 00099 void updateAttendee(); 00100 00101 protected: 00102 KPIM::AddresseeLineEdit *mNameEdit; 00103 QString mUid; 00104 QComboBox* mRoleCombo; 00105 QCheckBox* mRsvpButton; 00106 QComboBox* mStatusCombo; 00107 00108 QHBox* mOrganizerHBox; 00109 QComboBox *mOrganizerCombo; // either we organize it (combo shown) 00110 QLabel *mOrganizerLabel; // or someone else does (just a label is shown) 00111 00112 QLabel* mDelegateLabel; 00113 00114 QPushButton* mAddButton; 00115 QPushButton* mRemoveButton; 00116 QPushButton* mAddressBookButton; 00117 00118 QPtrList<KCal::Attendee> mdelAttendees; 00119 QPtrList<KCal::Attendee> mnewAttendees; 00120 00121 private: 00122 bool mDisableItemUpdate; 00123 }; 00124 00125 #endif