void ObjectsPage::Private::addFile( const QFileInfo& info )
{
    QListWidgetItem* const item = new QListWidgetItem;
    if ( info.isDir() )
        item->setIcon( KIcon( "folder" ) );
    item->setText( info.fileName() );
    item->setData( AbsoluteFilePathRole, info.absoluteFilePath() ); 
    fileListWidget->addItem( item );
}
// Helper to return the icon theme paths from XDG.
QStringList QGenericUnixTheme::xdgIconThemePaths()
{
    QStringList paths;
    // Add home directory first in search path
    const QFileInfo homeIconDir(QDir::homePath() + QStringLiteral("/.icons"));
    if (homeIconDir.isDir())
        paths.prepend(homeIconDir.absoluteFilePath());

    QString xdgDirString = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
    if (xdgDirString.isEmpty())
        xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
    foreach (const QString &xdgDir, xdgDirString.split(QLatin1Char(':'))) {
        const QFileInfo xdgIconsDir(xdgDir + QStringLiteral("/icons"));
        if (xdgIconsDir.isDir())
            paths.append(xdgIconsDir.absoluteFilePath());
    }
    return paths;
}
Example #3
0
QString IconFilter::type(const QFileInfo &info) const
{
    if (info.isDir())
        return QString("folder-blue");
    if (info.suffix().isEmpty())
        return QString("text-plain");
    // TODO: using a global mime dict
    return QString("text-markdown");
}
void SessionFolderDialog::on_selectButton_clicked() {

	QString path = this->setting.value("sessionFolder", "C:/").toString();
	QFileInfo sessionFolder = QFileDialog::getExistingDirectory(this, ("Save in"), path, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
	if(sessionFolder.isDir()) {
		this->setting.setValue("sessionFolder", sessionFolder.filePath());
		ui->filePath->setText(sessionFolder.filePath());
	}
}
Example #5
0
 void FluidLauncher::populateFileBrowser(QStringList config) {
//qWarning("populateFileBrowser\n");

     Config = config;

     QString path = Config.at(0);
     QString filter = Config.at(1);
     dir.cd(path);
     //     QMessageBox::information(mainwindow,"new path",dir.absolutePath(),QMessageBox::Ok);
     dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::AllDirs | QDir::NoDot);
     dir.setSorting(QDir::DirsFirst | QDir::Name | QDir::IgnoreCase);

     QFileInfoList list = dir.entryInfoList(QStringList() << filter);

     pictureFlowWidget->setSlideCount(list.count());

     for (int i = 0; i < list.size(); ++i) {
         QFileInfo fileInfo = list.at(i);
         QImage *img = new QImage();

         if (fileInfo.isFile()) {
             img = new QImage(ExtractImage(fileInfo));
         }
         else if (fileInfo.isDir()) {
             img->load(":/core/folder.png");
         }

         QStringList sl;
         if (fileInfo.isDir()) sl.append("Dir");
         if (fileInfo.isFile()) sl.append("File");

         Launcher* newDemo = new Launcher(
                     list.at(i).fileName(),
                     list.at(i).fileName(),
                     list.at(i).fileName(),
                     "",
                     sl);
         demoList.append(newDemo);
         pictureFlowWidget->setSlide(i, *img);
         pictureFlowWidget->setSlideCaption(i, list.at(i).fileName());
         delete img;
     }
     pictureFlowWidget->setCurrentSlide(list.count()/2);
 }
Example #6
0
ZLFileInfo QtZLFSManager::fileInfo(const std::string &path) const
{
    const QFileInfo info = QString::fromStdString(path);

    ZLFileInfo result;
    result.Exists = info.exists();
    result.IsDirectory = info.isDir();
    result.Size = info.size();
    return result;
}
Example #7
0
QIcon OpenFileDlg::icon ( const QFileInfo& info ) const
{
    if ( info.isFile() )
        return iconFile;
    else
    if ( info.isDir() )
        return iconFolder;
    else
        return QFileIconProvider::icon( info );
}
Example #8
0
QString BazaarClient::findTopLevelForFile(const QFileInfo &file) const
{
    const QString repositoryCheckFile =
            QLatin1String(Constants::BAZAARREPO) + QLatin1String("/branch-format");
    return file.isDir() ?
                VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(),
                                                                   repositoryCheckFile) :
                VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absolutePath(),
                                                                   repositoryCheckFile);
}
Example #9
0
/** \fn     ImageScanThread::SyncFilesFromDir(QString &, int)
 *  \brief  Loads all available files from the path on the
 *          backend and syncs depending if they are a directory or file
 *  \param  path The current directory with the files that shall be scanned syncronized
 *  \param  parentId The id of the parent directory which is required for possible subdirectories
 *  \param  baseDirectory The current root storage group path, this will be stripped before insertion into the database
 *  \return void
 */
void ImageScanThread::SyncFilesFromDir(QString &path, int parentId,
                                       const QString &baseDirectory)
{
    if (!m_continue)
    {
        LOG(VB_FILE, LOG_DEBUG,
            QString("Syncing from SG dir %1 interrupted").arg(path));
        return;
    }

    LOG(VB_FILE, LOG_DEBUG,
        QString("Syncing from SG dir %1").arg(path));

    QDir dir(path);
    if (!dir.exists())
        return;

    // Only get files and dirs, no special and hidden stuff
    dir.setFilter(QDir::Dirs | QDir::Files |
                  QDir::NoDotAndDotDot | QDir::NoSymLinks);
    QFileInfoList list = dir.entryInfoList();
    if (list.isEmpty())
        return;

    for (QFileInfoList::iterator it = list.begin(); it != list.end(); ++it)
    {
        if (!m_continue)
        {
            LOG(VB_FILE, LOG_DEBUG,
                QString("Syncing from SG dir %1 interrupted").arg(path));
            return;
        }

        QFileInfo fileInfo = *it;
        if (fileInfo.isDir())
        {
            // Get the id. This will be new parent id
            // when we traverse down the current directory.
            int id = SyncDirectory(fileInfo, parentId, baseDirectory);

            // Get new files within this directory
            QString fileName = fileInfo.absoluteFilePath();
            SyncFilesFromDir(fileName, id, baseDirectory);
        }
        else
        {
            SyncFile(fileInfo, parentId, baseDirectory);
        }

        // Increase the current progress count in case a
        // progressbar is used to show the sync progress
        if (m_progressTotalCount > m_progressCount)
            ++m_progressCount;
    }
}
QIcon FileIconProviderImplementation::icon(const QFileInfo &fileInfo) const
{
    if (debug)
        qDebug() << "FileIconProvider::icon" << fileInfo.absoluteFilePath();
    // Check for cached overlay icons by file suffix.
    if (!m_cache.isEmpty() && !fileInfo.isDir()) {
        const QString suffix = fileInfo.suffix();
        if (!suffix.isEmpty()) {
            for (int i = 0, n = m_cache.size(); i != n; ++i)
                if (m_cache.at(i).first == suffix)
                    return m_cache[i].second;
        }
    }
    // Get icon from OS.
    if (HostOsInfo::isWindowsHost() || HostOsInfo::isMacHost())
        return QFileIconProvider::icon(fileInfo);

    // File icons are unknown on linux systems.
    return fileInfo.isDir() ? QFileIconProvider::icon(fileInfo) : m_unknownFileIcon;
}
    virtual bool lessThan( const QModelIndex & left, const QModelIndex & right ) const
    {
        FolderListModel *model = static_cast<FolderListModel*>(this->sourceModel());
        if (model->isRootIndex(left) && model->isRootIndex(right)) {
            return false;
        }
        QFileInfo l = model->fileInfo(left);
        QFileInfo r = model->fileInfo(right);
        if (l.isDir() && r.isFile()) {
            return true;
        } else if (l.isFile() && r.isDir()) {
            return false;
        }
#ifdef Q_OS_WIN
        if (l.filePath().length() <= 3 || r.filePath().length() <= 3) {
            return l.filePath().at(0) < r.filePath().at(0);
        }
#endif
        return (l.fileName().compare(r.fileName(),Qt::CaseInsensitive) < 0);
    }
