~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to calendarsupport/freebusymanager.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Requires the Qt and KDE widget libraries, available at no cost at
 
3
  http://www.trolltech.com and http://www.kde.org respectively
 
4
 
 
5
  Copyright (c) 2002-2004 Klarälvdalens Datakonsult AB
 
6
        <info@klaralvdalens-datakonsult.se>
 
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
  In addition, as a special exception, the copyright holders give
 
23
  permission to link the code of this program with any edition of
 
24
  the Qt library by Trolltech AS, Norway (or with modified versions
 
25
  of Qt that use the same license as Qt), and distribute linked
 
26
  combinations including the two.  You must obey the GNU General
 
27
  Public License in all respects for all of the code used other than
 
28
  Qt.  If you modify this file, you may extend this exception to
 
29
  your version of the file, but you are not obligated to do so.  If
 
30
  you do not wish to do so, delete this exception statement from
 
31
  your version.
 
32
*/
 
33
#ifndef CALENDARSUPPORT_FREEBUSYMANAGER_H
 
34
#define CALENDARSUPPORT_FREEBUSYMANAGER_H
 
35
 
 
36
#include "calendarsupport_export.h"
 
37
 
 
38
#include <KCalCore/FreeBusyCache>
 
39
 
 
40
namespace CalendarSupport {
 
41
 
 
42
class Calendar;
 
43
class FreeBusyManagerPrivate;
 
44
class FreeBusyManagerStatic;
 
45
 
 
46
class CALENDARSUPPORT_EXPORT FreeBusyManager : public QObject, public KCalCore::FreeBusyCache
 
47
{
 
48
  Q_OBJECT
 
49
  public:
 
50
    /**
 
51
     * Returns the FreeBusyManager
 
52
     */
 
53
    static FreeBusyManager *self();
 
54
 
 
55
    void setCalendar( CalendarSupport::Calendar * );
 
56
 
 
57
    /**
 
58
      Publishes the owners freebusy information from the current calendar
 
59
      starting from the current date/time to current date/time + freeBusyPublishDays.
 
60
      If an upload is already in progress nothing happens.
 
61
 
 
62
      @see KCalPrefBase::freeBusyPublishUrl()
 
63
      @see KCalPrefBase::freeBusyPublishDays();
 
64
     */
 
65
    void publishFreeBusy( QWidget *parentWidget = 0 );
 
66
 
 
67
    /**
 
68
      Mail the freebusy information.
 
69
     */
 
70
    void mailFreeBusy( int daysToPublish = 30, QWidget *parentWidget = 0 );
 
71
     
 
72
   /**
 
73
      Retrieve the freebusy information of somebody else, i.e. it will not try
 
74
      to download our own freebusy information. This method makes use of a local
 
75
      cache, if the information for a given email is already downloaded it will
 
76
      return the information from the cache.
 
77
 
 
78
      The call is asynchronous, a download is started in the background (if
 
79
      needed) and freeBusyRetrieved will be emitted when the download is finished.
 
80
 
 
81
      @see KCalPrefs::thatIsMe( const QString &email );
 
82
 
 
83
      @param email Address of the person for which the F/B list should be
 
84
             retrieved.
 
85
      @param forceDownload Set to true to trigger a download even when automatic
 
86
             retrieval of freebusy information is disabled in the configuration.
 
87
      @return true if a download is initiated, and false otherwise
 
88
    */
 
89
    bool retrieveFreeBusy( const QString &email, bool forceDownload,
 
90
                           QWidget *parentWidget = 0 );
 
91
 
 
92
    /**
 
93
      Clears the retrieval queue, i.e. all retrieval request that are not started
 
94
      yet will not start at all. The freebusy retrieval that currently is
 
95
      downloading (if one) will not be canceled.
 
96
 
 
97
      @see retrieveFreeBusy
 
98
     */
 
99
    void cancelRetrieval();
 
100
 
 
101
    /**
 
102
      Load freebusy information belonging to an email. The information is loaded
 
103
      from a local file. If the file does not exists or doesn't contain valid
 
104
      information 0 is returned. In that case the information should be retrieved
 
105
      again by calling retrieveFreeBusy.
 
106
 
 
107
      Implements KCalCore::FreeBusyCache::loadFreeBusy
 
108
 
 
109
      @param email is a QString containing a email string in the
 
110
      "FirstName LastName <emailaddress>" format.
 
111
    */
 
112
    virtual KCalCore::FreeBusy::Ptr loadFreeBusy( const QString &email );
 
113
 
 
114
    /**
 
115
      Save freebusy information belonging to an email.
 
116
 
 
117
      Implements KCalCore::FreeBusyCache::saveFreeBusy
 
118
 
 
119
      @param freebusy is a pointer to a valid FreeBusy instance.
 
120
      @param person is a valid Person instance.
 
121
    */
 
122
    virtual bool saveFreeBusy( const KCalCore::FreeBusy::Ptr &freebusy,
 
123
                               const KCalCore::Person::Ptr &person );
 
124
 
 
125
  signals:
 
126
    /**
 
127
      This signal is emitted to return results of free/busy requests.
 
128
    */
 
129
    void freeBusyRetrieved( const KCalCore::FreeBusy::Ptr &,
 
130
                            const QString &email );
 
131
 
 
132
  protected:
 
133
    /** React on timer events, used for delayed freebusy list uploading */
 
134
    virtual void timerEvent( QTimerEvent * );
 
135
 
 
136
  private:
 
137
    /**
 
138
      Creates a new FreeBusyManager, private because FreeBusyManager is a
 
139
      Singleton
 
140
     */
 
141
    FreeBusyManager();
 
142
    virtual ~FreeBusyManager();
 
143
 
 
144
  private:
 
145
    friend class FreeBusyManagerStatic;
 
146
 
 
147
    FreeBusyManagerPrivate * const d_ptr;
 
148
    Q_DECLARE_PRIVATE( FreeBusyManager )
 
149
    Q_DISABLE_COPY( FreeBusyManager )
 
150
    Q_PRIVATE_SLOT( d_ptr, void checkFreeBusyUrl() )
 
151
    Q_PRIVATE_SLOT( d_ptr, void processFreeBusyDownloadResult( KJob * ) )
 
152
    Q_PRIVATE_SLOT( d_ptr, void processFreeBusyUploadResult( KJob * ) )
 
153
    Q_PRIVATE_SLOT( d_ptr, void processRetrieveQueue() )
 
154
    Q_PRIVATE_SLOT( d_ptr, void uploadFreeBusy() )
 
155
};
 
156
 
 
157
}
 
158
 
 
159
#endif