- set ownCloudUrl and known CA Certs.

This commit is contained in:
Klaas Freitag 2012-08-06 14:57:26 +03:00
parent 54c2368dbb
commit 4cad29331f
2 changed files with 43 additions and 0 deletions

View file

@ -38,6 +38,8 @@
#define OC_ORGANIZATION QLatin1String("ownCloud")
#define OC_APPLICATION QLatin1String("ownCloudClient")
#define CA_CERTS_KEY QLatin1String("CaCertificates")
namespace Mirall {
QString MirallConfigFile::_passwd;
@ -175,6 +177,41 @@ void MirallConfigFile::writeOwncloudConfig( const QString& connection,
}
// set the url, called from redirect handling.
void MirallConfigFile::setOwnCloudUrl( const QString& connection, const QString & url )
{
const QString file = configFile();
QSettings settings( file, QSettings::IniFormat);
settings.setIniCodec( "UTF-8" );
settings.beginGroup( connection );
settings.setValue("url", url );
settings.sync();
}
QByteArray MirallConfigFile::caCerts( )
{
QSettings settings( configFile(), QSettings::IniFormat );
settings.setIniCodec( "UTF-8" );
QByteArray certs = settings.value( CA_CERTS_KEY ).toByteArray();
return certs;
}
void MirallConfigFile::setCaCerts( const QByteArray & certs )
{
const QString file = configFile();
QSettings settings( file, QSettings::IniFormat);
settings.setIniCodec( "UTF-8" );
settings.setValue( CA_CERTS_KEY, certs );
settings.sync();
}
void MirallConfigFile::removeConnection( const QString& connection )
{
QString con( connection );

View file

@ -53,6 +53,12 @@ public:
QString ownCloudUrl( const QString& connection = QString(), bool webdav = false ) const;
void setOwnCloudUrl(const QString &connection, const QString& );
// the certs do not depend on a connection.
QByteArray caCerts();
void setCaCerts( const QByteArray& );
QString ownCloudUser( const QString& connection = QString() ) const;
QString ownCloudPasswd( const QString& connection = QString() ) const;