Add CalamaresUtils::obscure.
This commit is contained in:
parent
0978fff082
commit
baa3553db5
@ -291,4 +291,42 @@ removeDiacritics( const QString& string )
|
||||
}
|
||||
|
||||
|
||||
// Function CalamaresUtils::obscure based on KStringHandler::obscure,
|
||||
// part of KDElibs by KDE, file kstringhandler.cpp.
|
||||
// Original copyright statement follows.
|
||||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1999 Ian Zepp (icszepp@islc.net)
|
||||
Copyright (C) 2006 by Dominic Battre <dominic@battre.de>
|
||||
Copyright (C) 2006 by Martin Pool <mbp@canonical.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
QString
|
||||
obscure( const QString& string )
|
||||
{
|
||||
QString result;
|
||||
const QChar *unicode = string.unicode();
|
||||
for ( int i = 0; i < string.length(); ++i )
|
||||
// yes, no typo. can't encode ' ' or '!' because
|
||||
// they're the unicode BOM. stupid scrambling. stupid.
|
||||
result += ( unicode[ i ].unicode() <= 0x21 ) ?
|
||||
unicode[ i ] :
|
||||
QChar( 0x1001F - unicode[ i ].unicode() );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ namespace CalamaresUtils
|
||||
DLLEXPORT void setQmlModulesDir( const QDir& dir );
|
||||
|
||||
DLLEXPORT QString removeDiacritics( const QString& string );
|
||||
|
||||
DLLEXPORT QString obscure( const QString& string );
|
||||
}
|
||||
|
||||
#endif // CALAMARESUTILS_H
|
||||
|
@ -128,6 +128,7 @@ UsersPage::createJobs( const QString& defaultUserGroup, const QStringList& defau
|
||||
gs->insert( "autologinUser", ui->textBoxUsername->text() );
|
||||
|
||||
gs->insert( "username", ui->textBoxUsername->text() );
|
||||
gs->insert( "password", CalamaresUtils::obscure( ui->textBoxUserPassword->text() ) );
|
||||
|
||||
return list;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user