2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
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
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
29 #include <kaddressbookview.h>
37 class FilterSelectionWidget
;
39 namespace KAB
{ class Core
; }
40 namespace KABC
{ class AddressBook
; }
43 The view manager manages the views and everything related to them. The
44 manager will load the views at startup and display a view when told to
47 The view manager will also create and manage all dialogs directly related to
48 views (ie: AddView, ConfigureView, DeleteView, etc).
50 class ViewManager
: public QWidget
55 ViewManager( KAB::Core
*core
, QWidget
*parent
, const char *name
= 0 );
58 void restoreSettings();
63 QStringList
selectedUids() const;
64 QStringList
selectedEmails() const;
65 KABC::Addressee::List
selectedAddressees() const;
67 void setFilterSelectionWidget( FilterSelectionWidget
*wdg
);
69 KABC::Field
*currentSortField() const;
70 KABC::Field::List
viewFields() const;
73 void setSelected( const QString
&uid
= QString::null
, bool selected
= true );
74 void setFirstSelected( bool selected
= true );
76 void refreshView( const QString
&uid
= QString::null
);
86 Called whenever the user drops something in the active view.
87 This method will try to decode what was dropped, and if it was
88 a valid addressee, add it to the addressbook.
90 void dropped( QDropEvent
* );
93 Called whenever the user attempts to start a drag in the view.
94 This method will convert all the selected addressees into text (vcard)
95 and create a drag object.
101 Emitted whenever the user selects an entry in the view.
103 void selected( const QString
&uid
);
106 Emitted whenever the user activates an entry in the view.
108 void executed( const QString
&uid
);
111 Emitted whenever the address book is modified in some way.
116 Emitted whenever a url is dragged on a view.
118 void urlDropped( const KURL
& );
121 Emitted whenever the sort field of a view has changed.
123 void sortFieldChanged();
126 Emitted whenever the view fields changed.
128 void viewFieldsChanged();
131 void setActiveView( const QString
&name
);
132 void setActiveFilter( int index
);
133 void configureFilters();
136 void createViewFactories();
137 QStringList
filterNames() const;
138 int filterPosition( const QString
&name
) const;
139 QStringList
viewNames() const;
140 int viewPosition( const QString
&name
) const;
146 Filter mCurrentFilter
;
147 Filter::List mFilterList
;
149 QDict
<KAddressBookView
> mViewDict
;
150 QDict
<ViewFactory
> mViewFactoryDict
;
151 QStringList mViewNameList
;
153 QWidgetStack
*mViewWidgetStack
;
154 KAddressBookView
*mActiveView
;
156 KAction
*mActionDeleteView
;
157 KSelectAction
*mActionSelectView
;
159 FilterSelectionWidget
*mFilterSelectionWidget
;