Commit 98b441b2 authored by David Edmundson's avatar David Edmundson

Merge branch 'Plasma/5.14'

parents c6938009 bd6f08ad
......@@ -311,7 +311,7 @@ DiscoverPage {
}
Label {
readonly property string version: appInfo.application.isInstalled ? appInfo.application.installedVersion : appInfo.application.availableVersion
readonly property string releaseDate: appInfo.application.releaseDate.toDateString()
readonly property string releaseDate: appInfo.application.releaseDate.toLocaleString()
function versionString() {
if (version.length == 0) {
......
......@@ -1040,11 +1040,10 @@ void FlatpakBackend::onFetchSizeFinished(FlatpakResource *resource, guint64 down
if (runtime && !runtime->isInstalled()) {
resource->setDownloadSize(runtime->downloadSize() + downloadSize);
resource->setInstalledSize(installedSize);
} else {
resource->setDownloadSize(downloadSize);
resource->setInstalledSize(installedSize);
}
resource->setInstalledSize(installedSize);
}
void FlatpakBackend::updateAppState(FlatpakInstallation *flatpakInstallation, FlatpakResource *resource)
......
......@@ -243,7 +243,7 @@ void FlatpakSourcesBackend::addRemote(FlatpakRemote *remote, FlatpakInstallation
FlatpakSourceItem *it = new FlatpakSourceItem(!title.isEmpty() ? title : id);
it->setCheckState(flatpak_remote_get_disabled(remote) ? Qt::Unchecked : Qt::Checked);
it->setData(remoteUrl.host(), Qt::ToolTipRole);
it->setData(remoteUrl.isLocalFile() ? remoteUrl.toLocalFile() : remoteUrl.host(), Qt::ToolTipRole);
it->setData(id, IdRole);
it->setFlatpakInstallation(installation);
......
......@@ -378,30 +378,6 @@ void FwupdBackend::checkForUpdates()
return;
auto fw = new QFutureWatcher<GPtrArray*>(this);
fw->setFuture(QtConcurrent::run(&m_threadPool, [this] () -> GPtrArray*
{
const uint cacheAge = (24*60*60); // Check for updates every day
g_autoptr(GError) error = nullptr;
/* get devices */
GPtrArray* devices = fwupd_client_get_devices(client, m_cancellable, nullptr);
g_autoptr(GPtrArray) remotes = fwupd_client_get_remotes(client, m_cancellable, &error);
for(uint i = 0; remotes && i < remotes->len; i++)
{
FwupdRemote *remote = (FwupdRemote *)g_ptr_array_index(remotes, i);
if (!fwupd_remote_get_enabled(remote))
continue;
if (fwupd_remote_get_kind(remote) == FWUPD_REMOTE_KIND_LOCAL)
continue;
refreshRemote(this, remote, cacheAge, m_cancellable);
}
return devices;
}
));
connect(fw, &QFutureWatcher<GPtrArray*>::finished, this, [this, fw]() {
m_fetching = true;
emit fetchingChanged();
......@@ -438,6 +414,30 @@ void FwupdBackend::checkForUpdates()
emit initialized();
fw->deleteLater();
});
fw->setFuture(QtConcurrent::run(&m_threadPool, [this] () -> GPtrArray*
{
const uint cacheAge = (24*60*60); // Check for updates every day
g_autoptr(GError) error = nullptr;
/* get devices */
GPtrArray* devices = fwupd_client_get_devices(client, m_cancellable, nullptr);
g_autoptr(GPtrArray) remotes = fwupd_client_get_remotes(client, m_cancellable, &error);
for(uint i = 0; remotes && i < remotes->len; i++)
{
FwupdRemote *remote = (FwupdRemote *)g_ptr_array_index(remotes, i);
if (!fwupd_remote_get_enabled(remote))
continue;
if (fwupd_remote_get_kind(remote) == FWUPD_REMOTE_KIND_LOCAL)
continue;
refreshRemote(this, remote, cacheAge, m_cancellable);
}
return devices;
}
));
}
int FwupdBackend::updatesCount() const
......
......@@ -179,14 +179,10 @@ QStringList AppPackageKitResource::allPackageNames() const
QList<PackageState> AppPackageKitResource::addonsInformation()
{
const PackageKitBackend* p = static_cast<PackageKitBackend*>(parent());
const QVector<AppPackageKitResource*> res = p->extendedBy(m_appdata.id());
QList<PackageState> ret;
Q_FOREACH (AppPackageKitResource* r, res) {
ret += PackageState(r->appstreamId(), r->name(), r->comment(), r->isInstalled());
}
return ret;
return kTransform<QList<PackageState>>(
backend()->extendedBy(m_appdata.id()),
[](AppPackageKitResource* r) { return PackageState(r->appstreamId(), r->name(), r->comment(), r->isInstalled()); }
);
}
QStringList AppPackageKitResource::extends() const
......
......@@ -105,9 +105,8 @@ void SnapTransaction::setRequest(QSnapdRequest* req)
setCancellable(false);
connect(m_request.data(), &QSnapdRequest::progress, this, &SnapTransaction::progressed);
connect(m_request.data(), &QSnapdRequest::complete, this, &SnapTransaction::finishTransaction);
setStatus(SetupStatus);
setStatus(DownloadingStatus);
setStatus(SetupStatus);
m_request->runAsync();
}
......@@ -115,9 +114,17 @@ void SnapTransaction::progressed()
{
const auto change = m_request->change();
int percentage = 0, count = 0;
auto status = SetupStatus;
for(int i = 0, c = change->taskCount(); i<c; ++i) {
++count;
percentage += (100 * change->task(i)->progressDone()) / change->task(i)->progressTotal();
auto task = change->task(i);
if (task->kind() == QLatin1String("download-snap")) {
status = task->status() == QLatin1String("doing") || task->status() == QLatin1String("do") ? DownloadingStatus : CommittingStatus;
} else if (task->kind() == QLatin1String("clear-snap")) {
status = CommittingStatus;
}
percentage += (100 * task->progressDone()) / task->progressTotal();
}
setProgress(percentage / qMax(count, 1));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment