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