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 <qwidget.h>
00028 #include <qdatetime.h>
00029 #include <qtimer.h>
00030 
00031 class KDIntervalColorRectangle;
00032 class QLabel;
00033 class KDGanttView;
00034 class KDGanttViewItem;
00035 class FreeBusyItem;
00036 
00037 namespace KCal {
00038   class FreeBusy;
00039   class Attendee;
00040 }
00041 
00042 
00043 class KOEditorFreeBusy : public QWidget
00044 {
00045     Q_OBJECT
00046   public:
00047     KOEditorFreeBusy( int spacing = 8, QWidget *parent = 0,
00048                       const char *name = 0 );
00049     virtual ~KOEditorFreeBusy();
00050 
00051     void setUpdateEnabled( bool enabled );
00052     bool updateEnabled() const;
00053 
00054     void insertAttendee( KCal::Attendee *, bool readFBList );
00055     void removeAttendee( KCal::Attendee * );
00056     void updateAttendee( KCal::Attendee * );
00057     void clearAttendees();
00058 
00059     void readEvent( KCal::Event * );
00060 
00061     void triggerReload();
00062     void cancelReload();
00063 
00064   signals:
00065     void dateTimesChanged( const QDateTime &, const QDateTime & );
00066 
00067   public slots:
00068     void slotInsertFreeBusy( KCal::FreeBusy *fb, const QString &email );
00069 
00070     void setDateTimes( const QDateTime &, const QDateTime & );
00071 
00072     void editFreeBusyUrl( KDGanttViewItem *item );
00073 
00074   protected slots:
00075     void slotUpdateGanttView( const QDateTime &, const QDateTime & );
00076     void slotScaleChanged( int );
00077     void slotCenterOnStart() ;
00078     void slotZoomToTime();
00079     void slotPickDate();
00080 
00081     // Force the download of FB informations
00082     void manualReload();
00083     // Only download FB if the auto-download option is set in config
00084     void autoReload();
00085     void slotIntervalColorRectangleMoved( const QDateTime& start, const QDateTime& end );
00086 
00087   protected:
00088     void timerEvent( QTimerEvent* );
00089 
00090   private:
00091     void updateFreeBusyData( FreeBusyItem * );
00092 
00093     bool findFreeSlot( QDateTime &dtFrom, QDateTime &dtTo );
00094     bool tryDate( QDateTime &tryFrom, QDateTime &tryTo );
00095     bool tryDate( FreeBusyItem *attendee,
00096                   QDateTime &tryFrom, QDateTime &tryTo );
00097     void updateStatusSummary();
00098     void reload();
00099     KDGanttView *mGanttView;
00100     KDIntervalColorRectangle* mEventRectangle;
00101     QLabel *mStatusSummaryLabel;
00102     bool mIsOrganizer;
00103     QComboBox *scaleCombo;
00104 
00105     QDateTime mDtStart, mDtEnd;
00106 
00107     QTimer mReloadTimer;
00108 
00109     bool mForceDownload;
00110 };
00111 
00112 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys