~ubuntu-branches/ubuntu/natty/kdenetwork/natty-proposed

« back to all changes in this revision

Viewing changes to .pc/kubuntu_05_samba_sharing.diff/filesharing/advanced/kcm_sambaconf/socketoptionsdlg.ui.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-02-21 14:26:58 UTC
  • Revision ID: package-import@ubuntu.com-20110221142658-mzt9flk82tzdunxj
Tags: 4:4.6.0-0ubuntu4
Update kubuntu_05_samba_sharing.diff to match master

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
*****************************************************************************/
 
8
 
 
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
 ******************************************************************************/
 
28
 
 
29
#ifndef KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H
 
30
#define KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H
 
31
 
 
32
void SocketOptionsDlg::setShare( SambaShare * share )
 
33
{
 
34
    assert(share);
 
35
    
 
36
    _share = share;
 
37
    
 
38
    QString s = _share->getValue("socket options");
 
39
    
 
40
    s = s.simplified();
 
41
    
 
42
    // The string s has now the form e.g. :
 
43
    // "OPTION1=1 OPTION2=0 OPTION3=2234 OPTION4"
 
44
    
 
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") );
 
55
 
 
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") );
 
60
   
 
61
}
 
62
 
 
63
 
 
64
 
 
65
bool SocketOptionsDlg::getBoolValue( const QString & str, const QString & name )
 
66
{
 
67
    QString s = str;
 
68
    int i = s.find(name ,0,false);
 
69
                
 
70
    if (i > -1)
 
71
    {
 
72
        s = s.remove(0,i+1+QString(name).length());
 
73
        if ( s.startsWith("=") )
 
74
        {
 
75
            s = s.remove(0,1);
 
76
            if ( s.startsWith("0"))
 
77
                return false;
 
78
            else
 
79
                return true;
 
80
        }
 
81
        else
 
82
            return true;
 
83
    }
 
84
    
 
85
    return false;
 
86
}
 
87
 
 
88
int SocketOptionsDlg::getIntValue( const QString & str, const QString & name )
 
89
{
 
90
    QString s = str;
 
91
    int i = s.find(name ,0,false);
 
92
                
 
93
    if (i > -1)
 
94
    {
 
95
        s = s.remove(0,i+1+QString(name).length());
 
96
        if ( s.startsWith("=") )
 
97
        {
 
98
            s = s.remove(0,1);
 
99
            
 
100
            i = s.find(" ");
 
101
            if (i < 0)
 
102
                i = s.length();
 
103
            else
 
104
                i++;
 
105
            
 
106
            s = s.left( i );
 
107
            
 
108
            return s.toInt();
 
109
        }
 
110
        else
 
111
            return 0;
 
112
    }
 
113
    
 
114
    return 0;
 
115
}
 
116
 
 
117
#endif // KCM_SAMBACONF_SOCKETOPTIONSDLG_UI_H