korganizer

kotimelineview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2007 Till Adam <adam@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 TQt, and distribute the resulting executable,
00022     without including the source code for TQt in the source distribution.
00023 */
00024 #ifndef KOTIMELINEVIEW_H
00025 #define KOTIMELINEVIEW_H
00026 
00027 #include <koeventview.h>
00028 #include <kdgantt/KDGanttView.h>
00029 #include <tqmap.h>
00030 
00031 class KDGanttViewItem;
00032 
00033 namespace KCal {
00034   class ResourceCalendar;
00035 }
00036 
00037 namespace KOrg {
00038   class TimelineItem;
00039 }
00040 
00044 class KOTimelineView : public KOEventView
00045 {
00046     Q_OBJECT
00047   TQ_OBJECT
00048   public:
00049     KOTimelineView(Calendar *calendar, TQWidget *parent = 0,
00050                     const char *name = 0);
00051     ~KOTimelineView();
00052 
00053     virtual KCal::ListBase<KCal::Incidence> selectedIncidences();
00054     virtual KCal::DateList selectedIncidenceDates();
00055     virtual int currentDateCount();
00056     virtual void showDates(const TQDate&, const TQDate&);
00057     virtual void showIncidences(const KCal::ListBase<KCal::Incidence>&, const TQDate &date);
00058     virtual void updateView();
00059     virtual void changeIncidenceDisplay(KCal::Incidence* incidence, int mode);
00060     virtual int maxDatesHint() { return 0; }
00061 
00062     virtual bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
00063 
00064   private:
00065     KOrg::TimelineItem* calendarItemForIncidence( KCal::Incidence* incidence );
00066     void insertIncidence( KCal::Incidence* incidence );
00067     void insertIncidence( KCal::Incidence* incidence, const TQDate &day );
00068     void removeIncidence( KCal::Incidence* incidence );
00069 
00070   private slots:
00071     void itemSelected( KDGanttViewItem *item );
00072     void itemDoubleClicked( KDGanttViewItem *item );
00073     void itemRightClicked( KDGanttViewItem *item );
00074     void itemMoved( KDGanttViewItem *item );
00075     void overscale( KDGanttView::Scale scale );
00076     void newEventWithHint( const TQDateTime & );
00077 
00078   private:
00079     KDGanttView* mGantt;
00080     TQMap<KCal::ResourceCalendar*, TQMap<TQString, KOrg::TimelineItem*> > mCalendarItemMap;
00081     KOEventPopupMenu *mEventPopup;
00082     TQDate mStartDate, mEndDate;
00083     TQDateTime mHintDate;
00084 };
00085 
00086 #endif