author | wimpie <wimpie> | 2004-04-07 00:09:37 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-07 00:09:37 (UTC) |
commit | b93d9e0c4384be0a6f40be257ba791004388400b (patch) (side-by-side diff) | |
tree | 2ca0e41dc8c99e1af3ce2f0305d458f76d10db45 /noncore/settings/networksettings2/network | |
parent | 1b7aaf904fa70c16eee03155bd826e921798cc22 (diff) | |
download | opie-b93d9e0c4384be0a6f40be257ba791004388400b.zip opie-b93d9e0c4384be0a6f40be257ba791004388400b.tar.gz opie-b93d9e0c4384be0a6f40be257ba791004388400b.tar.bz2 |
MANY changes ... lancards should be OK now
Diffstat (limited to 'noncore/settings/networksettings2/network') (more/less context) (ignore whitespace changes)
5 files changed, 202 insertions, 8 deletions
diff --git a/noncore/settings/networksettings2/network/networkGUI.ui b/noncore/settings/networksettings2/network/networkGUI.ui index 9115ec0..5f71f82 100644 --- a/noncore/settings/networksettings2/network/networkGUI.ui +++ b/noncore/settings/networksettings2/network/networkGUI.ui @@ -1,57 +1,57 @@ <!DOCTYPE UI><UI> <class>NetworkGUI</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>NetworkGUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>293</width> + <width>289</width> <height>254</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Interface Configuration</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> - <cstring>TabWidget11</cstring> + <cstring>MainTab_TAB</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Setup</string> @@ -470,33 +470,33 @@ </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>Command_LE</cstring> </property> </widget> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> - <cstring>Tab_TB</cstring> + <cstring>Tab_TAB</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Pre-Up</string> @@ -1045,27 +1045,152 @@ <signal>toggled(bool)</signal> <receiver>Frame27</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>DHCP_CB</sender> <signal>toggled(bool)</signal> <receiver>TextLabel2_2</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>SendHostname_CB</sender> <signal>toggled(bool)</signal> <receiver>Hostname_LE</receiver> <slot>setEnabled(bool)</slot> </connection> + <connection> + <sender>AddPreUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Add()</slot> + </connection> + <connection> + <sender>DeletePreUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Remove()</slot> + </connection> + <connection> + <sender>UpPreUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Up()</slot> + </connection> + <connection> + <sender>DownPreUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Down()</slot> + </connection> + <connection> + <sender>AddPostUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Add()</slot> + </connection> + <connection> + <sender>DeletePostUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Remove()</slot> + </connection> + <connection> + <sender>UpPostUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Up()</slot> + </connection> + <connection> + <sender>DownPostUp_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Down()</slot> + </connection> + <connection> + <sender>AddPreDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Add()</slot> + </connection> + <connection> + <sender>DeletePreDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Remove()</slot> + </connection> + <connection> + <sender>UpPreDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Up()</slot> + </connection> + <connection> + <sender>DownPreDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Down()</slot> + </connection> + <connection> + <sender>AddPostDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Add()</slot> + </connection> + <connection> + <sender>DeletePostDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Remove()</slot> + </connection> + <connection> + <sender>UpPostDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Up()</slot> + </connection> + <connection> + <sender>DownPostDown_TB</sender> + <signal>clicked()</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_Down()</slot> + </connection> + <connection> + <sender>PreUp_LB</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_ShowCommand( QListBoxItem *)</slot> + </connection> + <connection> + <sender>PreDown_LB</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_ShowCommand( QListBoxItem *)</slot> + </connection> + <connection> + <sender>PostDown_LB</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_ShowCommand( QListBoxItem *)</slot> + </connection> + <connection> + <sender>PostUp_LB</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>NetworkGUI</receiver> + <slot>SLOT_ShowCommand( QListBoxItem *)</slot> + </connection> + <slot access="public">SLOT_Add()</slot> + <slot access="public">SLOT_Down()</slot> <slot access="public">SLOT_NetmaskModified( const QString & )</slot> + <slot access="public">SLOT_Remove()</slot> + <slot access="public">SLOT_Up()</slot> + <slot access="public">SLOT_ShowCommand( QListBoxItem *)</slot> </connections> <tabstops> <tabstop>DHCP_CB</tabstop> <tabstop>IPAddress_LE</tabstop> <tabstop>SubnetMask_LE</tabstop> <tabstop>Gateway_LE</tabstop> <tabstop>DNS1_LE</tabstop> <tabstop>DNS2_LE</tabstop> </tabstops> </UI> diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index d27d54a..b5989df 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp @@ -1,28 +1,28 @@ #include "network_NN.h" #include "network_NNI.h" static const char * NetworkNeeds[] = { "device", 0 }; /** * Constructor, find all of the possible interfaces */ -NetworkNetNode::NetworkNetNode() : ANetNode() { +NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { } /** * Delete any interfaces that we own. */ NetworkNetNode::~NetworkNetNode(){ } const QString NetworkNetNode::nodeDescription(){ return tr("\ <p>Sets up TCP/IP options.</p>\ <p>Use this to configure the TCP/IP protocol</p>\ " ); } diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 0f87e1b..6548c32 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h @@ -4,35 +4,32 @@ #include "netnode.h" class ANetwork; class NetworkNetNode : public ANetNode{ Q_OBJECT public: NetworkNetNode(); virtual ~NetworkNetNode(); virtual const QString pixmapName() { return "Devices/tcpip"; } - virtual const QString nodeName() - { return tr("IP Configuration"); } - virtual const QString nodeDescription() ; virtual ANetNodeInstance * createInstance( void ); virtual const char ** needs( void ); virtual const char * provides( void ); virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); virtual bool hasDataFor( const QString & ) { return 0; } virtual bool generateDeviceDataForCommonFile( SystemFile & SF, long DevNr ); private: virtual void setSpecificAttribute( QString & Attr, QString & Value ); diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp index 182213b..05110d9 100644 --- a/noncore/settings/networksettings2/network/networkedit.cpp +++ b/noncore/settings/networksettings2/network/networkedit.cpp @@ -1,18 +1,19 @@ #include <qtoolbutton.h> #include <qcheckbox.h> +#include <qtabwidget.h> #include <qlineedit.h> #include <qlistbox.h> #include <GUIUtils.h> #include <resources.h> #include "networkedit.h" NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); @@ -97,33 +98,39 @@ void NetworkEdit::showData( NetworkData_t & Data ) { populateList( Data.PreUp_SL, PreUp_LB ); populateList( Data.PostUp_SL, PostUp_LB ); populateList( Data.PreDown_SL, PreDown_LB ); populateList( Data.PostDown_SL, PostDown_LB ); } bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { bool Changed; QStringList NewSL; // collect new list for( unsigned int i = 0; i < LB->count() ; i ++ ) { NewSL.append( LB->text(i) ); } - // check if at least ONE item in new list is NEW + if( NewSL.count() != SL.count() ) { + // less or more items + SL= NewSL; + return 1; + } + + // Same size -> same content ? Changed = 0; for ( QStringList::Iterator it = NewSL.begin(); it != NewSL.end(); ++it ) { if( SL.findIndex( (*it) ) < 0 ) { // new or modified item Changed = 1; SL = NewSL; break; } } return Changed; } void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) { LB->clear(); @@ -145,16 +152,73 @@ void NetworkEdit::SLOT_NetmaskModified( const QString & ) { return; // if all ones // broadcast = (IPAddress | ~netmask ) { QString NW; QStringList ipal = QStringList::split( '.', IP ); QStringList nmal = QStringList::split( '.', SN ); NW = QString( "%1.%2.%3.%4" ). arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); Broadcast_LE->setText( NW ); } } + +QListBox * NetworkEdit::getActiveLB( void ) { + switch( Tab_TAB->currentPageIndex() ) { + case 0 : + return PreUp_LB; + case 1 : + return PostUp_LB; + case 2 : + return PreDown_LB; + } + return PostDown_LB; +} + +void NetworkEdit::SLOT_Add( void ) { + if( Command_LE->text().isEmpty() ) + return; + QListBox * LB = getActiveLB(); + + LB->insertItem( Command_LE->text() ); +} + +void NetworkEdit::SLOT_Remove( void ) { + QListBox * LB = getActiveLB(); + int i; + + if( ( i = LB->currentItem() ) >= 0 ) { + LB->removeItem( i ); + } +} + +void NetworkEdit::SLOT_Up( void ) { + QListBox * LB = getActiveLB(); + int i; + + if( ( i = LB->currentItem() ) > 0 ) { + QListBoxItem * LBI = LB->item(i); + LB->takeItem( LBI ); + LB->insertItem( LBI, --i ); + LB->setCurrentItem( i ); + } +} + +void NetworkEdit::SLOT_Down( void ) { + QListBox * LB = getActiveLB(); + int i; + + if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) { + QListBoxItem * LBI = LB->item(i); + LB->takeItem( LBI ); + LB->insertItem( LBI, ++i ); + LB->setCurrentItem( i ); + } +} + +void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) { + Command_LE->setText( It->text() ); +} diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h index 9ed4e84..adc20e0 100644 --- a/noncore/settings/networksettings2/network/networkedit.h +++ b/noncore/settings/networksettings2/network/networkedit.h @@ -1,21 +1,29 @@ #include "networkdata.h" #include "networkGUI.h" +class QListBox; + class NetworkEdit : public NetworkGUI { public : NetworkEdit( QWidget * parent ); QString acceptable( void ); bool commit( NetworkData_t & Data ); void showData( NetworkData_t & Data ); public slots : void SLOT_NetmaskModified( const QString & S ); + void SLOT_ShowCommand( QListBoxItem * LBI ); + void SLOT_Add( void ); + void SLOT_Remove( void ); + void SLOT_Up( void ); + void SLOT_Down( void ); private : + QListBox * getActiveLB( void ); bool updateList( QStringList &SL, QListBox * LB ); void populateList( QStringList &SL, QListBox * LB ); }; |