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