00001
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 <tqscrollview.h>
00029 #include <tqlabel.h>
00030
00031 #include <libkcal/calendar.h>
00032
00033 #include "calprinter.h"
00034 #include "calendarview.h"
00035
00036 #include "agendaview.h"
00037
00038 class TQHBox;
00039 class TQPushButton;
00040 class TQBoxLayout;
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 TQFrame
00052 {
00053 Q_OBJECT
00054 TQ_OBJECT
00055 public:
00056 enum Location { Top, Bottom };
00057 EventIndicator( Location loc = Top, TQWidget *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( TQPainter * );
00067
00068 private:
00069 int mColumns;
00070 Location mLocation;
00071 TQPixmap mPixmap;
00072 TQMemArray<bool> mEnabled;
00073 };
00074
00075 class KOAlternateLabel : public TQLabel
00076 {
00077 Q_OBJECT
00078 TQ_OBJECT
00079 public:
00080 KOAlternateLabel( const TQString &shortlabel, const TQString &longlabel,
00081 const TQString &extensivelabel = TQString(),
00082 TQWidget *parent = 0, const char *name = 0 );
00083 ~KOAlternateLabel();
00084
00085 virtual TQSize minimumSizeHint() const;
00086
00087 enum TextType { Short = 0, Long = 1, Extensive = 2 };
00088 TextType largestFittingTextType() const;
00089 void setFixedType( TextType type );
00090
00091 public slots:
00092 void useShortText();
00093 void useLongText();
00094 void useExtensiveText();
00095 void useDefaultText();
00096
00097 protected:
00098 virtual void resizeEvent( TQResizeEvent * );
00099 virtual void squeezeTextToLabel();
00100 bool mTextTypeFixed;
00101 TQString mShortText, mLongText, mExtensiveText;
00102 };
00103
00108 class KOAgendaView : public KOrg::AgendaView, public KCal::Calendar::Observer
00109 {
00110 Q_OBJECT
00111 TQ_OBJECT
00112 public:
00113 KOAgendaView( Calendar *cal,
00114 CalendarView *calendarView,
00115 TQWidget *parent = 0,
00116 const char *name = 0,
00117 bool isSideBySide = false );
00118 virtual ~KOAgendaView();
00119
00121 virtual int maxDatesHint();
00122
00124 virtual int currentDateCount();
00125
00127 virtual Incidence::List selectedIncidences();
00128
00130 virtual DateList selectedIncidenceDates();
00131
00133 virtual bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
00134
00136 void clearView();
00137
00138 KOrg::CalPrinterBase::PrintType printType();
00139
00141 TQDateTime selectionStart() { return mTimeSpanBegin; }
00143 TQDateTime selectionEnd() { return mTimeSpanEnd; }
00145 bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00147 void deleteSelectedDateTime();
00149 bool selectedIsSingleCell();
00150
00151 void setTypeAheadReceiver( TQObject * );
00152
00153 KOAgenda* agenda() const { return mAgenda; }
00154 TQSplitter* splitter() const { return mSplitterAgenda; }
00155 TQFrame *dayLabels() const { return mDayLabels; }
00156
00157
00158 void calendarIncidenceAdded( Incidence *incidence );
00159 void calendarIncidenceChanged( Incidence *incidence );
00160 void calendarIncidenceDeleted( Incidence *incidence );
00161
00162 public slots:
00163 virtual void updateView();
00164 virtual void updateConfig();
00165 virtual void showDates( const TQDate &start, const TQDate &end );
00166 virtual void showIncidences( const Incidence::List &incidenceList, const TQDate &date );
00167
00168 void insertIncidence( Incidence *incidence, const TQDate &curDate );
00169 void changeIncidenceDisplayAdded( Incidence *incidence );
00170 void changeIncidenceDisplay( Incidence *incidence, int mode );
00171
00172 void clearSelection();
00173
00174 void startDrag( Incidence * );
00175
00176 void readSettings();
00177 void readSettings( KConfig * );
00178 void writeSettings( KConfig * );
00179
00180 void setContentsPos( int y );
00181
00182 void setExpandedButton( bool expanded );
00183
00184 void finishTypeAhead();
00185
00187 void slotTodoDropped( Todo *, const TQPoint &, bool );
00188
00189 void enableAgendaUpdate( bool enable );
00190 void setIncidenceChanger( KOrg::IncidenceChangerBase *changer );
00191
00192 void zoomInHorizontally( const TQDate& date=TQDate() );
00193 void zoomOutHorizontally( const TQDate& date=TQDate() );
00194
00195 void zoomInVertically( );
00196 void zoomOutVertically( );
00197
00198 void zoomView( const int delta, const TQPoint &pos,
00199
00200 const Qt::Orientation orient=Qt::Horizontal );
00201
00202 void clearTimeSpanSelection();
00203
00204 void resourcesChanged();
00205
00206 signals:
00207 void toggleExpand();
00208 void zoomViewHorizontally(const TQDate &, int count );
00209
00210 void timeSpanSelectionChanged();
00211
00212 protected:
00214 void fillAgenda( const TQDate &startDate );
00215
00217 void fillAgenda();
00218
00219 void connectAgenda( KOAgenda*agenda, TQPopupMenu*popup, KOAgenda* otherAgenda );
00220
00222 void createDayLabels( bool force );
00223
00227 void setHolidayMasks();
00228
00229 void removeIncidence( Incidence * );
00234 void updateEventIndicators();
00235
00236 void updateTimeBarWidth();
00237
00238 virtual void resizeEvent( TQResizeEvent *resizeEvent );
00239
00240 protected slots:
00242 void updateEventDates( KOAgendaItem *item );
00244 void doUpdateItem();
00245
00246 void updateEventIndicatorTop( int newY );
00247 void updateEventIndicatorBottom( int newY );
00248
00250 void newTimeSpanSelected( const TQPoint &start, const TQPoint &end );
00252 void newTimeSpanSelectedAllDay( const TQPoint &start, const TQPoint &end );
00253
00254 void updateDayLabelSizes();
00255
00256 private:
00257 bool filterByResource( Incidence *incidence );
00258 void displayIncidence( Incidence *incidence );
00259
00260 private:
00261
00262 TQFrame *mDayLabels;
00263 TQHBox *mDayLabelsFrame;
00264 TQBoxLayout *mLayoutDayLabels;
00265 TQPtrList<KOAlternateLabel> mDateDayLabels;
00266 TQFrame *mAllDayFrame;
00267 KOAgenda *mAllDayAgenda;
00268 KOAgenda *mAgenda;
00269 TimeLabels *mTimeLabels;
00270 TQWidget *mDummyAllDayLeft;
00271 TQSplitter *mSplitterAgenda;
00272 TQPushButton *mExpandButton;
00273
00274 DateList mSelectedDates;
00275 DateList mSaveSelectedDates;
00276 int mViewType;
00277
00278 KOEventPopupMenu *mAgendaPopup;
00279 KOEventPopupMenu *mAllDayAgendaPopup;
00280
00281 EventIndicator *mEventIndicatorTop;
00282 EventIndicator *mEventIndicatorBottom;
00283
00284 TQMemArray<int> mMinY;
00285 TQMemArray<int> mMaxY;
00286
00287 TQMemArray<bool> mHolidayMask;
00288
00289 TQPixmap mExpandedPixmap;
00290 TQPixmap mNotExpandedPixmap;
00291
00292 TQDateTime mTimeSpanBegin;
00293 TQDateTime mTimeSpanEnd;
00294 bool mTimeSpanInAllDay;
00295 bool mAllowAgendaUpdate;
00296
00297 Incidence *mUpdateItem;
00298
00299 bool mIsSideBySide;
00300 bool mPendingChanges;
00301
00302
00303
00304
00305
00306
00307
00308 bool mAreDatesInitialized;
00309 };
00310
00311 #endif