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