File indexing completed on 2024-05-05 17:33:20
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "AbstractBackendUpdater.h" 0008 #include "AbstractResource.h" 0009 0010 AbstractBackendUpdater::AbstractBackendUpdater(QObject *parent) 0011 : QObject(parent) 0012 { 0013 } 0014 0015 void AbstractBackendUpdater::cancel() 0016 { 0017 Q_ASSERT(isCancelable() && "only call cancel when cancelable"); 0018 Q_ASSERT(false && "if it can be canceled, then ::cancel() must be implemented"); 0019 } 0020 0021 void AbstractBackendUpdater::fetchChangelog() const 0022 { 0023 const auto toUpd = toUpdate(); 0024 for (auto res : toUpd) { 0025 res->fetchChangelog(); 0026 } 0027 } 0028 0029 void AbstractBackendUpdater::enableNeedsReboot() 0030 { 0031 if (m_needsReboot) 0032 return; 0033 0034 m_needsReboot = true; 0035 Q_EMIT needsRebootChanged(); 0036 } 0037 0038 void AbstractBackendUpdater::enableReadyToReboot() 0039 { 0040 m_readyToReboot = true; 0041 } 0042 0043 bool AbstractBackendUpdater::needsReboot() const 0044 { 0045 return m_needsReboot; 0046 } 0047 0048 bool AbstractBackendUpdater::isReadyToReboot() const 0049 { 0050 return m_readyToReboot; 0051 } 0052 0053 void AbstractBackendUpdater::setOfflineUpdates(bool useOfflineUpdates) 0054 { 0055 Q_UNUSED(useOfflineUpdates); 0056 } 0057 0058 void AbstractBackendUpdater::setErrorMessage(const QString &errorMessage) 0059 { 0060 if (errorMessage == m_errorMessage) { 0061 return; 0062 } 0063 m_errorMessage = errorMessage; 0064 Q_EMIT errorMessageChanged(); 0065 }