summaryrefslogtreecommitdiffstats
path: root/korn/polldrop.h
blob: b45cdb4daff4d4cde78e4bd7023a6f4b84c78ff5 (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
/*
* polldrop.h -- Declaration of class KPollableDrop.
* Generated by newclass on Sun Nov 30 22:41:49 EST 1997.
*/
#ifndef SSK_POLLDROP_H
#define SSK_POLLDROP_H

#include"maildrop.h"

class TQTimerEvent;

/**
* Superclass for all pollable maildrop monitors.
* 
* To implement a polling maildrop, reimplement recheck and emit
* changed(int) in recheck if new messages have been received.
*
* @author Sirtaj Singh Kang (taj@kde.org)
* @version $Id$
*/
class KPollableDrop : public KMailDrop
{
	Q_OBJECT
  
public:
	static const char *PollConfigKey;
	static const int DefaultPoll;

private:
	int _freq;
	int _timerId;
	bool _timerRunning;

public:
	/**
	* KPollableDrop Constructor
	*/
	KPollableDrop();

	virtual bool startMonitor();
	virtual bool stopMonitor();
	virtual bool startProcess() { return true; } //Start en stop-functions for progress; it is not pollable, but a member of kio
	virtual bool stopProcess() { return true; }
	
	virtual bool running() { return _timerRunning; };

	int freq() const { return _freq; }
	void setFreq( int freq );

	virtual bool readConfigGroup ( const TDEConfigBase& cfg );
	virtual bool writeConfigGroup ( TDEConfigBase& cfg ) const;

	//virtual void addConfigPage( KDropCfgDialog * );

protected:
	void timerEvent( TQTimerEvent * );
};

inline void KPollableDrop::setFreq( int freq ) 
{  
	bool r = running();

	if( r ) stopMonitor();

	_freq = freq; 
 
	if( r ) startMonitor(); 
}

#endif // SSK_POLLDROP_H