Ejemplo n.º 1
0
void FreeSpaceWidget::slotTimeout()
{
    KMountPoint::List list = KMountPoint::currentMountPoints();

    foreach(const QString& path, d->paths)
    {
        KMountPoint::Ptr mp = list.findByPath(path);

        if (mp)
        {
            KDiskFreeSpace* const job = new KDiskFreeSpace(this);

            connect(job, SIGNAL(foundMountPoint(QString,quint64,quint64,quint64)),
                    this, SLOT(slotAvailableFreeSpace(QString,quint64,quint64,quint64)));

            job->readDF(mp->mountPoint());
        }
    }
}
Ejemplo n.º 2
0
void KAutoMountPrivate::slotResult(KJob *job)
{
    if (job->error()) {
        emit q->error();
        job->uiDelegate()->showErrorMessage();
    } else {
        const KMountPoint::List mountPoints(KMountPoint::currentMountPoints());
        KMountPoint::Ptr mp = mountPoints.findByDevice(m_strDevice);
        // Mounting devices using "LABEL=" or "UUID=" will fail if we look for
        // the device using only its real name since /etc/mtab will never contain
        // the LABEL or UUID entries. Hence, we check using the mount point below
        // when device name lookup fails. #247235
        if (!mp) {
            mp = mountPoints.findByPath(m_mountPoint);
        }

        if (!mp) {
            qCWarning(KIO_WIDGETS) << m_strDevice << "was correctly mounted, but findByDevice() didn't find it."
                       << "This looks like a bug, please report it on http://bugs.kde.org, together with your /etc/fstab and /etc/mtab lines for this device";
        } else {
            const QUrl url = QUrl::fromLocalFile(mp->mountPoint());
            //qDebug() << "KAutoMount: m_strDevice=" << m_strDevice << " -> mountpoint=" << mountpoint;
            if (m_bShowFilemanagerWindow) {
                KRun::runUrl(url, QStringLiteral("inode/directory"), 0 /*TODO - window*/);
            }
            // Notify about the new stuff in that dir, in case of opened windows showing it
            org::kde::KDirNotify::emitFilesAdded(url);
        }

        // Update the desktop file which is used for mount/unmount (icon change)
        //qDebug() << " mount finished : updating " << m_desktopFile;
        org::kde::KDirNotify::emitFilesChanged(QList<QUrl>() << QUrl::fromLocalFile(m_desktopFile));
        //KDirWatch::self()->setFileDirty( m_desktopFile );

        emit q->finished();
    }
    q->deleteLater();
}