summaryrefslogtreecommitdiffstats
path: root/redhat/tdebase/tdebase-3.5.13.2-kdm_theme_selector.patch
blob: 39f6f49a3ecb3530475940a557a58c02d15b32ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
--- 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 <tqimage.h>
 #include <tqfileinfo.h>
 #include <tqpushbutton.h>
+#include <tqgroupbox.h>
 
 #include <kcolorbutton.h>
 #include <kurl.h>
@@ -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 <tqbuttongroup.h>
 #include <tqlabel.h>
 #include <tqlayout.h>
+#include <tqcheckbox.h>
 #include <tqradiobutton.h>
 #include <tqwhatsthis.h>
 #include <tqvalidator.h>
@@ -35,6 +36,7 @@
 #include <tqcheckbox.h>
 #include <tqstyle.h>
 
+#include <kdesktopfile.h>
 #include <klocale.h>
 #include <klineedit.h>
 #include <kimageio.h>
@@ -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( "" );