-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 6b9fe4d..f918767 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -296,595 +296,595 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
296 | 296 | ||
297 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); | 297 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); |
298 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); | 298 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); |
299 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); | 299 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); |
300 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); | 300 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); |
301 | 301 | ||
302 | QLabel *l = new QLabel ( tab ); | 302 | QLabel *l = new QLabel ( tab ); |
303 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); | 303 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); |
304 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); | 304 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); |
305 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 305 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
306 | 306 | ||
307 | m_except = new QListView ( tab ); | 307 | m_except = new QListView ( tab ); |
308 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); | 308 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); |
309 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); | 309 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); |
310 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); | 310 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); |
311 | m_except-> addColumn ( tr( "Binary file(s)" )); | 311 | m_except-> addColumn ( tr( "Binary file(s)" )); |
312 | m_except-> setColumnAlignment ( 0, AlignCenter ); | 312 | m_except-> setColumnAlignment ( 0, AlignCenter ); |
313 | m_except-> setColumnAlignment ( 1, AlignCenter ); | 313 | m_except-> setColumnAlignment ( 1, AlignCenter ); |
314 | m_except-> setColumnAlignment ( 2, AlignCenter ); | 314 | m_except-> setColumnAlignment ( 2, AlignCenter ); |
315 | m_except-> setAllColumnsShowFocus ( true ); | 315 | m_except-> setAllColumnsShowFocus ( true ); |
316 | m_except-> setMinimumHeight ( 30 ); | 316 | m_except-> setMinimumHeight ( 30 ); |
317 | m_except-> header ( )-> setClickEnabled ( false ); | 317 | m_except-> header ( )-> setClickEnabled ( false ); |
318 | m_except-> header ( )-> setResizeEnabled ( false ); | 318 | m_except-> header ( )-> setResizeEnabled ( false ); |
319 | m_except-> header ( )-> setMovingEnabled ( false ); | 319 | m_except-> header ( )-> setMovingEnabled ( false ); |
320 | m_except-> setSorting ( -1 ); | 320 | m_except-> setSorting ( -1 ); |
321 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 321 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); |
322 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 322 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
323 | 323 | ||
324 | connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int))); | 324 | connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int))); |
325 | 325 | ||
326 | QToolButton *tb = new QToolButton ( tab ); | 326 | QToolButton *tb = new QToolButton ( tab ); |
327 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 327 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
328 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 328 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
329 | lay-> addWidget ( tb, 2, 1 ); | 329 | lay-> addWidget ( tb, 2, 1 ); |
330 | connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept())); | 330 | connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept())); |
331 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | 331 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); |
332 | 332 | ||
333 | tb = new QToolButton ( tab ); | 333 | tb = new QToolButton ( tab ); |
334 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 334 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
335 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 335 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
336 | lay-> addWidget ( tb, 3, 1 ); | 336 | lay-> addWidget ( tb, 3, 1 ); |
337 | connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept())); | 337 | connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept())); |
338 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | 338 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); |
339 | 339 | ||
340 | tb = new QToolButton ( tab ); | 340 | tb = new QToolButton ( tab ); |
341 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | 341 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); |
342 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 342 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
343 | lay-> addWidget ( tb, 4, 1 ); | 343 | lay-> addWidget ( tb, 4, 1 ); |
344 | connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept())); | 344 | connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept())); |
345 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | 345 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); |
346 | 346 | ||
347 | tb = new QToolButton ( tab ); | 347 | tb = new QToolButton ( tab ); |
348 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 348 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
349 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 349 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
350 | lay-> addWidget ( tb, 5, 1 ); | 350 | lay-> addWidget ( tb, 5, 1 ); |
351 | connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept())); | 351 | connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept())); |
352 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | 352 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); |
353 | 353 | ||
354 | lay-> setRowStretch ( 6, 10 ); | 354 | lay-> setRowStretch ( 6, 10 ); |
355 | lay-> setColStretch ( 0, 10 ); | 355 | lay-> setColStretch ( 0, 10 ); |
356 | 356 | ||
357 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 357 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
358 | QListViewItem *lvit = 0; | 358 | QListViewItem *lvit = 0; |
359 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 359 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
360 | { | 360 | { |
361 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 361 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
362 | 362 | ||
363 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 363 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
364 | } | 364 | } |
365 | 365 | ||
366 | 366 | ||
367 | vertLayout-> addSpacing ( 3 ); | 367 | vertLayout-> addSpacing ( 3 ); |
368 | QFrame *f = new QFrame ( tab ); | 368 | QFrame *f = new QFrame ( tab ); |
369 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 369 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
370 | vertLayout-> addWidget ( f ); | 370 | vertLayout-> addWidget ( f ); |
371 | vertLayout-> addSpacing ( 3 ); | 371 | vertLayout-> addSpacing ( 3 ); |
372 | 372 | ||
373 | 373 | ||
374 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 374 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
375 | 375 | ||
376 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 376 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
377 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 377 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
378 | 378 | ||
379 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 379 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
380 | gridLayout-> addWidget ( label, 0, 0 ); | 380 | gridLayout-> addWidget ( label, 0, 0 ); |
381 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 381 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
382 | 382 | ||
383 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 383 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
384 | btngrp-> hide ( ); | 384 | btngrp-> hide ( ); |
385 | btngrp-> setExclusive ( true ); | 385 | btngrp-> setExclusive ( true ); |
386 | 386 | ||
387 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 387 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
388 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 388 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
389 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 389 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
390 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 390 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
391 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 391 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
392 | m_tabstyle_list-> setCurrentItem ( style ); | 392 | m_tabstyle_list-> setCurrentItem ( style ); |
393 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 393 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
394 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 394 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
395 | 395 | ||
396 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 396 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
397 | btngrp-> insert ( m_tabstyle_top ); | 397 | btngrp-> insert ( m_tabstyle_top ); |
398 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 398 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
399 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 399 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
400 | 400 | ||
401 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 401 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
402 | btngrp-> insert ( m_tabstyle_bottom ); | 402 | btngrp-> insert ( m_tabstyle_bottom ); |
403 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 403 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
404 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 404 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
405 | 405 | ||
406 | m_tabstyle_top-> setChecked ( tabtop ); | 406 | m_tabstyle_top-> setChecked ( tabtop ); |
407 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 407 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
408 | 408 | ||
409 | m_original_tabstyle = style; | 409 | m_original_tabstyle = style; |
410 | m_original_tabpos = tabtop; | 410 | m_original_tabpos = tabtop; |
411 | 411 | ||
412 | vertLayout-> addSpacing ( 3 ); | 412 | vertLayout-> addSpacing ( 3 ); |
413 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 413 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
414 | 414 | ||
415 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 415 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
416 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 416 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
417 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | 417 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); |
418 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 418 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
419 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | 419 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); |
420 | QPixmap ccw1; | 420 | QPixmap ccw1; |
421 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 421 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
422 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); | 422 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); |
423 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 423 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
424 | 424 | ||
425 | rotbtngrp-> hide ( ); | 425 | rotbtngrp-> hide ( ); |
426 | rotbtngrp-> setExclusive ( true ); | 426 | rotbtngrp-> setExclusive ( true ); |
427 | rotbtngrp-> insert ( m_rotdir_cw ); | 427 | rotbtngrp-> insert ( m_rotdir_cw ); |
428 | rotbtngrp-> insert ( m_rotdir_ccw ); | 428 | rotbtngrp-> insert ( m_rotdir_ccw ); |
429 | rotbtngrp-> insert ( m_rotdir_flip ); | 429 | rotbtngrp-> insert ( m_rotdir_flip ); |
430 | 430 | ||
431 | ccw1. convertFromImage( ccwImage ); | 431 | ccw1. convertFromImage( ccwImage ); |
432 | m_rotdir_cw-> setPixmap( cw1 ); | 432 | m_rotdir_cw-> setPixmap( cw1 ); |
433 | m_rotdir_ccw-> setPixmap( ccw1 ); | 433 | m_rotdir_ccw-> setPixmap( ccw1 ); |
434 | m_rotdir_flip-> setPixmap( flip1 ); | 434 | m_rotdir_flip-> setPixmap( flip1 ); |
435 | 435 | ||
436 | rotLay-> addWidget ( rotlabel, 0 ); | 436 | rotLay-> addWidget ( rotlabel, 0 ); |
437 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 437 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
438 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 438 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
439 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 439 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
440 | 440 | ||
441 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 441 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
442 | ODirection rot = CW; | 442 | ODirection rot = CW; |
443 | 443 | ||
444 | if (rotDirection == -1) | 444 | if (rotDirection == -1) |
445 | { | 445 | { |
446 | rot = ODevice::inst ( )-> direction ( ); | 446 | rot = ODevice::inst ( )-> direction ( ); |
447 | } | 447 | } |
448 | else | 448 | else |
449 | { | 449 | { |
450 | rot = (ODirection)rotDirection; | 450 | rot = (ODirection)rotDirection; |
451 | } | 451 | } |
452 | 452 | ||
453 | m_rotdir_cw-> setChecked ( rot == CW ); | 453 | m_rotdir_cw-> setChecked ( rot == CW ); |
454 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 454 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
455 | m_rotdir_flip-> setChecked ( rot == Flip ); | 455 | m_rotdir_flip-> setChecked ( rot == Flip ); |
456 | 456 | ||
457 | return tab; | 457 | return tab; |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 461 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
462 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 462 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
463 | { | 463 | { |
464 | setCaption( tr( "Appearance Settings" ) ); | 464 | setCaption( tr( "Appearance Settings" ) ); |
465 | 465 | ||
466 | Config config( "qpe" ); | 466 | Config config( "qpe" ); |
467 | config.setGroup( "Appearance" ); | 467 | config.setGroup( "Appearance" ); |
468 | 468 | ||
469 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 469 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
470 | 470 | ||
471 | m_sample = new SampleWindow ( this ); | 471 | m_sample = new SampleWindow ( this ); |
472 | 472 | ||
473 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 473 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
474 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 474 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
475 | 475 | ||
476 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 476 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
477 | QWidget *styletab; | 477 | QWidget *styletab; |
478 | 478 | ||
479 | m_color_list = 0; | 479 | m_color_list = 0; |
480 | 480 | ||
481 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 481 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
482 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 482 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
483 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 483 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
484 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 484 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
485 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 485 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
486 | 486 | ||
487 | top-> addWidget ( tw, 10 ); | 487 | top-> addWidget ( tw, 10 ); |
488 | top-> addWidget ( m_sample, 1 ); | 488 | top-> addWidget ( m_sample, 1 ); |
489 | 489 | ||
490 | tw-> setCurrentTab ( styletab ); | 490 | tw-> setCurrentTab ( styletab ); |
491 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); | 491 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
492 | 492 | ||
493 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 493 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
494 | } | 494 | } |
495 | 495 | ||
496 | Appearance::~Appearance() | 496 | Appearance::~Appearance() |
497 | {} | 497 | {} |
498 | 498 | ||
499 | void Appearance::tabChanged ( QWidget *w ) | 499 | void Appearance::tabChanged ( QWidget *w ) |
500 | { | 500 | { |
501 | if ( w == m_advtab ) | 501 | if ( w == m_advtab ) |
502 | { | 502 | { |
503 | m_sample-> hide ( ); | 503 | m_sample-> hide ( ); |
504 | updateGeometry ( ); // shouldn't be necessary ... | 504 | updateGeometry ( ); // shouldn't be necessary ... |
505 | } | 505 | } |
506 | else | 506 | else |
507 | m_sample-> show ( ); | 507 | m_sample-> show ( ); |
508 | } | 508 | } |
509 | 509 | ||
510 | void Appearance::accept ( ) | 510 | void Appearance::accept ( ) |
511 | { | 511 | { |
512 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 512 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
513 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 513 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
514 | 514 | ||
515 | Config config ( "qpe" ); | 515 | Config config ( "qpe" ); |
516 | config. setGroup ( "Appearance" ); | 516 | config. setGroup ( "Appearance" ); |
517 | 517 | ||
518 | if ( m_style_changed ) | 518 | if ( m_style_changed ) |
519 | { | 519 | { |
520 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 520 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
521 | if ( item ) | 521 | if ( item ) |
522 | config.writeEntry( "Style", item-> key ( )); | 522 | config.writeEntry( "Style", item-> key ( )); |
523 | } | 523 | } |
524 | 524 | ||
525 | if ( m_deco_changed ) | 525 | if ( m_deco_changed ) |
526 | { | 526 | { |
527 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 527 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
528 | if ( item ) | 528 | if ( item ) |
529 | config.writeEntry( "Decoration", item-> key ( )); | 529 | config.writeEntry( "Decoration", item-> key ( )); |
530 | } | 530 | } |
531 | 531 | ||
532 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) | 532 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
533 | { | 533 | { |
534 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 534 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
535 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 535 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
536 | } | 536 | } |
537 | 537 | ||
538 | if ( m_font_changed ) | 538 | if ( m_font_changed ) |
539 | { | 539 | { |
540 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 540 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
541 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 541 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
542 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 542 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
543 | } | 543 | } |
544 | 544 | ||
545 | 545 | ||
546 | if ( m_color_changed ) | 546 | if ( m_color_changed ) |
547 | { | 547 | { |
548 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 548 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
549 | 549 | ||
550 | if ( item ) | 550 | if ( item ) |
551 | item-> save ( config ); | 551 | item-> save ( config ); |
552 | } | 552 | } |
553 | 553 | ||
554 | ODirection rot; | 554 | ODirection rot; |
555 | if (m_rotdir_ccw-> isChecked ( )) | 555 | if (m_rotdir_ccw-> isChecked ( )) |
556 | { | 556 | { |
557 | rot = CCW; | 557 | rot = CCW; |
558 | } | 558 | } |
559 | else if (m_rotdir_cw-> isChecked ( )) | 559 | else if (m_rotdir_cw-> isChecked ( )) |
560 | { | 560 | { |
561 | rot = CW; | 561 | rot = CW; |
562 | } | 562 | } |
563 | else | 563 | else |
564 | { | 564 | { |
565 | rot = Flip; | 565 | rot = Flip; |
566 | } | 566 | } |
567 | config. writeEntry ( "rotatedir", (int)rot ); | 567 | config. writeEntry ( "rotatedir", (int)rot ); |
568 | 568 | ||
569 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 569 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
570 | 570 | ||
571 | QStringList sl; | 571 | QStringList sl; |
572 | QString exceptstr; | 572 | QString exceptstr; |
573 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) | 573 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) |
574 | { | 574 | { |
575 | int fl = 0; | 575 | int fl = 0; |
576 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 576 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
577 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 577 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
578 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 578 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
579 | exceptstr = QString::number ( fl, 32 ); | 579 | exceptstr = QString::number ( fl, 32 ); |
580 | exceptstr.append( it-> pattern ( )); | 580 | exceptstr.append( it-> pattern ( )); |
581 | sl << exceptstr; | 581 | sl << exceptstr; |
582 | } | 582 | } |
583 | config. writeEntry ( "NoStyle", sl, ';' ); | 583 | config. writeEntry ( "NoStyle", sl, ';' ); |
584 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 584 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); |
585 | 585 | ||
586 | config. write ( ); // need to flush the config info first | 586 | config. write ( ); // need to flush the config info first |
587 | Global::applyStyle ( ); | 587 | Global::applyStyle ( ); |
588 | 588 | ||
589 | QDialog::accept ( ); | 589 | QDialog::accept ( ); |
590 | } | 590 | } |
591 | 591 | ||
592 | void Appearance::done ( int r ) | 592 | void Appearance::done ( int r ) |
593 | { | 593 | { |
594 | QDialog::done ( r ); | 594 | QDialog::done ( r ); |
595 | close ( ); | 595 | close ( ); |
596 | } | 596 | } |
597 | 597 | ||
598 | 598 | ||
599 | void Appearance::styleClicked ( int index ) | 599 | void Appearance::styleClicked ( int index ) |
600 | { | 600 | { |
601 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 601 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
602 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 602 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
603 | 603 | ||
604 | if ( m_sample && sli && sli-> style ( )) | 604 | if ( m_sample && sli && sli-> style ( )) |
605 | { | 605 | { |
606 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 606 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
607 | 607 | ||
608 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 608 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
609 | } | 609 | } |
610 | 610 | ||
611 | m_style_changed |= ( index != m_original_style ); | 611 | m_style_changed |= ( index != m_original_style ); |
612 | } | 612 | } |
613 | 613 | ||
614 | void Appearance::styleSettingsClicked ( ) | 614 | void Appearance::styleSettingsClicked ( ) |
615 | { | 615 | { |
616 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 616 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
617 | 617 | ||
618 | if ( item && item-> hasSettings ( )) | 618 | if ( item && item-> hasSettings ( )) |
619 | { | 619 | { |
620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
621 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 621 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
622 | 622 | ||
623 | QWidget *w = item-> settings ( d ); | 623 | QWidget *w = item-> settings ( d ); |
624 | 624 | ||
625 | if ( w ) | 625 | if ( w ) |
626 | { | 626 | { |
627 | vbox-> addWidget ( w ); | 627 | vbox-> addWidget ( w ); |
628 | 628 | ||
629 | d-> setCaption ( w-> caption ( )); | 629 | d-> setCaption ( w-> caption ( )); |
630 | 630 | ||
631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); | 631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
632 | 632 | ||
633 | if ( item-> setSettings ( accepted )) | 633 | if ( item-> setSettings ( accepted )) |
634 | m_style_changed = true; | 634 | m_style_changed = true; |
635 | } | 635 | } |
636 | delete d; | 636 | delete d; |
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | void Appearance::decoClicked ( int index ) | 640 | void Appearance::decoClicked ( int index ) |
641 | { | 641 | { |
642 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 642 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
643 | 643 | ||
644 | if ( m_sample ) | 644 | if ( m_sample ) |
645 | { | 645 | { |
646 | if ( dli && dli-> interface ( )) | 646 | if ( dli && dli-> interface ( )) |
647 | m_sample-> setDecoration ( dli-> interface ( )); | 647 | m_sample-> setDecoration ( dli-> interface ( )); |
648 | else | 648 | else |
649 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 649 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
650 | m_sample-> repaint ( ); | 650 | m_sample-> repaint ( ); |
651 | } | 651 | } |
652 | m_deco_changed |= ( index != m_original_deco ); | 652 | m_deco_changed |= ( index != m_original_deco ); |
653 | } | 653 | } |
654 | 654 | ||
655 | void Appearance::fontClicked ( const QFont &f ) | 655 | void Appearance::fontClicked ( const QFont &f ) |
656 | { | 656 | { |
657 | m_font_changed |= ( f != m_sample-> font ( )); | 657 | m_font_changed |= ( f != m_sample-> font ( )); |
658 | m_sample-> setFont ( f ); | 658 | m_sample-> setFont ( f ); |
659 | } | 659 | } |
660 | 660 | ||
661 | void Appearance::colorClicked ( int index ) | 661 | void Appearance::colorClicked ( int index ) |
662 | { | 662 | { |
663 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 663 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
664 | 664 | ||
665 | if ( item ) | 665 | if ( item ) |
666 | m_sample-> setPalette ( item-> palette ( )); | 666 | m_sample-> setPalette ( item-> palette ( )); |
667 | 667 | ||
668 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 668 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
669 | } | 669 | } |
670 | 670 | ||
671 | 671 | ||
672 | void Appearance::editSchemeClicked ( ) | 672 | void Appearance::editSchemeClicked ( ) |
673 | { | 673 | { |
674 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 674 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
675 | 675 | ||
676 | int cnt = 0; | 676 | int cnt = 0; |
677 | QString labels [QColorGroup::NColorRoles]; | 677 | QString labels [QColorGroup::NColorRoles]; |
678 | QColor colors [QColorGroup::NColorRoles]; | 678 | QColor colors [QColorGroup::NColorRoles]; |
679 | 679 | ||
680 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) | 680 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
681 | { | 681 | { |
682 | QColor col = item-> color ( role ); | 682 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); |
683 | 683 | ||
684 | if ( col. isValid ( )) | 684 | if ( col. isValid ( )) |
685 | { | 685 | { |
686 | labels [cnt] = item-> label ( role ); | 686 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); |
687 | colors [cnt] = col; | 687 | colors[cnt] = col; |
688 | 688 | ||
689 | cnt++; | 689 | cnt++; |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) | 694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
695 | { | 695 | { |
696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
697 | cnt = 0; | 697 | cnt = 0; |
698 | 698 | ||
699 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) | 699 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
700 | { | 700 | { |
701 | if ( item-> color ( role ). isValid ( )) | 701 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) |
702 | { | 702 | { |
703 | citem-> setColor ( role, colors [cnt] ); | 703 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); |
704 | cnt++; | 704 | cnt++; |
705 | } | 705 | } |
706 | } | 706 | } |
707 | 707 | ||
708 | m_color_list-> setCurrentItem ( 0 ); | 708 | m_color_list-> setCurrentItem ( 0 ); |
709 | colorClicked ( 0 ); | 709 | colorClicked ( 0 ); |
710 | 710 | ||
711 | m_color_changed = true; | 711 | m_color_changed = true; |
712 | } | 712 | } |
713 | delete editdlg; | 713 | delete editdlg; |
714 | } | 714 | } |
715 | 715 | ||
716 | 716 | ||
717 | void Appearance::saveSchemeClicked() | 717 | void Appearance::saveSchemeClicked() |
718 | { | 718 | { |
719 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 719 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
720 | 720 | ||
721 | if ( !item ) | 721 | if ( !item ) |
722 | return; | 722 | return; |
723 | 723 | ||
724 | QDialog *d = new QDialog ( this, 0, true ); | 724 | QDialog *d = new QDialog ( this, 0, true ); |
725 | d-> setCaption ( tr( "Save Scheme" )); | 725 | d-> setCaption ( tr( "Save Scheme" )); |
726 | QLineEdit *ed = new QLineEdit ( d ); | 726 | QLineEdit *ed = new QLineEdit ( d ); |
727 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 727 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
728 | ed-> setFocus ( ); | 728 | ed-> setFocus ( ); |
729 | 729 | ||
730 | if ( d-> exec ( ) == QDialog::Accepted ) | 730 | if ( d-> exec ( ) == QDialog::Accepted ) |
731 | { | 731 | { |
732 | QString schemename = ed-> text ( ); | 732 | QString schemename = ed-> text ( ); |
733 | QString filestr = QPEApplication::qpeDir(); | 733 | QString filestr = QPEApplication::qpeDir(); |
734 | filestr.append( "/etc/colors/" ); | 734 | filestr.append( "/etc/colors/" ); |
735 | filestr.append( schemename ); | 735 | filestr.append( schemename ); |
736 | filestr.append( ".scheme" ); | 736 | filestr.append( ".scheme" ); |
737 | QFile file ( filestr ); | 737 | QFile file ( filestr ); |
738 | if ( !file. exists ( )) | 738 | if ( !file. exists ( )) |
739 | { | 739 | { |
740 | QPalette p = item-> palette ( ); | 740 | QPalette p = item-> palette ( ); |
741 | 741 | ||
742 | Config config ( file.name(), Config::File ); | 742 | Config config ( file.name(), Config::File ); |
743 | config. setGroup( "Colors" ); | 743 | config. setGroup( "Colors" ); |
744 | 744 | ||
745 | item-> save ( config ); | 745 | item-> save ( config ); |
746 | 746 | ||
747 | config. write ( ); // need to flush the config info first | 747 | config. write ( ); // need to flush the config info first |
748 | 748 | ||
749 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); | 749 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); |
750 | } | 750 | } |
751 | else | 751 | else |
752 | { | 752 | { |
753 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 753 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
754 | } | 754 | } |
755 | } | 755 | } |
756 | delete d; | 756 | delete d; |
757 | } | 757 | } |
758 | 758 | ||
759 | void Appearance::deleteSchemeClicked() | 759 | void Appearance::deleteSchemeClicked() |
760 | { | 760 | { |
761 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 761 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
762 | 762 | ||
763 | if ( !item ) | 763 | if ( !item ) |
764 | return; | 764 | return; |
765 | 765 | ||
766 | if ( m_color_list-> currentItem ( ) > 0 ) | 766 | if ( m_color_list-> currentItem ( ) > 0 ) |
767 | { | 767 | { |
768 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 768 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
769 | { | 769 | { |
770 | QString filestr = QPEApplication::qpeDir ( ); | 770 | QString filestr = QPEApplication::qpeDir ( ); |
771 | filestr.append( "/etc/colors/" ); | 771 | filestr.append( "/etc/colors/" ); |
772 | filestr.append( item-> text ( ) ); | 772 | filestr.append( item-> text ( ) ); |
773 | filestr.append( ".scheme" ); | 773 | filestr.append( ".scheme" ); |
774 | QFile::remove ( filestr ); | 774 | QFile::remove ( filestr ); |
775 | delete item; | 775 | delete item; |
776 | } | 776 | } |
777 | } | 777 | } |
778 | else | 778 | else |
779 | { | 779 | { |
780 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 780 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | 784 | ||
785 | void Appearance::addExcept ( ) | 785 | void Appearance::addExcept ( ) |
786 | { | 786 | { |
787 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); | 787 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); |
788 | m_except-> ensureItemVisible ( it ); | 788 | m_except-> ensureItemVisible ( it ); |
789 | m_except-> setSelected ( it, true ); | 789 | m_except-> setSelected ( it, true ); |
790 | } | 790 | } |
791 | 791 | ||
792 | void Appearance::delExcept ( ) | 792 | void Appearance::delExcept ( ) |
793 | { | 793 | { |
794 | if ( m_except-> selectedItem ( )) | 794 | if ( m_except-> selectedItem ( )) |
795 | { | 795 | { |
796 | m_except-> setFocus ( ); | 796 | m_except-> setFocus ( ); |
797 | delete m_except-> selectedItem ( ); | 797 | delete m_except-> selectedItem ( ); |
798 | } | 798 | } |
799 | } | 799 | } |
800 | 800 | ||
801 | void Appearance::upExcept ( ) | 801 | void Appearance::upExcept ( ) |
802 | { | 802 | { |
803 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | 803 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); |
804 | 804 | ||
805 | if ( it && it-> itemAbove ( )) | 805 | if ( it && it-> itemAbove ( )) |
806 | it-> itemAbove ( )-> moveItem ( it ); | 806 | it-> itemAbove ( )-> moveItem ( it ); |
807 | } | 807 | } |
808 | 808 | ||
809 | void Appearance::downExcept ( ) | 809 | void Appearance::downExcept ( ) |
810 | { | 810 | { |
811 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | 811 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); |
812 | 812 | ||
813 | if ( it && it-> itemBelow ( )) | 813 | if ( it && it-> itemBelow ( )) |
814 | it-> moveItem ( it-> itemBelow ( )); | 814 | it-> moveItem ( it-> itemBelow ( )); |
815 | } | 815 | } |
816 | 816 | ||
817 | class ExEdit : public QLineEdit | 817 | class ExEdit : public QLineEdit |
818 | { | 818 | { |
819 | public: | 819 | public: |
820 | ExEdit ( ExceptListItem *item ) | 820 | ExEdit ( ExceptListItem *item ) |
821 | : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) | 821 | : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) |
822 | { | 822 | { |
823 | setFrame ( false ); | 823 | setFrame ( false ); |
824 | 824 | ||
825 | QRect r = it-> listView ( )-> itemRect ( it ); | 825 | QRect r = it-> listView ( )-> itemRect ( it ); |
826 | 826 | ||
827 | int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; | 827 | int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; |
828 | int y = r. y ( ); | 828 | int y = r. y ( ); |
829 | int w = it-> listView ( )-> viewport ( )-> width ( ) - x; | 829 | int w = it-> listView ( )-> viewport ( )-> width ( ) - x; |
830 | int h = r. height ( ); // + 2; | 830 | int h = r. height ( ); // + 2; |
831 | 831 | ||
832 | setText ( it-> pattern ( )); | 832 | setText ( it-> pattern ( )); |
833 | setGeometry ( x, y, w, h ); | 833 | setGeometry ( x, y, w, h ); |
834 | 834 | ||
835 | qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); | 835 | qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); |
836 | 836 | ||
837 | m_out = true; | 837 | m_out = true; |
838 | 838 | ||
839 | show ( ); | 839 | show ( ); |
840 | setFocus ( ); | 840 | setFocus ( ); |
841 | selectAll ( ); | 841 | selectAll ( ); |
842 | end ( true ); | 842 | end ( true ); |
843 | } | 843 | } |
844 | 844 | ||
845 | virtual void focusOutEvent ( QFocusEvent * ) | 845 | virtual void focusOutEvent ( QFocusEvent * ) |
846 | { | 846 | { |
847 | hide ( ); | 847 | hide ( ); |
848 | if ( m_out ) | 848 | if ( m_out ) |
849 | it-> setPattern ( text ( )); | 849 | it-> setPattern ( text ( )); |
850 | delete this; | 850 | delete this; |
851 | } | 851 | } |
852 | 852 | ||
853 | virtual void keyPressEvent ( QKeyEvent *e ) | 853 | virtual void keyPressEvent ( QKeyEvent *e ) |
854 | { | 854 | { |
855 | if ( e-> key ( ) == Key_Return ) | 855 | if ( e-> key ( ) == Key_Return ) |
856 | it-> listView ( )-> setFocus ( ); | 856 | it-> listView ( )-> setFocus ( ); |
857 | else if ( e-> key ( ) == Key_Escape ) | 857 | else if ( e-> key ( ) == Key_Escape ) |
858 | { | 858 | { |
859 | m_out = false; | 859 | m_out = false; |
860 | it-> listView ( )-> setFocus ( ); | 860 | it-> listView ( )-> setFocus ( ); |
861 | } | 861 | } |
862 | else | 862 | else |
863 | QLineEdit::keyPressEvent ( e ); | 863 | QLineEdit::keyPressEvent ( e ); |
864 | } | 864 | } |
865 | 865 | ||
866 | private: | 866 | private: |
867 | ExceptListItem *it; | 867 | ExceptListItem *it; |
868 | bool m_out; | 868 | bool m_out; |
869 | }; | 869 | }; |
870 | 870 | ||
871 | void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) | 871 | void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) |
872 | { | 872 | { |
873 | if ( !item || c < 0 || c > 3 ) | 873 | if ( !item || c < 0 || c > 3 ) |
874 | return; | 874 | return; |
875 | 875 | ||
876 | ExceptListItem *it = (ExceptListItem *) item; | 876 | ExceptListItem *it = (ExceptListItem *) item; |
877 | 877 | ||
878 | if ( c == 0 ) | 878 | if ( c == 0 ) |
879 | it-> setNoStyle ( !it-> noStyle ( )); | 879 | it-> setNoStyle ( !it-> noStyle ( )); |
880 | else if ( c == 1 ) | 880 | else if ( c == 1 ) |
881 | it-> setNoFont ( !it-> noFont ( )); | 881 | it-> setNoFont ( !it-> noFont ( )); |
882 | else if ( c == 2 ) | 882 | else if ( c == 2 ) |
883 | it-> setNoDeco ( !it-> noDeco ( )); | 883 | it-> setNoDeco ( !it-> noDeco ( )); |
884 | else if ( c == 3 ) | 884 | else if ( c == 3 ) |
885 | { | 885 | { |
886 | m_except-> ensureItemVisible ( it ); | 886 | m_except-> ensureItemVisible ( it ); |
887 | new ExEdit ( it ); | 887 | new ExEdit ( it ); |
888 | } | 888 | } |
889 | } | 889 | } |
890 | 890 | ||