File: UpdateItem.cpp

package info (click to toggle)
plasma-discover 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,288 kB
  • sloc: cpp: 30,576; xml: 2,710; python: 311; sh: 5; makefile: 5
file content (74 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 *   SPDX-FileCopyrightText: 2011 Jonathan Thomas <echidnaman@kubuntu.org>
 *
 *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 */

#include "UpdateItem.h"
#include <resources/AbstractBackendUpdater.h>
#include <resources/AbstractResource.h>
#include <resources/AbstractResourcesBackend.h>

#include "libdiscover_debug.h"
#include <KLocalizedString>
#include <QStringBuilder>

UpdateItem::UpdateItem(AbstractResource *app)
    : m_app(app)
{
    setExtended(app->updateNeedsAttention());
}

UpdateItem::~UpdateItem()
{
}

AbstractResource *UpdateItem::app() const
{
    return m_app;
}

QString UpdateItem::name() const
{
    return m_app->name();
}

QVariant UpdateItem::icon() const
{
    return m_app->icon();
}

qint64 UpdateItem::size() const
{
    return m_app->size();
}

static bool isMarked(AbstractResource *res)
{
    return res->backend()->backendUpdater()->isMarked(res);
}

Qt::CheckState UpdateItem::checked() const
{
    return isMarked(app()) ? Qt::Checked : Qt::Unchecked;
}

qreal UpdateItem::progress() const
{
    return m_progress;
}

void UpdateItem::setProgress(qreal progress)
{
    m_progress = progress;
}

QString UpdateItem::changelog() const
{
    return m_changelog;
}

void UpdateItem::setChangelog(const QString &changelog)
{
    m_changelog = changelog;
}