Example #12
0
void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth)
{
    depth++;
    if ( depth > 10 )
  return;

    QDir dir( dr );

    /* Opie got a different approach
     * I guess it's geek vs. consumer
     * in this case to be discussed
     */
    if ( dir.exists( ".Qtopia-ignore" ) )
  return;

    const QFileInfoList *list = dir.entryInfoList();
    if ( list ) {
  QFileInfo* fi;
  for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
      QString bn = fi->fileName();
      if ( bn[0] != '.' ) {
    if ( fi->isDir()  ) {
        if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" )
      findChildren(fi->filePath(), mimeFilters, reference, depth);
    } else {
        if ( fi->extension(FALSE) == "desktop" ) {
      DocLnk* dl = new DocLnk( fi->filePath() );
      QFileInfo fi2(dl->file());
      bool match = FALSE;
      if ( !fi2.exists() ) {
          dir.remove( dl->file() );
      }
      if ( mimeFilters.count() == 0 ) {
          add( dl );
          match = TRUE;
      } else {
          for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) {
        if ( (*it).match(dl->type()) >= 0 ) {
            add(dl);
            match = TRUE;
        }
          }
      }
      if ( !match )
          delete dl;
        } else {
      if ( !reference.find(fi->fileName()) )
          reference.insert(fi->filePath(), (void*)2);
        }
    }
      }
  }
    }
}
QString fixupPathForMac(const QString& directory) {
    // On OS X `directory` does not work as expected unless a file is included in the path, so we append a bogus
    // filename if the directory is valid.
    QString path = "";
    QFileInfo fileInfo = QFileInfo(directory);
    if (fileInfo.isDir()) {
        fileInfo.setFile(directory, "__HIFI_INVALID_FILE__");
        path = fileInfo.filePath();
    }
    return path;
}
Example #14
0
void Folder::checkLocalPath()
{
    const QFileInfo fi(_definition.localPath);

    if( fi.isDir() && fi.isReadable() ) {
        qDebug() << "Checked local path ok";
    } else {
        // Check directory again
        if( !FileSystem::fileExists(_definition.localPath, fi) ) {
            _syncResult.setErrorString(tr("Local folder %1 does not exist.").arg(_definition.localPath));
            _syncResult.setStatus( SyncResult::SetupError );
        } else if( !fi.isDir() ) {
            _syncResult.setErrorString(tr("%1 should be a folder but is not.").arg(_definition.localPath));
            _syncResult.setStatus( SyncResult::SetupError );
        } else if( !fi.isReadable() ) {
            _syncResult.setErrorString(tr("%1 is not readable.").arg(_definition.localPath));
            _syncResult.setStatus( SyncResult::SetupError );
        }
    }
}
/** Get the folder which is the target of one's double-click. */
void FileSystemTreeView::convertIndex(const QModelIndex &index)
{
	QFileInfo fileInfo = _fileSystemModel->fileInfo(index);
	if (fileInfo.isDir()) {
		emit folderChanged(_fileSystemModel->filePath(index));
	} else {
		QStringList tracks;
		tracks << "file://" + fileInfo.absoluteFilePath();
		emit aboutToInsertToPlaylist(-1, tracks);
	}
}
Example #16
0
void Config::setSslCertificatesPath(const QString& sslCertificatesPath)
{
    QFileInfo sslPathInfo = QFileInfo(sslCertificatesPath);
    if (sslPathInfo.isDir()) {
        if (sslCertificatesPath.endsWith('/'))
            m_sslCertificatesPath = sslCertificatesPath + "*";
        else
            m_sslCertificatesPath = sslCertificatesPath + "/*";
    } else {
        m_sslCertificatesPath = sslCertificatesPath;
    }
}
Example #17
0
/*!
    \internal

    Returns the canonicalized form of \a path (i.e., with all symlinks
    resolved, and all redundant path elements removed.
*/
QString QFSFileEnginePrivate::canonicalized(const QString &path)
{
    if (path.isEmpty())
        return path;

    QFileInfo fi;
    const QChar slash(QLatin1Char('/'));
    QString tmpPath = path;
    int separatorPos = 0;
    QSet<QString> nonSymlinks;
    QSet<QString> known;

    known.insert(path);
    do {
#ifdef Q_OS_WIN
        // UNC, skip past the first two elements
        if (separatorPos == 0 && tmpPath.startsWith(QLatin1String("//")))
            separatorPos = tmpPath.indexOf(slash, 2);
        if (separatorPos != -1)
#endif
        separatorPos = tmpPath.indexOf(slash, separatorPos + 1);
        QString prefix = separatorPos == -1 ? tmpPath : tmpPath.left(separatorPos);
        if (
#ifdef Q_OS_SYMBIAN
            // Symbian doesn't support directory symlinks, so do not check for link unless we
            // are handling the last path element. This not only slightly improves performance,
            // but also saves us from lot of unnecessary platform security check failures
            // when dealing with files under *:/private directories.
            separatorPos == -1 &&
#endif
            !nonSymlinks.contains(prefix)) {
            fi.setFile(prefix);
            if (fi.isSymLink()) {
                QString target = fi.symLinkTarget();
                if (separatorPos != -1) {
                    if (fi.isDir() && !target.endsWith(slash))
                        target.append(slash);
                    target.append(tmpPath.mid(separatorPos));
                }
                tmpPath = QDir::cleanPath(target);
                separatorPos = 0;

                if (known.contains(tmpPath))
                    return QString();
                known.insert(tmpPath);
            } else {
                nonSymlinks.insert(prefix);
            }
        }
    } while (separatorPos != -1);

    return QDir::cleanPath(tmpPath);
}
Example #18
0
bool ContainersSortFilterProxyModel::filterAcceptsRow(
        int source_row, const QModelIndex &source_parent) const
{
    if (const QFileSystemModel *fsm =
        qobject_cast<const QFileSystemModel*>(this->sourceModel()))
    {
        const QFileInfo fi = fsm->fileInfo(fsm->index(source_row, 0,
                                                      source_parent));
        return (fi.isDir() || Helper::isArchiveFile(fi));
    }
    return true;
}
// Locate a binary in a directory, applying all kinds of
// extensions the operating system supports.
static QString checkBinary(const QDir &dir, const QString &binary)
{
    // naive UNIX approach
    const QFileInfo info(dir.filePath(binary));

    if (info.isFile() && info.isExecutable()) {
        return info.absoluteFilePath();
    }

    // Does the OS have some weird extension concept or does the
    // binary have a 3 letter extension?
    if (pathOS == OS_Unix) {
        return QString();
    }
    const int dotIndex = binary.lastIndexOf(QLatin1Char('.'));
    if (dotIndex != -1 && dotIndex == binary.size() - 4) {
        return QString();
    }

    switch (pathOS) {
    case OS_Unix:
        break;
    case OS_Windows:
    {
        static const char *windowsExtensions[] = { ".cmd", ".bat", ".exe", ".com" };
        // Check the Windows extensions using the order
        const int windowsExtensionCount = sizeof(windowsExtensions) / sizeof(const char *);
        for (int e = 0; e < windowsExtensionCount; e++) {
            const QFileInfo windowsBinary(dir.filePath(binary + QLatin1String(windowsExtensions[e])));
            if (windowsBinary.isFile() && windowsBinary.isExecutable()) {
                return windowsBinary.absoluteFilePath();
            }
        }
    }
    break;
    case OS_Mac:
    {
        // Check for Mac app folders
        const QFileInfo appFolder(dir.filePath(binary + QLatin1String(".app")));
        if (appFolder.isDir()) {
            QString macBinaryPath = appFolder.absoluteFilePath();
            macBinaryPath += QLatin1String("/Contents/MacOS/");
            macBinaryPath += binary;
            const QFileInfo macBinary(macBinaryPath);
            if (macBinary.isFile() && macBinary.isExecutable()) {
                return macBinary.absoluteFilePath();
            }
        }
    }
    break;
    }
    return QString();
}
Example #20
0
/**
  * Fills up the parent sync file with all the content of folders in the folder action group.
  * Recursively calls itself when finds a folder.
  */
