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:28:40 +0900
commit64d40d992ecb290a7d395b14e5d3b81e4ed074d2 (patch)
tree620066cb47066d1919c7fdfba8dba5f544c97f0b /src/MainWidget.cpp
parent43425b84f70794eeb975f6811b7dacc3cec01cd2 (diff)
downloadkvkbd-64d40d992ecb290a7d395b14e5d3b81e4ed074d2.tar.gz
kvkbd-64d40d992ecb290a7d395b14e5d3b81e4ed074d2.zip
Keys color can now be changed without the need to restart the
application. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
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);
+ }
}
}