File indexing completed on 2024-11-17 04:44:00

0001 /*
0002     Copyright (c) 2010 Grégory Oestreicher <greg@kamago.net>
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 
0019 #include "davcollectiondeletejob.h"
0020 
0021 #include "daverror.h"
0022 #include "davjob.h"
0023 #include "davmanager.h"
0024 
0025 using namespace KDAV2;
0026 
0027 DavCollectionDeleteJob::DavCollectionDeleteJob(const DavUrl &url, QObject *parent)
0028     : DavJobBase(parent), mUrl(url)
0029 {
0030 }
0031 
0032 void DavCollectionDeleteJob::start()
0033 {
0034     DavJob *job = DavManager::self()->createDeleteJob(mUrl.url());
0035     connect(job, &DavJob::result, this, &DavCollectionDeleteJob::davJobFinished);
0036 }
0037 
0038 void DavCollectionDeleteJob::davJobFinished(KJob *job)
0039 {
0040     auto *deleteJob = qobject_cast<DavJob*>(job);
0041 
0042     //TODO Ignore deleteJob->error() != KIO::ERR_NO_CONTENT
0043     if (deleteJob->error()) {
0044         setErrorFromJob(deleteJob, ERR_COLLECTIONDELETE);
0045     }
0046 
0047     emitResult();
0048 }
0049