A few deprecations eradicated involving QCheckBox.
[kdenetwork.git] / filesharing / advanced / kcm_sambaconf / socketoptionsdlg.ui.h
blobc96ea24b564616ae3a6b70f74ebbdf115ef33e0b
1 /****************************************************************************
2 ** ui.h extension file, included from the uic-generated form implementation.
3 **
4 ** If you wish to add, delete or rename slots use Qt Designer which will
5 ** update this file, preserving your code. Create an init() slot in place of
6 ** a constructor, and a destroy() slot in place of a destructor.
7 *****************************************************************************/
9 /******************************************************************************
10 * *
11 * This file is part of KSambaPlugin. *
12 * *
13 * KSambaPlugin is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 * KSambaPlugin is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21 * GNU General Public License for more details. *
22 * *
23 * You should have received a copy of the GNU General Public License *
24 * along with KSambaPlugin; if not, write to the Free Software *
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
26 * *
27 ******************************************************************************/
29 #ifndef KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H
30 #define KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H
32 void SocketOptionsDlg::setShare( SambaShare * share )
34 assert(share);
36 _share = share;
38 QString s = _share->getValue("socket options");
40 s = s.simplified();
42 // The string s has now the form e.g. :
43 // "OPTION1=1 OPTION2=0 OPTION3=2234 OPTION4"
45 SO_KEEPALIVEChk->setChecked(getBoolValue( s, "SO_KEEPALIVE") );
46 SO_REUSEADDRChk->setChecked( getBoolValue( s, "SO_REUSEADDR") );
47 SO_BROADCASTChk->setChecked( getBoolValue( s, "SO_BROADCAST") );
48 TCP_NODELAYChk->setChecked( getBoolValue( s, "TCP_NODELAY") );
49 IPTOS_LOWDELAYChk->setChecked( getBoolValue( s, "IPTOS_LOWDELAY") );
50 IPTOS_THROUGHPUTChk->setChecked( getBoolValue( s, "IPTOS_THROUGHPUT") );
51 SO_SNDBUFChk->setChecked( getBoolValue( s, "SO_SNDBUF") );
52 SO_RCVBUFChk->setChecked( getBoolValue( s, "SO_RCVBUF") );
53 SO_SNDLOWATChk->setChecked( getBoolValue( s, "SO_SNDLOWAT") );
54 SO_RCVLOWATChk->setChecked( getBoolValue( s, "SO_RCVLOWAT") );
56 SO_SNDBUFSpin->setValue( getIntValue( s, "SO_SNDBUF") );
57 SO_RCVBUFSpin->setValue( getIntValue( s, "SO_RCVBUF") );
58 SO_SNDLOWATSpin->setValue( getIntValue( s, "SO_SNDLOWAT") );
59 SO_RCVLOWATSpin->setValue( getIntValue( s, "SO_RCVLOWAT") );
65 bool SocketOptionsDlg::getBoolValue( const QString & str, const QString & name )
67 QString s = str;
68 int i = s.find(name ,0,false);
70 if (i > -1)
72 s = s.remove(0,i+1+QString(name).length());
73 if ( s.startsWith("=") )
75 s = s.remove(0,1);
76 if ( s.startsWith("0"))
77 return false;
78 else
79 return true;
81 else
82 return true;
85 return false;
88 int SocketOptionsDlg::getIntValue( const QString & str, const QString & name )
90 QString s = str;
91 int i = s.find(name ,0,false);
93 if (i > -1)
95 s = s.remove(0,i+1+QString(name).length());
96 if ( s.startsWith("=") )
98 s = s.remove(0,1);
100 i = s.find(" ");
101 if (i < 0)
102 i = s.length();
103 else
104 i++;
106 s = s.left( i );
108 return s.toInt();
110 else
111 return 0;
114 return 0;
117 #endif // KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H