summaryrefslogtreecommitdiffstats
path: root/libkdepim/addresseeemailselection.h
blob: ca96306f2c1e0f8022d22d85697581d502d71ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
    This file is part of libkdepim.

    Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef KPIM_ADDRESSEE_EMAILSELECTION_H
#define KPIM_ADDRESSEE_EMAILSELECTION_H

#include <addresseeselector.h>

namespace KPIM {

class KDE_EXPORT AddresseeEmailSelection : public Selection
{
  public:
    AddresseeEmailSelection();

    /**
      Returns the number of fields the selection offers.
     */
    virtual uint fieldCount() const;

    /**
      Returns the title for the field specified by index.
     */
    virtual QString fieldTitle( uint index ) const;

    /**
      Returns the number of items for the given addressee.
     */
    virtual uint itemCount( const KABC::Addressee &addresse ) const;

    /**
      Returns the text that's used for the item specified by index.
     */
    virtual QString itemText( const KABC::Addressee &addresse, uint index ) const;

    /**
      Returns the icon that's used for the item specified by index.
     */
    virtual QPixmap itemIcon( const KABC::Addressee &addresse, uint index ) const;

    /**
      Returns whether the item specified by index is enabled.
     */
    virtual bool itemEnabled( const KABC::Addressee &addresse, uint index ) const;

    /**
      Returns whether the item specified by index matches the passed pattern.
     */
    virtual bool itemMatches( const KABC::Addressee &addresse, uint index, const QString &pattern ) const;

    /**
      Returns whether the item specified by index equals the passed pattern.
     */
    virtual bool itemEquals( const KABC::Addressee &addresse, uint index, const QString &pattern ) const;

    /**
      Returns the text that's used for the given distribution list.
     */
    virtual QString distributionListText( const KABC::DistributionList *distributionList ) const;

    /**
      Returns the icon that's used for the given distribution list.
     */
    virtual QPixmap distributionListIcon( const KABC::DistributionList *distributionList ) const;

    /**
      Returns whether the given distribution list is enabled.
     */
    virtual bool distributionListEnabled( const KABC::DistributionList *distributionList ) const;

    /**
      Returns whether the given distribution list matches the passed pattern.
     */
    virtual bool distributionListMatches(  const KABC::DistributionList *distributionList,
                                           const QString &pattern ) const;

    /**
      Returns the number of additional address books.
     */
    virtual uint addressBookCount() const;

    /**
      Returns the title for an additional address book.
     */
    virtual QString addressBookTitle( uint index ) const;

    /**
      Returns the content for an additional address book.
     */
    virtual KABC::Addressee::List addressBookContent( uint index ) const;

    QStringList to() const;
    QStringList cc() const;
    QStringList bcc() const;

    KABC::Addressee::List toAddresses() const;
    KABC::Addressee::List ccAddresses() const;
    KABC::Addressee::List bccAddresses() const;

    QStringList toDistributionLists() const;
    QStringList ccDistributionLists() const;
    QStringList bccDistributionLists() const;

    void setSelectedTo( const QStringList &emails );
    void setSelectedCC( const QStringList &emails );
    void setSelectedBCC( const QStringList &emails );

  private:
    virtual void addSelectedAddressees( uint fieldIndex, const KABC::Addressee&, uint itemIndex );
    virtual void addSelectedDistributionList( uint fieldIndex, const KABC::DistributionList* );

    QString email( const KABC::Addressee&, uint ) const;
    void setSelectedItem( uint fieldIndex, const QStringList& );

    KABC::Addressee::List mToAddresseeList;
    KABC::Addressee::List mCcAddresseeList;
    KABC::Addressee::List mBccAddresseeList;

    QStringList mToEmailList;
    QStringList mCcEmailList;
    QStringList mBccEmailList;

    QStringList mToDistributionList;
    QStringList mCcDistributionList;
    QStringList mBccDistributionList;
};

}

#endif