koagendaview.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KOAGENDAVIEW_H
00025 #define KOAGENDAVIEW_H
00026
00027 #include <qscrollview.h>
00028 #include <qlabel.h>
00029
00030 #include "calprinter.h"
00031 #include "koeventview.h"
00032
00033 class QHBox;
00034 class QPushButton;
00035
00036 class KOAgenda;
00037 class KOAgendaItem;
00038 class KConfig;
00039
00040 class TimeLabels : public QScrollView
00041 {
00042 Q_OBJECT
00043 public:
00044 TimeLabels( int rows, QWidget *parent = 0, const char *name = 0,
00045 WFlags f = 0 );
00046
00047 void setCellHeight( int height );
00048
00050 virtual int minimumWidth() const;
00051
00053 void updateConfig();
00054
00056 void setAgenda( KOAgenda *agenda );
00057
00059 virtual void paintEvent( QPaintEvent *e );
00060
00061 public slots:
00063 void positionChanged();
00064
00065 protected:
00066 void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
00067
00068 private:
00069 int mRows;
00070 int mCellHeight;
00071
00072 KOAgenda* mAgenda;
00073 };
00074
00075 class EventIndicator : public QFrame
00076 {
00077 Q_OBJECT
00078 public:
00079 enum Location { Top, Bottom };
00080 EventIndicator( Location loc = Top, QWidget *parent = 0,
00081 const char *name = 0 );
00082 virtual ~EventIndicator();
00083
00084 void changeColumns( int columns );
00085
00086 void enableColumn( int column, bool enable );
00087
00088 protected:
00089 void drawContents( QPainter * );
00090
00091 private:
00092 int mColumns;
00093 QHBox *mTopBox;
00094 QBoxLayout *mTopLayout;
00095 Location mLocation;
00096 QPixmap mPixmap;
00097 QMemArray<bool> mEnabled;
00098 };
00099
00100 class KOAlternateLabel : public QLabel
00101 {
00102 Q_OBJECT
00103 public:
00104 KOAlternateLabel( QString shortlabel, QString longlabel,
00105 QString extensivelabel = QString::null,
00106 QWidget *parent = 0, const char *name = 0 );
00107 ~KOAlternateLabel();
00108
00109 virtual QSize minimumSizeHint() const;
00110
00111 public slots:
00112 void setText( const QString & );
00113 void useShortText();
00114 void useLongText();
00115 void useExtensiveText();
00116 void useDefaultText();
00117
00118 protected:
00119 virtual void resizeEvent( QResizeEvent * );
00120 virtual void squeezeTextToLabel();
00121 bool mTextTypeFixed;
00122 QString mShortText, mLongText, mExtensiveText;
00123 };
00124
00129 class KOAgendaView : public KOEventView
00130 {
00131 Q_OBJECT
00132 public:
00133 KOAgendaView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
00134 virtual ~KOAgendaView();
00135
00137 virtual int maxDatesHint();
00138
00140 virtual int currentDateCount();
00141
00143 virtual Incidence::List selectedIncidences();
00144
00146 virtual DateList selectedDates();
00147
00149 virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00150
00152 void clearView();
00153
00154 virtual void printPreview( CalPrinter *calPrinter,
00155 const QDate &, const QDate & );
00156
00157 CalPrinter::PrintType printType();
00158
00160 QDateTime selectionStart() { return mTimeSpanBegin; }
00162 QDateTime selectionEnd() { return mTimeSpanEnd; }
00164 bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00166 void deleteSelectedDateTime();
00168 bool selectedIsSingleCell();
00169
00170 void setTypeAheadReceiver( QObject * );
00171
00172 public slots:
00173 virtual void updateView();
00174 virtual void updateConfig();
00175 virtual void showDates( const QDate &start, const QDate &end );
00176 virtual void showIncidences( const Incidence::List & );
00177
00178 void insertIncidence( Incidence *incidence, QDate curDate, int curCol = -1 );
00179 void changeIncidenceDisplayAdded( Incidence *incidence );
00180 void changeIncidenceDisplay( Incidence *incidence, int mode );
00181
00182 void clearSelection();
00183
00184 void newEvent( const QPoint &pos );
00185 void newEvent( const QPoint &start, const QPoint &end );
00186 void newEventAllDay( const QPoint &pos );
00187
00188 void startDrag( Incidence * );
00189
00190 void readSettings();
00191 void readSettings( KConfig * );
00192 void writeSettings( KConfig * );
00193
00194 void setContentsPos( int y );
00195
00196 void setExpandedButton( bool expanded );
00197
00198 void finishTypeAhead();
00199
00201 void slotTodoDropped( Todo *, const QPoint &, bool );
00202
00203 void enableAgendaUpdate( bool enable );
00204
00205 signals:
00206 void toggleExpand();
00207
00208 protected:
00210 void fillAgenda( const QDate &startDate );
00211
00213 void fillAgenda();
00214
00215 void connectAgenda( KOAgenda*agenda, QPopupMenu*popup, KOAgenda* otherAgenda );
00216
00218 void createDayLabels();
00219
00223 void setHolidayMasks();
00224
00225 void removeIncidence( Incidence * );
00230 void updateEventIndicators();
00231
00232 protected slots:
00234 void updateEventDates( KOAgendaItem *item );
00236 void doUpdateItem();
00237
00238 void updateEventIndicatorTop( int newY );
00239 void updateEventIndicatorBottom( int newY );
00240
00242 void newTimeSpanSelected( const QPoint &start, const QPoint &end );
00244 void newTimeSpanSelectedAllDay( const QPoint &start, const QPoint &end );
00245
00246 private:
00247
00248 QFrame *mDayLabels;
00249 QHBox *mDayLabelsFrame;
00250 QBoxLayout *mLayoutDayLabels;
00251 QFrame *mAllDayFrame;
00252 KOAgenda *mAllDayAgenda;
00253 KOAgenda *mAgenda;
00254 TimeLabels *mTimeLabels;
00255 QWidget *mDummyAllDayLeft;
00256 QSplitter *mSplitterAgenda;
00257 QPushButton *mExpandButton;
00258
00259 DateList mSelectedDates;
00260 int mViewType;
00261
00262 KOEventPopupMenu *mAgendaPopup;
00263 KOEventPopupMenu *mAllDayAgendaPopup;
00264
00265 EventIndicator *mEventIndicatorTop;
00266 EventIndicator *mEventIndicatorBottom;
00267
00268 QMemArray<int> mMinY;
00269 QMemArray<int> mMaxY;
00270
00271 QMemArray<bool> mHolidayMask;
00272
00273 QPixmap mExpandedPixmap;
00274 QPixmap mNotExpandedPixmap;
00275
00276 QDateTime mTimeSpanBegin;
00277 QDateTime mTimeSpanEnd;
00278 bool mTimeSpanInAllDay;
00279 bool mAllowAgendaUpdate;
00280
00281 Incidence *mUpdateItem;
00282 };
00283
00284 #endif
This file is part of the documentation for korganizer Library Version 3.3.2.