");
+ // Begin the table for the entries in this group
+ auto table = QString("
");
- // Begin formatting this item into HTML
- item.append(PixmapToHTML(entry->iconPixmap(IconSize::Medium)));
- item.append(" ");
- item.append(entry->title().toHtmlEscaped());
- item.append("\n"
- "");
+ // Output the entries in this group
+ for (const auto entry : entries) {
+
+ // Here we collect the table rows with this entry's data fields
+ QString item;
// Output the fixed fields
const auto& u = entry->username();
@@ -230,17 +224,31 @@ bool HtmlExporter::writeGroup(QIODevice& device, const Group& group, QString pat
item.append("| ");
item.append(key.toHtmlEscaped());
item.append(" | ");
- item.append(attr->value(key).toHtmlEscaped().replace("\n", " "));
+ item.append(attr->value(key).toHtmlEscaped().replace(" ", " ").replace("\n", " "));
item.append(" |
");
}
}
- // Done with this entry
- item.append("
\n");
- if (device.write(item.toUtf8()) == -1) {
- m_error = device.errorString();
- return false;
- }
+ // Skip if everything is empty
+ if (item.isEmpty())
+ continue;
+
+ // Output it into our table. First the left side with
+ // icon and entry title ...
+ table += "";
+ table += "| " + PixmapToHTML(entry->iconPixmap(IconSize::Medium)) + " | ";
+ table += "" + entry->title().toHtmlEscaped() + " | ";
+
+ // ... then the right side with the data fields
+ table += " | ";
+ table += "
";
+ }
+
+ // Output the complete table of this group
+ table.append("
\n");
+ if (device.write(table.toUtf8()) == -1) {
+ m_error = device.errorString();
+ return false;
}
// Recursively output the child groups