author | zautrix <zautrix> | 2005-03-30 20:15:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 20:15:13 (UTC) |
commit | 28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (patch) (side-by-side diff) | |
tree | fce7d5a7d9f834f0df1f76a206537b976981cbbf /korganizer | |
parent | b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (diff) | |
download | kdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.zip kdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.tar.gz kdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.tar.bz2 |
fix
-rw-r--r-- | korganizer/koviewmanager.cpp | 120 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 3 |
2 files changed, 76 insertions, 47 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 548ffd3..f97aa98 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -1,526 +1,552 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qwidgetstack.h> #include <kconfig.h> #include <kglobal.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #include <qdatetime.h> #include "calendarview.h" #include "datenavigator.h" #include "kotodoview.h" #include "koagendaview.h" #include "kodialogmanager.h" #include "komonthview.h" #include "kolistview.h" #include "kowhatsnextview.h" #include "kojournalview.h" #include "kotimespanview.h" #include "koprefs.h" #include "navigatorbar.h" #include "kdatenavigator.h" #include "koviewmanager.h" //extern bool externFlagMonthviewBlockPainting; //bool globalFlagBlockPainting = false; int globalFlagBlockAgenda = 0; int globalFlagBlockLabel = 0; int globalFlagBlockAgendaItemPaint = 1; int globalFlagBlockAgendaItemUpdate = 1; KOViewManager::KOViewManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { mCurrentView = 0; - + flagResetViewChangeDate = 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") { 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 ) { //mMainView->dateNavigator()->selectDates( date, 7 ); 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; if ( mFlagShowNextxDays ) { mCurrentAgendaView = 3 ; } } else showWeekView(); } else if (view == 10) { mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); } } 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::showNextView() { + static int selecteddatescount = 0; + static QDate selecteddate = QDate ( 2000, 1, 1 ); + static QDate baseCycleDate = QDate ( 2000, 1, 1 ); + int newCount = mMainView->dateNavigator()->selectedDates().count(); + if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { + flagResetViewChangeDate = 1; + } + if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) + flagResetViewChangeDate = 1; + if ( flagResetViewChangeDate > 0 ) { + baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); + //qDebug("newCycle "); + } if (mCurrentView == mWhatsNextView) goto NEXT_X; - if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; - if (mCurrentView == mJournalView ) goto DAY_1; - if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; - if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; - if (mCurrentView == mAgendaView ) goto DAY_6; - if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; - if (mCurrentView == mMonthView ) goto LIST; - if (mCurrentView == mListView ) goto TODO; - - // if (mCurrentView == mTodoView ) goto LIST; - - + // if (mCurrentView == mTodoView ) goto NEXT; NEXT: - if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} + if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} NEXT_X: - if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} + if ( KOPrefs::instance()->mShowIconNextDays ) { + globalFlagBlockAgenda = 1; + if ( mCurrentAgendaView != 3 ) + mCurrentAgendaView = -1; + showAgendaView(KOPrefs::instance()->mFullViewMonth); + globalFlagBlockAgenda = 2; + mMainView->dateNavigator()->selectDates( baseCycleDate , + KOPrefs::instance()->mNextXDays ); + mFlagShowNextxDays = true; + mCurrentAgendaView = 3 ; + goto ENTE ; + } JOURNAL: - if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} + if ( KOPrefs::instance()->mShowIconJournal ) { + resetDateSilent( baseCycleDate , 1 ); + showJournalView() ;goto ENTE ;} DAY_1: - if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} + if ( KOPrefs::instance()->mShowIconDay1 ) { + resetDateSilent( baseCycleDate , 2 ); + showDayView() ;goto ENTE ;} DAY_5: - if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} + if ( KOPrefs::instance()->mShowIconDay5 ) { + resetDateSilent( baseCycleDate , 2 ); + showWorkWeekView() ;goto ENTE ;} DAY_7: - if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} + if ( KOPrefs::instance()->mShowIconDay7 ) { + resetDateSilent( baseCycleDate , 2 ); + showWeekView();goto ENTE ;} DAY_6: - if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} + if ( KOPrefs::instance()->mShowIconDay6 ) { + resetDateSilent( baseCycleDate , 2 ); + showMonthViewWeek();goto ENTE ;} MONTH: - if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} + if ( KOPrefs::instance()->mShowIconMonth ) { + resetDateSilent( baseCycleDate , 2 ); + showMonthView();goto ENTE ;} LIST: - if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} + if ( KOPrefs::instance()->mShowIconList ) { + resetDateSilent( baseCycleDate , 2 ); + showListView() ;goto ENTE ;} TODO: - if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} - - if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} - - if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} - - if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} - - if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} - - if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} - - if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} - - if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} - - if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} - - if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} - - //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} - - - + 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::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(); } 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 ); if ( callUpdateView ) mMainView->updateView(); if ( globalFlagBlockAgenda == 5 ) { globalFlagBlockAgenda = 4; globalFlagBlockAgendaItemPaint = 1; } mMainView->viewStack()->raiseWidget(mCurrentView); if ( globalFlagBlockAgenda == 4 ) { if ( mCurrentView == mAgendaView ) { //globalFlagBlockAgenda =1 ; if ( KOPrefs::instance()->mSetTimeToDayStartAt ) mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); else if ( KOPrefs::instance()->mCenterOnCurrentTime ) mAgendaView->setStartHour( QTime::currentTime ().hour() ); qApp->processEvents(); //qDebug("qApp->processEvents() "); globalFlagBlockAgenda = 0; mAgendaView->repaintAgenda(); } globalFlagBlockAgenda = 0; } emit signalAgendaView( mCurrentView == mAgendaView ); //qDebug("raiseCurrentView ende "); } void KOViewManager::updateView() { // qDebug("KOViewManager::updateView() "); // if we are updating mTodoView, we get endless recursion if ( mTodoView == mCurrentView ) return; if ( mCurrentView ) mCurrentView->updateView(); } void KOViewManager::updateView(const QDate &start, const QDate &end) { // kdDebug() << "KOViewManager::updateView()" << endl; if (mCurrentView) mCurrentView->showDates(start, end); if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); } void KOViewManager::updateWNview() { if ( mCurrentView == mWhatsNextView && mWhatsNextView ) mWhatsNextView->updateView(); } void KOViewManager::showWhatsNextView() { if (!mWhatsNextView) { mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::WhatsNextView"); mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); addView(mWhatsNextView); connect(this, SIGNAL( printWNV() ), mWhatsNextView, SLOT( printMe() ) ); } globalFlagBlockAgenda = 1; showView(mWhatsNextView, true ); //mWhatsNextView->updateView(); } void KOViewManager::slotprintWNV() { if (!mWhatsNextView) showWhatsNextView(); emit printWNV(); } void KOViewManager::showListView() { if (!mListView) { mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); addView(mListView); connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mListView, SIGNAL( signalNewEvent() ), mMainView, SLOT( newEvent() ) ); connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); } // bool temp = mFlagShowNextxDays; //globalFlagBlockPainting = true; globalFlagBlockAgenda = 1; if ( KOPrefs::instance()->mListViewMonthTimespan ) { mMainView->setBlockShowDates( true ); mMainView->dateNavigator()->selectMonth(); mMainView->setBlockShowDates( false ); } showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; } void KOViewManager::showAgendaView( bool fullScreen ) { mMainView->dialogManager()->hideSearchDialog(); // qDebug("KOViewManager::showAgendaView "); bool full; full = fullScreen; if (!mAgendaView) { full = false; mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); addView(mAgendaView); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); #endif connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); // SIGNALS/SLOTS FOR DAY/WEEK VIEW connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), mMainView, SLOT(newTodoDateTime(QDateTime,bool))); connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), mMainView, SLOT(newEvent(QDateTime))); connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), mMainView, SLOT(newEvent(QDateTime,QDateTime))); connect(mAgendaView,SIGNAL(newEventSignal(QDate)), mMainView, SLOT(newEvent(QDate))); connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect(mAgendaView, SIGNAL( toggleExpand() ), mMainView, SLOT( toggleExpand() ) ); connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, SLOT( updateTodo( Todo *, int ) ) ); connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), mMainView, SIGNAL( todoModified( Todo *, int ))); connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); mAgendaView->readSettings(); mAgendaView->updateConfig(); } showView( mAgendaView, full); } void KOViewManager::showDayView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockLabel = 1; globalFlagBlockAgenda = 1; if ( mCurrentAgendaView != 1 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); globalFlagBlockAgenda = 2; globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectDates( 1 ); mCurrentAgendaView = 1 ; } void KOViewManager::showWorkWeekView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockAgenda = 1; globalFlagBlockLabel = 1; if ( mCurrentAgendaView != 5 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); globalFlagBlockAgenda = 2; globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectWorkWeek(); mCurrentAgendaView = 5 ; diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 1d565a6..8dc03e0 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -1,123 +1,126 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef KOVIEWMANAGER_H #define KOVIEWMANAGER_H #include <qobject.h> #include <korganizer/baseview.h> class CalendarView; class KOListView; class KOAgendaView; class KOMonthView; class KOTimeSpanView; class KOTodoView; class KOWhatsNextView; class KOJournalView; using namespace KCal; /** This class manages the views of the calendar. It owns the objects and handles creation and selection. */ class KOViewManager : public QObject { Q_OBJECT public: KOViewManager( CalendarView * ); virtual ~KOViewManager(); /** changes the view to be the currently selected view */ void showView(KOrg::BaseView *, bool fullScreen = false ); void updateWNview(); void readSettings(KConfig *config); void writeSettings(KConfig *config); bool showsNextDays(); /** Read which view was shown last from config file */ void readCurrentView(KConfig *); /** Write which view is currently shown to config file */ void writeCurrentView(KConfig *); KOrg::BaseView *currentView(); void setDocumentId( const QString & ); void updateView( const QDate &start, const QDate &end ); void raiseCurrentView( bool fullScreen = false , bool updateView = false); void addView(KOrg::BaseView *); Incidence *currentSelection(); QDate currentSelectionDate(); KOAgendaView *agendaView() const { return mAgendaView; } signals: void printWNV(); void signalFullScreen( bool ); void signalAgendaView( bool ); public slots: void slotprintWNV(); void showNextView(); void showMonth( const QDate & ); void showDateView( int, QDate ); void updateView(); void showWhatsNextView(); void showListView(); 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 resetDateSilent( QDate date , int days ); + int flagResetViewChangeDate; + QDate currentViewChangeDate; void createMonthView(); CalendarView *mMainView; int mCurrentAgendaView; KOAgendaView *mAgendaView; KOListView *mListView; KOMonthView *mMonthView; KOTodoView *mTodoView; KOWhatsNextView *mWhatsNextView; KOJournalView *mJournalView; KOTimeSpanView *mTimeSpanView; KOrg::BaseView *mCurrentView; // currently active event view int mAgendaViewMode; bool mFlagShowNextxDays; }; #endif |