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