void SyncAction::createSyncFileFromFolders(SyncFile * parent, FolderActionGroup * f*g)
{
    QSet<QString> entries;

    for (int i = 0; i < f*g->count(); ++i) {
        //Creating a set of all file names ---------------------------------

        QDir sync_dir(f*g->at(i));
        if (!sync_dir.exists()) continue;

        entries.unite(sync_dir.entryList(exception_bundle->filters(), static_cast<QDir::Filter>(dir_filters), (QDir::Name | QDir::DirsFirst | QDir::IgnoreCase)).toSet());
    }

    QFileInfo fi;
    FolderActionGroup * child_dirs_fag = NULL;
    SyncFile * sf = NULL;

    foreach (QString entry, entries) {

        if (exception_bundle->cdAndCheck(entry)) { // +++ Blacklisted +++
            skipped_count++;
        }
        else { // +++ Not in blacklist +++
            sf = parent->addChild(entry);

            for (int n = 0; n < f*g->count(); ++n) {
                // Obtaining absolute paths for the file names ---------------------
                fi.setFile(QDir(f*g->at(n)).absoluteFilePath(entry));

                if (fi.exists()) {
                    if (fi.isDir()) {
                        sf->setDir(true);
                        if (!child_dirs_fag) child_dirs_fag = new FolderActionGroup;
                        child_dirs_fag->insert(f*g->idAt(n), fi.absoluteFilePath());
                    }

                    sf->addFolder(f*g->idAt(n));
                }
            }

            //sf->setBlacklisted(exception_bundle->isInBlacklist());
            if (child_dirs_fag) {
                createSyncFileFromFolders(sf, child_dirs_fag);

                delete child_dirs_fag; child_dirs_fag = NULL;
            }
        }

        exception_bundle->cdUp();
    }

    f*g = NULL;
}
Example #21
0
QString FilteredDirIterator::next()
{
    if (m_firstItem) {
        m_firstItem = false;
        m_filePath = m_currentIter->path();
        return m_filePath;
    }

    m_filePath.clear();
    if (!m_currentIter) {
        return QString();
    }

    while (!m_currentIter->hasNext()) {
        delete m_currentIter;
        m_currentIter = nullptr;

        if (!m_paths.isEmpty()) {
            const QString path = m_paths.pop();
            m_currentIter = new QDirIterator(path, m_filters);
        } else {
            return QString();
        }
    }

    m_filePath = m_currentIter->next();
    const QFileInfo info = m_currentIter->fileInfo();

    if (info.isDir()) {
        if (shouldIndexFolder(m_filePath)) {
            m_paths.push(m_filePath);
            return m_filePath;
        } else {
            return next();
        }
    }
    else if (info.isFile()) {
        bool shouldIndexHidden = false;
        if (m_config)
            shouldIndexHidden = m_config->indexHiddenFilesAndFolders();

        bool shouldIndexFile = (!info.isHidden() || shouldIndexHidden)
                               && (!m_config || m_config->shouldFileBeIndexed(info.fileName()));
        if (shouldIndexFile) {
            return m_filePath;
        } else {
            return next();
        }
    }
    else {
        return next();
    }
}
Example #22
0
QVariantMap FileSystem::toMap(const QFileInfo& info)
{
    QVariantMap map;
    map.insert("path", info.filePath());
    map.insert("name", info.fileName());
    map.insert("extension", info.suffix());
    map.insert("size", info.size());
    map.insert("modified", info.lastModified());
    map.insert("isDir", info.isDir());
    map.insert("isFile", info.isFile());
    return map;
}
Example #23
0
	SyncConfLevel Plugin::CouldSync (const QString& path)
	{
		QFileInfo fi (path);
		if (!fi.isDir () || !fi.isWritable ())
			return SyncConfLevel::None;

		if (fi.dir ().entryList (QDir::Dirs).contains (".rockbox", Qt::CaseInsensitive) ||
			fi.dir ().entryList (QDir::Dirs).contains ("music", Qt::CaseInsensitive))
			return SyncConfLevel::High;

		return SyncConfLevel::Medium;
	}
