-rw-r--r-- | korganizer/calendarview.cpp | 72 | ||||
-rw-r--r-- | korganizer/calendarview.h | 6 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 218 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.h | 90 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 36 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 8 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 49 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 8 | ||||
-rw-r--r-- | korganizer/korganizerE.pro | 4 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 22 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 1 |
11 files changed, 463 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6eaac1c..00285a5 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -62,96 +62,97 @@ #include <krun.h> #include <kdirwatch.h> #include <libkdepim/kdatepicker.h> #include <libkdepim/ksyncprofile.h> #include <libkdepim/kpimglobalprefs.h> #include <libkcal/vcaldrag.h> #include <libkcal/icaldrag.h> #include <libkcal/icalformat.h> #include <libkcal/vcalformat.h> #include <libkcal/scheduler.h> #include <libkcal/calendarlocal.h> #include <libkcal/journal.h> #include <libkcal/calfilter.h> #include <libkcal/attendee.h> #include <libkcal/dndfactory.h> #include <libkcal/freebusy.h> #include <libkcal/filestorage.h> #include <libkcal/calendarresources.h> #include <libkcal/qtopiaformat.h> #include "../kalarmd/alarmdialog.h" #ifndef DESKTOP_VERSION #include <libkcal/sharpformat.h> #include <externalapphandler.h> #endif #include <libkcal/phoneformat.h> #ifndef KORG_NOMAIL #include "komailclient.h" #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include "koeventeditor.h" #include "kotodoeditor.h" #include "koprefs.h" #include "koeventviewerdialog.h" #include "publishdialog.h" #include "kofilterview.h" #include "koglobals.h" #include "koviewmanager.h" #include "koagendaview.h" #include "kodialogmanager.h" #include "outgoingdialog.h" #include "incomingdialog.h" +#include "datenavigatorcontainer.h" #include "statusdialog.h" #include "kdatenavigator.h" #include "kotodoview.h" #include "datenavigator.h" #include "resourceview.h" #include "navigatorbar.h" #include "searchdialog.h" #include "mainwindow.h" #include "calendarview.h" #ifndef DESKTOP_VERSION #include <qtopia/alarmserver.h> #endif #ifndef _WIN32_ #include <stdlib.h> #include <stdio.h> #include <unistd.h> #else #include <qprocess.h> #endif #ifdef DESKTOP_VERSION #include <kabc/stdaddressbook.h> #endif using namespace KOrg; using namespace KCal; extern int globalFlagBlockAgenda; extern int globalFlagBlockStartup; class KOBeamPrefs : public QDialog { public: KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : QDialog( parent, name, true ) { setCaption( i18n("Beam Options") ); QVBoxLayout* lay = new QVBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); lay->addWidget( time ); time->setExclusive ( true ) ; vcal = new QRadioButton(" vCalendar ", format ); ical = new QRadioButton(" iCalendar ", format ); @@ -222,297 +223,310 @@ CalendarView::CalendarView( CalendarResources *calendar, 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 KDateNavigator(mLeftSplitter, mCalendar, TRUE, - "CalendarView::DateNavigator", QDate::currentDate() ); + 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 ); - + //QWidget *leftFrame = new QWidget( mainBox ); QBoxLayout * mainBoxLayout; - QBoxLayout * leftFrameLayout; if ( KOPrefs::instance()->mVerticalScreen ) { mainBoxLayout = new QVBoxLayout(mainBox); - leftFrameLayout = new QHBoxLayout(leftFrame ); + //leftFrameLayout = new QHBoxLayout(leftFrame ); + mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; + mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); } else { mainBoxLayout = new QHBoxLayout(mainBox); - leftFrameLayout = new QVBoxLayout(leftFrame ); + //leftFrameLayout = new QVBoxLayout(leftFrame ); + mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; + mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } + //QBoxLayout * leftFrameLayout; topLayout->addWidget( mainBox ); - mainBoxLayout->addWidget (leftFrame); - mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, + 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 ); - mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); - mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); + //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( mainBox ); mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 10 ); - mLeftFrame = leftFrame; + //mLeftFrame = (QWidget *)leftFrame; if ( KOPrefs::instance()->mVerticalScreen ) { - mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); - leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); + mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); + //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); + //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); + //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); } else { - mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); - leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); + mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); + //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); + //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) - mDateNavigator->hide(); + mLeftFrame->toggle(); //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( 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 & ) ) ); - - connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), - SLOT( eventAdded( Event *) ) ); - - connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); +#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 ); } @@ -3640,115 +3654,119 @@ void CalendarView::takeOverEvent() incidence->setOrganizer(KOPrefs::instance()->email()); incidence->recreate(); incidence->setReadOnly(false); updateView(); } void CalendarView::takeOverCalendar() { // TODO: Create Calendar::allIncidences() function and use it here QPtrList<Event> events = mCalendar->events(); for(uint i=0; i<events.count(); ++i) { events.at(i)->setOrganizer(KOPrefs::instance()->email()); events.at(i)->recreate(); events.at(i)->setReadOnly(false); } QPtrList<Todo> todos = mCalendar->todos(); for(uint i=0; i<todos.count(); ++i) { todos.at(i)->setOrganizer(KOPrefs::instance()->email()); todos.at(i)->recreate(); todos.at(i)->setReadOnly(false); } QPtrList<Journal> journals = mCalendar->journals(); for(uint i=0; i<journals.count(); ++i) { journals.at(i)->setOrganizer(KOPrefs::instance()->email()); journals.at(i)->recreate(); journals.at(i)->setReadOnly(false); } updateView(); } void CalendarView::showIntro() { kdDebug() << "To be implemented." << endl; } QWidgetStack *CalendarView::viewStack() { return mRightFrame; } QWidget *CalendarView::leftFrame() { - return mLeftFrame; + return ( QWidget *)mLeftFrame; } DateNavigator *CalendarView::dateNavigator() { return mNavigator; } KDateNavigator* CalendarView::dateNavigatorWidget() { - return mDateNavigator; + return mDateNavigator->navigatorView(); } void CalendarView::toggleDateNavigatorWidget() { KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; + mLeftFrame->toggle(); + // FIXME mShowDateNavigator is not the toggle state of mLeftFrame +#if 0 if (!KOPrefs::instance()->mShowDateNavigator ) mDateNavigator->hide(); else mDateNavigator->show(); +#endif } void CalendarView::addView(KOrg::BaseView *view) { mViewManager->addView(view); } void CalendarView::showView(KOrg::BaseView *view) { mViewManager->showView(view, mLeftFrame->isVisible()); } Incidence *CalendarView::currentSelection() { return mViewManager->currentSelection(); } void CalendarView::toggleAllDaySize() { /* if ( KOPrefs::instance()->mAllDaySize > 47 ) KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; else KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; */ viewManager()->agendaView()->toggleAllDay(); } void CalendarView::toggleExpand() { // if ( mLeftFrame->isHidden() ) { // mLeftFrame->show(); // emit calendarViewExpanded( false ); // } else { // mLeftFrame->hide(); // emit calendarViewExpanded( true ); // } //qDebug(" CalendarView::toggleExpand()"); globalFlagBlockAgenda = 1; emit calendarViewExpanded( !mLeftFrame->isHidden() ); globalFlagBlockAgenda = 5; mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); //mViewManager->showView( 0, true ); } void CalendarView::calendarModified( bool modified, Calendar * ) { setModified( modified ); } Todo *CalendarView::selectedTodo() diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 664d700..fac9a9e 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -1,103 +1,105 @@ /* This file is part of KOrganizer. Copyright (c) 2000, 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 CALENDARVIEW_H #define CALENDARVIEW_H #include <qframe.h> #include <qlayout.h> #include <qwidget.h> #include <qptrlist.h> #include <qvbox.h> #include <qmap.h> #ifndef DESKTOP_VERSION #include <qtopia/ir.h> #else #define Ir char #endif #include <libkcal/calendar.h> #include <libkcal/scheduler.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> +#include <KDGanttMinimizeSplitter.h> #include <korganizer/calendarviewbase.h> #include <ksyncmanager.h> class QWidgetStack; class QSplitter; class CalPrinter; class KOFilterView; class KOViewManager; class KODialogManager; class KOTodoView; class KDateNavigator; +class DateNavigatorContainer; class DateNavigator; class KOIncidenceEditor; class KDatePicker; class ResourceView; class KOEventEditor; class KOTodoEditor ; class KOEventViewerDialog; class KOBeamPrefs; class KSyncProfile; class AlarmDialog; class KCal::Attendee; namespace KCal { class FileStorage; } using namespace KCal; /** This is the main calendar widget. It provides the different vies on t he calendar data as well as the date navigator. It also handles synchronisation of the different views and controls the different dialogs like preferences, event editor, search dialog etc. @short main calendar view widget @author Cornelius Schumacher */ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface { Q_OBJECT public: /** Constructs a new calendar view widget. @param calendar calendar document @param parent parent window @param name Qt internal widget object name */ CalendarView( CalendarResources *calendar, QWidget *parent = 0, const char *name = 0 ); CalendarView( Calendar *calendar, QWidget *parent = 0, const char *name = 0 ); virtual ~CalendarView(); Calendar *calendar() { return mCalendar; } KOViewManager *viewManager(); KODialogManager *dialogManager(); QDate startDate(); @@ -484,103 +486,103 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void adaptNavigationUnits(); bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); //Attendee* getYourAttendee(Event *event); void setBlockShowDates( bool b ) { mBlockShowDates = b ;} protected: void schedule(Scheduler::Method, Incidence *incidence = 0); // returns KMsgBox::OKCandel() int msgItemDelete(const QString name); void showEventEditor(); void showTodoEditor(); void writeLocale(); Todo *selectedTodo(); private: bool mViewerCallerIsSearchDialog; bool mBlockShowDates; KSyncManager* mSyncManager; AlarmDialog * mAlarmDialog; QString mAlarmNotification; QString mSuspendAlarmNotification; QTimer* mSuspendTimer; QTimer* mAlarmTimer; QTimer* mRecheckAlarmTimer; void computeAlarm( QString ); void startAlarm( QString, QString ); void setSyncEventsReadOnly(); QDateTime loadedFileVersion; void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); void checkExternalId( Incidence * inc ); int mGlobalSyncMode; QString mCurrentSyncDevice; QString mCurrentSyncName; KOBeamPrefs* beamDialog; void init(); int mDatePickerMode; bool mFlagEditDescription; QDateTime mLastCalendarSync; void createPrinter(); void calendarModified( bool, Calendar * ); CalPrinter *mCalPrinter; QSplitter *mPanner; QSplitter *mLeftSplitter; - QWidget *mLeftFrame; + KDGanttMinimizeSplitter *mLeftFrame; QWidgetStack *mRightFrame; KDatePicker* mDatePicker; QVBox* mDateFrame; - KDateNavigator *mDateNavigator; // widget showing small month view. + DateNavigatorContainer *mDateNavigator; // widget showing small month view. KOFilterView *mFilterView; ResourceView *mResourceView; // calendar object for this viewing instance Calendar *mCalendar; CalendarResourceManager *mResourceManager; FileStorage *mStorage; DateNavigator *mNavigator; KOViewManager *mViewManager; KODialogManager *mDialogManager; // Calendar filters QPtrList<CalFilter> mFilters; // various housekeeping variables. bool mModified; // flag indicating if calendar is modified bool mReadOnly; // flag indicating if calendar is read-only QDate mSaveSingleDate; Incidence *mSelectedIncidence; Incidence *mMoveIncidence; QDate mMoveIncidenceOldDate; KOTodoView *mTodoList; KOEventEditor * mEventEditor; KOTodoEditor * mTodoEditor; KOEventViewerDialog * mEventViewerDialog; void keyPressEvent ( QKeyEvent *e) ; //QMap<Incidence*,KOIncidenceEditor*> mDialogList; }; class CalendarViewVisitor : public Incidence::Visitor { public: CalendarViewVisitor() : mView( 0 ) {} bool act( Incidence *incidence, CalendarView *view ) { mView = view; return incidence->accept( *this ); } diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp new file mode 100644 index 0000000..cbfc5b2 --- a/dev/null +++ b/korganizer/datenavigatorcontainer.cpp @@ -0,0 +1,218 @@ +/* + 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" + +DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, + const char *name ) + : QWidget( parent, name ), mCalendar( 0 ), + mHorizontalCount( 1 ), mVerticalCount( 1 ) +{ + mExtraViews.setAutoDelete( true ); + + mNavigatorView = new KDateNavigator( this, name ); + + connectNavigatorView( mNavigatorView ); +} + +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( goPrevious() ), SIGNAL( goPrevious() ) ); + connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); + + connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); + connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); + connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); + connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); + + connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); +} + +void DateNavigatorContainer::setCalendar( Calendar *cal ) +{ + mCalendar = cal; + mNavigatorView->setCalendar( cal ); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + n->setCalendar( cal ); + } +} + +void DateNavigatorContainer::updateDayMatrix() +{ + mNavigatorView->updateDayMatrix(); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + n->updateDayMatrix(); + } +} + +void DateNavigatorContainer::updateToday() +{ + qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); +#if 0 + mNavigatorView->updateToday(); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + n->updateToday(); + } +#endif +} + +void DateNavigatorContainer::updateView() +{ + mNavigatorView->updateView(); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + n->updateView(); + } +} + +void DateNavigatorContainer::updateConfig() +{ + mNavigatorView->updateConfig(); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + n->updateConfig(); + } +} + +void DateNavigatorContainer::selectDates( const DateList &dateList ) +{ + mNavigatorView->selectDates( dateList ); + setBaseDates(); +} + +void DateNavigatorContainer::setBaseDates() +{ + KCal::DateList dateList = mNavigatorView->selectedDates(); + if ( dateList.isEmpty() ) { + kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; + } + QDate baseDate = dateList.first(); + KDateNavigator *n; + for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { + baseDate = baseDate.addDays( baseDate.daysInMonth () ); + n->setBaseDate( baseDate ); + } +} + +void DateNavigatorContainer::resizeEvent( QResizeEvent * ) +{ +#if 0 + kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; + kdDebug(5850) << " CURRENT SIZE: " << size() << endl; + kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; + kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; + kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; +#endif + + QSize minSize = mNavigatorView->minimumSizeHint(); + +// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; + + int verticalCount = size().height() / minSize.height(); + int horizontalCount = size().width() / minSize.width(); + //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); + if ( horizontalCount != mHorizontalCount || + verticalCount != mVerticalCount ) { + uint count = horizontalCount * verticalCount; + if ( count == 0 ) return; + + while ( count > ( mExtraViews.count() + 1 ) ) { + KDateNavigator *n = new KDateNavigator( this ); + mExtraViews.append( n ); + n->setCalendar( mCalendar ); + setBaseDates(); + connectNavigatorView( n ); + n->show(); + } + + while ( count < ( mExtraViews.count() + 1 ) ) { + mExtraViews.removeLast(); + } + + mHorizontalCount = horizontalCount; + mVerticalCount = verticalCount; + } + + int height = size().height() / verticalCount; + int width = size().width() / horizontalCount; + + NavigatorBar *bar = mNavigatorView->navigatorBar(); + if ( horizontalCount > 1 ) bar->showButtons( true, false ); + else bar->showButtons( true, true ); + + mNavigatorView->setGeometry(0, + 0, width, height ); + for( uint i = 0; i < mExtraViews.count(); ++i ) { + int x = ( i + 1 ) % horizontalCount; + int y = ( i + 1 ) / horizontalCount; + + KDateNavigator *view = mExtraViews.at( i ); + bar = view->navigatorBar(); + if ( y > 0 ) bar->showButtons( false, false ); + else { + if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); + else bar->showButtons( false, false ); + } + view->setGeometry( x * width, + y * height, width, height ); + } +} + +QSize DateNavigatorContainer::minimumSizeHint() const +{ + return mNavigatorView->minimumSizeHint(); +} + +QSize DateNavigatorContainer::sizeHint() const +{ + return mNavigatorView->sizeHint(); +} diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h new file mode 100644 index 0000000..affa8e1 --- a/dev/null +++ b/korganizer/datenavigatorcontainer.h @@ -0,0 +1,90 @@ +/* + 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 <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;} + + public slots: + void selectDates( const KCal::DateList & ); + void updateView(); + void updateConfig(); + void updateDayMatrix(); + void updateToday(); + + 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 monthSelected( int month ); + + protected: + void resizeEvent( QResizeEvent * ); + + void setBaseDates(); + void connectNavigatorView( KDateNavigator *v ); + + private: + KDateNavigator *mNavigatorView; + + KCal::Calendar *mCalendar; + + QPtrList<KDateNavigator> mExtraViews; + + int mHorizontalCount; + int mVerticalCount; +}; + +#endif diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index c08f44f..e76a85a 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -1,171 +1,185 @@ /* This file is part of KOrganizer. Copyright (c) 2001,2002 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 <qstring.h> #include <qkeycode.h> #include <qlayout.h> #include <qtimer.h> #include <qframe.h> #include <qlabel.h> #include <qapplication.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include "koglobals.h" #include "koprefs.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include <kcalendarsystem.h> #include "navigatorbar.h" #include "kdatenavigator.h" -KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, - bool show_week_nums, const char *name, - QDate startDate ) +KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) : QFrame(parent, name), updateTimer(0L) { - mCalendar = calendar; - setFrameStyle(QFrame::NoFrame); - + QDate startDate = QDate::currentDate(); QGridLayout *topLayout = new QGridLayout(this,8,8); if (! startDate.isValid()) { qDebug("KDateNavigator::invalid startdate "); startDate = QDate::currentDate(); } mSelectedDates.append(startDate); m_MthYr = startDate; - m_bShowWeekNums = show_week_nums; + m_bShowWeekNums = true; setFont( KOPrefs::instance()->mDateNavigatorFont ); mNavigatorBar = new NavigatorBar( startDate, this ); topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); //mNavigatorBar->resize( 1,1); connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); // get the day of the week on the first day QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); m_fstDayOfWk = dayone.dayOfWeek(); int i; // Set up the heading fields. for( i = 0; i < 7; i++ ) { headings[i] = new QLabel("",this); //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); headings[i]->setAlignment(AlignCenter); topLayout->addWidget(headings[i],1,i+1); } // Create the weeknumber labels for( i = 0; i < 6; i++ ) { weeknos[i] = new QLabel(this); weeknos[i]->setAlignment(AlignCenter); //weeknos[i]->setFont(QFont("Arial", 10)); - if(!show_week_nums) { + if(!m_bShowWeekNums) { weeknos[i]->hide(); } weeknos[i]->installEventFilter(this); topLayout->addWidget(weeknos[i],i+2,0); } - daymatrix = new KODayMatrix( this, mCalendar, dayone, - "KDateNavigator::DayMatrix"); + daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); daymatrix->setLineWidth(1); connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), SIGNAL( datesSelected( const KCal::DateList & ) ) ); connect( daymatrix, SIGNAL( eventDropped( Event * ) ), SIGNAL( eventDropped( Event * ) ) ); topLayout->addMultiCellWidget(daymatrix,2,7,1,7); // read settings from configuration file. updateConfig(); enableRollover(FollowMonth); - setFixedSize ( sizeHint() ); + //setFixedSize ( sizeHint() ); +} +void KDateNavigator::setCalendar( Calendar *cal ) +{ + daymatrix->setCalendar( cal ); +} + +void KDateNavigator::setBaseDate( const QDate &date ) +{ + m_MthYr = date; + + updateDates(); + updateView(); + + KCal::DateList dates; + dates.append( date ); + mNavigatorBar->selectDates( dates ); + + daymatrix->clearSelection(); + daymatrix->repaint(); } void KDateNavigator::enableRollover(RolloverType r) { switch(r) { case None : if (updateTimer) { updateTimer->stop(); delete updateTimer; updateTimer=0L; } break; case FollowDay : case FollowMonth : if (!updateTimer) { updateTimer = new QTimer(this); QObject::connect(updateTimer,SIGNAL(timeout()), this,SLOT(possiblyPastMidnight())); } updateTimer->start(0,true); lastDayChecked = QDate::currentDate(); } updateRollover=r; } KDateNavigator::~KDateNavigator() { } void KDateNavigator::passedMidnight() { QDate today = QDate::currentDate(); bool emitMonth = false; if (today.month() != lastDayChecked.month()) { if (updateRollover==FollowMonth && daymatrix->isEndOfMonth()) { goNextMonth(); emitMonth=true; } } daymatrix->recalculateToday(); diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 3ae1648..0aeb77a 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h @@ -1,111 +1,113 @@ /* 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, Calendar *calendar = 0, - bool show_week_numbers = false, const char *name = 0, - QDate date = QDate::currentDate() ); + 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 & ); + KCal::DateList selectedDates() const { return mSelectedDates; } + NavigatorBar *navigatorBar() const { return mNavigatorBar; } 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 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(); protected: void updateDates(); void wheelEvent (QWheelEvent *); diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 989f758..a886f4a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -42,303 +42,346 @@ #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include "koprefs.h" #include "koglobals.h" #include "kodaymatrix.h" // ============================================================================ // D Y N A M I C T I P // ============================================================================ DynamicTip::DynamicTip( QWidget * parent ) : QToolTip( parent ) { matrix = (KODayMatrix*)parent; } void DynamicTip::maybeTip( const QPoint &pos ) { //calculate which cell of the matrix the mouse is in QRect sz = matrix->frameRect(); int dheight = sz.height()*7 / 42; int dwidth = sz.width() / 7; int row = pos.y()/dheight; int col = pos.x()/dwidth; QRect rct(col*dwidth, row*dheight, dwidth, dheight); // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << // col << "][" << row << "] => " <<(col+row*7) << endl; //show holiday names only QString str = matrix->getHolidayLabel(col+row*7); if (str.isEmpty()) return; tip(rct, str); } // ============================================================================ // K O D A Y M A T R I X // ============================================================================ const int KODayMatrix::NOSELECTION = -1000; const int KODayMatrix::NUMDAYS = 42; +KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) + : QFrame( parent, name ), mCalendar( 0 ) + +#if 0 KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : QFrame(parent, name) +#endif { - mCalendar = calendar; + mPendingUpdateBeforeRepaint = false; // initialize dynamic arrays days = new QDate[NUMDAYS]; daylbls = new QString[NUMDAYS]; events = new int[NUMDAYS]; mToolTip = new DynamicTip(this); // set default values used for drawing the matrix mDefaultBackColor = palette().active().base(); mDefaultTextColor = palette().active().foreground(); mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); mSelectedDaysColor = QColor("white"); mTodayMarginWidth = 2; mSelEnd = mSelStart = NOSELECTION; setAcceptDrops(true); //setFont( QFont("Arial", 10) ); mUpdateTimer = new QTimer( this ); connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); mRepaintTimer = new QTimer( this ); connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); mDayChanged = false; updateView(); } +void KODayMatrix::setCalendar( Calendar *cal ) +{ + mCalendar = cal; + + setAcceptDrops( mCalendar ); + + updateEvents(); +} QColor KODayMatrix::getShadedColor(QColor color) { QColor shaded; int h=0; int s=0; int v=0; color.hsv(&h,&s,&v); s = s/4; v = 192+v/4; shaded.setHsv(h,s,v); return shaded; } KODayMatrix::~KODayMatrix() { delete [] days; delete [] daylbls; delete [] events; delete mToolTip; } /* void KODayMatrix::setStartDate(QDate start) { updateView(start); } */ void KODayMatrix::addSelectedDaysTo(DateList& selDays) { if (mSelStart == NOSELECTION) { return; } //cope with selection being out of matrix limits at top (< 0) int i0 = mSelStart; if (i0 < 0) { for (int i = i0; i < 0; i++) { selDays.append(days[0].addDays(i)); } i0 = 0; } //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) if (mSelEnd > NUMDAYS-1) { for (int i = i0; i <= NUMDAYS-1; i++) { selDays.append(days[i]); } for (int i = NUMDAYS; i < mSelEnd; i++) { selDays.append(days[0].addDays(i)); } // apply normal routine to selection being entirely within matrix limits } else { for (int i = i0; i <= mSelEnd; i++) { selDays.append(days[i]); } } } void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) { mSelStart = startdate.daysTo(start); mSelEnd = startdate.daysTo(end); } +void KODayMatrix::clearSelection() +{ + mSelEnd = mSelStart = NOSELECTION; +} void KODayMatrix::recalculateToday() { today = -1; for (int i=0; i<NUMDAYS; i++) { events[i] = 0; days[i] = startdate.addDays(i); daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); // if today is in the currently displayed month, hilight today if (days[i].year() == QDate::currentDate().year() && days[i].month() == QDate::currentDate().month() && days[i].day() == QDate::currentDate().day()) { today = i; } } // qDebug(QString("Today is visible at %1.").arg(today)); } void KODayMatrix::updateView() { updateView(startdate); } void KODayMatrix::repaintViewTimed() { mRepaintTimer->stop(); repaint(false); } void KODayMatrix::updateViewTimed() { - mUpdateTimer->stop(); + if ( !mCalendar ) { + qDebug("NOT CAL "); + return; + } + //qDebug("KODayMatrix::updateViewTimed "); for(int i = 0; i < NUMDAYS; i++) { // if events are set for the day then remember to draw it bold QPtrList<Event> eventlist = mCalendar->events(days[i]); Event *event; int numEvents = eventlist.count(); QString holiStr = ""; for(event=eventlist.first();event != 0;event=eventlist.next()) { ushort recurType = event->recurrence()->doesRecur(); if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { numEvents--; } if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { if ( !holiStr.isEmpty() ) holiStr += "\n"; holiStr += event->summary(); } } events[i] = numEvents; //if it is a holy day then draw it red. Sundays are consider holidays, too if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || !holiStr.isEmpty()) { mHolidays[i] = holiStr; } else { mHolidays[i] = QString::null; } } if ( ! mPendingUpdateBeforeRepaint ) repaint(false); } void KODayMatrix::updateView(QDate actdate) { if ( ! actdate.isValid() ) { //qDebug("date not valid "); return; } mDayChanged = false; //flag to indicate if the starting day of the matrix has changed by this call //mDayChanged = false; // if a new startdate is to be set then apply Cornelius's calculation // of the first day to be shown if (actdate != startdate) { // reset index of selection according to shift of starting date from startdate to actdate if (mSelStart != NOSELECTION) { int tmp = actdate.daysTo(startdate); //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; // shift selection if new one would be visible at least partly ! if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { // nested if is required for next X display pushed from a different month - correction required // otherwise, for month forward and backward, it must be avoided if( mSelStart > NUMDAYS || mSelStart < 0 ) mSelStart = mSelStart + tmp; if( mSelEnd > NUMDAYS || mSelEnd < 0 ) mSelEnd = mSelEnd + tmp; } } startdate = actdate; mDayChanged = true; recalculateToday(); } //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); if ( !isVisible() ) { mPendingUpdateBeforeRepaint = true; } else { #ifdef DESKTOP_VERSION //mRepaintTimer->start( 250 ); mUpdateTimer->start( 250 ); #else mRepaintTimer->start( 350 ); mUpdateTimer->start( 2000 ); #endif } } +void KODayMatrix::updateEvents() +{ + if ( !mCalendar ) return; + + for( int i = 0; i < NUMDAYS; i++ ) { + // if events are set for the day then remember to draw it bold + QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); + int numEvents = eventlist.count(); + Event *event; + for( event = eventlist.first(); event != 0;event=eventlist.next()) { + ushort recurType = event->doesRecur(); + + if ( ( recurType == Recurrence::rDaily && + !KOPrefs::instance()->mDailyRecur ) || + ( recurType == Recurrence::rWeekly && + !KOPrefs::instance()->mWeeklyRecur ) ) { + numEvents--; + } + } + events[ i ] = numEvents; + } +} const QDate& KODayMatrix::getDate(int offset) { if (offset < 0 || offset > NUMDAYS-1) { qDebug("Wrong offset2 "); return days[0]; } return days[offset]; } QString KODayMatrix::getHolidayLabel(int offset) { if (offset < 0 || offset > NUMDAYS-1) { qDebug("Wrong offset1 "); return 0; } return mHolidays[offset]; } int KODayMatrix::getDayIndexFrom(int x, int y) { return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? 6 - x/daysize.width() : x/daysize.width()); } // ---------------------------------------------------------------------------- // M O U S E E V E N T H A N D L I N G // ---------------------------------------------------------------------------- void KODayMatrix::mousePressEvent (QMouseEvent* e) { mSelStart = getDayIndexFrom(e->x(), e->y()); if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; mSelInit = mSelStart; } void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) { int tmp = getDayIndexFrom(e->x(), e->y()); if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; if (mSelInit > tmp) { mSelEnd = mSelInit; if (tmp != mSelStart) { mSelStart = tmp; repaint(false); } @@ -383,97 +426,97 @@ void KODayMatrix::mouseMoveEvent (QMouseEvent* e) } } } // ---------------------------------------------------------------------------- // D R A G ' N D R O P H A N D L I N G // ---------------------------------------------------------------------------- void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) { #ifndef KORG_NODND if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { e->ignore(); return; } // some visual feedback // oldPalette = palette(); // setPalette(my_HilitePalette); // update(); #endif } void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) { #ifndef KORG_NODND if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { e->ignore(); return; } e->accept(); #endif } void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) { #ifndef KORG_NODND // setPalette(oldPalette); // update(); #endif } void KODayMatrix::dropEvent(QDropEvent *e) { #ifndef KORG_NODND // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; - if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { + if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { e->ignore(); return; } DndFactory factory( mCalendar ); Event *event = factory.createDrop(e); if (event) { e->acceptAction(); Event *existingEvent = mCalendar->event(event->uid()); if(existingEvent) { // uniquify event event->recreate(); /* KMessageBox::sorry(this, i18n("Event already exists in this calendar."), i18n("Drop Event")); delete event; return; */ } // kdDebug() << "Drop new Event" << endl; // Adjust date QDateTime start = event->dtStart(); QDateTime end = event->dtEnd(); int duration = start.daysTo(end); int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); start.setDate(days[idx]); end.setDate(days[idx].addDays(duration)); event->setDtStart(start); event->setDtEnd(end); mCalendar->addEvent(event); emit eventDropped(event); } else { // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; e->ignore(); } #endif } // ---------------------------------------------------------------------------- // P A I N T E V E N T H A N D L I N G // ---------------------------------------------------------------------------- diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index 2dd112a..ba4853f 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h @@ -72,132 +72,134 @@ protected: void maybeTip( const QPoint & pos); private: /** the parent control this tooltip is designed for. */ KODayMatrix* matrix; }; /** * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. * Cornelius thought this was a waste of memory and a lot of overhead. * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame * that draws the labels and allows for dragging selection while maintaining nearly full * compatibility in behaviour with its predecessor. * * The following functionality has been changed: * * o when shifting events in the agenda view from one day to another the day matrix is updated now * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. * o no support for Ctrl+click to create groups of dates * (This has not really been supported in the predecessor. It was not very intuitive nor was it * user friendly.) * This feature has been replaced with dragging a selection on the matrix. The matrix will * automatically choose the appropriate selection (e.g. you are not any longer able to select * two distinct groups of date selections as in the old class) * o now that you can select more then a week it can happen that not all selected days are * displayed in the matrix. However this is preferred to the alternative which would mean to * adjust the selection and leave some days undisplayed while scrolling through the months * * @short day matrix widget of the KDateNavigator * * @author Eitzenberger Thomas */ class KODayMatrix: public QFrame { Q_OBJECT public: /** constructor to create a day matrix widget. * * @param parent widget that is the parent of the day matrix. Normally this should * be a KDateNavigator * @param calendar instance of a calendar on which all calculations are based * @param date start date of the matrix (is expected to be already fixed). It is * assumed that this date is the first week day to be shown in the matrix. * @param name name of the widget */ - KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); + KODayMatrix( QWidget *parent, const char *name ); + //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); /** destructor that deallocates all dynamically allocated private members. */ ~KODayMatrix(); /** updates the day matrix to start with the given date. Does all the necessary * checks for holidays or events on a day and stores them for display later on. * Does NOT update the view visually. Call repaint() for this. * * @param actdate recalculates the day matrix to show NUMDAYS starting from this * date. */ void updateView(QDate actdate); + void updateEvents(); /** returns the QDate object associated with day indexed by the * supplied offset. */ const QDate& getDate(int offset); - + void setCalendar( Calendar * ); /** returns the official name of this holy day or 0 if there is no label * for this day. */ QString getHolidayLabel(int offset); /** adds all actual selected days from mSelStart to mSelEnd to the supplied * DateList. */ void addSelectedDaysTo(DateList&); /** sets the actual to be displayed selection in the day matrix starting from * start and ending with end. Theview must be manually updated by calling * repaint. (?) */ void setSelectedDaysFrom(const QDate& start, const QDate& end); - + void clearSelection(); /** Is today visible in the view? Keep this in sync with * the values today (below) can take. */ bool isTodayVisible() const { return today>=0; } ; /** If today is visible, then we can find out if today is * near the beginning or the end of the month. * This is dependent on today remaining the index * in the array of visible dates and going from * top left (0) to bottom right (41). */ bool isBeginningOfMonth() const { return today<=8; } ; bool isEndOfMonth() const { return today>=27; } ; public slots: /** Recalculates all the flags of the days in the matrix like holidays or events * on a day (Actually calls above method with the actual startdate). */ void updateView(); void updateViewTimed(); void repaintViewTimed(); /** * Calculate which square in the matrix should be * hilighted to indicate it's today. */ void recalculateToday(); /* void setStartDate(QDate); */ signals: /** emitted if the user selects a block of days with the mouse by dragging a rectangle * inside the matrix * * @param daylist list of days that have been selected by the user */ void selected( const KCal::DateList &daylist ); /** emitted if the user has dropped an event inside the matrix * * @param event the dropped calendar event */ void eventDropped(Event *event); diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro index e6c3f8d..91b5a01 100644 --- a/korganizer/korganizerE.pro +++ b/korganizer/korganizerE.pro @@ -1,143 +1,143 @@ TEMPLATE = app CONFIG += qt warn_on TARGET = kopi OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER DEFINES += KORG_NOLVALTERNATION #KORG_NOKABC LIBS += -lmicrokdepim LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -lmicroqtcompat LIBS += $(GCC3EXTRALIB1) LIBS += $(GCC3EXTRALIB2) LIBS += -lqpe LIBS += -ljpeg LIBS += $(QTOPIALIB) LIBS += -L$(QPEDIR)/lib INTERFACES = kofilterview_base.ui #filteredit_base.ui -HEADERS = \ +HEADERS = datenavigatorcontainer.h \ wordsgerman.h \ filteredit_base.h \ alarmclient.h \ calendarview.h \ customlistviewitem.h \ datenavigator.h \ docprefs.h \ filtereditdialog.h \ incomingdialog.h \ incomingdialog_base.h \ interfaces/korganizer/baseview.h \ interfaces/korganizer/calendarviewbase.h \ journalentry.h \ kdateedit.h \ kdatenavigator.h \ koagenda.h \ koagendaitem.h \ koagendaview.h \ kocounterdialog.h \ kodaymatrix.h \ kodialogmanager.h \ koeditordetails.h \ koeditorgeneral.h \ koeditorgeneralevent.h \ koeditorgeneraltodo.h \ koeditorrecurrence.h \ koeventeditor.h \ koeventpopupmenu.h \ koeventview.h \ koeventviewer.h \ koeventviewerdialog.h \ kofilterview.h \ koglobals.h \ koincidenceeditor.h \ kojournalview.h \ kolistview.h \ kolocationbox.h \ komonthview.h \ koprefs.h \ koprefsdialog.h \ kotimespanview.h \ kotodoeditor.h \ kotodoview.h \ kotodoviewitem.h \ koviewmanager.h \ kowhatsnextview.h \ ktimeedit.h \ lineview.h \ mainwindow.h \ navigatorbar.h \ outgoingdialog.h \ outgoingdialog_base.h \ publishdialog.h \ publishdialog_base.h \ savetemplatedialog.h \ searchdialog.h \ simplealarmclient.h \ statusdialog.h \ timeline.h \ timespanview.h \ version.h \ ../kalarmd/alarmdialog.h -SOURCES = \ +SOURCES = datenavigatorcontainer.cpp \ filteredit_base.cpp \ calendarview.cpp \ datenavigator.cpp \ docprefs.cpp \ filtereditdialog.cpp \ incomingdialog.cpp \ incomingdialog_base.cpp \ journalentry.cpp \ kdatenavigator.cpp \ koagenda.cpp \ koagendaitem.cpp \ koagendaview.cpp \ kocounterdialog.cpp \ kodaymatrix.cpp \ kodialogmanager.cpp \ koeditordetails.cpp \ koeditorgeneral.cpp \ koeditorgeneralevent.cpp \ koeditorgeneraltodo.cpp \ koeditorrecurrence.cpp \ koeventeditor.cpp \ koeventpopupmenu.cpp \ koeventview.cpp \ koeventviewer.cpp \ koeventviewerdialog.cpp \ kofilterview.cpp \ koglobals.cpp \ koincidenceeditor.cpp \ kojournalview.cpp \ kolistview.cpp \ kolocationbox.cpp \ komonthview.cpp \ koprefs.cpp \ koprefsdialog.cpp \ kotimespanview.cpp \ kotodoeditor.cpp \ kotodoview.cpp \ kotodoviewitem.cpp \ koviewmanager.cpp \ kowhatsnextview.cpp \ ktimeedit.cpp \ lineview.cpp \ main.cpp \ mainwindow.cpp \ navigatorbar.cpp \ outgoingdialog.cpp \ outgoingdialog_base.cpp \ publishdialog.cpp \ diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 934e153..27d4d17 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -139,84 +139,106 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam size += 6; maxwidth+= 6; } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mPrevWeek->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextWeek->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); ctrlLayout->addWidget( mPrevWeek, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextWeek, 3 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); mPrevYear->setFocusPolicy(NoFocus); mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); mPrevWeek->setFocusPolicy(NoFocus); mNextWeek->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } NavigatorBar::~NavigatorBar() { } +void NavigatorBar::showButtons( bool left, bool right ) +{ + if ( left ) { + mPrevYear->show(); + mPrevMonth->show(); + } else { + mPrevYear->hide(); + mPrevMonth->hide(); + } + + if ( right ) { + mNextYear->show(); + mNextMonth->show(); + } else { + mNextYear->hide(); + mNextMonth->hide(); + } + if ( !left && !right ) { + mSelectMonth->setMaximumWidth( 1024 ); + mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); + } +} void NavigatorBar::selectMonth() { int month; KPopupFrame* popup = new KPopupFrame(this); KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); picker->setFocus(); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) { month = picker->getResult(); emit monthSelected ( month ); } else { KNotifyClient::beep(); } delete popup; } void NavigatorBar::selectDates( const KCal::DateList &dateList ) { if (dateList.count() > 0) { QDate date = dateList.first(); const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); // compute the label at the top of the navigator QString dtstr = i18n(calSys->monthName( date )) + " '" + QString::number( calSys->year( date ) ).right(2); mSelectMonth->setText( dtstr ); } } diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 803c817..4442caa 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -1,69 +1,70 @@ /* This file is part of KOrganizer. Copyright (c) 2003 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 NAVIGATORBAR_H #define NAVIGATORBAR_H #include <libkcal/incidencebase.h> #include <qwidget.h> class QPushButton; class QFrame; class QLabel; class NavigatorBar: public QWidget { Q_OBJECT public: NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); ~NavigatorBar(); + void showButtons( bool left, bool right ); public slots: void selectDates( const KCal::DateList & ); void selectMonth(); signals: void goNextMonth(); void goPrevMonth(); void goNextWeek(); void goPrevWeek(); void goNextYear(); void goPrevYear(); void monthSelected( int ); private: QFrame *mCtrlFrame; QPushButton *mPrevYear; QPushButton *mPrevMonth; QPushButton *mNextMonth; QPushButton *mPrevWeek; QPushButton *mNextWeek; QPushButton *mNextYear; QPushButton *mSelectMonth; //QLabel *mDateLabel; }; #endif |