~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/libkdepim-copy/addresseeview.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of libkdepim.
 
3
 
 
4
    Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
 
5
 
 
6
    This library is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU Library General Public
 
8
    License as published by the Free Software Foundation; either
 
9
    version 2 of the License, or (at your option) any later version.
 
10
 
 
11
    This library is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
    Library General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU Library General Public License
 
17
    along with this library; see the file COPYING.LIB.  If not, write to
 
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
    Boston, MA 02110-1301, USA.
 
20
*/
 
21
 
 
22
#ifndef KDEPIM_ADDRESSEEVIEW_H
 
23
#define KDEPIM_ADDRESSEEVIEW_H
 
24
 
 
25
#include "libkdepim-copy_export.h"
 
26
 
 
27
#include <kabc/addressee.h>
 
28
 
 
29
#include <KIMProxy>
 
30
#include <KTextBrowser>
 
31
 
 
32
class QPixmap;
 
33
 
 
34
namespace KIO {
 
35
  class Job;
 
36
}
 
37
class KToggleAction;
 
38
 
 
39
class KConfig;
 
40
class KJob;
 
41
 
 
42
namespace KPIM {
 
43
 
 
44
 
 
45
class KDEPIM_COPY_EXPORT AddresseeView : public KTextBrowser
 
46
{
 
47
  Q_OBJECT
 
48
  public:
 
49
    /**
 
50
      Constructor.
 
51
 
 
52
      @param config The config object where the settings are stored
 
53
                    which fields will be shown.
 
54
    */
 
55
    explicit AddresseeView( QWidget *parent = 0, KConfig *config = 0 );
 
56
 
 
57
    ~AddresseeView();
 
58
 
 
59
    /**
 
60
      Sets the addressee object. The addressee is displayed immediately.
 
61
 
 
62
      @param addr The addressee object.
 
63
    */
 
64
    void setAddressee( const KABC::Addressee& addr );
 
65
 
 
66
    /**
 
67
      Returns the current addressee object.
 
68
    */
 
69
    KABC::Addressee addressee() const;
 
70
 
 
71
 
 
72
    /**
 
73
      This enums are used by enableLinks to set which kind of links shall
 
74
      be enabled.
 
75
    */
 
76
    enum LinkMask {
 
77
      NoLinks = 0,
 
78
      AddressLinks = 1,
 
79
      EmailLinks = 2,
 
80
      PhoneLinks = 4,
 
81
      URLLinks = 8,
 
82
      IMLinks = 16,
 
83
      DefaultLinks = AddressLinks | EmailLinks | PhoneLinks | URLLinks | IMLinks
 
84
    };
 
85
 
 
86
    /**
 
87
      Sets which parts of the contact shall be presented as links.
 
88
      The mask can be OR'ed LinkMask. By default all links are enabled.
 
89
    */
 
90
    void enableLinks( int linkMask );
 
91
 
 
92
    /**
 
93
      This enums are used by vCardAsHTML to decide which fields shall be
 
94
      shown.
 
95
    */
 
96
    enum FieldMask {
 
97
      NoFields = 0,
 
98
      BirthdayFields = 1,
 
99
      AddressFields = 2,
 
100
      EmailFields = 4,
 
101
      PhoneFields = 8,
 
102
      URLFields = 16,
 
103
      IMFields = 32,
 
104
      CustomFields = 64,
 
105
      DefaultFields = AddressFields | EmailFields | PhoneFields | URLFields
 
106
    };
 
107
 
 
108
    /**
 
109
      Returns the HTML representation of a contact.
 
110
      The HTML code looks like
 
111
        &lt;div&gt;
 
112
        &lt;table&gt;
 
113
        ...
 
114
        &lt;/table&gt;
 
115
        &lt;/div&gt;
 
116
 
 
117
      @param addr The addressee object.
 
118
      @param linkMask The mask for which parts of the contact will
 
119
                      be displayed as links.
 
120
                      The links looks like this:
 
121
                        "addr://&lt;addr id&gt;" for addresses
 
122
                        "mailto:&lt;email address&gt;" for emails
 
123
                        "phone://&lt;phone number&gt;" for phone numbers
 
124
                        "http://&lt;url&gt;" for urls
 
125
                        "im:&lt;im addrss&gt;" for instant messaging addresses
 
126
                        "sms://&lt;phone number&gt;" for sending a sms
 
127
      @param internalLoading If true, the loading of internal pictures is done automatically.
 
128
      @param fieldMask The mask for which fields of the contact will
 
129
                       be displayed.
 
130
    */
 
131
    static QString vCardAsHTML( const KABC::Addressee& addr, ::KIMProxy *proxy, LinkMask linkMask = DefaultLinks,
 
132
                                bool internalLoading = true, FieldMask fieldMask = DefaultFields );
 
133
 
 
134
    /**
 
135
     * Encodes a QPixmap as a PNG into a data: URL (rfc2397), readable by the data kio protocol
 
136
     * @param pixmap the pixmap to encode
 
137
     * @return a data: URL
 
138
     */
 
139
    static QString pixmapAsDataUrl( const QPixmap& pixmap );
 
140
 
 
141
  Q_SIGNALS:
 
142
    void urlHighlighted( const QString &url );
 
143
    void emailHighlighted( const QString &email );
 
144
    void phoneNumberHighlighted( const QString &number );
 
145
    void faxNumberHighlighted( const QString &number );
 
146
 
 
147
    void highlightedMessage( const QString &message );
 
148
 
 
149
    void addressClicked( const QString &uid );
 
150
 
 
151
  protected:
 
152
    virtual void urlClicked( const QString &url );
 
153
    virtual void emailClicked( const QString &mail );
 
154
    virtual void phoneNumberClicked( const QString &number );
 
155
    virtual void smsTextClicked( const QString &number );
 
156
    virtual void sendSMS( const QString &number, const QString &msg );
 
157
    virtual void faxNumberClicked( const QString &number );
 
158
    virtual void imAddressClicked();
 
159
    virtual void contextMenuEvent( QContextMenuEvent *e );
 
160
 
 
161
 
 
162
  private Q_SLOTS:
 
163
    void slotMailClicked( const QString&, const QString& );
 
164
    void slotUrlClicked( const QString& );
 
165
    void slotHighlighted( const QString& );
 
166
    void slotPresenceChanged( const QString & );
 
167
    void slotPresenceInfoExpired();
 
168
    void configChanged();
 
169
 
 
170
    void data( KIO::Job*, const QByteArray& );
 
171
    void result( KJob* );
 
172
 
 
173
  private:
 
174
    void load();
 
175
    void save();
 
176
 
 
177
    void updateView();
 
178
 
 
179
    QString strippedNumber( const QString &number );
 
180
 
 
181
    KConfig *mConfig;
 
182
    bool mDefaultConfig;
 
183
 
 
184
    QByteArray mImageData;
 
185
    KIO::Job *mImageJob;
 
186
 
 
187
    KToggleAction *mActionShowBirthday;
 
188
    KToggleAction *mActionShowAddresses;
 
189
    KToggleAction *mActionShowEmails;
 
190
    KToggleAction *mActionShowPhones;
 
191
    KToggleAction *mActionShowURLs;
 
192
    KToggleAction *mActionShowIMAddresses;
 
193
    KToggleAction *mActionShowCustomFields;
 
194
 
 
195
    KABC::Addressee mAddressee;
 
196
    int mLinkMask;
 
197
 
 
198
    class AddresseeViewPrivate;
 
199
    AddresseeViewPrivate *d;
 
200
    ::KIMProxy *mKIMProxy;
 
201
};
 
202
 
 
203
}
 
204
 
 
205
#endif