summaryrefslogtreecommitdiffstats
path: root/dnssd/domainbrowser.h
blob: abe93507f0245426de1b416053535e61067d6259 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* This file is part of the KDE project
 *
 * Copyright (C) 2004 Jakub Stachowski <[email protected]>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef DNSSDDOMAINBROWSER_H
#define DNSSDDOMAINBROWSER_H

#include <tqobject.h>
#include <tqdict.h>
#include <dnssd/remoteservice.h>

// KIPC message ID used by kcm module to signal change in browsing domains list

#define KIPCDomainsChanged 2014

class TQStringList;
namespace DNSSD
{
class DomainBrowserPrivate;

/**
@short Class used to provide current list of domains for browsing.
@author Jakub Stachowski
*/
class TDEDNSSD_EXPORT DomainBrowser : public TQObject
{
	TQ_OBJECT
public:
	/**
	Standard constructor. It takes all parameters from global configuration.
	All changes in configuration are applied immediately.
	@param parent Parent object.
	 */
	DomainBrowser(TQObject *parent=0);
	
	/**
	Constructor that creates browser for domain list. This does not use global
	configuration at all.
	@param domains List of domains 
	@param recursive TRUE - additionally local network will be browsed for more domains
	@param parent Parent object.
	This process is recursive.
	 */
	DomainBrowser(const TQStringList& domains, bool recursive=false, TQObject *parent=0);

	~DomainBrowser();
	
	/**
	Current list of domains to browse.
	 */
	const TQStringList& domains() const;
	
	/**
	Starts browsing. To stop destroy this object.
	 */
	void startBrowse() ;
	
	/**
	Returns true when browse has already started
	 */
	bool isRunning() const;

signals:
	/**
	Emitted when domain has been removed from browsing list
	 */
	void domainRemoved(const TQString&);
	/**
	New domain has been discovered. Also emitted for domain specified in constructor
	and in global configuration
	 */
	void domainAdded(const TQString&);

protected:
	virtual void virtual_hook(int,void*);
private:
	friend class DomainBrowserPrivate;
	DomainBrowserPrivate *d;

	void gotNewDomain(const TQString&);
	void gotRemoveDomain(const TQString&);

private slots:
	void domainListChanged(int,int);
};

}

#endif