korganizer

koeditorfreebusy.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2000,2001,2004 Cornelius Schumacher <schumacher@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     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef KOEDITORFREEBUSY_H
00025 #define KOEDITORFREEBUSY_H
00026 
00027 #include "koattendeeeditor.h"
00028 
00029 #include <qwidget.h>
00030 #include <qdatetime.h>
00031 #include <qtimer.h>
00032 
00033 class KDIntervalColorRectangle;
00034 class QLabel;
00035 class KDGanttView;
00036 class KDGanttViewItem;
00037 class FreeBusyItem;
00038 
00039 namespace KCal {
00040   class FreeBusy;
00041   class Attendee;
00042 }
00043 
00044 
00045 class KOEditorFreeBusy : public KOAttendeeEditor
00046 {
00047     Q_OBJECT
00048   public:
00049     KOEditorFreeBusy( int spacing = 8, QWidget *parent = 0,
00050                       const char *name = 0 );
00051     virtual ~KOEditorFreeBusy();
00052 
00053     void setUpdateEnabled( bool enabled );
00054     bool updateEnabled() const;
00055 
00056     void insertAttendee( KCal::Attendee *, bool readFBList = true );
00057     void removeAttendee( KCal::Attendee * );
00058     void clearAttendees();
00059 
00060     void readEvent( KCal::Event * );
00061     void writeEvent( KCal::Event *event );
00062 
00063     void triggerReload();
00064     void cancelReload();
00065 
00066   signals:
00067     void dateTimesChanged( const QDateTime &, const QDateTime & );
00068 
00069   public slots:
00070     void slotInsertFreeBusy( KCal::FreeBusy *fb, const QString &email );
00071 
00072     void setDateTimes( const QDateTime &, const QDateTime & );
00073 
00074     void editFreeBusyUrl( KDGanttViewItem *item );
00075 
00076   protected slots:
00077     void slotUpdateGanttView( const QDateTime &, const QDateTime & );
00078     void slotScaleChanged( int );
00079     void slotCenterOnStart() ;
00080     void slotZoomToTime();
00081     void slotPickDate();
00082     void showAttendeeStatusMenu();
00083 
00084     // Force the download of FB informations
00085     void manualReload();
00086     // Only download FB if the auto-download option is set in config
00087     void autoReload();
00088     void slotIntervalColorRectangleMoved( const QDateTime& start, const QDateTime& end );
00089 
00090     void removeAttendee();
00091     void listViewClicked( int button, KDGanttViewItem* item );
00092 
00093   protected:
00094     void timerEvent( QTimerEvent* );
00095     KCal::Attendee* currentAttendee() const;
00096     void updateCurrentItem();
00097     void clearSelection() const;
00098     void changeStatusForMe( KCal::Attendee::PartStat status );
00099 
00100   private:
00101     void updateFreeBusyData( FreeBusyItem * );
00102 
00103     bool findFreeSlot( QDateTime &dtFrom, QDateTime &dtTo );
00104     bool tryDate( QDateTime &tryFrom, QDateTime &tryTo );
00105     bool tryDate( FreeBusyItem *attendee,
00106                   QDateTime &tryFrom, QDateTime &tryTo );
00107     void updateStatusSummary();
00108     void reload();
00109     KDGanttView *mGanttView;
00110     KDIntervalColorRectangle* mEventRectangle;
00111     QLabel *mStatusSummaryLabel;
00112     bool mIsOrganizer;
00113     QComboBox *scaleCombo;
00114 
00115     QDateTime mDtStart, mDtEnd;
00116 
00117     QTimer mReloadTimer;
00118 
00119     bool mForceDownload;
00120 };
00121 
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys