korganizer

multiagendaview.h

00001 /*
00002     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef KORG_MULTIAGENDAVIEW_H_H
00020 #define KORG_MULTIAGENDAVIEW_H_H
00021 
00022 #include "agendaview.h"
00023 
00024 class QScrollView;
00025 class QHBox;
00026 class QSplitter;
00027 class KOAgendaView;
00028 class TimeLabels;
00029 class QScrollBar;
00030 
00031 namespace KCal {
00032   class ResourceCalendar;
00033 }
00034 
00035 namespace KOrg {
00036 
00040 class MultiAgendaView : public AgendaView
00041 {
00042   Q_OBJECT
00043   public:
00044     explicit MultiAgendaView( Calendar* cal, QWidget *parent = 0, const char *name = 0 );
00045     ~MultiAgendaView();
00046 
00047     Incidence::List selectedIncidences();
00048     DateList selectedDates();
00049     int currentDateCount();
00050     int maxDatesHint();
00051 
00052     bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00053 
00054     void setTypeAheadReceiver( QObject *o );
00055 
00056   public slots:
00057     void showDates( const QDate &start, const QDate &end );
00058     void showIncidences( const Incidence::List &incidenceList, const QDate &date );
00059     void updateView();
00060     void changeIncidenceDisplay( Incidence *incidence, int mode );
00061     void updateConfig();
00062 
00063     void setIncidenceChanger( IncidenceChangerBase *changer );
00064 
00065     void finishTypeAhead();
00066 
00067     void show();
00068 
00069     void resourcesChanged();
00070 
00071   protected:
00072     void resizeEvent( QResizeEvent *ev );
00073     bool eventFilter( QObject *obj, QEvent *event );
00074 
00075   private:
00076     void addView( const QString &label, KCal::ResourceCalendar *res, const QString &subRes = QString::null );
00077     void deleteViews();
00078     void recreateViews();
00079     void setupViews();
00080     void resizeScrollView( const QSize &size );
00081     void installSplitterEventFilter( QSplitter *splitter );
00082 
00083   private slots:
00084     void slotSelectionChanged();
00085     void slotClearTimeSpanSelection();
00086     void resizeSplitters();
00087     void zoomView( const int delta, const QPoint &pos, const Qt::Orientation ori );
00088     void slotResizeScrollView();
00089 
00090   private:
00091     QValueList<KOAgendaView*> mAgendaViews;
00092     QValueList<QWidget*> mAgendaWidgets;
00093     QHBox *mTopBox;
00094     QScrollView *mScrollView;
00095     TimeLabels *mTimeLabels;
00096     QSplitter *mLeftSplitter, *mRightSplitter;
00097     QSplitter *mLastMovedSplitter;
00098     QScrollBar *mScrollBar;
00099     QWidget *mLeftBottomSpacer, *mRightBottomSpacer;
00100     QDate mStartDate, mEndDate;
00101     bool mUpdateOnShow;
00102     bool mPendingChanges;
00103 };
00104 
00105 }
00106 
00107 #endif