当前位置: 首页>>代码示例>>C++>>正文


C++ QFileInfo::absFilePath方法代码示例

本文整理汇总了C++中QFileInfo::absFilePath方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfo::absFilePath方法的具体用法?C++ QFileInfo::absFilePath怎么用?C++ QFileInfo::absFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QFileInfo的用法示例。


在下文中一共展示了QFileInfo::absFilePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dir

DocEntry *DocMetaInfo::scanMetaInfoDir(const QString &dirName, DocEntry *parent)
{
    QDir dir(dirName);
    if(!dir.exists())
        return 0;

    const QFileInfoList_qt3 *entryList = dir.entryInfoList_qt3();
    QFileInfoListIterator it(*entryList);
    QFileInfo *fi;
    for(; (fi = it.current()); ++it)
    {
        DocEntry *entry = 0;
        if(fi->isDir() && fi->fileName() != "." && fi->fileName() != "..")
        {
            DocEntry *dirEntry = addDirEntry(QDir(fi->absFilePath()), parent);
            entry = scanMetaInfoDir(fi->absFilePath(), dirEntry);
        }
        else if(fi->extension(false) == "desktop")
        {
            entry = addDocEntry(fi->absFilePath());
            if(parent && entry)
                parent->addChild(entry);
        }
    }

    return 0;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:27,代码来源:docmetainfo.cpp

示例2: rescanFolder

void FileSystemScanner::rescanFolder(Folder* folder, bool forceEXIF)
{
    QString currentFolderPath = folder->dir()->absPath();

    tracer->sdebug(__func__) << "adding files in folder: " << folder->id() << ": " << currentFolderPath << endl;

    emit(progress_scanningFolder(currentFolderPath));
    
    // this method is called regularly while rescanning the filesystem
    // before doing something here we process all outstanding events!
    KApplication::kApplication()->processEvents();
    if (m_cancel) {
        return;
    }

    if (!folder->dir()->exists()) {
        tracer->swarning(__func__) << "folder: " << folder->id() << ": " << currentFolderPath
                << " does no longer exist --> ignoring it!!!" << endl;
    }

    // get a list with all files in the current folder
    const QFileInfoList* filelist = folder->dir()->entryInfoList(QDir::Files);
    if (filelist) {
        QFileInfoListIterator iterator( *filelist );
        QFileInfo* fileInfo;
        while ((fileInfo = iterator.current()) != 0) {

            // only add jpeg files
            if (mustHandleFile(fileInfo->fileName())) {

                File* file = m_engine->m_fileDict->find(fileInfo->absFilePath());
                if (!file) {
                    // the file is seen for the first time --> create it
                    tracer->sdebug(__func__) << "found new file to add: '" << fileInfo->absFilePath() << "'" << endl;
                    file = new File(m_engine, folder, new QFileInfo(*fileInfo));
                    m_engine->dirtyfy();

                    folder->appendFile(file);
                    m_engine->m_fileList->append(file);
                    m_engine->m_fileDict->insert(file->fileInfo()->absFilePath(), file);

                    emit(newFile(file));
                    
                    // read exif data from the file and store this data in the database
                    readEXIF(file);
                } else {
                    // this file already exists in the database --> reread EXIF data if forceEXIF is true
                    if (forceEXIF) {
                        readEXIF(file);
                    }
                }
            }
            ++iterator;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:kphotobook-svn,代码行数:56,代码来源:filesystemscanner.cpp

示例3: installedAPIFiles

// Return installed API files.
QStringList QsciAPIs::installedAPIFiles() const
{
    const char *qtdir = getenv("QTDIR");

    if (!qtdir)
        return QStringList();

    QDir apidir = QDir(QString("%1/qsci/api/%2").arg(qtdir).arg(lexer()->lexer()));
    QStringList filenames;

    const QFileInfoList *flist = apidir.entryInfoList("*.api", QDir::Files, QDir::IgnoreCase);

    if (flist)
    {
        QPtrListIterator<QFileInfo> it(*flist);
        QFileInfo *fi;

        while ((fi = it.current()) != 0)
        {
            filenames << fi->absFilePath();
            ++it;
        }
    }

    return filenames;
}
开发者ID:fusigi0930,项目名称:qnotepad-pp,代码行数:27,代码来源:qsciapis.cpp

示例4: s

Biff::Biff( QWidget *parent, const char *name )
    : QWidget( parent, name, WShowModal | WType_Dialog )
{
    QFileInfo fi = QString(getenv( "MAIL" ));
    if ( !fi.exists() ) {
	QString s( "/var/spool/mail/" );
	s += getlogin();
	fi.setFile( s );
    }

    if ( fi.exists() ) {
	mailbox = fi.absFilePath();
	startTimer( 1000 );
    }

    setMinimumSize( 48, 48 );
    setMaximumSize( 48, 48 );
    resize( 48, 48 );

    hasNewMail.loadFromData( hasmail_bmp_data, hasmail_bmp_len );
    noNewMail.loadFromData( nomail_bmp_data, nomail_bmp_len );

    gotMail = FALSE;
    lastModified = fi.lastModified();
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:25,代码来源:biff.cpp

示例5: fillList

void AdminDatabase::fillList()
{
	m_listView->clear();
	const QFileInfoList *files = m_dumpDir->entryInfoList("*.sql");
	
	if ( files )
	{
		QFileInfoListIterator it( *files );
		QFileInfo * fi = 0;
		while( (fi=it.current()) != 0 )
		{
			++it;
			KListViewItem *item = new KListViewItem(m_listView);
			
			item->setText(0, fi->baseName().section('.', 0,0) );
			
			QFile tmp(fi->absFilePath());
			tmp.open(IO_ReadOnly);
			QTextStream stream( &tmp );
			item->setText(1, stream.readLine().section("--",1,1));
			tmp.close();
			item->setText(2, fi->created().toString(Qt::ISODate));
		}
		
	}
}
开发者ID:BackupTheBerlios,项目名称:kludoteca-svn,代码行数:26,代码来源:admindatabase.cpp

示例6: parseCmdLine

/**
 * Parses the command line, after it was stripped of its KDE options.
 * The command line may contain one of the following options:
 * 1. A project file (named cscope.proj)
 * 2. A Cscope cross-reference database
 * 3. A list of source files
 * @param	pArgs	Command line arguments
 */
void KScope::parseCmdLine(KCmdLineArgs* pArgs)
{
	QString sArg;
	QFileInfo fi;
	int i;

	// Loop over all arguments
	for (i = 0; i < pArgs->count(); i++) {
		// Verify the argument is a file or directory name
		sArg = pArgs->arg(i);
		fi.setFile(sArg);
		if (!fi.exists())
			continue;
			
		// Handle the current argument
		if (fi.isFile()) {
			if (fi.fileName() == "cscope.proj") {
				// Open a project file
				openProject(fi.dirPath(true));
				return;
			} else if (openCscopeOut(sArg)) {
				// Opened the file as a cross-reference database
				return;
			} else {
				// Assume this is a source file
				slotShowEditor(sArg, 0);
			}
		} else if (fi.isDir()) {
			// Treat the given path as a project directory
			openProject(fi.absFilePath());
			return;
		}
	}
}
开发者ID:VicHao,项目名称:kkscope,代码行数:42,代码来源:kscope.cpp

示例7: s

biff::biff(QWidget *parent, const char *name) : QWidget(parent, name)
{
    QString s(getenv("MAIL"));
    QFileInfo fi = s;
    if(! fi.exists())
    {
        s = MAILDIR;
        s += getlogin();
        fi.setFile(s);
    }

    if(fi.exists())
    {
        mailfile = fi.absFilePath();
        startTimer(3000);
    }
    else
    {
        perror((const char *)s);
        exit(1);
    }

    hasmail = QPixmap((const char **)mail_xpm);
    newmail = QPixmap((const char **)newmail_xpm);

    mailstate = Empty;
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:27,代码来源:biff.cpp

示例8: findResource

QString Util::findResource(QString filename)
{
    QFileInfo fi = QFileInfo(filename);
    if (fi.exists()) {
        return fi.absFilePath();
    }

    fi = QFileInfo(EXECUTABLE_PATH + "/" + filename);
    if (fi.exists()) {
        return fi.absFilePath();
    }

    fi = QFileInfo(QString("/usr/share/poa/") + filename);
    if (fi.exists()) {
        return fi.absFilePath();
    }

    return QString();
}
开发者ID:BackupTheBerlios,项目名称:poa,代码行数:19,代码来源:util.cpp

示例9: readDir

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();
}
开发者ID:natros,项目名称:qt-mac-free-3.3.8,代码行数:52,代码来源:qfileiconview.cpp

示例10: getNextTempFilename

QString SoundFile::getNextTempFilename()
{
    //QString tempFileFolder = gdata->settings.getString("General", "tempFilesFolder");
    QString tempFileFolder = gdata->qsettings->value("General/tempFilesFolder", QDir::convertSeparators(QDir::currentDirPath())).toString();
    QDir dir = QDir(tempFileFolder);
    QFileInfo fileInfo;
    QString fileName;
    bool fileExists;
    int index = 1;
    do {
        fileExists = false;
        fileName.sprintf("temp%03d.wav", index);
        //printf("trying %s\n", fileName.latin1());
        fileInfo.setFile(dir, fileName);
        if(fileInfo.exists()) {
            fileExists = true;
            index++;
        }
    } while(fileExists);
    return fileInfo.absFilePath();
}
开发者ID:Guildenstern,项目名称:Tartini,代码行数:21,代码来源:soundfile.cpp

示例11: parseKdelnkDir

short KApplicationTree::parseKdelnkDir( QDir d, KTreeList *tree, KAppTreeListItem *item)
{
  if( !d.exists() )
    return -1;

  d.setSorting( SORT_SPEC );
  QList <QString> item_list;
	
  const QFileInfoList *list = d.entryInfoList();
  QFileInfoListIterator it( *list );
  QFileInfo *fi;

  if( it.count() < 3 )
    return -1;

  while( ( fi = it.current() ) )
  {
    if( fi->fileName() == "." || fi->fileName() == ".." )
    {
      ++it;
      continue;
    }
    if( fi->isDir() )
    {
      parseKdelnkFile( fi, tree, item );
    }
    else 
    {
      if( !isKdelnkFile( fi->absFilePath() ) )
      {
	++it;
	continue;
      }
      parseKdelnkFile( fi, tree, item );
    } 
    ++it;
  }
  
  return 0;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:40,代码来源:open-with.cpp

示例12: findModules

/*!
    \fn myQLoader::findModules()
 */
void myQLoader::findModules()
{
  QString s; // = qApp->applicationDirPath();
  setAplDir(s);
  QDir d(s+"/modules");
  
  d.setFilter(QDir::Files);
  d.setNameFilter("*.so");
  
  const QFileInfoList *list = d.entryInfoList();
  QFileInfoListIterator it( *list );
  QFileInfo *fi;
  
  myInfo_modules one_module;

  while ( (fi = it.current()) != 0 ) {
	
	one_module.exec = fi->absFilePath();
	
	if(getModule_Info(one_module))
	  addToList(one_module);
	++it;
  }
}
开发者ID:peterkomar,项目名称:sct,代码行数:27,代码来源:myqloader.cpp

示例13: loadLogs

int loadLogs() {
  int logsize = 0;

  QString logdirname = locateLocal("data", "kppp/Log/");
  QDir logdir(logdirname, "*.log");

  kdDebug(5002) << "logdirname: " << logdirname << endl;
  
  // get log file size
  const QFileInfoList_qt3 *list = logdir.entryInfoList_qt3();
  QFileInfoListIterator it( *list );
  QFileInfo *fi;

  while ((fi = it.current()) != 0) {
    logsize += fi->size();
    ++it;
  }

  dlg = new QProgressDialog(i18n("Loading log files"),
			     QString::null,
			     logsize);
  dlg->setProgress(0);

  // load logs
  list = logdir.entryInfoList_qt3();
  QFileInfoListIterator it1( *list );

  int retval = 0;
  while ((fi = it1.current()) != 0) {
    retval += loadLog(fi->absFilePath());
    ++it1;
  }

  delete dlg; 
  return retval;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:36,代码来源:log.cpp

示例14: initialize


//.........这里部分代码省略.........
       insertItem(CICON("kfm"), i18n("Open in File Manager"), this, SLOT(slotOpenFileManager()));
        if (kapp->authorize("shell_access"))
            insertItem(CICON("terminal"), i18n("Open in Terminal"), this, SLOT(slotOpenTerminal()));
    }


    bool first_entry = true;
    bool dirfile_separator = false;
    int item_count = 0;
    int run_id = _startid;

    // get list iterator
    QFileInfoListIterator it(*list);

    // jump to startid
    it += _startid;

    // iterate over entry list
    for (; it.current(); ++it)
    {
        // bump id
        run_id++;

        QFileInfo *fi = it.current();
        // handle directories
        if (fi->isDir())
        {
            QString name = fi->fileName();

            // ignore . and .. entries
            if (name == "." || name == "..") continue;

            QPixmap icon;
            QString path = fi->absFilePath();

            // parse .directory if it does exist
            if (QFile::exists(path + "/.directory")) {

                KSimpleConfig c(path + "/.directory", true);
                c.setDesktopGroup();
                QString iconPath = c.readEntry("Icon");

                if ( iconPath.startsWith("./") )
                    iconPath = path + '/' + iconPath.mid(2);

                icon = KGlobal::iconLoader()->loadIcon(iconPath,
                                                       KIcon::Small, KIcon::SizeSmall,
                                                       KIcon::DefaultState, 0, true);
                if(icon.isNull())
                    icon = CICON("folder");
                name = c.readEntry("Name", name);
            }

            // use cached folder icon for directories without special icon
            if (icon.isNull())
                icon = CICON("folder");

            // insert separator if we are the first menu entry
            if(first_entry) {
                if (_startid == 0 && !_filesOnly)
                    insertSeparator();
                first_entry = false;
            }

            // append menu entry
            PanelBrowserMenu *submenu = new PanelBrowserMenu(path, this);
开发者ID:fuji7l,项目名称:KDesktop-Menu,代码行数:67,代码来源:browser_mnu.cpp

示例15: startCAProfDiffSession

bool DiffAnalystWindow::startCAProfDiffSession(QString session0, 
				QString session1, 
				QString diffSessName)
{
	SESSION_DIFF_INFO_VEC sessionInfoVec;
	QFileInfo fInfo;

	if(!session0.isEmpty() && !session1.isEmpty())
	{
		sessionInfoVec.clear();
		SESSION_DIFF_INFO info0,info1;
		bool isOk = false;

		while(1)
		{
			info0.sessionFile 	= session0.section(":",0,0);
			fInfo.setFile(info0.sessionFile);
			if(!fInfo.exists()) break;
		
			info0.task		= session0.section(":",1,1);
			if(!info0.task.isEmpty()
			&& info0.task.compare("All Tasks"))
			{
				fInfo.setFile(info0.task);
				if(!fInfo.exists()) break;
			}

			info0.module		= session0.section(":",2,2);
			fInfo.setFile(info0.module);
			if(!fInfo.exists()) break; 

			sessionInfoVec.push_back(info0);

			info1.sessionFile 	= session1.section(":",0,0);
			fInfo.setFile(info1.sessionFile);
			if(!fInfo.exists()) break;
		
			info1.task		= session1.section(":",1,1);
			if(!info1.task.isEmpty()
			&& info1.task.compare("All Tasks"))
			{
				fInfo.setFile(info1.task);
				if(!fInfo.exists()) break;
			}
		
			info1.module		= session1.section(":",2,2);
			fInfo.setFile(info1.module);
			if(!fInfo.exists()) break;

			isOk = true;
			break;
		}
	
		if(!isOk)
		{
			QMessageBox::critical(this,"DiffAnalyst Error",QString() +
				"Path not found: " + fInfo.absFilePath() + "\n\n" +
				"Please check command-line options, or use New Session Wizard.\n" );
			return false;
		}
	
		sessionInfoVec.push_back(info1);

		if(diffSessName.isEmpty())	
			diffSessName = "Untitle-1";
	}else{
		int sessionCnt = 0;

		/////////////////////////////////////////
		// Query NewSessionWizard
		if(m_pNewSessWzd == NULL)
			return false;
		
		if((sessionCnt = m_pNewSessWzd->getSessionDiffInfo(&sessionInfoVec)) <= 0)
		{
			return false;
		}


		/////////////////////////////////////////
		// Setup DiffAnalystWindowName
		diffSessName = m_pNewSessWzd->getSessionDiffName();

	}

	/////////////////////////////////////////
	// Setup DiffSession
	DiffSession *diffSess = new DiffSession(m_pWs,diffSessName.toAscii().data());
	if(diffSess == NULL) return false;
	if(!diffSess->init(sessionInfoVec)) return false;

	diffSess->showMaximized();
	
	m_pFileMenu->setItemEnabled (m_SaveId, true);
	m_pFileMenu->setItemEnabled (m_SaveAsId, true);
	m_ToolsToolId [TM_FILESAVE]->setEnabled(true);

	return true;

} //DiffAnalystWindow::startCAProfDiffSession
开发者ID:concocon,项目名称:CodeAnalyst-3_4_18_0413-Public,代码行数:100,代码来源:DiffAnalystWindow.cpp


注:本文中的QFileInfo::absFilePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。