MCPcopy Create free account
hub / github.com/KDE/labplot / fileNameChanged

Method fileNameChanged

src/frontend/datasources/ImportProjectDialog.cpp:482–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482void ImportProjectDialog::fileNameChanged(const QString& name) {
483 QString fileName{name};
484
485 // make relative path
486#ifdef HAVE_WINDOWS
487 if (!fileName.isEmpty() && fileName.at(1) != QLatin1Char(':'))
488#else
489 if (!fileName.isEmpty() && fileName.at(0) != QLatin1Char('/'))
490#endif
491 fileName = QDir::homePath() + QStringLiteral("/") + fileName;
492
493 bool fileExists = QFile::exists(fileName);
494 if (!fileExists) {
495 // file doesn't exist -> delete the content preview that is still potentially
496 // available from the previously selected file
497 delete ui.tvPreview->model();
498 ui.tvPreview->setModel(nullptr);
499 m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
500 return;
501 }
502
503 refreshPreview();
504}
505
506void ImportProjectDialog::newFolder() {
507 const QString& path = m_cbFileName->currentText();

Callers

nothing calls this directly

Calls 5

buttonMethod · 0.80
isEmptyMethod · 0.45
modelMethod · 0.45
setModelMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected