summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewmanager.cpp
Unidiff
Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/viewmanager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index c93d51a..c6baeac 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -1,699 +1,704 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31 31
32#ifndef KAB_EMBEDDED 32#ifndef KAB_EMBEDDED
33#include <libkdepim/kvcarddrag.h> 33#include <libkdepim/kvcarddrag.h>
34#include <kabc/vcardconverter.h> 34#include <kabc/vcardconverter.h>
35#include <kconfig.h> 35#include <kconfig.h>
36#include <kdeversion.h> 36#include <kdeversion.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include <klocale.h> 38#include <klocale.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kmultipledrag.h> 40#include <kmultipledrag.h>
41#include <ktrader.h> 41#include <ktrader.h>
42#include <kurldrag.h> 42#include <kurldrag.h>
43 43
44#include "addresseeutil.h" 44#include "addresseeutil.h"
45#else //KAB_EMBEDDED 45#else //KAB_EMBEDDED
46#include "views/kaddressbookiconview.h" 46#include "views/kaddressbookiconview.h"
47#include "views/kaddressbooktableview.h" 47#include "views/kaddressbooktableview.h"
48#include "views/kaddressbookcardview.h" 48#include "views/kaddressbookcardview.h"
49#include "kaddressbookview.h" 49#include "kaddressbookview.h"
50 50
51#include <qaction.h> 51#include <qaction.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54#include <kconfigbase.h> 54#include <kconfigbase.h>
55 55
56#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
57 57
58 58
59#include <kdebug.h> 59#include <kdebug.h>
60#include <kactionclasses.h> 60#include <kactionclasses.h>
61 61
62#include <qlayout.h> 62#include <qlayout.h>
63#include <qwidgetstack.h> 63#include <qwidgetstack.h>
64 64
65#include <kabc/addressbook.h> 65#include <kabc/addressbook.h>
66#include "filtereditdialog.h" 66#include "filtereditdialog.h"
67#include "addviewdialog.h" 67#include "addviewdialog.h"
68#include "kabcore.h" 68#include "kabcore.h"
69#include "kabprefs.h" 69#include "kabprefs.h"
70#include "viewmanager.h" 70#include "viewmanager.h"
71 71
72ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) 72ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name )
73 : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) 73 : QWidget( parent, name ), mCore( core ), mActiveView( 0 )
74{ 74{
75 initGUI(); 75 initGUI();
76 initActions(); 76 initActions();
77 77
78 mViewDict.setAutoDelete( true ); 78 mViewDict.setAutoDelete( true );
79 79
80 createViewFactories(); 80 createViewFactories();
81} 81}
82 82
83ViewManager::~ViewManager() 83ViewManager::~ViewManager()
84{ 84{
85 unloadViews(); 85 unloadViews();
86 mViewFactoryDict.clear(); 86 mViewFactoryDict.clear();
87} 87}
88 88
89void ViewManager::restoreSettings() 89void ViewManager::restoreSettings()
90{ 90{
91 mViewNameList = KABPrefs::instance()->mViewNames; 91 mViewNameList = KABPrefs::instance()->mViewNames;
92 QString activeViewName = KABPrefs::instance()->mCurrentView; 92 QString activeViewName = KABPrefs::instance()->mCurrentView;
93 93
94 mActionSelectView->setItems( mViewNameList ); 94 mActionSelectView->setItems( mViewNameList );
95 95
96 // Filter 96 // Filter
97 mFilterList = Filter::restore( mCore->config(), "Filter" ); 97 mFilterList = Filter::restore( mCore->config(), "Filter" );
98 mActionSelectFilter->setItems( filterNames() ); 98 mActionSelectFilter->setItems( filterNames() );
99 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); 99 mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
100 100
101 // Tell the views to reread their config, since they may have 101 // Tell the views to reread their config, since they may have
102 // been modified by global settings 102 // been modified by global settings
103 QString _oldgroup = mCore->config()->group(); 103 QString _oldgroup = mCore->config()->group();
104 104
105 QDictIterator<KAddressBookView> it( mViewDict ); 105 QDictIterator<KAddressBookView> it( mViewDict );
106 for ( it.toFirst(); it.current(); ++it ) { 106 for ( it.toFirst(); it.current(); ++it ) {
107 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 107 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
108 it.current()->readConfig( mCore->config() ); 108 it.current()->readConfig( mCore->config() );
109 } 109 }
110 setActiveView( activeViewName ); 110 setActiveView( activeViewName );
111 111
112 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 112 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
113} 113}
114 114
115void ViewManager::saveSettings() 115void ViewManager::saveSettings()
116{ 116{
117 QString _oldgroup = mCore->config()->group(); 117 QString _oldgroup = mCore->config()->group();
118 118
119 QDictIterator<KAddressBookView> it( mViewDict ); 119 QDictIterator<KAddressBookView> it( mViewDict );
120 for ( it.toFirst(); it.current(); ++it ) { 120 for ( it.toFirst(); it.current(); ++it ) {
121 KConfigGroupSaver saver( mCore->config(), it.currentKey() ); 121 KConfigGroupSaver saver( mCore->config(), it.currentKey() );
122#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
123 (*it)->writeConfig( mCore->config() ); 123 (*it)->writeConfig( mCore->config() );
124#else 124#else
125 (*it).writeConfig( mCore->config() ); 125 (*it).writeConfig( mCore->config() );
126#endif 126#endif
127 } 127 }
128 128
129 Filter::save( mCore->config(), "Filter", mFilterList ); 129 Filter::save( mCore->config(), "Filter", mFilterList );
130 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); 130 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
131 131
132 // write the view name list 132 // write the view name list
133 KABPrefs::instance()->mViewNames = mViewNameList; 133 KABPrefs::instance()->mViewNames = mViewNameList;
134 KABPrefs::instance()->mCurrentView = mActiveView->caption(); 134 KABPrefs::instance()->mCurrentView = mActiveView->caption();
135 135
136} 136}
137 137
138QStringList ViewManager::selectedUids() const 138QStringList ViewManager::selectedUids() const
139{ 139{
140 if ( mActiveView ) 140 if ( mActiveView )
141 return mActiveView->selectedUids(); 141 return mActiveView->selectedUids();
142 else 142 else
143 return QStringList(); 143 return QStringList();
144} 144}
145 145
146QStringList ViewManager::selectedEmails() const 146QStringList ViewManager::selectedEmails() const
147{ 147{
148 if ( mActiveView ) 148 if ( mActiveView )
149 return mActiveView->selectedEmails(); 149 return mActiveView->selectedEmails();
150 else 150 else
151 return QStringList(); 151 return QStringList();
152} 152}
153 153
154KABC::Addressee::List ViewManager::selectedAddressees() const 154KABC::Addressee::List ViewManager::selectedAddressees() const
155{ 155{
156 KABC::Addressee::List list; 156 KABC::Addressee::List list;
157 if ( mActiveView ) { 157 if ( mActiveView ) {
158 QStringList uids = mActiveView->selectedUids(); 158 QStringList uids = mActiveView->selectedUids();
159 QStringList::Iterator it; 159 QStringList::Iterator it;
160 for ( it = uids.begin(); it != uids.end(); ++it ) { 160 for ( it = uids.begin(); it != uids.end(); ++it ) {
161 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 161 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
162 if ( !addr.isEmpty() ) 162 if ( !addr.isEmpty() )
163 list.append( addr ); 163 list.append( addr );
164 } 164 }
165 } 165 }
166 166
167 return list; 167 return list;
168} 168}
169//US added another method with no parameter, since my moc compiler does not support default parameters. 169//US added another method with no parameter, since my moc compiler does not support default parameters.
170void ViewManager::setSelected() 170void ViewManager::setSelected()
171{ 171{
172 setSelected( QString::null, true ); 172 setSelected( QString::null, true );
173} 173}
174 174
175void ViewManager::setSelected( const QString &uid, bool selected ) 175void ViewManager::setSelected( const QString &uid, bool selected )
176{ 176{
177 if ( mActiveView ) 177 if ( mActiveView )
178 mActiveView->setSelected( uid, selected ); 178 mActiveView->setSelected( uid, selected );
179} 179}
180 180
181void ViewManager::setListSelected(QStringList list) 181void ViewManager::setListSelected(QStringList list)
182{ 182{
183 int i, count = list.count(); 183 int i, count = list.count();
184 for ( i = 0; i < count;++i ) 184 for ( i = 0; i < count;++i )
185 setSelected( list[i], true ); 185 setSelected( list[i], true );
186 186
187} 187}
188void ViewManager::unloadViews() 188void ViewManager::unloadViews()
189{ 189{
190 mViewDict.clear(); 190 mViewDict.clear();
191 mActiveView = 0; 191 mActiveView = 0;
192} 192}
193 193
194void ViewManager::setActiveView( const QString &name ) 194void ViewManager::setActiveView( const QString &name )
195{ 195{
196 KAddressBookView *view = 0; 196 KAddressBookView *view = 0;
197 197
198 // Check that this isn't the same as the current active view 198 // Check that this isn't the same as the current active view
199 if ( mActiveView && ( mActiveView->caption() == name ) ) 199 if ( mActiveView && ( mActiveView->caption() == name ) )
200 return; 200 return;
201 201
202 // At this point we know the view that should be active is not 202 // At this point we know the view that should be active is not
203 // currently active. We will try to find the new on in the list. If 203 // currently active. We will try to find the new on in the list. If
204 // we can't find it, it means it hasn't been instantiated, so we will 204 // we can't find it, it means it hasn't been instantiated, so we will
205 // create it on demand. 205 // create it on demand.
206 206
207 view = mViewDict.find( name ); 207 view = mViewDict.find( name );
208 208
209 // Check if we found the view. If we didn't, then we need to create it 209 // Check if we found the view. If we didn't, then we need to create it
210 if ( view == 0 ) { 210 if ( view == 0 ) {
211 KConfig *config = mCore->config(); 211 KConfig *config = mCore->config();
212 212
213 KConfigGroupSaver saver( config, name ); 213 KConfigGroupSaver saver( config, name );
214 214
215 QString type = config->readEntry( "Type", "Table" ); 215 QString type = config->readEntry( "Type", "Table" );
216 216
217 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; 217 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
218 218
219 ViewFactory *factory = mViewFactoryDict.find( type ); 219 ViewFactory *factory = mViewFactoryDict.find( type );
220 if ( factory ) 220 if ( factory )
221 view = factory->view( mCore->addressBook(), mViewWidgetStack ); 221 view = factory->view( mCore->addressBook(), mViewWidgetStack );
222 222
223 if ( view ) { 223 if ( view ) {
224 view->setCaption( name ); 224 view->setCaption( name );
225 mViewDict.insert( name, view ); 225 mViewDict.insert( name, view );
226//US my version needs an int as second parameter to addWidget 226//US my version needs an int as second parameter to addWidget
227 mViewWidgetStack->addWidget( view, -1 ); 227 mViewWidgetStack->addWidget( view, -1 );
228 view->readConfig( config ); 228 view->readConfig( config );
229 229
230 // The manager just relays the signals 230 // The manager just relays the signals
231 connect( view, SIGNAL( selected( const QString& ) ), 231 connect( view, SIGNAL( selected( const QString& ) ),
232 SIGNAL( selected( const QString & ) ) ); 232 SIGNAL( selected( const QString & ) ) );
233 connect( view, SIGNAL( executed( const QString& ) ), 233 connect( view, SIGNAL( executed( const QString& ) ),
234 SIGNAL( executed( const QString& ) ) ); 234 SIGNAL( executed( const QString& ) ) );
235 235
236 connect( view, SIGNAL( deleteRequest( ) ), 236 connect( view, SIGNAL( deleteRequest( ) ),
237 SIGNAL( deleteRequest( ) ) ); 237 SIGNAL( deleteRequest( ) ) );
238 238
239 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); 239 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
240 connect( view, SIGNAL( dropped( QDropEvent* ) ), 240 connect( view, SIGNAL( dropped( QDropEvent* ) ),
241 SLOT( dropped( QDropEvent* ) ) ); 241 SLOT( dropped( QDropEvent* ) ) );
242 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); 242 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
243 } 243 }
244 } 244 }
245 245
246 // If we found or created the view, raise it and refresh it 246 // If we found or created the view, raise it and refresh it
247 if ( view ) { 247 if ( view ) {
248 mActiveView = view; 248 mActiveView = view;
249 mViewWidgetStack->raiseWidget( view ); 249 mViewWidgetStack->raiseWidget( view );
250 // Set the proper filter in the view. By setting the combo 250 // Set the proper filter in the view. By setting the combo
251 // box, the activated slot will be called, which will push 251 // box, the activated slot will be called, which will push
252 // the filter to the view and refresh it. 252 // the filter to the view and refresh it.
253 253
254 if ( view->defaultFilterType() == KAddressBookView::None ) { 254 if ( view->defaultFilterType() == KAddressBookView::None ) {
255 255
256 mActionSelectFilter->setCurrentItem( 0 ); 256 mActionSelectFilter->setCurrentItem( 0 );
257 setActiveFilter( 0 ); 257 setActiveFilter( 0 );
258 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 258 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
259 setActiveFilter( mActionSelectFilter->currentItem() ); 259 setActiveFilter( mActionSelectFilter->currentItem() );
260 } else { 260 } else {
261 uint pos = filterPosition( view->defaultFilterName() ); 261 uint pos = filterPosition( view->defaultFilterName() );
262 mActionSelectFilter->setCurrentItem( pos ); 262 mActionSelectFilter->setCurrentItem( pos );
263 setActiveFilter( pos ); 263 setActiveFilter( pos );
264 } 264 }
265//US qDebug("ViewManager::setActiveView 6" ); 265//US qDebug("ViewManager::setActiveView 6" );
266 266
267 // Update the inc search widget to show the fields in the new active 267 // Update the inc search widget to show the fields in the new active
268 // view. 268 // view.
269 mCore->setSearchFields( mActiveView->fields() ); 269 mCore->setSearchFields( mActiveView->fields() );
270 270
271//US performance optimization. setActiveFilter calls also mActiveView->refresh() 271//US performance optimization. setActiveFilter calls also mActiveView->refresh()
272//US mActiveView->refresh(); 272//US mActiveView->refresh();
273 273
274 } 274 }
275 else 275 else
276 { 276 {
277 qDebug("ViewManager::setActiveView: unable to find view" ); 277 qDebug("ViewManager::setActiveView: unable to find view" );
278 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; 278 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
279 } 279 }
280} 280}
281 281
282//US added another method with no parameter, since my moc compiler does not support default parameters. 282//US added another method with no parameter, since my moc compiler does not support default parameters.
283void ViewManager::refreshView() 283void ViewManager::refreshView()
284{ 284{
285 refreshView( QString::null ); 285 refreshView( QString::null );
286} 286}
287 287
288void ViewManager::refreshView( const QString &uid ) 288void ViewManager::refreshView( const QString &uid )
289{ 289{
290 if ( mActiveView ) 290 if ( mActiveView )
291 mActiveView->refresh( uid ); 291 mActiveView->refresh( uid );
292} 292}
293 293
294void ViewManager::editView() 294void ViewManager::editView()
295{ 295{
296 if ( !mActiveView ) 296 if ( !mActiveView )
297 return; 297 return;
298 298
299 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); 299 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
300 ViewConfigureWidget *wdg = 0; 300 ViewConfigureWidget *wdg = 0;
301 ViewConfigureDialog* dlg = 0; 301 ViewConfigureDialog* dlg = 0;
302 if ( factory ) { 302 if ( factory ) {
303 // Save the filters so the dialog has the latest set 303 // Save the filters so the dialog has the latest set
304 Filter::save( mCore->config(), "Filter", mFilterList ); 304 Filter::save( mCore->config(), "Filter", mFilterList );
305 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 305 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
306 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 306 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
307 } else { 307 } else {
308 qDebug("ViewManager::editView()::cannot find viewfactory "); 308 qDebug("ViewManager::editView()::cannot find viewfactory ");
309 return; 309 return;
310 } 310 }
311 if ( wdg ) { 311 if ( wdg ) {
312 dlg->setWidget( wdg ); 312 dlg->setWidget( wdg );
313 313
314#ifndef DESKTOP_VERSION 314#ifndef DESKTOP_VERSION
315 //dlg.setMaximumSize( 640, 480 ); 315 //dlg.setMaximumSize( 640, 480 );
316 //dlg->setGeometry( 40,40, 400, 300); 316 //dlg->setGeometry( 40,40, 400, 300);
317 dlg->showMaximized(); 317 dlg->showMaximized();
318#endif 318#endif
319 319
320 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 320 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
321 321
322 dlg->restoreSettings( mCore->config() ); 322 dlg->restoreSettings( mCore->config() );
323 323
324 if ( dlg->exec() ) { 324 if ( dlg->exec() ) {
325 dlg->saveSettings( mCore->config() ); 325 dlg->saveSettings( mCore->config() );
326 mActiveView->readConfig( mCore->config() ); 326 mActiveView->readConfig( mCore->config() );
327 327
328 // Set the proper filter in the view. By setting the combo 328 // Set the proper filter in the view. By setting the combo
329 // box, the activated slot will be called, which will push 329 // box, the activated slot will be called, which will push
330 // the filter to the view and refresh it. 330 // the filter to the view and refresh it.
331 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 331 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
332 mActionSelectFilter->setCurrentItem( 0 ); 332 mActionSelectFilter->setCurrentItem( 0 );
333 setActiveFilter( 0 ); 333 setActiveFilter( 0 );
334 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { 334 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) {
335 setActiveFilter( mActionSelectFilter->currentItem() ); 335 setActiveFilter( mActionSelectFilter->currentItem() );
336 } else { 336 } else {
337 uint pos = filterPosition( mActiveView->defaultFilterName() ); 337 uint pos = filterPosition( mActiveView->defaultFilterName() );
338 mActionSelectFilter->setCurrentItem( pos ); 338 mActionSelectFilter->setCurrentItem( pos );
339 setActiveFilter( pos ); 339 setActiveFilter( pos );
340 } 340 }
341 mCore->setSearchFields( mActiveView->fields() ); 341 mCore->setSearchFields( mActiveView->fields() );
342//US performance optimization. setActiveFilter calls also mActiveView->refresh() 342//US performance optimization. setActiveFilter calls also mActiveView->refresh()
343//US mActiveView->refresh(); 343//US mActiveView->refresh();
344 344
345 345
346 //US this is a bugfix, that we get notified if we change a views configuration 346 //US this is a bugfix, that we get notified if we change a views configuration
347 emit modified(); 347 emit modified();
348 348
349 } 349 }
350 350
351 } 351 }
352 delete dlg; 352 delete dlg;
353} 353}
354 354
355void ViewManager::deleteView() 355void ViewManager::deleteView()
356{ 356{
357 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) 357 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" )
358 .arg( mActiveView->caption() ); 358 .arg( mActiveView->caption() );
359 QString caption = i18n( "Confirm Delete" ); 359 QString caption = i18n( "Confirm Delete" );
360 360
361 361
362 if (QMessageBox::information( this, caption, 362 if (QMessageBox::information( this, caption,
363 text, 363 text,
364 i18n("Yes!"), i18n("No"), 0, 0 ) == 0) 364 i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
365 { 365 {
366 mViewNameList.remove( mActiveView->caption() ); 366 mViewNameList.remove( mActiveView->caption() );
367 367
368 // remove the view from the config file 368 // remove the view from the config file
369 KConfig *config = mCore->config(); 369 KConfig *config = mCore->config();
370 config->deleteGroup( mActiveView->caption() ); 370 config->deleteGroup( mActiveView->caption() );
371 371
372 mViewDict.remove( mActiveView->caption() ); 372 mViewDict.remove( mActiveView->caption() );
373 mActiveView = 0; 373 mActiveView = 0;
374 374
375 // we are in an invalid state now, but that should be fixed after 375 // we are in an invalid state now, but that should be fixed after
376 // we emit the signal 376 // we emit the signal
377 mActionSelectView->setItems( mViewNameList ); 377 mActionSelectView->setItems( mViewNameList );
378 if ( mViewNameList.count() > 0 ) { 378 if ( mViewNameList.count() > 0 ) {
379 mActionSelectView->setCurrentItem( 0 ); 379 mActionSelectView->setCurrentItem( 0 );
380 setActiveView( mViewNameList[ 0 ] ); 380 setActiveView( mViewNameList[ 0 ] );
381 } 381 }
382 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 382 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
383 } 383 }
384} 384}
385 385
386void ViewManager::addView() 386void ViewManager::addView()
387{ 387{
388 AddViewDialog dialog( &mViewFactoryDict, this ); 388 AddViewDialog dialog( &mViewFactoryDict, this );
389 389
390 if ( dialog.exec() ) { 390 if ( dialog.exec() ) {
391 QString newName = dialog.viewName(); 391 QString newName = dialog.viewName();
392 QString type = dialog.viewType(); 392 QString type = dialog.viewType();
393 393
394 // Check for name conflicts 394 // Check for name conflicts
395 bool firstConflict = true; 395 bool firstConflict = true;
396 int numTries = 1; 396 int numTries = 1;
397 while ( mViewNameList.contains( newName ) > 0 ) { 397 while ( mViewNameList.contains( newName ) > 0 ) {
398 if ( !firstConflict ) { 398 if ( !firstConflict ) {
399 newName = newName.left( newName.length() - 4 ); 399 newName = newName.left( newName.length() - 4 );
400 firstConflict = false; 400 firstConflict = false;
401 } 401 }
402 402
403 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries ); 403 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries );
404 numTries++; 404 numTries++;
405 } 405 }
406 406
407 // Add the new one to the list 407 // Add the new one to the list
408 mViewNameList.append( newName ); 408 mViewNameList.append( newName );
409 409
410 // write the view to the config file, 410 // write the view to the config file,
411 KConfig *config = mCore->config(); 411 KConfig *config = mCore->config();
412 412
413 config->deleteGroup( newName ); 413 config->deleteGroup( newName );
414 414
415 KConfigGroupSaver saver( config, newName ); 415 KConfigGroupSaver saver( config, newName );
416 416
417 config->writeEntry( "Type", type ); 417 config->writeEntry( "Type", type );
418 418
419 // try to set the active view 419 // try to set the active view
420 mActionSelectView->setItems( mViewNameList ); 420 mActionSelectView->setItems( mViewNameList );
421 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); 421 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
422 setActiveView( newName ); 422 setActiveView( newName );
423 423
424 editView(); 424 editView();
425 425
426 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 426 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
427 } 427 }
428} 428}
429 429
430void ViewManager::createViewFactories() 430void ViewManager::createViewFactories()
431{ 431{
432#ifndef KAB_EMBEDDED 432#ifndef KAB_EMBEDDED
433 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); 433 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" );
434 KTrader::OfferList::ConstIterator it; 434 KTrader::OfferList::ConstIterator it;
435 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 435 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
436 if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) 436 if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
437 continue; 437 continue;
438 438
439 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 439 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
440 440
441 if ( !factory ) { 441 if ( !factory ) {
442 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; 442 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
443 continue; 443 continue;
444 } 444 }
445 445
446 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); 446 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
447 447
448 if ( !viewFactory ) { 448 if ( !viewFactory ) {
449 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; 449 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
450 continue; 450 continue;
451 } 451 }
452 452
453 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 453 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
454 } 454 }
455 455
456#else //KAB_EMBEDDED 456#else //KAB_EMBEDDED
457 ViewFactory* viewFactory = new IconViewFactory(); 457 ViewFactory* viewFactory = new IconViewFactory();
458 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 458 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
459// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 459// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
460 460
461 viewFactory = new TableViewFactory(); 461 viewFactory = new TableViewFactory();
462 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 462 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
463// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 463// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
464 464
465 viewFactory = new CardViewFactory(); 465 viewFactory = new CardViewFactory();
466 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 466 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
467// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 467// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
468 468
469#endif //KAB_EMBEDDED 469#endif //KAB_EMBEDDED
470 470
471} 471}
472 472
473void ViewManager::dropped( QDropEvent *e ) 473void ViewManager::dropped( QDropEvent *e )
474{ 474{
475 kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; 475 kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
476 476
477#ifndef KAB_EMBEDDED 477#ifndef KAB_EMBEDDED
478 478
479 QString clipText, vcards; 479 QString clipText, vcards;
480 KURL::List urls; 480 KURL::List urls;
481 481
482 if ( KURLDrag::decode( e, urls) ) { 482 if ( KURLDrag::decode( e, urls) ) {
483 KURL::List::Iterator it = urls.begin(); 483 KURL::List::Iterator it = urls.begin();
484 int c = urls.count(); 484 int c = urls.count();
485 if ( c > 1 ) { 485 if ( c > 1 ) {
486 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); 486 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c );
487 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { 487 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) {
488 for ( ; it != urls.end(); ++it ) 488 for ( ; it != urls.end(); ++it )
489 emit urlDropped( *it ); 489 emit urlDropped( *it );
490 } 490 }
491 } else if ( c == 1 ) 491 } else if ( c == 1 )
492 emit urlDropped( *it ); 492 emit urlDropped( *it );
493 } else if ( KVCardDrag::decode( e, vcards ) ) { 493 } else if ( KVCardDrag::decode( e, vcards ) ) {
494 KABC::Addressee addr; 494 KABC::Addressee addr;
495 KABC::VCardConverter converter; 495 KABC::VCardConverter converter;
496 QStringList list = QStringList::split( "\r\n\r\n", vcards ); 496 QStringList list = QStringList::split( "\r\n\r\n", vcards );
497 QStringList::Iterator it; 497 QStringList::Iterator it;
498 for ( it = list.begin(); it != list.end(); ++it ) { 498 for ( it = list.begin(); it != list.end(); ++it ) {
499 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { 499 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
500 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); 500 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
501 if ( a.isEmpty() ) { 501 if ( a.isEmpty() ) {
502 mCore->addressBook()->insertAddressee( addr ); 502 mCore->addressBook()->insertAddressee( addr );
503 emit modified(); 503 emit modified();
504 } 504 }
505 } 505 }
506 } 506 }
507 507
508 mActiveView->refresh(); 508 mActiveView->refresh();
509 } 509 }
510#else //KAB_EMBEDDED 510#else //KAB_EMBEDDED
511qDebug("ViewManager::dropped() has to be changed!!" ); 511qDebug("ViewManager::dropped() has to be changed!!" );
512#endif //KAB_EMBEDDED 512#endif //KAB_EMBEDDED
513 513
514} 514}
515 515
516void ViewManager::startDrag() 516void ViewManager::startDrag()
517{ 517{
518 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; 518 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
519 519
520#ifndef KAB_EMBEDDED 520#ifndef KAB_EMBEDDED
521 521
522 // Get the list of all the selected addressees 522 // Get the list of all the selected addressees
523 KABC::Addressee::List addrList; 523 KABC::Addressee::List addrList;
524 QStringList uidList = selectedUids(); 524 QStringList uidList = selectedUids();
525 QStringList::Iterator iter; 525 QStringList::Iterator iter;
526 for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) 526 for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
527 addrList.append( mCore->addressBook()->findByUid( *iter ) ); 527 addrList.append( mCore->addressBook()->findByUid( *iter ) );
528 528
529 KMultipleDrag *drag = new KMultipleDrag( this ); 529 KMultipleDrag *drag = new KMultipleDrag( this );
530 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); 530 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
531 KABC::Addressee::List::Iterator it; 531 KABC::Addressee::List::Iterator it;
532 QStringList vcards; 532 QStringList vcards;
533 for ( it = addrList.begin(); it != addrList.end(); ++it ) { 533 for ( it = addrList.begin(); it != addrList.end(); ++it ) {
534 QString vcard = QString::null; 534 QString vcard = QString::null;
535 KABC::VCardConverter converter; 535 KABC::VCardConverter converter;
536 if ( converter.addresseeToVCard( *it, vcard ) ) 536 if ( converter.addresseeToVCard( *it, vcard ) )
537 vcards.append( vcard ); 537 vcards.append( vcard );
538 } 538 }
539 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); 539 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
540 540
541 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); 541 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
542 drag->dragCopy(); 542 drag->dragCopy();
543 543
544#else //KAB_EMBEDDED 544#else //KAB_EMBEDDED
545qDebug("ViewManager::startDrag() has to be changed!!" ); 545qDebug("ViewManager::startDrag() has to be changed!!" );
546#endif //KAB_EMBEDDED 546#endif //KAB_EMBEDDED
547 547
548} 548}
549void ViewManager::doSearch( const QString& s,KABC::Field *field )
550{
551 if ( mActiveView )
552 mActiveView->doSearch( s, field );
549 553
554}
550void ViewManager::setActiveFilter( int index ) 555void ViewManager::setActiveFilter( int index )
551{ 556{
552 Filter currentFilter; 557 Filter currentFilter;
553 558
554 if ( ( index - 1 ) < 0 ) 559 if ( ( index - 1 ) < 0 )
555 currentFilter = Filter(); 560 currentFilter = Filter();
556 else 561 else
557 currentFilter = mFilterList[ index - 1 ]; 562 currentFilter = mFilterList[ index - 1 ];
558 563
559 // Check if we have a view. Since the filter combo is created before 564 // Check if we have a view. Since the filter combo is created before
560 // the view, this slot could be called before there is a valid view. 565 // the view, this slot could be called before there is a valid view.
561 if ( mActiveView ) { 566 if ( mActiveView ) {
562 mActiveView->setFilter( currentFilter ); 567 mActiveView->setFilter( currentFilter );
563 mActiveView->refresh(); 568 mActiveView->refresh();
564 emit selected( QString::null ); 569 emit selected( QString::null );
565 } 570 }
566} 571}
567 572
568void ViewManager::configureFilters() 573void ViewManager::configureFilters()
569{ 574{
570 FilterDialog dlg( this ); 575 FilterDialog dlg( this );
571 576
572 dlg.setFilters( mFilterList ); 577 dlg.setFilters( mFilterList );
573 578
574 if ( dlg.exec() ) 579 if ( dlg.exec() )
575 mFilterList = dlg.filters(); 580 mFilterList = dlg.filters();
576 581
577 uint pos = mActionSelectFilter->currentItem(); 582 uint pos = mActionSelectFilter->currentItem();
578 mActionSelectFilter->setItems( filterNames() ); 583 mActionSelectFilter->setItems( filterNames() );
579 mActionSelectFilter->setCurrentItem( pos ); 584 mActionSelectFilter->setCurrentItem( pos );
580 setActiveFilter( pos ); 585 setActiveFilter( pos );
581} 586}
582 587
583QStringList ViewManager::filterNames() const 588QStringList ViewManager::filterNames() const
584{ 589{
585 QStringList names( i18n( "No Filter" ) ); 590 QStringList names( i18n( "No Filter" ) );
586 591
587 Filter::List::ConstIterator it; 592 Filter::List::ConstIterator it;
588 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 593 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
589 names.append( (*it).name() ); 594 names.append( (*it).name() );
590 595
591 return names; 596 return names;
592} 597}
593 598
594int ViewManager::filterPosition( const QString &name ) const 599int ViewManager::filterPosition( const QString &name ) const
595{ 600{
596 int pos = 0; 601 int pos = 0;
597 602
598 Filter::List::ConstIterator it; 603 Filter::List::ConstIterator it;
599 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) 604 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
600 if ( name == (*it).name() ) 605 if ( name == (*it).name() )
601 return pos + 1; 606 return pos + 1;
602 607
603 return 0; 608 return 0;
604} 609}
605 610
606void ViewManager::initActions() 611void ViewManager::initActions()
607{ 612{
608//US <ActionList name="view_loadedviews"/> 613//US <ActionList name="view_loadedviews"/>
609//US <Separator/> 614//US <Separator/>
610 615
611#ifdef KAB_EMBEDDED 616#ifdef KAB_EMBEDDED
612 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); 617 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
613 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); 618 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
614 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); 619 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
615#endif //KAB_EMBEDDED 620#endif //KAB_EMBEDDED
616 621
617 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); 622 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
618#if KDE_VERSION >= 309 623#if KDE_VERSION >= 309
619 mActionSelectView->setMenuAccelsEnabled( false ); 624 mActionSelectView->setMenuAccelsEnabled( false );
620#endif 625#endif
621 connect( mActionSelectView, SIGNAL( activated( const QString& ) ), 626 connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
622 SLOT( setActiveView( const QString& ) ) ); 627 SLOT( setActiveView( const QString& ) ) );
623 628
624 629
625#ifdef KAB_EMBEDDED 630#ifdef KAB_EMBEDDED
626 mActionSelectView->plug(viewmenu); 631 mActionSelectView->plug(viewmenu);
627 viewmenu->insertSeparator(); 632 viewmenu->insertSeparator();
628#endif //KAB_EMBEDDED 633#endif //KAB_EMBEDDED
629 634
630 KAction *action; 635 KAction *action;
631 636
632 action = new KAction( i18n( "Modify View..." ), "configure", 0, this, 637 action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
633 SLOT( editView() ), mCore->actionCollection(), "view_modify" ); 638 SLOT( editView() ), mCore->actionCollection(), "view_modify" );
634#ifndef KAB_EMBEDDED 639#ifndef KAB_EMBEDDED
635 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); 640 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
636#else //KAB_EMBEDDED 641#else //KAB_EMBEDDED
637 action->plug(viewmenu); 642 action->plug(viewmenu);
638#endif //KAB_EMBEDDED 643#endif //KAB_EMBEDDED
639 644
640 action = new KAction( i18n( "Add View..." ), "window_new", 0, this, 645 action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
641 SLOT( addView() ), mCore->actionCollection(), "view_add" ); 646 SLOT( addView() ), mCore->actionCollection(), "view_add" );
642#ifndef KAB_EMBEDDED 647#ifndef KAB_EMBEDDED
643 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); 648 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
644#else //KAB_EMBEDDED 649#else //KAB_EMBEDDED
645 action->plug(viewmenu); 650 action->plug(viewmenu);
646#endif //KAB_EMBEDDED 651#endif //KAB_EMBEDDED
647 652
648 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, 653 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
649 this, SLOT( deleteView() ), 654 this, SLOT( deleteView() ),
650 mCore->actionCollection(), "view_delete" ); 655 mCore->actionCollection(), "view_delete" );
651#ifndef KAB_EMBEDDED 656#ifndef KAB_EMBEDDED
652 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); 657 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) );
653#else //KAB_EMBEDDED 658#else //KAB_EMBEDDED
654 mActionDeleteView->plug(viewmenu); 659 mActionDeleteView->plug(viewmenu);
655 viewmenu->insertSeparator(); 660 viewmenu->insertSeparator();
656#endif //KAB_EMBEDDED 661#endif //KAB_EMBEDDED
657 662
658#ifndef KAB_EMBEDDED 663#ifndef KAB_EMBEDDED
659 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 664 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
660 SLOT( refreshView(const QString &) ), mCore->actionCollection(), 665 SLOT( refreshView(const QString &) ), mCore->actionCollection(),
661 "view_refresh" ); 666 "view_refresh" );
662 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); 667 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
663#else //KAB_EMBEDDED 668#else //KAB_EMBEDDED
664 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 669 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
665 SLOT( refreshView()), mCore->actionCollection(), 670 SLOT( refreshView()), mCore->actionCollection(),
666 "view_refresh" ); 671 "view_refresh" );
667 action->plug(viewmenu); 672 action->plug(viewmenu);
668 viewmenu->insertSeparator(); 673 viewmenu->insertSeparator();
669#endif //KAB_EMBEDDED 674#endif //KAB_EMBEDDED
670 675
671 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, 676 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
672 SLOT( configureFilters() ), mCore->actionCollection(), 677 SLOT( configureFilters() ), mCore->actionCollection(),
673 "options_edit_filters" ); 678 "options_edit_filters" );
674 679
675 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); 680 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
676 681
677#if KDE_VERSION >= 309 682#if KDE_VERSION >= 309
678 mActionSelectFilter->setMenuAccelsEnabled( false ); 683 mActionSelectFilter->setMenuAccelsEnabled( false );
679#endif 684#endif
680 connect( mActionSelectFilter, SIGNAL( activated( int ) ), 685 connect( mActionSelectFilter, SIGNAL( activated( int ) ),
681 SLOT( setActiveFilter( int ) ) ); 686 SLOT( setActiveFilter( int ) ) );
682 687
683#ifdef KAB_EMBEDDED 688#ifdef KAB_EMBEDDED
684 action->plug(settingsmenu); 689 action->plug(settingsmenu);
685 mActionSelectFilter->plug(viewmenu); 690 mActionSelectFilter->plug(viewmenu);
686#endif //KAB_EMBEDDED 691#endif //KAB_EMBEDDED
687 692
688} 693}
689 694
690void ViewManager::initGUI() 695void ViewManager::initGUI()
691{ 696{
692 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); 697 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
693 mViewWidgetStack = new QWidgetStack( this ); 698 mViewWidgetStack = new QWidgetStack( this );
694 layout->addWidget( mViewWidgetStack ); 699 layout->addWidget( mViewWidgetStack );
695} 700}
696 701
697#ifndef KAB_EMBEDDED 702#ifndef KAB_EMBEDDED
698#include "viewmanager.moc" 703#include "viewmanager.moc"
699#endif //KAB_EMBEDDED 704#endif //KAB_EMBEDDED