summaryrefslogtreecommitdiffabout
path: root/korganizer/koviewmanager.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp62
1 files changed, 51 insertions, 11 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f8f6c1d..e22f096 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -79,25 +79,30 @@ KOViewManager::~KOViewManager()
KOrg::BaseView *KOViewManager::currentView()
{
return mCurrentView;
}
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" );
int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
mCurrentAgendaView = dateCount;
showAgendaView();
mCurrentAgendaView = dateCount;
#ifdef DESKTOP_VERSION
QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
@@ -198,25 +203,26 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
//mFlagShowNextxDays = false;
//if(view == mCurrentView) return;
if ( view == 0 ) {
view = mCurrentView;
if ( view == 0 )
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();
if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
full = true;
if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
full = false;
}
if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
@@ -477,27 +483,27 @@ void KOViewManager::showNextXView()
mCurrentAgendaView = -1;
showAgendaView(KOPrefs::instance()->mFullViewMonth);
globalFlagBlockAgenda = 2;
mMainView->dateNavigator()->selectDates( QDate::currentDate(),
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
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)),
mMainView, SLOT(newEvent(QDateTime)));
connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
@@ -508,58 +514,92 @@ void KOViewManager::showMonthView()
mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
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() ),
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( 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;
if ( !mTodoView ) {
mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
"KOViewManager::TodoView" );
addView( mTodoView );
// QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );