summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-16 22:08:18 (UTC)
committer zautrix <zautrix>2005-02-16 22:08:18 (UTC)
commit451b4de59893b5c0801a7bbb2f8cbe8e0266b324 (patch) (side-by-side diff)
treece3f535541583d37cfe951ddd8d7474770d9c374 /korganizer
parentb2cf8e9a08082539e0a5578a98766e5990783f9a (diff)
downloadkdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.zip
kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.gz
kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.bz2
month view fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigator.cpp15
-rw-r--r--korganizer/datenavigator.h3
-rw-r--r--korganizer/komonthview.cpp8
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koviewmanager.cpp62
-rw-r--r--korganizer/koviewmanager.h2
-rw-r--r--korganizer/mainwindow.cpp12
-rw-r--r--korganizer/navigatorbar.cpp26
-rw-r--r--korganizer/navigatorbar.h4
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
@@ -80,12 +80,18 @@ void DateNavigator::selectMonthByDate( const QDate & firstSelected )
void DateNavigator::selectMonth()
{
QDate date =mSelectedDates.first();
selectMonthByDate( date );
}
+void DateNavigator::selectMonthFromMonthview()
+{
+
+ QDate date =mSelectedDates.first().addDays( 7 );
+ selectMonthByDate( date );
+}
DateList DateNavigator::selectedDates()
{
return mSelectedDates;
}
@@ -255,12 +261,21 @@ void DateNavigator::selectNextMonth()
if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
selectMonthByDate( firstSelected );
else
selectWeekByDay( weekDay, firstSelected );
}
+void DateNavigator::selectPreviousWeek()
+{
+ selectDates( mSelectedDates.first().addDays( -7 ), datesCount() );
+}
+
+void DateNavigator::selectNextWeek()
+{
+ selectDates( mSelectedDates.first().addDays( 7 ), datesCount() );
+}
void DateNavigator::selectNextYear()
{
QDate firstSelected = mSelectedDates.first();
int weekDay = firstSelected.dayOfWeek();
firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 );
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h
index 4265e84..9742d41 100644
--- a/korganizer/datenavigator.h
+++ b/korganizer/datenavigator.h
@@ -64,15 +64,18 @@ class DateNavigator : public QObject
void selectToday();
void selectTodayMonth();
void selectPreviousYear();
void selectPreviousMonth();
void selectNextMonth();
+ void selectPreviousWeek();
+ void selectNextWeek();
void selectNextYear();
void selectMonth();
+ void selectMonthFromMonthview();
void selectMonthByDate( const QDate & );
void selectPrevious();
void selectNext();
void slotMonthSelect( int );
void slotDaySelect( QDate d );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index d0380e3..f9bc1ca 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -946,25 +946,27 @@ KOMonthView::~KOMonthView()
{
delete mContextMenu;
}
void KOMonthView::selectInternalWeekNum ( int n )
{
- switchView();
- emit selectWeekNum ( n );
+ switchView();
+ if ( !KOPrefs::instance()->mMonthViewWeek )
+ emit selectMonth ();
+ else
+ emit selectWeekNum ( n );
}
int KOMonthView::currentWeek()
{
if ( mShowWeekView )
return mWeekLabelsW[0]->getWeekNum();
return mWeekLabels[0]->getWeekNum();
}
void KOMonthView::switchView()
{
-
if ( selectedCell( ) )
selectedCell()->deselect();
mShowWeekView = !mShowWeekView;
KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
if ( clPending ) {
computeLayout();
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 03f9dc6..2f6f5dc 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -240,21 +240,22 @@ class KOMonthView: public KOEventView
void clearSelection();
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 *);
void viewChanged();
void updateDayLabels();
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 7efb6a6..5efc247 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -72,12 +72,13 @@ KOPrefs::KOPrefs() :
addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
addItemBool("ShowIconSearch",&mShowIconSearch,true);
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);
addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
addItemBool("ShowIconBack",&mShowIconBack,true);
addItemBool("ShowIconToday",&mShowIconToday,true);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fa69d52..e300067 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -168,12 +168,13 @@ class KOPrefs : public KPimPrefs
bool mShowIconNewTodo;
bool mShowIconNewEvent;
bool mShowIconSearch;
bool mShowIconList;
bool mShowIconDay1;
bool mShowIconDay5;
+ bool mShowIconDay6;
bool mShowIconDay7;
bool mShowIconMonth;
bool mShowIconTodoview;
bool mShowIconBackFast;
bool mShowIconBack;
bool mShowIconToday;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f8f6c1d..e22f096 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -85,13 +85,18 @@ KOrg::BaseView *KOViewManager::currentView()
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();
else if (view == "Todo") showTodoView();
else {
config->setGroup( "Views" );
@@ -204,13 +209,14 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
return;
}
bool full = 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 ;
mCurrentView = view;
// bool full = fullScreen;
bool isFull = !mMainView->leftFrame()->isVisible();
@@ -483,15 +489,15 @@ void KOViewManager::showNextXView()
mCurrentAgendaView = 3 ;
}
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);
// mMonthView->show();
// SIGNALS/SLOTS FOR MONTH VIEW
connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
@@ -514,12 +520,14 @@ void KOViewManager::showMonthView()
connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( moveIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
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()));
connect( mMonthView, SIGNAL(nextMonth() ),
mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
connect( mMonthView, SIGNAL(prevMonth() ),
@@ -529,31 +537,63 @@ void KOViewManager::showMonthView()
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( 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 & ) ) );
connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
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 );
}
void KOViewManager::showTodoView()
{
//mFlagShowNextxDays = false;
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 66ab138..8f0bf82 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -89,17 +89,19 @@ class KOViewManager : public QObject
void showAgendaView( bool fullScreen = false );
void showDayView();
void showWorkWeekView();
void showWeekView();
void showNextXView();
void showMonthView();
+ void showMonthViewWeek();
void showTodoView();
void showJournalView();
void showTimeSpanView();
private:
+ void createMonthView();
CalendarView *mMainView;
int mCurrentAgendaView;
KOAgendaView *mAgendaView;
KOListView *mListView;
KOMonthView *mMonthView;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ab0e4d6..16031b8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -710,12 +710,19 @@ void MainWindow::initActions()
configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
month_action->addTo( viewMenu );
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 );
todoview_action->addTo( viewMenu );
connect( todoview_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showTodoView() ) );
@@ -992,12 +999,14 @@ void MainWindow::initActions()
if (p-> mShowIconDay5)
day5_action->addTo( iconToolBar );
if (p-> mShowIconDay7)
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)
viewjournal_action->addTo( iconToolBar );
icon = loadPixmap( pathString + "2leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
@@ -1048,12 +1057,14 @@ void MainWindow::initActions()
if (p-> mShowIconList)
configureToolBarMenu->setItemChecked( 30, true );
if (p-> mShowIconDay1)
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)
configureToolBarMenu->setItemChecked( 70, true );
if (p-> mShowIconTodoview)
configureToolBarMenu->setItemChecked( 80, true );
@@ -1796,12 +1807,13 @@ void MainWindow::configureToolBar( int item )
p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
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 );
p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index b591232..934e153 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -86,28 +86,42 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
// Create forward navigation buttons
mNextMonth = new QPushButton( mCtrlFrame );
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") );
mSelectMonth = new QPushButton( mCtrlFrame );
// Create month name label
//selectMonth->setFont( tfont );
// selectMonth->setAlignment( AlignCenter );
//mDateLabel = new QLabel( selectMonth );
//mDateLabel->setFont( tfont );
//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
int i;
int maxwidth = 0;
QFontMetrics fm ( mSelectMonth->font() );
@@ -125,37 +139,45 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
size += 6;
maxwidth+= 6;
}
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
@@ -43,22 +43,26 @@ class NavigatorBar: public QWidget
void selectDates( const KCal::DateList & );
void selectMonth();
signals:
void goNextMonth();
void goPrevMonth();
+ void goNextWeek();
+ void goPrevWeek();
void goNextYear();
void goPrevYear();
void monthSelected( int );
private:
QFrame *mCtrlFrame;
QPushButton *mPrevYear;
QPushButton *mPrevMonth;
QPushButton *mNextMonth;
+ QPushButton *mPrevWeek;
+ QPushButton *mNextWeek;
QPushButton *mNextYear;
QPushButton *mSelectMonth;
//QLabel *mDateLabel;
};