-rw-r--r-- | korganizer/kodaymatrix.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ae0a051..5133519 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -49,33 +49,34 @@ | |||
49 | 49 | ||
50 | #include "kodaymatrix.h" | 50 | #include "kodaymatrix.h" |
51 | 51 | ||
52 | // ============================================================================ | 52 | // ============================================================================ |
53 | // D Y N A M I C T I P | 53 | // D Y N A M I C T I P |
54 | // ============================================================================ | 54 | // ============================================================================ |
55 | 55 | ||
56 | DynamicTip::DynamicTip( QWidget * parent ) | 56 | DynamicTip::DynamicTip( QWidget * parent ) |
57 | : QToolTip( parent ) | 57 | : QToolTip( parent ) |
58 | { | 58 | { |
59 | matrix = (KODayMatrix*)parent; | 59 | matrix = (KODayMatrix*)parent; |
60 | } | 60 | } |
61 | 61 | ||
62 | class KODaymatrixWhatsThis :public QWhatsThis | 62 | class KODaymatrixWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { }; | 65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; |
66 | ~KODaymatrixWhatsThis() { ; }; | ||
66 | 67 | ||
67 | protected: | 68 | protected: |
68 | virtual QString text( const QPoint& p ) | 69 | virtual QString text( const QPoint& p ) |
69 | { | 70 | { |
70 | return _view->getWhatsThisText( p ) ; | 71 | return _view->getWhatsThisText( p ) ; |
71 | } | 72 | } |
72 | private: | 73 | private: |
73 | KODayMatrix * _view; | 74 | KODayMatrix * _view; |
74 | }; | 75 | }; |
75 | 76 | ||
76 | void DynamicTip::maybeTip( const QPoint &pos ) | 77 | void DynamicTip::maybeTip( const QPoint &pos ) |
77 | { | 78 | { |
78 | //calculate which cell of the matrix the mouse is in | 79 | //calculate which cell of the matrix the mouse is in |
79 | QRect sz = matrix->frameRect(); | 80 | QRect sz = matrix->frameRect(); |
80 | int dheight = sz.height()*7 / 42; | 81 | int dheight = sz.height()*7 / 42; |
81 | int dwidth = sz.width() / 7; | 82 | int dwidth = sz.width() / 7; |
@@ -96,33 +97,33 @@ void DynamicTip::maybeTip( const QPoint &pos ) | |||
96 | 97 | ||
97 | // ============================================================================ | 98 | // ============================================================================ |
98 | // K O D A Y M A T R I X | 99 | // K O D A Y M A T R I X |
99 | // ============================================================================ | 100 | // ============================================================================ |
100 | 101 | ||
101 | const int KODayMatrix::NOSELECTION = -1000; | 102 | const int KODayMatrix::NOSELECTION = -1000; |
102 | const int KODayMatrix::NUMDAYS = 42; | 103 | const int KODayMatrix::NUMDAYS = 42; |
103 | 104 | ||
104 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | 105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) |
105 | : QFrame( parent, name ), mCalendar( 0 ) | 106 | : QFrame( parent, name ), mCalendar( 0 ) |
106 | 107 | ||
107 | #if 0 | 108 | #if 0 |
108 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
109 | QFrame(parent, name) | 110 | QFrame(parent, name) |
110 | #endif | 111 | #endif |
111 | { | 112 | { |
112 | new KODaymatrixWhatsThis(this); | 113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
113 | mPendingUpdateBeforeRepaint = false; | 114 | mPendingUpdateBeforeRepaint = false; |
114 | mouseDown = false; | 115 | mouseDown = false; |
115 | // initialize dynamic arrays | 116 | // initialize dynamic arrays |
116 | bDays.resize ( NUMDAYS ); | 117 | bDays.resize ( NUMDAYS ); |
117 | days = new QDate[NUMDAYS]; | 118 | days = new QDate[NUMDAYS]; |
118 | daylbls = new QString[NUMDAYS]; | 119 | daylbls = new QString[NUMDAYS]; |
119 | events = new int[NUMDAYS]; | 120 | events = new int[NUMDAYS]; |
120 | mToolTip = new DynamicTip(this); | 121 | mToolTip = new DynamicTip(this); |
121 | 122 | ||
122 | // set default values used for drawing the matrix | 123 | // set default values used for drawing the matrix |
123 | mDefaultBackColor = palette().active().base(); | 124 | mDefaultBackColor = palette().active().base(); |
124 | mDefaultTextColor = palette().active().foreground(); | 125 | mDefaultTextColor = palette().active().foreground(); |
125 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
126 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
127 | mSelectedDaysColor = QColor("white"); | 128 | mSelectedDaysColor = QColor("white"); |
128 | mTodayMarginWidth = 2; | 129 | mTodayMarginWidth = 2; |
@@ -209,32 +210,33 @@ void KODayMatrix::setCalendar( Calendar *cal ) | |||
209 | QColor KODayMatrix::getShadedColor(QColor color) | 210 | QColor KODayMatrix::getShadedColor(QColor color) |
210 | { | 211 | { |
211 | QColor shaded; | 212 | QColor shaded; |
212 | int h=0; | 213 | int h=0; |
213 | int s=0; | 214 | int s=0; |
214 | int v=0; | 215 | int v=0; |
215 | color.hsv(&h,&s,&v); | 216 | color.hsv(&h,&s,&v); |
216 | s = s/4; | 217 | s = s/4; |
217 | v = 192+v/4; | 218 | v = 192+v/4; |
218 | shaded.setHsv(h,s,v); | 219 | shaded.setHsv(h,s,v); |
219 | 220 | ||
220 | return shaded; | 221 | return shaded; |
221 | } | 222 | } |
222 | 223 | ||
223 | KODayMatrix::~KODayMatrix() | 224 | KODayMatrix::~KODayMatrix() |
224 | { | 225 | { |
226 | delete mKODaymatrixWhatsThis; | ||
225 | delete [] days; | 227 | delete [] days; |
226 | delete [] daylbls; | 228 | delete [] daylbls; |
227 | delete [] events; | 229 | delete [] events; |
228 | delete mToolTip; | 230 | delete mToolTip; |
229 | } | 231 | } |
230 | 232 | ||
231 | /* | 233 | /* |
232 | void KODayMatrix::setStartDate(QDate start) | 234 | void KODayMatrix::setStartDate(QDate start) |
233 | { | 235 | { |
234 | updateView(start); | 236 | updateView(start); |
235 | } | 237 | } |
236 | */ | 238 | */ |
237 | 239 | ||
238 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 240 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
239 | { | 241 | { |
240 | 242 | ||