diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /korn/polldrop.cpp | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korn/polldrop.cpp')
-rw-r--r-- | korn/polldrop.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/korn/polldrop.cpp b/korn/polldrop.cpp new file mode 100644 index 000000000..32a44be43 --- /dev/null +++ b/korn/polldrop.cpp @@ -0,0 +1,90 @@ +/* +* polldrop.cpp -- Implementation of class KPollableDrop. +* Author: Sirtaj Singh Kang +* Version: $Id$ +* Generated: Sun Nov 30 22:41:49 EST 1997 +*/ + + +#include<kconfigbase.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( QTimerEvent *ev ) +{ + if( _timerRunning && (ev->timerId() == _timerId) ) { + // this event is ours. + recheck(); // should be reimplemented by children. + } + else { + QObject::timerEvent( ev ); + } +} + +bool KPollableDrop::readConfigGroup( const KConfigBase& cfg ) +{ + KMailDrop::readConfigGroup( cfg ); + + setFreq( cfg.readNumEntry(fu(PollConfigKey), DefaultPoll ) ); + + return true; +} + +bool KPollableDrop::writeConfigGroup( KConfigBase& 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" |