Commit 13728d2e authored by Koen Martens's avatar Koen Martens

Pull out caldav discovery from CaldavClient class into CaldavDiscovery class

parent dbfee340
......@@ -17,13 +17,16 @@ CaldavClient::CaldavClient(QObject *parent) : QObject(parent)
this, &CaldavClient::discoveryComplete);
connect(discoveryEngine, &CaldavDiscovery::discoveryFailed,
[this]() {
emit todoItemDeleteError(CaldavClient::Error::AuthenticationFailed);
emit todoItemDeleteError(CaldavClient::Error::DiscoveryFailed);
});
connect(discoveryEngine, &CaldavDiscovery::authenticationError,
[this]() {
emit discoveryError(CaldavClient::Error::AuthenticationFailed);
});
connect(discoveryEngine, &CaldavDiscovery::networkError,
[this](HttpClientHelpers::ResponseProcessor::NetworkError error) {
emit discoveryError(networkErrorToCaldavClientError(error));
});
}
QObject *CaldavClient::getAccount()
......@@ -85,7 +88,7 @@ void CaldavClient::urlChanged()
this->setReady(false);
qDebug() << "URL CHANGED!";
discoveryEngine->startDiscovery(QUrl(account->property("url").toString());
discoveryEngine->startDiscovery(QUrl(account->property("url").toString()));
}
// slot
......
......@@ -22,19 +22,6 @@ CaldavDiscovery::CaldavDiscovery(HttpClient *httpClient, UrlBuilder *urlBuilder,
[this](HttpClientHelpers::ResponseProcessor::NetworkError error) {
emit networkError(error);
});
// connect(discoveryProcessor, &DiscoveryProcessor::discoveryFailed,
// [this]() {
// emit discoveryError(CaldavDiscovery::Error::DiscoveryFailed);
// });
// connect(discoveryProcessor, &DiscoveryProcessor::authenticationError,
// [this]() {
// emit discoveryError(CaldavDiscovery::Error::AuthenticationFailed);
// });
// connect(discoveryProcessor, &DiscoveryProcessor::error,
// [this](HttpClientHelpers::ResponseProcessor::NetworkError error) {
// emit discoveryError(networkErrorToCaldavClientError(error));
// });
}
void CaldavDiscovery::startDiscovery(QUrl url)
......@@ -48,7 +35,6 @@ void CaldavDiscovery::startDiscovery(QUrl url)
);
}
void CaldavDiscovery::redirected(QString location)
{
qDebug() << "requesting discovery redirect: " << location;
......@@ -65,12 +51,13 @@ void CaldavDiscovery::locationDiscovered()
{
QString location_str = discoveredUrl.toString();
qDebug() << "discovery completed, discovered url: " << location_str;
qDebug() << "location discovered: " << location_str;
if(!location_str.endsWith('/')) {
location_str.append(QStringLiteral("/"));
}
this->urlBuilder->setBase(location_str);
emit discoveryComplete();
}
......@@ -24,6 +24,7 @@ SOURCES += \
main.cpp \
../app/src/util/uuidgenerator.cpp \
../app/src/caldavclient/caldavclient.cpp \
../app/src/caldavclient/caldavdiscovery.cpp \
../app/src/caldavclient/discoveryprocessor.cpp \
../app/src/caldavclient/calendardetailprocessor.cpp \
../app/src/caldavclient/calendarlistprocessor.cpp \
......@@ -40,6 +41,7 @@ SOURCES += \
HEADERS += \
../app/src/util/uuidgenerator.h \
../app/src/caldavclient/caldavclient.h \
../app/src/caldavclient/caldavdiscovery.h \
../app/src/caldavclient/discoveryprocessor.h \
../app/src/caldavclient/calendardetailprocessor.h \
../app/src/caldavclient/calendarlistprocessor.h \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment