00001 #include "exampleiface.h" 00002 #include "examplemodule.h" 00003 00004 /* OPIE */ 00005 #include <opie2/odebug.h> 00006 using namespace Opie::Core; 00007 00008 #include <interfaces/interfaceinformationimp.h> 00009 00010 #include <qwidget.h> 00011 00012 VirtualModule::VirtualModule() { 00013 Interface* iface = new VirtualInterface( 0 ); 00014 iface->setHardwareName( "vpn" ); 00015 iface->setInterfaceName( "Test VPN" ); 00016 m_interfaces.append( iface ); 00017 00018 // If we set up VPN via pptp 00019 // and networksettins was closed and now opened 00020 // we need to hide the ppp device behind us 00021 // One can do this by calling setHandledInterfaceNames 00022 // setHandledInterfaceNames(); 00023 } 00024 00025 VirtualModule::~VirtualModule() { 00026 m_interfaces.setAutoDelete( true ); 00027 m_interfaces.clear(); 00028 } 00029 00030 00031 /* 00032 * We're a VPN module 00033 */ 00034 bool VirtualModule::isOwner( Interface* iface ) { 00035 /* check if it is our device */ 00036 return m_interfaces.find( iface ) != -1; 00037 } 00038 00039 QWidget* VirtualModule::configure( Interface* ) { 00040 /* We don't have any Config for now */ 00041 return 0l; 00042 } 00043 00044 QWidget* VirtualModule::information( Interface* iface ) { 00045 return new InterfaceInformationImp(0, "Interface info", iface ); 00046 } 00047 00048 QList<Interface> VirtualModule::getInterfaces() { 00049 return m_interfaces; 00050 } 00051 00052 void VirtualModule::possibleNewInterfaces( QMap<QString, QString>& map) { 00053 map.insert( ::QObject::tr("VPN PPTP"), 00054 ::QObject::tr("Add new Point to Point Tunnel Protocol connection" ) ); 00055 } 00056 00057 00058 Interface* VirtualModule::addNewInterface( const QString& ) { 00059 /* check the str if we support more interfaces */ 00060 /* 00061 Interface* iface = new VirtualInterface( 0 ); 00062 iface->setModuleOwner( this ); 00063 return iface;*/ 00064 00065 // if we would support saving interfaces we could add 00066 // them here 00067 00068 return 0; 00069 } 00070 00071 00072 bool VirtualModule::remove( Interface* ) { 00073 /* we do not support removing our interface */ 00074 return false; 00075 }
1.4.2