doc update
[kdepim.git] / korganizer / koeventview.h
blobf86dab36f7509ce8a23570816fe3674d3df2f49b
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
5 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
6 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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.
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.
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.
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.
26 #ifndef KOEVENTVIEW_H
27 #define KOEVENTVIEW_H
29 #include <KCal/Todo>
30 #include "korganizer/baseview.h"
32 namespace KCal {
33 class Incidence;
35 namespace Akonadi {
36 class Item;
38 using namespace KCal;
40 class KOEventPopupMenu;
41 class QMenu;
43 /**
44 KOEventView is the abstract base class from which all other
45 calendar views for event data are derived. It provides methods for
46 displaying
47 appointments and events on one or more days. The actual number of
48 days that a view actually supports is not defined by this abstract class;
49 that is up to the classes that inherit from it. It also provides
50 methods for updating the display, retrieving the currently selected
51 event (or events), and the like.
53 @short Abstract class from which all event views are derived.
54 @author Preston Brown <pbrown@kde.org>
55 @see KOListView, KOAgendaView, KOMonthView
57 class KOEventView : public KOrg::BaseView
59 Q_OBJECT
60 public:
61 /**
62 * Constructs a view.
63 * @param cal is a pointer to the calendar object from which events
64 * will be retrieved for display.
65 * @param parent is the parent QWidget.
67 explicit KOEventView( QWidget *parent=0 );
69 /**
70 * Destructor. Views will do view-specific cleanups here.
72 virtual ~KOEventView();
74 /**
75 * provides a hint back to the caller on the maximum number of dates
76 * that the view supports. A return value of 0 means no maximum.
78 virtual int maxDatesHint() = 0;
80 /**
81 * Construct a standard context menu for an event.
83 KOEventPopupMenu *eventPopup();
85 /**
86 * Construct a standard context that allows to create a new event.
88 QMenu *newEventPopup();
90 /** This view is a view for displaying events. */
91 bool isEventView() { return true; }
93 int showMoveRecurDialog( const Akonadi::Item &inc, const QDate &date );
95 /**
96 * Handles key events, opens the new event dialog when enter is pressed, activates
97 * type ahead.
99 bool processKeyEvent( QKeyEvent * );
102 * Sets the QObject that will receive key events that were made
103 * while the new event dialog was still being created.
105 void setTypeAheadReceiver( QObject *o );
108 * Returns true if the view item, that represents a to-do, should use the "completed"
109 * pixmap.
111 * @param todo The to-do associated with the view item.
112 * @param date The date in which the item appears in the view, for non recuring to-dos
113 * this is the same as the start date, but, for recurring to-dos this is the date of
114 * a particular occurrence.
117 static bool usesCompletedTodoPixmap( const Akonadi::Item &todo, const QDate &date );
119 public slots:
121 void focusChanged( QWidget*, QWidget* );
123 Perform the default action for an incidence, e.g. open the event editor,
124 when double-clicking an event in the agenda view.
126 void defaultAction( const Akonadi::Item &incidence );
128 signals:
130 * when the view changes the dates that are selected in one way or
131 * another, this signal is emitted. It should be connected back to
132 * the KDateNavigator object so that it changes appropriately,
133 * and any other objects that need to be aware that the list of
134 * selected dates has changed.
135 * @param datelist the new list of selected dates
137 void datesSelected( const DateList datelist );
140 * Emitted when an event is moved using the mouse in an agenda
141 * view (week / month).
143 void shiftedEvent( const QDate &olddate, const QDate &ewdate );
145 protected slots:
146 void popupShow();
147 void popupEdit();
148 void popupDelete();
149 void popupCut();
150 void popupCopy();
151 virtual void showNewEventPopup();
153 protected:
154 Akonadi::Item mCurrentIncidence; // Incidence selected e.g. for a context menu
156 private:
158 * This is called when the new event dialog is shown. It sends
159 * all events in mTypeAheadEvents to the receiver.
161 void finishTypeAhead();
163 private:
165 /* When we receive a QEvent with a key_Return release
166 * we will only show a new event dialog if we previously received a
167 * key_Return press, otherwise a new event dialog appears when
168 * you hit return in some yes/no dialog */
169 bool mReturnPressed;
171 bool mTypeAhead;
172 QObject *mTypeAheadReceiver;
173 QList<QEvent*> mTypeAheadEvents;
176 #endif