Commit b78a3ffc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix isUnique

parent c9cd360d
Pipeline #50454 passed with stage
in 41 minutes and 28 seconds
......@@ -81,11 +81,19 @@ void RemoteContentConfigureWidget::slotAdd()
QPointer<RemoteContentDialog> dlg = new RemoteContentDialog(this);
if (dlg->exec()) {
const auto info = dlg->info();
if (RemoteContentManager::self()->isUnique(info)) {
const int count = mListWidget->count();
bool isUnique = true;
for (int i = 0; i < count; ++i) {
const auto item = mListWidget->item(i);
if (item->text() == info.url()) {
isUnique = false;
KMessageBox::error(this, i18n("An entry already defines this url. Please modify it."), i18n("Add new Url"));
break;
}
}
if (isUnique) {
RemoteContentManager::self()->addRemoteContent(info);
insertRemoteContentInfo(info);
} else {
KMessageBox::error(this, i18n("An entry already defines this url. Please modify it."), i18n("Add new Url"));
}
}
delete dlg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment