Improve files names extension for Gnome DE and Flatpak

This commit is contained in:
Laurent Trinques
2020-02-26 14:50:56 +01:00
parent 6535a93b66
commit 85a2600e58
5 changed files with 13 additions and 13 deletions

View File

@@ -44,10 +44,10 @@ ConductorNumExport::ConductorNumExport(QETProject *project, QWidget *parent) :
*/ */
bool ConductorNumExport::toCsv() bool ConductorNumExport::toCsv()
{ {
QString name = QObject::tr("numero_de_fileries_") + m_project->title(); QString name = QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
if(!name.endsWith(".csv")) { // if(!name.endsWith(".csv")) {
name += ".csv"; // name += ".csv";
} // }
QString filename = QFileDialog::getSaveFileName(m_parent_widget, QObject::tr("Enregister sous... "), name, QObject::tr("Fichiers csv (*.csv)")); QString filename = QFileDialog::getSaveFileName(m_parent_widget, QObject::tr("Enregister sous... "), name, QObject::tr("Fichiers csv (*.csv)"));
QFile file(filename); QFile file(filename);

View File

@@ -1237,9 +1237,9 @@ bool QETElementEditor::slot_saveAsFile()
if (fn.isEmpty()) if (fn.isEmpty())
return(false); return(false);
// //If the name doesn't end by .elmt, we add it //If the name doesn't end by .elmt, we add it
// if (!fn.endsWith(".elmt", Qt::CaseInsensitive)) if (!fn.endsWith(".elmt", Qt::CaseInsensitive))
// fn += ".elmt"; fn += ".elmt";
bool result_save = toFile(fn); bool result_save = toFile(fn);
//If the save success, the filename is keep //If the save success, the filename is keep

View File

@@ -48,7 +48,7 @@ nomenclature::~nomenclature() {
bool nomenclature::saveToCSVFile() bool nomenclature::saveToCSVFile()
{ {
// SAVE IN FILE // SAVE IN FILE
QString name = QObject::tr("nomenclature_") + QString(m_project -> title()); QString name = QObject::tr("nomenclature_") + QString(m_project -> title() + ".csv");
if (!name.endsWith(".csv")) { if (!name.endsWith(".csv")) {
name += ".csv"; name += ".csv";
} }

View File

@@ -313,7 +313,7 @@ QString ProjectView::askUserForFilePath(bool assign) {
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this, this,
tr("Enregistrer sous", "dialog title"), tr("Enregistrer sous", "dialog title"),
m_project -> currentDir(), m_project -> currentDir() + "/" + tr("sansnom") + ".qet",
tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file") tr("Projet QElectroTech (*.qet)", "filetypes allowed when saving a project file")
); );

View File

@@ -125,10 +125,10 @@ int BOMExportDialog::exec()
if (r == QDialog::Accepted) if (r == QDialog::Accepted)
{ {
//save in csv file //save in csv file
QString file_name = tr("nomenclature_") + QString(m_project ->title()); QString file_name = tr("nomenclature_") + QString(m_project ->title() + ".csv");
if (!file_name.endsWith(".csv")) { // if (!file_name.endsWith(".csv")) {
file_name += ".csv"; // file_name += ".csv";
} // }
QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)")); QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)"));
QFile file(file_path); QFile file(file_path);
if (!file_path.isEmpty()) if (!file_path.isEmpty())