-rw-r--r-- | korganizer/koagendaview.cpp | 86 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 10 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 8 |
4 files changed, 88 insertions, 24 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 2b05d37..8d32152 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -49,237 +49,301 @@ | |||
49 | #include "koviewmanager.h" | 49 | #include "koviewmanager.h" |
50 | 50 | ||
51 | #include <libkcal/calendar.h> | 51 | #include <libkcal/calendar.h> |
52 | #include <libkcal/icaldrag.h> | 52 | #include <libkcal/icaldrag.h> |
53 | #include <libkcal/dndfactory.h> | 53 | #include <libkcal/dndfactory.h> |
54 | 54 | ||
55 | #include <kcalendarsystem.h> | 55 | #include <kcalendarsystem.h> |
56 | 56 | ||
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #ifndef KORG_NOPLUGINS | 58 | #ifndef KORG_NOPLUGINS |
59 | #include "kocore.h" | 59 | #include "kocore.h" |
60 | #endif | 60 | #endif |
61 | #include "koprefs.h" | 61 | #include "koprefs.h" |
62 | #include "koagenda.h" | 62 | #include "koagenda.h" |
63 | #include "koagendaitem.h" | 63 | #include "koagendaitem.h" |
64 | #ifndef KORG_NOPRINTER | 64 | #ifndef KORG_NOPRINTER |
65 | #include "calprinter.h" | 65 | #include "calprinter.h" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koagendaview.h" | 68 | #include "koagendaview.h" |
69 | //#include "koagendaview.moc" | 69 | //#include "koagendaview.moc" |
70 | 70 | ||
71 | //extern bool globalFlagBlockPainting; | 71 | //extern bool globalFlagBlockPainting; |
72 | extern int globalFlagBlockAgenda; | 72 | extern int globalFlagBlockAgenda; |
73 | extern int globalFlagBlockStartup; | 73 | extern int globalFlagBlockStartup; |
74 | extern int globalFlagBlockAgendaItemPaint; | 74 | extern int globalFlagBlockAgendaItemPaint; |
75 | extern int globalFlagBlockAgendaItemUpdate; | 75 | extern int globalFlagBlockAgendaItemUpdate; |
76 | extern int globalFlagBlockLabel; | 76 | extern int globalFlagBlockLabel; |
77 | using namespace KOrg; | 77 | using namespace KOrg; |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
82 | QScrollView(parent,name,f) | 82 | QScrollView(parent,name,f) |
83 | { | 83 | { |
84 | myPix.resize( 1, 1 ); | 84 | myPix.resize( 1, 1 ); |
85 | mRows = rows; | 85 | mRows = rows; |
86 | 86 | ||
87 | mRedrawNeeded = true; | 87 | mRedrawNeeded = true; |
88 | setMinimumHeight( 20 ); | 88 | setMinimumHeight( 20 ); |
89 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 89 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
90 | 90 | ||
91 | enableClipper(true); | 91 | enableClipper(true); |
92 | 92 | ||
93 | setHScrollBarMode(AlwaysOff); | 93 | setHScrollBarMode(AlwaysOff); |
94 | setVScrollBarMode(AlwaysOff); | 94 | setVScrollBarMode(AlwaysOff); |
95 | 95 | ||
96 | resizeContents(50,mRows * mCellHeight); | 96 | resizeContents(50,mRows * mCellHeight); |
97 | 97 | ||
98 | viewport()->setBackgroundMode( PaletteBackground ); | 98 | viewport()->setBackgroundMode( PaletteBackground ); |
99 | } | 99 | } |
100 | 100 | ||
101 | void TimeLabels::setCellHeight(int height) | 101 | void TimeLabels::setCellHeight(int height) |
102 | { | 102 | { |
103 | mCellHeight = height; | 103 | mCellHeight = height; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | Optimization so that only the "dirty" portion of the scroll view | 107 | Optimization so that only the "dirty" portion of the scroll view |
108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
109 | */ | 109 | */ |
110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
111 | { | 111 | { |
112 | 112 | ||
113 | // if ( globalFlagBlockAgenda ) | 113 | cx = contentsX() + frameWidth()*2; |
114 | // return; | 114 | cw = contentsWidth() ; |
115 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 115 | // end of workaround |
116 | // redrawn, not the area of the widget. unfortunately, this | 116 | |
117 | // code assumes the latter... | 117 | int cell = ((int)(cy/mCellHeight)); |
118 | 118 | int y = cell * mCellHeight; | |
119 | // now, for a workaround... | 119 | QFontMetrics fm = fontMetrics(); |
120 | // these two assignments fix the weird redraw bug | 120 | QString hour; |
121 | QString suffix = "am"; | ||
122 | int timeHeight = fm.ascent(); | ||
123 | QFont nFont = p->font(); | ||
124 | |||
125 | if (!KGlobal::locale()->use12Clock()) { | ||
126 | if ( QApplication::desktop()->width() <= 320 ) | ||
127 | suffix = "00"; | ||
128 | else | ||
129 | suffix = "00"; | ||
130 | } | ||
131 | |||
132 | if ( timeHeight > mCellHeight ) { | ||
133 | timeHeight = mCellHeight-1; | ||
134 | int pointS = nFont.pointSize(); | ||
135 | while ( pointS > 4 ) { | ||
136 | nFont.setPointSize( pointS ); | ||
137 | fm = QFontMetrics( nFont ); | ||
138 | if ( fm.ascent() < mCellHeight ) | ||
139 | break; | ||
140 | -- pointS; | ||
141 | } | ||
142 | fm = QFontMetrics( nFont ); | ||
143 | timeHeight = fm.ascent(); | ||
144 | } | ||
145 | //timeHeight -= (timeHeight/4-2); | ||
146 | QFont sFont = nFont; | ||
147 | sFont.setPointSize( sFont.pointSize()/2 ); | ||
148 | QFontMetrics fmS( sFont ); | ||
149 | int sHei = fmS.ascent() ; | ||
150 | //sHei -= (sHei/4-2); | ||
151 | int startW = this->width() - frameWidth()-2; | ||
152 | int tw2 = fmS.width(suffix); | ||
153 | timeHeight = (timeHeight-1) /2 -1; | ||
154 | while (y < cy + ch+mCellHeight) { | ||
155 | p->drawLine(startW-tw2+1 ,y,cw,y); | ||
156 | hour.setNum(cell); | ||
157 | // handle 24h and am/pm time formats | ||
158 | if (KGlobal::locale()->use12Clock()) { | ||
159 | if (cell > 11) suffix = "pm"; | ||
160 | else | ||
161 | suffix = "am"; | ||
162 | if (cell == 0) hour.setNum(12); | ||
163 | if (cell > 12) hour.setNum(cell - 12); | ||
164 | } | ||
165 | |||
166 | // center and draw the time label | ||
167 | int timeWidth = fm.width(hour); | ||
168 | int offset = startW - timeWidth - tw2 ; | ||
169 | p->setFont( nFont ); | ||
170 | p->drawText( offset, y+ timeHeight, hour); | ||
171 | p->setFont( sFont ); | ||
172 | offset = startW - tw2+1; | ||
173 | p->drawText( offset, y -1, suffix); | ||
174 | |||
175 | // increment indices | ||
176 | y += mCellHeight; | ||
177 | cell++; | ||
178 | } | ||
179 | |||
180 | |||
181 | |||
182 | |||
183 | #if 0 | ||
121 | mRedrawNeeded = true; | 184 | mRedrawNeeded = true; |
122 | if ( mRedrawNeeded ) { | 185 | if ( mRedrawNeeded ) { |
123 | cx = contentsX() + frameWidth()*2; | 186 | cx = contentsX() + frameWidth()*2; |
124 | cw = contentsWidth() ; | 187 | cw = contentsWidth() ; |
125 | // end of workaround | 188 | // end of workaround |
126 | 189 | ||
127 | int cell = ((int)(cy/mCellHeight)); | 190 | int cell = ((int)(cy/mCellHeight)); |
128 | int y = cell * mCellHeight; | 191 | int y = cell * mCellHeight; |
129 | QFontMetrics fm = fontMetrics(); | 192 | QFontMetrics fm = fontMetrics(); |
130 | QString hour; | 193 | QString hour; |
131 | QString suffix; | 194 | QString suffix; |
132 | int timeHeight = fm.ascent(); | 195 | int timeHeight = fm.ascent(); |
133 | QFont nFont = p->font(); | 196 | QFont nFont = p->font(); |
134 | 197 | ||
135 | if (!KGlobal::locale()->use12Clock()) { | 198 | if (!KGlobal::locale()->use12Clock()) { |
136 | if ( QApplication::desktop()->width() <= 320 ) | 199 | if ( QApplication::desktop()->width() <= 320 ) |
137 | suffix = ""; | 200 | suffix = ""; |
138 | else | 201 | else |
139 | suffix = "00"; | 202 | suffix = "00"; |
140 | } | 203 | } |
141 | 204 | ||
142 | if ( timeHeight > mCellHeight ) { | 205 | if ( timeHeight > mCellHeight ) { |
143 | timeHeight = mCellHeight-1; | 206 | timeHeight = mCellHeight-1; |
144 | int pointS = nFont.pointSize(); | 207 | int pointS = nFont.pointSize(); |
145 | while ( pointS > 4 ) { | 208 | while ( pointS > 4 ) { |
146 | nFont.setPointSize( pointS ); | 209 | nFont.setPointSize( pointS ); |
147 | fm = QFontMetrics( nFont ); | 210 | fm = QFontMetrics( nFont ); |
148 | if ( fm.ascent() < mCellHeight ) | 211 | if ( fm.ascent() < mCellHeight ) |
149 | break; | 212 | break; |
150 | -- pointS; | 213 | -- pointS; |
151 | } | 214 | } |
152 | fm = QFontMetrics( nFont ); | 215 | fm = QFontMetrics( nFont ); |
153 | timeHeight = fm.ascent(); | 216 | timeHeight = fm.ascent(); |
154 | } | 217 | } |
155 | //timeHeight -= (timeHeight/4-2); | 218 | //timeHeight -= (timeHeight/4-2); |
156 | QFont sFont = nFont; | 219 | QFont sFont = nFont; |
157 | sFont.setPointSize( sFont.pointSize()/2 ); | 220 | sFont.setPointSize( sFont.pointSize()/2 ); |
158 | QFontMetrics fmS( sFont ); | 221 | QFontMetrics fmS( sFont ); |
159 | int sHei = fmS.ascent() ; | 222 | int sHei = fmS.ascent() ; |
160 | //sHei -= (sHei/4-2); | 223 | //sHei -= (sHei/4-2); |
161 | int startW = this->width() - frameWidth()-2; | 224 | int startW = this->width() - frameWidth()-2; |
162 | int tw2 = fmS.width(suffix); | 225 | int tw2 = fmS.width(suffix); |
163 | while (y < cy + ch) { | 226 | while (y < cy + ch) { |
164 | p->drawLine(cx,y,cw,y); | 227 | p->drawLine(cx,y,cw,y); |
165 | hour.setNum(cell); | 228 | hour.setNum(cell); |
166 | // handle 24h and am/pm time formats | 229 | // handle 24h and am/pm time formats |
167 | if (KGlobal::locale()->use12Clock()) { | 230 | if (KGlobal::locale()->use12Clock()) { |
168 | if (cell > 11) suffix = "pm"; | 231 | if (cell > 11) suffix = "pm"; |
169 | else | 232 | else |
170 | suffix = "am"; | 233 | suffix = "am"; |
171 | if (cell == 0) hour.setNum(12); | 234 | if (cell == 0) hour.setNum(12); |
172 | if (cell > 12) hour.setNum(cell - 12); | 235 | if (cell > 12) hour.setNum(cell - 12); |
173 | tw2 = fmS.width(suffix); | 236 | tw2 = fmS.width(suffix); |
174 | } | 237 | } |
175 | 238 | ||
176 | // center and draw the time label | 239 | // center and draw the time label |
177 | int timeWidth = fm.width(hour); | 240 | int timeWidth = fm.width(hour); |
178 | int offset = startW - timeWidth - tw2 ; | 241 | int offset = startW - timeWidth - tw2 ; |
179 | p->setFont( nFont ); | 242 | p->setFont( nFont ); |
180 | p->drawText( offset, y+ timeHeight, hour); | 243 | p->drawText( offset, y+ timeHeight, hour); |
181 | p->setFont( sFont ); | 244 | p->setFont( sFont ); |
182 | offset = startW - tw2+1; | 245 | offset = startW - tw2+1; |
183 | p->drawText( offset, y+ sHei, suffix); | 246 | p->drawText( offset, y+ sHei, suffix); |
184 | 247 | ||
185 | // increment indices | 248 | // increment indices |
186 | y += mCellHeight; | 249 | y += mCellHeight; |
187 | cell++; | 250 | cell++; |
188 | } | 251 | } |
189 | } else { | 252 | } else { |
190 | //qDebug("NO redraw "); | 253 | //qDebug("NO redraw "); |
191 | } | 254 | } |
192 | // double buffer not yet implemented | 255 | // double buffer not yet implemented |
193 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | 256 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); |
194 | //mRedrawNeeded = false; | 257 | //mRedrawNeeded = false; |
258 | #endif | ||
195 | } | 259 | } |
196 | 260 | ||
197 | /** | 261 | /** |
198 | Calculates the minimum width. | 262 | Calculates the minimum width. |
199 | */ | 263 | */ |
200 | int TimeLabels::minimumWidth() const | 264 | int TimeLabels::minimumWidth() const |
201 | { | 265 | { |
202 | return mMiniWidth; | 266 | return mMiniWidth; |
203 | } | 267 | } |
204 | 268 | ||
205 | /** updates widget's internal state */ | 269 | /** updates widget's internal state */ |
206 | void TimeLabels::updateConfig() | 270 | void TimeLabels::updateConfig() |
207 | { | 271 | { |
208 | mRedrawNeeded = true; | 272 | mRedrawNeeded = true; |
209 | // set the font | 273 | // set the font |
210 | // config->setGroup("Fonts"); | 274 | // config->setGroup("Fonts"); |
211 | // QFont font = config->readFontEntry("TimeBar Font"); | 275 | // QFont font = config->readFontEntry("TimeBar Font"); |
212 | setFont(KOPrefs::instance()->mTimeBarFont); | 276 | setFont(KOPrefs::instance()->mTimeBarFont); |
213 | QString test = "20"; | 277 | QString test = "20"; |
214 | if (KGlobal::locale()->use12Clock()) | 278 | if (KGlobal::locale()->use12Clock()) |
215 | test = "12"; | 279 | test = "12"; |
216 | mMiniWidth = fontMetrics().width(test); | 280 | mMiniWidth = fontMetrics().width(test); |
217 | if (KGlobal::locale()->use12Clock()) | 281 | if (KGlobal::locale()->use12Clock()) |
218 | test = "pm"; | 282 | test = "pm"; |
219 | else { | 283 | else { |
220 | if ( QApplication::desktop()->width() <= 320 ) | 284 | if ( QApplication::desktop()->width() <= 320 ) |
221 | test = ""; | 285 | test = "00"; |
222 | else | 286 | else |
223 | test = "00"; | 287 | test = "00"; |
224 | } | 288 | } |
225 | QFont sFont = font(); | 289 | QFont sFont = font(); |
226 | sFont.setPointSize( sFont.pointSize()/2 ); | 290 | sFont.setPointSize( sFont.pointSize()/2 ); |
227 | QFontMetrics fmS( sFont ); | 291 | QFontMetrics fmS( sFont ); |
228 | mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ; | 292 | mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ; |
229 | // update geometry restrictions based on new settings | 293 | // update geometry restrictions based on new settings |
230 | setFixedWidth( mMiniWidth ); | 294 | setFixedWidth( mMiniWidth ); |
231 | 295 | ||
232 | // update HourSize | 296 | // update HourSize |
233 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 297 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
234 | resizeContents(50,mRows * mCellHeight); | 298 | resizeContents(50,mRows * mCellHeight); |
235 | } | 299 | } |
236 | 300 | ||
237 | /** update time label positions */ | 301 | /** update time label positions */ |
238 | void TimeLabels::positionChanged() | 302 | void TimeLabels::positionChanged() |
239 | { | 303 | { |
240 | int adjustment = mAgenda->contentsY(); | 304 | int adjustment = mAgenda->contentsY(); |
241 | setContentsPos(0, adjustment); | 305 | setContentsPos(0, adjustment); |
242 | } | 306 | } |
243 | 307 | ||
244 | /** */ | 308 | /** */ |
245 | void TimeLabels::setAgenda(KOAgenda* agenda) | 309 | void TimeLabels::setAgenda(KOAgenda* agenda) |
246 | { | 310 | { |
247 | mAgenda = agenda; | 311 | mAgenda = agenda; |
248 | } | 312 | } |
249 | 313 | ||
250 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 314 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
251 | { | 315 | { |
252 | mMouseDownY = e->pos().y(); | 316 | mMouseDownY = e->pos().y(); |
253 | mOrgCap = topLevelWidget()->caption(); | 317 | mOrgCap = topLevelWidget()->caption(); |
254 | } | 318 | } |
255 | 319 | ||
256 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 320 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
257 | { | 321 | { |
258 | int diff = mMouseDownY - e->pos().y(); | 322 | int diff = mMouseDownY - e->pos().y(); |
259 | if ( diff < 10 && diff > -10 ) | 323 | if ( diff < 10 && diff > -10 ) |
260 | return; | 324 | return; |
261 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 325 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
262 | if ( tSize < 4 ) | 326 | if ( tSize < 4 ) |
263 | tSize = 4; | 327 | tSize = 4; |
264 | if ( tSize > 22 ) | 328 | if ( tSize > 22 ) |
265 | tSize = 22; | 329 | tSize = 22; |
266 | tSize = (tSize-2)/2; | 330 | tSize = (tSize-2)/2; |
267 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 331 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
268 | 332 | ||
269 | } | 333 | } |
270 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 334 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
271 | { | 335 | { |
272 | topLevelWidget()->setCaption( mOrgCap ); | 336 | topLevelWidget()->setCaption( mOrgCap ); |
273 | int diff = mMouseDownY - e->pos().y(); | 337 | int diff = mMouseDownY - e->pos().y(); |
274 | if ( diff < 10 && diff > -10 ) | 338 | if ( diff < 10 && diff > -10 ) |
275 | return; | 339 | return; |
276 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 340 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
277 | if ( tSize < 4 ) | 341 | if ( tSize < 4 ) |
278 | tSize = 4; | 342 | tSize = 4; |
279 | if ( tSize > 22 ) | 343 | if ( tSize > 22 ) |
280 | tSize = 22; | 344 | tSize = 22; |
281 | tSize = (tSize/2)*2; | 345 | tSize = (tSize/2)*2; |
282 | if ( tSize == KOPrefs::instance()->mHourSize ) | 346 | if ( tSize == KOPrefs::instance()->mHourSize ) |
283 | return; | 347 | return; |
284 | KOPrefs::instance()->mHourSize = tSize; | 348 | KOPrefs::instance()->mHourSize = tSize; |
285 | emit scaleChanged(); | 349 | emit scaleChanged(); |
@@ -613,189 +677,193 @@ void KOAgendaView::resizeEvent( QResizeEvent* e ) | |||
613 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 677 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
614 | bool uc = false; | 678 | bool uc = false; |
615 | int ow = e->oldSize().width(); | 679 | int ow = e->oldSize().width(); |
616 | int oh = e->oldSize().height(); | 680 | int oh = e->oldSize().height(); |
617 | int w = e->size().width(); | 681 | int w = e->size().width(); |
618 | int h = e->size().height(); | 682 | int h = e->size().height(); |
619 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 683 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
620 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 684 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
621 | uc = true; | 685 | uc = true; |
622 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 686 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
623 | } | 687 | } |
624 | mUpcomingWidth = e->size().width() ; | 688 | mUpcomingWidth = e->size().width() ; |
625 | if ( mBlockUpdating || uc ) { | 689 | if ( mBlockUpdating || uc ) { |
626 | mBlockUpdating = false; | 690 | mBlockUpdating = false; |
627 | //mAgenda->setMinimumSize(800 , 600 ); | 691 | //mAgenda->setMinimumSize(800 , 600 ); |
628 | //qDebug("mAgenda->resize+++++++++++++++ "); | 692 | //qDebug("mAgenda->resize+++++++++++++++ "); |
629 | updateConfig(); | 693 | updateConfig(); |
630 | //qDebug("KOAgendaView::Updating now possible "); | 694 | //qDebug("KOAgendaView::Updating now possible "); |
631 | } else | 695 | } else |
632 | createDayLabels(); | 696 | createDayLabels(); |
633 | //qDebug("resizeEvent end "); | 697 | //qDebug("resizeEvent end "); |
634 | 698 | ||
635 | } | 699 | } |
636 | void KOAgendaView::slotDaylabelClicked( int num ) | 700 | void KOAgendaView::slotDaylabelClicked( int num ) |
637 | { | 701 | { |
638 | 702 | ||
639 | QDate firstDate = mSelectedDates.first(); | 703 | QDate firstDate = mSelectedDates.first(); |
640 | if ( num == -1 ) | 704 | if ( num == -1 ) |
641 | emit showDateView( 6, firstDate ); | 705 | emit showDateView( 6, firstDate ); |
642 | else if (num >= 0 ) { | 706 | else if (num >= 0 ) { |
643 | if ( mSelectedDates.count() == 1) | 707 | if ( mSelectedDates.count() == 1) |
644 | emit showDateView( 9, firstDate.addDays( num ) ); | 708 | emit showDateView( 9, firstDate.addDays( num ) ); |
645 | else | 709 | else |
646 | emit showDateView( 3, firstDate.addDays( num ) ); | 710 | emit showDateView( 3, firstDate.addDays( num ) ); |
647 | } | 711 | } |
648 | else | 712 | else |
649 | showDateView( 10, firstDate.addDays(1) ); | 713 | showDateView( 10, firstDate.addDays(1) ); |
650 | } | 714 | } |
651 | 715 | ||
652 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 716 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
653 | { | 717 | { |
654 | 718 | ||
655 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 719 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
656 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 720 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
657 | mDayLabelsList.append( dayLabel ); | 721 | mDayLabelsList.append( dayLabel ); |
658 | mLayoutDayLabels->addWidget(dayLabel); | 722 | mLayoutDayLabels->addWidget(dayLabel); |
659 | return dayLabel ; | 723 | return dayLabel ; |
660 | } | 724 | } |
661 | 725 | ||
662 | void KOAgendaView::createDayLabels() | 726 | void KOAgendaView::createDayLabels() |
663 | { | 727 | { |
664 | 728 | ||
665 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 729 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
666 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 730 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
667 | return; | 731 | return; |
668 | 732 | ||
669 | } | 733 | } |
670 | int newHight; | 734 | int newHight; |
671 | 735 | ||
672 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 736 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
673 | // It would remove some flickering and gain speed (since this is called by | 737 | // It would remove some flickering and gain speed (since this is called by |
674 | // each updateView() call) | 738 | // each updateView() call) |
675 | 739 | ||
676 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; | 740 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; |
741 | if ( QApplication::desktop()->width() <= 320 ) | ||
742 | maxWid -= 10; | ||
677 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 743 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
678 | if ( maxWid < 0 ) | 744 | if ( maxWid < 0 ) |
679 | maxWid = 20; | 745 | maxWid = 20; |
680 | 746 | ||
681 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 747 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
682 | QFontMetrics fm ( dlf ); | 748 | QFontMetrics fm ( dlf ); |
683 | int selCount = mSelectedDates.count(); | 749 | int selCount = mSelectedDates.count(); |
684 | QString dayTest = "Mon 20"; | 750 | QString dayTest = "Mon 20"; |
685 | //QString dayTest = "Mon 20"; | 751 | //QString dayTest = "Mon 20"; |
686 | int wid = fm.width( dayTest ); | 752 | int wid = fm.width( dayTest ); |
687 | //maxWid -= ( selCount * 3 ); //working for QLabels | 753 | //maxWid -= ( selCount * 3 ); //working for QLabels |
688 | maxWid -= ( selCount * 3 ); //working for QPushButton | 754 | maxWid -= ( selCount * 3 ); //working for QPushButton |
689 | if ( maxWid < 0 ) | 755 | if ( maxWid < 0 ) |
690 | maxWid = 20; | 756 | maxWid = 20; |
691 | int needWid = wid * selCount; | 757 | int needWid = wid * selCount; |
692 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 758 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
693 | //if ( needWid > maxWid ) | 759 | //if ( needWid > maxWid ) |
694 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 760 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
695 | while ( needWid > maxWid ) { | 761 | while ( needWid > maxWid ) { |
696 | dayTest = dayTest.left( dayTest.length() - 1 ); | 762 | dayTest = dayTest.left( dayTest.length() - 1 ); |
697 | wid = fm.width( dayTest ); | 763 | wid = fm.width( dayTest ); |
698 | needWid = wid * selCount; | 764 | needWid = wid * selCount; |
699 | } | 765 | } |
700 | int maxLen = dayTest.length(); | 766 | int maxLen = dayTest.length(); |
701 | int fontPoint = dlf.pointSize(); | 767 | int fontPoint = dlf.pointSize(); |
702 | if ( maxLen < 2 ) { | 768 | if ( maxLen < 2 ) { |
703 | int fontPoint = dlf.pointSize(); | 769 | int fontPoint = dlf.pointSize(); |
704 | while ( fontPoint > 4 ) { | 770 | while ( fontPoint > 4 ) { |
705 | --fontPoint; | 771 | --fontPoint; |
706 | dlf.setPointSize( fontPoint ); | 772 | dlf.setPointSize( fontPoint ); |
707 | QFontMetrics f( dlf ); | 773 | QFontMetrics f( dlf ); |
708 | wid = f.width( "30" ); | 774 | wid = f.width( "30" ); |
709 | needWid = wid * selCount; | 775 | needWid = wid * selCount; |
710 | if ( needWid < maxWid ) | 776 | if ( needWid < maxWid ) |
711 | break; | 777 | break; |
712 | } | 778 | } |
713 | maxLen = 2; | 779 | maxLen = 2; |
714 | } | 780 | } |
715 | //qDebug("Max len %d ", dayTest.length() ); | 781 | //qDebug("Max len %d ", dayTest.length() ); |
716 | 782 | ||
717 | QFontMetrics tempF( dlf ); | 783 | QFontMetrics tempF( dlf ); |
718 | newHight = tempF.height(); | 784 | newHight = tempF.height(); |
719 | mDayLabels->setFont( dlf ); | 785 | mDayLabels->setFont( dlf ); |
720 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 786 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
721 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 787 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
722 | //mLayoutDayLabels->addSpacing( 2 ); | 788 | //mLayoutDayLabels->addSpacing( 2 ); |
723 | // QFont lFont = dlf; | 789 | // QFont lFont = dlf; |
724 | bool appendLabels = false; | 790 | bool appendLabels = false; |
725 | KOAgendaButton *dayLabel; | 791 | KOAgendaButton *dayLabel; |
726 | dayLabel = mDayLabelsList.first(); | 792 | dayLabel = mDayLabelsList.first(); |
727 | if ( !dayLabel ) { | 793 | if ( !dayLabel ) { |
728 | appendLabels = true; | 794 | appendLabels = true; |
729 | dayLabel = getNewDaylabel(); | 795 | dayLabel = getNewDaylabel(); |
730 | } | 796 | } |
731 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); | 797 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); |
732 | dayLabel->setFont( dlf ); | 798 | dayLabel->setFont( dlf ); |
733 | dayLabel->setNum( -1 ); | 799 | dayLabel->setNum( -1 ); |
734 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 800 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
801 | #if 0 | ||
735 | if ( QApplication::desktop()->width() <= 320 ) | 802 | if ( QApplication::desktop()->width() <= 320 ) |
736 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) ); | 803 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) ); |
737 | else | 804 | else |
805 | #endif | ||
738 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 806 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
739 | dayLabel->show(); | 807 | dayLabel->show(); |
740 | DateList::ConstIterator dit; | 808 | DateList::ConstIterator dit; |
741 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 809 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
742 | int counter = -1; | 810 | int counter = -1; |
743 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 811 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
744 | ++counter; | 812 | ++counter; |
745 | QDate date = *dit; | 813 | QDate date = *dit; |
746 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 814 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
747 | if ( ! appendLabels ) { | 815 | if ( ! appendLabels ) { |
748 | dayLabel = mDayLabelsList.next(); | 816 | dayLabel = mDayLabelsList.next(); |
749 | if ( !dayLabel ) | 817 | if ( !dayLabel ) |
750 | appendLabels = true; | 818 | appendLabels = true; |
751 | } | 819 | } |
752 | if ( appendLabels ) { | 820 | if ( appendLabels ) { |
753 | dayLabel = getNewDaylabel(); | 821 | dayLabel = getNewDaylabel(); |
754 | } | 822 | } |
755 | dayLabel->setMinimumWidth( 1 ); | 823 | dayLabel->setMinimumWidth( 1 ); |
756 | dayLabel->setMaximumWidth( 10240 ); | 824 | dayLabel->setMaximumWidth( 10240 ); |
757 | dayLabel->setFont( dlf ); | 825 | dayLabel->setFont( dlf ); |
758 | dayLabel->show(); | 826 | dayLabel->show(); |
759 | dayLabel->setAutoRepeat( false ); | 827 | dayLabel->setAutoRepeat( false ); |
760 | dayLabel->setNum( counter ); | 828 | dayLabel->setNum( counter ); |
761 | QString str; | 829 | QString str; |
762 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 830 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
763 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 831 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
764 | switch ( maxLen ) { | 832 | switch ( maxLen ) { |
765 | case 2: | 833 | case 2: |
766 | str = QString::number( date.day() ); | 834 | str = QString::number( date.day() ); |
767 | break; | 835 | break; |
768 | 836 | ||
769 | case 3: | 837 | case 3: |
770 | str = dayName.left( 1 ) +QString::number( date.day()); | 838 | str = dayName.left( 1 ) +QString::number( date.day()); |
771 | 839 | ||
772 | break; | 840 | break; |
773 | case 4: | 841 | case 4: |
774 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 842 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
775 | 843 | ||
776 | break; | 844 | break; |
777 | case 5: | 845 | case 5: |
778 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 846 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
779 | 847 | ||
780 | break; | 848 | break; |
781 | case 6: | 849 | case 6: |
782 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 850 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
783 | break; | 851 | break; |
784 | 852 | ||
785 | default: | 853 | default: |
786 | break; | 854 | break; |
787 | } | 855 | } |
788 | if ( oneday ) { | 856 | if ( oneday ) { |
789 | QString addString; | 857 | QString addString; |
790 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 858 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
791 | addString = i18n("Today"); | 859 | addString = i18n("Today"); |
792 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 860 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
793 | addString = i18n("Tomorrow"); | 861 | addString = i18n("Tomorrow"); |
794 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 862 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
795 | addString = i18n("Yesterday"); | 863 | addString = i18n("Yesterday"); |
796 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 864 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
797 | addString = i18n("Day before yesterday"); | 865 | addString = i18n("Day before yesterday"); |
798 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 866 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
799 | addString = i18n("Day after tomorrow"); | 867 | addString = i18n("Day after tomorrow"); |
800 | if ( !addString.isEmpty() ) { | 868 | if ( !addString.isEmpty() ) { |
801 | str = addString+", " + str; | 869 | str = addString+", " + str; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index b8a0f09..8affe50 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -706,144 +706,144 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
706 | bool isRTL = KOGlobals::self()->reverseLayout(); | 706 | bool isRTL = KOGlobals::self()->reverseLayout(); |
707 | 707 | ||
708 | // draw background and topleft frame | 708 | // draw background and topleft frame |
709 | p.fillRect(0,0,width(),height(), mDefaultBackColor); | 709 | p.fillRect(0,0,width(),height(), mDefaultBackColor); |
710 | p.setPen(mDefaultTextColor); | 710 | p.setPen(mDefaultTextColor); |
711 | p.drawRect(0, 0, width(), height()); | 711 | p.drawRect(0, 0, width(), height()); |
712 | int mSelStartT = mSelStart; | 712 | int mSelStartT = mSelStart; |
713 | int mSelEndT = mSelEnd; | 713 | int mSelEndT = mSelEnd; |
714 | if ( mSelEndT >= NUMDAYS ) | 714 | if ( mSelEndT >= NUMDAYS ) |
715 | mSelEndT = NUMDAYS-1; | 715 | mSelEndT = NUMDAYS-1; |
716 | // draw selected days with highlighted background color | 716 | // draw selected days with highlighted background color |
717 | if (mSelStart != NOSELECTION) { | 717 | if (mSelStart != NOSELECTION) { |
718 | bool skip = false; | 718 | bool skip = false; |
719 | if ( ! mouseDown ) { | 719 | if ( ! mouseDown ) { |
720 | int mo = days[20].month(); | 720 | int mo = days[20].month(); |
721 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | 721 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); |
722 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | 722 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); |
723 | int startMo = days[mSelStartT].month(); | 723 | int startMo = days[mSelStartT].month(); |
724 | int endMo = days[mSelEndT].month(); | 724 | int endMo = days[mSelEndT].month(); |
725 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) | 725 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) |
726 | startMo = 1; | 726 | startMo = 1; |
727 | if ( endMo == 1 && mo == 12 ) | 727 | if ( endMo == 1 && mo == 12 ) |
728 | endMo = 12; | 728 | endMo = 12; |
729 | if ( mo == 12 && startMo == 1 ) | 729 | if ( mo == 12 && startMo == 1 ) |
730 | startMo = 13; | 730 | startMo = 13; |
731 | if ( (startMo > mo || endMo < mo) ) { | 731 | if ( (startMo > mo || endMo < mo) ) { |
732 | skip = true; | 732 | skip = true; |
733 | } else { | 733 | } else { |
734 | if ( days[mSelStartT].month() != mo ) { | 734 | if ( days[mSelStartT].month() != mo ) { |
735 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | 735 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); |
736 | mSelStartT += add +1; | 736 | mSelStartT += add +1; |
737 | } | 737 | } |
738 | if ( days[mSelEndT].month() != mo ) { | 738 | if ( days[mSelEndT].month() != mo ) { |
739 | int sub = days[mSelEndT].day(); | 739 | int sub = days[mSelEndT].day(); |
740 | mSelEndT -= sub ; | 740 | mSelEndT -= sub ; |
741 | } | 741 | } |
742 | } | 742 | } |
743 | } | 743 | } |
744 | //qDebug("SKIP %d ", skip); | 744 | //qDebug("SKIP %d ", skip); |
745 | if ( ! skip ) { | 745 | if ( ! skip ) { |
746 | row = mSelStartT/7; | 746 | row = mSelStartT/7; |
747 | col = mSelStartT -row*7; | 747 | col = mSelStartT -row*7; |
748 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 748 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
749 | int addCol = 0; | 749 | int addCol = 0; |
750 | int addRow = 0; | 750 | int addRow = 0; |
751 | int addRow2 = 0; | 751 | int addRow2 = 0; |
752 | int addCol2 = 0; | 752 | int addCol2 = 0; |
753 | if (row == mSelEndT/7) { | 753 | if (row == mSelEndT/7) { |
754 | if ( rowModulo ) { | 754 | if ( rowModulo ) { |
755 | if ( row >= 6 - rowModulo ) | 755 | if ( row >= 6 - rowModulo ) |
756 | addRow = row - 5 + rowModulo; | 756 | addRow = row - 5 + rowModulo; |
757 | } | 757 | } |
758 | if ( colModulo ) { | 758 | if ( colModulo ) { |
759 | int colt1 = mSelEndT%7; | 759 | int colt1 = mSelEndT%7; |
760 | //qDebug("colt1 %d ", colt1 ); | 760 | //qDebug("colt1 %d ", colt1 ); |
761 | if ( colt1 >= 7 - colModulo ) | 761 | if ( colt1 >= 7 - colModulo ) |
762 | addCol = colt1 - 7 + colModulo+1; | 762 | addCol = colt1 - 7 + colModulo+1; |
763 | int colt = mSelStartT%7; | 763 | int colt = mSelStartT%7; |
764 | if ( colt >= 7 - colModulo ) | 764 | if ( colt >= 7 - colModulo ) |
765 | addCol2 = colt - 7 + colModulo; | 765 | addCol2 = colt - 7 + colModulo; |
766 | addCol -= addCol2; | 766 | addCol -= addCol2; |
767 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | 767 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); |
768 | } | 768 | } |
769 | // Single row selection | 769 | // Single row selection |
770 | if ( row == 0) | 770 | //if ( row == 0) |
771 | addRow = 1; | 771 | // addRow = 1; |
772 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, | 772 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
773 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 773 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
774 | } else { | 774 | } else { |
775 | // draw first row to the right | 775 | // draw first row to the right |
776 | if ( colModulo ) { | 776 | if ( colModulo ) { |
777 | if ( col >= 7 - colModulo ) | 777 | if ( col >= 7 - colModulo ) |
778 | addCol2 = col - 7 + colModulo; | 778 | addCol2 = col - 7 + colModulo; |
779 | } | 779 | } |
780 | if ( rowModulo ) { | 780 | if ( rowModulo ) { |
781 | if ( row >= 6 - rowModulo ) | 781 | if ( row >= 6 - rowModulo ) |
782 | addRow = row - 5 + rowModulo; | 782 | addRow = row - 5 + rowModulo; |
783 | } | 783 | } |
784 | if ( row == 0) | 784 | //if ( row == 0) |
785 | addRow = 1; | 785 | // addRow = 1; |
786 | int drawWid = width()-(col*dwidth+1+addCol2)-1; | 786 | int drawWid = width()-(col*dwidth+1+addCol2)-1; |
787 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, | 787 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, |
788 | dheight+1, selcol); | 788 | dheight+1, selcol); |
789 | // draw full block till last line | 789 | // draw full block till last line |
790 | selh = mSelEndT/7-row; | 790 | selh = mSelEndT/7-row; |
791 | addRow = 0; | 791 | addRow = 0; |
792 | if ( rowModulo ) { | 792 | if ( rowModulo ) { |
793 | if ( mSelEndT/7 >= 6 - rowModulo ) | 793 | if ( mSelEndT/7 >= 6 - rowModulo ) |
794 | addRow = mSelEndT/7 - 5 + rowModulo; | 794 | addRow = mSelEndT/7 - 5 + rowModulo; |
795 | } | 795 | } |
796 | //qDebug("%d %d %d ",selh, row, addRow ); | 796 | //qDebug("%d %d %d ",selh, row, addRow ); |
797 | int addrow2 = addRow-selh+1; | 797 | int addrow2 = addRow-selh+1; |
798 | if ( addrow2 < 0 ) | 798 | if ( addrow2 < 0 ) |
799 | addrow2 = 0; | 799 | addrow2 = 0; |
800 | if (selh > 1) { | 800 | if (selh > 1) { |
801 | p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); | 801 | p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); |
802 | } | 802 | } |
803 | // draw last block from left to mSelEndT | 803 | // draw last block from left to mSelEndT |
804 | selw = mSelEndT-7*(mSelEndT/7)+1; | 804 | selw = mSelEndT-7*(mSelEndT/7)+1; |
805 | //qDebug("esl %d ",selw ); | 805 | //qDebug("esl %d ",selw ); |
806 | int add = 0; | 806 | int add = 0; |
807 | if ( colModulo ) { | 807 | if ( colModulo ) { |
808 | add = 7 - colModulo; | 808 | add = 7 - colModulo; |
809 | if ( selw > add ) | 809 | if ( selw > add ) |
810 | add = selw - add; | 810 | add = selw - add; |
811 | else | 811 | else |
812 | add = 0; | 812 | add = 0; |
813 | } | 813 | } |
814 | //qDebug("add %d ", add); | 814 | //qDebug("add %d ", add); |
815 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, | 815 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, |
816 | selw*dwidth+add, dheight+1, selcol); | 816 | selw*dwidth+add, dheight+1, selcol); |
817 | } | 817 | } |
818 | } | 818 | } |
819 | } | 819 | } |
820 | 820 | ||
821 | // iterate over all days in the matrix and draw the day label in appropriate colors | 821 | // iterate over all days in the matrix and draw the day label in appropriate colors |
822 | QColor actcol = mDefaultTextColorShaded; | 822 | QColor actcol = mDefaultTextColorShaded; |
823 | p.setPen(actcol); | 823 | p.setPen(actcol); |
824 | QPen tmppen; | 824 | QPen tmppen; |
825 | for(int i = 0; i < NUMDAYS; i++) { | 825 | for(int i = 0; i < NUMDAYS; i++) { |
826 | row = i/7; | 826 | row = i/7; |
827 | col = isRTL ? 6-(i-row*7) : i-row*7; | 827 | col = isRTL ? 6-(i-row*7) : i-row*7; |
828 | 828 | ||
829 | // if it is the first day of a month switch color from normal to shaded and vice versa | 829 | // if it is the first day of a month switch color from normal to shaded and vice versa |
830 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 830 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
831 | if (actcol == mDefaultTextColorShaded) { | 831 | if (actcol == mDefaultTextColorShaded) { |
832 | actcol = mDefaultTextColor; | 832 | actcol = mDefaultTextColor; |
833 | } else { | 833 | } else { |
834 | actcol = mDefaultTextColorShaded; | 834 | actcol = mDefaultTextColorShaded; |
835 | } | 835 | } |
836 | p.setPen(actcol); | 836 | p.setPen(actcol); |
837 | } | 837 | } |
838 | if (actcol == mDefaultTextColorShaded) { | 838 | if (actcol == mDefaultTextColorShaded) { |
839 | if ( ! mouseDown ) { | 839 | if ( ! mouseDown ) { |
840 | continue; | 840 | continue; |
841 | } | 841 | } |
842 | } | 842 | } |
843 | //Reset pen color after selected days block | 843 | //Reset pen color after selected days block |
844 | if (i == mSelEndT+1) { | 844 | if (i == mSelEndT+1) { |
845 | p.setPen(actcol); | 845 | p.setPen(actcol); |
846 | } | 846 | } |
847 | 847 | ||
848 | // if today then draw rectangle around day | 848 | // if today then draw rectangle around day |
849 | if (today == i) { | 849 | if (today == i) { |
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 253175e..2a30346 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -212,148 +212,144 @@ int KDGanttSplitterHandle::onButton( const QPoint& p ) | |||
212 | } | 212 | } |
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() | 217 | QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() |
218 | { | 218 | { |
219 | QValueList<QPointArray> list; | 219 | QValueList<QPointArray> list; |
220 | 220 | ||
221 | int sw = 8; | 221 | int sw = 8; |
222 | int yyy = 1; | 222 | int yyy = 1; |
223 | int xxx = 1; | 223 | int xxx = 1; |
224 | int voffset[] = { (int) -sw*3, (int) sw*3 }; | 224 | int voffset[] = { (int) -sw*3, (int) sw*3 }; |
225 | for ( int i = 0; i < 2; i++ ) { | 225 | for ( int i = 0; i < 2; i++ ) { |
226 | QPointArray arr; | 226 | QPointArray arr; |
227 | if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || | 227 | if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || |
228 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { | 228 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { |
229 | int mid = height()/2 + voffset[i]; | 229 | int mid = height()/2 + voffset[i]; |
230 | arr.setPoints( 3, | 230 | arr.setPoints( 3, |
231 | 1-xxx, mid - sw + 4, | 231 | 1-xxx, mid - sw + 4, |
232 | sw-3-xxx, mid, | 232 | sw-3-xxx, mid, |
233 | 1-xxx, mid + sw -4); | 233 | 1-xxx, mid + sw -4); |
234 | } | 234 | } |
235 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || | 235 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || |
236 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { | 236 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { |
237 | int mid = height()/2 + voffset[i]; | 237 | int mid = height()/2 + voffset[i]; |
238 | arr.setPoints( 3, | 238 | arr.setPoints( 3, |
239 | sw-4, mid - sw + 4, | 239 | sw-4, mid - sw + 4, |
240 | 0, mid, | 240 | 0, mid, |
241 | sw-4, mid + sw - 4); | 241 | sw-4, mid + sw - 4); |
242 | } | 242 | } |
243 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up || | 243 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up || |
244 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) { | 244 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) { |
245 | int mid = width()/2 + voffset[i]; | 245 | int mid = width()/2 + voffset[i]; |
246 | arr.setPoints( 3, | 246 | arr.setPoints( 3, |
247 | mid - sw + 4, sw-4, | 247 | mid - sw + 4, sw-4, |
248 | mid, 0, | 248 | mid, 0, |
249 | mid + sw - 4, sw-4 ); | 249 | mid + sw - 4, sw-4 ); |
250 | } | 250 | } |
251 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down || | 251 | else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down || |
252 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { | 252 | _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { |
253 | int mid = width()/2 + voffset[i]; | 253 | int mid = width()/2 + voffset[i]; |
254 | arr.setPoints( 3, | 254 | arr.setPoints( 3, |
255 | mid - sw + 4, 1-yyy, | 255 | mid - sw + 4, 1-yyy, |
256 | mid, sw-3-yyy, | 256 | mid, sw-3-yyy, |
257 | mid + sw -4, 1-yyy); | 257 | mid + sw -4, 1-yyy); |
258 | } | 258 | } |
259 | list.append( arr ); | 259 | list.append( arr ); |
260 | } | 260 | } |
261 | return list; | 261 | return list; |
262 | } | 262 | } |
263 | 263 | ||
264 | void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) | 264 | void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) |
265 | { | 265 | { |
266 | QPixmap buffer( size() ); | 266 | QPixmap buffer( size() ); |
267 | QPainter p( &buffer ); | 267 | QPainter p( &buffer ); |
268 | 268 | ||
269 | //LR | 269 | //LR |
270 | // Draw the splitter rectangle | 270 | // Draw the splitter rectangle |
271 | p.setBrush( colorGroup().background() ); | 271 | p.setBrush( colorGroup().background() ); |
272 | p.setPen( colorGroup().foreground() ); | 272 | p.setPen( colorGroup().foreground() ); |
273 | //p.drawRect( rect() ); | 273 | //p.drawRect( rect() ); |
274 | #ifndef DESKTOP_VERSION | 274 | #ifndef DESKTOP_VERSION |
275 | if ( mMouseDown ) | 275 | if ( mMouseDown ) |
276 | buffer.fill( QColor( 242,27,255 ) ); | 276 | buffer.fill( colorGroup().background().dark() ); |
277 | else | 277 | else |
278 | #endif | 278 | #endif |
279 | buffer.fill( colorGroup().background() ); | 279 | buffer.fill( colorGroup().background() ); |
280 | //buffer.fill( backgroundColor() ); | 280 | //buffer.fill( backgroundColor() ); |
281 | // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup()); | 281 | // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup()); |
282 | 282 | ||
283 | int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size | 283 | int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size |
284 | 284 | ||
285 | // arrow color | 285 | // arrow color |
286 | QColor col; | 286 | QColor col; |
287 | if ( _activeButton ) | 287 | if ( _activeButton ) |
288 | col = colorGroup().background().dark( 250 ); | 288 | col = colorGroup().background().dark( 250 ); |
289 | else { | 289 | else { |
290 | if ( mMouseDown ) | 290 | if ( mMouseDown ) |
291 | #ifndef DESKTOP_VERSION | 291 | col = Qt::white; |
292 | col = QColor( 178,18,188);//QColor( 242,27,255 );//Qt::white; | ||
293 | #else | ||
294 | col = Qt::white; | ||
295 | #endif | ||
296 | else | 292 | else |
297 | col = colorGroup().background().dark( 150 ); | 293 | col = colorGroup().background().dark( 150 ); |
298 | } | 294 | } |
299 | //QColor col = backgroundColor().dark( 130 ); | 295 | //QColor col = backgroundColor().dark( 130 ); |
300 | p.setBrush( col ); | 296 | p.setBrush( col ); |
301 | p.setPen( col ); | 297 | p.setPen( col ); |
302 | 298 | ||
303 | QValueList<QPointArray> list = buttonRegions(); | 299 | QValueList<QPointArray> list = buttonRegions(); |
304 | int index = 1; | 300 | int index = 1; |
305 | if ( mUseOffset ) | 301 | if ( mUseOffset ) |
306 | p.translate( 0, 1 ); | 302 | p.translate( 0, 1 ); |
307 | for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { | 303 | for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { |
308 | if ( index == _activeButton ) { | 304 | if ( index == _activeButton ) { |
309 | 305 | ||
310 | /* | 306 | /* |
311 | if ( ! _collapsed ) { | 307 | if ( ! _collapsed ) { |
312 | p.save(); | 308 | p.save(); |
313 | // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), | 309 | // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), |
314 | // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); | 310 | // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); |
315 | p.translate( -1, 0 ); | 311 | p.translate( -1, 0 ); |
316 | p.drawPolygon( *it, true ); | 312 | p.drawPolygon( *it, true ); |
317 | p.restore(); } else | 313 | p.restore(); } else |
318 | */ | 314 | */ |
319 | p.drawPolygon( *it, true ); | 315 | p.drawPolygon( *it, true ); |
320 | 316 | ||
321 | } | 317 | } |
322 | else { | 318 | else { |
323 | /* | 319 | /* |
324 | if ( ! _collapsed ) { | 320 | if ( ! _collapsed ) { |
325 | p.save(); | 321 | p.save(); |
326 | p.translate( -1, 0 ); | 322 | p.translate( -1, 0 ); |
327 | p.drawPolygon( *it, true ); | 323 | p.drawPolygon( *it, true ); |
328 | p.restore(); | 324 | p.restore(); |
329 | } else | 325 | } else |
330 | */ | 326 | */ |
331 | p.drawPolygon( *it, true ); | 327 | p.drawPolygon( *it, true ); |
332 | 328 | ||
333 | } | 329 | } |
334 | index++; | 330 | index++; |
335 | } | 331 | } |
336 | 332 | ||
337 | // Draw the lines between the arrows | 333 | // Draw the lines between the arrows |
338 | if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left || | 334 | if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left || |
339 | s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { | 335 | s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { |
340 | int mid = height()/2; | 336 | int mid = height()/2; |
341 | p.drawLine ( 1, mid - sw, 1, mid + sw ); | 337 | p.drawLine ( 1, mid - sw, 1, mid + sw ); |
342 | p.drawLine ( 3, mid - sw, 3, mid + sw ); | 338 | p.drawLine ( 3, mid - sw, 3, mid + sw ); |
343 | } | 339 | } |
344 | else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up || | 340 | else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up || |
345 | s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) { | 341 | s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) { |
346 | int mid = width()/2; | 342 | int mid = width()/2; |
347 | p.drawLine( mid -sw, 1, mid +sw, 1 ); | 343 | p.drawLine( mid -sw, 1, mid +sw, 1 ); |
348 | p.drawLine( mid -sw, 3, mid +sw, 3 ); | 344 | p.drawLine( mid -sw, 3, mid +sw, 3 ); |
349 | } | 345 | } |
350 | bitBlt( this, 0, 0, &buffer ); | 346 | bitBlt( this, 0, 0, &buffer ); |
351 | 347 | ||
352 | } | 348 | } |
353 | #endif | 349 | #endif |
354 | 350 | ||
355 | class QSplitterLayoutStruct | 351 | class QSplitterLayoutStruct |
356 | { | 352 | { |
357 | public: | 353 | public: |
358 | KDGanttMinimizeSplitter::ResizeMode mode; | 354 | KDGanttMinimizeSplitter::ResizeMode mode; |
359 | QCOORD sizer; | 355 | QCOORD sizer; |
@@ -627,129 +623,129 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
627 | recalc( isVisible() ); | 623 | recalc( isVisible() ); |
628 | 624 | ||
629 | } else if ( c->type() == QEvent::ChildRemoved ) { | 625 | } else if ( c->type() == QEvent::ChildRemoved ) { |
630 | QSplitterLayoutStruct *p = 0; | 626 | QSplitterLayoutStruct *p = 0; |
631 | if ( data->list.count() > 1 ) | 627 | if ( data->list.count() > 1 ) |
632 | p = data->list.at(1); //remove handle _after_ first widget. | 628 | p = data->list.at(1); //remove handle _after_ first widget. |
633 | QSplitterLayoutStruct *s = data->list.first(); | 629 | QSplitterLayoutStruct *s = data->list.first(); |
634 | while ( s ) { | 630 | while ( s ) { |
635 | if ( s->wid == c->child() ) { | 631 | if ( s->wid == c->child() ) { |
636 | data->list.removeRef( s ); | 632 | data->list.removeRef( s ); |
637 | delete s; | 633 | delete s; |
638 | if ( p && p->isSplitter ) { | 634 | if ( p && p->isSplitter ) { |
639 | data->list.removeRef( p ); | 635 | data->list.removeRef( p ); |
640 | delete p->wid; //will call childEvent | 636 | delete p->wid; //will call childEvent |
641 | delete p; | 637 | delete p; |
642 | } | 638 | } |
643 | recalcId(); | 639 | recalcId(); |
644 | doResize(); | 640 | doResize(); |
645 | return; | 641 | return; |
646 | } | 642 | } |
647 | p = s; | 643 | p = s; |
648 | s = data->list.next(); | 644 | s = data->list.next(); |
649 | } | 645 | } |
650 | } | 646 | } |
651 | } | 647 | } |
652 | 648 | ||
653 | 649 | ||
654 | /*! | 650 | /*! |
655 | Shows a rubber band at position \a p. If \a p is negative, the | 651 | Shows a rubber band at position \a p. If \a p is negative, the |
656 | rubber band is removed. | 652 | rubber band is removed. |
657 | */ | 653 | */ |
658 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 654 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
659 | { | 655 | { |
660 | #ifdef DESKTOP_VERSION | 656 | #ifdef DESKTOP_VERSION |
661 | QPainter paint( this ); | 657 | QPainter paint( this ); |
662 | paint.setPen( gray ); | 658 | paint.setPen( gray ); |
663 | paint.setBrush( gray ); | 659 | paint.setBrush( gray ); |
664 | paint.setRasterOp( XorROP ); | 660 | paint.setRasterOp( XorROP ); |
665 | QRect r = contentsRect(); | 661 | QRect r = contentsRect(); |
666 | const int rBord = 3; //Themable???? | 662 | const int rBord = 3; //Themable???? |
667 | #if QT_VERSION >= 0x030000 | 663 | #if QT_VERSION >= 0x030000 |
668 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 664 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
669 | #else | 665 | #else |
670 | int sw = style().splitterWidth(); | 666 | int sw = style().splitterWidth(); |
671 | #endif | 667 | #endif |
672 | if ( orient == Horizontal ) { | 668 | if ( orient == Horizontal ) { |
673 | if ( opaqueOldPos >= 0 ) | 669 | if ( opaqueOldPos >= 0 ) |
674 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 670 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
675 | 2*rBord, r.height() ); | 671 | 2*rBord, r.height() ); |
676 | if ( p >= 0 ) | 672 | if ( p >= 0 ) |
677 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 673 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
678 | } else { | 674 | } else { |
679 | if ( opaqueOldPos >= 0 ) | 675 | if ( opaqueOldPos >= 0 ) |
680 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 676 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
681 | r.width(), 2*rBord ); | 677 | r.width(), 2*rBord ); |
682 | if ( p >= 0 ) | 678 | if ( p >= 0 ) |
683 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 679 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
684 | } | 680 | } |
685 | opaqueOldPos = p; | 681 | opaqueOldPos = p; |
686 | #else | 682 | #else |
687 | if ( !mRubberBand ) { | 683 | if ( !mRubberBand ) { |
688 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | 684 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); |
689 | mRubberBand->setFrameStyle( Box | Raised ); | 685 | mRubberBand->setFrameStyle( Box | Raised ); |
690 | //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); | 686 | //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); |
691 | mRubberBand->setPalette( QPalette ( QColor( 178,18,188), QColor( 242,27,255 ) )); | 687 | mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); |
692 | } | 688 | } |
693 | QRect r = contentsRect(); | 689 | QRect r = contentsRect(); |
694 | static int rBord = 0; //Themable???? | 690 | static int rBord = 0; //Themable???? |
695 | if ( !rBord ) { | 691 | if ( !rBord ) { |
696 | if (QApplication::desktop()->width() <= 320 ) | 692 | if (QApplication::desktop()->width() <= 320 ) |
697 | rBord = 3; | 693 | rBord = 3; |
698 | else | 694 | else |
699 | rBord = 4; | 695 | rBord = 4; |
700 | } | 696 | } |
701 | int sw = style().splitterWidth(); | 697 | int sw = style().splitterWidth(); |
702 | if ( orient == Horizontal ) { | 698 | if ( orient == Horizontal ) { |
703 | if ( p >= 0 ) { | 699 | if ( p >= 0 ) { |
704 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | 700 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); |
705 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | 701 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); |
706 | } | 702 | } |
707 | } else { | 703 | } else { |
708 | if ( p >= 0 ) { | 704 | if ( p >= 0 ) { |
709 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | 705 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); |
710 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | 706 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); |
711 | } | 707 | } |
712 | } | 708 | } |
713 | opaqueOldPos = p; | 709 | opaqueOldPos = p; |
714 | if ( ! mRubberBand->isVisible() ) { | 710 | if ( ! mRubberBand->isVisible() ) { |
715 | mRubberBand->show(); | 711 | mRubberBand->show(); |
716 | } | 712 | } |
717 | #endif | 713 | #endif |
718 | } | 714 | } |
719 | 715 | ||
720 | 716 | ||
721 | /*! \reimp */ | 717 | /*! \reimp */ |
722 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 718 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
723 | { | 719 | { |
724 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 720 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { |
725 | recalc( isVisible() ); | 721 | recalc( isVisible() ); |
726 | if ( e->type() == QEvent::Show ) | 722 | if ( e->type() == QEvent::Show ) |
727 | data->firstShow = FALSE; | 723 | data->firstShow = FALSE; |
728 | } | 724 | } |
729 | return QWidget::event( e ); | 725 | return QWidget::event( e ); |
730 | } | 726 | } |
731 | 727 | ||
732 | 728 | ||
733 | /*! | 729 | /*! |
734 | \obsolete | 730 | \obsolete |
735 | 731 | ||
736 | Draws the splitter handle in the rectangle described by \a x, \a y, | 732 | Draws the splitter handle in the rectangle described by \a x, \a y, |
737 | \a w, \a h using painter \a p. | 733 | \a w, \a h using painter \a p. |
738 | \sa QStyle::drawPrimitive() | 734 | \sa QStyle::drawPrimitive() |
739 | */ | 735 | */ |
740 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 736 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
741 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 737 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
742 | { | 738 | { |
743 | #if 0 | 739 | #if 0 |
744 | // LR | 740 | // LR |
745 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 741 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
746 | (orientation() == Qt::Horizontal ? | 742 | (orientation() == Qt::Horizontal ? |
747 | QStyle::Style_Horizontal : 0)); | 743 | QStyle::Style_Horizontal : 0)); |
748 | #endif | 744 | #endif |
749 | } | 745 | } |
750 | 746 | ||
751 | 747 | ||
752 | /*! | 748 | /*! |
753 | Returns the id of the splitter to the right of or below the widget \a w, | 749 | Returns the id of the splitter to the right of or below the widget \a w, |
754 | or 0 if there is no such splitter | 750 | or 0 if there is no such splitter |
755 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). | 751 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). |
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index e6144de..11635e1 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -75,145 +75,145 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
75 | mUser2Button = 0; | 75 | mUser2Button = 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | if ( buttonMask & Ok ) { | 78 | if ( buttonMask & Ok ) { |
79 | mOkButton = new QPushButton( i18n("Ok"), this ); | 79 | mOkButton = new QPushButton( i18n("Ok"), this ); |
80 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); | 80 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); |
81 | //mOkButton->setDefault( true ); | 81 | //mOkButton->setDefault( true ); |
82 | } else { | 82 | } else { |
83 | mOkButton = 0; | 83 | mOkButton = 0; |
84 | } | 84 | } |
85 | if ( buttonMask & Default ) { | 85 | if ( buttonMask & Default ) { |
86 | mDefaultButton = new QPushButton( i18n("Default"), this ); | 86 | mDefaultButton = new QPushButton( i18n("Default"), this ); |
87 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | 87 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); |
88 | } else { | 88 | } else { |
89 | mDefaultButton = 0; | 89 | mDefaultButton = 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( buttonMask & Apply ) { | 92 | if ( buttonMask & Apply ) { |
93 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 93 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
94 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 94 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
95 | } else { | 95 | } else { |
96 | mApplyButton = 0; | 96 | mApplyButton = 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | if ( buttonMask & Cancel ) { | 99 | if ( buttonMask & Cancel ) { |
100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
102 | } else { | 102 | } else { |
103 | mCancelButton = 0; | 103 | mCancelButton = 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | if ( buttonMask & Close ) { | 106 | if ( buttonMask & Close ) { |
107 | mCloseButton = new QPushButton( i18n("Close"), this ); | 107 | mCloseButton = new QPushButton( i18n("Close"), this ); |
108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
109 | } else { | 109 | } else { |
110 | mCloseButton = 0; | 110 | mCloseButton = 0; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | QTabWidget *KDialogBase::tabWidget() | 114 | QTabWidget *KDialogBase::tabWidget() |
115 | { | 115 | { |
116 | if ( !mTabWidget ) { | 116 | if ( !mTabWidget ) { |
117 | mTabWidget = new QTabWidget( this ); | 117 | mTabWidget = new QTabWidget( this ); |
118 | setMainWidget( mTabWidget ); | 118 | setMainWidget( mTabWidget ); |
119 | } | 119 | } |
120 | return mTabWidget; | 120 | return mTabWidget; |
121 | } | 121 | } |
122 | 122 | ||
123 | void KDialogBase::hideButtons() | 123 | void KDialogBase::hideButtons() |
124 | { | 124 | { |
125 | if ( mUser1Button ) mUser1Button->hide() ; | 125 | if ( mUser1Button ) mUser1Button->hide() ; |
126 | if ( mUser2Button ) mUser2Button->hide() ; | 126 | if ( mUser2Button ) mUser2Button->hide() ; |
127 | if ( mOkButton ) mOkButton->hide() ; | 127 | if ( mOkButton ) mOkButton->hide() ; |
128 | if ( mApplyButton ) mApplyButton->hide() ; | 128 | if ( mApplyButton ) mApplyButton->hide() ; |
129 | if ( mDefaultButton ) mDefaultButton->hide(); | 129 | if ( mDefaultButton ) mDefaultButton->hide(); |
130 | if ( mCancelButton ) mCancelButton->hide() ; | 130 | if ( mCancelButton ) mCancelButton->hide() ; |
131 | if ( mCloseButton ) mCloseButton->hide() ; | 131 | if ( mCloseButton ) mCloseButton->hide() ; |
132 | 132 | ||
133 | } | 133 | } |
134 | void KDialogBase::initLayout() | 134 | void KDialogBase::initLayout() |
135 | { | 135 | { |
136 | 136 | ||
137 | delete mTopLayout; | 137 | delete mTopLayout; |
138 | mTopLayout = new QVBoxLayout( this ); | 138 | mTopLayout = new QVBoxLayout( this ); |
139 | mTopLayout->setMargin( marginHint() ); | 139 | mTopLayout->setMargin( marginHintSmall() ); |
140 | mTopLayout->setSpacing( spacingHint() ); | 140 | mTopLayout->setSpacing( spacingHintSmall() ); |
141 | 141 | ||
142 | mTopLayout->addWidget( mMainWidget ); | 142 | mTopLayout->addWidget( mMainWidget ); |
143 | 143 | ||
144 | QBoxLayout *buttonLayout = new QHBoxLayout; | 144 | QBoxLayout *buttonLayout = new QHBoxLayout; |
145 | mTopLayout->addLayout( buttonLayout ); | 145 | mTopLayout->addLayout( buttonLayout ); |
146 | 146 | ||
147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
154 | buttonLayout->setMargin( 0 ); | 154 | buttonLayout->setMargin( marginHintSmall() ); |
155 | buttonLayout->setSpacing( spacingHint() ); | 155 | buttonLayout->setSpacing( spacingHintSmall() ); |
156 | } | 156 | } |
157 | 157 | ||
158 | QFrame *KDialogBase::addPage( const QString &name ) | 158 | QFrame *KDialogBase::addPage( const QString &name ) |
159 | { | 159 | { |
160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
161 | QFrame *frame = new QFrame( tabWidget() ); | 161 | QFrame *frame = new QFrame( tabWidget() ); |
162 | tabWidget()->addTab( frame, name ); | 162 | tabWidget()->addTab( frame, name ); |
163 | return frame; | 163 | return frame; |
164 | } | 164 | } |
165 | 165 | ||
166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
167 | { | 167 | { |
168 | return addPage( name ); | 168 | return addPage( name ); |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | void KDialogBase::setMainWidget( QWidget *widget ) | 172 | void KDialogBase::setMainWidget( QWidget *widget ) |
173 | { | 173 | { |
174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
175 | 175 | ||
176 | mMainWidget = widget; | 176 | mMainWidget = widget; |
177 | initLayout(); | 177 | initLayout(); |
178 | } | 178 | } |
179 | 179 | ||
180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
181 | { | 181 | { |
182 | QPushButton *button = findButton( id ); | 182 | QPushButton *button = findButton( id ); |
183 | if ( button ) { | 183 | if ( button ) { |
184 | button->setText( text ); | 184 | button->setText( text ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 188 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
189 | { | 189 | { |
190 | QPushButton *button = findButton( id ); | 190 | QPushButton *button = findButton( id ); |
191 | if ( button ) { | 191 | if ( button ) { |
192 | button->setEnabled( state ); | 192 | button->setEnabled( state ); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 196 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
197 | { | 197 | { |
198 | QPushButton *button = 0; | 198 | QPushButton *button = 0; |
199 | switch ( id ) { | 199 | switch ( id ) { |
200 | case Ok: | 200 | case Ok: |
201 | button = mOkButton; | 201 | button = mOkButton; |
202 | break; | 202 | break; |
203 | case Apply: | 203 | case Apply: |
204 | button = mApplyButton; | 204 | button = mApplyButton; |
205 | break; | 205 | break; |
206 | case User1: | 206 | case User1: |
207 | button = mUser1Button; | 207 | button = mUser1Button; |
208 | break; | 208 | break; |
209 | case User2: | 209 | case User2: |
210 | button = mUser2Button; | 210 | button = mUser2Button; |
211 | break; | 211 | break; |
212 | case Cancel: | 212 | case Cancel: |
213 | button = mCancelButton; | 213 | button = mCancelButton; |
214 | break; | 214 | break; |
215 | case Default: | 215 | case Default: |
216 | button = mDefaultButton; | 216 | button = mDefaultButton; |
217 | break; | 217 | break; |
218 | case Close: | 218 | case Close: |
219 | button = mCloseButton; | 219 | button = mCloseButton; |