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 public slots:
00086 void setText( const QString & );
00087 void useShortText();
00088 void useLongText();
00089 void useExtensiveText();
00090 void useDefaultText();
00091
00092 protected:
00093 virtual void resizeEvent( QResizeEvent * );
00094 virtual void squeezeTextToLabel();
00095 bool mTextTypeFixed;
00096 QString mShortText, mLongText, mExtensiveText;
00097 };
00098
00103 class KOAgendaView : public KOrg::AgendaView, public KCal::Calendar::Observer
00104 {
00105 Q_OBJECT
00106 public:
00107 KOAgendaView( Calendar *cal,
00108 CalendarView *calendarView,
00109 QWidget *parent = 0,
00110 const char *name = 0,
00111 bool isSideBySide = false );
00112 virtual ~KOAgendaView();
00113
00115 virtual int maxDatesHint();
00116
00118 virtual int currentDateCount();
00119
00121 virtual Incidence::List selectedIncidences();
00122
00124 virtual DateList selectedIncidenceDates();
00125
00127 virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00128
00130 void clearView();
00131
00132 KOrg::CalPrinterBase::PrintType printType();
00133
00135 QDateTime selectionStart() { return mTimeSpanBegin; }
00137 QDateTime selectionEnd() { return mTimeSpanEnd; }
00139 bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00141 void deleteSelectedDateTime();
00143 bool selectedIsSingleCell();
00144
00145 void setTypeAheadReceiver( QObject * );
00146
00147 KOAgenda* agenda() const { return mAgenda; }
00148 QSplitter* splitter() const { return mSplitterAgenda; }
00149 QFrame *dayLabels() const { return mDayLabels; }
00150
00151
00152 void calendarIncidenceAdded( Incidence *incidence );
00153 void calendarIncidenceChanged( Incidence *incidence );
00154 void calendarIncidenceDeleted( Incidence *incidence );
00155
00156 public slots:
00157 virtual void updateView();
00158 virtual void updateConfig();
00159 virtual void showDates( const QDate &start, const QDate &end );
00160 virtual void showIncidences( const Incidence::List &incidenceList, const QDate &date );
00161
00162 void insertIncidence( Incidence *incidence, const QDate &curDate );
00163 void changeIncidenceDisplayAdded( Incidence *incidence );
00164 void changeIncidenceDisplay( Incidence *incidence, int mode );
00165
00166 void clearSelection();
00167
00168 void startDrag( Incidence * );
00169
00170 void readSettings();
00171 void readSettings( KConfig * );
00172 void writeSettings( KConfig * );
00173
00174 void setContentsPos( int y );
00175
00176 void setExpandedButton( bool expanded );
00177
00178 void finishTypeAhead();
00179
00181 void slotTodoDropped( Todo *, const QPoint &, bool );
00182
00183 void enableAgendaUpdate( bool enable );
00184 void setIncidenceChanger( KOrg::IncidenceChangerBase *changer );
00185
00186 void zoomInHorizontally( const QDate& date=QDate() );
00187 void zoomOutHorizontally( const QDate& date=QDate() );
00188
00189 void zoomInVertically( );
00190 void zoomOutVertically( );
00191
00192 void zoomView( const int delta, const QPoint &pos,
00193 const Qt::Orientation orient=Qt::Horizontal );
00194
00195 void clearTimeSpanSelection();
00196
00197 void resourcesChanged();
00198
00199 signals:
00200 void toggleExpand();
00201 void zoomViewHorizontally(const QDate &, int count );
00202
00203 void timeSpanSelectionChanged();
00204
00205 protected:
00207 void fillAgenda( const QDate &startDate );
00208
00210 void fillAgenda();
00211
00212 void connectAgenda( KOAgenda*agenda, QPopupMenu*popup, KOAgenda* otherAgenda );
00213
00215 void createDayLabels( bool force );
00216
00220 void setHolidayMasks();
00221
00222 void removeIncidence( Incidence * );
00227 void updateEventIndicators();
00228
00229 void updateTimeBarWidth();
00230
00231 protected slots:
00233 void updateEventDates( KOAgendaItem *item );
00235 void doUpdateItem();
00236
00237 void updateEventIndicatorTop( int newY );
00238 void updateEventIndicatorBottom( int newY );
00239
00241 void newTimeSpanSelected( const QPoint &start, const QPoint &end );
00243 void newTimeSpanSelectedAllDay( const QPoint &start, const QPoint &end );
00244
00245 private:
00246 bool filterByResource( Incidence *incidence );
00247 void displayIncidence( Incidence *incidence );
00248
00249 private:
00250
00251 QFrame *mDayLabels;
00252 QHBox *mDayLabelsFrame;
00253 QBoxLayout *mLayoutDayLabels;
00254 QFrame *mAllDayFrame;
00255 KOAgenda *mAllDayAgenda;
00256 KOAgenda *mAgenda;
00257 TimeLabels *mTimeLabels;
00258 QWidget *mDummyAllDayLeft;
00259 QSplitter *mSplitterAgenda;
00260 QPushButton *mExpandButton;
00261
00262 DateList mSelectedDates;
00263 DateList mSaveSelectedDates;
00264 int mViewType;
00265
00266 KOEventPopupMenu *mAgendaPopup;
00267 KOEventPopupMenu *mAllDayAgendaPopup;
00268
00269 EventIndicator *mEventIndicatorTop;
00270 EventIndicator *mEventIndicatorBottom;
00271
00272 QMemArray<int> mMinY;
00273 QMemArray<int> mMaxY;
00274
00275 QMemArray<bool> mHolidayMask;
00276
00277 QPixmap mExpandedPixmap;
00278 QPixmap mNotExpandedPixmap;
00279
00280 QDateTime mTimeSpanBegin;
00281 QDateTime mTimeSpanEnd;
00282 bool mTimeSpanInAllDay;
00283 bool mAllowAgendaUpdate;
00284
00285 Incidence *mUpdateItem;
00286
00287 bool mIsSideBySide;
00288 bool mPendingChanges;
00289 };
00290
00291 #endif
|