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 @@ -6,17 +6,17 @@ <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> @@ -33,17 +33,17 @@ <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> @@ -478,17 +478,17 @@ <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> @@ -1053,17 +1053,142 @@ <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> 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 @@ -4,17 +4,17 @@ 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(){ } 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 @@ -12,19 +12,16 @@ class NetworkNetNode : public ANetNode{ 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 ); 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,10 +1,11 @@ #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 ){ @@ -105,17 +106,23 @@ 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; @@ -153,8 +160,65 @@ void NetworkEdit::SLOT_NetmaskModified( const QString & ) { 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 ); }; |