Example #24
0
void ThumbnailModel::addThumbnail(QFileInfo fi) {
	ThumbnailModelItem i;
	i.icon = QIcon(new ThumbnailEngine(fi));
	i.label = fi.fileName();
	i.absPath = fi.absoluteFilePath();
	i.isDir = fi.isDir();

	int row = data_vector.size();
	beginInsertRows(QModelIndex(), row, row);
	data_vector.append(i);
	endInsertRows();
}
Example #25
0
// Recurse through the directory and gather a count on how many files there are to process.
// This is used for the progressbar info.
int GameHandler::buildFileCount(QString directory, GameHandler *handler)
{
    int filecount = 0;
    QDir RomDir(directory);

    // If we can't read it's contents move on
    if (!RomDir.isReadable())
        return 0;

    QFileInfoList List = RomDir.entryInfoList();
    for (QFileInfoList::const_iterator it = List.begin();
         it != List.end(); ++it)
    {
        QFileInfo Info = *it;
        QString RomName = Info.fileName();

        if (RomName == "." ||
            RomName == "..")
        {
            continue;
        }

        if (Info.isDir())
        {
            filecount += buildFileCount(Info.filePath(), handler);
            continue;
        }
        else
        {
            if (handler->validextensions.count() > 0)
            {
                QRegExp r;

                r.setPattern("^" + Info.suffix() + "$");
                r.setCaseSensitivity(Qt::CaseInsensitive);
                QStringList result;
                for (int x = 0; x < handler->validextensions.size(); x++)
                {
                    QString extension = handler->validextensions.at(x);
                    if (extension.contains(r))
                        result.append(extension);
                }
                if (result.isEmpty())
                    continue;
            }

            filecount++;
        }
    }

    return filecount;
}
void QtFileIconView::readDir( const QDir &dir )
{
    if ( !dir.isReadable() )
        return;

    if ( isRoot( dir.absPath() ) )
        emit disableUp();
    else
        emit enableUp();

    clear();

    emit directoryChanged( dir.absPath() );

    const QFileInfoList *filist = dir.entryInfoList( QDir::DefaultFilter, QDir::DirsFirst | QDir::Name );

    emit startReadDir( filist->count() );

    QFileInfoListIterator it( *filist );
    QFileInfo *fi;
    bool allowRename = FALSE, allowRenameSet = FALSE;
    while ( ( fi = it.current() ) != 0 ) {
        ++it;
        if ( fi && fi->fileName() == ".." && ( fi->dirPath() == "/" || fi->dirPath().isEmpty() ) )
            continue;
        emit readNextDir();
        QtFileIconViewItem *item = new QtFileIconViewItem( this, new QFileInfo( *fi ) );
        if ( fi->isDir() )
            item->setKey( QString( "000000%1" ).arg( fi->fileName() ) );
        else
            item->setKey( fi->fileName() );
        if ( !allowRenameSet ) {
            if ( !QFileInfo( fi->absFilePath() ).isWritable() ||
                    item->text() == "." || item->text() == ".." )
                allowRename = FALSE;
            else
                allowRename = TRUE;
            if ( item->text() == "." || item->text() == ".." )
                allowRenameSet = FALSE;
            else
                allowRenameSet = TRUE;
        }
        item->setRenameEnabled( allowRename );
    }

    if ( !QFileInfo( dir.absPath() ).isWritable() )
        emit disableMkdir();
    else
        emit enableMkdir();

    emit readDirDone();
}
Example #27
0
QVariant AdvQFileSystemModel::data( const QModelIndex& index, int role ) const {
    if( role == Qt::DecorationRole )
    {
        QFileInfo info = AdvQFileSystemModel::fileInfo(index);
        if(info.isDir())
        {
            QString folderName = info.fileName();
            if(folderName.contains(".adv"))
                return QPixmap(":/img/images/advIcon.png");
        }
    }
    return QFileSystemModel::data(index, role);
}
Example #28
0
Qt::ItemFlags EffectModel::flags(const QModelIndex &index) const {
    QFileInfo info = fileInfo(index);
    Qt::ItemFlags flags = QFileSystemModel::flags(index);
    if(info.isDir()) {
        SET_BIT(flags,Qt::ItemIsDragEnabled);
    } else {
        CLR_BIT(flags,Qt::ItemIsDragEnabled);
    }


    //SET_BIT(flags,Qt::ItemIsDragEnabled);
    return flags;
}
Example #29
0
    foreach (QFileInfo f, files){
        if (f.isDir()&&!f.isSymLink()&&f.isReadable()){
            ++count_dirs;
            dirRound(f.absoluteFilePath());

        }
        else {

            ++count_files;
            total_size+=f.size();

        }
    }
Example #30
0
void EffectDock::DelFolder(){
    QModelIndex idx = ui.tree->currentIndex();
    FAIL_RET_VOID(idx.isValid());
    bool isYes = QMessageBox::warning(this,
        QStringLiteral("警告"),QStringLiteral("是否确定要删除"),
        QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes;
    FAIL_RET_VOID (isYes);
    QFileInfo info = mpModel->fileInfo(idx);
    if(info.isDir()){
        FolderDelDlg(info.absoluteFilePath()).Run();
        mpModel->rmdir(idx);
    }
}