Files
ports/sysutils/krename/patches/patch-src_podofoplugin_cpp
2025-09-12 16:40:28 +00:00

41 lines
1.9 KiB
Plaintext

https://gitlab.archlinux.org/archlinux/packaging/packages/krename/-/blob/main/podofo-0.10.patch?ref_type=heads
Index: src/podofoplugin.cpp
--- src/podofoplugin.cpp.orig
+++ src/podofoplugin.cpp
@@ -61,6 +61,26 @@ QString PodofoPlugin::processFile(BatchRenamer *b, int
try {
PdfMemDocument doc;
doc.Load(filename.toUtf8().data());
+#if (PODOFO_VERSION_MINOR>=10 || PODOFO_VERSION_MAJOR>=1)
+ const PdfInfo *info = doc.GetInfo();
+
+ if (token == "pdfauthor") {
+
+ return info->GetAuthor().has_value() ? QString::fromUtf8(info->GetAuthor()->GetString().c_str()) : QString();
+ } else if (token == "pdfcreator") {
+ return info->GetCreator().has_value() ? QString::fromUtf8(info->GetCreator()->GetString().c_str()) : QString();
+ } else if (token == "pdfkeywords") {
+ return info->GetKeywords().has_value() ? QString::fromUtf8(info->GetKeywords()->GetString().c_str()) : QString();
+ } else if (token == "pdfsubject") {
+ return info->GetSubject().has_value() ? QString::fromUtf8(info->GetSubject()->GetString().c_str()) : QString();
+ } else if (token == "pdftitle") {
+ return info->GetTitle().has_value() ? QString::fromUtf8(info->GetTitle()->GetString().c_str()) : QString();
+ } else if (token == "pdfproducer") {
+ return info->GetProducer().has_value() ? QString::fromUtf8(info->GetProducer()->GetString().c_str()) : QString();
+ } else if (token == "pdfpages") {
+ return QString::number(doc.GetPages().GetCount());
+ }
+#else
PdfInfo *info = doc.GetInfo();
if (token == "pdfauthor") {
@@ -78,6 +98,7 @@ QString PodofoPlugin::processFile(BatchRenamer *b, int
} else if (token == "pdfpages") {
return QString::number(doc.GetPageCount());
}
+#endif
} catch (PdfError &error) {
return QString::fromUtf8(error.what());
}