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 Qt, and distribute the resulting executable,
00022     without including the source code for Qt 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   public:
00048     KOTimelineView(Calendar *calendar, TQWidget *parent = 0,
00049                     const char *name = 0);
00050     ~KOTimelineView();
00051 
00052     virtual KCal::ListBase<KCal::Incidence> selectedIncidences();
00053     virtual KCal::DateList selectedIncidenceDates();
00054     virtual int currentDateCount();
00055     virtual void showDates(const TQDate&, const TQDate&);
00056     virtual void showIncidences(const KCal::ListBase<KCal::Incidence>&, const TQDate &date);
00057     virtual void updateView();
00058     virtual void changeIncidenceDisplay(KCal::Incidence* incidence, int mode);
00059     virtual int maxDatesHint() { return 0; }
00060 
00061     virtual bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
00062 
00063   private:
00064     KOrg::TimelineItem* calendarItemForIncidence( KCal::Incidence* incidence );
00065     void insertIncidence( KCal::Incidence* incidence );
00066     void insertIncidence( KCal::Incidence* incidence, const TQDate &day );
00067     void removeIncidence( KCal::Incidence* incidence );
00068 
00069   private slots:
00070     void itemSelected( KDGanttViewItem *item );
00071     void itemDoubleClicked( KDGanttViewItem *item );
00072     void itemRightClicked( KDGanttViewItem *item );
00073     void itemMoved( KDGanttViewItem *item );
00074     void overscale( KDGanttView::Scale scale );
00075     void newEventWithHint( const TQDateTime & );
00076 
00077   private:
00078     KDGanttView* mGantt;
00079     TQMap<KCal::ResourceCalendar*, TQMap<TQString, KOrg::TimelineItem*> > mCalendarItemMap;
00080     KOEventPopupMenu *mEventPopup;
00081     TQDate mStartDate, mEndDate;
00082     TQDateTime mHintDate;
00083 };
00084 
00085 #endif