author | sandman <sandman> | 2002-11-28 00:35:42 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-28 00:35:42 (UTC) |
commit | 57ad30fb514428e068142e31ee40aa1615291123 (patch) (unidiff) | |
tree | e5fd98fec4f207730e1e7e6cbda1044e96711cad /noncore/settings/appearance2/appearance.cpp | |
parent | 27fe94d8aec5ffff56b39eb89b0e36f2b1c229ed (diff) | |
download | opie-57ad30fb514428e068142e31ee40aa1615291123.zip opie-57ad30fb514428e068142e31ee40aa1615291123.tar.gz opie-57ad30fb514428e068142e31ee40aa1615291123.tar.bz2 |
two small fixes for the new "no style" list:
- changes are saved on "OK" even when the embedded lineedit has the focus
- the order of the entries not reversed on each invocation anymore
Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 22b12b4..f611799 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -277,24 +277,25 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
277 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 ); | 277 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 ); |
278 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 ); | 278 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 ); |
279 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 ); | 279 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 ); |
280 | m_except-> addColumn ( tr( "Binary file(s)" )); | 280 | m_except-> addColumn ( tr( "Binary file(s)" )); |
281 | m_except-> setColumnAlignment ( 0, AlignCenter ); | 281 | m_except-> setColumnAlignment ( 0, AlignCenter ); |
282 | m_except-> setColumnAlignment ( 1, AlignCenter ); | 282 | m_except-> setColumnAlignment ( 1, AlignCenter ); |
283 | m_except-> setColumnAlignment ( 2, AlignCenter ); | 283 | m_except-> setColumnAlignment ( 2, AlignCenter ); |
284 | m_except-> setAllColumnsShowFocus ( true ); | 284 | m_except-> setAllColumnsShowFocus ( true ); |
285 | m_except-> setMinimumHeight ( 30 ); | 285 | m_except-> setMinimumHeight ( 30 ); |
286 | m_except-> header ( )-> setClickEnabled ( false ); | 286 | m_except-> header ( )-> setClickEnabled ( false ); |
287 | m_except-> header ( )-> setResizeEnabled ( false ); | 287 | m_except-> header ( )-> setResizeEnabled ( false ); |
288 | m_except-> header ( )-> setMovingEnabled ( false ); | 288 | m_except-> header ( )-> setMovingEnabled ( false ); |
289 | m_except-> setSorting ( -1 ); | ||
289 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 290 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); |
290 | 291 | ||
291 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); | 292 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); |
292 | 293 | ||
293 | QToolButton *tb = new QToolButton ( tab ); | 294 | QToolButton *tb = new QToolButton ( tab ); |
294 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 295 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
295 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 296 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
296 | lay-> addWidget ( tb, 2, 1 ); | 297 | lay-> addWidget ( tb, 2, 1 ); |
297 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); | 298 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); |
298 | 299 | ||
299 | tb = new QToolButton ( tab ); | 300 | tb = new QToolButton ( tab ); |
300 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 301 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
@@ -309,28 +310,29 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
309 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); | 310 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); |
310 | 311 | ||
311 | tb = new QToolButton ( tab ); | 312 | tb = new QToolButton ( tab ); |
312 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 313 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
313 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 314 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
314 | lay-> addWidget ( tb, 5, 1 ); | 315 | lay-> addWidget ( tb, 5, 1 ); |
315 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); | 316 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); |
316 | 317 | ||
317 | lay-> setRowStretch ( 6, 10 ); | 318 | lay-> setRowStretch ( 6, 10 ); |
318 | lay-> setColStretch ( 0, 10 ); | 319 | lay-> setColStretch ( 0, 10 ); |
319 | 320 | ||
320 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 321 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
322 | QListViewItem *lvit = 0; | ||
321 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 323 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
322 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 324 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
323 | 325 | ||
324 | new ExceptListItem ( m_except, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 326 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
325 | } | 327 | } |
326 | 328 | ||
327 | 329 | ||
328 | vertLayout-> addSpacing ( 3 ); | 330 | vertLayout-> addSpacing ( 3 ); |
329 | QFrame *f = new QFrame ( tab ); | 331 | QFrame *f = new QFrame ( tab ); |
330 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 332 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
331 | vertLayout-> addWidget ( f ); | 333 | vertLayout-> addWidget ( f ); |
332 | vertLayout-> addSpacing ( 3 ); | 334 | vertLayout-> addSpacing ( 3 ); |
333 | 335 | ||
334 | 336 | ||
335 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
336 | 338 | ||
@@ -446,24 +448,26 @@ void Appearance::accept ( ) | |||
446 | } | 448 | } |
447 | 449 | ||
448 | 450 | ||
449 | if ( m_color_changed ) | 451 | if ( m_color_changed ) |
450 | { | 452 | { |
451 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 453 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
452 | 454 | ||
453 | if ( item ) | 455 | if ( item ) |
454 | item-> save ( config ); | 456 | item-> save ( config ); |
455 | } | 457 | } |
456 | 458 | ||
457 | 459 | ||
460 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | ||
461 | |||
458 | QStringList sl; | 462 | QStringList sl; |
459 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { | 463 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { |
460 | int fl = 0; | 464 | int fl = 0; |
461 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 465 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
462 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 466 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
463 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 467 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
464 | sl << ( QString::number ( fl, 32 ) + it-> pattern ( )); | 468 | sl << ( QString::number ( fl, 32 ) + it-> pattern ( )); |
465 | } | 469 | } |
466 | config. writeEntry ( "NoStyle", sl, ';' ); | 470 | config. writeEntry ( "NoStyle", sl, ';' ); |
467 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 471 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); |
468 | 472 | ||
469 | config. write ( ); // need to flush the config info first | 473 | config. write ( ); // need to flush the config info first |
@@ -643,25 +647,25 @@ void Appearance::deleteSchemeClicked() | |||
643 | delete item; | 647 | delete item; |
644 | } | 648 | } |
645 | } | 649 | } |
646 | else | 650 | else |
647 | { | 651 | { |
648 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 652 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
649 | } | 653 | } |
650 | } | 654 | } |
651 | 655 | ||
652 | 656 | ||
653 | void Appearance::addExcept ( ) | 657 | void Appearance::addExcept ( ) |
654 | { | 658 | { |
655 | ExceptListItem *it = new ExceptListItem ( m_except, tr( "<new>" ), true, true, true ); | 659 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); |
656 | m_except-> ensureItemVisible ( it ); | 660 | m_except-> ensureItemVisible ( it ); |
657 | m_except-> setSelected ( it, true ); | 661 | m_except-> setSelected ( it, true ); |
658 | } | 662 | } |
659 | 663 | ||
660 | void Appearance::delExcept ( ) | 664 | void Appearance::delExcept ( ) |
661 | { | 665 | { |
662 | if ( m_except-> selectedItem ( )) { | 666 | if ( m_except-> selectedItem ( )) { |
663 | m_except-> setFocus ( ); | 667 | m_except-> setFocus ( ); |
664 | delete m_except-> selectedItem ( ); | 668 | delete m_except-> selectedItem ( ); |
665 | } | 669 | } |
666 | } | 670 | } |
667 | 671 | ||