Commit 4612818a authored by Sergio Martins's avatar Sergio Martins
Browse files

Added the "preferredMonth" to the datesSelected() signal too.

The view now has an hint of which month to display when a week crosses two months.

Clicking on a date navigator date now keeps month view in sync.

CCBUG: 258866
parent f1b22a7d
......@@ -205,8 +205,8 @@ CalendarView::CalendarView( QWidget *parent )
connect( mDateNavigatorContainer, SIGNAL(goNext()),
mDateNavigator, SLOT(selectNext()) );
connect( mDateNavigatorContainer, SIGNAL(datesSelected(KCalCore::DateList)),
mDateNavigator, SLOT(selectDates(KCalCore::DateList)) );
connect( mDateNavigatorContainer, SIGNAL(datesSelected(KCalCore::DateList,QDate)),
mDateNavigator, SLOT(selectDates(KCalCore::DateList,QDate)) );
connect( mViewManager, SIGNAL(datesSelected(KCalCore::DateList)),
mDateNavigator, SLOT(selectDates(KCalCore::DateList)) );
......
......@@ -54,11 +54,11 @@ int DateNavigator::datesCount() const
return mSelectedDates.count();
}
void DateNavigator::selectDates( const DateList &dateList )
void DateNavigator::selectDates( const DateList &dateList, const QDate &preferredMonth )
{
if ( dateList.count() > 0 ) {
mSelectedDates = dateList;
emitSelected();
emitSelected( preferredMonth );
}
}
......
......@@ -49,7 +49,7 @@ class DateNavigator : public QObject
int datesCount() const;
public slots:
void selectDates( const KCalCore::DateList & );
void selectDates( const KCalCore::DateList &, const QDate &preferredMonth = QDate() );
void selectDate( const QDate & );
void selectDates( int count );
......
......@@ -69,7 +69,7 @@ DateNavigatorContainer::~DateNavigatorContainer()
void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
{
connect( v, SIGNAL(datesSelected(KCalCore::DateList)),
SIGNAL(datesSelected(KCalCore::DateList)) );
SLOT(handleDatesSelectedSignal(KCalCore::DateList)) );
connect( v, SIGNAL(incidenceDropped(Akonadi::Item,QDate)),
SIGNAL(incidenceDropped(Akonadi::Item,QDate)) );
......@@ -383,4 +383,13 @@ QDate DateNavigatorContainer::monthOfNavigator( int navigatorIndex ) const
}
}
void DateNavigatorContainer::handleDatesSelectedSignal( const KCalCore::DateList &dateList )
{
Q_ASSERT( sender() );
KDateNavigator *navigator = qobject_cast<KDateNavigator*>( sender() );
Q_ASSERT( navigator );
emit datesSelected( dateList, navigator->month() );
}
#include "datenavigatorcontainer.moc"
......@@ -84,7 +84,7 @@ class DateNavigatorContainer: public QFrame
void goNextMonth();
signals:
void datesSelected( const KCalCore::DateList & );
void datesSelected( const KCalCore::DateList &, const QDate &preferredMonth );
void incidenceDropped( const Akonadi::Item &, const QDate & );
void incidenceDroppedMove( const Akonadi::Item &, const QDate & );
void newEventSignal( const QDate & );
......@@ -135,6 +135,9 @@ class DateNavigatorContainer: public QFrame
the other parts of the splitter are resized earlier now */
void resizeAllContents();
private slots:
void handleDatesSelectedSignal( const KCalCore::DateList & );
private:
/* Returns the first day of the first KDateNavigator, and the last day
of the last KDateNavigator.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment