Esempio n. 1
0
KComboBoxTest::KComboBoxTest(TQWidget* widget, const char* name )
              :TQWidget(widget, name)
{
  TQVBoxLayout *vbox = new TQVBoxLayout (this, KDialog::marginHint(), KDialog::spacingHint());
  
  // Test for KCombo's KLineEdit destruction
  KComboBox *testCombo = new KComboBox( true, this ); // rw, with KLineEdit
  testCombo->setEditable( false ); // destroys our KLineEdit
  assert( testCombo->delegate() == 0L );
  delete testCombo; // not needed anymore  
  
  // Qt combobox
  TQHBox* hbox = new TQHBox(this);
  hbox->setSpacing (KDialog::spacingHint());
  TQLabel* lbl = new TQLabel("&QCombobox:", hbox);
  lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
  
  m_qc = new TQComboBox(hbox, "QtReadOnlyCombo" );
  lbl->setBuddy (m_qc);  
  TQObject::connect (m_qc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
  TQObject::connect (m_qc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
  vbox->addWidget (hbox);
  
  // Read-only combobox
  hbox = new TQHBox(this);
  hbox->setSpacing (KDialog::spacingHint());
  lbl = new TQLabel("&Read-Only Combo:", hbox);
  lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);

  m_ro = new KComboBox(hbox, "ReadOnlyCombo" );
  lbl->setBuddy (m_ro);
  m_ro->setCompletionMode( TDEGlobalSettings::CompletionAuto );
  TQObject::connect (m_ro, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
  TQObject::connect (m_ro, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
  vbox->addWidget (hbox);

  // Read-write combobox
  hbox = new TQHBox(this);
  hbox->setSpacing (KDialog::spacingHint());
  lbl = new TQLabel("&Editable Combo:", hbox);
  lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);

  m_rw = new KComboBox( true, hbox, "ReadWriteCombo" );
  lbl->setBuddy (m_rw);
  m_rw->setDuplicatesEnabled( true );
  m_rw->setInsertionPolicy( TQComboBox::NoInsertion );
  m_rw->setTrapReturnKey( true );
  TQObject::connect (m_rw, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
  TQObject::connect (m_rw, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&)));
  TQObject::connect (m_rw, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));
  TQObject::connect (m_rw, TQT_SIGNAL(returnPressed(const TQString&)), TQT_SLOT(slotReturnPressed(const TQString&)));
  vbox->addWidget (hbox);

  // History combobox...
  hbox = new TQHBox(this);
  hbox->setSpacing (KDialog::spacingHint());
  lbl = new TQLabel("&History Combo:", hbox);
  lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);

  m_hc = new KHistoryCombo( true, hbox, "HistoryCombo" );
  lbl->setBuddy (m_hc);
  m_hc->setDuplicatesEnabled( true );
  m_hc->setInsertionPolicy( TQComboBox::NoInsertion );
  TQObject::connect (m_hc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
  TQObject::connect (m_hc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&)));
  TQObject::connect (m_hc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));  
  vbox->addWidget (hbox);
  m_hc->setTrapReturnKey(true);

  // Read-write combobox that is a replica of code in konqueror...
  hbox = new TQHBox(this);
  hbox->setSpacing (KDialog::spacingHint());
  lbl = new TQLabel( "&Konq's Combo:", hbox);
  lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);

  m_konqc = new KComboBox( true, hbox, "KonqyCombo" );
  lbl->setBuddy (m_konqc);
  m_konqc->setMaxCount( 10 );
  TQObject::connect (m_konqc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
  TQObject::connect (m_konqc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
  TQObject::connect (m_konqc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));
  vbox->addWidget (hbox);

  // Create an exit button
  hbox = new TQHBox (this);
  m_btnExit = new TQPushButton( "E&xit", hbox );
  TQObject::connect( m_btnExit, TQT_SIGNAL(clicked()), TQT_SLOT(quitApp()) );

  // Create a disable button...
  m_btnEnable = new TQPushButton( "Disa&ble", hbox );
  TQObject::connect (m_btnEnable, TQT_SIGNAL(clicked()), TQT_SLOT(slotDisable()));

  vbox->addWidget (hbox);

  // Popuplate the select-only list box
  TQStringList list;
  list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips"
       << "Computer" << "Mankind";
  list.sort();
  
  // Setup the qcombobox
  m_qc->insertStringList (list);
  
  // Setup read-only combo
  m_ro->insertStringList( list );
  m_ro->completionObject()->setItems( list );

  // Setup read-write combo
  m_rw->insertStringList( list );
  m_rw->completionObject()->setItems( list );

  // Setup read-write combo
  m_hc->insertStringList( list );
  m_hc->completionObject()->setItems( list );

  // Setup konq's combobox
  KSimpleConfig historyConfig( "konq_history" );
  historyConfig.setGroup( "Location Bar" );
  TDECompletion * s_pCompletion = new TDECompletion;
  s_pCompletion->setOrder( TDECompletion::Weighted );
  s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) );
  s_pCompletion->setCompletionMode( TDEGlobalSettings::completionMode() );
  m_konqc->setCompletionObject( s_pCompletion );

  TQPixmap pix = SmallIcon("www");
  m_konqc->insertItem( pix, "http://www.kde.org" );
  m_konqc->setCurrentItem( m_konqc->count()-1 );

  m_timer = new TQTimer (this);
  connect (m_timer, TQT_SIGNAL (timeout()), TQT_SLOT (slotTimeout()));
}
Esempio n. 2
0
KComboBoxTest::KComboBoxTest(QWidget* widget)
              :QWidget(widget)
{
  QVBoxLayout *vbox = new QVBoxLayout (this);

  // Qt combobox
  KHBox* hbox = new KHBox(this);
  hbox->setSpacing (-1);
  QLabel* lbl = new QLabel("&QCombobox:", hbox);
  lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);

  m_qc = new QComboBox(hbox);
  m_qc->setObjectName( QLatin1String( "QtReadOnlyCombo" ) );
  lbl->setBuddy (m_qc);
  connectComboSignals(m_qc);
  vbox->addWidget (hbox);

  // Read-only combobox
  hbox = new KHBox(this);
  hbox->setSpacing (-1);
  lbl = new QLabel("&Read-Only Combo:", hbox);
  lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);

  m_ro = new KComboBox(hbox );
  m_ro->setObjectName( "ReadOnlyCombo" );
  lbl->setBuddy (m_ro);
  m_ro->setCompletionMode( KGlobalSettings::CompletionAuto );
  connectComboSignals(m_ro);
  vbox->addWidget (hbox);

  // Read-write combobox
  hbox = new KHBox(this);
  hbox->setSpacing (-1);
  lbl = new QLabel("&Editable Combo:", hbox);
  lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);

  m_rw = new KComboBox( true, hbox );
  m_rw->setObjectName( "ReadWriteCombo" );
  lbl->setBuddy (m_rw);
  m_rw->setDuplicatesEnabled( true );
  m_rw->setInsertPolicy( QComboBox::NoInsert );
  m_rw->setTrapReturnKey( true );
  connectComboSignals(m_rw);
  vbox->addWidget (hbox);

  // History combobox...
  hbox = new KHBox(this);
  hbox->setSpacing (-1);
  lbl = new QLabel("&History Combo:", hbox);
  lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);

  m_hc = new KHistoryComboBox( hbox );
  m_hc->setObjectName( "HistoryCombo" );
  lbl->setBuddy (m_hc);
  m_hc->setDuplicatesEnabled( true );
  m_hc->setInsertPolicy( QComboBox::NoInsert );
  connectComboSignals(m_hc);
  vbox->addWidget (hbox);
  m_hc->setTrapReturnKey(true);

  // Read-write combobox that is a replica of code in konqueror...
  hbox = new KHBox(this);
  hbox->setSpacing (-1);
  lbl = new QLabel( "&Konq's Combo:", hbox);
  lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);

  m_konqc = new KComboBox( true, hbox );
  m_konqc->setObjectName( "KonqyCombo" );
  lbl->setBuddy (m_konqc);
  m_konqc->setMaxCount( 10 );
  connectComboSignals(m_konqc);
  vbox->addWidget (hbox);

  // Create an exit button
  hbox = new KHBox (this);
  m_btnExit = new QPushButton( "E&xit", hbox );
  QObject::connect( m_btnExit, SIGNAL(clicked()), SLOT(quitApp()) );

  // Create a disable button...
  m_btnEnable = new QPushButton( "Disa&ble", hbox );
  QObject::connect (m_btnEnable, SIGNAL(clicked()), SLOT(slotDisable()));

  vbox->addWidget (hbox);

  // Popuplate the select-only list box
  QStringList list;
  list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips"
       << "Computer" << "Mankind";
  list.sort();

  // Setup the qcombobox
  m_qc->addItems(list );

  // Setup read-only combo
  m_ro->addItems( list );
  m_ro->completionObject()->setItems( list );

  // Setup read-write combo
  m_rw->addItems( list );
  m_rw->completionObject()->setItems( list );

  // Setup history combo
  m_hc->addItems( list );
  m_hc->completionObject()->setItems( list + QStringList() << "One" << "Two" << "Three" );

  // Setup konq's combobox
  KConfig historyConfig( "konq_history", KConfig::SimpleConfig );
  KConfigGroup cg(&historyConfig, "Location Bar" );
  KCompletion * s_pCompletion = new KCompletion;
  s_pCompletion->setOrder( KCompletion::Weighted );
  s_pCompletion->setItems( cg.readEntry( "ComboContents", QStringList() ) );
  s_pCompletion->setCompletionMode( KGlobalSettings::completionMode() );
  m_konqc->setCompletionObject( s_pCompletion );

  QPixmap pix = SmallIcon("www");
  m_konqc->addItem( pix, "http://www.kde.org" );
  m_konqc->setCurrentIndex( m_konqc->count()-1 );

  m_timer = new QTimer (this);
  connect (m_timer, SIGNAL (timeout()), SLOT (slotTimeout()));
}
Esempio n. 3
0
KgColors::KgColors(bool first, QWidget* parent) :
        KonfiguratorPage(first, parent), offset(0),
        activeTabIdx(-1), inactiveTabIdx(-1),
