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.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 5d9af6d..7b307f7 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -65,96 +65,97 @@ KOViewManager::KOViewManager( CalendarView *mainView ) :
mWhatsNextView = 0;
mTodoView = 0;
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") {
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());
if (view != 9)
lastMode = 0;
//qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
bool savemFlagShowNextxDays = mFlagShowNextxDays;
mFlagShowNextxDays = false;
if ( view == 3 ) {
//mCurrentAgendaView = 1 ;
lastDate = mMainView->dateNavigator()->selectedDates().first();
lastCount = mMainView->dateNavigator()->selectedDates().count();
lastNDMode = savemFlagShowNextxDays;
mMainView->dateNavigator()->selectDate( date );
lastMode = 1;
mCurrentAgendaView = 1 ;
} else if (view == 4 ) {
mCurrentAgendaView = 7 ;
mMainView->dateNavigator()->selectDates( date, 7 );
} else if (view == 5 ) {
mCurrentAgendaView = 14 ;
mMainView->dateNavigator()->selectDates( date, 14);
} else if (view == 6 ) {
resetDateSilent( date,1);
showMonthView();
} else if (view == 7 ) {
mMainView->dateNavigator()->selectDate( date );
showJournalView();
} else if (view == 8 ) {
globalFlagBlockAgenda = 1;
if ( mCurrentAgendaView != 3 )
mCurrentAgendaView = -1;
showAgendaView(KOPrefs::instance()->mFullViewMonth);
globalFlagBlockAgenda = 2;
mMainView->dateNavigator()->selectDates( date ,
KOPrefs::instance()->mNextXDays );
mFlagShowNextxDays = true;
mCurrentAgendaView = 3 ;
} if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
if ( lastMode ) {
mCurrentAgendaView = lastCount ;
mMainView->dateNavigator()->selectDates( lastDate, lastCount);
mFlagShowNextxDays = lastNDMode;
@@ -237,96 +238,102 @@ void KOViewManager::showNextView()
DAY_1:
if ( KOPrefs::instance()->mShowIconDay1 ) {
resetDateSilent( baseCycleDate , 2 );
showDayView() ;goto ENTE ;}
DAY_5:
if ( KOPrefs::instance()->mShowIconDay5 ) {
resetDateSilent( baseCycleDate , 2 );
showWorkWeekView() ;goto ENTE ;}
DAY_7:
if ( KOPrefs::instance()->mShowIconDay7 ) {
resetDateSilent( baseCycleDate , 2 );
showWeekView();goto ENTE ;}
DAY_6:
if ( KOPrefs::instance()->mShowIconDay6 ) {
resetDateSilent( baseCycleDate , 2 );
showMonthViewWeek();goto ENTE ;}
MONTH:
if ( KOPrefs::instance()->mShowIconMonth ) {
resetDateSilent( baseCycleDate , 2 );
showMonthView();goto ENTE ;}
LIST:
if ( KOPrefs::instance()->mShowIconList ) {
resetDateSilent( baseCycleDate , 2 );
showListView() ;goto ENTE ;}
TODO:
if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
//if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
ENTE:
flagResetViewChangeDate = 0;
selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
selecteddate = mMainView->dateNavigator()->selectedDates().first();
}
void KOViewManager::resetDateSilent( QDate date , int days )
{
mMainView->dateNavigator()->blockSignals( true );
mMainView->dateNavigator()->selectDates( date , days );
mMainView->dateNavigator()->blockSignals( false );
}
+void KOViewManager::setDefaultCalendar(int)
+{
+ if ( mJournalView && mCurrentView == mJournalView )
+ mJournalView->updateView();
+}
+
void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
{
if ( flagResetViewChangeDate < 10 )
++flagResetViewChangeDate;
//mFlagShowNextxDays = false;
//if(view == mCurrentView) return;
if ( view == 0 ) {
view = mCurrentView;
if ( view == 0 )
return;
}
bool callupdate = !(view == mCurrentView);
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, callupdate );
mMainView->adaptNavigationUnits();
mMainView->updateUnmanagedViews();
}
void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
{
mCurrentAgendaView = 0;
if ( fullScreen ) {
mMainView->leftFrame()->hide();
} else {
mMainView->leftFrame()->show();
}
//if ( mCurrentView == mMonthView ) qApp->processEvents();
emit signalFullScreen( !fullScreen );