summaryrefslogtreecommitdiffabout
path: root/korganizer/koviewmanager.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp50
1 files changed, 45 insertions, 5 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f8f6c1d..e22f096 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -67,49 +67,54 @@ KOViewManager::KOViewManager( CalendarView *mainView ) :
mAgendaView = 0;
mMonthView = 0;
mListView = 0;
mJournalView = 0;
mTimeSpanView = 0;
mCurrentAgendaView = 0 ;
mFlagShowNextxDays = false;
}
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() ) );
#endif
}
}
void KOViewManager::showDateView( int view, QDate date)
{
static int lastMode = 0;
static int lastCount = 0;
static bool lastNDMode = false;
static QDate lastDate;
//qDebug("date %d %s", view, date.toString().latin1());
@@ -186,48 +191,49 @@ void KOViewManager::writeSettings(KConfig *config)
mTimeSpanView->writeSettings(config);
}
if (mListView) {
mListView->writeSettings(config);
}
if (mTodoView) {
mTodoView->saveLayout(config,"Todo View");
}
}
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;
+ 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();
//raiseCurrentView( full );
mMainView->processIncidenceSelection( 0 );
//mMainView->updateView();
raiseCurrentView( full, true );
mMainView->adaptNavigationUnits();
}
void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
{
mCurrentAgendaView = 0;
if ( fullScreen ) {
@@ -465,113 +471,147 @@ void KOViewManager::showWeekView()
qApp->processEvents();
globalFlagBlockAgenda = 2;
globalFlagBlockLabel = 0;
mMainView->dateNavigator()->selectWeek();
mCurrentAgendaView = 7 ;
}
void KOViewManager::showNextXView()
{
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 3 )
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()
+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 *)));
connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
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;
+ bool full = true;
+ if ( mCurrentView == mMonthView)
+ full = mMainView->leftFrame()->isVisible();
// if(mMonthView == mCurrentView) return;
- if ( KOPrefs::instance()->mMonthViewWeek )
- mMainView->dateNavigator()->selectWeek();
+ 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 );
// SIGNALS/SLOTS FOR TODO VIEW
connect( mTodoView, SIGNAL( newTodoSignal() ),
mMainView, SLOT( newTodo() ) );
connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
mMainView, SLOT( newSubTodo( Todo *) ) );
connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
mMainView, SLOT( showTodo( Todo * ) ) );
connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
mMainView, SLOT( editTodo( Todo * ) ) );
connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
mMainView, SLOT( deleteTodo( Todo * ) ) );