korganizer

koagendaview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2000,2001,2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 #ifndef KOAGENDAVIEW_H
00026 #define KOAGENDAVIEW_H
00027 
00028 #include <qscrollview.h>
00029 #include <qlabel.h>
00030 
00031 #include "calprinter.h"
00032 
00033 #include "agendaview.h"
00034 
00035 class QHBox;
00036 class QPushButton;
00037 class QBoxLayout;
00038 
00039 class KOAgenda;
00040 class KOAgendaItem;
00041 class TimeLabels;
00042 class KConfig;
00043 
00044 namespace KCal {
00045   class ResourceCalendar;
00046 }
00047 
00048 namespace KOrg {
00049   class IncidenceChangerBase;
00050 }
00051 
00052 class EventIndicator : public QFrame
00053 {
00054     Q_OBJECT
00055   public:
00056     enum Location { Top, Bottom };
00057     EventIndicator( Location loc = Top, QWidget *parent = 0,
00058                     const char *name = 0 );
00059     virtual ~EventIndicator();
00060 
00061     void changeColumns( int columns );
00062 
00063     void enableColumn( int column, bool enable );
00064 
00065   protected:
00066     void drawContents( QPainter * );
00067 
00068   private:
00069     int mColumns;
00070     Location mLocation;
00071     QPixmap mPixmap;
00072     QMemArray<bool> mEnabled;
00073 };
00074 
00075 class KOAlternateLabel : public QLabel
00076 {
00077     Q_OBJECT
00078   public:
00079     KOAlternateLabel( const QString &shortlabel, const QString &longlabel,
00080                       const QString &extensivelabel = QString::null,
00081                       QWidget *parent = 0, const char *name = 0 );
00082     ~KOAlternateLabel();
00083 
00084     virtual QSize minimumSizeHint() const;
00085 
00086   public slots:
00087     void setText( const QString & );
00088     void useShortText();
00089     void useLongText();
00090     void useExtensiveText();
00091     void useDefaultText();
00092 
00093   protected:
00094     virtual void resizeEvent( QResizeEvent * );
00095     virtual void squeezeTextToLabel();
00096     bool mTextTypeFixed;
00097     QString mShortText, mLongText, mExtensiveText;
00098 };
00099 
00104 class KOAgendaView : public KOrg::AgendaView
00105 {
00106     Q_OBJECT
00107   public:
00108     KOAgendaView( Calendar *cal, QWidget *parent = 0, const char *name = 0, bool isSideBySide = false );
00109     virtual ~KOAgendaView();
00110 
00111 
00112 
00114     virtual int maxDatesHint();
00115 
00117     virtual int currentDateCount();
00118 
00120     virtual Incidence::List selectedIncidences();
00121 
00123     virtual DateList selectedDates();
00124 
00126     virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00127 
00129     void clearView();
00130 
00131     KOrg::CalPrinterBase::PrintType printType();
00132 
00134     QDateTime selectionStart() { return mTimeSpanBegin; }
00136     QDateTime selectionEnd() { return mTimeSpanEnd; }
00138     bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00140     void deleteSelectedDateTime();
00142     bool selectedIsSingleCell();
00143 
00144     void setTypeAheadReceiver( QObject * );
00145 
00147     void setResource( KCal::ResourceCalendar *res, const QString &subResource = QString::null );
00148 
00149     KOAgenda* agenda() const { return mAgenda; }
00150     QSplitter* splitter() const { return mSplitterAgenda; }
00151 
00152   public slots:
00153     virtual void updateView();
00154     virtual void updateConfig();
00155     virtual void showDates( const QDate &start, const QDate &end );
00156     virtual void showIncidences( const Incidence::List &incidenceList );
00157 
00158     void insertIncidence( Incidence *incidence, const QDate &curDate, int curCol = -1 );
00159     void changeIncidenceDisplayAdded( Incidence *incidence );
00160     void changeIncidenceDisplay( Incidence *incidence, int mode );
00161 
00162     void clearSelection();
00163 
00164     void startDrag( Incidence * );
00165 
00166     void readSettings();
00167     void readSettings( KConfig * );
00168     void writeSettings( KConfig * );
00169 
00170     void setContentsPos( int y );
00171 
00172     void setExpandedButton( bool expanded );
00173 
00174     void finishTypeAhead();
00175 
00177     void slotTodoDropped( Todo *, const QPoint &, bool );
00178 
00179     void enableAgendaUpdate( bool enable );
00180     void setIncidenceChanger( KOrg::IncidenceChangerBase *changer );
00181 
00182     void zoomInHorizontally( const QDate& date=QDate() );
00183     void zoomOutHorizontally( const QDate& date=QDate() );
00184 
00185     void zoomInVertically( );
00186     void zoomOutVertically( );
00187 
00188     void zoomView( const int delta, const QPoint &pos,
00189       const Qt::Orientation orient=Qt::Horizontal );
00190 
00191     void clearTimeSpanSelection();
00192   signals:
00193     void toggleExpand();
00194     void zoomViewHorizontally(const QDate &, int count );
00195 
00196     void timeSpanSelectionChanged();
00197 
00198   protected:
00200     void fillAgenda( const QDate &startDate );
00201 
00203     void fillAgenda();
00204 
00205     void connectAgenda( KOAgenda*agenda, QPopupMenu*popup, KOAgenda* otherAgenda );
00206 
00208     void createDayLabels();
00209 
00213     void setHolidayMasks();
00214 
00215     void removeIncidence( Incidence * );
00220     void updateEventIndicators();
00221 
00222     void updateTimeBarWidth();
00223 
00224   protected slots:
00226     void updateEventDates( KOAgendaItem *item );
00228     void doUpdateItem();
00229 
00230     void updateEventIndicatorTop( int newY );
00231     void updateEventIndicatorBottom( int newY );
00232 
00234     void newTimeSpanSelected( const QPoint &start, const QPoint &end );
00236     void newTimeSpanSelectedAllDay( const QPoint &start, const QPoint &end );
00237 
00238   private:
00239     bool filterByResource( Incidence *incidence );
00240 
00241   private:
00242     // view widgets
00243     QFrame *mDayLabels;
00244     QHBox *mDayLabelsFrame;
00245     QBoxLayout *mLayoutDayLabels;
00246     QFrame *mAllDayFrame;
00247     KOAgenda *mAllDayAgenda;
00248     KOAgenda *mAgenda;
00249     TimeLabels *mTimeLabels;
00250     QWidget *mDummyAllDayLeft;
00251     QSplitter *mSplitterAgenda;
00252     QPushButton *mExpandButton;
00253 
00254     DateList mSelectedDates;  // List of dates to be displayed
00255     int mViewType;
00256 
00257     KOEventPopupMenu *mAgendaPopup;
00258     KOEventPopupMenu *mAllDayAgendaPopup;
00259 
00260     EventIndicator *mEventIndicatorTop;
00261     EventIndicator *mEventIndicatorBottom;
00262 
00263     QMemArray<int> mMinY;
00264     QMemArray<int> mMaxY;
00265 
00266     QMemArray<bool> mHolidayMask;
00267 
00268     QPixmap mExpandedPixmap;
00269     QPixmap mNotExpandedPixmap;
00270 
00271     QDateTime mTimeSpanBegin;
00272     QDateTime mTimeSpanEnd;
00273     bool mTimeSpanInAllDay;
00274     bool mAllowAgendaUpdate;
00275 
00276     Incidence *mUpdateItem;
00277 
00278     KCal::ResourceCalendar *mResource;
00279     QString mSubResource;
00280 
00281     bool mIsSideBySide;
00282 };
00283 
00284 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys