MCPcopy Create free account
hub / github.com/KDE/kid3 / selectFile

Method selectFile

src/app/cli/kid3cli.cpp:419–439  ·  view source on GitHub ↗

* Select files in the current directory. * @param paths file names * @return true if files found and selected. */

Source from the content-addressed store, hash-verified

417 * @return true if files found and selected.
418 */
419bool Kid3Cli::selectFile(const QStringList& paths)
420{
421 bool ok = true;
422 FileProxyModel* model = m_app->getFileProxyModel();
423 for (const QString& fileName : paths) {
424 QModelIndex index = model->index(fileName);
425 if (!index.isValid() && fileName.startsWith(QLatin1Char(':'))) {
426 // The FileSystemModel considers paths starting with a colon as invalid,
427 // retry with a relative path. See also comment about QResource in
428 // Kid3Application::openDirectory().
429 index = model->index(QLatin1String("./") + fileName);
430 }
431 if (index.isValid()) {
432 m_app->getFileSelectionModel()->setCurrentIndex(
433 index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
434 } else {
435 ok = false;
436 }
437 }
438 return ok;
439}
440
441/**
442 * Update the currently selected files from the frame tables.

Callers 1

startCommandMethod · 0.45

Calls 3

indexMethod · 0.45
isValidMethod · 0.45
setCurrentIndexMethod · 0.45

Tested by

no test coverage detected