summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp144
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp2
3 files changed, 86 insertions, 68 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 70cbf96..234375b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -24,3 +24,2 @@
#include <qhbox.h>
-#include <qtimer.h>
#include <qvbox.h>
@@ -409,9 +408,2 @@ void MonthViewCell::keyPressEvent ( QKeyEvent * e )
}
-void MonthViewCell::clear()
-{
- mItemList->clear();
- QApplication::removePostedEvents ( mItemList );
- QApplication::removePostedEvents ( mLabel );
- QApplication::removePostedEvents ( this );
-}
@@ -554,4 +546,4 @@ void MonthViewCell::insertTodo(Todo *todo)
{
- QString text;
mItemList->setFocusPolicy(WheelFocus);
+ QString text;
if (todo->hasDueDate()) {
@@ -562,3 +554,3 @@ void MonthViewCell::insertTodo(Todo *todo)
}
- text += i18n("T: %1").arg(todo->summary());
+ text += i18n("Td: %1").arg(todo->summary());
@@ -618,2 +610,3 @@ void MonthViewCell::updateCell()
{
+ qDebug("MonthViewCell::updateCell() ");
if ( !mMonthView->isUpdatePossible() )
@@ -785,2 +778,3 @@ void MonthViewCell::selection( QListBoxItem *item )
if ( !item ) return;
+
mMonthView->setSelectedCell( this );
@@ -797,7 +791,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
- mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
+ mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
{
- ignoreResizeEvent = 0;
- mShortDayLabelsW = false;
- mShortDayLabelsM = false;
+ skipResize = false;
clPending = true;
@@ -821,2 +813,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mCells.setAutoDelete( true );
+ mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
mDayLabels.resize( mDaysPerWeek );
@@ -1016,2 +1009,3 @@ void KOMonthView::updateConfig()
mWidthLongDayLabel = 0;
+
for (int i = 0; i < 7; i++) {
@@ -1020,3 +1014,6 @@ void KOMonthView::updateConfig()
}
+ bool temp = mShowSatSunComp ;
+ mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
if ( ! mShowWeekView ) {
+ if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
computeLayout();
@@ -1048,4 +1045,4 @@ void KOMonthView::updateDayLabels()
if (mWeekStartsMonday) {
- bool show = mShortDayLabelsW;
- if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
+ bool show = mShortDayLabels;
+ if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
show = true;
@@ -1053,4 +1050,4 @@ void KOMonthView::updateDayLabels()
} else {
- if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW));
- else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW));
+ if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
+ else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
@@ -1061,4 +1058,4 @@ void KOMonthView::updateDayLabels()
if (mWeekStartsMonday) {
- bool show = mShortDayLabelsM;
- if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
+ bool show = mShortDayLabels;
+ if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
show = true;
@@ -1066,4 +1063,4 @@ void KOMonthView::updateDayLabels()
} else {
- if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
- else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
+ if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
+ else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
@@ -1265,10 +1262,8 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
{
- //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
- if ( ignoreResizeEvent ) {
- //qDebug("KOMonthView::resizeEvent ignored ");
- --ignoreResizeEvent;
+ qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
+ if ( skipResize ) {
+ skipResize = false;
+ qDebug("skipResize ");
return;
}
- if ( e->size().width()+ e->size().height() < 240 )
- return;
computeLayout();
@@ -1282,12 +1277,26 @@ void KOMonthView::computeLayoutWeek()
{
- static int widd = 0;
- static int heigg = 0;
- if ( widd == width() && heigg == height () ) {
- return;
- }
- widd = width() ;
- heigg = height ();
+ static int lastWid = 0;
+ static int lastHei = 0;
int daysToShow;
+ bool combinedSatSun = false;
+ if (mShowSatSunComp = 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;
+
+
+ if ( lastWid == width() && lastHei ==height() )
+ return;
+ lastWid =width();
+ lastHei = height();
+
+
if ( wid < hei )
@@ -1296,4 +1305,6 @@ void KOMonthView::computeLayoutWeek()
daysToShow = 3;
- bool combinedSatSun = true;
+ mShowSatSunComp = true;
+ combinedSatSun = true;
+ qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
@@ -1374,4 +1385,5 @@ void KOMonthView::computeLayoutWeek()
mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
-
- mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
+ // 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());
+ mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
updateDayLabels();
@@ -1385,16 +1397,6 @@ void KOMonthView::computeLayout()
{
- // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
- // 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;
+ static int lastWid = 0;
+ static int lastHei = 0;
@@ -1404,13 +1406,5 @@ void KOMonthView::computeLayout()
}
- 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 ) {
+ if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
daysToShow = 6;
@@ -1418,2 +1412,15 @@ void KOMonthView::computeLayout()
}
+ 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 ( lastWid == width() && lastHei ==height() )
+ return;
+ lastWid =width();
+ lastHei = height();
+ qDebug("KOMonthView::computeLayout() MMM ------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
@@ -1454,2 +1461,3 @@ void KOMonthView::computeLayout()
for ( i = 0; i < mCells.count(); ++i) {
+ //qDebug("iii %d ", i);
w = colWid;
@@ -1490,4 +1498,5 @@ void KOMonthView::computeLayout()
mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
- mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ;
- qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel);
+ // 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());
+ mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
updateDayLabels();
@@ -1495,2 +1504,3 @@ void KOMonthView::computeLayout()
updatePossible = true;
+ //mWeekLabels[mNumWeeks]->setText( i18n("W"));
if ( forceUpdate )
@@ -1502,3 +1512,10 @@ 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;
+ }
+ */
}
@@ -1510,2 +1527,3 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
{
+ // qDebug("KOMonthView::setSelectedCell ");
if ( mSelectedCell && mSelectedCell != cell ) {
@@ -1516,2 +1534,4 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
mSelectedCell = cell;
+ // if ( mSelectedCell )
+ // mSelectedCell->select();
if ( !mSelectedCell )
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 9dbe319..a29a1a8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -156,3 +156,2 @@ class MonthViewCell : public QWidget
void select();
- void clear();
@@ -228,5 +227,5 @@ class KOMonthView: public KOEventView
bool isUpdatePossible() { return updatePossible; }
- void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;}
MonthViewCell * selectedCell();
+ bool skipResize;
public slots:
@@ -261,3 +260,2 @@ class KOMonthView: public KOEventView
private:
- int ignoreResizeEvent;
int currentWeek();
@@ -273,2 +271,3 @@ class KOMonthView: public KOEventView
bool mWeekStartsMonday;
+ bool mShowSatSunComp;
void computeLayout();
@@ -283,4 +282,3 @@ class KOMonthView: public KOEventView
- bool mShortDayLabelsM;
- bool mShortDayLabelsW;
+ bool mShortDayLabels;
int mWidthLongDayLabel;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 62d3e7f..ba15f7f 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -203,3 +203,3 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
if ( view == mMonthView && mMonthView)
- mMonthView->setIgnoreResizeEvent( 1 );
+ mMonthView->skipResize = true ;
mCurrentView = view;