From 8f328bef497a9e3bc628e4e294c1a70b0c8b0eab Mon Sep 17 00:00:00 2001
From: foutrelis <foutrelis@eb2447ed-0c53-47e4-bac8-5bc4a241df78>
Date: Wed, 2 Mar 2022 10:28:24 +0000
Subject: [PATCH] Fix build with poppler 22.03.0

diff -uprw a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
--- a/filters/karbon/pdf/CMakeLists.txt	2020-05-14 09:51:30.000000000 +0300
+++ b/filters/karbon/pdf/CMakeLists.txt	2022-03-02 12:19:08.039939530 +0200
@@ -14,6 +14,10 @@ if(Poppler_VERSION VERSION_LESS "0.83.0"
     add_definitions("-DHAVE_POPPLER_PRE_0_83")
 endif()
 
+if(Poppler_VERSION VERSION_LESS "22.3.0")
+    add_definitions("-DHAVE_POPPLER_PRE_22_3")
+endif()
+
 set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
 
 add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
diff -uprw a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp
--- a/filters/karbon/pdf/Pdf2OdgImport.cpp	2020-05-14 09:51:30.000000000 +0300
+++ b/filters/karbon/pdf/Pdf2OdgImport.cpp	2022-03-02 12:20:35.125605950 +0200
@@ -86,8 +86,12 @@ KoFilter::ConversionStatus Pdf2OdgImport
     if (! globalParams)
         return KoFilter::NotImplemented;
 
+#ifdef HAVE_POPPLER_PRE_22_3
     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
+#else
+    PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()));
+#endif
     if (! pdfDoc) {
 #ifdef HAVE_POPPLER_PRE_0_83
         delete globalParams;
diff -uprw a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp
--- a/filters/karbon/pdf/PdfImport.cpp	2020-05-14 09:51:30.000000000 +0300
+++ b/filters/karbon/pdf/PdfImport.cpp	2022-03-02 12:21:46.197510028 +0200
@@ -73,8 +73,12 @@ KoFilter::ConversionStatus PdfImport::co
     if (! globalParams)
         return KoFilter::NotImplemented;
 
+#ifdef HAVE_POPPLER_PRE_22_3
     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
+#else
+    PDFDoc * pdfDoc = new PDFDoc(std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data()));
+#endif
     if (! pdfDoc) {
 #ifdef HAVE_POPPLER_PRE_0_83
         delete globalParams;
