summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-07 10:32:40 (UTC)
committer zautrix <zautrix>2005-02-07 10:32:40 (UTC)
commitafc19166fcdc09d3d5b757a84abfeb0b2746f35f (patch) (unidiff)
tree91b1de5d4154eace5ddb2c0dc5c3243a53ed8661 /korganizer
parent363a0e27d630452762e76131b4606e14a3231f01 (diff)
downloadkdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.zip
kdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.tar.gz
kdepimpi-afc19166fcdc09d3d5b757a84abfeb0b2746f35f.tar.bz2
month fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp216
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp2
3 files changed, 122 insertions, 104 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 70cbf96..234375b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -22,7 +22,6 @@
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qtimer.h>
26#include <qvbox.h> 25#include <qvbox.h>
27#include <qwidgetstack.h> 26#include <qwidgetstack.h>
28#include <qpushbutton.h> 27#include <qpushbutton.h>
@@ -74,7 +73,7 @@ private:
74 KNoScrollListBox* _wid; 73 KNoScrollListBox* _wid;
75 74
76}; 75};
77 76
78 77
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 78KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 79 : QListBox(parent, name, WRepaintNoErase)
@@ -92,7 +91,7 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p)
92{ 91{
93 QListBoxItem* item = itemAt ( p ); 92 QListBoxItem* item = itemAt ( p );
94 if ( ! item ) { 93 if ( ! item ) {
95 return i18n("Click in the cell\nto add an event!"); 94 return i18n("Click in the cell\nto add an event!");
96 } 95 }
97 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 96 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
98} 97}
@@ -319,7 +318,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
319 const QPoint &) ), 318 const QPoint &) ),
320 SLOT( contextMenu( QListBoxItem * ) ) ); 319 SLOT( contextMenu( QListBoxItem * ) ) );
321 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 320 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
322 SLOT( selection( QListBoxItem * ) ) ); 321 SLOT( selection( QListBoxItem * ) ) );
323 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 322 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
324 SLOT( cellClicked( QListBoxItem * ) ) ); 323 SLOT( cellClicked( QListBoxItem * ) ) );
325 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 324 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
@@ -407,13 +406,6 @@ void MonthViewCell::keyPressEvent ( QKeyEvent * e )
407 e->ignore(); 406 e->ignore();
408 407
409} 408}
410void MonthViewCell::clear()
411{
412 mItemList->clear();
413 QApplication::removePostedEvents ( mItemList );
414 QApplication::removePostedEvents ( mLabel );
415 QApplication::removePostedEvents ( this );
416}
417 409
418void MonthViewCell::startUpdateCell() 410void MonthViewCell::startUpdateCell()
419{ 411{
@@ -552,44 +544,44 @@ void MonthViewCell::insertEvent(Event *event)
552} 544}
553void MonthViewCell::insertTodo(Todo *todo) 545void MonthViewCell::insertTodo(Todo *todo)
554{ 546{
555 QString text;
556 mItemList->setFocusPolicy(WheelFocus); 547 mItemList->setFocusPolicy(WheelFocus);
557 if (todo->hasDueDate()) { 548 QString text;
558 if (!todo->doesFloat()) { 549 if (todo->hasDueDate()) {
559 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 550 if (!todo->doesFloat()) {
560 text += " "; 551 text += KGlobal::locale()->formatTime(todo->dtDue().time());
552 text += " ";
553 }
561 } 554 }
562 } 555 text += i18n("Td: %1").arg(todo->summary());
563 text += i18n("T: %1").arg(todo->summary()); 556
564 557 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
565 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 558 //item->setPalette( mStandardPalette );
566 //item->setPalette( mStandardPalette ); 559 QPalette pal;
567 QPalette pal; 560 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
568 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 561 QStringList categories = todo->categories();
569 QStringList categories = todo->categories(); 562 QString cat = categories.first();
570 QString cat = categories.first(); 563 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
571 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 564 pal = getPalette();
572 pal = getPalette(); 565 if (cat.isEmpty()) {
573 if (cat.isEmpty()) { 566 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
574 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 567 } else {
568 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
569 }
570
575 } else { 571 } else {
576 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 572 if (cat.isEmpty()) {
573 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
574 } else {
575 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
576 }
577 } 577 }
578 578
579 } else { 579 } else {
580 if (cat.isEmpty()) { 580 pal = mStandardPalette ;
581 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
582 } else {
583 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
584 }
585 } 581 }
586 582 item->setPalette( pal );
587 } else { 583 mItemList->insertItem( item );
588 pal = mStandardPalette ; 584 mToolTip += text+"\n";
589 }
590 item->setPalette( pal );
591 mItemList->insertItem( item );
592 mToolTip += text+"\n";
593} 585}
594void MonthViewCell::finishUpdateCell() 586void MonthViewCell::finishUpdateCell()
595{ 587{
@@ -616,6 +608,7 @@ void MonthViewCell::finishUpdateCell()
616} 608}
617void MonthViewCell::updateCell() 609void MonthViewCell::updateCell()
618{ 610{
611 qDebug("MonthViewCell::updateCell() ");
619 if ( !mMonthView->isUpdatePossible() ) 612 if ( !mMonthView->isUpdatePossible() )
620 return; 613 return;
621 startUpdateCell(); 614 startUpdateCell();
@@ -783,6 +776,7 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
783void MonthViewCell::selection( QListBoxItem *item ) 776void MonthViewCell::selection( QListBoxItem *item )
784{ 777{
785 if ( !item ) return; 778 if ( !item ) return;
779
786 mMonthView->setSelectedCell( this ); 780 mMonthView->setSelectedCell( this );
787} 781}
788 782
@@ -795,11 +789,9 @@ void MonthViewCell::selection( QListBoxItem *item )
795KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 789KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
796 : KOEventView( calendar, parent, name ), 790 : KOEventView( calendar, parent, name ),
797 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 791 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
798 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 792 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
799{ 793{
800 ignoreResizeEvent = 0; 794 skipResize = false;
801 mShortDayLabelsW = false;
802 mShortDayLabelsM = false;
803 clPending = true; 795 clPending = true;
804 mWidStack = new QWidgetStack( this ); 796 mWidStack = new QWidgetStack( this );
805 QHBoxLayout* hb = new QHBoxLayout( this ); 797 QHBoxLayout* hb = new QHBoxLayout( this );
@@ -819,6 +811,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
819 mWeekStartsMonday = true; 811 mWeekStartsMonday = true;
820 updatePossible = false; 812 updatePossible = false;
821 mCells.setAutoDelete( true ); 813 mCells.setAutoDelete( true );
814 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
822 mDayLabels.resize( mDaysPerWeek ); 815 mDayLabels.resize( mDaysPerWeek );
823 mDayLabelsW.resize( mDaysPerWeek ); 816 mDayLabelsW.resize( mDaysPerWeek );
824 QFont bfont = font(); 817 QFont bfont = font();
@@ -907,7 +900,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
907 900
908 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 901 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
909 mContextMenu = eventPopup(); 902 mContextMenu = eventPopup();
910 //updateConfig(); //useless here ... 903 // updateConfig(); //useless here...
911 // ... but we need mWidthLongDayLabel computed 904 // ... but we need mWidthLongDayLabel computed
912 QFontMetrics fontmetric(mDayLabels[0]->font()); 905 QFontMetrics fontmetric(mDayLabels[0]->font());
913 mWidthLongDayLabel = 0; 906 mWidthLongDayLabel = 0;
@@ -1014,11 +1007,15 @@ void KOMonthView::updateConfig()
1014 } 1007 }
1015 QFontMetrics fontmetric(mDayLabels[0]->font()); 1008 QFontMetrics fontmetric(mDayLabels[0]->font());
1016 mWidthLongDayLabel = 0; 1009 mWidthLongDayLabel = 0;
1010
1017 for (int i = 0; i < 7; i++) { 1011 for (int i = 0; i < 7; i++) {
1018 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1012 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1019 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1013 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1020 } 1014 }
1015 bool temp = mShowSatSunComp ;
1016 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1021 if ( ! mShowWeekView ) { 1017 if ( ! mShowWeekView ) {
1018 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1022 computeLayout(); 1019 computeLayout();
1023 } 1020 }
1024 updateDayLabels(); 1021 updateDayLabels();
@@ -1046,26 +1043,26 @@ void KOMonthView::updateDayLabels()
1046 mDayLabelsT = &mDayLabelsW; 1043 mDayLabelsT = &mDayLabelsW;
1047 for (int i = 0; i < 7; i++) { 1044 for (int i = 0; i < 7; i++) {
1048 if (mWeekStartsMonday) { 1045 if (mWeekStartsMonday) {
1049 bool show = mShortDayLabelsW; 1046 bool show = mShortDayLabels;
1050 if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1047 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1051 show = true; 1048 show = true;
1052 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1049 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1053 } else { 1050 } else {
1054 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); 1051 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
1055 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); 1052 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
1056 1053
1057 } 1054 }
1058 } 1055 }
1059 mDayLabelsT = &mDayLabels; 1056 mDayLabelsT = &mDayLabels;
1060 for (int i = 0; i < 7; i++) { 1057 for (int i = 0; i < 7; i++) {
1061 if (mWeekStartsMonday) { 1058 if (mWeekStartsMonday) {
1062 bool show = mShortDayLabelsM; 1059 bool show = mShortDayLabels;
1063 if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1060 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1064 show = true; 1061 show = true;
1065 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1062 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1066 } else { 1063 } else {
1067 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1064 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
1068 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1065 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
1069 1066
1070 } 1067 }
1071 } 1068 }
@@ -1263,14 +1260,12 @@ void KOMonthView::updateView()
1263 1260
1264void KOMonthView::resizeEvent(QResizeEvent * e) 1261void KOMonthView::resizeEvent(QResizeEvent * e)
1265{ 1262{
1266 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1263 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1267 if ( ignoreResizeEvent ) { 1264 if ( skipResize ) {
1268 //qDebug("KOMonthView::resizeEvent ignored "); 1265 skipResize = false;
1269 --ignoreResizeEvent; 1266 qDebug("skipResize ");
1270 return; 1267 return;
1271 } 1268 }
1272 if ( e->size().width()+ e->size().height() < 240 )
1273 return;
1274 computeLayout(); 1269 computeLayout();
1275 clPending = true; 1270 clPending = true;
1276 if ( mShowWeekView ) 1271 if ( mShowWeekView )
@@ -1280,22 +1275,38 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
1280} 1275}
1281void KOMonthView::computeLayoutWeek() 1276void KOMonthView::computeLayoutWeek()
1282{ 1277{
1283 static int widd = 0; 1278 static int lastWid = 0;
1284 static int heigg = 0; 1279 static int lastHei = 0;
1285 if ( widd == width() && heigg == height () ) {
1286 return;
1287 }
1288 widd = width() ;
1289 heigg = height ();
1290 int daysToShow; 1280 int daysToShow;
1281 bool combinedSatSun = false;
1282 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1283 daysToShow = 6;
1284 combinedSatSun = true;
1285 }
1286 int tWid = topLevelWidget()->size().width();
1287 int tHei = topLevelWidget()->size().height();
1288
1291 int wid = size().width();//e 1289 int wid = size().width();//e
1292 int hei = size().height()-1; 1290 int hei = size().height()-1;
1291
1292 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1293 return;
1294
1295
1296 if ( lastWid == width() && lastHei ==height() )
1297 return;
1298 lastWid =width();
1299 lastHei = height();
1300
1301
1293 if ( wid < hei ) 1302 if ( wid < hei )
1294 daysToShow = 2; 1303 daysToShow = 2;
1295 else 1304 else
1296 daysToShow = 3; 1305 daysToShow = 3;
1297 bool combinedSatSun = true; 1306 mShowSatSunComp = true;
1307 combinedSatSun = true;
1298 1308
1309 qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1299 QFontMetrics fm ( mWeekLabels[0]->font() ); 1310 QFontMetrics fm ( mWeekLabels[0]->font() );
1300 int weeklabelwid = fm.width( "888" ); 1311 int weeklabelwid = fm.width( "888" );
1301 wid -= weeklabelwid; 1312 wid -= weeklabelwid;
@@ -1372,8 +1383,9 @@ void KOMonthView::computeLayoutWeek()
1372 h = cellHei ; 1383 h = cellHei ;
1373 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1384 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1374 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1385 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1375 1386 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1376 mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; 1387 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1388 mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
1377 updateDayLabels(); 1389 updateDayLabels();
1378 bool forceUpdate = !updatePossible; 1390 bool forceUpdate = !updatePossible;
1379 updatePossible = true; 1391 updatePossible = true;
@@ -1383,39 +1395,34 @@ void KOMonthView::computeLayoutWeek()
1383} 1395}
1384void KOMonthView::computeLayout() 1396void KOMonthView::computeLayout()
1385{ 1397{
1386 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 1398
1387 // note this only changes the text if the requested size crosses the
1388 // threshold between big enough to support the full name and not big
1389 // enough.
1390
1391 int tWid = topLevelWidget()->size().width();
1392 int tHei = topLevelWidget()->size().height();
1393
1394 int wid = size().width();//e
1395 int hei = size().height()-1;
1396 1399
1397 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1400 static int lastWid = 0;
1398 return; 1401 static int lastHei = 0;
1399 1402
1400
1401 if ( mShowWeekView ){ 1403 if ( mShowWeekView ){
1402 computeLayoutWeek(); 1404 computeLayoutWeek();
1403 return; 1405 return;
1404 } 1406 }
1405 static int widd = 0;
1406 static int heigg = 0;
1407 if ( widd == width() && heigg == height () ) {
1408 return;
1409 }
1410 widd = width() ;
1411 heigg = height ();
1412
1413 int daysToShow = 7; 1407 int daysToShow = 7;
1414 bool combinedSatSun = false; 1408 bool combinedSatSun = false;
1415 if (KOPrefs::instance()->mMonthViewSatSunTog ) { 1409 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1416 daysToShow = 6; 1410 daysToShow = 6;
1417 combinedSatSun = true; 1411 combinedSatSun = true;
1418 } 1412 }
1413 int tWid = topLevelWidget()->size().width();
1414 int tHei = topLevelWidget()->size().height();
1415
1416 int wid = size().width();//e
1417 int hei = size().height()-1;
1418
1419 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1420 return;
1421 if ( lastWid == width() && lastHei ==height() )
1422 return;
1423 lastWid =width();
1424 lastHei = height();
1425 qDebug("KOMonthView::computeLayout() MMM ------------------------------------ ");
1419 QFontMetrics fm ( mWeekLabels[0]->font() ); 1426 QFontMetrics fm ( mWeekLabels[0]->font() );
1420 int weeklabelwid = fm.width( "888" ); 1427 int weeklabelwid = fm.width( "888" );
1421 wid -= weeklabelwid; 1428 wid -= weeklabelwid;
@@ -1452,6 +1459,7 @@ void KOMonthView::computeLayout()
1452 w = colWid; 1459 w = colWid;
1453 h = cellHei ; 1460 h = cellHei ;
1454 for ( i = 0; i < mCells.count(); ++i) { 1461 for ( i = 0; i < mCells.count(); ++i) {
1462 //qDebug("iii %d ", i);
1455 w = colWid; 1463 w = colWid;
1456 if ( ((i) % 7) >= 7-colModulo ) { 1464 if ( ((i) % 7) >= 7-colModulo ) {
1457 ++w; 1465 ++w;
@@ -1488,11 +1496,13 @@ void KOMonthView::computeLayout()
1488 y += h; 1496 y += h;
1489 } 1497 }
1490 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1498 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1491 mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; 1499 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1492 qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); 1500 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1501 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
1493 updateDayLabels(); 1502 updateDayLabels();
1494 bool forceUpdate = !updatePossible; 1503 bool forceUpdate = !updatePossible;
1495 updatePossible = true; 1504 updatePossible = true;
1505 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1496 if ( forceUpdate ) 1506 if ( forceUpdate )
1497 updateView(); 1507 updateView();
1498} 1508}
@@ -1500,7 +1510,14 @@ void KOMonthView::computeLayout()
1500void KOMonthView::showContextMenu( Incidence *incidence ) 1510void KOMonthView::showContextMenu( Incidence *incidence )
1501{ 1511{
1502 mContextMenu->showIncidencePopup(incidence); 1512 mContextMenu->showIncidencePopup(incidence);
1503 1513 /*
1514 if( incidence && incidence->type() == "Event" ) {
1515 Event *event = static_cast<Event *>(incidence);
1516 mContextMenu->showEventPopup(event);
1517 } else {
1518 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1519 }
1520 */
1504} 1521}
1505MonthViewCell * KOMonthView::selectedCell( ) 1522MonthViewCell * KOMonthView::selectedCell( )
1506{ 1523{
@@ -1508,12 +1525,15 @@ MonthViewCell * KOMonthView::selectedCell( )
1508} 1525}
1509void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1526void KOMonthView::setSelectedCell( MonthViewCell *cell )
1510{ 1527{
1528 // qDebug("KOMonthView::setSelectedCell ");
1511 if ( mSelectedCell && mSelectedCell != cell ) { 1529 if ( mSelectedCell && mSelectedCell != cell ) {
1512 MonthViewCell * mvc = mSelectedCell; 1530 MonthViewCell * mvc = mSelectedCell;
1513 mSelectedCell = cell; 1531 mSelectedCell = cell;
1514 mvc->deselect(); 1532 mvc->deselect();
1515 } else 1533 } else
1516 mSelectedCell = cell; 1534 mSelectedCell = cell;
1535 // if ( mSelectedCell )
1536 // mSelectedCell->select();
1517 if ( !mSelectedCell ) 1537 if ( !mSelectedCell )
1518 emit incidenceSelected( 0 ); 1538 emit incidenceSelected( 0 );
1519 else 1539 else
@@ -1558,7 +1578,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
1558 mCellsW[0]->setFocus(); 1578 mCellsW[0]->setFocus();
1559 else 1579 else
1560 mCells[0]->setFocus(); 1580 mCells[0]->setFocus();
1561 1581
1562 } 1582 }
1563 e->accept(); 1583 e->accept();
1564 break; 1584 break;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 9dbe319..a29a1a8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -154,7 +154,6 @@ class MonthViewCell : public QWidget
154 154
155 void deselect(); 155 void deselect();
156 void select(); 156 void select();
157 void clear();
158 157
159#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
160 static QToolTipGroup *toolTipGroup(); 159 static QToolTipGroup *toolTipGroup();
@@ -226,9 +225,9 @@ class KOMonthView: public KOEventView
226 const QDate &, const QDate &); 225 const QDate &, const QDate &);
227 bool isMonthView() { return true; } 226 bool isMonthView() { return true; }
228 bool isUpdatePossible() { return updatePossible; } 227 bool isUpdatePossible() { return updatePossible; }
229 void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;}
230 228
231 MonthViewCell * selectedCell(); 229 MonthViewCell * selectedCell();
230 bool skipResize;
232 public slots: 231 public slots:
233 virtual void updateView(); 232 virtual void updateView();
234 virtual void updateConfig(); 233 virtual void updateConfig();
@@ -259,7 +258,6 @@ class KOMonthView: public KOEventView
259 void updateDayLabels(); 258 void updateDayLabels();
260 259
261 private: 260 private:
262 int ignoreResizeEvent;
263 int currentWeek(); 261 int currentWeek();
264 bool clPending; 262 bool clPending;
265 QWidgetStack * mWidStack; 263 QWidgetStack * mWidStack;
@@ -271,6 +269,7 @@ class KOMonthView: public KOEventView
271 int mNumWeeks; 269 int mNumWeeks;
272 int mNumCells; 270 int mNumCells;
273 bool mWeekStartsMonday; 271 bool mWeekStartsMonday;
272 bool mShowSatSunComp;
274 void computeLayout(); 273 void computeLayout();
275 void computeLayoutWeek(); 274 void computeLayoutWeek();
276 275
@@ -281,8 +280,7 @@ class KOMonthView: public KOEventView
281 QPtrVector<QLabel> mDayLabelsW; 280 QPtrVector<QLabel> mDayLabelsW;
282 QPtrVector<KOWeekButton> mWeekLabelsW; 281 QPtrVector<KOWeekButton> mWeekLabelsW;
283 282
284 bool mShortDayLabelsM; 283 bool mShortDayLabels;
285 bool mShortDayLabelsW;
286 int mWidthLongDayLabel; 284 int mWidthLongDayLabel;
287 285
288 QDate mStartDate; 286 QDate mStartDate;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 62d3e7f..ba15f7f 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -201,7 +201,7 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
201 full = mMainView->leftFrame()->isVisible(); 201 full = mMainView->leftFrame()->isVisible();
202 } else { 202 } else {
203 if ( view == mMonthView && mMonthView) 203 if ( view == mMonthView && mMonthView)
204 mMonthView->setIgnoreResizeEvent( 1 ); 204 mMonthView->skipResize = true ;
205 mCurrentView = view; 205 mCurrentView = view;
206 // bool full = fullScreen; 206 // bool full = fullScreen;
207 bool isFull = !mMainView->leftFrame()->isVisible(); 207 bool isFull = !mMainView->leftFrame()->isVisible();