summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-17 17:09:57 (UTC)
committer zautrix <zautrix>2005-08-17 17:09:57 (UTC)
commitb3de38d3c4c3935a3fa428eeb4ad97fa8c60c43a (patch) (unidiff)
treeed4d04abe2996cde745757632d8616b23a15670b
parentc21edc19916722f5dd4e939f1522d311a86411fd (diff)
downloadkdepimpi-b3de38d3c4c3935a3fa428eeb4ad97fa8c60c43a.zip
kdepimpi-b3de38d3c4c3935a3fa428eeb4ad97fa8c60c43a.tar.gz
kdepimpi-b3de38d3c4c3935a3fa428eeb4ad97fa8c60c43a.tar.bz2
view select fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--kaddressbook/viewmanager.cpp7
-rw-r--r--kaddressbook/views/configuretableviewdialog.cpp2
3 files changed, 9 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 2e5cf50..18e94a7 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,27 +1,28 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.1 ************ 3********** VERSION 2.2.1 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed a problem displaying very long allday events in agenda view in single day mode. 6Fixed a problem displaying very long allday events in agenda view in single day mode.
7 7
8KA/Pi: 8KA/Pi:
9Added a config option to turn on asking before a contact is deleted. 9Added a config option to turn on asking before a contact is deleted.
10Fixed a problem with the default view and view selection at startup.
10 11
11********** VERSION 2.2.0 ************ 12********** VERSION 2.2.0 ************
12 13
13New stable release! 14New stable release!
14Fixed some minor usability problems. 15Fixed some minor usability problems.
15Added writing of next alarm to a file for usage on pdaXrom. 16Added writing of next alarm to a file for usage on pdaXrom.
16 17
17 18
18************************************* 19*************************************
19 20
20You can find the complete changelog 21You can find the complete changelog
21from version 1.7.7 to 2.2.0 22from version 1.7.7 to 2.2.0
22in the source package or on 23in the source package or on
23 24
24http://www.pi-sync.net/html/changelog.html 25http://www.pi-sync.net/html/changelog.html
25 26
26 27
27 28
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index c738ad8..b5d9419 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -148,241 +148,248 @@ void ViewManager::saveSettings()
148 KABPrefs::instance()->mViewNames = mViewNameList; 148 KABPrefs::instance()->mViewNames = mViewNameList;
149 KABPrefs::instance()->mCurrentView = mActiveView->caption(); 149 KABPrefs::instance()->mCurrentView = mActiveView->caption();
150 150
151} 151}
152 152
153QStringList ViewManager::selectedUids() const 153QStringList ViewManager::selectedUids() const
154{ 154{
155 if ( mActiveView ) 155 if ( mActiveView )
156 return mActiveView->selectedUids(); 156 return mActiveView->selectedUids();
157 else 157 else
158 return QStringList(); 158 return QStringList();
159} 159}
160 160
161QStringList ViewManager::selectedEmails() const 161QStringList ViewManager::selectedEmails() const
162{ 162{
163 if ( mActiveView ) 163 if ( mActiveView )
164 return mActiveView->selectedEmails(); 164 return mActiveView->selectedEmails();
165 else 165 else
166 return QStringList(); 166 return QStringList();
167} 167}
168 168
169KABC::Addressee::List ViewManager::selectedAddressees() const 169KABC::Addressee::List ViewManager::selectedAddressees() const
170{ 170{
171 KABC::Addressee::List list; 171 KABC::Addressee::List list;
172 if ( mActiveView ) { 172 if ( mActiveView ) {
173 QStringList uids = mActiveView->selectedUids(); 173 QStringList uids = mActiveView->selectedUids();
174 QStringList::Iterator it; 174 QStringList::Iterator it;
175 for ( it = uids.begin(); it != uids.end(); ++it ) { 175 for ( it = uids.begin(); it != uids.end(); ++it ) {
176 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 176 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
177 if ( !addr.isEmpty() ) 177 if ( !addr.isEmpty() )
178 list.append( addr ); 178 list.append( addr );
179 } 179 }
180 } 180 }
181 181
182 return list; 182 return list;
183} 183}
184//US added another method with no parameter, since my moc compiler does not support default parameters. 184//US added another method with no parameter, since my moc compiler does not support default parameters.
185void ViewManager::setSelected() 185void ViewManager::setSelected()
186{ 186{
187 setSelected( QString::null, true ); 187 setSelected( QString::null, true );
188} 188}
189 189
190void ViewManager::setSelected( const QString &uid, bool selected ) 190void ViewManager::setSelected( const QString &uid, bool selected )
191{ 191{
192 if ( mActiveView ) 192 if ( mActiveView )
193 mActiveView->setSelected( uid, selected ); 193 mActiveView->setSelected( uid, selected );
194} 194}
195 195
196void ViewManager::setListSelected(QStringList list) 196void ViewManager::setListSelected(QStringList list)
197{ 197{
198 int i, count = list.count(); 198 int i, count = list.count();
199 for ( i = 0; i < count;++i ) 199 for ( i = 0; i < count;++i )
200 setSelected( list[i], true ); 200 setSelected( list[i], true );
201 201
202} 202}
203void ViewManager::unloadViews() 203void ViewManager::unloadViews()
204{ 204{
205 mViewDict.clear(); 205 mViewDict.clear();
206 mActiveView = 0; 206 mActiveView = 0;
207} 207}
208 208
209void ViewManager::selectView( const QString &name ) 209void ViewManager::selectView( const QString &name )
210{ 210{
211 setActiveView( name ); 211 setActiveView( name );
212 mCore->saveSettings(); 212 mCore->saveSettings();
213} 213}
214void ViewManager::setActiveView( const QString &name ) 214void ViewManager::setActiveView( const QString &name )
215{ 215{
216 KAddressBookView *view = 0; 216 KAddressBookView *view = 0;
217 217
218 // Check that this isn't the same as the current active view 218 // Check that this isn't the same as the current active view
219 if ( mActiveView && ( mActiveView->caption() == name ) ) 219 if ( mActiveView && ( mActiveView->caption() == name ) )
220 return; 220 return;
221 221
222 // At this point we know the view that should be active is not 222 // 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 223 // 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 224 // we can't find it, it means it hasn't been instantiated, so we will
225 // create it on demand. 225 // create it on demand.
226 226
227 view = mViewDict.find( name ); 227 view = mViewDict.find( name );
228 228
229 // Check if we found the view. If we didn't, then we need to create it 229 // Check if we found the view. If we didn't, then we need to create it
230 if ( view == 0 ) { 230 if ( view == 0 ) {
231 KConfig *config = mCore->config(); 231 KConfig *config = mCore->config();
232 232
233 KConfigGroupSaver saver( config, name ); 233 KConfigGroupSaver saver( config, name );
234 234
235 QString type = config->readEntry( "Type", "Table" ); 235 QString type = config->readEntry( "Type", "Table" );
236 236
237 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; 237 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
238 238
239 ViewFactory *factory = mViewFactoryDict.find( type ); 239 ViewFactory *factory = mViewFactoryDict.find( type );
240 if ( factory ) 240 if ( factory )
241 view = factory->view( mCore->addressBook(), mViewWidgetStack ); 241 view = factory->view( mCore->addressBook(), mViewWidgetStack );
242 242
243 if ( view ) { 243 if ( view ) {
244 if ( !mViewNameList.contains( name ) ) {
245 mViewNameList.append( name );
246 }
244 view->setCaption( name ); 247 view->setCaption( name );
245 mViewDict.insert( name, view ); 248 mViewDict.insert( name, view );
246//US my version needs an int as second parameter to addWidget 249//US my version needs an int as second parameter to addWidget
247 mViewWidgetStack->addWidget( view, -1 ); 250 mViewWidgetStack->addWidget( view, -1 );
248 view->readConfig( config ); 251 view->readConfig( config );
249 252
250 // The manager just relays the signals 253 // The manager just relays the signals
251 connect( view, SIGNAL( selected( const QString& ) ), 254 connect( view, SIGNAL( selected( const QString& ) ),
252 SIGNAL( selected( const QString & ) ) ); 255 SIGNAL( selected( const QString & ) ) );
253 connect( view, SIGNAL( executed( const QString& ) ), 256 connect( view, SIGNAL( executed( const QString& ) ),
254 SIGNAL( executed( const QString& ) ) ); 257 SIGNAL( executed( const QString& ) ) );
255 258
256 connect( view, SIGNAL( deleteRequest( ) ), 259 connect( view, SIGNAL( deleteRequest( ) ),
257 SIGNAL( deleteRequest( ) ) ); 260 SIGNAL( deleteRequest( ) ) );
258 261
259 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); 262 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
260 connect( view, SIGNAL( dropped( QDropEvent* ) ), 263 connect( view, SIGNAL( dropped( QDropEvent* ) ),
261 SLOT( dropped( QDropEvent* ) ) ); 264 SLOT( dropped( QDropEvent* ) ) );
262 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); 265 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
263 } 266 }
264 } 267 }
265 268
266 // If we found or created the view, raise it and refresh it 269 // If we found or created the view, raise it and refresh it
267 if ( view ) { 270 if ( view ) {
268 mActiveView = view; 271 mActiveView = view;
269 mViewWidgetStack->raiseWidget( view ); 272 mViewWidgetStack->raiseWidget( view );
270 // Set the proper filter in the view. By setting the combo 273 // Set the proper filter in the view. By setting the combo
271 // box, the activated slot will be called, which will push 274 // box, the activated slot will be called, which will push
272 // the filter to the view and refresh it. 275 // the filter to the view and refresh it.
273 276
274 if ( view->defaultFilterType() == KAddressBookView::None ) { 277 if ( view->defaultFilterType() == KAddressBookView::None ) {
275 278
276 mActionSelectFilter->setCurrentItem( 0 ); 279 mActionSelectFilter->setCurrentItem( 0 );
277 setActiveFilter( 0 ); 280 setActiveFilter( 0 );
278 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 281 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
279 setActiveFilter( mActionSelectFilter->currentItem() ); 282 setActiveFilter( mActionSelectFilter->currentItem() );
280 } else { 283 } else {
281 uint pos = filterPosition( view->defaultFilterName() ); 284 uint pos = filterPosition( view->defaultFilterName() );
282 mActionSelectFilter->setCurrentItem( pos ); 285 mActionSelectFilter->setCurrentItem( pos );
283 setActiveFilter( pos ); 286 setActiveFilter( pos );
284 } 287 }
285//US qDebug("ViewManager::setActiveView 6" ); 288//US qDebug("ViewManager::setActiveView 6" );
286 289
287 // Update the inc search widget to show the fields in the new active 290 // Update the inc search widget to show the fields in the new active
288 // view. 291 // view.
289 mCore->setSearchFields( mActiveView->fields() ); 292 mCore->setSearchFields( mActiveView->fields() );
290 293
291//US performance optimization. setActiveFilter calls also mActiveView->refresh() 294//US performance optimization. setActiveFilter calls also mActiveView->refresh()
292//US mActiveView->refresh(); 295//US mActiveView->refresh();
296
297 mActionSelectView->setItems( mViewNameList );
298 mActionSelectView->setCurrentItem( mViewNameList.findIndex( mActiveView->caption() ) );
299
293 } 300 }
294 else 301 else
295 { 302 {
296 qDebug("ViewManager::setActiveView: unable to find view" ); 303 qDebug("ViewManager::setActiveView: unable to find view" );
297 } 304 }
298} 305}
299 306
300//US added another method with no parameter, since my moc compiler does not support default parameters. 307//US added another method with no parameter, since my moc compiler does not support default parameters.
301void ViewManager::refreshView() 308void ViewManager::refreshView()
302{ 309{
303 refreshView( QString::null ); 310 refreshView( QString::null );
304} 311}
305 312
306void ViewManager::refreshView( const QString &uid ) 313void ViewManager::refreshView( const QString &uid )
307{ 314{
308 if ( mActiveView ) 315 if ( mActiveView )
309 mActiveView->refresh( uid ); 316 mActiveView->refresh( uid );
310} 317}
311 318
312void ViewManager::setFocusAV() 319void ViewManager::setFocusAV()
313{ 320{
314 if ( mActiveView ) 321 if ( mActiveView )
315 mActiveView->setFocusAV(); 322 mActiveView->setFocusAV();
316} 323}
317void ViewManager::editView() 324void ViewManager::editView()
318{ 325{
319 if ( !mActiveView ) 326 if ( !mActiveView )
320 return; 327 return;
321 328
322 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); 329 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
323 ViewConfigureWidget *wdg = 0; 330 ViewConfigureWidget *wdg = 0;
324 ViewConfigureDialog* dlg = 0; 331 ViewConfigureDialog* dlg = 0;
325 if ( factory ) { 332 if ( factory ) {
326 // Save the filters so the dialog has the latest set 333 // Save the filters so the dialog has the latest set
327 Filter::save( mCore->config(), "Filter", mFilterList ); 334 Filter::save( mCore->config(), "Filter", mFilterList );
328 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 335 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
329 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 336 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
330 } else { 337 } else {
331 qDebug("ViewManager::editView()::cannot find viewfactory "); 338 qDebug("ViewManager::editView()::cannot find viewfactory ");
332 return; 339 return;
333 } 340 }
334 if ( wdg ) { 341 if ( wdg ) {
335 dlg->setWidget( wdg ); 342 dlg->setWidget( wdg );
336 343
337#ifndef DESKTOP_VERSION 344#ifndef DESKTOP_VERSION
338 //dlg.setMaximumSize( 640, 480 ); 345 //dlg.setMaximumSize( 640, 480 );
339 //dlg->setGeometry( 40,40, 400, 300); 346 //dlg->setGeometry( 40,40, 400, 300);
340 dlg->showMaximized(); 347 dlg->showMaximized();
341#endif 348#endif
342 349
343 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 350 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
344 351
345 dlg->restoreSettings( mCore->config() ); 352 dlg->restoreSettings( mCore->config() );
346 353
347 if ( dlg->exec() ) { 354 if ( dlg->exec() ) {
348 dlg->saveSettings( mCore->config() ); 355 dlg->saveSettings( mCore->config() );
349 mActiveView->readConfig( mCore->config() ); 356 mActiveView->readConfig( mCore->config() );
350 357
351 // Set the proper filter in the view. By setting the combo 358 // Set the proper filter in the view. By setting the combo
352 // box, the activated slot will be called, which will push 359 // box, the activated slot will be called, which will push
353 // the filter to the view and refresh it. 360 // the filter to the view and refresh it.
354 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 361 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
355 mActionSelectFilter->setCurrentItem( 0 ); 362 mActionSelectFilter->setCurrentItem( 0 );
356 setActiveFilter( 0 ); 363 setActiveFilter( 0 );
357 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { 364 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) {
358 setActiveFilter( mActionSelectFilter->currentItem() ); 365 setActiveFilter( mActionSelectFilter->currentItem() );
359 } else { 366 } else {
360 uint pos = filterPosition( mActiveView->defaultFilterName() ); 367 uint pos = filterPosition( mActiveView->defaultFilterName() );
361 mActionSelectFilter->setCurrentItem( pos ); 368 mActionSelectFilter->setCurrentItem( pos );
362 setActiveFilter( pos ); 369 setActiveFilter( pos );
363 } 370 }
364 mCore->setSearchFields( mActiveView->fields() ); 371 mCore->setSearchFields( mActiveView->fields() );
365//US performance optimization. setActiveFilter calls also mActiveView->refresh() 372//US performance optimization. setActiveFilter calls also mActiveView->refresh()
366//US mActiveView->refresh(); 373//US mActiveView->refresh();
367 374
368 375
369 //US this is a bugfix, that we get notified if we change a views configuration 376 //US this is a bugfix, that we get notified if we change a views configuration
370 emit modified(); 377 emit modified();
371 378
372 } 379 }
373 380
374 } 381 }
375 delete dlg; 382 delete dlg;
376} 383}
377 384
378void ViewManager::deleteView() 385void ViewManager::deleteView()
379{ 386{
380 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) 387 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" )
381 .arg( mActiveView->caption() ); 388 .arg( mActiveView->caption() );
382 QString caption = i18n( "Confirm Delete" ); 389 QString caption = i18n( "Confirm Delete" );
383 390
384 391
385 if (QMessageBox::information( this, caption, 392 if (QMessageBox::information( this, caption,
386 text, 393 text,
387 i18n("Yes!"), i18n("No"), 0, 0 ) == 0) 394 i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
388 { 395 {
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp
index 0e36abd..c329cd9 100644
--- a/kaddressbook/views/configuretableviewdialog.cpp
+++ b/kaddressbook/views/configuretableviewdialog.cpp
@@ -14,193 +14,193 @@
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#include <qstring.h> 24#include <qstring.h>
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29#include <qcheckbox.h> 29#include <qcheckbox.h>
30#include <qvbox.h> 30#include <qvbox.h>
31#include <qbuttongroup.h> 31#include <qbuttongroup.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35 35
36#include <kglobal.h> 36#include <kglobal.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <klineedit.h> 38#include <klineedit.h>
39#include <kurlrequester.h> 39#include <kurlrequester.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kfontdialog.h> 41#include <kfontdialog.h>
42 42
43#ifndef KAB_EMBEDDED 43#ifndef KAB_EMBEDDED
44#include <kimageio.h> 44#include <kimageio.h>
45#else //KAB_EMBEDDED 45#else //KAB_EMBEDDED
46#endif //KAB_EMBEDDED 46#endif //KAB_EMBEDDED
47 47
48#include <kconfig.h> 48#include <kconfig.h>
49 49
50#include "colorlistbox.h" 50#include "colorlistbox.h"
51 51
52#include "configuretableviewdialog.h" 52#include "configuretableviewdialog.h"
53 53
54ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab, 54ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab,
55 QWidget *parent, 55 QWidget *parent,
56 const char *name ) 56 const char *name )
57 : ViewConfigureWidget( ab, parent, name ) 57 : ViewConfigureWidget( ab, parent, name )
58{ 58{
59 QWidget *page = addPage( i18n( "Look & Feel" ), QString::null, 59 QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
60 KGlobal::iconLoader()->loadIcon( "looknfeel", 60 KGlobal::iconLoader()->loadIcon( "looknfeel",
61 KIcon::Panel ) ); 61 KIcon::Panel ) );
62 62
63 mPage = new LookAndFeelPage( page ); 63 mPage = new LookAndFeelPage( page );
64} 64}
65 65
66ConfigureTableViewWidget::~ConfigureTableViewWidget() 66ConfigureTableViewWidget::~ConfigureTableViewWidget()
67{ 67{
68} 68}
69 69
70void ConfigureTableViewWidget::restoreSettings( KConfig *config ) 70void ConfigureTableViewWidget::restoreSettings( KConfig *config )
71{ 71{
72 ViewConfigureWidget::restoreSettings( config ); 72 ViewConfigureWidget::restoreSettings( config );
73 73
74 mPage->restoreSettings( config ); 74 mPage->restoreSettings( config );
75} 75}
76 76
77void ConfigureTableViewWidget::saveSettings( KConfig *config ) 77void ConfigureTableViewWidget::saveSettings( KConfig *config )
78{ 78{
79 ViewConfigureWidget::saveSettings( config ); 79 ViewConfigureWidget::saveSettings( config );
80 80
81 mPage->saveSettings( config ); 81 mPage->saveSettings( config );
82} 82}
83 83
84 84
85 85
86LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) 86LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name)
87 : QVBox(parent, name) 87 : QVBox(parent, name)
88{ 88{
89 initGUI(); 89 initGUI();
90 90
91 // Set initial state 91 // Set initial state
92 enableBackgroundToggled(mBackgroundBox->isChecked()); 92 enableBackgroundToggled(mBackgroundBox->isChecked());
93} 93}
94 94
95void LookAndFeelPage::restoreSettings( KConfig *config ) 95void LookAndFeelPage::restoreSettings( KConfig *config )
96{ 96{
97 mAlternateButton->setChecked(config->readBoolEntry("ABackground", true)); 97 mAlternateButton->setChecked(config->readBoolEntry("ABackground", true));
98 mLineButton->setChecked(config->readBoolEntry("SingleLine", false)); 98 mLineButton->setChecked(config->readBoolEntry("SingleLine", false));
99 mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true)); 99 mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true));
100 100
101 if (!mAlternateButton->isChecked() & !mLineButton->isChecked()) 101 if (!mAlternateButton->isChecked() & !mLineButton->isChecked())
102 mNoneButton->setChecked(true); 102 mNoneButton->setChecked(true);
103 103
104 mBackgroundBox->setChecked(config->readBoolEntry("Background", false)); 104 mBackgroundBox->setChecked(config->readBoolEntry("Background", false));
105 mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName")); 105 mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName"));
106 106
107 // colors 107 // colors
108 cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) ); 108 cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) );
109 QColor c; 109 QColor c;
110qDebug("LookAndFeelPage::restoreSettings make base color configurable"); 110 //qDebug("LookAndFeelPage::restoreSettings make base color configurable");
111 111
112#ifndef KAB_EMBEDDED 112#ifndef KAB_EMBEDDED
113 c = KGlobalSettings::baseColor(); 113 c = KGlobalSettings::baseColor();
114#else //KAB_EMBEDDED 114#else //KAB_EMBEDDED
115 c = QColor(0,0,0); 115 c = QColor(0,0,0);
116#endif //KAB_EMBEDDED 116#endif //KAB_EMBEDDED
117 117
118 c = colorGroup().background(); 118 c = colorGroup().background();
119 lbColors->insertItem( new ColorListItem( i18n("Background Color"), 119 lbColors->insertItem( new ColorListItem( i18n("Background Color"),
120 config->readColorEntry( "BackgroundColor", &c ) ) ); 120 config->readColorEntry( "BackgroundColor", &c ) ) );
121 c = colorGroup().foreground(); 121 c = colorGroup().foreground();
122 lbColors->insertItem( new ColorListItem( i18n("Text Color"), 122 lbColors->insertItem( new ColorListItem( i18n("Text Color"),
123 config->readColorEntry( "TextColor", &c ) ) ); 123 config->readColorEntry( "TextColor", &c ) ) );
124 c = colorGroup().button(); 124 c = colorGroup().button();
125 lbColors->insertItem( new ColorListItem( i18n("Header Background Color"), 125 lbColors->insertItem( new ColorListItem( i18n("Header Background Color"),
126 config->readColorEntry( "HeaderBackgroundColor", &c ) ) ); 126 config->readColorEntry( "HeaderBackgroundColor", &c ) ) );
127 c = colorGroup().buttonText(); 127 c = colorGroup().buttonText();
128 lbColors->insertItem( new ColorListItem( i18n("Header Text Color"), 128 lbColors->insertItem( new ColorListItem( i18n("Header Text Color"),
129 config->readColorEntry( "HeaderTextColor", &c ) ) ); 129 config->readColorEntry( "HeaderTextColor", &c ) ) );
130 c = colorGroup().highlight(); 130 c = colorGroup().highlight();
131 lbColors->insertItem( new ColorListItem( i18n("Highlight Color"), 131 lbColors->insertItem( new ColorListItem( i18n("Highlight Color"),
132 config->readColorEntry( "HighlightColor", &c ) ) ); 132 config->readColorEntry( "HighlightColor", &c ) ) );
133 c = colorGroup().highlightedText(); 133 c = colorGroup().highlightedText();
134 lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"), 134 lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"),
135 config->readColorEntry( "HighlightedTextColor", &c ) ) ); 135 config->readColorEntry( "HighlightedTextColor", &c ) ) );
136 c = colorGroup().background(); 136 c = colorGroup().background();
137 lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"), 137 lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"),
138 config->readColorEntry( "AlternatingBackgroundColor", &c ) ) ); 138 config->readColorEntry( "AlternatingBackgroundColor", &c ) ) );
139 139
140 enableColors(); 140 enableColors();
141 141
142 // fonts 142 // fonts
143 QFont fnt = font(); 143 QFont fnt = font();
144 updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont ); 144 updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont );
145 fnt.setBold( true ); 145 fnt.setBold( true );
146 updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont ); 146 updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont );
147 cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) ); 147 cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) );
148 enableFonts(); 148 enableFonts();
149 149
150} 150}
151 151
152void LookAndFeelPage::saveSettings( KConfig *config ) 152void LookAndFeelPage::saveSettings( KConfig *config )
153{ 153{
154 config->writeEntry("ABackground", mAlternateButton->isChecked()); 154 config->writeEntry("ABackground", mAlternateButton->isChecked());
155 config->writeEntry("SingleLine", mLineButton->isChecked()); 155 config->writeEntry("SingleLine", mLineButton->isChecked());
156 config->writeEntry("ToolTips", mToolTipBox->isChecked()); 156 config->writeEntry("ToolTips", mToolTipBox->isChecked());
157 config->writeEntry("Background", mBackgroundBox->isChecked()); 157 config->writeEntry("Background", mBackgroundBox->isChecked());
158 config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text()); 158 config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text());
159 159
160 // colors 160 // colors
161 config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() ); 161 config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() );
162 if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm. 162 if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm.
163 { 163 {
164 config->writeEntry( "BackgroundColor", lbColors->color( 0 ) ); 164 config->writeEntry( "BackgroundColor", lbColors->color( 0 ) );
165 config->writeEntry( "TextColor", lbColors->color( 1 ) ); 165 config->writeEntry( "TextColor", lbColors->color( 1 ) );
166 config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) ); 166 config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) );
167 config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) ); 167 config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) );
168 config->writeEntry( "HighlightColor", lbColors->color( 4 ) ); 168 config->writeEntry( "HighlightColor", lbColors->color( 4 ) );
169 config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) ); 169 config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) );
170 config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) ); 170 config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) );
171 } 171 }
172 // fonts 172 // fonts
173 config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() ); 173 config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() );
174 if ( cbEnableCustomFonts->isChecked() ) 174 if ( cbEnableCustomFonts->isChecked() )
175 { 175 {
176 config->writeEntry( "TextFont", lTextFont->font() ); 176 config->writeEntry( "TextFont", lTextFont->font() );
177 config->writeEntry( "HeaderFont", lHeaderFont->font() ); 177 config->writeEntry( "HeaderFont", lHeaderFont->font() );
178 } 178 }
179 179
180} 180}
181 181
182void LookAndFeelPage::setTextFont() 182void LookAndFeelPage::setTextFont()
183{ 183{
184 QFont f( lTextFont->font() ); 184 QFont f( lTextFont->font() );
185#ifndef KAB_EMBEDDED 185#ifndef KAB_EMBEDDED
186 if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted ) 186 if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted )
187 updateFontLabel( f, lTextFont ); 187 updateFontLabel( f, lTextFont );
188#else //KAB_EMBEDDED 188#else //KAB_EMBEDDED
189 bool ok; 189 bool ok;
190 QFont fout = KFontDialog::getFont( f, ok); 190 QFont fout = KFontDialog::getFont( f, ok);
191 if ( ok ) 191 if ( ok )
192 updateFontLabel( fout, lTextFont ); 192 updateFontLabel( fout, lTextFont );
193#endif //KAB_EMBEDDED 193#endif //KAB_EMBEDDED
194} 194}
195 195
196void LookAndFeelPage::setHeaderFont() 196void LookAndFeelPage::setHeaderFont()
197{ 197{
198 QFont f( lHeaderFont->font() ); 198 QFont f( lHeaderFont->font() );
199#ifndef KAB_EMBEDDED 199#ifndef KAB_EMBEDDED
200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted ) 200 if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
201 updateFontLabel( f, lHeaderFont ); 201 updateFontLabel( f, lHeaderFont );
202#else //KAB_EMBEDDED 202#else //KAB_EMBEDDED
203 bool ok; 203 bool ok;
204 QFont fout = KFontDialog::getFont( f, ok); 204 QFont fout = KFontDialog::getFont( f, ok);
205 if ( ok ) 205 if ( ok )
206 updateFontLabel( fout, lHeaderFont ); 206 updateFontLabel( fout, lHeaderFont );