Better wording
[kdepim.git] / calendarsupport / groupware.h
blob93fc54f4c9e4051232c6edf7af55f3b973e85ce0
1 /*
2 Copyright (c) 2002-2004 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 In addition, as a special exception, the copyright holders give
19 permission to link the code of this program with any edition of
20 the Qt library by Trolltech AS, Norway (or with modified versions
21 of Qt that use the same license as Qt), and distribute linked
22 combinations including the two. You must obey the GNU General
23 Public License in all respects for all of the code used other than
24 Qt. If you modify this file, you may extend this exception to
25 your version of the file, but you are not obligated to do so. If
26 you do not wish to do so, delete this exception statement from
27 your version.
30 #ifndef CALENDARSUPPORT_GROUPWARE_H
31 #define CALENDARSUPPORT_GROUPWARE_H
33 #include "calendarsupport_export.h"
34 #include "incidencechanger.h"
35 #include "nepomukcalendar.h"
37 #include <KCalCore/ICalFormat>
39 namespace Akonadi {
40 class Item;
43 namespace CalendarSupport {
45 class MailScheduler;
47 class CALENDARSUPPORT_EXPORT GroupwareUiDelegate
49 public:
50 virtual ~GroupwareUiDelegate();
51 virtual void requestIncidenceEditor( const Akonadi::Item &item ) = 0;
53 virtual void setCalendar( CalendarSupport::Calendar *calendar ) = 0;
54 virtual void createCalendar() = 0;
57 class CALENDARSUPPORT_EXPORT Groupware : public QObject
59 Q_OBJECT
60 public:
61 /**
62 @see sendICalMessage
64 struct SendICalMessageDialogAnswers {
65 SendICalMessageDialogAnswers() : sendEmailAnswer( 0 ),
66 notOrganizerAnswer( 0 ),
67 sendingErrorAnswer( 0 ) { }
68 int sendEmailAnswer;
69 int notOrganizerAnswer;
70 int sendingErrorAnswer;
73 static Groupware *create( GroupwareUiDelegate * );
74 static Groupware *instance();
76 ~Groupware();
78 /** Send iCal messages after asking the user
79 Returns false if the user cancels the dialog, and true if the
80 user presses Yes or No. ( This last afirmation seems false, i don't see a
81 cancel button, and there's more than one dialog ).
83 @param dialogAnswers will contain user answers to all dialogs that
84 were presented.
86 If @p reuseDialogAnswers is true, this variable is also read,
87 otherwise only written to.
89 This is useful so the user isn't presented with the same dialog
90 twice on the same atomic operations like dissociating occurrences
91 ( which are composed of an "add incidence" and a "change incidence" ).
93 @param reuseDialogAnswers, if true, sendICalMessage() will only
94 ask the user if it didn't find the answer in @p dialogResults
96 bool sendICalMessage( QWidget *parent,
97 KCalCore::iTIPMethod method,
98 const KCalCore::Incidence::Ptr &incidence,
99 IncidenceChanger::HowChanged action,
100 bool attendeeStatusChanged,
101 SendICalMessageDialogAnswers &dialogAnswers,
102 MailScheduler &scheduler,
103 bool reuseDialogAnswers = false );
105 // DoNotNotify is a flag indicating that the user does not want
106 // updates sent back to the organizer.
107 void setDoNotNotify( bool notify ) { mDoNotNotify = notify; }
108 bool doNotNotify() { return mDoNotNotify; }
109 void handleInvitation( const QString &receiver,
110 const QString &iCal,
111 const QString &type );
112 private Q_SLOTS:
113 void finishHandlingInvitation();
115 // Frees calendar if it doesn't have jobs running
116 void calendarJobFinished( bool success, const QString &errorString );
118 Q_SIGNALS:
119 void handleInvitationFinished( bool success, const QString &errorMessage );
121 protected:
122 Groupware( GroupwareUiDelegate * );
124 private:
125 static Groupware *mInstance;
126 KCalCore::ICalFormat mFormat;
127 GroupwareUiDelegate *mDelegate;
128 bool mDoNotNotify;
129 class Private;
130 Private *const d;
135 //@cond PRIVATE
136 inline uint qHash( const QSharedPointer<CalendarSupport::NepomukCalendar> &key )
138 return qHash<CalendarSupport::NepomukCalendar>( key.data() );
140 //@endcond
142 #endif