-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 10 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 6 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 2 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 3 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 2 |
7 files changed, 21 insertions, 8 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 5cdaa83..5941337 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -161,97 +161,101 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | |||
161 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; | 161 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; |
162 | #endif | 162 | #endif |
163 | QSize minSize = mNavigatorView->sizeHintTwoButtons(); | 163 | QSize minSize = mNavigatorView->sizeHintTwoButtons(); |
164 | 164 | ||
165 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; | 165 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; |
166 | 166 | ||
167 | int verticalCount = size().height() / minSize.height(); | 167 | int verticalCount = size().height() / minSize.height(); |
168 | int horizontalCount = size().width() / minSize.width(); | 168 | int horizontalCount = size().width() / minSize.width(); |
169 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | 169 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); |
170 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 170 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
171 | bool fontchange = false; | 171 | bool fontchange = false; |
172 | QFont fo; | 172 | QFont fo; |
173 | if ( horizontalCount != mHorizontalCount || | 173 | if ( horizontalCount != mHorizontalCount || |
174 | verticalCount != mVerticalCount ) { | 174 | verticalCount != mVerticalCount ) { |
175 | uint count = horizontalCount * verticalCount; | 175 | uint count = horizontalCount * verticalCount; |
176 | if ( count == 0 ) { | 176 | if ( count == 0 ) { |
177 | bool ok; | 177 | bool ok; |
178 | fo = mNavigatorView->yourFontHint( size() , &ok); | 178 | fo = mNavigatorView->yourFontHint( size() , &ok); |
179 | //mNavigatorView->resize( size() ); | 179 | //mNavigatorView->resize( size() ); |
180 | //if ( ! ok ) | 180 | //if ( ! ok ) |
181 | // return; | 181 | // return; |
182 | minSize = mNavigatorView->sizeHintTwoButtons(); | 182 | minSize = mNavigatorView->sizeHintTwoButtons(); |
183 | verticalCount = size().height() / minSize.height(); | 183 | verticalCount = size().height() / minSize.height(); |
184 | horizontalCount = size().width() / minSize.width(); | 184 | horizontalCount = size().width() / minSize.width(); |
185 | if ( horizontalCount == 0 ) | 185 | if ( horizontalCount == 0 ) |
186 | horizontalCount = 1; | 186 | horizontalCount = 1; |
187 | if ( verticalCount == 0 ) | 187 | if ( verticalCount == 0 ) |
188 | verticalCount = 1; | 188 | verticalCount = 1; |
189 | fontchange = true; | 189 | fontchange = true; |
190 | count = horizontalCount * verticalCount; | 190 | count = horizontalCount * verticalCount; |
191 | } else { | 191 | } else { |
192 | if ( mNavigatorView->fontChanged() ) { | 192 | if ( mNavigatorView->fontChanged() ) { |
193 | fontchange = true; | 193 | fontchange = true; |
194 | fo = KOPrefs::instance()->mDateNavigatorFont; | 194 | fo = KOPrefs::instance()->mDateNavigatorFont; |
195 | mNavigatorView->changeFont( fo ); | 195 | mNavigatorView->changeFont( fo ); |
196 | mNavigatorView->unsetFontChanged(); | 196 | mNavigatorView->unsetFontChanged(); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | while ( count > ( mExtraViews.count() + 1 ) ) { | 200 | while ( count > ( mExtraViews.count() + 1 ) ) { |
201 | KDateNavigator *n = new KDateNavigator( this ); | 201 | KDateNavigator *n = new KDateNavigator( this ); |
202 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 202 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
203 | mExtraViews.append( n ); | 203 | mExtraViews.append( n ); |
204 | n->setCalendar( mCalendar ); | 204 | n->setCalendar( mCalendar ); |
205 | setBaseDates(); | 205 | setBaseDates(); |
206 | connectNavigatorView( n ); | 206 | connectNavigatorView( n ); |
207 | n->show(); | 207 | n->show(); |
208 | } | 208 | } |
209 | 209 | int iii = 0; | |
210 | while ( count < ( mExtraViews.count() + 1 ) ) { | 210 | while ( iii < ( mExtraViews.count() ) ) { |
211 | mExtraViews.removeLast(); | 211 | if ( iii < count-1 ) |
212 | mExtraViews.at( iii )->show(); | ||
213 | else | ||
214 | mExtraViews.at( iii )->hide(); | ||
215 | ++iii; | ||
212 | } | 216 | } |
213 | if ( fontchange ) { | 217 | if ( fontchange ) { |
214 | //mNavigatorView->changeFont( fo ); | 218 | //mNavigatorView->changeFont( fo ); |
215 | uint i; | 219 | uint i; |
216 | for( i = 0; i < mExtraViews.count(); ++i ) { | 220 | for( i = 0; i < mExtraViews.count(); ++i ) { |
217 | KDateNavigator *view = mExtraViews.at( i ); | 221 | KDateNavigator *view = mExtraViews.at( i ); |
218 | view->changeFont( fo ); | 222 | view->changeFont( fo ); |
219 | } | 223 | } |
220 | } | 224 | } |
221 | mHorizontalCount = horizontalCount; | 225 | mHorizontalCount = horizontalCount; |
222 | mVerticalCount = verticalCount; | 226 | mVerticalCount = verticalCount; |
223 | } | 227 | } |
224 | int height = size().height() / verticalCount; | 228 | int height = size().height() / verticalCount; |
225 | int width = size().width() / horizontalCount; | 229 | int width = size().width() / horizontalCount; |
226 | 230 | ||
227 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 231 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
228 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); | 232 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); |
229 | else bar->showButtons( true, true ); | 233 | else bar->showButtons( true, true ); |
230 | 234 | ||
231 | mNavigatorView->setGeometry(0, | 235 | mNavigatorView->setGeometry(0, |
232 | 0, width, height ); | 236 | 0, width, height ); |
233 | for( uint i = 0; i < mExtraViews.count(); ++i ) { | 237 | for( uint i = 0; i < mExtraViews.count(); ++i ) { |
234 | int x = ( i + 1 ) % horizontalCount; | 238 | int x = ( i + 1 ) % horizontalCount; |
235 | int y = ( i + 1 ) / horizontalCount; | 239 | int y = ( i + 1 ) / horizontalCount; |
236 | 240 | ||
237 | KDateNavigator *view = mExtraViews.at( i ); | 241 | KDateNavigator *view = mExtraViews.at( i ); |
238 | bar = view->navigatorBar(); | 242 | bar = view->navigatorBar(); |
239 | if ( y > 0 ) bar->showButtons( false, false ); | 243 | if ( y > 0 ) bar->showButtons( false, false ); |
240 | else { | 244 | else { |
241 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); | 245 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); |
242 | else bar->showButtons( false, false ); | 246 | else bar->showButtons( false, false ); |
243 | } | 247 | } |
244 | view->setGeometry( x * width, | 248 | view->setGeometry( x * width, |
245 | y * height, width, height ); | 249 | y * height, width, height ); |
246 | } | 250 | } |
247 | } | 251 | } |
248 | 252 | ||
249 | QSize DateNavigatorContainer::minimumSizeHint() const | 253 | QSize DateNavigatorContainer::minimumSizeHint() const |
250 | { | 254 | { |
251 | return mNavigatorView->minimumSizeHint(); | 255 | return mNavigatorView->minimumSizeHint(); |
252 | } | 256 | } |
253 | 257 | ||
254 | QSize DateNavigatorContainer::sizeHint() const | 258 | QSize DateNavigatorContainer::sizeHint() const |
255 | { | 259 | { |
256 | return mNavigatorView->sizeHint(); | 260 | return mNavigatorView->sizeHint(); |
257 | } | 261 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 0ea2860..19cc0e3 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -32,175 +32,175 @@ | |||
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KOAgendaItemWhatsThis(this); | 80 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | //setMouseTracking(true); | 85 | //setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | 94 | KOPrefs::instance()->mWTshowDetails, |
95 | KOPrefs::instance()->mWTshowCreated, | 95 | KOPrefs::instance()->mWTshowCreated, |
96 | KOPrefs::instance()->mWTshowChanged); | 96 | KOPrefs::instance()->mWTshowChanged); |
97 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
98 | } | 98 | } |
99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
100 | { | 100 | { |
101 | mIncidence = incidence; | 101 | mIncidence = incidence; |
102 | mDate = qd; | 102 | mDate = qd; |
103 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
104 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
105 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
106 | computeText(); | 106 | computeText(); |
107 | 107 | ||
108 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
113 | else | 113 | else |
114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
115 | } | 115 | } |
116 | else { | 116 | else { |
117 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
118 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
119 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
122 | else | 122 | else |
123 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
124 | } else { | 124 | } else { |
125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |
133 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 133 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
134 | mBackgroundColor.dark(),mBackgroundColor.light(), | 134 | mBackgroundColor.dark(),mBackgroundColor.light(), |
135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
136 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
137 | 137 | ||
138 | mConflictItems.clear(); | 138 | mConflictItems.clear(); |
139 | setCellXY(0,0,1); | 139 | setCellXY(0,0,1); |
140 | setCellXWidth(0); | 140 | setCellXWidth(0); |
141 | setSubCell(0); | 141 | setSubCell(0); |
142 | setSubCells(1); | 142 | setSubCells(1); |
143 | setMultiItem(0,0,0); | 143 | setMultiItem(0,0,0); |
144 | startMove(); | 144 | startMove(); |
145 | mSelected = true; | 145 | mSelected = true; |
146 | select(false); | 146 | select(false); |
147 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 147 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
148 | mFontPixelSize = fontinf.height();; | 148 | mFontPixelSize = fontinf.height();; |
149 | hide(); | 149 | hide(); |
150 | xPaintCoord = -1; | 150 | xPaintCoord = -1; |
151 | yPaintCoord = -1; | 151 | yPaintCoord = -1; |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | KOAgendaItem::~KOAgendaItem() | 155 | KOAgendaItem::~KOAgendaItem() |
156 | { | 156 | { |
157 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 157 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
158 | 158 | delete mKOAgendaItemWhatsThis; | |
159 | } | 159 | } |
160 | 160 | ||
161 | void KOAgendaItem::recreateIncidence() | 161 | void KOAgendaItem::recreateIncidence() |
162 | { | 162 | { |
163 | #if 0 | 163 | #if 0 |
164 | Incidence* newInc = mIncidence->clone(); | 164 | Incidence* newInc = mIncidence->clone(); |
165 | newInc->recreate(); | 165 | newInc->recreate(); |
166 | if ( mIncidence->doesRecur() ) { | 166 | if ( mIncidence->doesRecur() ) { |
167 | mIncidence->addExDate( mDate ); | 167 | mIncidence->addExDate( mDate ); |
168 | newInc->recurrence()->unsetRecurs(); | 168 | newInc->recurrence()->unsetRecurs(); |
169 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 169 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
170 | QTime tim = mIncidence->dtStart().time(); | 170 | QTime tim = mIncidence->dtStart().time(); |
171 | newInc->setDtStart( QDateTime(mDate, tim) ); | 171 | newInc->setDtStart( QDateTime(mDate, tim) ); |
172 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 172 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
173 | } | 173 | } |
174 | #endif | 174 | #endif |
175 | mIncidence = mIncidence->recreateCloneException( mDate ); | 175 | mIncidence = mIncidence->recreateCloneException( mDate ); |
176 | } | 176 | } |
177 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 177 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
178 | { | 178 | { |
179 | int size = AGENDA_ICON_SIZE; | 179 | int size = AGENDA_ICON_SIZE; |
180 | 180 | ||
181 | int yOff = 0; | 181 | int yOff = 0; |
182 | int xOff = 0; | 182 | int xOff = 0; |
183 | int x = pos().x() +3; | 183 | int x = pos().x() +3; |
184 | int y; | 184 | int y; |
185 | if ( mAllDay ) | 185 | if ( mAllDay ) |
186 | y = pos().y()+3; | 186 | y = pos().y()+3; |
187 | else | 187 | else |
188 | y = mCellYTop * ( height() / cellHeight() ) +3; | 188 | y = mCellYTop * ( height() / cellHeight() ) +3; |
189 | if (mIncidence->cancelled()) { | 189 | if (mIncidence->cancelled()) { |
190 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 190 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
191 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 191 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
192 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 192 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
193 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 193 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
194 | if ( horLayout ) | 194 | if ( horLayout ) |
195 | ++xOff; | 195 | ++xOff; |
196 | else | 196 | else |
197 | ++yOff; | 197 | ++yOff; |
198 | } | 198 | } |
199 | if (mIncidence->isAlarmEnabled()) { | 199 | if (mIncidence->isAlarmEnabled()) { |
200 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 200 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
201 | if ( horLayout ) | 201 | if ( horLayout ) |
202 | ++xOff; | 202 | ++xOff; |
203 | else | 203 | else |
204 | ++yOff; | 204 | ++yOff; |
205 | } | 205 | } |
206 | if (mIncidence->recurrence()->doesRecur()) { | 206 | if (mIncidence->recurrence()->doesRecur()) { |
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index b4dba79..53658c0 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -1,162 +1,164 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | #ifndef KOAGENDAITEM_H | 19 | #ifndef KOAGENDAITEM_H |
20 | #define KOAGENDAITEM_H | 20 | #define KOAGENDAITEM_H |
21 | 21 | ||
22 | #include <qframe.h> | 22 | #include <qframe.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qpalette.h> | 26 | #include <qpalette.h> |
27 | 27 | ||
28 | #include <libkcal/incidence.h> | 28 | #include <libkcal/incidence.h> |
29 | 29 | ||
30 | class KOAgendaItemWhatsThis; | ||
30 | class QToolTipGroup; | 31 | class QToolTipGroup; |
31 | class QDragEnterEvent; | 32 | class QDragEnterEvent; |
32 | class QDropEvent; | 33 | class QDropEvent; |
33 | 34 | ||
34 | using namespace KCal; | 35 | using namespace KCal; |
35 | 36 | ||
36 | /* | 37 | /* |
37 | The KOAgendaItem has to make sure that it receives all mouse events, which are | 38 | The KOAgendaItem has to make sure that it receives all mouse events, which are |
38 | to be used for dragging and resizing. That means it has to be installed as | 39 | to be used for dragging and resizing. That means it has to be installed as |
39 | eventfiler for its children, if it has children, and it has to pass mouse | 40 | eventfiler for its children, if it has children, and it has to pass mouse |
40 | events from the cildren to itself. See eventFilter(). | 41 | events from the cildren to itself. See eventFilter(). |
41 | */ | 42 | */ |
42 | class KOAgendaItem : public QWidget | 43 | class KOAgendaItem : public QWidget |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | public: | 46 | public: |
46 | KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, | 47 | KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, |
47 | WFlags f=0 ); | 48 | WFlags f=0 ); |
48 | ~KOAgendaItem(); | 49 | ~KOAgendaItem(); |
49 | QString getWhatsThisText(); | 50 | QString getWhatsThisText(); |
50 | void init ( Incidence *incidence, QDate qd ); | 51 | void init ( Incidence *incidence, QDate qd ); |
51 | int cellX() { return mCellX; } | 52 | int cellX() { return mCellX; } |
52 | int cellXWidth() { return mCellXWidth; } | 53 | int cellXWidth() { return mCellXWidth; } |
53 | int cellYTop() { return mCellYTop; } | 54 | int cellYTop() { return mCellYTop; } |
54 | int cellYBottom() { return mCellYBottom; } | 55 | int cellYBottom() { return mCellYBottom; } |
55 | int cellHeight(); | 56 | int cellHeight(); |
56 | int cellWidth(); | 57 | int cellWidth(); |
57 | int subCell() { return mSubCell; } | 58 | int subCell() { return mSubCell; } |
58 | int subCells() { return mSubCells; } | 59 | int subCells() { return mSubCells; } |
59 | 60 | ||
60 | void setCellXY(int X, int YTop, int YBottom); | 61 | void setCellXY(int X, int YTop, int YBottom); |
61 | void setCellY(int YTop, int YBottom); | 62 | void setCellY(int YTop, int YBottom); |
62 | void setCellX(int XLeft, int XRight); | 63 | void setCellX(int XLeft, int XRight); |
63 | void setCellXWidth(int xwidth); | 64 | void setCellXWidth(int xwidth); |
64 | void setSubCell(int subCell); | 65 | void setSubCell(int subCell); |
65 | void setSubCells(int subCells); | 66 | void setSubCells(int subCells); |
66 | 67 | ||
67 | /** Start movement */ | 68 | /** Start movement */ |
68 | void startMove(); | 69 | void startMove(); |
69 | /** Reset to original values */ | 70 | /** Reset to original values */ |
70 | void resetMove(); | 71 | void resetMove(); |
71 | 72 | ||
72 | void moveRelative(int dx,int dy); | 73 | void moveRelative(int dx,int dy); |
73 | void expandTop(int dy); | 74 | void expandTop(int dy); |
74 | void expandBottom(int dy); | 75 | void expandBottom(int dy); |
75 | void expandLeft(int dx); | 76 | void expandLeft(int dx); |
76 | void expandRight(int dx); | 77 | void expandRight(int dx); |
77 | int mLastMoveXPos; | 78 | int mLastMoveXPos; |
78 | 79 | ||
79 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 80 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
80 | KOAgendaItem *last); | 81 | KOAgendaItem *last); |
81 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } | 82 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } |
82 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } | 83 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } |
83 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } | 84 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } |
84 | 85 | ||
85 | Incidence *incidence() const { return mIncidence; } | 86 | Incidence *incidence() const { return mIncidence; } |
86 | QDate itemDate() { return mDate; } | 87 | QDate itemDate() { return mDate; } |
87 | 88 | ||
88 | /** Update the date of this item's occurence (not in the event) */ | 89 | /** Update the date of this item's occurence (not in the event) */ |
89 | void setItemDate(QDate qd); | 90 | void setItemDate(QDate qd); |
90 | 91 | ||
91 | void setText ( const QString & text ) { mDisplayedText = text; } | 92 | void setText ( const QString & text ) { mDisplayedText = text; } |
92 | QString text () { return mDisplayedText; } | 93 | QString text () { return mDisplayedText; } |
93 | 94 | ||
94 | virtual bool eventFilter ( QObject *, QEvent * ); | 95 | virtual bool eventFilter ( QObject *, QEvent * ); |
95 | 96 | ||
96 | static QToolTipGroup *toolTipGroup(); | 97 | static QToolTipGroup *toolTipGroup(); |
97 | 98 | ||
98 | QPtrList<KOAgendaItem> conflictItems(); | 99 | QPtrList<KOAgendaItem> conflictItems(); |
99 | void setConflictItems(QPtrList<KOAgendaItem>); | 100 | void setConflictItems(QPtrList<KOAgendaItem>); |
100 | void addConflictItem(KOAgendaItem *ci); | 101 | void addConflictItem(KOAgendaItem *ci); |
101 | void paintMe( bool, QPainter* painter = 0 ); | 102 | void paintMe( bool, QPainter* painter = 0 ); |
102 | void repaintMe(); | 103 | void repaintMe(); |
103 | static void resizePixmap( int, int ); | 104 | static void resizePixmap( int, int ); |
104 | static QPixmap * paintPix(); | 105 | static QPixmap * paintPix(); |
105 | static QPixmap * paintPixSel(); | 106 | static QPixmap * paintPixSel(); |
106 | static QPixmap * paintPixAllday(); | 107 | static QPixmap * paintPixAllday(); |
107 | void updateItem(); | 108 | void updateItem(); |
108 | void computeText(); | 109 | void computeText(); |
109 | void recreateIncidence(); | 110 | void recreateIncidence(); |
110 | bool checkLayout(); | 111 | bool checkLayout(); |
111 | public slots: | 112 | public slots: |
112 | bool updateIcons( QPainter *, bool ); | 113 | bool updateIcons( QPainter *, bool ); |
113 | void select(bool=true); | 114 | void select(bool=true); |
114 | 115 | ||
115 | protected: | 116 | protected: |
116 | void dragEnterEvent(QDragEnterEvent *e); | 117 | void dragEnterEvent(QDragEnterEvent *e); |
117 | void dropEvent(QDropEvent *e); | 118 | void dropEvent(QDropEvent *e); |
118 | void paintEvent ( QPaintEvent * ); | 119 | void paintEvent ( QPaintEvent * ); |
119 | void resizeEvent ( QResizeEvent *ev ); | 120 | void resizeEvent ( QResizeEvent *ev ); |
120 | 121 | ||
121 | private: | 122 | private: |
123 | KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis; | ||
122 | bool mAllDay; | 124 | bool mAllDay; |
123 | int mCellX; | 125 | int mCellX; |
124 | int mCellXWidth; | 126 | int mCellXWidth; |
125 | int mCellYTop,mCellYBottom; | 127 | int mCellYTop,mCellYBottom; |
126 | int mSubCell; // subcell number of this item | 128 | int mSubCell; // subcell number of this item |
127 | int mSubCells; // Total number of subcells in cell of this item | 129 | int mSubCells; // Total number of subcells in cell of this item |
128 | int xPaintCoord; | 130 | int xPaintCoord; |
129 | int yPaintCoord; | 131 | int yPaintCoord; |
130 | int wPaintCoord; | 132 | int wPaintCoord; |
131 | int hPaintCoord; | 133 | int hPaintCoord; |
132 | // Variables to remember start position | 134 | // Variables to remember start position |
133 | int mStartCellX; | 135 | int mStartCellX; |
134 | int mStartCellXWidth; | 136 | int mStartCellXWidth; |
135 | int mStartCellYTop,mStartCellYBottom; | 137 | int mStartCellYTop,mStartCellYBottom; |
136 | int mLastMovePos; | 138 | int mLastMovePos; |
137 | 139 | ||
138 | // Multi item pointers | 140 | // Multi item pointers |
139 | KOAgendaItem *mFirstMultiItem; | 141 | KOAgendaItem *mFirstMultiItem; |
140 | KOAgendaItem *mNextMultiItem; | 142 | KOAgendaItem *mNextMultiItem; |
141 | KOAgendaItem *mLastMultiItem; | 143 | KOAgendaItem *mLastMultiItem; |
142 | 144 | ||
143 | int mFontPixelSize; | 145 | int mFontPixelSize; |
144 | Incidence *mIncidence; // corresponding event or todo | 146 | Incidence *mIncidence; // corresponding event or todo |
145 | QDate mDate; //date this events occurs (for recurrence) | 147 | QDate mDate; //date this events occurs (for recurrence) |
146 | //void showIcon( QLabel*, int ); | 148 | //void showIcon( QLabel*, int ); |
147 | //QLabel *mTodoIconLabel; | 149 | //QLabel *mTodoIconLabel; |
148 | //QLabel *mItemLabel; | 150 | //QLabel *mItemLabel; |
149 | //QWidget *mIconBox; | 151 | //QWidget *mIconBox; |
150 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; | 152 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; |
151 | //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; | 153 | //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; |
152 | //QLabel *mIconMoreInfo; | 154 | //QLabel *mIconMoreInfo; |
153 | static QToolTipGroup *mToolTipGroup; | 155 | static QToolTipGroup *mToolTipGroup; |
154 | 156 | ||
155 | QColor mBackgroundColor; | 157 | QColor mBackgroundColor; |
156 | QColorGroup mColorGroup; | 158 | QColorGroup mColorGroup; |
157 | QString mDisplayedText; | 159 | QString mDisplayedText; |
158 | bool mSelected; | 160 | bool mSelected; |
159 | QPtrList<KOAgendaItem> mConflictItems; | 161 | QPtrList<KOAgendaItem> mConflictItems; |
160 | }; | 162 | }; |
161 | 163 | ||
162 | #endif // KOAGENDAITEM_H | 164 | #endif // KOAGENDAITEM_H |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ae0a051..5133519 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -17,144 +17,145 @@ | |||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source ode for Qt in the source distribution. | 22 | without including the source ode for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #include <libkcal/vcaldrag.h> | 35 | #include <libkcal/vcaldrag.h> |
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/dndfactory.h> | 37 | #include <libkcal/dndfactory.h> |
38 | #include <libkcal/calendarresources.h> | 38 | #include <libkcal/calendarresources.h> |
39 | #include <libkcal/resourcecalendar.h> | 39 | #include <libkcal/resourcecalendar.h> |
40 | #include <kresources/resourceselectdialog.h> | 40 | #include <kresources/resourceselectdialog.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPLUGINS | 44 | #ifndef KORG_NOPLUGINS |
45 | #include "kocore.h" | 45 | #include "kocore.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "koglobals.h" | 48 | #include "koglobals.h" |
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; |
82 | int row = pos.y()/dheight; | 83 | int row = pos.y()/dheight; |
83 | int col = pos.x()/dwidth; | 84 | int col = pos.x()/dwidth; |
84 | 85 | ||
85 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
86 | 87 | ||
87 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
88 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 89 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
89 | 90 | ||
90 | //show holiday names only | 91 | //show holiday names only |
91 | QString str = matrix->getHolidayLabel(col+row*7); | 92 | QString str = matrix->getHolidayLabel(col+row*7); |
92 | if (str.isEmpty()) return; | 93 | if (str.isEmpty()) return; |
93 | tip(rct, str); | 94 | tip(rct, str); |
94 | } | 95 | } |
95 | 96 | ||
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; |
129 | mSelEnd = mSelStart = NOSELECTION; | 130 | mSelEnd = mSelStart = NOSELECTION; |
130 | 131 | ||
131 | setAcceptDrops(true); | 132 | setAcceptDrops(true); |
132 | //setFont( QFont("Arial", 10) ); | 133 | //setFont( QFont("Arial", 10) ); |
133 | 134 | ||
134 | mUpdateTimer = new QTimer( this ); | 135 | mUpdateTimer = new QTimer( this ); |
135 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
136 | mRepaintTimer = new QTimer( this ); | 137 | mRepaintTimer = new QTimer( this ); |
137 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
138 | mDayChanged = false; | 139 | mDayChanged = false; |
139 | updateView(); | 140 | updateView(); |
140 | } | 141 | } |
141 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 142 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
142 | { | 143 | { |
143 | 144 | ||
144 | int tmp = getDayIndexFrom(p.x(), p.y()); | 145 | int tmp = getDayIndexFrom(p.x(), p.y()); |
145 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 146 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
146 | return QString(); | 147 | return QString(); |
147 | QDate mDate = days[tmp]; | 148 | QDate mDate = days[tmp]; |
148 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 149 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
149 | Event *event; | 150 | Event *event; |
150 | QStringList mToolTip; | 151 | QStringList mToolTip; |
151 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 152 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
152 | QString mToolTipText; | 153 | QString mToolTipText; |
153 | QString text; | 154 | QString text; |
154 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 155 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
155 | if (event->isMultiDay()) { | 156 | if (event->isMultiDay()) { |
156 | QString prefix = "<->";multiday = 2; | 157 | QString prefix = "<->";multiday = 2; |
157 | QString time; | 158 | QString time; |
158 | if ( event->doesRecur() ) { | 159 | if ( event->doesRecur() ) { |
159 | if ( event->recursOn( mDate) ) { | 160 | if ( event->recursOn( mDate) ) { |
160 | prefix ="->" ;multiday = 1; | 161 | prefix ="->" ;multiday = 1; |
@@ -177,96 +178,97 @@ QString KODayMatrix::getWhatsThisText( QPoint p ) | |||
177 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 178 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
178 | else if ( mDate == event->dtEnd().date () ) | 179 | else if ( mDate == event->dtEnd().date () ) |
179 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 180 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
180 | 181 | ||
181 | } | 182 | } |
182 | text = time + event->summary(); | 183 | text = time + event->summary(); |
183 | mToolTipText += prefix + text; | 184 | mToolTipText += prefix + text; |
184 | } else { | 185 | } else { |
185 | if (event->doesFloat()) { | 186 | if (event->doesFloat()) { |
186 | text = event->summary(); | 187 | text = event->summary(); |
187 | mToolTipText += text; | 188 | mToolTipText += text; |
188 | } | 189 | } |
189 | else { | 190 | else { |
190 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 191 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
191 | text += " " + event->summary(); | 192 | text += " " + event->summary(); |
192 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 193 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
193 | } | 194 | } |
194 | } | 195 | } |
195 | mToolTip.append( mToolTipText ); | 196 | mToolTip.append( mToolTipText ); |
196 | } | 197 | } |
197 | mToolTip.sort(); | 198 | mToolTip.sort(); |
198 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 199 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
199 | } | 200 | } |
200 | void KODayMatrix::setCalendar( Calendar *cal ) | 201 | void KODayMatrix::setCalendar( Calendar *cal ) |
201 | { | 202 | { |
202 | mCalendar = cal; | 203 | mCalendar = cal; |
203 | 204 | ||
204 | setAcceptDrops( mCalendar ); | 205 | setAcceptDrops( mCalendar ); |
205 | 206 | ||
206 | updateEvents(); | 207 | updateEvents(); |
207 | } | 208 | } |
208 | 209 | ||
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 | ||
241 | if (mSelStart == NOSELECTION) { | 243 | if (mSelStart == NOSELECTION) { |
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
245 | //cope with selection being out of matrix limits at top (< 0) | 247 | //cope with selection being out of matrix limits at top (< 0) |
246 | int i0 = mSelStart; | 248 | int i0 = mSelStart; |
247 | if (i0 < 0) { | 249 | if (i0 < 0) { |
248 | for (int i = i0; i < 0; i++) { | 250 | for (int i = i0; i < 0; i++) { |
249 | selDays.append(days[0].addDays(i)); | 251 | selDays.append(days[0].addDays(i)); |
250 | } | 252 | } |
251 | i0 = 0; | 253 | i0 = 0; |
252 | } | 254 | } |
253 | 255 | ||
254 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 256 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
255 | if (mSelEnd > NUMDAYS-1) { | 257 | if (mSelEnd > NUMDAYS-1) { |
256 | for (int i = i0; i <= NUMDAYS-1; i++) { | 258 | for (int i = i0; i <= NUMDAYS-1; i++) { |
257 | selDays.append(days[i]); | 259 | selDays.append(days[i]); |
258 | } | 260 | } |
259 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 261 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
260 | selDays.append(days[0].addDays(i)); | 262 | selDays.append(days[0].addDays(i)); |
261 | } | 263 | } |
262 | 264 | ||
263 | // apply normal routine to selection being entirely within matrix limits | 265 | // apply normal routine to selection being entirely within matrix limits |
264 | } else { | 266 | } else { |
265 | for (int i = i0; i <= mSelEnd; i++) { | 267 | for (int i = i0; i <= mSelEnd; i++) { |
266 | selDays.append(days[i]); | 268 | selDays.append(days[i]); |
267 | } | 269 | } |
268 | } | 270 | } |
269 | } | 271 | } |
270 | 272 | ||
271 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 273 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
272 | { | 274 | { |
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index f4016b6..10f4b05 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -1,91 +1,92 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KODAYMAT_H | 23 | #ifndef _KODAYMAT_H |
24 | #define _KODAYMAT_H | 24 | #define _KODAYMAT_H |
25 | 25 | ||
26 | #include <libkcal/calendar.h> | 26 | #include <libkcal/calendar.h> |
27 | 27 | ||
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qcolor.h> | 30 | #include <qcolor.h> |
31 | #include <qpen.h> | 31 | #include <qpen.h> |
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qtooltip.h> | 33 | #include <qtooltip.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qbitarray.h> | 35 | #include <qbitarray.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | class QDragEnterEvent; | 38 | class QDragEnterEvent; |
39 | class QDragMoveEvent; | 39 | class QDragMoveEvent; |
40 | class QDragLeaveEvent; | 40 | class QDragLeaveEvent; |
41 | class QDropEvent; | 41 | class QDropEvent; |
42 | 42 | ||
43 | class KODayMatrix; | 43 | class KODayMatrix; |
44 | class KODaymatrixWhatsThis; | ||
44 | 45 | ||
45 | using namespace KCal; | 46 | using namespace KCal; |
46 | 47 | ||
47 | 48 | ||
48 | /** | 49 | /** |
49 | * small helper class to dynamically show tooltips inside the day matrix. | 50 | * small helper class to dynamically show tooltips inside the day matrix. |
50 | * This class asks the day matrix object for a appropriate label which | 51 | * This class asks the day matrix object for a appropriate label which |
51 | * is in our special case the name of the holiday or null if this day is no holiday. | 52 | * is in our special case the name of the holiday or null if this day is no holiday. |
52 | */ | 53 | */ |
53 | class DynamicTip : public QToolTip | 54 | class DynamicTip : public QToolTip |
54 | { | 55 | { |
55 | public: | 56 | public: |
56 | 57 | ||
57 | /** | 58 | /** |
58 | * Constructor that expects a KODayMatrix object as parent. | 59 | * Constructor that expects a KODayMatrix object as parent. |
59 | * | 60 | * |
60 | * @param parent the parent KODayMatrix control. | 61 | * @param parent the parent KODayMatrix control. |
61 | */ | 62 | */ |
62 | DynamicTip(QWidget* parent ); | 63 | DynamicTip(QWidget* parent ); |
63 | 64 | ||
64 | protected: | 65 | protected: |
65 | 66 | ||
66 | /** | 67 | /** |
67 | * Qt's callback to ask the object to provide an approrpiate text for the | 68 | * Qt's callback to ask the object to provide an approrpiate text for the |
68 | * tooltip to be shown. | 69 | * tooltip to be shown. |
69 | * | 70 | * |
70 | * @param pos coordinates of the mouse. | 71 | * @param pos coordinates of the mouse. |
71 | */ | 72 | */ |
72 | void maybeTip( const QPoint & pos); | 73 | void maybeTip( const QPoint & pos); |
73 | 74 | ||
74 | private: | 75 | private: |
75 | 76 | ||
76 | /** the parent control this tooltip is designed for. */ | 77 | /** the parent control this tooltip is designed for. */ |
77 | KODayMatrix* matrix; | 78 | KODayMatrix* matrix; |
78 | }; | 79 | }; |
79 | 80 | ||
80 | /** | 81 | /** |
81 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 82 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. |
82 | * Cornelius thought this was a waste of memory and a lot of overhead. | 83 | * Cornelius thought this was a waste of memory and a lot of overhead. |
83 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame | 84 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame |
84 | * that draws the labels and allows for dragging selection while maintaining nearly full | 85 | * that draws the labels and allows for dragging selection while maintaining nearly full |
85 | * compatibility in behaviour with its predecessor. | 86 | * compatibility in behaviour with its predecessor. |
86 | * | 87 | * |
87 | * The following functionality has been changed: | 88 | * The following functionality has been changed: |
88 | * | 89 | * |
89 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 90 | * o when shifting events in the agenda view from one day to another the day matrix is updated now |
90 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. | 91 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. |
91 | * o no support for Ctrl+click to create groups of dates | 92 | * o no support for Ctrl+click to create groups of dates |
@@ -181,96 +182,97 @@ public slots: | |||
181 | void repaintViewTimed(); | 182 | void repaintViewTimed(); |
182 | 183 | ||
183 | /** | 184 | /** |
184 | * Calculate which square in the matrix should be | 185 | * Calculate which square in the matrix should be |
185 | * hilighted to indicate it's today. | 186 | * hilighted to indicate it's today. |
186 | */ | 187 | */ |
187 | void recalculateToday(); | 188 | void recalculateToday(); |
188 | 189 | ||
189 | /* | 190 | /* |
190 | void setStartDate(QDate); | 191 | void setStartDate(QDate); |
191 | */ | 192 | */ |
192 | 193 | ||
193 | signals: | 194 | signals: |
194 | 195 | ||
195 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle | 196 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle |
196 | * inside the matrix | 197 | * inside the matrix |
197 | * | 198 | * |
198 | * @param daylist list of days that have been selected by the user | 199 | * @param daylist list of days that have been selected by the user |
199 | */ | 200 | */ |
200 | void selected( const KCal::DateList &daylist ); | 201 | void selected( const KCal::DateList &daylist ); |
201 | 202 | ||
202 | /** emitted if the user has dropped an event inside the matrix | 203 | /** emitted if the user has dropped an event inside the matrix |
203 | * | 204 | * |
204 | * @param event the dropped calendar event | 205 | * @param event the dropped calendar event |
205 | */ | 206 | */ |
206 | void eventDropped(Event *event); | 207 | void eventDropped(Event *event); |
207 | 208 | ||
208 | protected: | 209 | protected: |
209 | 210 | ||
210 | void paintEvent(QPaintEvent *ev); | 211 | void paintEvent(QPaintEvent *ev); |
211 | 212 | ||
212 | void mousePressEvent (QMouseEvent* e); | 213 | void mousePressEvent (QMouseEvent* e); |
213 | 214 | ||
214 | void mouseReleaseEvent (QMouseEvent* e); | 215 | void mouseReleaseEvent (QMouseEvent* e); |
215 | 216 | ||
216 | void mouseMoveEvent (QMouseEvent* e); | 217 | void mouseMoveEvent (QMouseEvent* e); |
217 | 218 | ||
218 | void dragEnterEvent(QDragEnterEvent *); | 219 | void dragEnterEvent(QDragEnterEvent *); |
219 | 220 | ||
220 | void dragMoveEvent(QDragMoveEvent *); | 221 | void dragMoveEvent(QDragMoveEvent *); |
221 | 222 | ||
222 | void dragLeaveEvent(QDragLeaveEvent *); | 223 | void dragLeaveEvent(QDragLeaveEvent *); |
223 | 224 | ||
224 | void dropEvent(QDropEvent *); | 225 | void dropEvent(QDropEvent *); |
225 | 226 | ||
226 | void resizeEvent(QResizeEvent *); | 227 | void resizeEvent(QResizeEvent *); |
227 | 228 | ||
228 | private: | 229 | private: |
230 | KODaymatrixWhatsThis* mKODaymatrixWhatsThis; | ||
229 | bool mouseDown; | 231 | bool mouseDown; |
230 | QBitArray bDays; | 232 | QBitArray bDays; |
231 | QPixmap myPix; | 233 | QPixmap myPix; |
232 | QTimer* mUpdateTimer; | 234 | QTimer* mUpdateTimer; |
233 | QTimer* mRepaintTimer; | 235 | QTimer* mRepaintTimer; |
234 | bool mDayChanged; | 236 | bool mDayChanged; |
235 | bool mPendingUpdateBeforeRepaint; | 237 | bool mPendingUpdateBeforeRepaint; |
236 | 238 | ||
237 | /** returns the index of the day located at the matrix's widget (x,y) position. | 239 | /** returns the index of the day located at the matrix's widget (x,y) position. |
238 | * | 240 | * |
239 | * @param x horizontal coordinate | 241 | * @param x horizontal coordinate |
240 | * @param y vertical coordinate | 242 | * @param y vertical coordinate |
241 | */ | 243 | */ |
242 | int getDayIndexFrom(int x, int y); | 244 | int getDayIndexFrom(int x, int y); |
243 | 245 | ||
244 | /** calculates a "shaded" color from the supplied color object. | 246 | /** calculates a "shaded" color from the supplied color object. |
245 | * (Copied from Cornelius's kdpdatebutton.cpp) | 247 | * (Copied from Cornelius's kdpdatebutton.cpp) |
246 | * | 248 | * |
247 | * @param color source based on which a shaded color should be calculated. | 249 | * @param color source based on which a shaded color should be calculated. |
248 | */ | 250 | */ |
249 | QColor getShadedColor(QColor color); | 251 | QColor getShadedColor(QColor color); |
250 | 252 | ||
251 | /** number of days to be displayed. For now there is no support for any other number then 42. | 253 | /** number of days to be displayed. For now there is no support for any other number then 42. |
252 | so change it at your own risk :o) */ | 254 | so change it at your own risk :o) */ |
253 | static const int NUMDAYS; | 255 | static const int NUMDAYS; |
254 | 256 | ||
255 | /** calendar instance to be queried for holidays, events, ... */ | 257 | /** calendar instance to be queried for holidays, events, ... */ |
256 | Calendar *mCalendar; | 258 | Calendar *mCalendar; |
257 | 259 | ||
258 | /** starting date of the matrix */ | 260 | /** starting date of the matrix */ |
259 | QDate startdate; | 261 | QDate startdate; |
260 | 262 | ||
261 | /** array of day labels to optimeize drawing performance. */ | 263 | /** array of day labels to optimeize drawing performance. */ |
262 | QString *daylbls; | 264 | QString *daylbls; |
263 | 265 | ||
264 | /** array of days displayed to reduce memory consumption by | 266 | /** array of days displayed to reduce memory consumption by |
265 | subsequently calling QDate::addDays(). */ | 267 | subsequently calling QDate::addDays(). */ |
266 | QDate *days; | 268 | QDate *days; |
267 | 269 | ||
268 | /** array of storing the number of events on a given day. | 270 | /** array of storing the number of events on a given day. |
269 | * used for drawing a bold font if there is at least one event on that day. | 271 | * used for drawing a bold font if there is at least one event on that day. |
270 | */ | 272 | */ |
271 | int *events; | 273 | int *events; |
272 | 274 | ||
273 | /** stores holiday names of the days shown in the matrix. */ | 275 | /** stores holiday names of the days shown in the matrix. */ |
274 | QMap<int,QString> mHolidays; | 276 | QMap<int,QString> mHolidays; |
275 | 277 | ||
276 | /** indey of today or -1 if today is not visible in the matrix. */ | 278 | /** indey of today or -1 if today is not visible in the matrix. */ |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 5e8ea27..2b01c23 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -368,97 +368,97 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
369 | 369 | ||
370 | mTodoListView = new KOTodoListView(calendar,this, name ); | 370 | mTodoListView = new KOTodoListView(calendar,this, name ); |
371 | topLayout->addWidget(mTodoListView); | 371 | topLayout->addWidget(mTodoListView); |
372 | //mTodoListView->header()->setMaximumHeight(30); | 372 | //mTodoListView->header()->setMaximumHeight(30); |
373 | mTodoListView->setRootIsDecorated(true); | 373 | mTodoListView->setRootIsDecorated(true); |
374 | mTodoListView->setAllColumnsShowFocus(true); | 374 | mTodoListView->setAllColumnsShowFocus(true); |
375 | 375 | ||
376 | mTodoListView->setShowSortIndicator(true); | 376 | mTodoListView->setShowSortIndicator(true); |
377 | 377 | ||
378 | mTodoListView->addColumn(i18n("Todo")); | 378 | mTodoListView->addColumn(i18n("Todo")); |
379 | mTodoListView->addColumn(i18n("Prio")); | 379 | mTodoListView->addColumn(i18n("Prio")); |
380 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 380 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
381 | mTodoListView->addColumn(i18n("Complete")); | 381 | mTodoListView->addColumn(i18n("Complete")); |
382 | mTodoListView->setColumnAlignment(2,AlignCenter); | 382 | mTodoListView->setColumnAlignment(2,AlignCenter); |
383 | 383 | ||
384 | mTodoListView->addColumn(i18n("Due Date")); | 384 | mTodoListView->addColumn(i18n("Due Date")); |
385 | mTodoListView->setColumnAlignment(3,AlignLeft); | 385 | mTodoListView->setColumnAlignment(3,AlignLeft); |
386 | mTodoListView->addColumn(i18n("Due Time")); | 386 | mTodoListView->addColumn(i18n("Due Time")); |
387 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 387 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
388 | 388 | ||
389 | mTodoListView->addColumn(i18n("Start Date")); | 389 | mTodoListView->addColumn(i18n("Start Date")); |
390 | mTodoListView->setColumnAlignment(5,AlignLeft); | 390 | mTodoListView->setColumnAlignment(5,AlignLeft); |
391 | mTodoListView->addColumn(i18n("Start Time")); | 391 | mTodoListView->addColumn(i18n("Start Time")); |
392 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 392 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
393 | 393 | ||
394 | mTodoListView->addColumn(i18n("Cancelled")); | 394 | mTodoListView->addColumn(i18n("Cancelled")); |
395 | mTodoListView->addColumn(i18n("Categories")); | 395 | mTodoListView->addColumn(i18n("Categories")); |
396 | #if 0 | 396 | #if 0 |
397 | mTodoListView->addColumn(i18n("Sort Id")); | 397 | mTodoListView->addColumn(i18n("Sort Id")); |
398 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 398 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | mTodoListView->setMinimumHeight( 60 ); | 401 | mTodoListView->setMinimumHeight( 60 ); |
402 | mTodoListView->setItemsRenameable( true ); | 402 | mTodoListView->setItemsRenameable( true ); |
403 | mTodoListView->setRenameable( 0 ); | 403 | mTodoListView->setRenameable( 0 ); |
404 | mTodoListView->setColumnWidth( 0, 120 ); | 404 | mTodoListView->setColumnWidth( 0, 120 ); |
405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
414 | 414 | ||
415 | 415 | ||
416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 416 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
417 | 417 | ||
418 | mPriorityPopupMenu = new QPopupMenu(this); | 418 | mPriorityPopupMenu = new QPopupMenu(this); |
419 | for (int i = 1; i <= 5; i++) { | 419 | for (int i = 1; i <= 5; i++) { |
420 | QString label = QString ("%1").arg (i); | 420 | QString label = QString ("%1").arg (i); |
421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
422 | } | 422 | } |
423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
424 | 424 | ||
425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
426 | for (int i = 0; i <= 100; i+=20) { | 426 | for (int i = 0; i <= 100; i+=20) { |
427 | QString label = QString ("%1 %").arg (i); | 427 | QString label = QString ("%1 %").arg (i); |
428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
429 | } | 429 | } |
430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | mItemPopupMenu = new QPopupMenu(this); | 434 | mItemPopupMenu = new QPopupMenu(this); |
435 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 435 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
436 | SLOT (showTodo())); | 436 | SLOT (showTodo())); |
437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
438 | SLOT (editTodo())); | 438 | SLOT (editTodo())); |
439 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 439 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
440 | SLOT (deleteTodo())); | 440 | SLOT (deleteTodo())); |
441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
442 | SLOT (cloneTodo())); | 442 | SLOT (cloneTodo())); |
443 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 443 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
444 | SLOT (moveTodo())); | 444 | SLOT (moveTodo())); |
445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
446 | SLOT (beamTodo())); | 446 | SLOT (beamTodo())); |
447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
448 | SLOT (cancelTodo())); | 448 | SLOT (cancelTodo())); |
449 | mItemPopupMenu->insertSeparator(); | 449 | mItemPopupMenu->insertSeparator(); |
450 | 450 | ||
451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
452 | SLOT (newTodo())); | 452 | SLOT (newTodo())); |
453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
454 | SLOT (newSubTodo())); | 454 | SLOT (newSubTodo())); |
455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
456 | SLOT (unparentTodo()),0,21); | 456 | SLOT (unparentTodo()),0,21); |
457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
458 | SLOT (reparentTodo()),0,22); | 458 | SLOT (reparentTodo()),0,22); |
459 | mItemPopupMenu->insertSeparator(); | 459 | mItemPopupMenu->insertSeparator(); |
460 | #if 0 | 460 | #if 0 |
461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
462 | this, SLOT( purgeCompleted() ) ); | 462 | this, SLOT( purgeCompleted() ) ); |
463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
464 | this, SLOT( toggleCompleted() ),0, 33 ); | 464 | this, SLOT( toggleCompleted() ),0, 33 ); |
@@ -505,96 +505,97 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
505 | // Double clicking conflicts with opening/closing the subtree | 505 | // Double clicking conflicts with opening/closing the subtree |
506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
507 | SLOT( editItem( QListViewItem *) ) ); | 507 | SLOT( editItem( QListViewItem *) ) ); |
508 | /* | 508 | /* |
509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
510 | const QPoint &,int ) ), | 510 | const QPoint &,int ) ), |
511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
512 | */ | 512 | */ |
513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
514 | const QPoint &,int ) ), | 514 | const QPoint &,int ) ), |
515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
517 | SLOT( itemClicked( QListViewItem * ) ) ); | 517 | SLOT( itemClicked( QListViewItem * ) ) ); |
518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
521 | SLOT( updateView() ) ); | 521 | SLOT( updateView() ) ); |
522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
523 | SLOT( todoModified(Todo *, int) ) ); | 523 | SLOT( todoModified(Todo *, int) ) ); |
524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
525 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 525 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
527 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 527 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
528 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 528 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
529 | SLOT( paintNeeded()) ); | 529 | SLOT( paintNeeded()) ); |
530 | 530 | ||
531 | #if 0 | 531 | #if 0 |
532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
533 | SLOT(selectionChanged(QListViewItem *))); | 533 | SLOT(selectionChanged(QListViewItem *))); |
534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
535 | SLOT(selectionChanged(QListViewItem *))); | 535 | SLOT(selectionChanged(QListViewItem *))); |
536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
537 | SLOT(selectionChanged(QListViewItem *))); | 537 | SLOT(selectionChanged(QListViewItem *))); |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
543 | 543 | ||
544 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
545 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
546 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
547 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
552 | { | 552 | { |
553 | delete mKOTodoViewWhatsThis; | ||
553 | delete mDocPrefs; | 554 | delete mDocPrefs; |
554 | } | 555 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | 556 | QString KOTodoView::getWhatsThisText(QPoint p) |
556 | { | 557 | { |
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 558 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
558 | if ( item ) | 559 | if ( item ) |
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 560 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
560 | KOPrefs::instance()->mWTshowDetails, | 561 | KOPrefs::instance()->mWTshowDetails, |
561 | KOPrefs::instance()->mWTshowCreated, | 562 | KOPrefs::instance()->mWTshowCreated, |
562 | KOPrefs::instance()->mWTshowChanged); | 563 | KOPrefs::instance()->mWTshowChanged); |
563 | return i18n("That is the todo view" ); | 564 | return i18n("That is the todo view" ); |
564 | 565 | ||
565 | } | 566 | } |
566 | 567 | ||
567 | void KOTodoView::jumpToDate () | 568 | void KOTodoView::jumpToDate () |
568 | { | 569 | { |
569 | // if (mActiveItem) { | 570 | // if (mActiveItem) { |
570 | // mActiveItem->todo()); | 571 | // mActiveItem->todo()); |
571 | // if ( mActiveItem->todo()->hasDueDate() ) | 572 | // if ( mActiveItem->todo()->hasDueDate() ) |
572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 573 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
573 | } | 574 | } |
574 | void KOTodoView::paintNeeded() | 575 | void KOTodoView::paintNeeded() |
575 | { | 576 | { |
576 | if ( mPendingUpdateBeforeRepaint ) { | 577 | if ( mPendingUpdateBeforeRepaint ) { |
577 | updateView(); | 578 | updateView(); |
578 | mPendingUpdateBeforeRepaint = false; | 579 | mPendingUpdateBeforeRepaint = false; |
579 | } | 580 | } |
580 | } | 581 | } |
581 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 582 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
582 | { | 583 | { |
583 | if ( mPendingUpdateBeforeRepaint ) { | 584 | if ( mPendingUpdateBeforeRepaint ) { |
584 | updateView(); | 585 | updateView(); |
585 | mPendingUpdateBeforeRepaint = false; | 586 | mPendingUpdateBeforeRepaint = false; |
586 | } | 587 | } |
587 | KOrg::BaseView::paintEvent( pevent); | 588 | KOrg::BaseView::paintEvent( pevent); |
588 | } | 589 | } |
589 | 590 | ||
590 | void KOTodoView::updateView() | 591 | void KOTodoView::updateView() |
591 | { | 592 | { |
592 | pendingSubtodo = 0; | 593 | pendingSubtodo = 0; |
593 | if ( mBlockUpdate ) { | 594 | if ( mBlockUpdate ) { |
594 | return; | 595 | return; |
595 | } | 596 | } |
596 | if ( !isVisible() ) { | 597 | if ( !isVisible() ) { |
597 | mPendingUpdateBeforeRepaint = true; | 598 | mPendingUpdateBeforeRepaint = true; |
598 | return; | 599 | return; |
599 | } | 600 | } |
600 | //qDebug("KOTodoView::updateView() %x", this); | 601 | //qDebug("KOTodoView::updateView() %x", this); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 462f0a6..eab0754 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -4,96 +4,97 @@ | |||
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | class KOTodoViewWhatsThis; | ||
52 | 53 | ||
53 | class DocPrefs; | 54 | class DocPrefs; |
54 | 55 | ||
55 | class KOTodoListView : public KListView | 56 | class KOTodoListView : public KListView |
56 | { | 57 | { |
57 | Q_OBJECT | 58 | Q_OBJECT |
58 | public: | 59 | public: |
59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 60 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
60 | virtual ~KOTodoListView() {} | 61 | virtual ~KOTodoListView() {} |
61 | 62 | ||
62 | signals: | 63 | signals: |
63 | void paintNeeded(); | 64 | void paintNeeded(); |
64 | void todoDropped(Todo *, int); | 65 | void todoDropped(Todo *, int); |
65 | void double_Clicked(QListViewItem *item); | 66 | void double_Clicked(QListViewItem *item); |
66 | void reparentTodoSignal( Todo *,Todo * ); | 67 | void reparentTodoSignal( Todo *,Todo * ); |
67 | void unparentTodoSignal(Todo *); | 68 | void unparentTodoSignal(Todo *); |
68 | void deleteTodo( Todo * ); | 69 | void deleteTodo( Todo * ); |
69 | protected: | 70 | protected: |
70 | void contentsDragEnterEvent(QDragEnterEvent *); | 71 | void contentsDragEnterEvent(QDragEnterEvent *); |
71 | void contentsDragMoveEvent(QDragMoveEvent *); | 72 | void contentsDragMoveEvent(QDragMoveEvent *); |
72 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 73 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
73 | void contentsDropEvent(QDropEvent *); | 74 | void contentsDropEvent(QDropEvent *); |
74 | 75 | ||
75 | void contentsMousePressEvent(QMouseEvent *); | 76 | void contentsMousePressEvent(QMouseEvent *); |
76 | void contentsMouseMoveEvent(QMouseEvent *); | 77 | void contentsMouseMoveEvent(QMouseEvent *); |
77 | void contentsMouseReleaseEvent(QMouseEvent *); | 78 | void contentsMouseReleaseEvent(QMouseEvent *); |
78 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 79 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
79 | 80 | ||
80 | private: | 81 | private: |
81 | void paintEvent(QPaintEvent * pevent); | 82 | void paintEvent(QPaintEvent * pevent); |
82 | bool internalDrop; | 83 | bool internalDrop; |
83 | QString mName; | 84 | QString mName; |
84 | Calendar *mCalendar; | 85 | Calendar *mCalendar; |
85 | QPoint mPressPos; | 86 | QPoint mPressPos; |
86 | bool mMousePressed; | 87 | bool mMousePressed; |
87 | QListViewItem *mOldCurrent; | 88 | QListViewItem *mOldCurrent; |
88 | void keyPressEvent ( QKeyEvent * ) ; | 89 | void keyPressEvent ( QKeyEvent * ) ; |
89 | }; | 90 | }; |
90 | 91 | ||
91 | 92 | ||
92 | /** | 93 | /** |
93 | This is the line-edit on top of the todoview for fast addition of new todos | 94 | This is the line-edit on top of the todoview for fast addition of new todos |
94 | */ | 95 | */ |
95 | class KOQuickTodo : public QLineEdit | 96 | class KOQuickTodo : public QLineEdit |
96 | { | 97 | { |
97 | public: | 98 | public: |
98 | KOQuickTodo(QWidget *parent=0); | 99 | KOQuickTodo(QWidget *parent=0); |
99 | protected: | 100 | protected: |
@@ -173,83 +174,84 @@ class KOTodoView : public KOrg::BaseView | |||
173 | void displayAllFlat(); | 174 | void displayAllFlat(); |
174 | 175 | ||
175 | void purgeCompleted(); | 176 | void purgeCompleted(); |
176 | void toggleCompleted(); | 177 | void toggleCompleted(); |
177 | void toggleRunning(); | 178 | void toggleRunning(); |
178 | void toggleQuickTodo(); | 179 | void toggleQuickTodo(); |
179 | void updateTodo( Todo *, int ); | 180 | void updateTodo( Todo *, int ); |
180 | 181 | ||
181 | void itemClicked(QListViewItem *); | 182 | void itemClicked(QListViewItem *); |
182 | void itemStateChanged(QListViewItem *); | 183 | void itemStateChanged(QListViewItem *); |
183 | void modified(bool); | 184 | void modified(bool); |
184 | void itemDoubleClicked(QListViewItem *item); | 185 | void itemDoubleClicked(QListViewItem *item); |
185 | 186 | ||
186 | signals: | 187 | signals: |
187 | void newTodoSignal(); | 188 | void newTodoSignal(); |
188 | void newSubTodoSignal(Todo *); | 189 | void newSubTodoSignal(Todo *); |
189 | void unparentTodoSignal(Todo *); | 190 | void unparentTodoSignal(Todo *); |
190 | void reparentTodoSignal( Todo *,Todo * ); | 191 | void reparentTodoSignal( Todo *,Todo * ); |
191 | void showTodoSignal(Todo *); | 192 | void showTodoSignal(Todo *); |
192 | 193 | ||
193 | void editTodoSignal(Todo *); | 194 | void editTodoSignal(Todo *); |
194 | void deleteTodoSignal(Todo *); | 195 | void deleteTodoSignal(Todo *); |
195 | void todoModifiedSignal (Todo *, int); | 196 | void todoModifiedSignal (Todo *, int); |
196 | 197 | ||
197 | void isModified(bool); | 198 | void isModified(bool); |
198 | void cloneTodoSignal( Incidence * ); | 199 | void cloneTodoSignal( Incidence * ); |
199 | void cancelTodoSignal( Incidence * ); | 200 | void cancelTodoSignal( Incidence * ); |
200 | void moveTodoSignal( Incidence * ); | 201 | void moveTodoSignal( Incidence * ); |
201 | void beamTodoSignal( Incidence * ); | 202 | void beamTodoSignal( Incidence * ); |
202 | void purgeCompletedSignal(); | 203 | void purgeCompletedSignal(); |
203 | 204 | ||
204 | protected slots: | 205 | protected slots: |
205 | void paintNeeded(); | 206 | void paintNeeded(); |
206 | void processSelectionChange(); | 207 | void processSelectionChange(); |
207 | void addQuickTodo(); | 208 | void addQuickTodo(); |
208 | void setTodoModified( Todo* ); | 209 | void setTodoModified( Todo* ); |
209 | void todoModified(Todo *, int ); | 210 | void todoModified(Todo *, int ); |
210 | 211 | ||
211 | private: | 212 | private: |
212 | /* | 213 | /* |
213 | * the TodoEditor approach is rather unscaling in the long | 214 | * the TodoEditor approach is rather unscaling in the long |
214 | * run. | 215 | * run. |
215 | * Korganizer keeps it in memory and we need to update | 216 | * Korganizer keeps it in memory and we need to update |
216 | * 1. make KOTodoViewItem a QObject again? | 217 | * 1. make KOTodoViewItem a QObject again? |
217 | * 2. add a public method for setting one todo modified? | 218 | * 2. add a public method for setting one todo modified? |
218 | * 3. add a private method for setting a todo modified + friend here? | 219 | * 3. add a private method for setting a todo modified + friend here? |
219 | * -- zecke 2002-07-08 | 220 | * -- zecke 2002-07-08 |
220 | */ | 221 | */ |
222 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; | ||
221 | friend class KOTodoListView; | 223 | friend class KOTodoListView; |
222 | void paintEvent(QPaintEvent * pevent); | 224 | void paintEvent(QPaintEvent * pevent); |
223 | bool mPendingUpdateBeforeRepaint; | 225 | bool mPendingUpdateBeforeRepaint; |
224 | friend class KOTodoViewItem; | 226 | friend class KOTodoViewItem; |
225 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 227 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
226 | void restoreItemState( QListViewItem * ); | 228 | void restoreItemState( QListViewItem * ); |
227 | 229 | ||
228 | bool checkTodo( Todo * ); | 230 | bool checkTodo( Todo * ); |
229 | bool isFlatDisplay; | 231 | bool isFlatDisplay; |
230 | void setOpen( QListViewItem*, bool setOpen); | 232 | void setOpen( QListViewItem*, bool setOpen); |
231 | KOTodoListView *mTodoListView; | 233 | KOTodoListView *mTodoListView; |
232 | QPopupMenu *mItemPopupMenu; | 234 | QPopupMenu *mItemPopupMenu; |
233 | QPopupMenu *mPopupMenu; | 235 | QPopupMenu *mPopupMenu; |
234 | QPopupMenu *mPriorityPopupMenu; | 236 | QPopupMenu *mPriorityPopupMenu; |
235 | QPopupMenu *mPercentageCompletedPopupMenu; | 237 | QPopupMenu *mPercentageCompletedPopupMenu; |
236 | QPopupMenu *mCategoryPopupMenu; | 238 | QPopupMenu *mCategoryPopupMenu; |
237 | 239 | ||
238 | QMap<int, int> mPercentage; | 240 | QMap<int, int> mPercentage; |
239 | QMap<int, int> mPriority; | 241 | QMap<int, int> mPriority; |
240 | QMap<int, QString> mCategory; | 242 | QMap<int, QString> mCategory; |
241 | KOTodoViewItem *mActiveItem; | 243 | KOTodoViewItem *mActiveItem; |
242 | 244 | ||
243 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 245 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
244 | QString mName; | 246 | QString mName; |
245 | 247 | ||
246 | DocPrefs *mDocPrefs; | 248 | DocPrefs *mDocPrefs; |
247 | QString mCurrentDoc; | 249 | QString mCurrentDoc; |
248 | KOQuickTodo *mQuickAdd; | 250 | KOQuickTodo *mQuickAdd; |
249 | bool mBlockUpdate; | 251 | bool mBlockUpdate; |
250 | void keyPressEvent ( QKeyEvent * ) ; | 252 | void keyPressEvent ( QKeyEvent * ) ; |
251 | KOTodoViewItem * pendingSubtodo; | 253 | KOTodoViewItem * pendingSubtodo; |
252 | DateNavigator* mNavigator; | 254 | DateNavigator* mNavigator; |
253 | }; | 255 | }; |
254 | 256 | ||
255 | #endif | 257 | #endif |