File indexing completed on 2024-06-16 04:52:27

0001 /*
0002     Copyright (c) 2018 Christian Mollekopf <mollekopf@kolabsys.com>
0003 
0004     This program is free software; you can redistribute it and/or modify
0005     it under the terms of the GNU General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or
0007     (at your option) any later version.
0008 
0009     This program is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012     GNU General Public License for more details.
0013 
0014     You should have received a copy of the GNU General Public License
0015     along with this program; if not, write to the Free Software
0016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017 */
0018 #pragma once
0019 
0020 #include "kpimkdav2_export.h"
0021 
0022 #include "davjobbase.h"
0023 #include "davurl.h"
0024 
0025 #include <KCoreAddons/KJob>
0026 
0027 #include <QtCore/QStringList>
0028 
0029 namespace KDAV2
0030 {
0031 
0032 /**
0033  * @short A job that discovers the principal url using well-known uri's
0034  *
0035  * It's an incomplete implementation of RFC 6764 so far.
0036  */
0037 class KPIMKDAV2_EXPORT DavDiscoveryJob : public DavJobBase
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * Discover the url of the server.
0044      *
0045      * @param url The DAV url of the server.
0046      * @param parent The parent object.
0047      */
0048     explicit DavDiscoveryJob(const DavUrl &url, const QString &wellKnownSuffix, QObject *parent = nullptr);
0049 
0050     /**
0051      * Starts the job.
0052      */
0053     void start() Q_DECL_OVERRIDE;
0054 
0055     /**
0056      * Returns the found principal url.
0057      */
0058     QUrl url() const;
0059 
0060 private Q_SLOTS:
0061     void davJobFinished(KJob *);
0062 
0063 private:
0064     DavUrl mUrl;
0065 };
0066 
0067 }