#ifdef SYNCHRONIZER_ENABLED
        synchronizerTabIdx(-1),
#endif
        otherTabIdx(-1)
{
    QWidget *innerWidget = new QFrame(this);
    setWidget(innerWidget);
    setWidgetResizable(true);
    QGridLayout *kgColorsLayout = new QGridLayout(innerWidget);
    kgColorsLayout->setSpacing(6);

    //  -------------------------- GENERAL GROUPBOX ----------------------------------

    QGroupBox *generalGrp = createFrame(i18n("General"), innerWidget);
    QGridLayout *generalGrid = createGridLayout(generalGrp);

    generalGrid->setSpacing(0);
    generalGrid->setContentsMargins(5, 5, 5, 5);

    KONFIGURATOR_CHECKBOX_PARAM generalSettings[] =
        //  cfg_class  cfg_name                     default                 text                                              restart tooltip
    {{"Colors", "KDE Default",                 _KDEDefaultColors,      i18n("Use the default KDE colors"),             false,  "<p><img src='toolbar|kcontrol'></p>" + i18n("<p>Use KDE's global color configuration.</p><p><i>KDE System Settings -> Application Appearance  -> Colors</i></p>") },
        {"Colors", "Enable Alternate Background", _AlternateBackground,   i18n("Use alternate background color"),         false, i18n("<p>The <b>background color</b> and the <b>alternate background</b> color alternates line by line.</p><p>When you don't use the <i>KDE default colors</i>, you can configure the alternate colors in the <i>colors</i> box.</p>") },
        {"Colors", "Show Current Item Always",    _ShowCurrentItemAlways, i18n("Show current item even if not focused"),  false, i18n("<p>Shows the last cursor position in the non active list panel.</p><p>This option is only available when you don't use the <i>KDE default colors</i>.</p>") },
        {"Colors", "Dim Inactive Colors",         _DimInactiveColors,     i18n("Dim the colors of the inactive panel"),   false, i18n("<p>The colors of the inactive panel are calculated by a dim color and a dim factor.</p>") }
    };

    generals = createCheckBoxGroup(0, 2, generalSettings, sizeof(generalSettings) / sizeof(generalSettings[0]), generalGrp);
    generalGrid->addWidget(generals, 1, 0);

    generals->layout()->setSpacing(5);

    connect(generals->find("KDE Default"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable()));
    connect(generals->find("Show Current Item Always"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable()));
    connect(generals->find("Dim Inactive Colors"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable()));

    kgColorsLayout->addWidget(generalGrp, 0 , 0, 1, 3);
    QWidget *hboxWidget = new QWidget(innerWidget);
    QHBoxLayout *hbox = new QHBoxLayout(hboxWidget);

    //  -------------------------- COLORS GROUPBOX ----------------------------------

    QGroupBox *colorsFrameGrp = createFrame(i18n("Colors"), hboxWidget);
    QGridLayout *colorsFrameGrid = createGridLayout(colorsFrameGrp);
    colorsFrameGrid->setSpacing(0);
    colorsFrameGrid->setContentsMargins(3, 3, 3, 3);

    colorTabWidget = new QTabWidget(colorsFrameGrp);

    colorsGrp = new QWidget(colorTabWidget);
    activeTabIdx = colorTabWidget->addTab(colorsGrp, i18n("Active"));

    colorsGrid = new QGridLayout(colorsGrp);
    colorsGrid->setSpacing(0);
    colorsGrid->setContentsMargins(2, 2, 2, 2);

    ADDITIONAL_COLOR transparent  = { i18n("Transparent"),       Qt::white, "transparent" };

    QPalette p = QGuiApplication::palette();

    addColorSelector("Foreground",                 i18n("Foreground:"),                  p.color(QPalette::Active, QPalette::Text));
    addColorSelector("Directory Foreground",       i18n("Directory foreground:"),        getColorSelector("Foreground")->getColor(), i18n("Same as foreground"));
    addColorSelector("Executable Foreground",      i18n("Executable foreground:"),       getColorSelector("Foreground")->getColor(), i18n("Same as foreground"));
    addColorSelector("Symlink Foreground",         i18n("Symbolic link foreground:"),    getColorSelector("Foreground")->getColor(), i18n("Same as foreground"));
    addColorSelector("Invalid Symlink Foreground", i18n("Invalid symlink foreground:"),  getColorSelector("Foreground")->getColor(), i18n("Same as foreground"));
    addColorSelector("Background",                 i18n("Background:"),                  p.color(QPalette::Active, QPalette::Base));
    ADDITIONAL_COLOR sameAsBckgnd = { i18n("Same as background"), getColorSelector("Background")->getColor(), "Background" };
    addColorSelector("Alternate Background",       i18n("Alternate background:"),        p.color(QPalette::Active, QPalette::AlternateBase), "", &sameAsBckgnd, 1);
    addColorSelector("Marked Foreground",          i18n("Selected foreground:"),         p.color(QPalette::Active, QPalette::HighlightedText), "", &transparent, 1);
    addColorSelector("Marked Background",          i18n("Selected background:"),         p.color(QPalette::Active, QPalette::Highlight), "", &sameAsBckgnd, 1);
    ADDITIONAL_COLOR sameAsAltern = { i18n("Same as alt. background"), getColorSelector("Alternate Background")->getColor(), "Alternate Background" };
    addColorSelector("Alternate Marked Background", i18n("Alternate selected background:"), getColorSelector("Marked Background")->getColor(), i18n("Same as selected background"), &sameAsAltern, 1);
    addColorSelector("Current Foreground",         i18n("Current foreground:"),          Qt::white,                                    i18n("Not used"));
    ADDITIONAL_COLOR sameAsMarkedForegnd = { i18n("Same as selected foreground"), getColorSelector("Marked Foreground")->getColor(), "Marked Foreground" };
    addColorSelector("Marked Current Foreground",         i18n("Selected current foreground:"),          Qt::white,                                    i18n("Not used"), &sameAsMarkedForegnd, 1);
    addColorSelector("Current Background",         i18n("Current background:"),          Qt::white, i18n("Not used"), &sameAsBckgnd, 1);

    colorsGrid->addWidget(createSpacer(colorsGrp), itemList.count() - offset, 1);

    connect(getColorSelector("Foreground"), SIGNAL(colorChanged()), this, SLOT(slotForegroundChanged()));
    connect(getColorSelector("Background"), SIGNAL(colorChanged()), this, SLOT(slotBackgroundChanged()));
    connect(getColorSelector("Alternate Background"), SIGNAL(colorChanged()), this, SLOT(slotAltBackgroundChanged()));
    connect(getColorSelector("Marked Background"), SIGNAL(colorChanged()), this, SLOT(slotMarkedBackgroundChanged()));

    inactiveColorStack = new QStackedWidget(colorTabWidget);
    inactiveTabIdx = colorTabWidget->addTab(inactiveColorStack, i18n("Inactive"));

    colorsGrp = normalInactiveWidget = new QWidget(inactiveColorStack);

    colorsGrid = new QGridLayout(normalInactiveWidget);
    colorsGrid->setSpacing(0);
    colorsGrid->setContentsMargins(2, 2, 2, 2);

    offset = endOfActiveColors = itemList.count();

    addColorSelector("Inactive Foreground",                  i18n("Foreground:"),                  getColorSelector("Foreground")->getColor(), i18n("Same as active"));
    ADDITIONAL_COLOR sameAsInactForegnd = { i18n("Same as foreground"), getColorSelector("Inactive Foreground")->getColor(), "Inactive Foreground" };
    addColorSelector("Inactive Directory Foreground",        i18n("Directory foreground:"),        getColorSelector("Directory Foreground")->getColor(), i18n("Same as active"), &sameAsInactForegnd, 1);
    addColorSelector("Inactive Executable Foreground",       i18n("Executable foreground:"),       getColorSelector("Executable Foreground")->getColor(), i18n("Same as active"), &sameAsInactForegnd, 1);
    addColorSelector("Inactive Symlink Foreground",          i18n("Symbolic link foreground:"),    getColorSelector("Symlink Foreground")->getColor(), i18n("Same as active"), &sameAsInactForegnd, 1);
    addColorSelector("Inactive Invalid Symlink Foreground",  i18n("Invalid symlink foreground:"),  getColorSelector("Invalid Symlink Foreground")->getColor(), i18n("Same as active"), &sameAsInactForegnd, 1);
    addColorSelector("Inactive Background",                  i18n("Background:"),                  getColorSelector("Background")->getColor(), i18n("Same as active"));
    ADDITIONAL_COLOR sameAsInactBckgnd = { i18n("Same as background"), getColorSelector("Inactive Background")->getColor(), "Inactive Background" };
    addColorSelector("Inactive Alternate Background",        i18n("Alternate background:"),        getColorSelector("Alternate Background")->getColor(), i18n("Same as active"), &sameAsInactBckgnd, 1);
    addColorSelector("Inactive Marked Foreground",           i18n("Selected foreground:"),           getColorSelector("Marked Foreground")->getColor(), i18n("Same as active"), &transparent, 1);
    addColorSelector("Inactive Marked Background",           i18n("Selected background:"),           getColorSelector("Marked Background")->getColor(), i18n("Same as active"), &sameAsInactBckgnd, 1);
    ADDITIONAL_COLOR sameAsInactAltern[] = {{ i18n("Same as alt. background"), getColorSelector("Inactive Alternate Background")->getColor(), "Inactive Alternate Background" },
        { i18n("Same as selected background"), getColorSelector("Inactive Marked Background")->getColor(), "Inactive Marked Background" }
    };
    addColorSelector("Inactive Alternate Marked Background", i18n("Alternate selected background:"), getColorSelector("Alternate Marked Background")->getColor(), i18n("Same as active"), sameAsInactAltern, 2);
    addColorSelector("Inactive Current Foreground",          i18n("Current foreground:"),          getColorSelector("Current Foreground")->getColor(), i18n("Same as active"));
    ADDITIONAL_COLOR sameAsInactMarkedForegnd = { i18n("Same as selected foreground"), getColorSelector("Inactive Marked Foreground")->getColor(), "Inactive Marked Foreground" };
    addColorSelector("Inactive Marked Current Foreground",          i18n("Selected current foreground:"),          getColorSelector("Marked Current Foreground")->getColor(), i18n("Same as active"), &sameAsInactMarkedForegnd, 1);
    addColorSelector("Inactive Current Background",          i18n("Current background:"),          getColorSelector("Current Background")->getColor(), i18n("Same as active"), &sameAsInactBckgnd, 1);

    colorsGrid->addWidget(createSpacer(normalInactiveWidget), itemList.count() - offset, 1);

    connect(getColorSelector("Inactive Foreground"), SIGNAL(colorChanged()), this, SLOT(slotInactiveForegroundChanged()));
    connect(getColorSelector("Inactive Background"), SIGNAL(colorChanged()), this, SLOT(slotInactiveBackgroundChanged()));
    connect(getColorSelector("Inactive Alternate Background"), SIGNAL(colorChanged()), this, SLOT(slotInactiveAltBackgroundChanged()));
    connect(getColorSelector("Inactive Marked Background"), SIGNAL(colorChanged()), this, SLOT(slotInactiveMarkedBackgroundChanged()));

    offset = endOfPanelColors = itemList.count();

    inactiveColorStack->addWidget(normalInactiveWidget);

    colorsGrp = dimmedInactiveWidget = new QWidget(inactiveColorStack);

    colorsGrid = new QGridLayout(dimmedInactiveWidget);
    colorsGrid->setSpacing(0);
    colorsGrid->setContentsMargins(2, 2, 2, 2);

    addColorSelector("Dim Target Color", i18n("Dim target color:"), Qt::black);

    int index = itemList.count() - offset;
    labelList.append(addLabel(colorsGrid, index, 0, i18n("Dim factor:"), colorsGrp));
    dimFactor = createSpinBox("Colors", "Dim Factor", 80, 0, 100, colorsGrp);
    dimFactor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    colorsGrid->addWidget(dimFactor, index++, 1);

    colorsGrid->addWidget(createSpacer(dimmedInactiveWidget), itemList.count() + 1 - offset, 1);

    inactiveColorStack->addWidget(dimmedInactiveWidget);

    inactiveColorStack->setCurrentWidget(normalInactiveWidget);

    ADDITIONAL_COLOR KDEDefaultBase = { i18n("KDE default"), p.color(QPalette::Active, QPalette::Base), "KDE default" };
    ADDITIONAL_COLOR KDEDefaultFore = { i18n("KDE default"), p.color(QPalette::Active, QPalette::Text), "KDE default" };

#ifdef SYNCHRONIZER_ENABLED
    colorsGrp = new QWidget(colorTabWidget);
    synchronizerTabIdx = colorTabWidget->addTab(colorsGrp, i18n("Synchronizer"));

    colorsGrid = new QGridLayout(colorsGrp);
    colorsGrid->setSpacing(0);
    colorsGrid->setContentsMargins(2, 2, 2, 2);

    offset = endOfPanelColors = itemList.count();

    addColorSelector("Synchronizer Equals Foreground", i18n("Equals foreground:"), Qt::black, QString(), &KDEDefaultFore, 1);
    addColorSelector("Synchronizer Equals Background", i18n("Equals background:"), p.color(QPalette::Active, QPalette::Base), QString(), &KDEDefaultBase, 1);
    addColorSelector("Synchronizer Differs Foreground", i18n("Differing foreground:"), Qt::red, QString(), &KDEDefaultFore, 1);
    addColorSelector("Synchronizer Differs Background", i18n("Differing background:"), p.color(QPalette::Active, QPalette::Base), QString(), &KDEDefaultBase, 1);
    addColorSelector("Synchronizer LeftCopy Foreground", i18n("Copy to left foreground:"), Qt::blue, QString(), &KDEDefaultFore, 1);
    addColorSelector("Synchronizer LeftCopy Background", i18n("Copy to left background:"), p.color(QPalette::Active, QPalette::Base), QString(), &KDEDefaultBase, 1);
    addColorSelector("Synchronizer RightCopy Foreground", i18n("Copy to right foreground:"), Qt::darkGreen, QString(), &KDEDefaultFore, 1);
    addColorSelector("Synchronizer RightCopy Background", i18n("Copy to right background:"), p.color(QPalette::Active, QPalette::Base), QString(), &KDEDefaultBase, 1);
    addColorSelector("Synchronizer Delete Foreground", i18n("Delete foreground:"), Qt::white, QString(), &KDEDefaultFore, 1);
    addColorSelector("Synchronizer Delete Background", i18n("Delete background:"), Qt::red, QString(), &KDEDefaultBase, 1);

    colorsGrid->addWidget(createSpacer(colorsGrp), itemList.count() - offset, 1);
#endif

    colorsGrp = new QWidget(colorTabWidget);
    otherTabIdx = colorTabWidget->addTab(colorsGrp, i18n("Other"));

    colorsGrid = new QGridLayout(colorsGrp);
    colorsGrid->setSpacing(0);
    colorsGrid->setContentsMargins(2, 2, 2, 2);

    offset = endOfPanelColors = itemList.count();

    addColorSelector("Quicksearch Match Foreground", i18n("Quicksearch, match foreground:"), Qt::black, QString(), &KDEDefaultFore, 1);
    addColorSelector("Quicksearch Match Background", i18n("Quicksearch, match background:"), QColor(192, 255, 192), QString(), &KDEDefaultBase, 1);
    addColorSelector("Quicksearch Non-match Foreground", i18n("Quicksearch, non-match foreground:"), Qt::black, QString(), &KDEDefaultFore, 1);
    addColorSelector("Quicksearch Non-match Background", i18n("Quicksearch, non-match background:"), QColor(255, 192, 192), QString(), &KDEDefaultBase, 1);
    ADDITIONAL_COLOR KDEDefaultWindowFore = { i18n("KDE default"), p.color(QPalette::Active, QPalette::WindowText), "KDE default" };
    ADDITIONAL_COLOR KDEDefaultWindowBack = { i18n("KDE default"), p.color(QPalette::Active, QPalette::Window), "KDE default" };
    addColorSelector("Statusbar Foreground Active", i18n("Statusbar, active foreground:"), p.color(QPalette::Active, QPalette::HighlightedText), QString(), &KDEDefaultWindowFore, 1);
    addColorSelector("Statusbar Background Active", i18n("Statusbar, active background:"), p.color(QPalette::Active, QPalette::Highlight), QString(), &KDEDefaultWindowBack, 1);
    addColorSelector("Statusbar Foreground Inactive", i18n("Statusbar, inactive foreground:"), p.color(QPalette::Inactive, QPalette::Text), QString(), &KDEDefaultWindowFore, 1);
    addColorSelector("Statusbar Background Inactive", i18n("Statusbar, inactive background:"), p.color(QPalette::Inactive, QPalette::Base), QString(), &KDEDefaultWindowBack, 1);

    colorsGrid->addWidget(createSpacer(colorsGrp), itemList.count() - offset, 1);

    colorsFrameGrid->addWidget(colorTabWidget, 0, 0);
    hbox->addWidget(colorsFrameGrp);

    //  -------------------------- PREVIEW GROUPBOX ----------------------------------

    previewGrp = createFrame(i18n("Preview"), hboxWidget);
    previewGrid = createGridLayout(previewGrp);

    preview = new KrTreeWidget(previewGrp);
    preview->setBackgroundRole(QPalette::Window);
    preview->setAutoFillBackground(true);

    QStringList labels;
    labels << i18n("Colors");
    preview->setHeaderLabels(labels);

    preview->header()->setSortIndicatorShown(false);
    preview->setSortingEnabled(false);
    preview->setEnabled(false);

    previewGrid->addWidget(preview, 0 , 0);
    hbox->addWidget(previewGrp);

    connect(generals->find("Enable Alternate Background"), SIGNAL(stateChanged(int)), this, SLOT(generatePreview()));
    connect(colorTabWidget, SIGNAL(currentChanged(int)), this, SLOT(generatePreview()));
    connect(dimFactor, SIGNAL(valueChanged(int)), this, SLOT(generatePreview()));

    kgColorsLayout->addWidget(hboxWidget, 1 , 0, 1,  3);

    importBtn = new QPushButton(i18n("Import color-scheme"), innerWidget);
    kgColorsLayout->addWidget(importBtn, 2, 0);
    exportBtn = new QPushButton(i18n("Export color-scheme"), innerWidget);
    kgColorsLayout->addWidget(exportBtn, 2, 1);
    kgColorsLayout->addWidget(createSpacer(innerWidget), 2, 2);
    connect(importBtn, SIGNAL(clicked()), this, SLOT(slotImportColors()));
    connect(exportBtn, SIGNAL(clicked()), this, SLOT(slotExportColors()));

    slotDisable();
}