-rw-r--r-- | korganizer/komonthview.cpp | 94 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 44 insertions, 57 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ffb2e1e..70cbf96 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -909,3 +909,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
909 | mContextMenu = eventPopup(); | 909 | mContextMenu = eventPopup(); |
910 | updateConfig(); //useless here | 910 | //updateConfig(); //useless here ... |
911 | // ... but we need mWidthLongDayLabel computed | ||
912 | QFontMetrics fontmetric(mDayLabels[0]->font()); | ||
913 | mWidthLongDayLabel = 0; | ||
914 | for (int i = 0; i < 7; i++) { | ||
915 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | ||
916 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | ||
917 | } | ||
911 | 918 | ||
@@ -1009,3 +1016,2 @@ void KOMonthView::updateConfig() | |||
1009 | mWidthLongDayLabel = 0; | 1016 | mWidthLongDayLabel = 0; |
1010 | qDebug("KOMonthView::updateConfig() "); | ||
1011 | for (int i = 0; i < 7; i++) { | 1017 | for (int i = 0; i < 7; i++) { |
@@ -1038,9 +1044,3 @@ void KOMonthView::updateDayLabels() | |||
1038 | QPtrVector<QLabel> *mDayLabelsT; | 1044 | QPtrVector<QLabel> *mDayLabelsT; |
1039 | #if 0 | 1045 | |
1040 | if (mShowWeekView ) | ||
1041 | mDayLabelsT = &mDayLabelsW; | ||
1042 | else | ||
1043 | mDayLabelsT = &mDayLabels; | ||
1044 | #endif | ||
1045 | qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); | ||
1046 | mDayLabelsT = &mDayLabelsW; | 1046 | mDayLabelsT = &mDayLabelsW; |
@@ -1265,13 +1265,7 @@ void KOMonthView::resizeEvent(QResizeEvent * e) | |||
1265 | { | 1265 | { |
1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1266 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1267 | if ( ignoreResizeEvent ) { |
1268 | int diff = e->size().height() - e->oldSize().height(); | 1268 | //qDebug("KOMonthView::resizeEvent ignored "); |
1269 | if ( diff < 0 ) | 1269 | --ignoreResizeEvent; |
1270 | diff = diff * (-1); | 1270 | return; |
1271 | if ( diff == ignoreResizeEventHeight ) { | ||
1272 | qDebug("KOMonthView::resizeEvent ignored "); | ||
1273 | --ignoreResizeEvent; | ||
1274 | return; | ||
1275 | } | ||
1276 | ignoreResizeEvent = 0; | ||
1277 | } | 1271 | } |
@@ -1288,13 +1282,12 @@ void KOMonthView::computeLayoutWeek() | |||
1288 | { | 1282 | { |
1289 | 1283 | static int widd = 0; | |
1284 | static int heigg = 0; | ||
1285 | if ( widd == width() && heigg == height () ) { | ||
1286 | return; | ||
1287 | } | ||
1288 | widd = width() ; | ||
1289 | heigg = height (); | ||
1290 | int daysToShow; | 1290 | int daysToShow; |
1291 | int tWid = topLevelWidget()->size().width(); | ||
1292 | int tHei = topLevelWidget()->size().height(); | ||
1293 | |||
1294 | int wid = size().width();//e | 1291 | int wid = size().width();//e |
1295 | int hei = size().height()-1; | 1292 | int hei = size().height()-1; |
1296 | |||
1297 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1298 | return; | ||
1299 | |||
1300 | if ( wid < hei ) | 1293 | if ( wid < hei ) |
@@ -1305,3 +1298,2 @@ void KOMonthView::computeLayoutWeek() | |||
1305 | 1298 | ||
1306 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1307 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1299 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
@@ -1382,4 +1374,3 @@ void KOMonthView::computeLayoutWeek() | |||
1382 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1374 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1383 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1375 | |
1384 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1385 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1376 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
@@ -1398,2 +1389,13 @@ void KOMonthView::computeLayout() | |||
1398 | // enough. | 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 | |||
1397 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1398 | return; | ||
1399 | |||
1400 | |||
1399 | if ( mShowWeekView ){ | 1401 | if ( mShowWeekView ){ |
@@ -1402,2 +1404,10 @@ void KOMonthView::computeLayout() | |||
1402 | } | 1404 | } |
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 | |||
1403 | int daysToShow = 7; | 1413 | int daysToShow = 7; |
@@ -1408,11 +1418,2 @@ void KOMonthView::computeLayout() | |||
1408 | } | 1418 | } |
1409 | int tWid = topLevelWidget()->size().width(); | ||
1410 | int tHei = topLevelWidget()->size().height(); | ||
1411 | |||
1412 | int wid = size().width();//e | ||
1413 | int hei = size().height()-1; | ||
1414 | |||
1415 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1416 | return; | ||
1417 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1418 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1419 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
@@ -1489,4 +1490,2 @@ void KOMonthView::computeLayout() | |||
1489 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1490 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1490 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | ||
1491 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1492 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1491 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; |
@@ -1496,3 +1495,2 @@ void KOMonthView::computeLayout() | |||
1496 | updatePossible = true; | 1495 | updatePossible = true; |
1497 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
1498 | if ( forceUpdate ) | 1496 | if ( forceUpdate ) |
@@ -1504,10 +1502,3 @@ void KOMonthView::showContextMenu( Incidence *incidence ) | |||
1504 | mContextMenu->showIncidencePopup(incidence); | 1502 | mContextMenu->showIncidencePopup(incidence); |
1505 | /* | 1503 | |
1506 | if( incidence && incidence->type() == "Event" ) { | ||
1507 | Event *event = static_cast<Event *>(incidence); | ||
1508 | mContextMenu->showEventPopup(event); | ||
1509 | } else { | ||
1510 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | ||
1511 | } | ||
1512 | */ | ||
1513 | } | 1504 | } |
@@ -1519,3 +1510,2 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell ) | |||
1519 | { | 1510 | { |
1520 | //qDebug("KOMonthView::setSelectedCell %x ", cell); | ||
1521 | if ( mSelectedCell && mSelectedCell != cell ) { | 1511 | if ( mSelectedCell && mSelectedCell != cell ) { |
@@ -1526,4 +1516,2 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell ) | |||
1526 | mSelectedCell = cell; | 1516 | mSelectedCell = cell; |
1527 | // if ( mSelectedCell ) | ||
1528 | // mSelectedCell->select(); | ||
1529 | if ( !mSelectedCell ) | 1517 | if ( !mSelectedCell ) |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d70cda1..9dbe319 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -228,3 +228,3 @@ class KOMonthView: public KOEventView | |||
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} | 229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} |
230 | 230 | ||
@@ -262,3 +262,2 @@ class KOMonthView: public KOEventView | |||
262 | int ignoreResizeEvent; | 262 | int ignoreResizeEvent; |
263 | int ignoreResizeEventHeight; | ||
264 | int currentWeek(); | 263 | int currentWeek(); |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c35de0a..62d3e7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -202,2 +202,4 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
202 | } else { | 202 | } else { |
203 | if ( view == mMonthView && mMonthView) | ||
204 | mMonthView->setIgnoreResizeEvent( 1 ); | ||
203 | mCurrentView = view; | 205 | mCurrentView = view; |
@@ -225,4 +227,2 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | |||
225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 227 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | |||
227 | mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); | ||
228 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |