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 <tqwidget.h>
00025 #include <libkcal/attendee.h>
00026 #include <kabc/addressee.h>
00027 
00028 class TQBoxLayout;
00029 class TQComboBox;
00030 class TQCheckBox;
00031 class TQLabel;
00032 class TQPushButton;
00033 class TQHBox;
00034 class TQListViewItem;
00035 
00036 namespace KPIM {
00037   class AddresseeLineEdit;
00038 }
00039 
00040 namespace KCal {
00041   class Incidence;
00042 }
00043 
00047 class KOAttendeeEditor : public TQWidget
00048 {
00049   Q_OBJECT
00050   TQ_OBJECT
00051   public:
00052     KOAttendeeEditor( TQWidget *parent, const char *name = 0 );
00053 
00054     virtual void insertAttendee( KCal::Attendee *attendee, bool fetchFB = true ) = 0;
00055     virtual void removeAttendee( KCal::Attendee *attendee ) = 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( TQWidget *parent, TQBoxLayout *layout );
00072     void initEditWidgets( TQWidget *parent, TQBoxLayout *layout );
00073 
00079     void insertAttendeeFromAddressee( const KABC::Addressee &a, const KCal::Attendee* at=0 );
00080 
00081     void fillOrganizerCombo();
00082     virtual TQListViewItem* 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 setSelected ( int index ) = 0;
00088     virtual int selectedIndex() = 0;
00089     virtual void changeStatusForMe( KCal::Attendee::PartStat status ) = 0;
00090 
00091     virtual bool eventFilter( TQObject *, TQEvent *);
00092 
00093   protected slots:
00094     void addNewAttendee();
00095     void openAddressBook();
00096 
00097     void setEnableAttendeeInput( bool enabled );
00098     void updateAttendeeInput();
00099     void clearAttendeeInput();
00100     void fillAttendeeInput( KCal::Attendee *a );
00101     void expandAttendee();
00102     void updateAttendee();
00103 
00104   protected:
00105     KPIM::AddresseeLineEdit *mNameEdit;
00106     TQString mUid;
00107     TQComboBox* mRoleCombo;
00108     TQCheckBox* mRsvpButton;
00109     TQComboBox* mStatusCombo;
00110 
00111     TQHBox* mOrganizerHBox;
00112     TQComboBox *mOrganizerCombo; // either we organize it (combo shown)
00113     TQLabel *mOrganizerLabel; // or someone else does (just a label is shown)
00114 
00115     TQLabel* mDelegateLabel;
00116 
00117     TQPushButton* mAddButton;
00118     TQPushButton* mRemoveButton;
00119     TQPushButton* mAddressBookButton;
00120 
00121     TQPtrList<KCal::Attendee> mdelAttendees;
00122     TQPtrList<KCal::Attendee> mnewAttendees;
00123 
00124   private:
00125     KABC::Addressee::List expandDistList( const TQString &text ) const;
00126     bool mDisableItemUpdate;
00127 };
00128 
00129 #endif