CloudSync::CloudSync( QObject *parent ) : QObject( parent ), d( new Private() ) { connect( &d->m_cloudSyncManager, SIGNAL(owncloudServerChanged(QString)), this, SIGNAL(owncloudServerChanged()) ); connect( &d->m_cloudSyncManager, SIGNAL(owncloudUsernameChanged(QString)), this, SIGNAL(owncloudUsernameChanged()) ); connect( &d->m_cloudSyncManager, SIGNAL(owncloudPasswordChanged(QString)), this, SIGNAL(owncloudPasswordChanged()) ); }
void CloudSyncManager::setOwncloudServer( const QString &server ) { if ( d->m_ownloudServer != server ) { d->m_ownloudServer = server; emit owncloudServerChanged( d->m_ownloudServer ); emit apiUrlChanged( apiUrl() ); } }
void CloudSyncManager::setOwncloudServer( const QString &server ) { QString const oldProtocol = d->m_owncloudProtocol; QString const oldServer = d->m_ownloudServer; if ( server.startsWith( "http://" ) ) { d->m_owncloudProtocol = "http://"; d->m_ownloudServer = server.mid( 7 ); } else if ( server.startsWith( "https://" ) ) { d->m_owncloudProtocol = "https://"; d->m_ownloudServer = server.mid ( 8 ); } else { d->m_owncloudProtocol = "http://"; d->m_ownloudServer = server; } if ( oldServer != d->m_ownloudServer ) { emit owncloudServerChanged( owncloudServer() ); emit apiUrlChanged( apiUrl() ); } else if ( oldProtocol != d->m_owncloudProtocol ) { emit apiUrlChanged( apiUrl() ); } }