1 /////////////////////////////////////////////////////////////////////////////
3 // Project: SMB kioslave for KDE2
5 // File: kio_smb_internal.h
7 // Abstract: Utility classes used by SMBSlave
9 // Author(s): Matthew Peterson <mpeterson@caldera.com>
10 // Frank Schwanz <schwanz@fh-brandenburg.de>
11 //---------------------------------------------------------------------------
13 // Copyright (c) 2000 Caldera Systems, Inc.
15 // This program is free software; you can redistribute it and/or modify it
16 // under the terms of the GNU General Public License as published by the
17 // Free Software Foundation; either version 2.1 of the License, or
18 // (at your option) any later version.
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU Lesser General Public License for more details.
25 // You should have received a copy of the GNU General Public License
26 // along with this program; see the file COPYING. If not, please obtain
27 // a copy from http://www.gnu.org/copyleft/gpl.html
29 /////////////////////////////////////////////////////////////////////////////
31 #ifndef KIO_SMB_INTERNAL_H_INCLUDED
32 #define KIO_SMB_INTERNAL_H_INCLUDED
34 #include <kio/authinfo.h>
40 * SMBURLTYPE_UNKNOWN - Type could not be determined. Bad SMB Url.
41 * SMBURLTYPE_ENTIRE_NETWORK - "smb:/" is entire network
42 * SMBURLTYPE_WORKGROUP_OR_SERVER - "smb:/mygroup" or "smb:/myserver"
43 * URLTYPE_SHARE_OR_PATH - "smb:/mygroupe/mymachine/myshare/mydir"
46 SMBURLTYPE_UNKNOWN
= 0, SMBURLTYPE_ENTIRE_NETWORK
= 1,
47 SMBURLTYPE_WORKGROUP_OR_SERVER
= 2, SMBURLTYPE_SHARE_OR_PATH
= 3
51 //===========================================================================
53 * Class to handle URL's
54 * it can convert KUrl to smbUrl
56 * it also check the correctness of the URL
58 class SMBUrl
: public KUrl
64 SMBUrl(const KUrl
& kurl
);
67 * Appends the specified file and dir to this SMBUrl
68 * "smb://server/share" --> "smb://server/share/filedir"
70 void addPath(const QString
&filedir
);
72 bool cd(const QString
&dir
);
75 * Returns the type of this SMBUrl:
76 * SMBURLTYPE_UNKNOWN - Type could not be determined. Bad SMB Url.
77 * SMBURLTYPE_ENTIRE_NETWORK - "smb:/" is entire network
78 * SMBURLTYPE_WORKGROUP_OR_SERVER - "smb:/mygroup" or "smb:/myserver"
79 * URLTYPE_SHARE_OR_PATH - "smb:/mygroupe/mymachine/myshare/mydir"
81 SMBUrlType
getType() const;
83 void setPass( const QString
& _txt
) { KUrl::setPass(_txt
); updateCache(); }
84 void setUser( const QString
& _txt
) { KUrl::setUser(_txt
); updateCache(); }
85 void setHost( const QString
& _txt
) { KUrl::setHost(_txt
); updateCache(); }
88 * Returns the workgroup if it given in url
90 // QString getWorkgroup() const;
93 * Returns path after workgroup
95 // QString getServerShareDir() const;
98 * Return a URL that is suitable for libsmbclient
100 QByteArray
toSmbcUrl() const { return m_surl
; }
104 * Change from QString to QCString (MS Windows's character encoding)
106 QByteArray
fromUnicode( const QString
&_str
) const;
115 mutable SMBUrlType m_type
;