Example #1
0
void ODocumentFileView::reread() {
    if (!m_selector)
        return;

    m_selector->setNewVisible( showNew() );
    m_selector->setCloseVisible( showClose() );
    m_selector->filter = currentMimeType().join(";");
    m_selector->reread();
}
Example #2
0
QWidget* ODocumentFileView::widget( QWidget* parent ) {
    if (!m_selector ) {
        m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
        QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ),
                         selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
        QObject::connect(m_selector, SIGNAL(closeMe() ),
                         selector(), SIGNAL(closeMe() ) );
        QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ),
                         selector(), SIGNAL(newSelected(const DocLnk&) ) );
    }

    return m_selector;
}
Example #3
0
// KDE5 TODO: merge with comment()? Need to see what lxr says about the usage of both.
QString KFileItem::mimeComment() const
{
    if (!d) {
        return QString();
    }

    const QString displayType = d->m_entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_TYPE);
    if (!displayType.isEmpty()) {
        return displayType;
    }

    bool isLocalUrl;
    QUrl url = mostLocalUrl(&isLocalUrl);

    QMimeType mime = currentMimeType();
    // This cannot move to kio_file (with UDS_DISPLAY_TYPE) because it needs
    // the mimetype to be determined, which is done here, and possibly delayed...
    if (isLocalUrl && !d->isSlow() && mime.inherits(QStringLiteral("application/x-desktop"))) {
        KDesktopFile cfg(url.toLocalFile());
        QString comment = cfg.desktopGroup().readEntry("Comment");
        if (!comment.isEmpty()) {
            return comment;
        }
    }

    // Support for .directory file in directories
    if (isLocalUrl && isDir() && isDirectoryMounted(url)) {
        QUrl u(url);
        u.setPath(u.path() + QLatin1String("/.directory"));
        const KDesktopFile cfg(u.toLocalFile());
        const QString comment = cfg.readComment();
        if (!comment.isEmpty()) {
            return comment;
        }
    }

    const QString comment = mime.comment();
    //qDebug() << "finding comment for " << url.url() << " : " << d->m_mimeType->name();
    if (!comment.isEmpty()) {
        return comment;
    } else {
        return mime.name();
    }
}