Simplified config file write method, removed don't store pwd.

This commit is contained in:
Klaas Freitag 2013-04-27 22:21:28 +02:00
parent a8bc849b5d
commit 6c5d5a543c
2 changed files with 4 additions and 13 deletions

View file

@ -136,25 +136,17 @@ bool MirallConfigFile::connectionExists( const QString& conn )
void MirallConfigFile::writeOwncloudConfig( const QString& connection, void MirallConfigFile::writeOwncloudConfig( const QString& connection,
const QString& url, const QString& url,
const QString& user, const QString& user,
const QString& passwd, const QString& passwd )
bool https, bool skipPwd )
{ {
const QString file = configFile(); const QString file = configFile();
bool skipPwd = false; // can be refactored - remove it.
qDebug() << "*** writing mirall config to " << file << " Skippwd: " << skipPwd; qDebug() << "*** writing mirall config to " << file << " Skippwd: " << skipPwd;
QSettings settings( file, QSettings::IniFormat); QSettings settings( file, QSettings::IniFormat);
settings.setIniCodec( "UTF-8" ); settings.setIniCodec( "UTF-8" );
QString cloudsUrl( url );
if( !cloudsUrl.startsWith( QLatin1String("http")) ) {
if (https)
cloudsUrl.prepend(QLatin1String("https://"));
else
cloudsUrl.prepend(QLatin1String("http://"));
}
settings.beginGroup( connection ); settings.beginGroup( connection );
settings.setValue( QLatin1String("url"), cloudsUrl ); settings.setValue( QLatin1String("url"), url );
settings.setValue( QLatin1String("user"), user ); settings.setValue( QLatin1String("user"), user );

View file

@ -50,8 +50,7 @@ public:
void writeOwncloudConfig( const QString& connection, void writeOwncloudConfig( const QString& connection,
const QString& url, const QString& url,
const QString& user, const QString& user,
const QString& passwd, const QString& passwd );
bool https, bool skipPwd );
void removeConnection( const QString& connection = QString() ); void removeConnection( const QString& connection = QString() );