Esempio n. 1
0
void EventWidget::updateConfig()
{
  	KConfig *config;
  
	config = kapp->getConfig();

	config->setGroup("Fonts");
	setFont(config->readFontEntry("Schedule Font"));

	config->setGroup( "Colors" );

	selectedHandle = config->readColorEntry( "AptSelected" );
	inactiveHandle = config->readColorEntry( "AptUnselected" );
	activeHandle = config->readColorEntry( "AptActive" ); 

	QColorGroup normalGroup(
		black, //kapp->windowColor, // foreground, used for the edge
		//kapp->windowColor,
		config->readColorEntry( "AptBackground" ), 
			// background, used for non text area in textbox
		green, //config->readColorEntry( "AptUnselected" ),// light
		red, // dark
		red, // mid
		config->readColorEntry( "AptText" ), // text
		//kapp->windowColor
		config->readColorEntry( "AptBackground" )
			// base used for background behind text
	);

	// for displaying currently happening event ...
	QColorGroup activeGroup(
		selectedHandle, // for the edge
		config->readColorEntry( "AptBackground" ), 
		green, // light
		red, // dark
		red, // mid
		config->readColorEntry( "AptText" ), // text
		config->readColorEntry( "AptBackground" )
	);

	QColorGroup disabledGroup(
		black, //kapp->windowColor, // foreground, used for the edge
		//kapp->windowColor,
		config->readColorEntry( "AptBackground" ).dark(120), 
			// background, used for non text area in textbox
		green, //config->readColorEntry( "AptUnselected" ),// light
		red, // dark
		red, // mid
		config->readColorEntry( "AptText" ), // text
		//kapp->windowColor
		config->readColorEntry( "AptBackground" ).dark(120)
			// base used for background behind text
	);

	QPalette myPalette;
	myPalette.setNormal( normalGroup );
	myPalette.setActive( activeGroup );
	myPalette.setDisabled(disabledGroup);

	setPalette(myPalette);

	// we don't want the hilite border for other widgets except
	// the main widget, so set the active color group to normalGroup.
	myPalette.setActive(normalGroup);
	textBox->setPalette( myPalette );
	iconBox->setPalette( myPalette );

	setSelected( widgetSelected ); // to set handle color
}