summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-06 20:09:33 (UTC)
committer zautrix <zautrix>2005-02-06 20:09:33 (UTC)
commit961fc44f4092c1f981eb3be4284715e6829f885c (patch) (side-by-side diff)
tree005e999ddbf07af42c7da4f9193874ba0ba3870c
parent536a16498de6b9c10b3f5b147ca18c5e4421401c (diff)
downloadkdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.zip
kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.gz
kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.bz2
fixesss
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp94
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koviewmanager.cpp4
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
@@ -907,7 +907,14 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
//connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
mContextMenu = eventPopup();
- updateConfig(); //useless here
+ //updateConfig(); //useless here ...
+ // ... but we need mWidthLongDayLabel computed
+ QFontMetrics fontmetric(mDayLabels[0]->font());
+ mWidthLongDayLabel = 0;
+ for (int i = 0; i < 7; i++) {
+ int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
+ if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
+ }
//mWeekLabels[mNumWeeks]->setText( i18n("W"));
@@ -1007,7 +1014,6 @@ void KOMonthView::updateConfig()
}
QFontMetrics fontmetric(mDayLabels[0]->font());
mWidthLongDayLabel = 0;
- qDebug("KOMonthView::updateConfig() ");
for (int i = 0; i < 7; i++) {
int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
@@ -1036,13 +1042,7 @@ void KOMonthView::updateDayLabels()
{
QPtrVector<QLabel> *mDayLabelsT;
-#if 0
- if (mShowWeekView )
- mDayLabelsT = &mDayLabelsW;
- else
- mDayLabelsT = &mDayLabels;
-#endif
- qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM);
+
mDayLabelsT = &mDayLabelsW;
for (int i = 0; i < 7; i++) {
if (mWeekStartsMonday) {
@@ -1263,17 +1263,11 @@ void KOMonthView::updateView()
void KOMonthView::resizeEvent(QResizeEvent * e)
{
- qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
+ //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
if ( ignoreResizeEvent ) {
- int diff = e->size().height() - e->oldSize().height();
- if ( diff < 0 )
- diff = diff * (-1);
- if ( diff == ignoreResizeEventHeight ) {
- qDebug("KOMonthView::resizeEvent ignored ");
- --ignoreResizeEvent;
- return;
- }
- ignoreResizeEvent = 0;
+ //qDebug("KOMonthView::resizeEvent ignored ");
+ --ignoreResizeEvent;
+ return;
}
if ( e->size().width()+ e->size().height() < 240 )
return;
@@ -1286,24 +1280,22 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
}
void KOMonthView::computeLayoutWeek()
{
-
+ static int widd = 0;
+ static int heigg = 0;
+ if ( widd == width() && heigg == height () ) {
+ return;
+ }
+ widd = width() ;
+ heigg = height ();
int daysToShow;
- int tWid = topLevelWidget()->size().width();
- int tHei = topLevelWidget()->size().height();
-
int wid = size().width();//e
int hei = size().height()-1;
-
- if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
- return;
-
if ( wid < hei )
daysToShow = 2;
else
daysToShow = 3;
bool combinedSatSun = true;
- //qDebug("KOMonthView::computeLayout()------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
int weeklabelwid = fm.width( "888" );
wid -= weeklabelwid;
@@ -1380,8 +1372,7 @@ void KOMonthView::computeLayoutWeek()
h = cellHei ;
mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
- // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
- //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
+
mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
updateDayLabels();
bool forceUpdate = !updatePossible;
@@ -1396,25 +1387,35 @@ void KOMonthView::computeLayout()
// note this only changes the text if the requested size crosses the
// threshold between big enough to support the full name and not big
// enough.
+
+ int tWid = topLevelWidget()->size().width();
+ int tHei = topLevelWidget()->size().height();
+
+ int wid = size().width();//e
+ int hei = size().height()-1;
+
+ if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
+ return;
+
+
if ( mShowWeekView ){
computeLayoutWeek();
return;
}
+ static int widd = 0;
+ static int heigg = 0;
+ if ( widd == width() && heigg == height () ) {
+ return;
+ }
+ widd = width() ;
+ heigg = height ();
+
int daysToShow = 7;
bool combinedSatSun = false;
if (KOPrefs::instance()->mMonthViewSatSunTog ) {
daysToShow = 6;
combinedSatSun = true;
}
- int tWid = topLevelWidget()->size().width();
- int tHei = topLevelWidget()->size().height();
-
- int wid = size().width();//e
- int hei = size().height()-1;
-
- if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
- return;
- //qDebug("KOMonthView::computeLayout()------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
int weeklabelwid = fm.width( "888" );
wid -= weeklabelwid;
@@ -1487,14 +1488,11 @@ void KOMonthView::computeLayout()
y += h;
}
mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
- // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
- //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ;
qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel);
updateDayLabels();
bool forceUpdate = !updatePossible;
updatePossible = true;
- //mWeekLabels[mNumWeeks]->setText( i18n("W"));
if ( forceUpdate )
updateView();
}
@@ -1502,14 +1500,7 @@ void KOMonthView::computeLayout()
void KOMonthView::showContextMenu( Incidence *incidence )
{
mContextMenu->showIncidencePopup(incidence);
- /*
- if( incidence && incidence->type() == "Event" ) {
- Event *event = static_cast<Event *>(incidence);
- mContextMenu->showEventPopup(event);
- } else {
- kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
- }
- */
+
}
MonthViewCell * KOMonthView::selectedCell( )
{
@@ -1517,15 +1508,12 @@ MonthViewCell * KOMonthView::selectedCell( )
}
void KOMonthView::setSelectedCell( MonthViewCell *cell )
{
- //qDebug("KOMonthView::setSelectedCell %x ", cell);
if ( mSelectedCell && mSelectedCell != cell ) {
MonthViewCell * mvc = mSelectedCell;
mSelectedCell = cell;
mvc->deselect();
} else
mSelectedCell = cell;
- // if ( mSelectedCell )
- // mSelectedCell->select();
if ( !mSelectedCell )
emit incidenceSelected( 0 );
else
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index d70cda1..9dbe319 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -226,7 +226,7 @@ class KOMonthView: public KOEventView
const QDate &, const QDate &);
bool isMonthView() { return true; }
bool isUpdatePossible() { return updatePossible; }
- void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;}
+ void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;}
MonthViewCell * selectedCell();
public slots:
@@ -260,7 +260,6 @@ class KOMonthView: public KOEventView
private:
int ignoreResizeEvent;
- int ignoreResizeEventHeight;
int currentWeek();
bool clPending;
QWidgetStack * mWidStack;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index c35de0a..62d3e7f 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -200,6 +200,8 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
return;
full = mMainView->leftFrame()->isVisible();
} else {
+ if ( view == mMonthView && mMonthView)
+ mMonthView->setIgnoreResizeEvent( 1 );
mCurrentView = view;
// bool full = fullScreen;
bool isFull = !mMainView->leftFrame()->isVisible();
@@ -223,8 +225,6 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
int hei = mMainView->height();
if ( mCurrentView == mMonthView ) {
if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) {
-
- mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height());
mMainView->navigatorBar()->show();
hei -= mMainView->navigatorBar()->sizeHint().height();
}