-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 @@ -84,4 +84,10 @@ void DateNavigator::selectMonth() selectMonthByDate( date ); } +void DateNavigator::selectMonthFromMonthview() +{ + + QDate date =mSelectedDates.first().addDays( 7 ); + selectMonthByDate( date ); +} DateList DateNavigator::selectedDates() @@ -259,4 +265,13 @@ void DateNavigator::selectNextMonth() } +void DateNavigator::selectPreviousWeek() +{ + selectDates( mSelectedDates.first().addDays( -7 ), datesCount() ); +} + +void DateNavigator::selectNextWeek() +{ + selectDates( mSelectedDates.first().addDays( 7 ), datesCount() ); +} void DateNavigator::selectNextYear() diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 4265e84..9742d41 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h @@ -68,7 +68,10 @@ class DateNavigator : public QObject void selectPreviousMonth(); void selectNextMonth(); + void selectPreviousWeek(); + void selectNextWeek(); void selectNextYear(); 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 @@ -950,6 +950,9 @@ KOMonthView::~KOMonthView() void KOMonthView::selectInternalWeekNum ( int n ) { - switchView(); - emit selectWeekNum ( n ); + switchView(); + if ( !KOPrefs::instance()->mMonthViewWeek ) + emit selectMonth (); + else + emit selectWeekNum ( n ); } @@ -962,5 +965,4 @@ int KOMonthView::currentWeek() void KOMonthView::switchView() { - if ( selectedCell( ) ) selectedCell()->deselect(); diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 03f9dc6..2f6f5dc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -244,8 +244,8 @@ class KOMonthView: public KOEventView void setSelectedCell( MonthViewCell * ); + void switchView(); protected slots: void selectInternalWeekNum ( int ); - void switchView(); void processSelectionChange(); signals: @@ -253,4 +253,5 @@ class KOMonthView: public KOEventView void prevMonth(); void selectWeekNum ( int ); + void selectMonth (); void showDaySignal( QDate ); protected: diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7efb6a6..5efc247 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -76,4 +76,5 @@ KOPrefs::KOPrefs() : addItemBool("ShowIconDay1",&mShowIconDay1,true); addItemBool("ShowIconDay5",&mShowIconDay5,true); + addItemBool("ShowIconDay6",&mShowIconDay6,true); addItemBool("ShowIconDay7",&mShowIconDay7,true); addItemBool("ShowIconMonth",&mShowIconMonth,true); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index fa69d52..e300067 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -172,4 +172,5 @@ class KOPrefs : public KPimPrefs bool mShowIconDay1; bool mShowIconDay5; + bool mShowIconDay6; bool mShowIconDay7; bool mShowIconMonth; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f8f6c1d..e22f096 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -89,5 +89,10 @@ void KOViewManager::readSettings(KConfig *config) QString view = config->readEntry("Current View"); 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(); else if (view == "Journal") showJournalView(); @@ -208,5 +213,6 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) if ( mCurrentAgendaView < 0 ) return; - full = mMainView->leftFrame()->isVisible(); + if ( view != mMonthView ) + full = mMainView->leftFrame()->isVisible(); } else { if ( view == mMonthView && mMonthView) @@ -487,7 +493,7 @@ bool KOViewManager::showsNextDays() return mFlagShowNextxDays; } -void KOViewManager::showMonthView() - { - if (!mMonthView) { +void KOViewManager::createMonthView() +{ +if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); @@ -518,4 +524,6 @@ void KOViewManager::showMonthView() connect( mMonthView, SIGNAL( selectWeekNum( int ) ), mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); + connect( mMonthView, SIGNAL( selectMonth() ), + mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), mMainView, SLOT ( showDay( QDate ) ) ); @@ -533,4 +541,8 @@ void KOViewManager::showMonthView() connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), + mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); + connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), + mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), @@ -542,14 +554,42 @@ 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 @@ -93,4 +93,5 @@ class KOViewManager : public QObject void showNextXView(); void showMonthView(); + void showMonthViewWeek(); void showTodoView(); void showJournalView(); @@ -98,4 +99,5 @@ 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 @@ -714,4 +714,11 @@ void MainWindow::initActions() mView->viewManager(), SLOT( showMonthView() ) ); + 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" ); configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); @@ -996,4 +1003,6 @@ void MainWindow::initActions() if (p-> mShowIconMonth) month_action->addTo( iconToolBar ); + if (p-> mShowIconDay6) + day6_action->addTo( iconToolBar ); if (p-> mShowIconTodoview) todoview_action->addTo( iconToolBar ); @@ -1052,4 +1061,6 @@ void MainWindow::initActions() if (p-> mShowIconDay5) configureToolBarMenu->setItemChecked( 50, true ); + if (p-> mShowIconDay6) + configureToolBarMenu->setItemChecked( 75, true ); if (p-> mShowIconDay7) configureToolBarMenu->setItemChecked( 60, true ); @@ -1800,4 +1811,5 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); + p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index b591232..934e153 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -90,4 +90,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam QToolTip::add( mNextMonth, i18n("Next Month") ); + 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 ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); @@ -102,8 +111,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam if ( QString ( name ) == QString("useBigPixmaps") ) { mNextMonth->setFlat( true); + mNextWeek->setFlat( true); mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); mPrevMonth->setFlat( true); + mPrevWeek->setFlat( true); + } else { + mPrevWeek->hide(); + mNextWeek->hide(); } mSelectMonth->setFont( tfont ); @@ -129,7 +143,9 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mSelectMonth->setFixedWidth( maxwidth ); 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 ); // set up control frame layout @@ -137,4 +153,5 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); + ctrlLayout->addWidget( mPrevWeek, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); @@ -143,4 +160,5 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); + ctrlLayout->addWidget( mNextWeek, 3 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); @@ -149,4 +167,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); + connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); + connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); @@ -154,4 +174,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); + mPrevWeek->setFocusPolicy(NoFocus); + mNextWeek->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 93240a6..803c817 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -47,4 +47,6 @@ class NavigatorBar: public QWidget void goNextMonth(); void goPrevMonth(); + void goNextWeek(); + void goPrevWeek(); void goNextYear(); void goPrevYear(); @@ -57,4 +59,6 @@ class NavigatorBar: public QWidget QPushButton *mPrevMonth; QPushButton *mNextMonth; + QPushButton *mPrevWeek; + QPushButton *mNextWeek; QPushButton *mNextYear; QPushButton *mSelectMonth; |