@ -37,8 +37,7 @@
# include <tqfontdialog.h>
# include <tdeconfig.h>
# include <tdeapplication.h>
# include <ntqcolordialog.h>
# define R1LEN 13
# define R2LEN 10
@ -77,7 +76,11 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
int sty = 15 ;
extent_visible = false ;
setPaletteBackgroundColor ( TQColor ( " #cdc0b0 " ) ) ;
TDEConfig * cfg = TDEApplication : : kApplication ( ) - > config ( ) ;
// if "kbColor" entry doesn't exist - either because it hasn't been saved
// or kvkbdrc doesn't exist, default to "#cdc0b0"
TQColor bc = cfg - > readEntry ( " kbColor " , " #cdc0b0 " ) ;
setPaletteBackgroundColor ( TQColor ( bc ) ) ;
setFocusPolicy ( TQ_NoFocus ) ;
// resize ( 550,235 );
@ -522,6 +525,12 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
bool fnt_autores = cfg - > readBoolEntry ( " autoresfont " , true ) ;
m - > setItemChecked ( mnu_autores , fnt_autores ) ;
m - > insertSeparator ( ) ;
m - > insertItem ( i18n ( " Keyboard color " ) , this , TQT_SLOT ( Colorb ( ) ) ) ;
m - > insertItem ( i18n ( " Key color (restart if changed) " ) , this , TQT_SLOT ( Colork ( ) ) ) ;
m - > insertSeparator ( ) ;
mnu_dock = m - > insertItem ( i18n ( " Dock widget " ) , this , TQT_SLOT ( showDock ( ) ) ) ;
bool show_dock = cfg - > readBoolEntry ( " showdock " , false ) ;
@ -571,7 +580,30 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
}
void MainWidget : : Colorb ( ) // keyboard colour chosen through the configuration menu
{
TDEConfig * cfg = TDEApplication : : kApplication ( ) - > config ( ) ;
// if "kbColor" entry exists, start with that, otherwise start with the default "#cdc0b0"
TQColor bc = cfg - > readEntry ( " kbColor " , " #cdc0b0 " ) ;
TQColor b = TQColorDialog : : getColor ( TQColor ( bc ) ) ;
// if the selection of the new colour is cancelled, b will be invalid
// otherwise the new value is written to kvkbdrc - this must be in the #rrggbb format
// and as writeEntry produces rrr,ggg,bbb format, .name() is required to convert to #rrggbb
if ( b . isValid ( ) ) {
cfg - > writeEntry ( " kbColor " , b . name ( ) ) ;
cfg - > sync ( ) ;
setPaletteBackgroundColor ( TQColor ( b ) ) ; }
}
void MainWidget : : Colork ( ) // key/button colour chosen through the configuration menu
{
TDEConfig * cfg = TDEApplication : : kApplication ( ) - > config ( ) ;
TQColor kc = cfg - > readEntry ( " keyColor " , " #f0f0f0 " ) ;
TQColor k = TQColorDialog : : getColor ( TQColor ( kc ) ) ;
if ( k . isValid ( ) ) {
cfg - > writeEntry ( " keyColor " , k . name ( ) ) ;
cfg - > sync ( ) ; }
// can't set PaletteBackgroundColor because it's in VButton::VButton - needs restart to read configuration entry
}
void MainWidget : : finishInit ( )
{
TDEConfig * cfg = TDEApplication : : kApplication ( ) - > config ( ) ;
@ -597,7 +629,7 @@ void MainWidget::restorePosition()
int d_width = 553 ;
int d_height = 235 ;
TQRect dflt_geom ( screen_geom . width ( ) - d_width , screen_geom . height ( ) - d_height , d_width , d_height ) ;
TQRect dflt_geom ( screen_geom . width ( ) - d_width - 150 , screen_geom . height ( ) - d_height - 50 , d_width , d_height ) ;
TDEConfig * cfg = 0 ;
cfg = TDEApplication : : kApplication ( ) - > config ( ) ;