-rw-r--r-- | korganizer/calendarview.cpp | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6eaac1c..00285a5 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -98,24 +98,25 @@ #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> @@ -258,26 +259,27 @@ void CalendarView::init() 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() ), @@ -286,70 +288,82 @@ void CalendarView::init() 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 & ) ) ); @@ -363,29 +377,29 @@ void CalendarView::init() 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 *) ) ); @@ -458,25 +472,25 @@ void CalendarView::init() 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; @@ -3676,43 +3690,47 @@ void CalendarView::takeOverCalendar() 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() |