File indexing completed on 2025-01-05 04:58:22

0001 /*
0002   progressmanager.cpp
0003 
0004   SPDX-FileCopyrightText: 2004 Till Adam <adam@kde.org>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #include "progressmanagerakonadi.h"
0010 #include "agentprogressmonitor.h"
0011 
0012 KPIM::ProgressItem *PimCommon::ProgressManagerAkonadi::createProgressItem(KPIM::ProgressItem *parent,
0013                                                                           const Akonadi::AgentInstance &agent,
0014                                                                           const QString &id,
0015                                                                           const QString &label,
0016                                                                           const QString &status,
0017                                                                           bool canBeCanceled,
0018                                                                           KPIM::ProgressItem::CryptoStatus cryptoStatus)
0019 {
0020     const bool itemAlreadyExists = (KPIM::ProgressManager::instance()->progressItem(id) != nullptr);
0021     KPIM::ProgressItem *t = KPIM::ProgressManager::instance()->createProgressItem(parent, id, label, status, canBeCanceled, cryptoStatus);
0022     t->setTypeProgressItem(0);
0023     if (!itemAlreadyExists) {
0024         //    qCDebug(LIBKDEPIM_LOG) << "Created ProgressItem for agent" << instance.name();
0025         new AgentProgressMonitor(agent, t);
0026     }
0027     return t;
0028 }