author | zautrix <zautrix> | 2005-02-16 22:08:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-16 22:08:18 (UTC) |
commit | 451b4de59893b5c0801a7bbb2f8cbe8e0266b324 (patch) (side-by-side diff) | |
tree | ce3f535541583d37cfe951ddd8d7474770d9c374 /korganizer | |
parent | b2cf8e9a08082539e0a5578a98766e5990783f9a (diff) | |
download | kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.zip kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.gz kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.bz2 |
month view fixes
-rw-r--r-- | korganizer/datenavigator.cpp | 15 | ||||
-rw-r--r-- | korganizer/datenavigator.h | 3 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 8 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 62 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 26 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 4 |
11 files changed, 120 insertions, 17 deletions
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index 8b7c993..b0eac51 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp @@ -85,2 +85,8 @@ void DateNavigator::selectMonth() } +void DateNavigator::selectMonthFromMonthview() +{ + + QDate date =mSelectedDates.first().addDays( 7 ); + selectMonthByDate( date ); +} @@ -260,2 +266,11 @@ void DateNavigator::selectNextMonth() } +void DateNavigator::selectPreviousWeek() +{ + selectDates( mSelectedDates.first().addDays( -7 ), datesCount() ); +} + +void DateNavigator::selectNextWeek() +{ + selectDates( mSelectedDates.first().addDays( 7 ), datesCount() ); +} diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 4265e84..9742d41 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h @@ -69,2 +69,4 @@ class DateNavigator : public QObject void selectNextMonth(); + void selectPreviousWeek(); + void selectNextWeek(); void selectNextYear(); @@ -72,2 +74,3 @@ class DateNavigator : public QObject void selectMonth(); + void selectMonthFromMonthview(); void selectMonthByDate( const QDate & ); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index d0380e3..f9bc1ca 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -951,4 +951,7 @@ void KOMonthView::selectInternalWeekNum ( int n ) { - switchView(); - emit selectWeekNum ( n ); + switchView(); + if ( !KOPrefs::instance()->mMonthViewWeek ) + emit selectMonth (); + else + emit selectWeekNum ( n ); } @@ -963,3 +966,2 @@ void KOMonthView::switchView() { - if ( selectedCell( ) ) diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 03f9dc6..2f6f5dc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -245,2 +245,3 @@ class KOMonthView: public KOEventView void setSelectedCell( MonthViewCell * ); + void switchView(); @@ -248,3 +249,2 @@ class KOMonthView: public KOEventView void selectInternalWeekNum ( int ); - void switchView(); void processSelectionChange(); @@ -254,2 +254,3 @@ class KOMonthView: public KOEventView void selectWeekNum ( int ); + void selectMonth (); void showDaySignal( QDate ); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7efb6a6..5efc247 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -77,2 +77,3 @@ KOPrefs::KOPrefs() : addItemBool("ShowIconDay5",&mShowIconDay5,true); + addItemBool("ShowIconDay6",&mShowIconDay6,true); addItemBool("ShowIconDay7",&mShowIconDay7,true); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index fa69d52..e300067 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -173,2 +173,3 @@ class KOPrefs : public KPimPrefs bool mShowIconDay5; + bool mShowIconDay6; bool mShowIconDay7; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f8f6c1d..e22f096 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -90,3 +90,8 @@ void KOViewManager::readSettings(KConfig *config) if (view == "WhatsNext") showWhatsNextView(); - else if (view == "Month") showMonthView(); + else if (view == "Month") { + if ( KOPrefs::instance()->mMonthViewWeek ) + showMonthView(); + else + showMonthViewWeek(); + } else if (view == "List") showListView(); @@ -209,3 +214,4 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) return; - full = mMainView->leftFrame()->isVisible(); + if ( view != mMonthView ) + full = mMainView->leftFrame()->isVisible(); } else { @@ -488,5 +494,5 @@ bool KOViewManager::showsNextDays() } -void KOViewManager::showMonthView() - { - if (!mMonthView) { +void KOViewManager::createMonthView() +{ +if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); @@ -519,2 +525,4 @@ void KOViewManager::showMonthView() mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); + connect( mMonthView, SIGNAL( selectMonth() ), + mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), @@ -534,2 +542,6 @@ void KOViewManager::showMonthView() mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), + mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), + mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); @@ -543,12 +555,40 @@ void KOViewManager::showMonthView() } +} +void KOViewManager::showMonthViewWeek() +{ + createMonthView(); + bool full = true; + if ( mCurrentView == mMonthView) + full = mMainView->leftFrame()->isVisible(); + if ( !KOPrefs::instance()->mMonthViewWeek ) { + mMonthView->switchView(); + if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) + full = false; + else + full = true; + } + mMainView->dateNavigator()->selectWeek(); + showView(mMonthView, full ); +} +void KOViewManager::showMonthView() + { + + createMonthView(); globalFlagBlockAgenda = 1; //mFlagShowNextxDays = false; - // if(mMonthView == mCurrentView) return; - if ( KOPrefs::instance()->mMonthViewWeek ) - mMainView->dateNavigator()->selectWeek(); - else - mMainView->dateNavigator()->selectMonth(); + bool full = true; + if ( mCurrentView == mMonthView) + full = mMainView->leftFrame()->isVisible(); + // if(mMonthView == mCurrentView) return; + if ( KOPrefs::instance()->mMonthViewWeek ) { + mMonthView->switchView(); + if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) + full = false; + else + full = true; + } + mMainView->dateNavigator()->selectMonth(); - showView(mMonthView, true ); + showView(mMonthView, full ); diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 66ab138..8f0bf82 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -94,2 +94,3 @@ class KOViewManager : public QObject void showMonthView(); + void showMonthViewWeek(); void showTodoView(); @@ -99,2 +100,3 @@ class KOViewManager : public QObject private: + void createMonthView(); CalendarView *mMainView; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ab0e4d6..16031b8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -715,2 +715,9 @@ void MainWindow::initActions() + icon = loadPixmap( pathString + "workweek2" ); + configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); + QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); + day6_action->addTo( viewMenu ); + connect( day6_action, SIGNAL( activated() ), + mView->viewManager(), SLOT( showMonthViewWeek() ) ); + icon = loadPixmap( pathString + "todo" ); @@ -997,2 +1004,4 @@ void MainWindow::initActions() month_action->addTo( iconToolBar ); + if (p-> mShowIconDay6) + day6_action->addTo( iconToolBar ); if (p-> mShowIconTodoview) @@ -1053,2 +1062,4 @@ void MainWindow::initActions() configureToolBarMenu->setItemChecked( 50, true ); + if (p-> mShowIconDay6) + configureToolBarMenu->setItemChecked( 75, true ); if (p-> mShowIconDay7) @@ -1801,2 +1812,3 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); + p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index b591232..934e153 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -91,2 +91,11 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam + mPrevWeek = new QPushButton( mCtrlFrame ); + mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); + QToolTip::add( mPrevWeek, i18n("Previous Week") ); + + // Create forward navigation buttons + mNextWeek = new QPushButton( mCtrlFrame ); + mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); + QToolTip::add( mNextWeek, i18n("Next Week") ); + mNextYear = new QPushButton( mCtrlFrame ); @@ -103,2 +112,3 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextMonth->setFlat( true); + mNextWeek->setFlat( true); mNextYear->setFlat( true); @@ -107,2 +117,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mPrevMonth->setFlat( true); + mPrevWeek->setFlat( true); + } else { + mPrevWeek->hide(); + mNextWeek->hide(); } @@ -130,5 +144,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mSelectMonth->setFixedHeight( size ); - mPrevYear->setFixedHeight( size ); + mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); - mNextMonth->setFixedHeight( size ); + mPrevWeek->setFixedHeight( size ); + mNextMonth->setFixedHeight( size ); + mNextWeek->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); @@ -138,2 +154,3 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam ctrlLayout->addWidget( mPrevMonth, 3 ); + ctrlLayout->addWidget( mPrevWeek, 3 ); //ctrlLayout->addStretch( 1 ); @@ -144,2 +161,3 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam // ctrlLayout->addStretch( 1 ); + ctrlLayout->addWidget( mNextWeek, 3 ); ctrlLayout->addWidget( mNextMonth, 3 ); @@ -150,2 +168,4 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); + connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); + connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); @@ -155,2 +175,4 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextMonth->setFocusPolicy(NoFocus); + mPrevWeek->setFocusPolicy(NoFocus); + mNextWeek->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 93240a6..803c817 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -48,2 +48,4 @@ class NavigatorBar: public QWidget void goPrevMonth(); + void goNextWeek(); + void goPrevWeek(); void goNextYear(); @@ -58,2 +60,4 @@ class NavigatorBar: public QWidget QPushButton *mNextMonth; + QPushButton *mPrevWeek; + QPushButton *mNextWeek; QPushButton *mNextYear; |