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.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 188ad23..7e126d9 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -53,149 +53,152 @@
//bool globalFlagBlockPainting = false;
int globalFlagBlockAgenda = 0;
int globalFlagBlockLabel = 0;
int globalFlagBlockAgendaItemPaint = 1;
int globalFlagBlockAgendaItemUpdate = 1;
KOViewManager::KOViewManager( CalendarView *mainView ) :
QObject(), mMainView( mainView )
{
mCurrentView = 0;
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") showMonthView();
else if (view == "List") showListView();
else if (view == "Journal") showJournalView();
else if (view == "TimeSpan") showTimeSpanView();
else if (view == "Todo") showTodoView();
else {
showAgendaView();
}
}
-
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 0
- mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
-#endif
+
+ //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->showDay( date );
} 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 ) {
mMainView->dateNavigator()->blockSignals( true );
showMonthView();
mMainView->dateNavigator()->selectMonthByDate( date );
mMainView->dateNavigator()->blockSignals( false );
mMainView->dateNavigator()->selectDate( date );
} 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) {
- showWeekView();
+ } 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;
+ if ( mFlagShowNextxDays ) {
+ mCurrentAgendaView = 3 ;
+ }
+ } else
+ showWeekView();
} else if (view == 10) {
mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
}
-
-#if 0
- dateNavigator()->blockSignals( true );
- dateNavigator()->selectDate( d );
- dateNavigator()->blockSignals( false );
- mViewManager->showDayView();
-#endif
-
+ lastMode = view;
}
void KOViewManager::writeSettings(KConfig *config)
{
config->setGroup("General");
QString view;
if (mCurrentView == mWhatsNextView) view = "WhatsNext";
else if (mCurrentView == mMonthView) view = "Month";
else if (mCurrentView == mListView) view = "List";
else if (mCurrentView == mJournalView) view = "Journal";
else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
else if (mCurrentView == mTodoView) view = "Todo";
else view = "Agenda";
config->writeEntry("Current View",view);
if (mAgendaView) {
mAgendaView->writeSettings(config);
}
if (mTimeSpanView) {
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;
full = mMainView->leftFrame()->isVisible();