KukuRuzo

Fix some build issues and warnings

Sep 22nd, 2025
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.49 KB | None | 0 0
  1. diff --git a/iris/cmake/modules/IrisSCTP.cmake b/iris/cmake/modules/IrisSCTP.cmake
  2. index d02888b5..84056f5b 100644
  3. --- a/iris/cmake/modules/IrisSCTP.cmake
  4. +++ b/iris/cmake/modules/IrisSCTP.cmake
  5. @@ -60,10 +60,14 @@ else()
  6.          if(NOT Git_FOUND)
  7.              message(FATAL_ERROR "Git not found! Bundled UsrSCTP needs Git utility.\nPlease set GIT_EXECUTABLE variable or add git to PATH")
  8.          endif()
  9. +        # When using the "cmake --build . -t clean" command, it cleans the built files, but the next time it builds, it crashes with a patch error.
  10. +        # As an attempt to avoid this crash the last line of patch_command was added
  11.          set(patch_command
  12. -        ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/usrsctp.patch <SOURCE_DIR> &&
  13. -        ${GIT_EXECUTABLE} checkout <SOURCE_DIR>/usrsctplib/netinet/sctp_output.c &&
  14. -        ${GIT_EXECUTABLE} apply <SOURCE_DIR>/usrsctp.patch)
  15. +            ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/usrsctp.patch <SOURCE_DIR> &&
  16. +            ${GIT_EXECUTABLE} checkout <SOURCE_DIR>/usrsctplib/netinet/sctp_output.c &&
  17. +            ${GIT_EXECUTABLE} apply <SOURCE_DIR>/usrsctp.patch ||
  18. +            ${CMAKE_COMMAND} -E echo "USRSCTP Sources already patched"
  19. +        )
  20.          ExternalProject_Add(UsrSCTPProject
  21.              PREFIX ${USRSCTP_PREFIX}
  22.              BINARY_DIR ${USRSCTP_BUILD_DIR}
  23. diff --git a/iris/src/xmpp/xmpp-im/types.cpp b/iris/src/xmpp/xmpp-im/types.cpp
  24. index 6b212b70..ff22a0f7 100644
  25. --- a/iris/src/xmpp/xmpp-im/types.cpp
  26. +++ b/iris/src/xmpp/xmpp-im/types.cpp
  27. @@ -33,6 +33,10 @@
  28.  
  29.  #include <optional>
  30.  
  31. +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  32. +#include <QTimeZone>
  33. +#endif
  34. +
  35.  #define NS_XML "http://www.w3.org/XML/1998/namespace"
  36.  
  37.  namespace XMPP {
  38. @@ -1482,7 +1486,7 @@ Stanza Message::toStanza(Stream *stream) const
  39.      if (!d->reactions.targetId.isEmpty()) {
  40.          auto e = s.createElement(reactionsNS, QStringLiteral("reactions"));
  41.          e.setAttribute(QLatin1String("id"), d->reactions.targetId);
  42. -        for (const QString &reaction : d->reactions.reactions) {
  43. +        for (const QString &reaction : std::as_const(d->reactions.reactions)) {
  44.              e.appendChild(s.createTextElement(reactionsNS, QStringLiteral("reaction"), reaction));
  45.          }
  46.          s.appendChild(e);
  47. @@ -1656,7 +1660,11 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf
  48.          if (useTimeZoneOffset) {
  49.              d->timeStamp = stamp.addSecs(timeZoneOffset * 3600);
  50.          } else {
  51. +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
  52.              stamp.setTimeSpec(Qt::UTC);
  53. +#else
  54. +            stamp.setTimeZone(QTimeZone::UTC);
  55. +#endif
  56.              d->timeStamp = stamp.toLocalTime();
  57.          }
  58.          d->timeStampSend = true;
  59. diff --git a/iris/src/xmpp/xmpp-im/xmpp_mamtask.cpp b/iris/src/xmpp/xmpp-im/xmpp_mamtask.cpp
  60. index 87eee3d3..a79a3740 100644
  61. --- a/iris/src/xmpp/xmpp-im/xmpp_mamtask.cpp
  62. +++ b/iris/src/xmpp/xmpp-im/xmpp_mamtask.cpp
  63. @@ -18,6 +18,9 @@
  64.   */
  65.  
  66.  #include "xmpp_mamtask.h"
  67. +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  68. +#include <QTimeZone>
  69. +#endif
  70.  
  71.  using namespace XMLHelper;
  72.  using namespace XMPP;
  73. @@ -76,7 +79,11 @@ XData MAMTask::Private::makeMAMFilter()
  74.          XData::Field start;
  75.          start.setType(XData::Field::Field_TextSingle);
  76.          start.setVar(QLatin1String("start"));
  77. +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
  78.          from.setTimeSpec(Qt::UTC);
  79. +#else
  80. +        from.setTimeZone(QTimeZone::UTC);
  81. +#endif
  82.          start.setValue(QStringList(from.toString()));
  83.          fl.append(start);
  84.      }
  85. @@ -85,7 +92,11 @@ XData MAMTask::Private::makeMAMFilter()
  86.          XData::Field end;
  87.          end.setType(XData::Field::Field_TextSingle);
  88.          end.setVar(QLatin1String("end"));
  89. +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
  90.          to.setTimeSpec(Qt::UTC);
  91. +#else
  92. +        to.setTimeZone(QTimeZone::UTC);
  93. +#endif
  94.          end.setValue(QStringList(to.toString()));
  95.          fl.append(end);
  96.      }
  97. diff --git a/iris/src/xmpp/xmpp-im/xmpp_tasks.cpp b/iris/src/xmpp/xmpp-im/xmpp_tasks.cpp
  98. index 90d8232c..ea0f4ba6 100644
  99. --- a/iris/src/xmpp/xmpp-im/xmpp_tasks.cpp
  100. +++ b/iris/src/xmpp/xmpp-im/xmpp_tasks.cpp
  101. @@ -32,6 +32,9 @@
  102.  #include <QList>
  103.  #include <QRegularExpression>
  104.  #include <QTimer>
  105. +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  106. +#include <QTimeZone>
  107. +#endif
  108.  
  109.  using namespace XMPP;
  110.  
  111. @@ -776,7 +779,11 @@ bool JT_PushPresence::take(const QDomElement &e)
  112.          if (client()->manualTimeZoneOffset()) {
  113.              stamp = stamp.addSecs(client()->timeZoneOffset() * 3600);
  114.          } else {
  115. +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
  116.              stamp.setTimeSpec(Qt::UTC);
  117. +#else
  118. +            stamp.setTimeZone(QTimeZone::UTC);
  119. +#endif
  120.              stamp = stamp.toLocalTime();
  121.          }
  122.          p.setTimeStamp(stamp);
  123. diff --git a/plugins/generic/contentdownloaderplugin/form.cpp b/plugins/generic/contentdownloaderplugin/form.cpp
  124. index db8f2159..23a3e0f7 100644
  125. --- a/plugins/generic/contentdownloaderplugin/form.cpp
  126. +++ b/plugins/generic/contentdownloaderplugin/form.cpp
  127. @@ -271,7 +271,15 @@ void Form::downloadHtmlFinished()
  128.  
  129.          QString errorMsg;
  130.          int     errorLine, errorColumn;
  131. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  132.          if (doc.setContent(html, &errorMsg, &errorLine, &errorColumn)) {
  133. +#else
  134. +        auto parseResult = doc.setContent(html);
  135. +        errorMsg = parseResult.errorMessage;
  136. +        errorLine = parseResult.errorLine;
  137. +        errorColumn = parseResult.errorColumn;
  138. +        if (parseResult) {
  139. +#endif
  140.              QString           imgsdir = tmpDir_ + QDir::separator() + "imgs";
  141.              QDir              dir(imgsdir);
  142.              QFileSystemModel *model = new QFileSystemModel();
  143. diff --git a/plugins/generic/juickplugin/juickparser.cpp b/plugins/generic/juickplugin/juickparser.cpp
  144. index 1116d8ee..6330f7ee 100644
  145. --- a/plugins/generic/juickplugin/juickparser.cpp
  146. +++ b/plugins/generic/juickplugin/juickparser.cpp
  147. @@ -21,6 +21,9 @@
  148.  #include <QDateTime>
  149.  #include <QObject>
  150.  #include <QRegularExpression>
  151. +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  152. +#include <QTimeZone>
  153. +#endif
  154.  
  155.  static const QString juickLink("https://juick.com/%1");
  156.  
  157. @@ -247,7 +250,11 @@ QString JuickParser::timeStamp() const
  158.              if (offset == -1) {
  159.                  QDateTime cur = QDateTime::currentDateTime();
  160.                  QDateTime utc = cur.toUTC();
  161. +#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
  162.                  utc.setTimeSpec(Qt::LocalTime);
  163. +#else
  164. +                utc.setTimeZone(QTimeZone::LocalTime);
  165. +#endif
  166.                  offset = utc.secsTo(cur);
  167.              }
  168.              dt = dt.addSecs(offset);
  169. diff --git a/plugins/generic/omemoplugin/src/omemo.h b/plugins/generic/omemoplugin/src/omemo.h
  170. index c09cb77f..962dc511 100644
  171. --- a/plugins/generic/omemoplugin/src/omemo.h
  172. +++ b/plugins/generic/omemoplugin/src/omemo.h
  173. @@ -111,9 +111,9 @@ private:
  174.      };
  175.  
  176.      std::shared_ptr<Crypto>                            m_crypto;
  177. +    AccountInfoAccessingHost                          *m_accountInfoAccessor = nullptr;
  178.      StanzaSendingHost                                 *m_stanzaSender        = nullptr;
  179.      PsiAccountControllingHost                         *m_accountController   = nullptr;
  180. -    AccountInfoAccessingHost                          *m_accountInfoAccessor = nullptr;
  181.      ContactInfoAccessingHost                          *m_contactInfoAccessor = nullptr;
  182.      QVector<std::shared_ptr<MessageWaitingForBundles>> m_pendingMessages;
  183.      QString                                            m_dataPath;
  184. diff --git a/plugins/generic/otrplugin/src/htmltidy.cpp b/plugins/generic/otrplugin/src/htmltidy.cpp
  185. index 8c30061a..cac3abad 100644
  186. --- a/plugins/generic/otrplugin/src/htmltidy.cpp
  187. +++ b/plugins/generic/otrplugin/src/htmltidy.cpp
  188. @@ -89,7 +89,15 @@ QDomElement HtmlTidy::output(QDomDocument &document)
  189.      QString errorText;
  190.  
  191.      QString html = writeOutput();
  192. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  193.      if (!document.setContent(html, true, &errorText, &errorLine, &errorColumn)) {
  194. +#else
  195. +    auto result = document.setContent(html, QDomDocument::ParseOption::UseNamespaceProcessing);
  196. +    errorLine = result.errorLine;
  197. +    errorColumn = result.errorColumn;
  198. +    errorText = result.errorMessage;
  199. +    if (!result) {
  200. +#endif
  201.          qWarning() << "---- parsing error:\n"
  202.                     << html << "\n----\n"
  203.                     << errorText << " line:" << errorLine << " column:" << errorColumn;
  204. diff --git a/plugins/generic/otrplugin/src/psiotrplugin.cpp b/plugins/generic/otrplugin/src/psiotrplugin.cpp
  205. index 1b7e6c18..bcd4f6f0 100644
  206. --- a/plugins/generic/otrplugin/src/psiotrplugin.cpp
  207. +++ b/plugins/generic/otrplugin/src/psiotrplugin.cpp
  208. @@ -302,7 +302,15 @@ bool PsiOtrPlugin::decryptMessageElement(int accountIndex, QDomElement &messageE
  209.              QDomDocument document;
  210.              int          errorLine = 0, errorColumn = 0;
  211.              QString      errorText;
  212. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  213.              if (document.setContent(decrypted, true, &errorText, &errorLine, &errorColumn)) {
  214. +#else
  215. +            auto result = document.setContent(decrypted, QDomDocument::ParseOption::UseNamespaceProcessing);
  216. +            errorColumn = result.errorColumn;
  217. +            errorLine = result.errorLine;
  218. +            errorText = result.errorMessage;
  219. +            if (result) {
  220. +#endif
  221.                  htmlElement.appendChild(document.documentElement());
  222.              } else {
  223.                  qWarning() << "---- parsing error:\n"
  224. diff --git a/src/bookmarkmanagedlg.cpp b/src/bookmarkmanagedlg.cpp
  225. index fdb8081c..a7bdfc52 100644
  226. --- a/src/bookmarkmanagedlg.cpp
  227. +++ b/src/bookmarkmanagedlg.cpp
  228. @@ -234,7 +234,13 @@ void BookmarkManageDlg::importBookmarks()
  229.      if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
  230.          QDomDocument doc;
  231.          QString      error;
  232. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  233.          if (doc.setContent(&file, &error)) {
  234. +#else
  235. +        auto result = doc.setContent(&file);
  236. +        error = result.errorMessage;
  237. +        if (result) {
  238. +#endif
  239.              QDomElement root = doc.firstChildElement("bookmarks");
  240.              if (root.isNull())
  241.                  return;
  242. diff --git a/src/historydlg.cpp b/src/historydlg.cpp
  243. index 6e2a3a60..ec9870d2 100644
  244. --- a/src/historydlg.cpp
  245. +++ b/src/historydlg.cpp
  246. @@ -38,6 +38,9 @@
  247.  #include <QProgressDialog>
  248.  #include <QScrollBar>
  249.  #include <QTextBlock>
  250. +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  251. +#include <QTimeZone>
  252. +#endif
  253.  
  254.  #define SEARCH_PADDING_SIZE 20
  255.  #define DISPLAY_PAGE_SIZE 200
  256. @@ -1138,8 +1141,10 @@ void HistoryDlg::getNext()
  257.  
  258.  void HistoryDlg::getDate()
  259.  {
  260. -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
  261. +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && QT_VERSION < QT_VERSION_CHECK(6,9,0)
  262.      QDateTime ts = ui_.calendar->selectedDate().startOfDay(Qt::UTC);
  263. +#elif QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
  264. +    QDateTime ts = ui_.calendar->selectedDate().startOfDay(QTimeZone::UTC);
  265.  #else
  266.      QDateTime ts(ui_.calendar->selectedDate(), { 0, 0 }, Qt::UTC);
  267.  #endif
  268. diff --git a/src/tools/iconset/iconset.cpp b/src/tools/iconset/iconset.cpp
  269. index e96db1a0..72801102 100644
  270. --- a/src/tools/iconset/iconset.cpp
  271. +++ b/src/tools/iconset/iconset.cpp
  272. @@ -1603,7 +1603,11 @@ bool Iconset::load(const QString &dir, Format format)
  273.      ba = d->loadData(fileName, dir);
  274.      if (!ba.isEmpty()) {
  275.          QDomDocument doc;
  276. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  277.          if (doc.setContent(ba, false)) {
  278. +#else
  279. +        if (doc.setContent(ba)) {
  280. +#endif
  281.              if ((format == Format::Psi && d->load(doc, dir))
  282.                  || (format == Format::KdeEmoticons && d->loadKdeEmoticons(doc, dir))) {
  283.                  d->filename = dir;
  284. diff --git a/src/vcardfactory.cpp b/src/vcardfactory.cpp
  285. index 718ce9f6..525c77b2 100644
  286. --- a/src/vcardfactory.cpp
  287. +++ b/src/vcardfactory.cpp
  288. @@ -207,7 +207,11 @@ VCard4::VCard VCardFactory::vcard(const Jid &j, Flags flags)
  289.      if (!v4) {
  290.          file.seek(0);
  291.          QDomDocument doc;
  292. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  293.          if (doc.setContent(&file, false)) {
  294. +#else
  295. +        if (doc.setContent(&file)) {
  296. +#endif
  297.              VCard vcard = VCard::fromXml(doc.documentElement());
  298.              if (!vcard.isNull()) {
  299.                  v4.fromVCardTemp(vcard);
  300. diff --git a/src/whiteboarding/wbmanager.cpp b/src/whiteboarding/wbmanager.cpp
  301. index 74ccafea..b55e3d6c 100644
  302. --- a/src/whiteboarding/wbmanager.cpp
  303. +++ b/src/whiteboarding/wbmanager.cpp
  304. @@ -114,7 +114,11 @@ void WbManager::openWhiteboard(const Jid &target, const Jid &ownJid, bool groupC
  305.  
  306.                  QFile file(fileName);
  307.                  if (file.open(QIODevice::ReadOnly)) {
  308. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  309.                      doc.setContent(&file, true);
  310. +#else
  311. +                    doc.setContent(&file, QDomDocument::ParseOption::UseNamespaceProcessing);
  312. +#endif
  313.                      file.close();
  314.                  }
  315.              }
  316. @@ -124,7 +128,11 @@ void WbManager::openWhiteboard(const Jid &target, const Jid &ownJid, bool groupC
  317.  
  318.              // initialize with an empty whiteboarding document
  319.              doc = QDomDocument();
  320. +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
  321.              doc.setContent(QString(EMPTYWB), true);
  322. +#else
  323. +            doc.setContent(QString(EMPTYWB), QDomDocument::ParseOption::UseNamespaceProcessing);
  324. +#endif
  325.          }
  326.  
  327.          // negotiate the session
  328.  
Advertisement
Add Comment
Please, Sign In to add comment