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 <libkcal/attendee.h>
00025 #include <kabc/addressee.h>
00026 
00027 #include <qwidget.h>
00028 #include <qtimer.h>
00029 
00030 class QBoxLayout;
00031 class QComboBox;
00032 class QCheckBox;
00033 class QLabel;
00034 class QPushButton;
00035 class QHBox;
00036 class QListViewItem;
00037 
00038 namespace KPIM {
00039   class AddresseeLineEdit;
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     virtual void removeAttendee( KCal::Attendee *attendee ) = 0;
00057 
00058     virtual void readEvent( KCal::Incidence *incidence );
00059     virtual void writeEvent( KCal::Incidence *incidence );
00060 
00062     void cancelAttendeeEvent( KCal::Incidence *incidence );
00063 
00064     virtual void setOrganizer(const QString &newOrganizer);
00065 
00066   public slots:
00067     void acceptForMe();
00068     void declineForMe();
00069 
00070   signals:
00071     void updateAttendeeSummary( int count );
00072 
00073   protected:
00074     void initOrganizerWidgets( QWidget *parent, QBoxLayout *layout );
00075     void initEditWidgets( QWidget *parent, QBoxLayout *layout );
00076 
00082     void insertAttendeeFromAddressee( const KABC::Addressee &a, const KCal::Attendee* at=0 );
00083 
00084     void fillOrganizerCombo();
00085     virtual QListViewItem* hasExampleAttendee() const = 0;
00086     bool isExampleAttendee( const KCal::Attendee* ) const;
00087     virtual KCal::Attendee* currentAttendee() const = 0;
00088     virtual void updateCurrentItem() = 0;
00089 
00090     virtual void setSelected ( int index ) = 0;
00091     virtual int selectedIndex() = 0;
00092     virtual void changeStatusForMe( KCal::Attendee::PartStat status ) = 0;
00093 
00094     virtual bool eventFilter( QObject *, QEvent *);
00095 
00096   protected slots:
00097     void addNewAttendee();
00098     void openAddressBook();
00099 
00100     void setEnableAttendeeInput( bool enabled );
00101     void updateAttendeeInput();
00102     void clearAttendeeInput();
00103     void fillAttendeeInput( KCal::Attendee *a );
00104     void expandAttendee();
00105     void updateAttendee();
00106 
00107   protected:
00108     KPIM::AddresseeLineEdit *mNameEdit;
00109     QString mUid;
00110     QComboBox* mRoleCombo;
00111     QCheckBox* mRsvpButton;
00112     QComboBox* mStatusCombo;
00113 
00114     QHBox* mOrganizerHBox;
00115     QComboBox *mOrganizerCombo; // either we organize it (combo shown)
00116     QLabel *mOrganizerLabel; // or someone else does (just a label is shown)
00117 
00118     QLabel* mDelegateLabel;
00119 
00120     QPushButton* mAddButton;
00121     QPushButton* mRemoveButton;
00122     QPushButton* mAddressBookButton;
00123 
00124     QPtrList<KCal::Attendee> mdelAttendees;
00125     QPtrList<KCal::Attendee> mnewAttendees;
00126 
00127   private:
00128     KABC::Addressee::List expandDistList( const QString &text ) const;
00129     bool mDisableItemUpdate;
00130     QTimer mExpandDistListTimer;
00131 };
00132 
00133 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys