book = books.get(i);
child = new NTreeWidgetItem();
child.setChildIndicatorPolicy(ChildIndicatorPolicy.DontShowIndicatorWhenChildless);
child.setText(0, book.getName());
if (icons != null && !icons.containsKey(book.getGuid())) {
QIcon icon = findDefaultIcon(book.getGuid(), book.getName(), localBooks, book.isPublished());
child.setIcon(0, icon);
} else {
child.setIcon(0, icons.get(book.getGuid()));
}
child.setTextAlignment(1, ra.value());
child.setText(2, book.getGuid());
if (book.getStack() == null || book.getStack().equalsIgnoreCase(""))
addTopLevelItem(child);
else {
String stackName = book.getStack();
QTreeWidgetItem parent;
if (!stacks.containsKey(stackName)) {
parent = createStackIcon(stackName, ra);
addTopLevelItem(parent);
stacks.put(stackName, parent);
} else
parent = stacks.get(stackName);
parent.addChild(child);
}
}
sortItems(0, SortOrder.AscendingOrder);
if (Global.mimicEvernoteInterface) {
String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
QIcon allIcon = db.getSystemIconTable().getIcon("All Notebooks", "ALLNOTEBOOK");
if (allIcon == null)
allIcon = new QIcon(iconPath+"notebook-green.png");
child = new NTreeWidgetItem();
child.setIcon(0, allIcon);
child.setText(0, tr("All Notebooks"));
child.setText(2, "");