korganizer

kotimelineview.h
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2007 Till Adam <adam@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 KOTIMELINEVIEW_H
25 #define KOTIMELINEVIEW_H
26 
27 #include <koeventview.h>
28 #include <kdgantt/KDGanttView.h>
29 #include <tqmap.h>
30 
31 class KDGanttViewItem;
32 
33 namespace KCal {
34  class ResourceCalendar;
35 }
36 
37 namespace KOrg {
38  class TimelineItem;
39 }
40 
45 {
46  Q_OBJECT
47  TQ_OBJECT
48  public:
49  KOTimelineView(Calendar *calendar, TQWidget *parent = 0,
50  const char *name = 0);
51  ~KOTimelineView();
52 
54  virtual KCal::DateList selectedIncidenceDates();
55  virtual int currentDateCount();
56  virtual void showDates(const TQDate&, const TQDate&);
57  virtual void showIncidences(const KCal::ListBase<KCal::Incidence>&, const TQDate &date);
58  virtual void updateView();
59  virtual void changeIncidenceDisplay(KCal::Incidence* incidence, int mode);
60  virtual int maxDatesHint() { return 0; }
61 
62  virtual bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
63 
64  private:
65  KOrg::TimelineItem* calendarItemForIncidence( KCal::Incidence* incidence );
66  void insertIncidence( KCal::Incidence* incidence );
67  void insertIncidence( KCal::Incidence* incidence, const TQDate &day );
68  void removeIncidence( KCal::Incidence* incidence );
69 
70  private slots:
71  void itemSelected( KDGanttViewItem *item );
72  void itemDoubleClicked( KDGanttViewItem *item );
73  void itemRightClicked( KDGanttViewItem *item );
74  void itemMoved( KDGanttViewItem *item );
75  void overscale( KDGanttView::Scale scale );
76  void newEventWithHint( const TQDateTime & );
77 
78  private:
79  KDGanttView* mGantt;
80  TQMap<KCal::ResourceCalendar*, TQMap<TQString, KOrg::TimelineItem*> > mCalendarItemMap;
81  KOEventPopupMenu *mEventPopup;
82  TQDate mStartDate, mEndDate;
83  TQDateTime mHintDate;
84 };
85 
86 #endif