summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/connectionmanager.h
blob: 44ff1b2e950f76556d337b745ae33bc7d38ea7ad (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
/*
    connectionmanager.h - Provides the client side interface to the kde networkstatus daemon

    Copyright (c) 2004      by Will Stephenson <[email protected]>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef KDE_CONNECTION_MANAGER_H
#define KDE_CONNECTION_MANAGER_H

#include <dcopobject.h>

#include "kopete_export.h"
#include "networkstatuscommon.h"

class ConnectionManagerPrivate;

class KOPETE_EXPORT ConnectionManager : public TQObject, virtual public DCOPObject
{
	Q_OBJECT
//	
	K_DCOP
	public:
		static ConnectionManager* self();
		enum State { Inactive, Online, Offline, Pending };
		virtual ~ConnectionManager();
		NetworkStatus::EnumStatus status( const TQString & host );
			// check if a hostname is available.  Ask user if offline.  Request host
		NetworkStatus::EnumRequestResult requestConnection( TQWidget* mainWidget, const TQString & host, bool userInitiated );
			// method to relinquish a connection
		void relinquishConnection( const TQString & host );
	signals:
		// signal that the network for a hostname is up/down
		void statusChanged( const TQString & host, NetworkStatus::EnumStatus status );
	protected:
		// sets up internal state
		void initialise();
		// reread the desktop status from the daemon and update internal state
		void updateStatus();
			// ask if the user would like to reconnect
		bool askToConnect( TQWidget * mainWidget );
	k_dcop:
			void slotStatusChanged( TQString host, int status );
	private:
		ConnectionManager( TQObject *parent, const char * name );
		ConnectionManagerPrivate *d;
		static ConnectionManager * s_self;
};

#endif