@ -35,6 +35,7 @@
# include <tqmessagebox.h>
# include <tqmessagebox.h>
# include <tqfile.h>
# include <tqfile.h>
# include <tqdir.h>
# include <tqdir.h>
# include <tqtimer.h>
# define CONFIG_FILE "kmilodrc"
# define CONFIG_FILE "kmilodrc"
@ -275,35 +276,24 @@ void GenericMonitor::brightnessSlowDown()
void GenericMonitor : : brightnessChange ( int direction , int step )
void GenericMonitor : : brightnessChange ( int direction , int step )
{
{
if ( ! tdepowersave )
if ( ! tdepowersave | | direction = = 0 )
{
{
return ;
return ;
}
}
DCOPReply reply = tdepowersave - > call ( " brightnessGet " ) ;
if ( reply . isValid ( ) )
{
int brightnessLevel = ( int ) reply ;
if ( brightnessLevel > = 0 )
{
brightnessLevel + = direction * step ; // add requested brightness step
if ( brightnessLevel > 100 )
{
brightnessLevel = 100 ;
}
if ( brightnessLevel < 0 )
{
brightnessLevel = 0 ;
}
if ( direction > 0 )
if ( direction > 0 )
{
{
tdepowersave - > send ( " do_brightnessUp " , step ) ;
tdepowersave - > call ( " do_brightnessUp " , step ) ;
}
}
else if ( direction < 0 )
else
{
{
tdepowersave - > send ( " do_brightnessDown " , step ) ;
tdepowersave - > call ( " do_brightnessDown " , step ) ;
}
TQTimer : : singleShot ( 250 , this , TQT_SLOT ( brightnessValueUpdate ( ) ) ) ;
}
}
void GenericMonitor : : brightnessValueUpdate ( )
{
DCOPReply reply = tdepowersave - > call ( " brightnessGet " ) ;
DCOPReply reply = tdepowersave - > call ( " brightnessGet " ) ;
if ( reply . isValid ( ) )
if ( reply . isValid ( ) )
{
{
@ -311,12 +301,6 @@ void GenericMonitor::brightnessChange(int direction, int step)
// on machines with few brightness steps.
// on machines with few brightness steps.
_interface - > displayProgress ( i18n ( " Brightness " ) , ( int ) reply ) ;
_interface - > displayProgress ( i18n ( " Brightness " ) , ( int ) reply ) ;
}
}
else
{
_interface - > displayProgress ( i18n ( " Brightness " ) , brightnessLevel ) ;
}
}
}
}
}
int GenericMonitor : : progress ( ) const
int GenericMonitor : : progress ( ) const