summaryrefslogtreecommitdiffstats
path: root/src/MainWidget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-02-27 15:28:40 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-02-27 15:29:41 +0900
commit4918c52f39ab6459d1c48e9456a7fbd01a4e91f6 (patch)
tree45027af97cb407006c2c09632566fbeeee1e3683 /src/MainWidget.cpp
parent807c1ac53f76fda7c4cafd58c5a2079a0a1961e5 (diff)
downloadkvkbd-4918c52f39ab6459d1c48e9456a7fbd01a4e91f6.tar.gz
kvkbd-4918c52f39ab6459d1c48e9456a7fbd01a4e91f6.zip
Keys color can now be changed without the need to restart the
application. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 64d40d992ecb290a7d395b14e5d3b81e4ed074d2)
Diffstat (limited to 'src/MainWidget.cpp')
-rw-r--r--src/MainWidget.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp
index ff7dc62..ee9c1df 100644
--- a/src/MainWidget.cpp
+++ b/src/MainWidget.cpp
@@ -511,27 +511,27 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
{
tray = new KbdTray ( this );
tray->setPixmap ( UserIcon ( "tray" ) );
-
+
TDEConfig *cfg = TDEApplication::kApplication()->config();
-
+
TDEPopupMenu *m = tray->contextMenu();
m->setCheckable ( true );
-
+
KHelpMenu *h = new KHelpMenu ( tray, about );
m->insertItem ( "Font ...", this, TQT_SLOT ( chooseFont() ) );
mnu_autores = m->insertItem( "Auto resize font",this, TQT_SLOT ( toggleFontAutoRes() ) );
bool fnt_autores = cfg->readBoolEntry("autoresfont",true);
m->setItemChecked(mnu_autores, fnt_autores);
-
+
m->insertItem ( i18n ("Background color"), this, TQT_SLOT ( chooseBackgroundColor() ) );
- m->insertItem ( i18n ("Keys color (requires restart)"), this, TQT_SLOT ( chooseKeysColor() ) );
+ m->insertItem ( i18n ("Keys color"), this, TQT_SLOT ( chooseKeysColor() ) );
m->insertSeparator();
mnu_dock = m->insertItem ( "Dock widget", this, TQT_SLOT ( showDock() ) );
bool show_dock = cfg->readBoolEntry("showdock",false);
m->setItemChecked(mnu_dock, show_dock);
-
+
mnu_lock = m->insertItem(i18n("Lock on screen"), this, TQT_SLOT(toggleLock()));
locked = cfg->readBoolEntry("locked", false);
m->setItemChecked(mnu_lock, locked);
@@ -597,7 +597,23 @@ void MainWidget::chooseKeysColor()
{
cfg->writeEntry("keysColor", newkeysC.name()); // save as #rrbbgg
cfg->sync();
- // can't set PaletteBackgroundColor because it's in VButton::VButton - needs restart to read configuration entry
+
+ for (unsigned idx = 0; idx < btns.size(); ++idx)
+ {
+ btns[idx]->setColor(newkeysC);
+ }
+ for (unsigned idx = 0; idx < mod_keys.size(); ++idx)
+ {
+ mod_keys[idx]->setColor(newkeysC);
+ }
+ for (unsigned idx = 0; idx < other_keys.size(); ++idx)
+ {
+ other_keys[idx]->setColor(newkeysC);
+ }
+ for (unsigned idx = 0; idx < numl_keys.size(); ++idx)
+ {
+ numl_keys[idx]->setColor(newkeysC);
+ }
}
}