-rw-r--r-- | bin/kdepim/WhatsNew.txt | 8 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 2 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.h | 1 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 3 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 10 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 3 |
8 files changed, 29 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 1c2bff8..6f8b041 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,183 +1,189 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.0.21 ************ Fixed another SMTP problem in OM/Pi. Some small changed in the new datenavigator in KO/Pi. Changed default setting for new filter in KA/Pi to "exclude categories". -Changed the default font size for 640x480 display +Changed the default font size for 640x480 display . +Changed popup menu behaviour in agenda and list view. +Fixed some layout problems of the date label size in the month view. +Made month view update faster. +Made first datenavigator repainting faster. +Changed the title of the event/todo edit dialogs. + ********** VERSION 2.0.20 ************ Two small fixes in OM/Pi. Better resizing of the new datenavigator in KO/Pi. ********** VERSION 2.0.19 ************ KO/Pi: Enhancements and bugfixes in the new datenavigator. Bugfix in this changelog: The datenavigator was changed in version 2.0.18, not the datepicker. ********** VERSION 2.0.18 ************ KO/Pi: Fixed some minor problems. Cleaned up the KO/Pi config dialog. Fixed problem moving events in aganda view. Made datepicker scaleable, i.e. if the datenavigator shows now a datenavigator matrix depending on its size. Birthdays are now displayed green in the datenavigator. What'sThis Help in datenavigator shows all events of the day. OM/Pi: Updated the backend mail library to the latest version. Please backup your mail before using this version. ********** VERSION 2.0.17 ************ KO/Pi: Tooltips in month view were not sorted. Fixed. Daylabel in agenda view ( for display of one day ) was too short. Fixed. Conflict display dialog for syncing was not on top of other windows. Fixed. Fixed some minor problems. Fixed an endless loop when importing vcs file with RESOURCES entry. ********** VERSION 2.0.16 ************ OM/Pi: Fixed the SMTP account setting the option. Fixed something in mail sending. KO/Pi: Added possibility to export selected events/todos as vcal file. ********** VERSION 2.0.15 ************ PwM/Pi: Added keyboard shorcuts for - toggling summary view (space bar) - delete item (delete + backspace key) - add new item ( i + n key) Fixed length of info in the title. KO/Pi-KA/Pi: Changed "ME" menu bar entry to an icon. KO/Pi: Fixed two minor bugs in displaying todos. If in month view a cell is selected, the key shortcut "d" shows now that date. Added complete info for a todo in month view as an icon left of the text. Fixed problems of displaying data when "<" or ">" are used in summary/location/description. Fixed problem of search dialog size when switching displays. Cancel key now closes date picker. Rearranged KO/Pi file menu structure. OM/Pi: Added to the SMTP account setting the option "No secure connection". You have to configure your SMTP accounts again, sorry. KA/Pi: Added support for importing quoted-printable. Support was added by Peter P.. Thanks, Peter! ********** VERSION 2.0.14 ************ Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. Fixed bug in KO/Pi todo printing. Made Qtopia calendar import possible on desktop . ********** VERSION 2.0.13 ************ Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". OM/Pi: Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. Added missing German translation. Added warning if path is specified in local folder settings of account config. ********** VERSION 2.0.12 ************ KO/Pi: Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. Fixed problem in pi-sync mode when wrong password was sent. OM/Pi: Fixed a crash when displaying mails with "Show mail as html" was checked in the config. Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. ********** VERSION 2.0.11 ************ Fixed some problems in pi-sync mode (e.g. details of events were not synced properly) ********** VERSION 2.0.10 ************ KO/Pi: In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. This is fixed. Changed the search dialog a bit to make it more user friendly. (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). Added config option to hide the week number in KO/Pi toolbar. ********** VERSION 2.0.9 ************ Made month view icons for multiday events a bit nicer. Some minor fixes in KO/Pi (e.g. go to today did not work for new week view properly). ********** VERSION 2.0.8 ************ Fixed a problem in dependency info in the ipk files for the Zaurus. Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. Added a "go today" button to the datepicker. Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) and made it configureable to show these values. Fixed a problem for events (from external iCal files) that do have a duration but no end date. ********** VERSION 2.0.7 ************ Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. Fixed a problem in OM/Pi when trying to login to some IMAP servers (like the IMAP server of Apple: mail.mac.com ) Added recurring todos to KO/Pi. ********** VERSION 2.0.6 ************ Stable release 2.0.6! Some bugfixes in the pi-sync mode. Added German translation for pi-sync mode. KO/Pi: Made the todolist using alternate background. Other minor fixes in KO/Pi. You can find the complete changelog from version 1.7.7 to 2.0.5 in the source package or on http://www.pi-sync.net/html/changelog.html diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6ed6a1c..92fd59c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -181,384 +181,388 @@ class KOCatPrefs : public QDialog QDialog( parent, name, true ) { setCaption( i18n("Manage new Categories") ); QVBoxLayout* lay = new QVBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); lay->addWidget( lab ); QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; addCatBut = new QRadioButton(i18n("Add to category list"), format ); new QRadioButton(i18n("Remove from Events/Todos"), format ); addCatBut->setChecked( true ); QPushButton * ok = new QPushButton( i18n("OK"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); resize( 200, 200 ); } bool addCat() { return addCatBut->isChecked(); } private: QRadioButton* addCatBut; }; CalendarView::CalendarView( CalendarResources *calendar, QWidget *parent, const char *name ) : CalendarViewBase( parent, name ), mCalendar( calendar ), mResourceManager( calendar->resourceManager() ) { mEventEditor = 0; mTodoEditor = 0; init(); } CalendarView::CalendarView( Calendar *calendar, QWidget *parent, const char *name ) : CalendarViewBase( parent, name ), mCalendar( calendar ), mResourceManager( 0 ) { mEventEditor = 0; mTodoEditor = 0; init(); } void CalendarView::init() { setFocusPolicy ( WheelFocus ); mViewerCallerIsSearchDialog = false; mBlockShowDates = false; beamDialog = new KOBeamPrefs(); mDatePickerMode = 0; mCurrentSyncDevice = ""; writeLocale(); mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); mEventViewerDialog = 0; mModified = false; mReadOnly = false; mSelectedIncidence = 0; mCalPrinter = 0; mFilters.setAutoDelete(true); mCalendar->registerObserver( this ); // TODO: Make sure that view is updated, when calendar is changed. mStorage = new FileStorage( mCalendar ); mNavigator = new DateNavigator( this, "datevav", mViewManager ); QBoxLayout *topLayout = (QBoxLayout*)layout(); #ifndef KORG_NOSPLITTER // create the main layout frames. mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); topLayout->addWidget(mPanner); mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, "CalendarView::LeftFrame"); mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); mDateNavigator = new DateNavigatorContainer( mLeftSplitter, "CalendarView::DateNavigator" ); mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); mTodoList->setNavigator( mNavigator ); mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); #ifdef KORG_NORESOURCEVIEW mResourceView = 0; #else if ( mResourceManager ) { mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); mResourceView->updateView(); connect( mResourceView, SIGNAL( resourcesChanged() ), SLOT( updateView() ) ); } else { mResourceView = 0; } #endif QWidget *rightBox = new QWidget( mPanner ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 1 ); mLeftFrame = mLeftSplitter; #else //QWidget *mainBox = new QWidget( this ); //QWidget *leftFrame = new QWidget( mainBox ); //QBoxLayout * mainBoxLayout; if ( KOPrefs::instance()->mVerticalScreen ) { //mainBoxLayout = new QVBoxLayout(mainBox); //leftFrameLayout = new QHBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { //mainBoxLayout = new QHBoxLayout(mainBox); //leftFrameLayout = new QVBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); //QBoxLayout * leftFrameLayout; topLayout->addWidget( mMainFrame ); //mainBoxLayout->addWidget (mLeftFrame); mDateNavigator = new DateNavigatorContainer( mLeftFrame, "CalendarView::DateNavigator" ); #if 0 // FIXME mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, "CalendarView::DateNavigator", QDate::currentDate()); #endif // mDateNavigator->blockSignals( true ); //leftFrameLayout->addWidget( mDateNavigator ); mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); mTodoList->setNavigator( mNavigator ); #if 0 if ( QApplication::desktop()->width() < 480 ) { leftFrameLayout->addWidget(mFilterView); leftFrameLayout->addWidget(mTodoList, 2 ); } else { leftFrameLayout->addWidget(mTodoList,2 ); leftFrameLayout->addWidget(mFilterView ); } #endif mFilterView->hide(); QWidget *rightBox = new QWidget( mMainFrame ); //mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 10 ); //mLeftFrame = (QWidget *)leftFrame; if ( KOPrefs::instance()->mVerticalScreen ) { //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); } else { //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) mDateNavigator->hide(); //qDebug("Calendarview Size %d %d ", width(), height()); #endif connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( showDates( const KCal::DateList & ) ) ); connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); + + connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), + mViewManager, SLOT( showMonth( const QDate & ) ) ); + connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mDateNavigator, SIGNAL( goNextYear() ), mNavigator, SLOT( selectNextYear() ) ); connect( mDateNavigator, SIGNAL( goPrevMonth() ), mNavigator, SLOT( selectPreviousMonth() ) ); connect( mDateNavigator, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); connect( mDateNavigator, SIGNAL( goPrevious() ), mNavigator, SLOT( selectPrevious() ) ); connect( mDateNavigator, SIGNAL( goNext() ), mNavigator, SLOT( selectNext() ) ); connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), mNavigator, SLOT( slotMonthSelect( int ) ) ); connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); #if 0 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), SLOT( incidenceAdded( Incidence *) ) ); #endif // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); connect( this, SIGNAL( configChanged() ), mDateNavigator, SLOT( updateConfig() ) ); connect( mTodoList, SIGNAL( newTodoSignal() ), SLOT( newTodo() ) ); connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), SLOT( newSubTodo( Todo * ) ) ); connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), SLOT( editTodo( Todo * ) ) ); connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), SLOT( showTodo( Todo *) ) ); connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), SLOT( deleteTodo( Todo *) ) ); connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); connect( mTodoList, SIGNAL( purgeCompletedSignal() ), SLOT( purgeCompleted() ) ); connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), SIGNAL( todoModified( Todo *, int ) ) ); connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), this, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), this, SLOT (cancelIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), this, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), this, SLOT ( beamIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), this, SLOT ( todo_unsub( Todo * ) ) ); connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), this, SLOT ( todo_resub( Todo *,Todo * ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, SLOT( updateTodo( Todo *, int ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), this, SLOT( changeTodoDisplay( Todo *, int ) ) ); connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); connect(QApplication::clipboard(),SIGNAL(dataChanged()), SLOT(checkClipboard())); connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processTodoListSelection( Incidence * ) ) ); connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); // kdDebug() << "CalendarView::CalendarView() done" << endl; mDateFrame = new QVBox(0,0,WType_Popup); //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); mDateFrame->setLineWidth(3); mDateFrame->hide(); mDateFrame->setCaption( i18n( "Pick a date to display")); mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); mEventEditor = mDialogManager->getEventEditor(); mTodoEditor = mDialogManager->getTodoEditor(); mFlagEditDescription = false; mSuspendTimer = new QTimer( this ); mAlarmTimer = new QTimer( this ); mRecheckAlarmTimer = new QTimer( this ); connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); mAlarmDialog = new AlarmDialog( this ); connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); mAlarmDialog->setServerNotification( false ); mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); #ifndef DESKTOP_VERSION //US listen for arriving address resultsets connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); #endif mDateNavigator->setCalendar( mCalendar ); } CalendarView::~CalendarView() { // kdDebug() << "~CalendarView()" << endl; //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; delete mViewManager; delete mStorage; delete mDateFrame ; delete beamDialog; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } void CalendarView::showDay( QDate d ) { dateNavigator()->blockSignals( true ); dateNavigator()->selectDate( d ); dateNavigator()->blockSignals( false ); mViewManager->showDayView(); //dateNavigator()->selectDate( d ); } void CalendarView::timerAlarm() { //qDebug("CalendarView::timerAlarm() "); computeAlarm(mAlarmNotification ); } void CalendarView::suspendAlarm() { //qDebug(" CalendarView::suspendAlarm() "); computeAlarm(mSuspendAlarmNotification ); } void CalendarView::startAlarm( QString mess , QString filename) { mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); } void CalendarView::checkNextTimerAlarm() { mCalendar->checkAlarmForIncidence( 0, true ); } void CalendarView::computeAlarm( QString msg ) { QString mess = msg; QString mAlarmMessage = mess.mid( 9 ); QString filename = MainWindow::resourcePath(); filename += "koalarm.wav"; QString tempfilename; if ( mess.left( 13 ) == "suspend_alarm") { bool error = false; int len = mess.mid( 13 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 13, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( ! error ) { filename = tempfilename; } mAlarmMessage = mess.mid( 13+len+3 ); //qDebug("suspend file %s ",tempfilename.latin1() ); startAlarm( mAlarmMessage, filename); return; } diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 11dc592..edeebdf 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -1,265 +1,267 @@ /* This file is part of KOrganizer. Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 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 <kdebug.h> #include <klocale.h> //#include "koglobals.h" #include "navigatorbar.h" #include "kdatenavigator.h" #include <kcalendarsystem.h> #include "datenavigatorcontainer.h" #include "koprefs.h" DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, const char *name ) : QWidget( parent, name ), mCalendar( 0 ), mHorizontalCount( 1 ), mVerticalCount( 1 ) { mResizeEnabled = false; mExtraViews.setAutoDelete( true ); mNavigatorView = new KDateNavigator( this, name ); mNavigatorView->hide(); connectNavigatorView( mNavigatorView ); //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); mLastDisplayedDN = 0; mUpdateTimer; mUpdateTimer = new QTimer( this ); connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); mFirstSelectedDate = QDate::currentDate(); mSelectedDateCount = 1; } DateNavigatorContainer::~DateNavigatorContainer() { } void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) { connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), SIGNAL( datesSelected( const KCal::DateList & ) ) ); #if 0 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); #endif connect( v, SIGNAL( weekClicked( const QDate & ) ), SIGNAL( weekClicked( const QDate & ) ) ); + connect( v, SIGNAL( showMonth( const QDate & ) ), + SIGNAL( showMonth( const QDate & ) ) ); connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); } void DateNavigatorContainer::slotgoNextYear() { jumpMonth( 12 ); emit goNextYear(); } void DateNavigatorContainer::slotgoPrevYear() { jumpMonth( -12 ); emit goPrevYear(); } void DateNavigatorContainer::slotgoPrevMonth() { jumpMonth( -1 ); emit goPrevMonth(); } void DateNavigatorContainer::slotgoNextMonth() { jumpMonth( 1 ); emit goNextMonth(); } void DateNavigatorContainer::jumpMonth( int month ) { QDate baseDate = mNavigatorView->baseDate(); computeMonthSelected( baseDate.month() + month, false ); } void DateNavigatorContainer::slotMonthSelected( int month ) { computeMonthSelected( month, true ); } void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) { //qDebug("slotMonthSelected %d ", month); QDate baseDate = mNavigatorView->baseDate(); if ( baseDate.month() == month ) return; //qDebug("month %d %d ",baseDate.month(),month); QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); date = date.addDays( -(baseDate.month()-month ) *30 ); QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); //qDebug("NEW BASE %s", newBase.toString().latin1()); mNavigatorView->setBaseDate( newBase ); QDate last = lastAvailableDate(); QDate first = firstAvailableDate(); QDate selFirst = mFirstSelectedDate; QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); if ( selFirst >= first && selLast <= last ) { setBaseDates(); if ( forceEmit ) updateDayMatrixDates(); } else { setBaseDates(); if ( forceEmit ) updateDayMatrixDates(); if ( forceEmit ) emit monthSelected( month ); } } void DateNavigatorContainer::setCalendar( Calendar *cal ) { mCalendar = cal; mNavigatorView->setCalendar( cal ); for( uint i = 0; i < mLastDisplayedDN; ++i ) { KDateNavigator *n = mExtraViews.at( i ); n->setCalendar( cal ); } } void DateNavigatorContainer::checkUpdateDayMatrixDates() { //qDebug("KODNC: wid %d hei %d ", width(), height()); mUpdateTimer->stop(); //return; if ( width() < 3 || height() < 3 ) return; static int lastWid = 0; static int lastHei = 0; if ( lastWid == width() && height() == lastHei ) { qDebug("KODNC: No layout computing needed. "); } else { lastWid = width(); lastHei = height(); QSize minSize = mNavigatorView->yourSizeHint(); int verticalCount = size().height() / minSize.height(); int horizontalCount = size().width() / minSize.width(); //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); bool fontchange = false; if ( horizontalCount == 1) horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); QFont fo; if ( horizontalCount != mHorizontalCount || verticalCount != mVerticalCount ) { uint count = horizontalCount * verticalCount; if ( count == 0 ) { bool ok; fo = mNavigatorView->yourFontHint( size() , &ok ); //mNavigatorView->resize( size() ); //if ( ! ok ) // return; int butt = 2; horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); if ( horizontalCount <= 1 ) minSize = mNavigatorView->sizeHintTwoButtons( 4 ); else minSize = mNavigatorView->sizeHintTwoButtons(); verticalCount = size().height() / minSize.height(); horizontalCount = size().width() / minSize.width(); if ( horizontalCount == 0 ) horizontalCount = 1; if ( verticalCount == 0 ) verticalCount = 1; fontchange = true; count = horizontalCount * verticalCount; } else { if ( mNavigatorView->fontChanged() ) { fontchange = true; fo = KOPrefs::instance()->mDateNavigatorFont; mNavigatorView->changeFont( fo ); mNavigatorView->unsetFontChanged(); } } mLastDisplayedDN = horizontalCount*verticalCount-1; while ( count > ( mExtraViews.count() + 1 ) ) { KDateNavigator *n = new KDateNavigator( this ); n->setMonthSignalOffset ( mExtraViews.count()+1 ); mExtraViews.append( n ); n->setCalendar( mCalendar ); connectNavigatorView( n ); // n->show(); } setBaseDates(); if ( fontchange ) { //mNavigatorView->changeFont( fo ); uint i; for( i = 0; i < mExtraViews.count(); ++i ) { KDateNavigator *view = mExtraViews.at( i ); view->changeFont( fo ); } } mHorizontalCount = horizontalCount; mVerticalCount = verticalCount; } int theight = height() / mVerticalCount; int twidth = width() / mHorizontalCount; NavigatorBar *bar = mNavigatorView->navigatorBar(); if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); else bar->showButtons( true, true ); mNavigatorView->setGeometry(0, 0, twidth, theight ); for( uint i = 0; i < mLastDisplayedDN; ++i ) { int x = ( i + 1 ) % mHorizontalCount; int y = ( i + 1 ) / mHorizontalCount; KDateNavigator *view = mExtraViews.at( i ); bar = view->navigatorBar(); if ( y > 0 ) bar->showButtons( false, false ); else { if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); else bar->showButtons( false, false ); } view->setGeometry( x * twidth, y * theight, twidth, theight ); } int iii = 0; int ccc = mHorizontalCount * mVerticalCount; mNavigatorView->show(); diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h index ac9745d..87cc59f 100644 --- a/korganizer/datenavigatorcontainer.h +++ b/korganizer/datenavigatorcontainer.h @@ -1,108 +1,109 @@ /* This file is part of KOrganizer. Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 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 DATENAVIGATORCONTAINER_H #define DATENAVIGATORCONTAINER_H class KDateNavigator; #include <qwidget.h> #include <qtimer.h> #include <libkcal/calendar.h> using namespace KCal; class DateNavigatorContainer: public QWidget { Q_OBJECT public: DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 ); ~DateNavigatorContainer(); /** Associate date navigator with a calendar. It is used by KODayMatrix. */ void setCalendar( Calendar * ); QSize minimumSizeHint() const; QSize sizeHint() const; KDateNavigator * navigatorView() { return mNavigatorView;} QDate lastAvailableDate() const ; QDate firstAvailableDate() const ; public slots: void selectDates( const KCal::DateList & ); void updateView(); void updateConfig(); void updateDayMatrix(); void updateDayMatrixDates(); void checkUpdateDayMatrixDates(); void updateToday(); void slotMonthSelected( int month ); void slotgoNextMonth(); void slotgoPrevMonth(); void slotgoNextYear(); void slotgoPrevYear(); void setResizeEnabled(); signals: void datesSelected( const KCal::DateList & ); void incidenceDropped( Incidence *, const QDate & ); void incidenceDroppedMove( Incidence *, const QDate & ); void weekClicked( const QDate &); void goPrevious(); void goNext(); void goNextMonth(); void goPrevMonth(); void goNextYear(); void goPrevYear(); + void showMonth( const QDate & ); void monthSelected( int month ); protected: void computeMonthSelected( int month , bool forceEmit ); void jumpMonth( int month ); void resizeEvent( QResizeEvent * ); void setBaseDates(); void connectNavigatorView( KDateNavigator *v ); private: bool mResizeEnabled; QTimer* mUpdateTimer; int mLastDisplayedDN; QDate mFirstSelectedDate; int mSelectedDateCount; KDateNavigator *mNavigatorView; KCal::Calendar *mCalendar; QPtrList<KDateNavigator> mExtraViews; int mHorizontalCount; int mVerticalCount; }; #endif diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 5eccfd6..38bddc2 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -258,210 +258,213 @@ void KDateNavigator::passedMidnight() if (emitMonth) { emit monthPassed(today); } } /* slot */ void KDateNavigator::possiblyPastMidnight() { if (lastDayChecked!=QDate::currentDate()) { passedMidnight(); lastDayChecked=QDate::currentDate(); } // Set the timer to go off 1 second after midnight // or after 8 minutes, whichever comes first. if (updateTimer) { QTime now = QTime::currentTime(); QTime midnight = QTime(23,59,59); int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) // .arg(now.toString()).arg(midnight.toString())); updateTimer->stop(); updateTimer->start(msecsWait,true); } } void KDateNavigator::updateDates() { // Find the first day of the week of the current month. //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); //int di = d1 - d2 + 1; dayone = dayone.addDays( -d2 + 1 ); int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); // If month begins on Monday and Monday is first day of week, // month should begin on second line. Sunday doesn't have this problem. int nextLine = ( ( m_fstDayOfWkCalsys == 1) && ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; // update the matrix dates int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; daymatrix->updateView(dayone.addDays(index)); //each updateDates is followed by an updateView -> repaint is issued there ! // daymatrix->repaint(); } void KDateNavigator::updateDayMatrix() { daymatrix->updateView(); //daymatrix->repaint(); } void KDateNavigator::updateView() { setUpdatesEnabled( false ); int i; // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; daymatrix->updateView(); // set the week numbers. for(i = 0; i < 6; i++) { QString weeknum; // remember, according to ISO 8601, the first week of the year is the // first week that contains a thursday. Thus we must subtract off 4, // not just 1. //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); int add = 0; if ( ! KGlobal::locale()->weekStartsMonday() ) ++add; if (dayOfYear % 7 != 0) weeknum.setNum(dayOfYear / 7 + 1+add); else weeknum.setNum(dayOfYear / 7 +add); weeknos[i]->setText(weeknum); } setUpdatesEnabled( true ); // kdDebug() << "updateView() -> repaint()" << endl; repaint(); // daymatrix->repaint(); } void KDateNavigator::updateConfig() { int day; for(int i=0; i<7; i++) { // take the first letter of the day name to be the abbreviation if (KGlobal::locale()->weekStartsMonday()) { day = i+1; } else { if (i==0) day = 7; else day = i; } QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, true ); if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); headings[i]->setText( dayName ); } updateDates(); updateView(); } void KDateNavigator::setShowWeekNums(bool enabled) { qDebug("KDateNavigator::setShowWeekNums***************************** "); m_bShowWeekNums = enabled; for(int i=0; i<6; i++) { if(enabled) weeknos[i]->show(); else weeknos[i]->hide(); } resize(size()); } void KDateNavigator::selectDates(const DateList& dateList) { if (dateList.count() > 0) { mNavigatorBar->selectDates( dateList ); mSelectedDates = dateList; // set our record of the month and year that this datetbl is // displaying. m_MthYr = mSelectedDates.first(); // set our record of the first day of the week of the current // month. This needs to be done before calling dayToIndex, since it // relies on this information being up to date. QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); m_fstDayOfWk = dayone.dayOfWeek(); updateDates(); daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); updateView(); } } int KDateNavigator::dayNum(int row, int col) { return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; } int KDateNavigator::dayToIndex(int dayNum) { int row, col; row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) row++; col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; return row * 7 + col; } void KDateNavigator::wheelEvent (QWheelEvent *e) { if(e->delta()>0) emit goPrevious(); else emit goNext(); e->accept(); } bool KDateNavigator::eventFilter (QObject *o,QEvent *e) { if (e->type() == QEvent::MouseButtonPress) { int i; for(i=0;i<6;++i) { if (o == weeknos[i]) { QDate weekstart = daymatrix->getDate(i*7); emit weekClicked(weekstart); break; } } for(i=0;i<7;++i) { if (o == headings[i]) { KCal::DateList selDays; QDate date = daymatrix->getDate(14); + emit showMonth(date ); +#if 0 int dio = date.daysInMonth(); int j; int ye = date.year(); int mo = date.month(); for ( j = 1; j <= dio; ++j ) { selDays.append( QDate( ye, mo, j ) ); } emit datesSelected( selDays ); +#endif break; } } return true; } else { return false; } } //#include "kdatenavigator.moc" diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 93bbceb..780ebb8 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h @@ -1,166 +1,167 @@ /* 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 KDATENAVIGATOR_H #define KDATENAVIGATOR_H #include <qframe.h> #include <qdatetime.h> #include <qlabel.h> #include <libkcal/calendar.h> #include "kodaymatrix.h" class QPushButton; class QTimer; class KCalendarSystem; class NavigatorBar; class KDateNavigator: public QFrame { Q_OBJECT public: KDateNavigator( QWidget *parent = 0,const char *name = 0 ); ~KDateNavigator(); /** The DateNavigator automatically checks for * the passage of midnight. If rollover type is * set to None, no signals are emitted and no * processing is done. With rollover set to * FollowDay, the day highlighter changes at * midnight and dayPassed() is emitted. * With FollowMonth, it has the same effect * as FollowDay but also adjusts the month that is * visible and emits monthPassed() when the month changes. */ enum RolloverType { None, FollowDay, FollowMonth } ; void enableRollover( RolloverType ); void setShowWeekNums( bool enabled ); void setCalendar( Calendar * ); void setBaseDate( const QDate & , bool doRepaint = true ); QDate baseDate() const { return m_MthYr;} KCal::DateList selectedDates() const { return mSelectedDates; } NavigatorBar *navigatorBar() const { return mNavigatorBar; } void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} QSize yourSizeHint()const { return mySizeHint; }; QSize yourFullSizeHint() const { return myFullSizeHint;}; QFont yourFontHint( QSize , bool * b); bool fontChanged() {return mFontChanged; } void unsetFontChanged() { mFontChanged = false; } KODayMatrix *dayMatrix() { return daymatrix ;} QSize sizeHint() const; QSize sizeHintTwoButtons( int butnum = 2 ) const; void changeFont ( QFont fo ); public slots: void selectDates( const KCal::DateList & ); void updateView(); void updateConfig(); void updateDayMatrix(); signals: void datesSelected( const KCal::DateList & ); void eventDropped( Event * ); void weekClicked( const QDate &); + void showMonth( const QDate & ); void goPrevious(); void goNext(); void goNextMonth(); void goPrevMonth(); void goNextYear(); void goPrevYear(); void monthSelected( int ); // Signals emitted at midnight carrying the new date. void dayPassed( QDate ); void monthPassed( QDate ); protected slots: /** * Called regularly to see if we need to update the view * wrt. the today box and the month box. Only important * if you leave KOrganizer idle for long periods of time. * * Until we have a reliable way of setting QTimers to go * off at a particular wall-clock time, we need this, * which calls passedMidnight() at the right moments. */ void possiblyPastMidnight(); /** handles updating the view when midnight has come by due to idle time. * */ void passedMidnight(); void slotMonthSelected( int m ); protected: void updateDates(); void wheelEvent (QWheelEvent *); bool eventFilter (QObject *,QEvent *); private: QSize mySizeHint; QSize myFullSizeHint; bool mFontChanged; int mMonthSignalOffset; NavigatorBar *mNavigatorBar; QFrame *headingSep; QFrame *weeknumSep; QLabel *headings[7]; QLabel *weeknos[7]; KODayMatrix *daymatrix; KCal::DateList mSelectedDates; QDate m_MthYr; int m_fstDayOfWk; bool m_bShowWeekNums; int dayNum(int row, int col); int dayToIndex(int dayNum); Calendar *mCalendar; KCalendarSystem *mCalendarSystem; const QString *curHeaders; /** used to update the day view periodically, in particular every * midnight to move the "today" rectangle. */ QTimer *updateTimer; QDate lastDayChecked; RolloverType updateRollover; // Disabling copy constructor and assignment operator KDateNavigator(const KDateNavigator & ); KDateNavigator &operator=(const KDateNavigator &); }; #endif diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c6e76c4..5a2dce3 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -1,324 +1,325 @@ /* 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; 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->showDay( date ); + 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::showView(KOrg::BaseView *view, bool fullScreen ) { //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::showListView() { if (!mListView) { mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); addView(mListView); connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), @@ -388,333 +389,340 @@ void KOViewManager::showAgendaView( bool fullScreen ) 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(mMainView, SIGNAL( calendarViewExpanded( bool ) ), mAgendaView, SLOT( setExpandedButton( bool ) ) ); 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 ; } void KOViewManager::showWeekView() { /* globalFlagBlockAgenda = 2; qDebug("4globalFlagBlockAgenda = 2; "); //globalFlagBlockPainting = true; mMainView->dateNavigator()->selectWeek(); showAgendaView(); */ mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockAgenda = 1; globalFlagBlockLabel = 1; if ( mCurrentAgendaView != 7 ) mCurrentAgendaView = -1; showAgendaView(); 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::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(); globalFlagBlockAgenda = 1; 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::showMonth( const QDate & date ) +{ + mMainView->dateNavigator()->blockSignals( true ); + mMainView->dateNavigator()->selectDate( date ); + mMainView->dateNavigator()->blockSignals( false ); + showMonthView(); +} 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 ) { mMonthView->switchView(); if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) full = false; else full = true; } mMainView->dateNavigator()->selectMonth(); 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 * ) ) ); connect( mTodoView, SIGNAL( purgeCompletedSignal() ), mMainView, SLOT( purgeCompleted() ) ); connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mMainView, SIGNAL( configChanged() ), mTodoView, SLOT( updateConfig() ) ); connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, SLOT( updateTodo( Todo *, int ) ) ); connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), mMainView, SLOT ( todo_unsub( Todo * ) ) ); connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); KConfig *config = KOGlobals::config(); mTodoView->restoreLayout(config,"Todo View"); mTodoView->setNavigator( mMainView->dateNavigator() ); } globalFlagBlockAgenda = 1; showView( mTodoView, true ); } void KOViewManager::showJournalView() { //mFlagShowNextxDays = false; if (!mJournalView) { mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::JournalView"); connect( mMainView, SIGNAL( configChanged() ), mJournalView, SLOT( updateConfig() ) ); connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); addView(mJournalView); } showView(mJournalView); mMainView->dateNavigator()->selectDates( 1 ); } void KOViewManager::showTimeSpanView() { //mFlagShowNextxDays = false; if (!mTimeSpanView) { mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::TimeSpanView"); addView(mTimeSpanView); mTimeSpanView->readSettings(); } showView(mTimeSpanView); } Incidence *KOViewManager::currentSelection() { if (!mCurrentView) return 0; if ( mCurrentView == mListView ) { if ( mListView->currentItem() ) return mListView->currentItem(); } return mCurrentView->selectedIncidences().first(); } QDate KOViewManager::currentSelectionDate() { QDate qd; if (mCurrentView) { DateList qvl = mCurrentView->selectedDates(); if (!qvl.isEmpty()) qd = qvl.first(); } return qd; } void KOViewManager::addView(KOrg::BaseView *view) { #if QT_VERSION >= 0x030000 mMainView->viewStack()->addWidget( view ); #else mMainView->viewStack()->addWidget( view, 1 ); #endif } void KOViewManager::setDocumentId( const QString &id ) { if (mTodoView) mTodoView->setDocumentId( id ); } diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 8f0bf82..6290227 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -1,120 +1,121 @@ /* 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: + public slots: + 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 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 |