summaryrefslogtreecommitdiffstats
path: root/smb4k/core/smb4ksambaoptionsinfo.cpp
blob: 5ea5b51a5e2bd04727396163c5ec002eb9021559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/***************************************************************************
    smb4ksambaoptionsinfo  -  This is a container class that carries
    various information of extra options for a specific host.
                             -------------------
    begin                : Mi Okt 18 2006
    copyright            : (C) 2006 by Alexander Reinholdt
    email                : dustpuppy@mail.berlios.de
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful, but   *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,   *
 *   MA  02110-1301 USA                                                    *
 ***************************************************************************/


// application specific includes
#include "smb4ksambaoptionsinfo.h"
#include "smb4kshare.h"


Smb4KSambaOptionsInfo::Smb4KSambaOptionsInfo( const QString &name )
: m_name( name ), m_remount( false ), m_port( -1 ),
#ifndef __FreeBSD__
m_filesystem( QString::null ), m_write_access( true ),
#endif
m_protocol( QString::null ), m_kerberos( false ),
m_uid( QString::null ), m_gid( QString::null )
{
}


Smb4KSambaOptionsInfo::Smb4KSambaOptionsInfo( Smb4KShare *share )
: m_name( share->name() ), m_remount( false ), m_port( -1 ),
#ifndef __FreeBSD__
m_filesystem( share->filesystem() ), m_write_access( true ),
#endif
m_protocol( QString::null ), m_kerberos( false ),
m_uid( QString( "%1" ).arg( share->uid() ) ), m_gid( QString( "%1" ).arg( share->gid() ) )
{
}



Smb4KSambaOptionsInfo::Smb4KSambaOptionsInfo( const Smb4KSambaOptionsInfo &info )
: m_name( info.itemName() ), m_remount( info.remount() ), m_port( info.port() ),
#ifndef __FreeBSD__
m_filesystem( info.filesystem() ), m_write_access( info.writeAccess() ),
#endif
m_protocol( info.protocol() ), m_kerberos( info.kerberos() ),
m_uid( info.uid() ), m_gid( info.gid() )
{
}


Smb4KSambaOptionsInfo::~Smb4KSambaOptionsInfo()
{
}


void Smb4KSambaOptionsInfo::setRemount( bool rm )
{
  m_remount = rm;
}


void Smb4KSambaOptionsInfo::setItemName( const QString &name )
{
  m_name = name;
}


void Smb4KSambaOptionsInfo::setPort( int port )
{
  m_port = port;
}

void Smb4KSambaOptionsInfo::setProtocol( const QString &p )
{
  if ( QString::compare( p, "auto" ) != 0 )
  {
    m_protocol = p;
  }
  else
  {
    m_protocol = QString::null;
  }
}


void Smb4KSambaOptionsInfo::setKerberos( bool krb )
{
  m_kerberos = krb;
}


int Smb4KSambaOptionsInfo::type()
{
  return m_name.contains( "/" ) == 3 ? Share : Host;
}


void Smb4KSambaOptionsInfo::setUID( const QString &uid )
{
  m_uid = uid;
}


void Smb4KSambaOptionsInfo::setGID( const QString &gid )
{
  m_gid = gid;
}

#ifndef __FreeBSD__
void Smb4KSambaOptionsInfo::setFilesystem( const QString &fs )
{
  m_filesystem = fs;
}


void Smb4KSambaOptionsInfo::setWriteAccess( bool rw )
{
  m_write_access = rw;
}
#endif