Example #1
0
void FolderModel::setUrl(const QString& url)
{
    const QUrl &resolvedUrl = resolve(url);

    if (url == m_url) {
        m_dirModel->dirLister()->updateDirectory(resolvedUrl);
        return;
    }

    beginResetModel();
    m_url = url;
    m_isDirCache.clear();
    m_dirModel->dirLister()->openUrl(resolvedUrl);
    clearDragImages();
    endResetModel();

    emit urlChanged();
    emit resolvedUrlChanged();

    m_errorString.clear();
    emit errorStringChanged();

    if (m_dirWatch) {
        delete m_dirWatch;
    }

    if (resolvedUrl.isValid()) {
        m_dirWatch = new KDirWatch(this);
        connect(m_dirWatch, &KDirWatch::created, this, &FolderModel::iconNameChanged);
        connect(m_dirWatch, &KDirWatch::dirty, this, &FolderModel::iconNameChanged);
        m_dirWatch->addFile(resolvedUrl.toLocalFile() + QLatin1String("/.directory"));
    }

    emit iconNameChanged();
}
Example #2
0
void FolderModel::setUrl(const QString& url)
{
    const QUrl &resolvedUrl = resolve(url);

    if (url == m_url) {
        m_dirModel->dirLister()->updateDirectory(resolvedUrl);

        return;
    }

    beginResetModel();
    m_url = url;
    m_isDirCache.clear();
    m_dirModel->dirLister()->openUrl(resolvedUrl);
    clearDragImages();
    endResetModel();

    emit urlChanged();
    emit resolvedUrlChanged();

    m_errorString.clear();
    emit errorStringChanged();
}