-rw-r--r-- | korganizer/calendarview.cpp | 33 | ||||
-rw-r--r-- | korganizer/calendarview.h | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 55 | ||||
-rw-r--r-- | korganizer/komonthview.h | 6 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 41 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 1 |
6 files changed, 55 insertions, 85 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 77de94f..0fbaa9a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -286,7 +286,4 @@ void CalendarView::init() QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); - mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); - rightLayout->addWidget( mNavigatorBar ); - mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 1 ); @@ -328,7 +325,5 @@ void CalendarView::init() mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); - mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); mRightFrame = new QWidgetStack( rightBox ); - rightLayout->addWidget( mNavigatorBar ); rightLayout->addWidget( mRightFrame, 10 ); @@ -351,17 +346,5 @@ void CalendarView::init() connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); - connect( mNavigatorBar, SIGNAL( goPrevYear() ), - mNavigator, SLOT( selectPreviousYear() ) ); - connect( mNavigatorBar, SIGNAL( goNextYear() ), - mNavigator, SLOT( selectNextYear() ) ); - connect( mNavigatorBar, SIGNAL( goPrevMonth() ), - mNavigator, SLOT( selectPreviousMonth() ) ); - connect( mNavigatorBar, SIGNAL( goNextMonth() ), - mNavigator, SLOT( selectNextMonth() ) ); - connect( mNavigatorBar, SIGNAL( selectWeek( int ) ), - mNavigator, SLOT( selectWeek( int ) ) ); - - connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), - mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); + connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), @@ -383,6 +366,4 @@ void CalendarView::init() connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), mNavigator, SLOT( slotMonthSelect( int ) ) ); - connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), - mNavigator, SLOT( slotMonthSelect( int ) ) ); connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), @@ -3869,16 +3850,4 @@ void CalendarView::slotCalendarChanged() } -NavigatorBar *CalendarView::navigatorBar() -{ - return mNavigatorBar; -} -void CalendarView::showNavigatorBar( bool b) -{ - if ( b ) mNavigatorBar->show(); - else mNavigatorBar->hide(); -} - - - void CalendarView::keyPressEvent ( QKeyEvent *e) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 8d7ff36..731298d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -58,5 +58,4 @@ class KOIncidenceEditor; class KDatePicker; class ResourceView; -class NavigatorBar; class KOEventEditor; class KOTodoEditor ; @@ -107,5 +106,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser QWidgetStack *viewStack(); QWidget *leftFrame(); - NavigatorBar *navigatorBar(); DateNavigator *dateNavigator(); @@ -177,5 +175,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser public slots: - void showNavigatorBar(bool); void showOpenError(); void watchSavedFile(); @@ -534,5 +531,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser KDatePicker* mDatePicker; QVBox* mDateFrame; - NavigatorBar *mNavigatorBar; KDateNavigator *mDateNavigator; // widget showing small month view. diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 234375b..7ba0b2f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -794,6 +794,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) skipResize = false; clPending = true; + mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); mWidStack = new QWidgetStack( this ); - QHBoxLayout* hb = new QHBoxLayout( this ); + QVBoxLayout* hb = new QVBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); @@ -805,4 +806,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWidStack->addWidget( mWeekView , 1 ); #endif + hb->addWidget( mNavigatorBar ); hb->addWidget( mWidStack ); mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); @@ -811,4 +813,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekStartsMonday = true; updatePossible = false; + //updatePossible = true; mCells.setAutoDelete( true ); mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; @@ -918,4 +921,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) emit incidenceSelected( 0 ); +#ifndef DESKTOP_VERSION + resize( QApplication::desktop()->size() ); + computeLayout(); +#endif } @@ -944,5 +951,4 @@ void KOMonthView::switchView() mShowWeekView = !mShowWeekView; KOPrefs::instance()->mMonthViewWeek = mShowWeekView; - //emit showNavigator( !mShowWeekView ); if ( clPending ) { computeLayout(); @@ -1261,10 +1267,5 @@ 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()); - if ( skipResize ) { - skipResize = false; - qDebug("skipResize "); - return; - } + //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); computeLayout(); clPending = true; @@ -1287,14 +1288,13 @@ void KOMonthView::computeLayoutWeek() int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + int wid = width();//e + int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) return; - - if ( lastWid == width() && lastHei ==height() ) + if ( lastWid == width() && lastHei == height() ) return; - lastWid =width(); + lastWid = width(); lastHei = height(); @@ -1307,5 +1307,5 @@ void KOMonthView::computeLayoutWeek() combinedSatSun = true; - qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); + //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1388,9 +1388,9 @@ void KOMonthView::computeLayoutWeek() mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("M")); - if ( forceUpdate ) - updateView(); + //if ( forceUpdate ) + // updateView(); } void KOMonthView::computeLayout() @@ -1414,14 +1414,17 @@ void KOMonthView::computeLayout() int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + int wid = width();//e + int hei = height()-1-mNavigatorBar->height(); - if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) + if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { return; - if ( lastWid == width() && lastHei ==height() ) + } + if ( lastWid == width() && lastHei == height() ){ return; - lastWid =width(); - lastHei = height(); - qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); + } + + lastWid = width(); + lastHei = height(); + //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1501,9 +1504,7 @@ void KOMonthView::computeLayout() mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); - if ( forceUpdate ) - updateView(); } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a29a1a8..bf861ef 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -37,4 +37,5 @@ #include "koeventview.h" +#include "navigatorbar.h" #ifdef DESKTOP_VERSION @@ -228,5 +229,6 @@ class KOMonthView: public KOEventView MonthViewCell * selectedCell(); - bool skipResize; + bool skipResize; + NavigatorBar* navigatorBar() { return mNavigatorBar ;} public slots: virtual void updateView(); @@ -250,5 +252,4 @@ class KOMonthView: public KOEventView void nextMonth(); void prevMonth(); - void showNavigator( bool ); void selectWeekNum ( int ); void showDaySignal( QDate ); @@ -259,4 +260,5 @@ class KOMonthView: public KOEventView private: + NavigatorBar* mNavigatorBar; int currentWeek(); bool clPending; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index ba15f7f..b551e2a 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -202,5 +202,5 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) } else { if ( view == mMonthView && mMonthView) - mMonthView->skipResize = true ; + ;//mMonthView->skipResize = true ; mCurrentView = view; // bool full = fullScreen; @@ -222,23 +222,8 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) { mCurrentAgendaView = 0; - int wid = mMainView->width() ; - int hei = mMainView->height(); - if ( mCurrentView == mMonthView ) { - if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { - mMainView->navigatorBar()->show(); - hei -= mMainView->navigatorBar()->sizeHint().height(); - } - //mMainView->navigatorBar()->hide(); - } else { - mMainView->navigatorBar()->hide(); - } if ( fullScreen ) { mMainView->leftFrame()->hide(); } else { mMainView->leftFrame()->show(); - if ( KOPrefs::instance()->mVerticalScreen ) - hei -= mMainView->leftFrame()->height(); - else - wid -= mMainView->leftFrame()->width(); } emit signalFullScreen( !fullScreen ); @@ -528,9 +513,25 @@ void KOViewManager::showMonthView() connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); connect( mMonthView, SIGNAL(nextMonth() ), - mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); + mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); connect( mMonthView, SIGNAL(prevMonth() ), - mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); - connect( mMonthView, SIGNAL( showNavigator(bool) ), - mMainView, SLOT ( showNavigatorBar(bool) ) ); + mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), + mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), + mMainView->dateNavigator(), SLOT( selectNextYear() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), + mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), + mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( selectWeek( int ) ), + mMainView->dateNavigator(), SLOT( selectWeek( int ) ) ); + + connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), + mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); + + + connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), + mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); + } diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 657f98d..f05e6f6 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -155,4 +155,5 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); + setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } |