1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

More custom catalogs constraints: title and sitenames are required to be unique

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1642 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Vasiliy Bout 2010-08-03 11:49:47 +00:00
parent 427640f0c3
commit 5f6b62b8de
10 changed files with 36 additions and 14 deletions

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />
<node name="alreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="titleAlreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Buchkauf" />

View file

@ -321,7 +321,8 @@
<node name="titleIsEmpty" value="Title should be non-empty" />
<node name="urlIsEmpty" value="URL should be non-empty" />
<node name="invalidUrl" value="Invalid URL" />
<node name="alreadyExists" value="Specified title already exists" />
<node name="titleAlreadyExists" value="Specified title already exists" />
<node name="siteAlreadyExists" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Purchase book" />

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />
<node name="alreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="titleAlreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Achat du livre"/>

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />
<node name="alreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="titleAlreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Könyv vásárlása" />

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" value="Il campo Titolo non può essere lasciato vuoto" />
<node name="urlIsEmpty" value="Il campo URL non può essere lasciato vuoto" />
<node name="invalidUrl" value="URL non valida" />
<node name="alreadyExists" value="Il titolo specificato è già esistente"/>
<node name="titleAlreadyExists" value="Il titolo specificato è già esistente"/>
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Libro acquistato" />

View file

@ -321,7 +321,8 @@
<node name="titleIsEmpty" value="Название не может быть пустым" />
<node name="urlIsEmpty" value="URL не может быть пустым" />
<node name="invalidUrl" value="Неверный URL" />
<node name="alreadyExists" value="Заданное название уже существует" />
<node name="titleAlreadyExists" value="Заданное название уже существует" />
<node name="siteAlreadyExists" value="Заданный сайт уже существует" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Покупка книги" />

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />
<node name="alreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="titleAlreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="Mua sách" />

View file

@ -322,7 +322,8 @@
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />
<node name="alreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="titleAlreadyExists" toBeTranslated="true" value="Specified title already exists" />
<node name="siteAlreadyExists" toBeTranslated="true" value="Specified site already exists" />
</node>
<node name="purchaseConfirmBox">
<node name="title" value="购买书籍" />

View file

@ -103,8 +103,13 @@ class CustomCatalogDialog extends NetworkDialog {
}
final NetworkLibrary library = NetworkLibrary.Instance();
if (library.hasCustomLink(myTitle, (ICustomNetworkLink) myLink)) {
final String err = myResource.getResource("alreadyExists").getValue();
if (library.hasCustomLinkTitle(myTitle, (ICustomNetworkLink) myLink)) {
final String err = myResource.getResource("titleAlreadyExists").getValue();
sendError(true, false, err);
return;
}
if (library.hasCustomLinkSite(siteName, (ICustomNetworkLink) myLink)) {
final String err = myResource.getResource("siteAlreadyExists").getValue();
sendError(true, false, err);
return;
}

View file

@ -475,13 +475,13 @@ public class NetworkLibrary {
link.saveLink();
}
public int getCustomLinksNumber() {
/*public int getCustomLinksNumber() {
return myCustomLinks.size();
}
public ICustomNetworkLink getCustomLink(int index) {
return myCustomLinks.get(index);
}
}*/
public void removeCustomLink(ICustomNetworkLink link) {
final int index = Collections.binarySearch(myCustomLinks, link, new LinksComparator());
@ -493,12 +493,21 @@ public class NetworkLibrary {
link.setSaveLinkListener(null);
}
public boolean hasCustomLink(String title, ICustomNetworkLink exeptFor) {
for (ICustomNetworkLink link: myCustomLinks) {
public boolean hasCustomLinkTitle(String title, ICustomNetworkLink exeptFor) {
for (INetworkLink link: myLinks) {
if (link != exeptFor && link.getTitle().equals(title)) {
return true;
}
}
return false;
}
public boolean hasCustomLinkSite(String siteName, ICustomNetworkLink exeptFor) {
for (INetworkLink link: myLinks) {
if (link != exeptFor && link.getSiteName().equals(siteName)) {
return true;
}
}
return false;
}
}