X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/48b58f830a585b773435c9af5ee2fe8f0c7c641d..fc9e06426746b5b33d31db68904d4d205537a080:/src/statusbar/mountpointobserver.cpp diff --git a/src/statusbar/mountpointobserver.cpp b/src/statusbar/mountpointobserver.cpp index 0be0f7173..67d341b3d 100644 --- a/src/statusbar/mountpointobserver.cpp +++ b/src/statusbar/mountpointobserver.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2014 by Frank Reininghaus * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2014 Frank Reininghaus + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "mountpointobserver.h" @@ -23,16 +10,16 @@ #include -MountPointObserver::MountPointObserver(const QUrl& url, QObject* parent) : - QObject(parent), - m_url(url), - m_referenceCount(0) +MountPointObserver::MountPointObserver(const QUrl &url, QObject *parent) + : QObject(parent) + , m_url(url) + , m_referenceCount(0) { } -MountPointObserver* MountPointObserver::observerForUrl(const QUrl& url) +MountPointObserver *MountPointObserver::observerForUrl(const QUrl &url) { - MountPointObserver* observer = MountPointObserverCache::instance()->observerForUrl(url); + MountPointObserver *observer = MountPointObserverCache::instance()->observerForUrl(url); return observer; } @@ -41,16 +28,20 @@ void MountPointObserver::update() if (m_referenceCount == 0) { delete this; } else { - KIO::FileSystemFreeSpaceJob* job = KIO::fileSystemFreeSpace(m_url); - connect(job, &KIO::FileSystemFreeSpaceJob::result, this, &MountPointObserver::freeSpaceResult); + KIO::FileSystemFreeSpaceJob *job = KIO::fileSystemFreeSpace(m_url); + connect(job, &KJob::result, this, &MountPointObserver::freeSpaceResult); } } -void MountPointObserver::freeSpaceResult(KIO::Job* job, KIO::filesize_t size, KIO::filesize_t available) +void MountPointObserver::freeSpaceResult(KJob *job) { if (!job->error()) { - emit spaceInfoChanged(size, available); + KIO::FileSystemFreeSpaceJob *freeSpaceJob = qobject_cast(job); + Q_ASSERT(freeSpaceJob); + Q_EMIT spaceInfoChanged(freeSpaceJob->size(), freeSpaceJob->availableSize()); } else { - emit spaceInfoChanged(0, 0); + Q_EMIT spaceInfoChanged(0, 0); } } + +#include "moc_mountpointobserver.cpp"