blob: 8d05a03bebf5ab9721403b790a106dfa8ae5b6c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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( 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 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"
|