Skip to content

Commit

Permalink
https://github.com/StephaneCouturier/Katalog/issues/543
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneCouturier committed Jul 23, 2024
1 parent 21378b7 commit 71e755e
Show file tree
Hide file tree
Showing 9 changed files with 560 additions and 534 deletions.
2 changes: 2 additions & 0 deletions src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,12 @@ bool Device::verifyDeviceNameExists()
SELECT COUNT(*)
FROM device
WHERE device_name = :device_name
AND device_type =:device_type
)");

query.prepare(querySQL);
query.bindValue(":device_name", name);
query.bindValue(":device_type", type);

if (!query.exec() and ID !=0) {
qDebug() << "DEBUG: Error executing verifyDeviceNameExists:" << query.lastError().text();
Expand Down
16 changes: 10 additions & 6 deletions src/mainwindow_tab_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,16 +1107,22 @@ void MainWindow::saveDeviceForm()
if (previousName != activeDevice->name
and activeDevice->verifyDeviceNameExists()==true
and (activeDevice->type=="Catalog" or activeDevice->type=="Storage")){
//Duplicate names are not allowed for Catalogs and Storage devices
//Duplicate names are not allowed for Catalogs and for Storage devices separately (A Storage can have the same name as a Catalog)
QMessageBox msgBox;
msgBox.setWindowTitle("Katalog");
msgBox.setText( tr("There is already a Catalog or Storage with this name:<br/><b>").arg(activeDevice->type)
+ activeDevice->name
+ "</b><br/><br/>"+tr("Choose a different name and try again."));
QString message;
if (activeDevice->type == "Catalog") {
message = tr("There is already a Catalog with this name:<br/><b>");
}
else if (activeDevice->type == "Storage") {
message = tr("There is already a Storage with this name:<br/><b>");
}
msgBox.setText(message + activeDevice->name + "</b><br/><br/>" + tr("Choose a different name and try again."));
msgBox.setIcon(QMessageBox::Warning);
msgBox.exec();
return;
}

if (previousExternalID != activeDevice->externalID
and activeDevice->verifyStorageExternalIDExists()==true
and activeDevice->type=="Storage"){
Expand Down Expand Up @@ -1272,8 +1278,6 @@ void MainWindow::saveDeviceForm()
//Refresh
if(collection->databaseMode=="Memory")
collection->loadCatalogFilesToTable();


}
}

Expand Down
Binary file modified src/translations/Katalog_cz_CZ.qm
Binary file not shown.
269 changes: 137 additions & 132 deletions src/translations/Katalog_cz_CZ.ts

Large diffs are not rendered by default.

Binary file modified src/translations/Katalog_de_DE.qm
Binary file not shown.
269 changes: 137 additions & 132 deletions src/translations/Katalog_de_DE.ts

Large diffs are not rendered by default.

269 changes: 137 additions & 132 deletions src/translations/Katalog_en_US.ts

Large diffs are not rendered by default.

Binary file modified src/translations/Katalog_fr_FR.qm
Binary file not shown.
269 changes: 137 additions & 132 deletions src/translations/Katalog_fr_FR.ts

Large diffs are not rendered by default.

0 comments on commit 71e755e

Please sign in to comment.