예제 #1
0
void QchDirectory::setCurrentPath(const QString &path) {
    if (path != currentPath()) {
        if (QDir::setCurrent(path)) {
            emit currentPathChanged();
        }
    }
}
예제 #2
0
	void DirsTreeWidget::currentChanged (const QModelIndex& current, const QModelIndex& previous)
	{
		QTreeView::currentChanged (current, previous);
		if (current.isValid()) {
			const QString& path = model_.filePath (current);
			emit currentPathChanged (path);
		}
	}
void LoadFileListTask::processDirectory(const QString &path)
{
	emit currentPathChanged(path);
    QFileInfoList fileInfoList = QDir(path).entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
	for (int j = 0; j < fileInfoList.size(); j++) {
		QFileInfo fileInfo = fileInfoList.at(j);
		if (fileInfo.isDir()) {
			processDirectory(fileInfo.filePath());
		}
		else {
			processFile(fileInfo.filePath());
		}
    }
}
예제 #4
0
/*  SLOT [private] */
void FileManager::handleItemActivation(QModelIndex index)
{
	if (m_selectionModel->selectedIndexes().count() != 1) {
		// Dont bother on multiple file activation
		return;
	}

	if (m_model->isDir(index)) {
		// Change Path
        m_currentDir.cd(m_model->filePath(index));
		m_currentIndex = m_model->setRootPath(m_currentDir.absolutePath());

		m_view->clearSelection();
		m_view->setRootIndex(m_currentIndex);
        // Set view on firstRow
		m_view->setCurrentIndex(m_currentIndex.child(0, 0));
		emit currentPathChanged();
	}
}
ctkCmdLineModuleExplorerModulesSettings::ctkCmdLineModuleExplorerModulesSettings(ctkCmdLineModuleManager *moduleManager)
  : ui(new Ui::ctkCmdLineModuleExplorerModulesSettings)
  , ModuleManager(moduleManager)
  , ShowXmlAction(new ctkCmdLineModuleExplorerShowXmlAction(this))
  , ModulesRegistered(false)
{
  ui->setupUi(this);

  ui->PathListButtonsWidget->init(ui->PathListWidget);
  ui->PathListWidget->addAction(this->ShowXmlAction);
  ui->PathListWidget->setContextMenuPolicy(Qt::ActionsContextMenu);

  this->ShowXmlAction->setEnabled(false);

  connect(ui->PathListWidget, SIGNAL(currentPathChanged(QString,QString)), SLOT(pathSelected(QString)));
  connect(ui->PathListWidget, SIGNAL(pathsChanged(QStringList,QStringList)), SLOT(pathsAdded(QStringList)));

  this->registerProperty(ctkCmdLineModuleExplorerConstants::KEY_REGISTERED_MODULES,
                         ui->PathListWidget, "paths", SIGNAL(pathsChanged(QStringList,QStringList)));
}
예제 #6
0
파일: guibehind.cpp 프로젝트: shuge/dukto
void GuiBehind::setCurrentPath(QString path)
{
    if (path == mSettings->currentPath()) return;
    mSettings->savePath(path);
    emit currentPathChanged();
}
예제 #7
0
void NRemoteFSBrowser::signal_read_dir ( Common::SignalArgs & args )
{
    SignalOptions options( args );
    QStringList completionList;
    int i;

    std::vector<std::string> dirs;
    std::vector<std::string> files;
    std::vector<std::string> dirDates;
    std::vector<std::string> fileDates;
    std::vector<Uint> fileSizes;

    std::vector<std::string>::const_iterator itDirs;
    std::vector<std::string>::const_iterator itFiles;

    m_currentPath = options.value<std::string>("dirPath").c_str();

    // add an ending '/' if the string does not have any
    if( !m_currentPath.endsWith("/") )
        m_currentPath += "/";

//  if(!m_updatingCompletion)
//    m_editPath->setText(m_currentPath);
//  else
//    m_updatingCompletion = false;

    dirs = options.array<std::string>("dirs");
    files = options.array<std::string>("files");
    dirDates = options.array<std::string>("dirDates");
    fileDates = options.array<std::string>("fileDates");
    fileSizes = options.array<Uint>("fileSizes");

    // notice the view(s) that the model is about to be completely changed
    emit layoutAboutToBeChanged();

    //clear();
    m_completionModel->setStringList( QStringList() );

    // delete old data
    while( !m_data.empty() )
        delete m_data.takeFirst();

    // add the directories
    for( i = 0, itDirs = dirs.begin() ; itDirs != dirs.end() ; ++itDirs, ++i )
    {
        FileInfo * fileInfo = new FileInfo();
        QString name = itDirs->c_str();

        fileInfo->name = name;
        fileInfo->type = DIRECTORY;

        fileInfo->dateModified = dirDates[i].c_str();

        if(!m_currentPath.isEmpty() && name != "..")
            name.prepend(m_currentPath + (m_currentPath.endsWith("/") ? "" : "/"));

        m_data.append(fileInfo);
        completionList << name;
    }

    m_completionModel->setStringList( completionList );

    // add the files
    for( i = 0, itFiles = files.begin() ; itFiles != files.end() ; ++itFiles, ++i )
    {
        FileInfo * fileInfo = new FileInfo();

        fileInfo->name = itFiles->c_str();
        fileInfo->type = FILE;
        fileInfo->dateModified = fileDates[i].c_str();
        fileInfo->fileSize = fileSizes[i];

        m_data.append(fileInfo);
    }

    // notice the view(s) that the model has finished changing
    emit layoutChanged();
    emit currentPathChanged(m_currentPath);
}