From 451b4de59893b5c0801a7bbb2f8cbe8e0266b324 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 16 Feb 2005 22:08:18 +0000 Subject: month view fixes --- diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index a3ea5ee..3d8edfc 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -4,6 +4,8 @@ Info about the changes in new versions of KDE-Pim/Pi Fixed a problem in dependency info in the ipk files for the Zaurus. +Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. + ********** VERSION 2.0.7 ************ diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 2d4cb74..5f1bee4 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1271,8 +1271,8 @@ { "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, { "

Start on: %1

","

Start am: %1

" }, -{ "","" }, -{ "","" }, +{ "List week view","Listenwochenansicht" }, +{ "List week","Listenwochenansicht" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index 8b7c993..b0eac51 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp @@ -83,6 +83,12 @@ void DateNavigator::selectMonth() QDate date =mSelectedDates.first(); selectMonthByDate( date ); } +void DateNavigator::selectMonthFromMonthview() +{ + + QDate date =mSelectedDates.first().addDays( 7 ); + selectMonthByDate( date ); +} DateList DateNavigator::selectedDates() { @@ -258,6 +264,15 @@ void DateNavigator::selectNextMonth() selectWeekByDay( weekDay, firstSelected ); } +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 @@ -67,9 +67,12 @@ class DateNavigator : public QObject void selectPreviousYear(); void selectPreviousMonth(); void selectNextMonth(); + void selectPreviousWeek(); + void selectNextWeek(); void selectNextYear(); void selectMonth(); + void selectMonthFromMonthview(); void selectMonthByDate( const QDate & ); void selectPrevious(); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index d0380e3..f9bc1ca 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -949,8 +949,11 @@ KOMonthView::~KOMonthView() void KOMonthView::selectInternalWeekNum ( int n ) { - switchView(); - emit selectWeekNum ( n ); + switchView(); + if ( !KOPrefs::instance()->mMonthViewWeek ) + emit selectMonth (); + else + emit selectWeekNum ( n ); } int KOMonthView::currentWeek() @@ -961,7 +964,6 @@ int KOMonthView::currentWeek() } void KOMonthView::switchView() { - if ( selectedCell( ) ) selectedCell()->deselect(); mShowWeekView = !mShowWeekView; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 03f9dc6..2f6f5dc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -243,15 +243,16 @@ class KOMonthView: public KOEventView void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); + void switchView(); protected slots: void selectInternalWeekNum ( int ); - void switchView(); void processSelectionChange(); signals: void nextMonth(); void prevMonth(); void selectWeekNum ( int ); + void selectMonth (); void showDaySignal( QDate ); protected: void resizeEvent(QResizeEvent *); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7efb6a6..5efc247 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -75,6 +75,7 @@ KOPrefs::KOPrefs() : addItemBool("ShowIconList",&mShowIconList,true); addItemBool("ShowIconDay1",&mShowIconDay1,true); addItemBool("ShowIconDay5",&mShowIconDay5,true); + addItemBool("ShowIconDay6",&mShowIconDay6,true); addItemBool("ShowIconDay7",&mShowIconDay7,true); addItemBool("ShowIconMonth",&mShowIconMonth,true); addItemBool("ShowIconTodoview",&mShowIconTodoview,true); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index fa69d52..e300067 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -171,6 +171,7 @@ class KOPrefs : public KPimPrefs bool mShowIconList; bool mShowIconDay1; bool mShowIconDay5; + bool mShowIconDay6; bool mShowIconDay7; bool mShowIconMonth; bool mShowIconTodoview; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f8f6c1d..e22f096 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -88,7 +88,12 @@ void KOViewManager::readSettings(KConfig *config) config->setGroup("General"); 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(); else if (view == "TimeSpan") showTimeSpanView(); @@ -207,7 +212,8 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) if(view == mCurrentView && view != mWhatsNextView ) { if ( mCurrentAgendaView < 0 ) return; - full = mMainView->leftFrame()->isVisible(); + if ( view != mMonthView ) + full = mMainView->leftFrame()->isVisible(); } else { if ( view == mMonthView && mMonthView) ;//mMonthView->skipResize = true ; @@ -486,9 +492,9 @@ bool KOViewManager::showsNextDays() { return mFlagShowNextxDays; } -void KOViewManager::showMonthView() - { - if (!mMonthView) { +void KOViewManager::createMonthView() +{ +if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); addView(mMonthView); @@ -517,6 +523,8 @@ void KOViewManager::showMonthView() mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 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 ) ) ); connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); @@ -532,6 +540,10 @@ void KOViewManager::showMonthView() mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 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 & ) ), mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); @@ -541,16 +553,44 @@ void KOViewManager::showMonthView() mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); } +} +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 @@ -92,11 +92,13 @@ class KOViewManager : public QObject void showWeekView(); void showNextXView(); void showMonthView(); + void showMonthViewWeek(); void showTodoView(); void showJournalView(); void showTimeSpanView(); private: + void createMonthView(); CalendarView *mMainView; int mCurrentAgendaView; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ab0e4d6..16031b8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -713,6 +713,13 @@ void MainWindow::initActions() connect( month_action, SIGNAL( activated() ), 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 ); QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); @@ -995,6 +1002,8 @@ void MainWindow::initActions() day7_action->addTo( iconToolBar ); if (p-> mShowIconMonth) month_action->addTo( iconToolBar ); + if (p-> mShowIconDay6) + day6_action->addTo( iconToolBar ); if (p-> mShowIconTodoview) todoview_action->addTo( iconToolBar ); if (p-> mShowIconJournal) @@ -1051,6 +1060,8 @@ void MainWindow::initActions() configureToolBarMenu->setItemChecked( 40, true ); if (p-> mShowIconDay5) configureToolBarMenu->setItemChecked( 50, true ); + if (p-> mShowIconDay6) + configureToolBarMenu->setItemChecked( 75, true ); if (p-> mShowIconDay7) configureToolBarMenu->setItemChecked( 60, true ); if (p-> mShowIconMonth) @@ -1799,6 +1810,7 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 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 ); p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index b591232..934e153 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -89,6 +89,15 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 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") ); QToolTip::add( mNextYear, i18n("Next Year") ); @@ -101,10 +110,15 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam //mDateLabel->setAlignment( AlignCenter ); 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 ); // Set minimum width to width of widest month name label @@ -128,31 +142,39 @@ 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 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); + ctrlLayout->addWidget( mPrevWeek, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); + ctrlLayout->addWidget( mNextWeek, 3 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 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() ) ); mPrevYear->setFocusPolicy(NoFocus); mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); + mPrevWeek->setFocusPolicy(NoFocus); + mNextWeek->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 93240a6..803c817 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -46,6 +46,8 @@ class NavigatorBar: public QWidget signals: void goNextMonth(); void goPrevMonth(); + void goNextWeek(); + void goPrevWeek(); void goNextYear(); void goPrevYear(); void monthSelected( int ); @@ -56,6 +58,8 @@ class NavigatorBar: public QWidget QPushButton *mPrevYear; QPushButton *mPrevMonth; QPushButton *mNextMonth; + QPushButton *mPrevWeek; + QPushButton *mNextWeek; QPushButton *mNextYear; QPushButton *mSelectMonth; -- cgit v0.9.0.2