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