summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/networkedit.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/network/networkedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/networkedit.cpp66
1 files changed, 65 insertions, 1 deletions
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,6 +1,7 @@
1#include <qtoolbutton.h> 1#include <qtoolbutton.h>
2#include <qcheckbox.h> 2#include <qcheckbox.h>
3#include <qtabwidget.h>
3#include <qlineedit.h> 4#include <qlineedit.h>
4#include <qlistbox.h> 5#include <qlistbox.h>
5#include <GUIUtils.h> 6#include <GUIUtils.h>
6#include <resources.h> 7#include <resources.h>
@@ -109,9 +110,15 @@ bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) {
109 for( unsigned int i = 0; i < LB->count() ; i ++ ) { 110 for( unsigned int i = 0; i < LB->count() ; i ++ ) {
110 NewSL.append( LB->text(i) ); 111 NewSL.append( LB->text(i) );
111 } 112 }
112 113
113 // check if at least ONE item in new list is NEW 114 if( NewSL.count() != SL.count() ) {
115 // less or more items
116 SL= NewSL;
117 return 1;
118 }
119
120 // Same size -> same content ?
114 Changed = 0; 121 Changed = 0;
115 for ( QStringList::Iterator it = NewSL.begin(); 122 for ( QStringList::Iterator it = NewSL.begin();
116 it != NewSL.end(); 123 it != NewSL.end();
117 ++it ) { 124 ++it ) {
@@ -157,4 +164,61 @@ void NetworkEdit::SLOT_NetmaskModified( const QString & ) {
157 arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); 164 arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) );
158 Broadcast_LE->setText( NW ); 165 Broadcast_LE->setText( NW );
159 } 166 }
160} 167}
168
169QListBox * NetworkEdit::getActiveLB( void ) {
170 switch( Tab_TAB->currentPageIndex() ) {
171 case 0 :
172 return PreUp_LB;
173 case 1 :
174 return PostUp_LB;
175 case 2 :
176 return PreDown_LB;
177 }
178 return PostDown_LB;
179}
180
181void NetworkEdit::SLOT_Add( void ) {
182 if( Command_LE->text().isEmpty() )
183 return;
184 QListBox * LB = getActiveLB();
185
186 LB->insertItem( Command_LE->text() );
187}
188
189void NetworkEdit::SLOT_Remove( void ) {
190 QListBox * LB = getActiveLB();
191 int i;
192
193 if( ( i = LB->currentItem() ) >= 0 ) {
194 LB->removeItem( i );
195 }
196}
197
198void NetworkEdit::SLOT_Up( void ) {
199 QListBox * LB = getActiveLB();
200 int i;
201
202 if( ( i = LB->currentItem() ) > 0 ) {
203 QListBoxItem * LBI = LB->item(i);
204 LB->takeItem( LBI );
205 LB->insertItem( LBI, --i );
206 LB->setCurrentItem( i );
207 }
208}
209
210void NetworkEdit::SLOT_Down( void ) {
211 QListBox * LB = getActiveLB();
212 int i;
213
214 if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) {
215 QListBoxItem * LBI = LB->item(i);
216 LB->takeItem( LBI );
217 LB->insertItem( LBI, ++i );
218 LB->setCurrentItem( i );
219 }
220}
221
222void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) {
223 Command_LE->setText( It->text() );
224}