-rw-r--r-- | korganizer/komonthview.cpp | 7 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 02d2585..da81586 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -872,109 +872,116 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
872 | //label->setAlignment(AlignCenter); | 872 | //label->setAlignment(AlignCenter); |
873 | mWeekLabelsW.insert( i, label ); | 873 | mWeekLabelsW.insert( i, label ); |
874 | } | 874 | } |
875 | mWeekLabelsW[1]->setText( i18n("W")); | 875 | mWeekLabelsW[1]->setText( i18n("W")); |
876 | 876 | ||
877 | 877 | ||
878 | int row, col; | 878 | int row, col; |
879 | mCells.resize( mNumCells ); | 879 | mCells.resize( mNumCells ); |
880 | for( row = 0; row < mNumWeeks; ++row ) { | 880 | for( row = 0; row < mNumWeeks; ++row ) { |
881 | for( col = 0; col < mDaysPerWeek; ++col ) { | 881 | for( col = 0; col < mDaysPerWeek; ++col ) { |
882 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 882 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
883 | mCells.insert( row * mDaysPerWeek + col, cell ); | 883 | mCells.insert( row * mDaysPerWeek + col, cell ); |
884 | 884 | ||
885 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 885 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
886 | SLOT( defaultAction( Incidence * ) ) ); | 886 | SLOT( defaultAction( Incidence * ) ) ); |
887 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 887 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
888 | SIGNAL( newEventSignal( QDateTime ) ) ); | 888 | SIGNAL( newEventSignal( QDateTime ) ) ); |
889 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 889 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
890 | SIGNAL( showDaySignal( QDate ) ) ); | 890 | SIGNAL( showDaySignal( QDate ) ) ); |
891 | } | 891 | } |
892 | } | 892 | } |
893 | mCellsW.resize( mDaysPerWeek ); | 893 | mCellsW.resize( mDaysPerWeek ); |
894 | for( col = 0; col < mDaysPerWeek; ++col ) { | 894 | for( col = 0; col < mDaysPerWeek; ++col ) { |
895 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 895 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
896 | mCellsW.insert( col, cell ); | 896 | mCellsW.insert( col, cell ); |
897 | 897 | ||
898 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 898 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
899 | SLOT( defaultAction( Incidence * ) ) ); | 899 | SLOT( defaultAction( Incidence * ) ) ); |
900 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 900 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
901 | SIGNAL( newEventSignal( QDateTime ) ) ); | 901 | SIGNAL( newEventSignal( QDateTime ) ) ); |
902 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 902 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
903 | SIGNAL( showDaySignal( QDate ) ) ); | 903 | SIGNAL( showDaySignal( QDate ) ) ); |
904 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 904 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
905 | } | 905 | } |
906 | 906 | ||
907 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 907 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
908 | mContextMenu = eventPopup(); | 908 | mContextMenu = eventPopup(); |
909 | // updateConfig(); //useless here... | 909 | // updateConfig(); //useless here... |
910 | // ... but we need mWidthLongDayLabel computed | 910 | // ... but we need mWidthLongDayLabel computed |
911 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 911 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
912 | mWidthLongDayLabel = 0; | 912 | mWidthLongDayLabel = 0; |
913 | for (int i = 0; i < 7; i++) { | 913 | for (int i = 0; i < 7; i++) { |
914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
916 | } | 916 | } |
917 | 917 | ||
918 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 918 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
919 | 919 | ||
920 | #if 0 | ||
920 | if ( mShowWeekView ) | 921 | if ( mShowWeekView ) |
921 | mWidStack->raiseWidget( mWeekView ); | 922 | mWidStack->raiseWidget( mWeekView ); |
922 | else | 923 | else |
923 | mWidStack->raiseWidget( mMonthView ); | 924 | mWidStack->raiseWidget( mMonthView ); |
925 | #endif | ||
924 | 926 | ||
925 | emit incidenceSelected( 0 ); | 927 | emit incidenceSelected( 0 ); |
926 | #ifndef DESKTOP_VERSION | 928 | #ifndef DESKTOP_VERSION |
927 | resize( QApplication::desktop()->size() ); | 929 | resize( QApplication::desktop()->size() ); |
928 | #else | 930 | #else |
929 | resize(640, 480 ); | 931 | resize(640, 480 ); |
932 | updatePossible = true; | ||
930 | #endif | 933 | #endif |
931 | computeLayout(); | 934 | computeLayout(); |
932 | 935 | ||
936 | if ( mShowWeekView ) | ||
937 | mWidStack->raiseWidget( mWeekView ); | ||
938 | else | ||
939 | mWidStack->raiseWidget( mMonthView ); | ||
933 | } | 940 | } |
934 | 941 | ||
935 | KOMonthView::~KOMonthView() | 942 | KOMonthView::~KOMonthView() |
936 | { | 943 | { |
937 | delete mContextMenu; | 944 | delete mContextMenu; |
938 | } | 945 | } |
939 | 946 | ||
940 | void KOMonthView::selectInternalWeekNum ( int n ) | 947 | void KOMonthView::selectInternalWeekNum ( int n ) |
941 | { | 948 | { |
942 | switchView(); | 949 | switchView(); |
943 | emit selectWeekNum ( n ); | 950 | emit selectWeekNum ( n ); |
944 | } | 951 | } |
945 | 952 | ||
946 | int KOMonthView::currentWeek() | 953 | int KOMonthView::currentWeek() |
947 | { | 954 | { |
948 | if ( mShowWeekView ) | 955 | if ( mShowWeekView ) |
949 | return mWeekLabelsW[0]->getWeekNum(); | 956 | return mWeekLabelsW[0]->getWeekNum(); |
950 | return mWeekLabels[0]->getWeekNum(); | 957 | return mWeekLabels[0]->getWeekNum(); |
951 | } | 958 | } |
952 | void KOMonthView::switchView() | 959 | void KOMonthView::switchView() |
953 | { | 960 | { |
954 | 961 | ||
955 | if ( selectedCell( ) ) | 962 | if ( selectedCell( ) ) |
956 | selectedCell()->deselect(); | 963 | selectedCell()->deselect(); |
957 | mShowWeekView = !mShowWeekView; | 964 | mShowWeekView = !mShowWeekView; |
958 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 965 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
959 | if ( clPending ) { | 966 | if ( clPending ) { |
960 | computeLayout(); | 967 | computeLayout(); |
961 | updateConfig(); | 968 | updateConfig(); |
962 | } | 969 | } |
963 | if ( mShowWeekView ) | 970 | if ( mShowWeekView ) |
964 | mWidStack->raiseWidget( mWeekView ); | 971 | mWidStack->raiseWidget( mWeekView ); |
965 | else | 972 | else |
966 | mWidStack->raiseWidget( mMonthView ); | 973 | mWidStack->raiseWidget( mMonthView ); |
967 | clPending = false; | 974 | clPending = false; |
968 | } | 975 | } |
969 | 976 | ||
970 | int KOMonthView::maxDatesHint() | 977 | int KOMonthView::maxDatesHint() |
971 | { | 978 | { |
972 | return mNumCells; | 979 | return mNumCells; |
973 | } | 980 | } |
974 | 981 | ||
975 | int KOMonthView::currentDateCount() | 982 | int KOMonthView::currentDateCount() |
976 | { | 983 | { |
977 | return mNumCells; | 984 | return mNumCells; |
978 | } | 985 | } |
979 | 986 | ||
980 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 987 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 78d4027..44db209 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -221,207 +221,204 @@ void KOTodoViewItem::stateChange(bool state) | |||
221 | if (mTodo->hasDueDate()) { | 221 | if (mTodo->hasDueDate()) { |
222 | setText(3, mTodo->dtDueDateStr()); | 222 | setText(3, mTodo->dtDueDateStr()); |
223 | QDate d = mTodo->dtDue().date(); | 223 | QDate d = mTodo->dtDue().date(); |
224 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 224 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
225 | setSortKey(3,keyd); | 225 | setSortKey(3,keyd); |
226 | if (mTodo->doesFloat()) { | 226 | if (mTodo->doesFloat()) { |
227 | setText(4,""); | 227 | setText(4,""); |
228 | } | 228 | } |
229 | else { | 229 | else { |
230 | setText(4,mTodo->dtDueTimeStr()); | 230 | setText(4,mTodo->dtDueTimeStr()); |
231 | QTime t = mTodo->dtDue().time(); | 231 | QTime t = mTodo->dtDue().time(); |
232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
233 | setSortKey(4,keyt); | 233 | setSortKey(4,keyt); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
238 | 238 | ||
239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
240 | if (mTodo->percentComplete()<100) { | 240 | if (mTodo->percentComplete()<100) { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 242 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
243 | } | 243 | } |
244 | else { | 244 | else { |
245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
246 | else setSortKey(2,QString::number(99)); | 246 | else setSortKey(2,QString::number(99)); |
247 | } | 247 | } |
248 | if ( state ) { | 248 | if ( state ) { |
249 | QListViewItem * myChild = firstChild(); | 249 | QListViewItem * myChild = firstChild(); |
250 | KOTodoViewItem *item; | 250 | KOTodoViewItem *item; |
251 | while( myChild ) { | 251 | while( myChild ) { |
252 | //qDebug("stateCH "); | 252 | //qDebug("stateCH "); |
253 | item = static_cast<KOTodoViewItem*>(myChild); | 253 | item = static_cast<KOTodoViewItem*>(myChild); |
254 | item->stateChange(state); | 254 | item->stateChange(state); |
255 | myChild = myChild->nextSibling(); | 255 | myChild = myChild->nextSibling(); |
256 | } | 256 | } |
257 | } else { | 257 | } else { |
258 | QListViewItem * myChild = parent(); | 258 | QListViewItem * myChild = parent(); |
259 | if ( myChild ) | 259 | if ( myChild ) |
260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
261 | } | 261 | } |
262 | mTodoView->modified(true); | 262 | mTodoView->modified(true); |
263 | setMyPixmap(); | 263 | setMyPixmap(); |
264 | mTodoView->setTodoModified( mTodo ); | 264 | mTodoView->setTodoModified( mTodo ); |
265 | } | 265 | } |
266 | 266 | ||
267 | bool KOTodoViewItem::isAlternate() | 267 | bool KOTodoViewItem::isAlternate() |
268 | { | 268 | { |
269 | #ifndef KORG_NOLVALTERNATION | 269 | |
270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
271 | if (lv && lv->alternateBackground().isValid()) | 271 | if (lv && lv->alternateBackground().isValid()) |
272 | { | 272 | { |
273 | KOTodoViewItem *above = 0; | 273 | KOTodoViewItem *above = 0; |
274 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 274 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); |
275 | m_known = above ? above->m_known : true; | 275 | m_known = above ? above->m_known : true; |
276 | if (m_known) | 276 | if (m_known) |
277 | { | 277 | { |
278 | m_odd = above ? !above->m_odd : false; | 278 | m_odd = above ? !above->m_odd : false; |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | KOTodoViewItem *item; | 282 | KOTodoViewItem *item; |
283 | bool previous = true; | 283 | bool previous = true; |
284 | if (QListViewItem::parent()) | 284 | if (QListViewItem::parent()) |
285 | { | 285 | { |
286 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); | 286 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); |
287 | if (item) | 287 | if (item) |
288 | previous = item->m_odd; | 288 | previous = item->m_odd; |
289 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 289 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
290 | } | 290 | } |
291 | else | 291 | else |
292 | { | 292 | { |
293 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); | 293 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); |
294 | } | 294 | } |
295 | 295 | ||
296 | while(item) | 296 | while(item) |
297 | { | 297 | { |
298 | item->m_odd = previous = !previous; | 298 | item->m_odd = previous = !previous; |
299 | item->m_known = true; | 299 | item->m_known = true; |
300 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); | 300 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | return m_odd; | 303 | return m_odd; |
304 | } | 304 | } |
305 | return false; | 305 | return false; |
306 | #else | ||
307 | return false; | ||
308 | #endif | ||
309 | } | 306 | } |
310 | 307 | ||
311 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 308 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
312 | { | 309 | { |
313 | QColorGroup _cg = cg; | 310 | QColorGroup _cg = cg; |
314 | QColorGroup::ColorRole role; | 311 | QColorGroup::ColorRole role; |
315 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 312 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
316 | role = QColorGroup::Text; | 313 | role = QColorGroup::Text; |
317 | else | 314 | else |
318 | role = QColorGroup::Base; | 315 | role = QColorGroup::Base; |
319 | //#ifndef KORG_NOLVALTERNATION | 316 | //#ifndef KORG_NOLVALTERNATION |
320 | // if (isAlternate()) | 317 | if (isAlternate()) |
321 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 318 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
322 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 319 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
323 | QColor colorToSet; | 320 | QColor colorToSet; |
324 | if ( setColor ) { | 321 | if ( setColor ) { |
325 | QStringList categories = mTodo->categories(); | 322 | QStringList categories = mTodo->categories(); |
326 | QString cat = categories.first(); | 323 | QString cat = categories.first(); |
327 | if ( !cat.isEmpty()) { | 324 | if ( !cat.isEmpty()) { |
328 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 325 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
329 | } else | 326 | } else |
330 | setColor = false; | 327 | setColor = false; |
331 | } | 328 | } |
332 | 329 | ||
333 | int odue = mTodo->hasDueSubTodo( !isOpen()); | 330 | int odue = mTodo->hasDueSubTodo( !isOpen()); |
334 | if (odue == 2) { | 331 | if (odue == 2) { |
335 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 332 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
336 | setColor = true; | 333 | setColor = true; |
337 | } else if ( odue == 1 ) { | 334 | } else if ( odue == 1 ) { |
338 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 335 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
339 | setColor = true; | 336 | setColor = true; |
340 | } | 337 | } |
341 | 338 | ||
342 | 339 | ||
343 | if ( setColor ) { | 340 | if ( setColor ) { |
344 | _cg.setColor(role,colorToSet ); | 341 | _cg.setColor(role,colorToSet ); |
345 | if ( role == QColorGroup::Base) { | 342 | if ( role == QColorGroup::Base) { |
346 | int rgb = colorToSet.red(); | 343 | int rgb = colorToSet.red(); |
347 | rgb += colorToSet.blue()/2; | 344 | rgb += colorToSet.blue()/2; |
348 | rgb += colorToSet.green(); | 345 | rgb += colorToSet.green(); |
349 | if ( rgb < 200 ) | 346 | if ( rgb < 200 ) |
350 | _cg.setColor(QColorGroup::Text,Qt::white ); | 347 | _cg.setColor(QColorGroup::Text,Qt::white ); |
351 | } | 348 | } |
352 | } | 349 | } |
353 | //#endif | 350 | //#endif |
354 | if ( column > 0 ){ | 351 | if ( column > 0 ){ |
355 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 352 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
356 | p->save(); | 353 | p->save(); |
357 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 354 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
358 | 355 | ||
359 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 356 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
360 | // p->setPen(Qt::black ); //border | 357 | // p->setPen(Qt::black ); //border |
361 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 358 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
362 | QColor fc = KOPrefs::instance()->mHighlightColor; | 359 | QColor fc = KOPrefs::instance()->mHighlightColor; |
363 | if ( mTodo->percentComplete() == 100 ) | 360 | if ( mTodo->percentComplete() == 100 ) |
364 | fc = darkGreen; | 361 | fc = darkGreen; |
365 | p->drawRect( 2, 2, width-4, height()-4); | 362 | p->drawRect( 2, 2, width-4, height()-4); |
366 | p->fillRect( 3, 3, progress, height()-6, | 363 | p->fillRect( 3, 3, progress, height()-6, |
367 | fc ); | 364 | fc ); |
368 | p->restore(); | 365 | p->restore(); |
369 | } else { | 366 | } else { |
370 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 367 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
371 | } | 368 | } |
372 | return; | 369 | return; |
373 | } | 370 | } |
374 | 371 | ||
375 | int align = alignment; | 372 | int align = alignment; |
376 | 373 | ||
377 | if ( !p ) | 374 | if ( !p ) |
378 | return; | 375 | return; |
379 | 376 | ||
380 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 377 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
381 | 378 | ||
382 | QListView *lv = listView(); | 379 | QListView *lv = listView(); |
383 | if ( !lv ) | 380 | if ( !lv ) |
384 | return; | 381 | return; |
385 | int marg = 2;//lv->itemMargin(); | 382 | int marg = 2;//lv->itemMargin(); |
386 | int r = 0; | 383 | int r = 0; |
387 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 384 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
388 | int BoxSize = 20; | 385 | int BoxSize = 20; |
389 | int boxOffset = 2; | 386 | int boxOffset = 2; |
390 | int xOffset = 2; | 387 | int xOffset = 2; |
391 | if (qApp->desktop()->width() < 300 ) { | 388 | if (qApp->desktop()->width() < 300 ) { |
392 | BoxSize = 14; | 389 | BoxSize = 14; |
393 | boxOffset = -1; | 390 | boxOffset = -1; |
394 | xOffset = 1; | 391 | xOffset = 1; |
395 | // marg = 0; | 392 | // marg = 0; |
396 | } | 393 | } |
397 | if ( height() < BoxSize ) { | 394 | if ( height() < BoxSize ) { |
398 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 395 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
399 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 396 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
400 | BoxSize = height(); | 397 | BoxSize = height(); |
401 | 398 | ||
402 | } | 399 | } |
403 | //bool winStyle = lv->style() == WindowsStyle; | 400 | //bool winStyle = lv->style() == WindowsStyle; |
404 | 401 | ||
405 | int lineStart = 5; | 402 | int lineStart = 5; |
406 | if ( myType == Controller ) { | 403 | if ( myType == Controller ) { |
407 | if ( !pixmap( 0 ) ) | 404 | if ( !pixmap( 0 ) ) |
408 | r += BoxSize + 4; | 405 | r += BoxSize + 4; |
409 | } else { | 406 | } else { |
410 | ASSERT( lv ); //### | 407 | ASSERT( lv ); //### |
411 | //QFontMetrics fm( lv->font() ); | 408 | //QFontMetrics fm( lv->font() ); |
412 | //int d = fm.height(); | 409 | //int d = fm.height(); |
413 | int x = 0; | 410 | int x = 0; |
414 | int y = (height() - BoxSize) / 2; | 411 | int y = (height() - BoxSize) / 2; |
415 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 412 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
416 | if ( myType == CheckBox ) { | 413 | if ( myType == CheckBox ) { |
417 | if ( isEnabled() ) | 414 | if ( isEnabled() ) |
418 | p->setPen( QPen( _cg.text(), 1 ) ); | 415 | p->setPen( QPen( _cg.text(), 1 ) ); |
419 | else | 416 | else |
420 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 417 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
421 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 418 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
422 | lineStart = x+marg; | 419 | lineStart = x+marg; |
423 | ///////////////////// | 420 | ///////////////////// |
424 | x++; | 421 | x++; |
425 | y++; | 422 | y++; |
426 | if ( isOn() ) { | 423 | if ( isOn() ) { |
427 | QPointArray a( 7*2 ); | 424 | QPointArray a( 7*2 ); |