--- trinity-tdebase-3.5.13.2~pre86+807a5445/kcontrol/kdm/kdm-appear.h.kdm_theme_selector 2013-01-09 02:12:13.000000000 +0100 +++ trinity-tdebase-3.5.13.2~pre86+807a5445/kcontrol/kdm/kdm-appear.h 2013-05-09 12:58:14.535347383 +0200 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -57,6 +58,7 @@ void loadColorSchemes(KBackedComboBox *combo); void loadGuiStyles(KBackedComboBox *combo); + void loadThemes(KBackedComboBox *combo); void loadLanguageList(KLanguageButton *combo); bool eventFilter(TQObject *, TQEvent *); @@ -72,6 +74,7 @@ private slots: void slotAreaRadioClicked(int id); void slotLogoButtonClicked(); + void slotUsethemeChanged(bool state); void changed(); private: @@ -85,14 +88,19 @@ TQRadioButton *logoRadio; TQLineEdit *xLineEdit; TQLineEdit *yLineEdit; + TQCheckBox * themecheck; KBackedComboBox *compositorcombo; KBackedComboBox *guicombo; + KBackedComboBox *themecombo; KBackedComboBox *colcombo; KBackedComboBox *echocombo; + TQLabel * themeimagelabel; KLanguageButton *langcombo; TQCheckBox *sakbox; TQLabel *sakwarning; + //TQHBoxLayout * themehlay; + TQGroupBox *themegroup; }; #endif --- trinity-tdebase-3.5.13.2~pre86+807a5445/kcontrol/kdm/kdm-appear.cpp.kdm_theme_selector 2013-01-09 02:12:13.000000000 +0100 +++ trinity-tdebase-3.5.13.2~pre86+807a5445/kcontrol/kdm/kdm-appear.cpp 2013-05-09 13:00:34.428413714 +0200 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include +#include #include #include #include @@ -62,10 +64,43 @@ TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "vbox"); - TQGroupBox *group = new TQGroupBox(i18n("Appearance"), this); + + // ThemeBox Starts here + + themecheck = new TQCheckBox( i18n("Use Theme"), this ); + vbox->addWidget(themecheck); + connect(themecheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed())); + connect(themecheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotUsethemeChanged(bool))); + + themegroup = new TQGroupBox(0, Vertical, i18n("Theme"), this); + vbox->addWidget(themegroup); + + TQGridLayout * grid = new TQGridLayout( themegroup->layout(), 4, 3, KDialog::spacingHint() ); + + grid->setColStretch(1, 1); + grid->setColStretch(2, 1); + + themecombo = new KBackedComboBox(themegroup); + loadThemes(themecombo); + + TQLabel * label1 = new TQLabel(themecombo, i18n("KDM Theme:"),themegroup); + grid->addWidget(label1,1,0); + grid->addWidget(themecombo,1,1); + connect(themecombo, TQT_SIGNAL(activated(int)), TQT_SLOT(changed())); + connect(themecombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotThemeChanged(int))); + + themeimagelabel = new TQLabel(themecombo,"",themegroup); + + grid->addMultiCellWidget(themeimagelabel,1,3,2,2,TQt::AlignRight); + + vbox->addStretch(1); + // ENDS HERE + + TQGroupBox * group = new TQGroupBox(i18n("Appearance"), this); + vbox->addWidget(group); - TQGridLayout *grid = new TQGridLayout( group, 5, 2, KDialog::marginHint(), + grid = new TQGridLayout( group, 5, 2, KDialog::marginHint(), KDialog::spacingHint(), "grid"); grid->addRowSpacing(0, group->fontMetrics().height()); grid->setColStretch(0, 1); @@ -267,10 +302,25 @@ } + +void KDMAppearanceWidget::slotUsethemeChanged(bool state) +{ + //themehlay->setEnabled(state); + //themecombo->setEnabled(state); + //themeimagelabel->setEnabled(state); + themegroup->setEnabled(state); +} + + void KDMAppearanceWidget::makeReadOnly() { disconnect( logobutton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotLogoButtonClicked()) ); + + themecheck->setEnabled(false); + //themegroup->setEnabled(false); + themecombo->setEnabled(false); + themeimagelabel->setEnabled(false); logobutton->setAcceptDrops(false); greetstr_lined->setReadOnly(true); noneRadio->setEnabled(false); @@ -352,6 +402,40 @@ } } +void KDMAppearanceWidget::loadThemes(KBackedComboBox *combo) +{ + // Gets current Theme in kdmrc + TQString current; + config->setGroup("X-*-Greeter"); + TQFileInfo Theme = config->readEntry("Theme"); + if(Theme.exists()) { + current = Theme.fileName(); + } + + // List directories under "themes" directory + TQDir d(locate("data", TQString::fromLatin1("kdm/themes/")), "", TQDir::Name, TQDir::Dirs|TQDir::NoSymLinks|TQDir::Readable|TQDir::Executable); + TQStringList list = d.entryList(); + + combo->clear(); + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { + TQString name = (*it); + + if(name == "." || name == ".." ) { + continue; + } + + if (name.isEmpty()) { + name = "default"; + } + + combo->insertItem( *it, name); + + if (name == current) { + combo->setCurrentItem(combo->count()-1); + } + } +} + bool KDMAppearanceWidget::setLogo(TQString logo) { TQString flogo = logo.isEmpty() ? @@ -468,6 +552,10 @@ config->writeEntry("GUIStyle", guicombo->currentId()); + TQString Theme = locate("data", TQString::fromLatin1("kdm/themes/")); + Theme.append(themecombo->currentId()); + config->writeEntry("Theme", Theme); + config->writeEntry("ColorScheme", colcombo->currentId()); config->writeEntry("EchoMode", echocombo->currentId()); @@ -476,6 +564,8 @@ config->writeEntry("Language", langcombo->current()); + config->writeEntry("UseTheme", themecheck->isChecked()); + if (!sakwarning) { config->writeEntry("UseSAK", sakbox->isChecked()); } @@ -523,6 +613,8 @@ // Check the current compositor type compositorcombo->setCurrentId(config->readEntry("Compositor")); + loadThemes(themecombo); + // Check the GUI type guicombo->setCurrentId(config->readEntry("GUIStyle")); @@ -544,6 +636,9 @@ // get the language langcombo->setCurrentItem(config->readEntry("Language", "C")); + themecheck->setChecked(config->readBoolEntry("UseTheme",true)); + slotUsethemeChanged(config->readBoolEntry("UseTheme",true)); + // See if the SAK is enabled if (!sakwarning) { sakbox->setChecked(config->readBoolEntry("UseSAK", true)); @@ -556,10 +651,12 @@ void KDMAppearanceWidget::defaults() { + themecheck->setChecked(true); greetstr_lined->setText( i18n("Welcome to %n") ); logoRadio->setChecked( true ); slotAreaRadioClicked( KdmLogo ); setLogo( "" ); + themecombo->setCurrentId(""); compositorcombo->setCurrentId( "" ); guicombo->setCurrentId( "" ); colcombo->setCurrentId( "" );