• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

korganizer

  • sources
  • kde-4.14
  • kdepim
  • korganizer
kodaymatrix.h
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
5  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
6  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 
22  As a special exception, permission is given to link this program
23  with any edition of Qt, and distribute the resulting executable,
24  without including the source code for Qt in the source distribution.
25 */
26 
27 #ifndef KORG_KODAYMATRIX_H
28 #define KORG_KODAYMATRIX_H
29 
30 #include <Akonadi/Calendar/ETMCalendar>
31 
32 #include <KCalCore/IncidenceBase> //for KCalCore::DateList typedef
33 
34 #include <QFrame>
35 
69 class KODayMatrix: public QFrame, public Akonadi::ETMCalendar::CalendarObserver
70 {
71  Q_OBJECT
72  public:
78  explicit KODayMatrix( QWidget *parent );
79 
82  ~KODayMatrix();
83 
87  static QPair<QDate,QDate> matrixLimits( const QDate &month );
88 
93  void setCalendar( const Akonadi::ETMCalendar::Ptr & );
94 
103  void updateView( const QDate &actdate );
104 
109  void updateIncidences();
110 
115  const QDate &getDate( int offset ) const;
116 
121  QString getHolidayLabel( int offset ) const;
122 
127  void addSelectedDaysTo( KCalCore::DateList & );
128 
136  void setSelectedDaysFrom( const QDate &start, const QDate &end );
137 
141  void clearSelection();
142 
146  bool isTodayVisible() const { return mToday >= 0; }
147 
155  bool isBeginningOfMonth() const { return mToday <= 8; }
156  bool isEndOfMonth() const { return mToday >= 27; }
157 
162  void calendarIncidenceAdded( const KCalCore::Incidence::Ptr &incidence );
163  void calendarIncidenceChanged( const KCalCore::Incidence::Ptr &incidence );
164  void calendarIncidenceDeleted( const KCalCore::Incidence::Ptr &incidence );
165 
167  void setHighlightMode( bool highlightEvents,
168  bool highlightTodos,
169  bool highlightJournals );
170  void setUpdateNeeded();
171  public slots:
176  void updateView();
177 
182  void recalculateToday();
183 
187  void resourcesChanged();
188 
189  signals:
196  void selected( const KCalCore::DateList &daylist );
197 
198  void newEventSignal( const QDate &date );
199  void newTodoSignal( const QDate &date );
200  void newJournalSignal( const QDate &date );
201 
209  void incidenceDropped( const Akonadi::Item &item, const QDate &dt );
210 
218  void incidenceDroppedMove( const Akonadi::Item &item, const QDate &dt );
219 
220  protected:
221  bool event( QEvent *e );
222 
223  void paintEvent( QPaintEvent *ev );
224 
225  void mousePressEvent( QMouseEvent *e );
226 
227  void mouseReleaseEvent( QMouseEvent *e );
228 
229  void mouseMoveEvent( QMouseEvent *e );
230 
231  void resizeEvent( QResizeEvent * );
232 
233  void dragEnterEvent( QDragEnterEvent *e );
234 
235  void dragMoveEvent( QDragMoveEvent *e );
236 
237  void dragLeaveEvent( QDragLeaveEvent *e );
238 
239  void dropEvent( QDropEvent *e );
240 
241  private:
245  void popupMenu( const QDate &date );
246 
252  int getDayIndexFrom( int x, int y ) const;
253 
259  QColor getShadedColor( const QColor &color ) const;
260 
262  void updateEvents();
263 
265  void updateTodos();
266 
268  void updateJournals();
269 
272  static const int NUMDAYS;
273 
275  Akonadi::ETMCalendar::Ptr mCalendar;
276 
278  QDate mStartDate;
279 
281  QString *mDayLabels;
282 
285  QDate *mDays;
286 
288  QList<QDate> mEvents;
289 
291  QMap<int,QString> mHolidays;
292 
294  int mToday;
295 
298  int mSelInit;
299 
302  static const int NOSELECTION;
303 
305  int mSelStart;
306 
308  int mSelEnd;
309 
312  int mTodayMarginWidth;
313 
317  QRect mDaySize;
318 
322  bool mPendingChanges;
323 
325  bool mHighlightEvents;
326 
328  bool mHighlightTodos;
329 
331  bool mHighlightJournals;
332 };
333 
334 #endif
QEvent
QResizeEvent
QWidget
KODayMatrix::clearSelection
void clearSelection()
Clear all selections.
Definition: kodaymatrix.cpp:147
KODayMatrix::~KODayMatrix
~KODayMatrix()
destructor that deallocates all dynamically allocated private members.
Definition: kodaymatrix.cpp:98
KODayMatrix::incidenceDropped
void incidenceDropped(const Akonadi::Item &item, const QDate &dt)
Emitted if the user has dropped an incidence (event or todo) inside the matrix.
KODayMatrix::isEndOfMonth
bool isEndOfMonth() const
Definition: kodaymatrix.h:156
KODayMatrix::matrixLimits
static QPair< QDate, QDate > matrixLimits(const QDate &month)
returns the first and last date of the 6*7 matrix that displays month
Definition: kodaymatrix.cpp:886
KODayMatrix::resizeEvent
void resizeEvent(QResizeEvent *)
Definition: kodaymatrix.cpp:878
QDragMoveEvent
KODayMatrix::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *e)
Definition: kodaymatrix.cpp:632
KODayMatrix::newTodoSignal
void newTodoSignal(const QDate &date)
KODayMatrix::getDate
const QDate & getDate(int offset) const
Returns the QDate object associated with day indexed by the supplied offset.
Definition: kodaymatrix.cpp:412
KODayMatrix::isTodayVisible
bool isTodayVisible() const
Is today visible in the view? Keep this in sync with the values today (below) can take...
Definition: kodaymatrix.h:146
QMap< int, QString >
KODayMatrix::calendarIncidenceDeleted
void calendarIncidenceDeleted(const KCalCore::Incidence::Ptr &incidence)
Definition: kodaymatrix.cpp:447
QWidget::y
int y() const
KODayMatrix::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *e)
Definition: kodaymatrix.cpp:607
QMouseEvent
KODayMatrix::isBeginningOfMonth
bool isBeginningOfMonth() const
If today is visible, then we can find out if today is near the beginning or the end of the month...
Definition: kodaymatrix.h:155
KODayMatrix::setHighlightMode
void setHighlightMode(bool highlightEvents, bool highlightTodos, bool highlightJournals)
Sets which incidences should be highlighted.
Definition: kodaymatrix.cpp:453
KODayMatrix::event
bool event(QEvent *e)
Definition: kodaymatrix.cpp:477
KODayMatrix::calendarIncidenceAdded
void calendarIncidenceAdded(const KCalCore::Incidence::Ptr &incidence)
Reimplemented from Akonadi::ETMCalendar They set mPendingChanges to true.
Definition: kodaymatrix.cpp:435
QRect
KODayMatrix::updateIncidences
void updateIncidences()
Update incidence states of dates.
Definition: kodaymatrix.cpp:249
QWidget::x
int x() const
KODayMatrix::setSelectedDaysFrom
void setSelectedDaysFrom(const QDate &start, const QDate &end)
Sets the actual to be displayed selection in the day matrix starting from start and ending with end...
Definition: kodaymatrix.cpp:139
QDropEvent
KODayMatrix::getHolidayLabel
QString getHolidayLabel(int offset) const
Returns the official name of this holy day or 0 if there is no label for this day.
Definition: kodaymatrix.cpp:420
KODayMatrix::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *e)
Definition: kodaymatrix.cpp:533
QDate
QString
CalendarObserver
QList< QDate >
QColor
KODayMatrix::mousePressEvent
void mousePressEvent(QMouseEvent *e)
Definition: kodaymatrix.cpp:500
QPair
KODayMatrix::calendarIncidenceChanged
void calendarIncidenceChanged(const KCalCore::Incidence::Ptr &incidence)
Definition: kodaymatrix.cpp:441
KODayMatrix::updateView
void updateView()
Recalculates all the flags of the days in the matrix like holidays or events on a day (Actually calls...
Definition: kodaymatrix.cpp:172
KODayMatrix::selected
void selected(const KCalCore::DateList &daylist)
Emitted if the user selects a block of days with the mouse by dragging a rectangle inside the matrix...
KODayMatrix::dropEvent
void dropEvent(QDropEvent *e)
Definition: kodaymatrix.cpp:639
QFrame
KODayMatrix::incidenceDroppedMove
void incidenceDroppedMove(const Akonadi::Item &item, const QDate &dt)
Emitted if the user has dropped an event inside the matrix and chose to move it instead of copy...
KODayMatrix::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *e)
Definition: kodaymatrix.cpp:622
KODayMatrix::resourcesChanged
void resourcesChanged()
Handle resource changes.
Definition: kodaymatrix.cpp:468
QDragLeaveEvent
KODayMatrix::setCalendar
void setCalendar(const Akonadi::ETMCalendar::Ptr &)
Associate a calendar with this day matrix.
Definition: kodaymatrix.cpp:70
KODayMatrix::paintEvent
void paintEvent(QPaintEvent *ev)
Definition: kodaymatrix.cpp:712
QDragEnterEvent
KODayMatrix::addSelectedDaysTo
void addSelectedDaysTo(KCalCore::DateList &)
Adds all actual selected days from mSelStart to mSelEnd to the supplied DateList. ...
Definition: kodaymatrix.cpp:108
KODayMatrix
Replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed.
Definition: kodaymatrix.h:69
KODayMatrix::KODayMatrix
KODayMatrix(QWidget *parent)
constructor to create a day matrix widget.
Definition: kodaymatrix.cpp:53
KODayMatrix::setUpdateNeeded
void setUpdateNeeded()
Definition: kodaymatrix.cpp:177
QPaintEvent
QObject::parent
QObject * parent() const
KODayMatrix::newEventSignal
void newEventSignal(const QDate &date)
KODayMatrix::recalculateToday
void recalculateToday()
Calculates which square in the matrix should be hiighted to indicate the square is on "today"...
Definition: kodaymatrix.cpp:152
KODayMatrix::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *e)
Definition: kodaymatrix.cpp:570
KODayMatrix::newJournalSignal
void newJournalSignal(const QDate &date)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal