Don't try to connect to subsonic on startup if nothing is configured.

This commit is contained in:
David Sansome 2013-02-17 15:14:55 +11:00
parent 6904b06cf8
commit 0ae323bfff
2 changed files with 13 additions and 2 deletions

View File

@ -155,13 +155,22 @@ void SubsonicService::ReloadSettings() {
Login();
}
bool SubsonicService::IsConfigured() const {
return !server_.isEmpty() &&
!username_.isEmpty() &&
!password_.isEmpty();
}
void SubsonicService::Login() {
// Forget session ID
network_->setCookieJar(new QNetworkCookieJar(network_));
// Forget login state whilst waiting
login_state_ = LoginState_Unknown;
// Ping is enough to check credentials
Ping();
if (IsConfigured()) {
// Ping is enough to check credentials
Ping();
}
}
void SubsonicService::Login(

View File

@ -58,6 +58,8 @@ class SubsonicService : public InternetService
typedef QMap<QString, QString> RequestOptions;
bool IsConfigured() const;
QStandardItem* CreateRootItem();
void LazyPopulate(QStandardItem *item);
void ShowContextMenu(const QPoint &global_pos);