1 /////////////////////////////////////////////////////////////////////////////
3 // Project: SMB kioslave for KDE2
5 // File: kio_smb_config.cpp
7 // Abstract: member function implementations for SMBSlave that deal with
8 // KDE/SMB slave configuration
10 // Author(s): Matthew Peterson <mpeterson@caldera.com>
12 //---------------------------------------------------------------------------
14 // Copyright (c) 2000 Caldera Systems, Inc.
16 // This program is free software; you can redistribute it and/or modify it
17 // under the terms of the GNU General Public License as published by the
18 // Free Software Foundation; either version 2.1 of the License, or
19 // (at your option) any later version.
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU Lesser General Public License for more details.
26 // You should have received a copy of the GNU General Public License
27 // along with this program; see the file COPYING. If not, please obtain
28 // a copy from http://www.gnu.org/copyleft/gpl.html
30 /////////////////////////////////////////////////////////////////////////////
33 #include "kio_smb_internal.h"
35 #include <kconfiggroup.h>
38 //===========================================================================
39 void SMBSlave::reparseConfiguration()
41 KConfig
cfg("kioslaverc", KConfig::NoGlobals
);
42 const KConfigGroup group
= cfg
.group("Browser Settings/SMBro");
43 m_default_user
= group
.readEntry("User");
44 // m_default_workgroup=group.readEntry("Workgroup");
45 // m_showHiddenShares=group.readEntry("ShowHiddenShares", QVariant(false)).toBool();
47 QString m_encoding
= QTextCodec::codecForLocale()->name();
48 m_default_encoding
= group
.readEntry( "Encoding", m_encoding
.toLower() );
50 // unscramble, taken from Nicola Brodu's smb ioslave
51 //not really secure, but better than storing the plain password
52 QString scrambled
= group
.readEntry( "Password" );
53 m_default_password
= "";
54 for (int i
=0; i
<scrambled
.length()/3; i
++)
56 QChar qc1
= scrambled
[i
*3];
57 QChar qc2
= scrambled
[i
*3+1];
58 QChar qc3
= scrambled
[i
*3+2];
59 unsigned int a1
= qc1
.toLatin1() - '0';
60 unsigned int a2
= qc2
.toLatin1() - 'A';
61 unsigned int a3
= qc3
.toLatin1() - '0';
62 unsigned int num
= ((a1
& 0x3F) << 10) | ((a2
& 0x1F) << 5) | (a3
& 0x1F);
63 m_default_password
[i
] = QChar((uchar
)((num
- 17) ^ 173)); // restore