summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kaddressbookview.h
Unidiff
Diffstat (limited to 'kaddressbook/kaddressbookview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index c134e96..2e91cbc 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -1,165 +1,166 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KADDRESSBOOKVIEW_H 24#ifndef KADDRESSBOOKVIEW_H
25#define KADDRESSBOOKVIEW_H 25#define KADDRESSBOOKVIEW_H
26 26
27#ifndef KAB_EMBEDDED 27#ifndef KAB_EMBEDDED
28#include <klibloader.h> 28#include <klibloader.h>
29#endif //KAB_EMBEDDED 29#endif //KAB_EMBEDDED
30 30
31class KConfig; 31class KConfig;
32class QDropEvent; 32class QDropEvent;
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <kabc/field.h> 35#include <kabc/field.h>
36#include <qwidget.h> 36#include <qwidget.h>
37 37
38#include "viewconfigurewidget.h" 38#include "viewconfigurewidget.h"
39#include "filter.h" 39#include "filter.h"
40 40
41namespace KABC { class AddressBook; } 41namespace KABC { class AddressBook; }
42 42
43/** 43/**
44 Base class for all views in kaddressbook. This class implements 44 Base class for all views in kaddressbook. This class implements
45 all the common methods needed to provide a view to the user. 45 all the common methods needed to provide a view to the user.
46 46
47 To implement a specific view (table, card, etc), just inherit from 47 To implement a specific view (table, card, etc), just inherit from
48 this class and implement all the pure virtuals. 48 this class and implement all the pure virtuals.
49 49
50 @author Mike Pilone <mpilone@slac.com> 50 @author Mike Pilone <mpilone@slac.com>
51 */ 51 */
52class KAddressBookView : public QWidget 52class KAddressBookView : public QWidget
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55 55
56 public: 56 public:
57 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; 57 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
58 58
59 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); 59 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name );
60 virtual ~KAddressBookView(); 60 virtual ~KAddressBookView();
61 61
62 /** 62 /**
63 Must be overloaded in subclasses. Should return a list of 63 Must be overloaded in subclasses. Should return a list of
64 all the uids of selected contacts. 64 all the uids of selected contacts.
65 */ 65 */
66 virtual QStringList selectedUids() = 0; 66 virtual QStringList selectedUids() = 0;
67 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; 67 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0;
68 virtual void scrollUP() = 0; 68 virtual void scrollUP() = 0;
69 virtual void scrollDOWN() = 0; 69 virtual void scrollDOWN() = 0;
70 virtual void setFocusAV() = 0;
70 71
71 /** 72 /**
72 Called whenever this view should read the config. This can be used 73 Called whenever this view should read the config. This can be used
73 as a sign that the config has changed, therefore the view should 74 as a sign that the config has changed, therefore the view should
74 assume the worst and rebuild itself if necessary. For example, 75 assume the worst and rebuild itself if necessary. For example,
75 in a table view this method may be called when the user adds or 76 in a table view this method may be called when the user adds or
76 removes columns from the view. 77 removes columns from the view.
77 78
78 If overloaded in the subclass, do not forget to call super class's 79 If overloaded in the subclass, do not forget to call super class's
79 method. 80 method.
80 81
81 @param config The KConfig object to read from. The group will already 82 @param config The KConfig object to read from. The group will already
82 be set, so do not change the group. 83 be set, so do not change the group.
83 */ 84 */
84 virtual void readConfig( KConfig *config ); 85 virtual void readConfig( KConfig *config );
85 86
86 /** 87 /**
87 Called whenever this view should write the config. The view should not 88 Called whenever this view should write the config. The view should not
88 write out information handled by the application, such as which fields 89 write out information handled by the application, such as which fields
89 are visible. The view should only write out information specific 90 are visible. The view should only write out information specific
90 to itself (i.e.: All information in the ViewConfigWidget) 91 to itself (i.e.: All information in the ViewConfigWidget)
91 92
92 If overloaded in the subclass, do not forget to call the super class's 93 If overloaded in the subclass, do not forget to call the super class's
93 method. 94 method.
94 95
95 @param config The KConfig object to read from. The group will already 96 @param config The KConfig object to read from. The group will already
96 be set, so do not change the group. 97 be set, so do not change the group.
97 */ 98 */
98 virtual void writeConfig( KConfig *config ); 99 virtual void writeConfig( KConfig *config );
99 100
100 /** 101 /**
101 Returns a QString with all the selected email addresses concatenated 102 Returns a QString with all the selected email addresses concatenated
102 together with a ',' seperator. 103 together with a ',' seperator.
103 */ 104 */
104 virtual QString selectedEmails(); 105 virtual QString selectedEmails();
105 106
106 /** 107 /**
107 Return the type of the view: Icon, Table, etc. Please make sure that 108 Return the type of the view: Icon, Table, etc. Please make sure that
108 this is the same value that ViewWrapper::type() will return for your 109 this is the same value that ViewWrapper::type() will return for your
109 view. 110 view.
110 */ 111 */
111 virtual QString type() const = 0; 112 virtual QString type() const = 0;
112 113
113 /** 114 /**
114 Returns a list of the fields that should be displayed. The list 115 Returns a list of the fields that should be displayed. The list
115 is composed of the fields proper names (ie: Home Address), so 116 is composed of the fields proper names (ie: Home Address), so
116 the view may need to translate them in order to get the 117 the view may need to translate them in order to get the
117 value from the addressee. 118 value from the addressee.
118 119
119 This list is generated from the config file, so it is advisable to call 120 This list is generated from the config file, so it is advisable to call
120 this method whenever a readConfig() is called in order to get the newest 121 this method whenever a readConfig() is called in order to get the newest
121 list of fields. 122 list of fields.
122 */ 123 */
123 KABC::Field::List fields() const; 124 KABC::Field::List fields() const;
124 125
125 /** 126 /**
126 Sets the active filter. This filter will be used for filtering 127 Sets the active filter. This filter will be used for filtering
127 the list of addressees to display. The view will <b>not</b> 128 the list of addressees to display. The view will <b>not</b>
128 automatically refresh itself, so in most cases you will want to call 129 automatically refresh itself, so in most cases you will want to call
129 KAddressBookView::refresh() after this method. 130 KAddressBookView::refresh() after this method.
130 */ 131 */
131 void setFilter( const Filter& ); 132 void setFilter( const Filter& );
132 133
133 /** 134 /**
134 @return The default filter type selection. If the selection 135 @return The default filter type selection. If the selection
135 is SpecificFilter, the name of the filter can be retrieved with 136 is SpecificFilter, the name of the filter can be retrieved with
136 defaultFilterName() 137 defaultFilterName()
137 */ 138 */
138 DefaultFilterType defaultFilterType() const; 139 DefaultFilterType defaultFilterType() const;
139 140
140 /** 141 /**
141 @return The name of the default filter. This string is 142 @return The name of the default filter. This string is
142 only valid if defaultFilterType() is returning SpecificFilter. 143 only valid if defaultFilterType() is returning SpecificFilter.
143 */ 144 */
144 const QString &defaultFilterName() const; 145 const QString &defaultFilterName() const;
145 146
146 /** 147 /**
147 @return The address book. 148 @return The address book.
148 */ 149 */
149 KABC::AddressBook *addressBook() const; 150 KABC::AddressBook *addressBook() const;
150 151
151 public slots: 152 public slots:
152 /** 153 /**
153 Must be overloaded in subclasses to refresh the view. 154 Must be overloaded in subclasses to refresh the view.
154 Refreshing includes updating the view to ensure that only items 155 Refreshing includes updating the view to ensure that only items
155 in the document are visible. If <i>uid</i> is valid, only the 156 in the document are visible. If <i>uid</i> is valid, only the
156 addressee with uid needs to be refreshed. This is an optimization 157 addressee with uid needs to be refreshed. This is an optimization
157 only. 158 only.
158 */ 159 */
159 virtual void refresh( QString uid = QString::null ) = 0; 160 virtual void refresh( QString uid = QString::null ) = 0;
160 161
161 /** 162 /**
162 This method must be overloaded in subclasses. Select (highlight) 163 This method must be overloaded in subclasses. Select (highlight)
163 the addressee matching <i>uid</i>. If uid 164 the addressee matching <i>uid</i>. If uid
164 is equal to QString::null, then all addressees should be selected. 165 is equal to QString::null, then all addressees should be selected.
165 */ 166 */