Example #1
0
void FileSystemWidget::openPathIndex(const QModelIndex &index)
{
    FileNode *node = m_model->nodeFromIndex(index);
    if (!node) {
        return;
    }
    if (node->isFile()) {
        QFileInfo info(node->path());
        QString cmd = FileUtil::lookPathInDir(info.fileName(),LiteApi::getCurrentEnvironment(m_liteApp),info.path());
        if (cmd == node->path()) {
            LiteApi::ILiteBuild *build = LiteApi::getLiteBuild(m_liteApp);
            if (build) {
                build->executeCommand(info.fileName(),QString(),info.path());
                return;
            }
        }
        m_liteApp->fileManager()->openEditor(node->path(),true);
    }
}
Example #2
0
void FileSystemWidget::openPathIndex(const QModelIndex &index)
{
    FileNode *node = m_model->nodeFromIndex(index);
    if (!node) {
        return;
    }
    if (node->isFile()) {
        QFileInfo info(node->path());
        QString mimeType = m_liteApp->mimeTypeManager()->findMimeTypeByFile(node->path());
        if (mimeType.startsWith("text/") || mimeType.startsWith("application/")) {
            m_liteApp->fileManager()->openEditor(node->path());
            return;
        }
        QString cmd = FileUtil::lookPathInDir(info.fileName(),info.path());
        if (cmd == node->path()) {
            LiteApi::ILiteBuild *build = LiteApi::getLiteBuild(m_liteApp);
            if (build) {
                build->executeCommand(info.fileName(),QString(),info.path());
                return;
            }
        }
        m_liteApp->fileManager()->openEditor(node->path(),true);
    }
}