korganizer
koagendaview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KOAGENDAVIEW_H
00026 #define KOAGENDAVIEW_H
00027
00028 #include <qscrollview.h>
00029 #include <qlabel.h>
00030
00031 #include <libkcal/calendar.h>
00032
00033 #include "calprinter.h"
00034 #include "calendarview.h"
00035
00036 #include "agendaview.h"
00037
00038 class QHBox;
00039 class QPushButton;
00040 class QBoxLayout;
00041
00042 class KOAgenda;
00043 class KOAgendaItem;
00044 class TimeLabels;
00045 class KConfig;
00046
00047 namespace KOrg {
00048 class IncidenceChangerBase;
00049 }
00050
00051 class EventIndicator : public QFrame
00052 {
00053 Q_OBJECT
00054 public:
00055 enum Location { Top, Bottom };
00056 EventIndicator( Location loc = Top, QWidget *parent = 0,
00057 const char *name = 0 );
00058 virtual ~EventIndicator();
00059
00060 void changeColumns( int columns );
00061
00062 void enableColumn( int column, bool enable );
00063
00064 protected:
00065 void drawContents( QPainter * );
00066
00067 private:
00068 int mColumns;
00069 Location mLocation;
00070 QPixmap mPixmap;
00071 QMemArray<bool> mEnabled;
00072 };
00073
00074 class KOAlternateLabel : public QLabel
00075 {
00076 Q_OBJECT
00077 public:
00078 KOAlternateLabel( const QString &shortlabel, const QString &longlabel,
00079 const QString &extensivelabel = QString::null,
00080 QWidget *parent = 0, const char *name = 0 );
00081 ~KOAlternateLabel();
00082
00083 virtual QSize minimumSizeHint() const;
00084
00085 enum TextType { Short = 0, Long = 1, Extensive = 2 };
00086 TextType largestFittingTextType() const;
00087 void setFixedType( TextType type );
00088
00089 public slots:
00090 void useShortText();
00091 void useLongText();
00092 void useExtensiveText();
00093 void useDefaultText();
00094
00095 protected:
00096 virtual void resizeEvent( QResizeEvent * );
00097 virtual void squeezeTextToLabel();
00098 bool mTextTypeFixed;
00099 QString mShortText, mLongText, mExtensiveText;
00100 };
00101
00106 class KOAgendaView : public KOrg::AgendaView, public KCal::Calendar::Observer
00107 {
00108 Q_OBJECT
00109 public:
00110 KOAgendaView( Calendar *cal,
00111 CalendarView *calendarView,
00112 QWidget *parent = 0,
00113 const char *name = 0,
00114 bool isSideBySide = false );
00115 virtual ~KOAgendaView();
00116
00118 virtual int maxDatesHint();
00119
00121 virtual int currentDateCount();
00122
00124 virtual Incidence::List selectedIncidences();
00125
00127 virtual DateList selectedIncidenceDates();
00128
00130 virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00131
00133 void clearView();
00134
00135 KOrg::CalPrinterBase::PrintType printType();
00136
00138 QDateTime selectionStart() { return mTimeSpanBegin; }
00140 QDateTime selectionEnd() { return mTimeSpanEnd; }
00142 bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00144 void deleteSelectedDateTime();
00146 bool selectedIsSingleCell();
00147
00148 void setTypeAheadReceiver( QObject * );
00149
00150 KOAgenda* agenda() const { return mAgenda; }
00151 QSplitter* splitter() const { return mSplitterAgenda; }
00152 QFrame *dayLabels() const { return mDayLabels; }
00153
00154
00155 void calendarIncidenceAdded( Incidence *incidence );
00156 void calendarIncidenceChanged( Incidence *incidence );
00157 void calendarIncidenceDeleted( Incidence *incidence );
00158
00159 public slots:
00160 virtual void updateView();
00161 virtual void updateConfig();
00162 virtual void showDates( const QDate &start, const QDate &end );
00163 virtual void showIncidences( const Incidence::List &incidenceList, const QDate &date );
00164
00165 void insertIncidence( Incidence *incidence, const QDate &curDate );
00166 void changeIncidenceDisplayAdded( Incidence *incidence );
00167 void changeIncidenceDisplay( Incidence *incidence, int mode );
00168
00169 void clearSelection();
00170
00171 void startDrag( Incidence * );
00172
00173 void readSettings();
00174 void readSettings( KConfig * );
00175 void writeSettings( KConfig * );
00176
00177 void setContentsPos( int y );
00178
00179 void setExpandedButton( bool expanded );
00180
00181 void finishTypeAhead();
00182
00184 void slotTodoDropped( Todo *, const QPoint &, bool );
00185
00186 void enableAgendaUpdate( bool enable );
00187 void setIncidenceChanger( KOrg::IncidenceChangerBase *changer );
00188
00189 void zoomInHorizontally( const QDate& date=QDate() );
00190 void zoomOutHorizontally( const QDate& date=QDate() );
00191
00192 void zoomInVertically( );
00193 void zoomOutVertically( );
00194
00195 void zoomView( const int delta, const QPoint &pos,
00196 const Qt::Orientation orient=Qt::Horizontal );
00197
00198 void clearTimeSpanSelection();
00199
00200 void resourcesChanged();
00201
00202 signals:
00203 void toggleExpand();
00204 void zoomViewHorizontally(const QDate &, int count );
00205
00206 void timeSpanSelectionChanged();
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( bool force );
00219
00223 void setHolidayMasks();
00224
00225 void removeIncidence( Incidence * );
00230 void updateEventIndicators();
00231
00232 void updateTimeBarWidth();
00233
00234 virtual void resizeEvent( QResizeEvent *resizeEvent );
00235
00236 protected slots:
00238 void updateEventDates( KOAgendaItem *item );
00240 void doUpdateItem();
00241
00242 void updateEventIndicatorTop( int newY );
00243 void updateEventIndicatorBottom( int newY );
00244
00246 void newTimeSpanSelected( const QPoint &start, const QPoint &end );
00248 void newTimeSpanSelectedAllDay( const QPoint &start, const QPoint &end );
00249
00250 void updateDayLabelSizes();
00251
00252 private:
00253 bool filterByResource( Incidence *incidence );
00254 void displayIncidence( Incidence *incidence );
00255
00256 private:
00257
00258 QFrame *mDayLabels;
00259 QHBox *mDayLabelsFrame;
00260 QBoxLayout *mLayoutDayLabels;
00261 QPtrList<KOAlternateLabel> mDateDayLabels;
00262 QFrame *mAllDayFrame;
00263 KOAgenda *mAllDayAgenda;
00264 KOAgenda *mAgenda;
00265 TimeLabels *mTimeLabels;
00266 QWidget *mDummyAllDayLeft;
00267 QSplitter *mSplitterAgenda;
00268 QPushButton *mExpandButton;
00269
00270 DateList mSelectedDates;
00271 DateList mSaveSelectedDates;
00272 int mViewType;
00273
00274 KOEventPopupMenu *mAgendaPopup;
00275 KOEventPopupMenu *mAllDayAgendaPopup;
00276
00277 EventIndicator *mEventIndicatorTop;
00278 EventIndicator *mEventIndicatorBottom;
00279
00280 QMemArray<int> mMinY;
00281 QMemArray<int> mMaxY;
00282
00283 QMemArray<bool> mHolidayMask;
00284
00285 QPixmap mExpandedPixmap;
00286 QPixmap mNotExpandedPixmap;
00287
00288 QDateTime mTimeSpanBegin;
00289 QDateTime mTimeSpanEnd;
00290 bool mTimeSpanInAllDay;
00291 bool mAllowAgendaUpdate;
00292
00293 Incidence *mUpdateItem;
00294
00295 bool mIsSideBySide;
00296 bool mPendingChanges;
00297 };
00298
00299 #endif
|