korganizer

koeditorfreebusy.h
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2000,2001,2004 Cornelius Schumacher <schumacher@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 #ifndef KOEDITORFREEBUSY_H
25 #define KOEDITORFREEBUSY_H
26 
27 #include "koattendeeeditor.h"
28 
29 #include <tqwidget.h>
30 #include <tqdatetime.h>
31 #include <tqtimer.h>
32 
33 class KDIntervalColorRectangle;
34 class TQLabel;
35 class KDGanttView;
36 class KDGanttViewItem;
37 class FreeBusyItem;
38 
39 namespace KCal {
40  class FreeBusy;
41  class Attendee;
42 }
43 
44 
45 class KOEditorFreeBusy : public KOAttendeeEditor
46 {
47  TQ_OBJECT
48 
49  public:
50  KOEditorFreeBusy( int spacing = 8, TQWidget *parent = 0,
51  const char *name = 0 );
52  virtual ~KOEditorFreeBusy();
53 
54  void setUpdateEnabled( bool enabled );
55  bool updateEnabled() const;
56 
57  void insertAttendee( KCal::Attendee *, bool readFBList = true );
58  void removeAttendee( KCal::Attendee * );
59  void clearAttendees();
60 
61  void readEvent( KCal::Event * );
62  void writeEvent( KCal::Event *event );
63 
64  void triggerReload();
65  void cancelReload();
66 
67  signals:
68  void dateTimesChanged( const TQDateTime &, const TQDateTime & );
69 
70  public slots:
71  void slotInsertFreeBusy( KCal::FreeBusy *fb, const TQString &email );
72 
73  void setDateTimes( const TQDateTime &, const TQDateTime & );
74 
75  void editFreeBusyUrl( KDGanttViewItem *item );
76 
77  protected slots:
78  void slotUpdateGanttView( const TQDateTime &, const TQDateTime & );
79  void slotScaleChanged( int );
80  void slotCenterOnStart() ;
81  void slotZoomToTime();
82  void slotPickDate();
83  void showAttendeeStatusMenu();
84 
85  // Force the download of FB informations
86  void manualReload();
87  // Only download FB if the auto-download option is set in config
88  void autoReload();
89  void slotIntervalColorRectangleMoved( const TQDateTime& start, const TQDateTime& end );
90 
91  void removeAttendee();
92  void listViewClicked( int button, KDGanttViewItem* item );
93 
94  protected:
95  void timerEvent( TQTimerEvent* );
96  KCal::Attendee* currentAttendee() const;
97  /* reimpl */
98  TQListViewItem* hasExampleAttendee() const;
99  void updateCurrentItem();
100  void clearSelection() const;
101  void setSelected ( int index );
102  int selectedIndex();
103  void changeStatusForMe( KCal::Attendee::PartStat status );
104  virtual bool eventFilter( TQObject *watched, TQEvent *event );
105 
106  private slots:
107  void slotOrganizerChanged( const TQString &newOrganizer );
108  private:
109  void updateFreeBusyData( FreeBusyItem * );
110 
111  bool findFreeSlot( TQDateTime &dtFrom, TQDateTime &dtTo );
112  bool tryDate( TQDateTime &tryFrom, TQDateTime &tryTo );
113  bool tryDate( FreeBusyItem *attendee,
114  TQDateTime &tryFrom, TQDateTime &tryTo );
115  void updateStatusSummary();
116  void reload();
117  KDGanttView *mGanttView;
118  KDIntervalColorRectangle* mEventRectangle;
119  TQLabel *mStatusSummaryLabel;
120  bool mIsOrganizer;
121  TQComboBox *scaleCombo;
122 
123  TQDateTime mDtStart, mDtEnd;
124 
125  TQTimer mReloadTimer;
126 
127  bool mForceDownload;
128 
129  TQString mCurrentOrganizer;
130 };
131 
132 #endif
Common base class for attendee editor and free busy view.