summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/validate_xml.py36
-rw-r--r--src/bookmarks/CMakeLists.txt5
-rw-r--r--src/bookmarks/bookmarkstreeitem.hpp4
-rw-r--r--src/panels/bookmarkstoolbar.cpp1
4 files changed, 45 insertions, 1 deletions
diff --git a/scripts/validate_xml.py b/scripts/validate_xml.py
new file mode 100755
index 00000000..4f716d60
--- /dev/null
+++ b/scripts/validate_xml.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+# ============================================================
+# The rekonq project
+# ============================================================
+# SPDX-License-Identifier: GPL-3.0-only
+# Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
+# ============================================================
+""" Validate xml files """
+
+
+import argparse
+import sys
+from lxml import etree
+
+
+def validate(xml_path: str, validator) -> bool:
+ ''' Load and validate file using lxml '''
+ xml_doc = etree.parse(xml_path)
+ return validator.validate(xml_doc)
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description='Validate xml files')
+ parser.add_argument('files', type=str, nargs='+', help='One or more files to validate')
+ parser.add_argument('--dtd', type=str, help='DTD')
+ args = parser.parse_args()
+
+ validator = etree.DTD(args.dtd)
+ files_ok = True
+ for file in args.files:
+ if not validate(file, validator):
+ print(f'{file} failed validation')
+ files_ok = False
+
+ if not files_ok:
+ sys.exit('validation failed')
diff --git a/src/bookmarks/CMakeLists.txt b/src/bookmarks/CMakeLists.txt
index 3f89c74f..0e9fef9e 100644
--- a/src/bookmarks/CMakeLists.txt
+++ b/src/bookmarks/CMakeLists.txt
@@ -16,4 +16,9 @@ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_executable(xbel test/xbel.cpp)
target_link_libraries(xbel GTest::gtest GTest::gtest_main bookmarks)
gtest_discover_tests(xbel WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
+
+ add_test(NAME bookmarks.validate_xml
+ COMMAND ${PROJECT_SOURCE_DIR}/scripts/validate_xml.py --dtd=${CMAKE_CURRENT_SOURCE_DIR}/test/xbel-1.0.dtd
+ ${CMAKE_CURRENT_SOURCE_DIR}/test/bookmarks.xbel
+ )
endif()
diff --git a/src/bookmarks/bookmarkstreeitem.hpp b/src/bookmarks/bookmarkstreeitem.hpp
index caed1ecb..91d4ab2a 100644
--- a/src/bookmarks/bookmarkstreeitem.hpp
+++ b/src/bookmarks/bookmarkstreeitem.hpp
@@ -40,7 +40,9 @@ public:
template <typename T> [[nodiscard]] QAction *action(T *sender, rekonq::OpenType type) const
{
- auto *action = new QAction(m_data.title, sender);
+ auto *action = new QAction(m_icon, m_data.title, sender);
+ action->setIconVisibleInMenu(true);
+ action->setToolTip(m_data.description.isEmpty() ? m_data.title : m_data.description);
QObject::connect(action, &QAction::triggered, sender,
[this, sender, type]() { emit sender->loadUrl(m_data.href, type); });
return action;
diff --git a/src/panels/bookmarkstoolbar.cpp b/src/panels/bookmarkstoolbar.cpp
index 01a7db30..c616410e 100644
--- a/src/panels/bookmarkstoolbar.cpp
+++ b/src/panels/bookmarkstoolbar.cpp
@@ -16,6 +16,7 @@ constexpr int elide_width = 100;
BookmarkToolBar::BookmarkToolBar(QWidget *parent) : QToolBar(parent)
{
+ setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
/*
setContextMenuPolicy(Qt::CustomContextMenu);