krop's commit fixes my problem in a better way, reverting
[kdepim.git] / korganizer / koincidenceeditor.h
blob5142f29e99133457d7333d1d4ea59d5fc23e693e
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
25 #ifndef KOINCIDENCEEDITOR_H
26 #define KOINCIDENCEEDITOR_H
28 #include <kpagedialog.h>
29 #include <kurl.h>
30 #include <QList>
32 namespace KPIM {
33 class DesignerFields;
34 class EmbeddedURLPage;
37 namespace KOrg {
38 class IncidenceChangerBase;
41 class KOEditorDetails;
42 class KOAttendeeEditor;
44 namespace KCal {
45 class Calendar;
46 class CalendarLocal;
47 class Incidence;
49 using namespace KCal;
50 using namespace KOrg;
52 /**
53 This is the base class for the calendar component editors.
55 class KOIncidenceEditor : public KPageDialog
57 Q_OBJECT
58 public:
59 /**
60 Construct new IncidenceEditor.
62 KOIncidenceEditor( const QString &caption, Calendar *calendar,
63 QWidget *parent );
64 virtual ~KOIncidenceEditor();
66 /** This incidence has been modified externally */
67 virtual void modified( int /*change*/= 0 ) {}
69 virtual void reload() = 0;
71 virtual void selectInvitationCounterProposal( bool enable );
72 virtual void selectCreateTask( bool enable );
74 public slots:
75 /** Edit an existing todo. */
76 virtual void editIncidence( Incidence *, Calendar * ) = 0;
77 virtual void setIncidenceChanger( IncidenceChangerBase *changer )
78 { mChanger = changer; }
80 /** Initialize editor. This function creates the tab widgets. */
81 virtual void init() = 0;
83 /**
84 Adds attachments to the editor
86 void addAttachments( const QStringList &attachments,
87 const QStringList &mimeTypes = QStringList(),
88 bool inlineAttachment = false );
90 /**
91 Adds attendees to the editor
93 void addAttendees( const QStringList &attendees );
95 signals:
96 void buttonClicked( int );
97 void deleteAttendee( Incidence * );
99 void editCategories();
100 void updateCategoryConfig();
101 void dialogClose( Incidence * );
102 void editCanceled( Incidence * );
104 void deleteIncidenceSignal( Incidence * );
105 void signalAddAttachments( const QStringList &attachments,
106 const QStringList &mimeTypes = QStringList(),
107 bool inlineAttachment = false );
109 protected slots:
110 void reject();
111 void accept();
113 void openURL( const KUrl &url );
115 virtual void slotButtonClicked( int button );
116 virtual void slotManageTemplates();
118 virtual void slotSaveTemplate( const QString & ) = 0;
119 virtual void slotLoadTemplate( const QString & );
120 virtual void slotTemplatesChanged( const QStringList & );
122 protected:
123 virtual void closeEvent( QCloseEvent * );
125 virtual QString type() { return QString(); }
126 virtual QStringList &templates() const = 0;
127 virtual void loadTemplate( CalendarLocal & ) = 0;
129 void setupAttendeesTab();
130 void setupDesignerTabs( const QString &type );
132 void saveAsTemplate( Incidence *, const QString &name );
134 void readDesignerFields( Incidence *i );
135 void writeDesignerFields( Incidence *i );
138 Returns true if the user made any alteration
140 virtual bool incidenceModified();
142 // Returns the page widget. To remove the tab, just delete that one.
143 QWidget *addDesignerTab( const QString &uifile );
145 void setupEmbeddedURLPage( const QString &label, const QString &url,
146 const QString &mimetype );
147 void createEmbeddedURLPages( Incidence *i );
150 Process user input and create or update event.
151 @return false if input is invalid.
153 virtual bool processInput() { return false; }
155 virtual void processCancel() {}
157 void cancelRemovedAttendees( Incidence *incidence );
159 Calendar *mCalendar;
161 KOEditorDetails *mDetails;
162 KOAttendeeEditor *mAttendeeEditor;
163 KOrg::IncidenceChangerBase *mChanger;
165 QList<KPIM::DesignerFields*> mDesignerFields;
166 QMap<QWidget*, KPIM::DesignerFields*> mDesignerFieldForWidget;
167 QList<QWidget*> mEmbeddedURLPages;
168 QList<QWidget*> mAttachedDesignerFields;
169 bool mIsCounter;
170 bool mIsCreateTask;
173 #endif