30 #include "../widgets/kdatenavigator.h"
35 #include <KCalendarSystem>
41 mHorizontalCount( 1 ), mVerticalCount( 1 ),
42 mIgnoreNavigatorUpdates( false )
46 i18n(
"<qt><p>Select the dates you want to "
47 "display in KOrganizer's main view here. Hold the "
48 "mouse button to select more than one day.</p>"
49 "<p>Press the top buttons to browse to the next "
50 "/ previous months or years.</p>"
51 "<p>Each line shows a week. The number in the left "
52 "column is the number of the week in the year. "
53 "Press it to select the whole week.</p>"
61 qDeleteAll( mExtraViews );
67 SLOT(handleDatesSelectedSignal(KCalCore::DateList)) );
162 const QDate &preferredMonth )
164 if ( !dateList.isEmpty() ) {
165 QDate start( dateList.first() );
166 QDate end( dateList.last() );
170 if ( !mExtraViews.
isEmpty() ) {
171 navlast = mExtraViews.
last()->endDate();
172 navsecond = mExtraViews.
first()->startDate();
174 navlast = mNavigatorView->
endDate();
175 navsecond = navfirst;
182 const bool changingMonth =
184 calSys->month( mNavigatorView->
month() ) != calSys->month( preferredMonth ) );
186 if ( start < navfirst ||
188 ( end > navlast && start >= navsecond ) ||
191 if ( preferredMonth.
isValid() ) {
198 if ( !mIgnoreNavigatorUpdates ) {
211 QDate baseDate = start;
212 if ( !mIgnoreNavigatorUpdates ) {
218 if ( !mIgnoreNavigatorUpdates ) {
227 kDebug() <<
"DateNavigatorContainer::resizeEvent()";
228 kDebug() <<
" CURRENT SIZE:" <<
size();
230 kDebug() <<
" SIZEHINT:" <<
sizeHint();
245 if ( horizontalCount != mHorizontalCount || verticalCount != mVerticalCount ) {
246 int count = horizontalCount * verticalCount;
251 while ( count > ( mExtraViews.
count() + 1 ) ) {
258 while ( count < ( mExtraViews.
count() + 1 ) ) {
259 delete ( mExtraViews.
last() );
263 mHorizontalCount = horizontalCount;
264 mVerticalCount = verticalCount;
278 if ( horizontalCount > 1 ) {
285 ( horizontalCount - 1 ) : 0 ) * width ),
287 for (
int i = 0; i < mExtraViews.
count(); ++i ) {
288 int x = ( i + 1 ) % horizontalCount;
289 int y = ( i + 1 ) / horizontalCount;
296 if ( x + 1 == horizontalCount ) {
303 ( horizontalCount - 1 - x ) : x ) * width ),
304 y * height, width, height );
321 bool highlightJournals )
const {
323 mNavigatorView->
setHighlightMode( highlightEvents, highlightTodos, highlightJournals );
354 QDate firstMonth, lastMonth;
356 lastMonth = mNavigatorView->
month();
358 lastMonth = mExtraViews.
last()->month();
361 firstMonth = calSys->
addMonths( mNavigatorView->
month(), offset );
362 lastMonth = calSys->
addMonths( lastMonth, offset );
367 return qMakePair( firstMonthBoundary.first, lastMonthBoundary.second );
372 if ( navigatorIndex == 0 ) {
373 return mNavigatorView->
month();
376 if ( navigatorIndex <= mExtraViews.
count() && navigatorIndex >= 0 ) {
377 return mExtraViews[navigatorIndex-1]->month();
383 void DateNavigatorContainer::handleDatesSelectedSignal(
const KCalCore::DateList &dateList )
390 const QDate firstDate = dateList.first();
397 void DateNavigatorContainer::handleWeekClickedSignal(
const QDate &week,
const QDate & )
412 if ( date >= limits.first && date <= limits.second ) {
414 navigator = mNavigatorView;
419 if ( date >= limits.first && date <= limits.second ) {
void selectDates(const KCalCore::DateList &)
DateNavigatorContainer(QWidget *parent=0)
QDate monthOfNavigator(int navigatorIndex=0) const
Returns the month of the specified KDateNavigator.
void resizeEvent(QResizeEvent *)
static QPair< QDate, QDate > matrixLimits(const QDate &month)
returns the first and last date of the 6*7 matrix that displays month
void datesSelected(const KCalCore::DateList &, const QDate &preferredMonth)
NavigatorBar * navigatorBar() const
void setHighlightMode(bool highlightEvents, bool highlightTodos, bool highlightJournals) const
void incidenceDropped(const Akonadi::Item &, const QDate &)
KCalCore::DateList selectedDates() const
const T & at(int i) const
void newEventSignal(const QDate &)
virtual QSize sizeHint() const
void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Associate date navigator with a calendar.
int count(const T &value) const
void append(const T &value)
void incidenceDroppedMove(const Akonadi::Item &, const QDate &)
void newJournalSignal(const QDate &)
QDate addMonths(int nmonths) const
void nextMonthClicked(const QDate ¤tMonth, const QDate &selectionLowerLimit, const QDate &selectionUpperLimit)
~DateNavigatorContainer()
void connectNavigatorView(KDateNavigator *v)
void prevMonthClicked(const QDate ¤tMonth, const QDate &selectionLowerLimit, const QDate &selectionUpperLimit)
Signals that the previous month button has been clicked.
void setBaseDate(const QDate &)
QSize minimumSizeHint() const
void yearSelected(int year)
void weekClicked(const QDate &week, const QDate &preferredMonth)
void monthSelected(int month)
const KCalendarSystem * calendarSystem() const
static KOGlobals * self()
QDate month() const
Returns the current displayed month.
void showButtons(bool left, bool right)
void selectDates(const KCalCore::DateList &, const QDate &preferredMonth=QDate())
preferredMonth is useful when the datelist crosses months, if different from -1, it has the month tha...
void setHighlightMode(bool highlightEvents, bool highlightTodos, bool highlightJournals) const
void setBaseDates(const QDate &start)
void newTodoSignal(const QDate &)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void resizeAllContents()
Resizes all the child elements after the size of the widget changed.
void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Associate date navigator with a calendar.