kopete/libkopete
connectionmanager.h
Go to the documentation of this file.00001 /* 00002 connectionmanager.h - Provides the client side interface to the kde networkstatus daemon 00003 00004 Copyright (c) 2004 by Will Stephenson <wstephenson@kde.org> 00005 00006 Kopete (c) 2004-2007 by the Kopete developers <kopete-devel@kde.org> 00007 00008 ************************************************************************* 00009 * * 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2 of the License, or (at your option) any later version. * 00014 * * 00015 ************************************************************************* 00016 */ 00017 00018 #ifndef KDE_CONNECTION_MANAGER_H 00019 #define KDE_CONNECTION_MANAGER_H 00020 00021 #include <dcopobject.h> 00022 00023 #include "kopete_export.h" 00024 #include "networkstatuscommon.h" 00025 00026 class ConnectionManagerPrivate; 00027 00028 class KOPETE_EXPORT ConnectionManager : public QObject, virtual public DCOPObject 00029 { 00030 Q_OBJECT 00031 K_DCOP 00032 public: 00033 static ConnectionManager* self(); 00034 enum State { Inactive, Online, Offline, Pending }; 00035 virtual ~ConnectionManager(); 00036 NetworkStatus::EnumStatus status( const QString & host ); 00037 // check if a hostname is available. Ask user if offline. Request host 00038 NetworkStatus::EnumRequestResult requestConnection( QWidget* mainWidget, const QString & host, bool userInitiated ); 00039 // method to relinquish a connection 00040 void relinquishConnection( const QString & host ); 00041 signals: 00042 // signal that the network for a hostname is up/down 00043 void statusChanged( const QString & host, NetworkStatus::EnumStatus status ); 00044 protected: 00045 // sets up internal state 00046 void initialise(); 00047 // reread the desktop status from the daemon and update internal state 00048 void updateStatus(); 00049 // ask if the user would like to reconnect 00050 bool askToConnect( QWidget * mainWidget ); 00051 k_dcop: 00052 void slotStatusChanged( QString host, int status ); 00053 private: 00054 ConnectionManager( QObject *parent, const char * name ); 00055 ConnectionManagerPrivate *d; 00056 }; 00057 00058 #endif 00059
KDE 4.2 API Reference