summaryrefslogtreecommitdiffstats
path: root/kaddressbook/interfaces/core.h
blob: 0132399c1ae6201e297eafc160f53f4fc2540428 (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*
    This file is part of KAddressbook.
    Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>

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

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

    As a special exception, permission is given to link this program
    with any edition of TQt, and distribute the resulting executable,
    without including the source code for TQt in the source distribution.
*/

#ifndef KAB_CORE_H
#define KAB_CORE_H

#include <config.h> // for TDEPIM_NEW_DISTRLISTS

#ifdef TDEPIM_NEW_DISTRLISTS
#include <libtdepim/distributionlist.h>
#endif

#include <tqobject.h>

#include <tdeabc/field.h>
#include <kcommand.h>
#include <kxmlguiclient.h>
#include <tdepimmacros.h>

namespace TDEABC {
class AddressBook;
class Resource;
}

class TQWidget;

class TDEActionCollection;
class TDEConfig;
class KURL;

namespace KAB {

class SearchManager;

class KDE_EXPORT Core : public TQObject
{
  Q_OBJECT
  

  public:
    Core( KXMLGUIClient *client, TQObject *parent, const char *name = 0 );

    /**
      Returns a pointer to the StdAddressBook of the application.
     */
    virtual TDEABC::AddressBook *addressBook() const = 0;

    /**
      Returns a pointer to the TDEConfig object of the application.
     */
    virtual TDEConfig *config() const = 0;

    /**
      Returns a pointer to the global TDEActionCollection object. So
      other classes can register their actions easily.
     */
    virtual TDEActionCollection *actionCollection() const = 0;

    /**
      Returns a pointer to the gui client.
     */
    virtual KXMLGUIClient *guiClient() const { return mGUIClient; }

    /**
      Returns the current sort field.
     */
    virtual TDEABC::Field *currentSortField() const = 0;

    /**
      Returns the uid list of the currently selected contacts.
     */
    virtual TQStringList selectedUIDs() const = 0;

    /**
      Displays a ResourceSelectDialog and returns the selected
      resource or a null pointer if no resource was selected by
      the user.
     */
    virtual TDEABC::Resource *requestResource( TQWidget *parent ) = 0;

    /**
      Returns the parent widget.
     */
    virtual TQWidget *widget() const = 0;

    /**
      Deletes given contacts from the address book.

      @param uids The uids of the contacts, which shall be deleted.
     */
    virtual void deleteContacts( const TQStringList &uids ) = 0;

    /**
      Deletes given contacts from the address book.

      @param uids The uids of the contacts, which shall be deleted.
     */
    virtual void deleteDistributionLists( const TQStringList &uids ) = 0;

#ifdef TDEPIM_NEW_DISTRLISTS
    /**
      Returns all the distribution lists.
     */
    virtual KPIM::DistributionList::List distributionLists() const = 0;


    /**
      Returns the name of all the distribution lists.
     */
    virtual TQStringList distributionListNames() const = 0;

    /**
      sets the distribution list to display. If null, the regular
      address book is to be displayed.  
     */
    virtual void setSelectedDistributionList( const TQString &name ) = 0;
#endif

    //// This class isn't part of interfaces/, so this method here isn't really useful
    virtual SearchManager *searchManager() const = 0;

    virtual KCommandHistory *commandHistory() const = 0;

    signals:
    /**
      Forwarded from SearchManager
      After it is emitted, distributionListNames() might have a different result.
     */
    void contactsUpdated();

  public slots:
    /**
      Is called whenever a contact is selected in the view.
     */
    virtual void setContactSelected( const TQString &uid ) = 0;

    /**
      DCOP METHOD: Adds the given email address to address book.
     */
    virtual void addEmail( const TQString& addr ) = 0;

    /**
      DCOP METHOD: Imports the vCard, located at the given url.
     */
    virtual void importVCard( const KURL& url ) = 0;

    /**
      DCOP METHOD: Imports the given vCard.
     */
    virtual void importVCardFromData( const TQString& vCard ) = 0;

    /**
      DCOP METHOD: Opens contact editor to input a new contact.
     */
    virtual void newContact() = 0;

    /**
      DCOP METHOD: Opens distribution list editor to input a new distribution list.
     */
    virtual void newDistributionList() = 0;

    /**
      DCOP METHOD: Returns the name of the contact, that matches the given
                   phone number.
     */
    virtual TQString getNameByPhone( const TQString& phone ) = 0;

    /**
      Shows an edit dialog for the given uid.
     */
    virtual void editContact( const TQString &uid = TQString() ) = 0;

    /**
      Shows an edit dialog for the given distribution list 
    */
    virtual void editDistributionList( const TQString &name ) = 0;

  private:
    KXMLGUIClient *mGUIClient;
};

}

#endif