Reset the service when connecting a second time and fetch posts after

connected
This commit is contained in:
Luca Beltrame 2015-02-14 14:46:07 +01:00
parent aaf8adf560
commit 5f07fe2ea1

View file

@ -106,6 +106,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
// connections // connections
connect(m_connectWidget, &DanbooruConnectWidget::accepted, [this]() { connect(m_connectWidget, &DanbooruConnectWidget::accepted, [this]() {
m_service->setBoardUrl(m_connectWidget->boardUrl()); m_service->setBoardUrl(m_connectWidget->boardUrl());
if (!m_connectWidget->isAnonymous() && !m_connectWidget->username().isEmpty() if (!m_connectWidget->isAnonymous() && !m_connectWidget->username().isEmpty()
&& !m_connectWidget->password().isEmpty()) { && !m_connectWidget->password().isEmpty()) {
@ -116,6 +117,7 @@ DanbooruMainWindow::DanbooruMainWindow(QWidget *parent)
actionCollection()->action(QLatin1String("fetch"))->setEnabled(true); actionCollection()->action(QLatin1String("fetch"))->setEnabled(true);
m_connectWidget->hide(); m_connectWidget->hide();
m_service->getPostList();
}); });
@ -176,6 +178,7 @@ void DanbooruMainWindow::connectToBoard()
} }
m_model->clear(); m_model->clear();
m_service->reset();
m_connectWidget->show(); m_connectWidget->show();
} }