You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdepim/korn/polldrop.cpp

91 lines
1.5 KiB

/*
* polldrop.cpp -- Implementation of class KPollableDrop.
* Author: Sirtaj Singh Kang
* Version: $Id$
* Generated: Sun Nov 30 22:41:49 EST 1997
*/
#include<tdeconfigbase.h>
#include"utils.h"
#include"polldrop.h"
KPollableDrop::KPollableDrop()
: KMailDrop()
{
_timerId = 0;
_timerRunning = false;
_freq = 300;
}
bool KPollableDrop::startMonitor()
{
if( !running() ) {
recheck();
_timerId = startTimer( _freq * 1000 );
_timerRunning = true;
return startProcess();
}
return false;
}
bool KPollableDrop::stopMonitor()
{
if( running() ) {
killTimer( _timerId );
_timerId = 0;
_timerRunning = false;
return stopProcess();
}
return false;
}
void KPollableDrop::timerEvent( TQTimerEvent *ev )
{
if( _timerRunning && (ev->timerId() == _timerId) ) {
// this event is ours.
recheck(); // should be reimplemented by children.
}
else {
TQObject::timerEvent( ev );
}
}
bool KPollableDrop::readConfigGroup( const TDEConfigBase& cfg )
{
KMailDrop::readConfigGroup( cfg );
setFreq( cfg.readNumEntry(fu(PollConfigKey), DefaultPoll ) );
return true;
}
bool KPollableDrop::writeConfigGroup( TDEConfigBase& cfg ) const
{
KMailDrop::writeConfigGroup( cfg );
cfg.writeEntry(fu(PollConfigKey), freq() );
return true;
}
//void KPollableDrop::addConfigPage( KDropCfgDialog *dlg )
//{
// dlg->addConfigPage( new KPollCfg( this ) );
//
// KMailDrop::addConfigPage( dlg );
//}
const char *KPollableDrop::PollConfigKey = "interval";
const int KPollableDrop::DefaultPoll = 300; // 5 minutes
#include "polldrop.moc"