read oc url from config file.

This commit is contained in:
Klaas Freitag 2011-09-30 10:24:01 +02:00
parent 9043e69d27
commit 96eaeb2c62
4 changed files with 36 additions and 2 deletions

View file

@ -164,6 +164,7 @@ void OwncloudSetup::slotFinished( int res, QProcess::ExitStatus )
void OwncloudSetup::startWizard()
{
_ocWizard->setOCUrl( ownCloudUrl() );
_ocWizard->exec();
}
@ -182,6 +183,19 @@ void OwncloudSetup::writeOwncloudConfig()
settings.sync();
}
/*
* returns the configured owncloud url if its already configured, otherwise an empty
* string.
*/
QString OwncloudSetup::ownCloudUrl() const
{
QSettings settings( mirallConfigFile(), QSettings::IniFormat );
QString url = settings.value( "ownCloud/url" ).toString();
qDebug() << "Returning configured owncloud url: " << url;
return url;
}
/*
* method to check the if the owncloud admin script is existing
*/

View file

@ -26,6 +26,12 @@ public:
QString mirallConfigFile() const;
/**
* returns the configured owncloud url if its already configured, otherwise an empty
* string.
*/
QString ownCloudUrl() const ;
signals:
public slots:

View file

@ -71,6 +71,11 @@ bool OwncloudWizardSelectTypePage::isComplete() const
return true;
}
void OwncloudWizardSelectTypePage::setOCUrl( const QString& url )
{
_ui.OCUrlLineEdit->setText( url );
}
// ======================================================================
@ -253,6 +258,13 @@ void OwncloudWizard::appendToResultWidget( const QString& msg )
p->appendResultText( msg );
}
} // end namespace
void OwncloudWizard::setOCUrl( const QString& url )
{
if( !url.isEmpty() ) {
OwncloudWizardSelectTypePage *p = static_cast<OwncloudWizardSelectTypePage*>(page( Page_SelectType ));
p->setOCUrl( url );
}
}
} // end namespace
#include "owncloudwizard.moc"

View file

@ -38,7 +38,7 @@ public:
virtual bool isComplete() const;
virtual void initializePage();
int nextId() const;
void setOCUrl( const QString& );
private:
Ui_OwncloudWizardSelectTypePage _ui;
@ -121,6 +121,8 @@ public:
OwncloudWizard(QWidget *parent = 0L);
void setOCUrl( const QString& );
public slots:
void appendToResultWidget( const QString& );
void slotCurrentPageChanged( int );