File indexing completed on 2024-11-10 04:40:31

0001 /*
0002     SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "resourceselectjob_p.h"
0008 
0009 #include "job_p.h"
0010 #include "private/imapparser_p.h"
0011 #include "private/protocol_p.h"
0012 
0013 using namespace Akonadi;
0014 
0015 class Akonadi::ResourceSelectJobPrivate : public JobPrivate
0016 {
0017 public:
0018     explicit ResourceSelectJobPrivate(ResourceSelectJob *parent)
0019         : JobPrivate(parent)
0020     {
0021     }
0022 
0023     QString resourceId;
0024     QString jobDebuggingString() const override;
0025 };
0026 
0027 QString Akonadi::ResourceSelectJobPrivate::jobDebuggingString() const
0028 {
0029     return QStringLiteral("Select Resource %1").arg(resourceId);
0030 }
0031 
0032 ResourceSelectJob::ResourceSelectJob(const QString &identifier, QObject *parent)
0033     : Job(new ResourceSelectJobPrivate(this), parent)
0034 {
0035     Q_D(ResourceSelectJob);
0036     d->resourceId = identifier;
0037 }
0038 
0039 void ResourceSelectJob::doStart()
0040 {
0041     Q_D(ResourceSelectJob);
0042 
0043     d->sendCommand(Protocol::SelectResourceCommandPtr::create(d->resourceId));
0044 }
0045 
0046 bool ResourceSelectJob::doHandleResponse(qint64 tag, const Protocol::CommandPtr &response)
0047 {
0048     if (!response->isResponse() || response->type() != Protocol::Command::SelectResource) {
0049         return Job::doHandleResponse(tag, response);
0050     }
0051 
0052     return true;
0053 }
0054 
0055 #include "moc_resourceselectjob_p.cpp"