kaddressbook

viewmanager.h
1/*
2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4
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.
9
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.
14
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.
18
19 As a special exception, permission is given to link this program
20 with any edition of TQt, and distribute the resulting executable,
21 without including the source code for TQt in the source distribution.
22*/
23
24#ifndef VIEWMANAGER_H
25#define VIEWMANAGER_H
26
27#include <tqdict.h>
28#include <tqwidget.h>
29#include <kaddressbookview.h>
30
31class TQDropEvent;
32class TQWidgetStack;
33
34class TDEAction;
35class TDESelectAction;
36
38
39namespace KAB { class Core; }
40namespace TDEABC { class AddressBook; }
41
50class ViewManager : public TQWidget
51{
52 TQ_OBJECT
53
54
55 public:
56 ViewManager( KAB::Core *core, TQWidget *parent, const char *name = 0 );
58
59 void restoreSettings();
60 void saveSettings();
61
62 void unloadViews();
63
64 TQStringList selectedUids() const;
65 TQStringList selectedEmails() const;
66 TDEABC::Addressee::List selectedAddressees() const;
67
68 void setFilterSelectionWidget( FilterSelectionWidget *wdg );
69
70 TDEABC::Field *currentSortField() const;
71 TDEABC::Field::List viewFields() const;
72
73 public slots:
74 void setSelected( const TQString &uid = TQString(), bool selected = true );
75 void setFirstSelected( bool selected = true );
76
77 void refreshView( const TQString &uid = TQString() );
78 void editView();
79 void deleteView();
80 void addView();
81
82 void scrollUp();
83 void scrollDown();
84
85 protected slots:
91 void dropped( TQDropEvent* );
92
98 void startDrag();
99
100 signals:
104 void selected( const TQString &uid );
105
109 void executed( const TQString &uid );
110
114 void modified();
115
119 void urlDropped( const KURL& );
120
125
130
131 private slots:
132 void setActiveView( const TQString &name );
133 void setActiveFilter( int index );
134 void configureFilters();
135
136 private:
137 void createViewFactories();
138 TQStringList filterNames() const;
139 int filterPosition( const TQString &name ) const;
140 TQStringList viewNames() const;
141 int viewPosition( const TQString &name ) const;
142 void initActions();
143 void initGUI();
144
145 KAB::Core *mCore;
146
147 Filter mCurrentFilter;
148 Filter::List mFilterList;
149
150 TQDict<KAddressBookView> mViewDict;
151 TQDict<ViewFactory> mViewFactoryDict;
152 TQStringList mViewNameList;
153
154 TQWidgetStack *mViewWidgetStack;
155 KAddressBookView *mActiveView;
156
157 TDEAction *mActionDeleteView;
158 TDESelectAction *mActionSelectView;
159
160 FilterSelectionWidget *mFilterSelectionWidget;
161};
162
163#endif
A simple widget which consists of a label and a combo box in a horizontal line.
Filter for AddressBook related objects (Addressees)
Definition: filter.h:40
Base class for all views in kaddressbook.
The view manager manages the views and everything related to them.
Definition: viewmanager.h:51
void viewFieldsChanged()
Emitted whenever the view fields changed.
void startDrag()
Called whenever the user attempts to start a drag in the view.
void urlDropped(const KURL &)
Emitted whenever a url is dragged on a view.
void dropped(TQDropEvent *)
Called whenever the user drops something in the active view.
void modified()
Emitted whenever the address book is modified in some way.
void selected(const TQString &uid)
Emitted whenever the user selects an entry in the view.
void sortFieldChanged()
Emitted whenever the sort field of a view has changed.
void executed(const TQString &uid)
Emitted whenever the user activates an entry in the view.