| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp`/ |
| 2 | |
| 3 | #include "gui/webviewers/qtextbrowser/textbrowserviewer.h"cxx . . $ `<file>/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "definitions/globals.h"cxx . . $ `<file>/src/librssguard/definitions/globals.h`/ |
| 7 | #include "gui/dialogs/formmain.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formmain.h`/ |
| 8 | #include "gui/webbrowser.h"cxx . . $ `<file>/src/librssguard/gui/webbrowser.h`/ |
| 9 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 10 | #include "miscellaneous/externaltool.h"cxx . . $ `<file>/src/librssguard/miscellaneous/externaltool.h`/ |
| 11 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 12 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 13 | #include "network-web/adblock/adblockrequestinfo.h"cxx . . $ `<file>/src/librssguard/network-web/adblock/adblockrequestinfo.h`/ |
| 14 | #include "network-web/downloader.h"cxx . . $ `<file>/src/librssguard/network-web/downloader.h`/ |
| 15 | #include "network-web/networkfactory.h"cxx . . $ `<file>/src/librssguard/network-web/networkfactory.h`/ |
| 16 | #include "network-web/webfactory.h"cxx . . $ `<file>/src/librssguard/network-web/webfactory.h`/ |
| 17 | |
| 18 | #include <QBuffer> |
| 19 | #include <QContextMenuEvent> |
| 20 | #include <QFileIconProvider> |
| 21 | #include <QScrollBar> |
| 22 | #include <QTextCodec> |
| 23 | #include <QTimer> |
| 24 | #include <QtConcurrent> |
| 25 | |
| 26 | TextBrowserViewercxx . . $ TextBrowserViewer#::TextBrowserViewercxx . . $ TextBrowserViewer#TextBrowserViewer(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 27 | : QTextBrowsercxx . . $ QTextBrowser#(parent), m_resourcesEnabledcxx . . $ TextBrowserViewer#m_resourcesEnabled.(false), m_resourceDownloadercxx . . $ TextBrowserViewer#m_resourceDownloader.(new Downloadercxx . . $ Downloader#Downloader(749de1b6ae65bddd).()), |
| 28 | m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.(new QThreadcxx . . $ QThread#QThread(749de1b6ae65bddd).(this)), m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources.({cxx . . $ std/initializer_list#initializer_list(ced63f7c635d850d).}), |
| 29 | m_placeholderImagecxx . . $ TextBrowserViewer#m_placeholderImage.(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->miscPixmapcxx . . $ IconFactory#miscPixmap(13bf8f5656ba7097).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image-placeholder"))), |
| 30 | m_placeholderImageErrorcxx . . $ TextBrowserViewer#m_placeholderImageError.(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->miscPixmapcxx . . $ IconFactory#miscPixmap(13bf8f5656ba7097).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image-placeholder-error"))), |
| 31 | m_downloadercxx . . $ TextBrowserViewer#m_downloader.(new Downloadercxx . . $ Downloader#Downloader(749de1b6ae65bddd).(this)), m_documentcxx . . $ TextBrowserViewer#m_document.(new TextBrowserDocumentcxx . . $ TextBrowserDocument#(this)) { |
| 32 | setAutoFillBackgroundcxx . . $ QWidget#setAutoFillBackground(b45ddcbc8423892c).(false); |
| 33 | setFrameShapecxx . . $ QFrame#setFrameShape(58426e538cd37cb).(QFramecxx . . $ QFrame#::Shapecxx . . $ QFrame#Shape#::NoFramecxx . . $ QFrame#NoFrame.); |
| 34 | setFrameShadowcxx . . $ QFrame#setFrameShadow(25fd9c3ff6b75302).(QFramecxx . . $ QFrame#::Shadowcxx . . $ QFrame#Shadow#::Plaincxx . . $ QFrame#Plain.); |
| 35 | setTabChangesFocuscxx . . $ QTextEdit#setTabChangesFocus(b45ddcbc8423892c).(true); |
| 36 | setOpenLinkscxx . . $ QTextBrowser#setOpenLinks(b45ddcbc8423892c).(false); |
| 37 | setWordWrapModecxx . . $ QTextEdit#setWordWrapMode(3f929c8d13a78d0c).(QTextOptioncxx . . $ QTextOption#::WrapModecxx . . $ QTextOption#WrapMode#::WordWrapcxx . . $ QTextOption#WordWrap.); |
| 38 | |
| 39 | viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->setAutoFillBackgroundcxx . . $ QWidget#setAutoFillBackground(b45ddcbc8423892c).(false); |
| 40 | |
| 41 | setResourcesEnabledcxx . . $ TextBrowserViewer#setResourcesEnabled(b45ddcbc8423892c).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Messages::ShowResourcesInArticles)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()); |
| 42 | setDocumentcxx . . $ QTextEdit#setDocument(68d7deb16251beb9).(m_documentcxx . . $ TextBrowserViewer#m_document..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()); |
| 43 | |
| 44 | m_resourceDownloadercxx . . $ TextBrowserViewer#m_resourceDownloader.->moveToThreadcxx . . $ QObject#moveToThread(d30c93cb79097f61).(m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.); |
| 45 | m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.->startcxx . . $ QThread#start(bd4fe741c868f69f).(QThreadcxx . . $ QThread#::Prioritycxx . . $ QThread#Priority#::LowPrioritycxx . . $ QThread#LowPriority.); |
| 46 | |
| 47 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &TextBrowserViewercxx . . $ TextBrowserViewer#::reloadDocumentcxx . . $ TextBrowserViewer#reloadDocument(49f6e7a06ebc5aa8)., this, [this]() { |
| 48 | const auto scr = verticalScrollBarPositioncxx . . $ TextBrowserViewer#verticalScrollBarPosition(21b6c25e127938e2).(); |
| 49 | setHtmlPrivatecxx . . $ TextBrowserViewer#setHtmlPrivate(9b3514a5b076b66b).(htmlcxx . . $ TextBrowserViewer#html(6ef7b6c27b00b43d).(), m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl.); |
| 50 | setVerticalScrollBarPositioncxx . . $ TextBrowserViewer#setVerticalScrollBarPosition(ba8836b59fb42830).(scr); |
| 51 | }); |
| 52 | |
| 53 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_resourceDownloadercxx . . $ TextBrowserViewer#m_resourceDownloader., &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., this, &TextBrowserViewercxx . . $ TextBrowserViewer#::resourceDownloadedcxx . . $ TextBrowserViewer#resourceDownloaded(377b816ef29857eb).); |
| 54 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QTextBrowsercxx . . $ QTextBrowser#::anchorClickedcxx . . $ QTextBrowser#anchorClicked(37355d2f77053a23)., this, &TextBrowserViewercxx . . $ TextBrowserViewer#::onAnchorClickedcxx . . $ TextBrowserViewer#onAnchorClicked(37355d2f77053a23).); |
| 55 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, QOverloadcxx . . $ QOverload#<const QUrl&>::ofcxx . . $ QOverload#of(63f0cbf97c2df3d6).(&QTextBrowsercxx . . $ QTextBrowser#::highlightedcxx . . $ QTextBrowser#highlighted(37355d2f77053a23).), this, &TextBrowserViewercxx . . $ TextBrowserViewer#::linkMouseHighlightedcxx . . $ TextBrowserViewer#linkMouseHighlighted(37355d2f77053a23).); |
| 56 | } |
| 57 | |
| 58 | TextBrowserViewercxx . . $ TextBrowserViewer#::~cxx . . $ TextBrowserViewer#`~TextBrowserViewer`(ced63f7c635d850d).TextBrowserViewercxx . . $ TextBrowserViewer#() { |
| 59 | m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.->quitcxx . . $ QThread#quit(49f6e7a06ebc5aa8).(); |
| 60 | m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.->waitcxx . . $ QThread#wait(534bc65d63671d2b).(); |
| 61 | m_resourceDownloaderThreadcxx . . $ TextBrowserViewer#m_resourceDownloaderThread.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 62 | m_resourceDownloadercxx . . $ TextBrowserViewer#m_resourceDownloader.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 63 | } |
| 64 | |
| 65 | QSizecxx . . $ QSize# TextBrowserViewercxx . . $ TextBrowserViewer#::sizeHintcxx . . $ TextBrowserViewer#sizeHint(4b3b776e5ee2b367).() const { |
| 66 | auto doc_size = documentcxx . . $ QTextEdit#document(f21741221844491e).()->sizecxx . . $ QTextDocument#size(6c9504dc925659fb).().toSizecxx . . $ QSizeF#toSize(31eef80d4686a819).(); |
| 67 | |
| 68 | doc_size.setHeightcxx . . $ QSize#setHeight(f349c77f591a7878).(doc_size.heightcxx . . $ QSize#height(ea6fe5115c70a13f).() + contentsMarginscxx . . $ QWidget#contentsMargins(b3d08c6b733dca3).().topcxx . . $ QMargins#top(ea6fe5115c70a13f).() + contentsMarginscxx . . $ QWidget#contentsMargins(b3d08c6b733dca3).().bottomcxx . . $ QMargins#bottom(ea6fe5115c70a13f).()); |
| 69 | return doc_size; |
| 70 | } |
| 71 | |
| 72 | QVariantcxx . . $ QVariant# TextBrowserViewercxx . . $ TextBrowserViewer#::loadOneResourcecxx . . $ TextBrowserViewer#loadOneResource(8c09c4293100362).(int type, const QUrlcxx . . $ QUrl#& name) { |
| 73 | if (type != QTextDocumentcxx . . $ QTextDocument#::ResourceTypecxx . . $ QTextDocument#ResourceType#::ImageResourcecxx . . $ QTextDocument#ImageResource.) { |
| 74 | return {cxx . . $ QVariant#QVariant(ced63f7c635d850d).}; |
| 75 | } |
| 76 | |
| 77 | auto resolved_name = (m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).() && name.isRelativecxx . . $ QUrl#isRelative(50ce9a9e25b4a850).()) ? m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..resolvedcxx . . $ QUrl#resolved(12b57030d3a86ba7).(name) : namecxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 78 | |
| 79 | if (!m_resourcesEnabledcxx . . $ TextBrowserViewer#m_resourcesEnabled. || !m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources..containscxx . . $ QMap#contains(8877ebe272b9620d).(resolved_name)) { |
| 80 | // Resources are not enabled. |
| 81 | return m_placeholderImagecxx . . $ TextBrowserViewer#m_placeholderImage.; |
| 82 | } |
| 83 | |
| 84 | // Resources are enabled and we already have the resource. |
| 85 | int acceptable_width = int(widthcxx . . $ QWidget#width(455f465bc33b4cdf).() * ACCEPTABLE_IMAGE_PERCENTUAL_WIDTHcxx . . $ `src/librssguard/gui/webviewers/webviewer.h:28:9`!); |
| 86 | |
| 87 | QMapcxx . . $ QMap#<int, QByteArraycxx . . $ QByteArray#>& resource_data_all_sizes = m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources.[cxx . . $ QMap#`operator[]`(bbd415b616967878).resolved_name]; |
| 88 | QImagecxx . . $ QImage# imgcxx . . $ QImage#QImage(ced63f7c635d850d).; |
| 89 | |
| 90 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Picture" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(name) |
| 91 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "has these sizes cached:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). NONQUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:428:9`!(resource_data_all_sizes.keys()); |
| 92 | |
| 93 | if (resource_data_all_sizes.isEmptycxx . . $ QMap#isEmpty(50ce9a9e25b4a850).()) { |
| 94 | img =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). m_placeholderImageErrorcxx . . $ TextBrowserViewer#m_placeholderImageError..toImagecxx . . $ QPixmap#toImage(b37cda5778b78373).(); |
| 95 | } |
| 96 | else { |
| 97 | // Now, we either select specifically sized picture, or default one. |
| 98 | QByteArraycxx . . $ QByteArray# resource_datacxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 99 | |
| 100 | if (resource_data_all_sizes.containscxx . . $ QMap#contains(8877ebe272b9620d).(acceptable_width)) { |
| 101 | // We have picture with this exact size. The picture was likely downsized |
| 102 | // to this size before. |
| 103 | resource_data =cxx . . $ QByteArray#`operator=`(c3d647c78c52d790). resource_data_all_sizes.valuecxx . . $ QMap#value(6f0b2e7f225a8193).(acceptable_width); |
| 104 | } |
| 105 | else { |
| 106 | // We only have default size or not desired size. Return initial picture. |
| 107 | resource_data =cxx . . $ QByteArray#`operator=`(c3d647c78c52d790). resource_data_all_sizes.valuecxx . . $ QMap#value(6f0b2e7f225a8193).(0); |
| 108 | } |
| 109 | |
| 110 | img =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). QImagecxx . . $ QImage#::fromDatacxx . . $ QImage#fromData(fef032c0862e7100).(resource_data); |
| 111 | } |
| 112 | |
| 113 | int img_width = img.widthcxx . . $ QImage#width(455f465bc33b4cdf).(); |
| 114 | |
| 115 | if (img_width > acceptable_width) { |
| 116 | QElapsedTimercxx . . $ QElapsedTimer# tmrcxx . . $ QElapsedTimer#QElapsedTimer(ced63f7c635d850d).; |
| 117 | |
| 118 | tmr.startcxx . . $ QElapsedTimer#start(ced63f7c635d850d).(); |
| 119 | img =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). img.scaledToWidthcxx . . $ QImage#scaledToWidth(1fbdf8631328a1eb).(acceptable_width, Qtcxx . . $ Qt/::TransformationModecxx . . $ Qt/TransformationMode#::SmoothTransformationcxx . . $ Qt/SmoothTransformation.); |
| 120 | |
| 121 | qWarningNNcxx . . $ `src/librssguard/definitions/definitions.h:417:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Picture" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(name) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "with width" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(img_width) |
| 122 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "is too wide, down-scaling to prevent horizontal scrollbars. Scaling took" |
| 123 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). NONQUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:429:9`!(tmr.elapsed()) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "miliseconds."; |
| 124 | |
| 125 | QByteArraycxx . . $ QByteArray# save_arrcxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 126 | QBuffercxx . . $ QBuffer# save_bufcxx . . $ QBuffer#QBuffer(2b5e1eb05360d54d).(&save_arr, this); |
| 127 | |
| 128 | if (img.savecxx . . $ QImage#save(3e5a96ff0a5f828b).(&save_buf, "JPG", 100)) { |
| 129 | save_buf.closecxx . . $ QBuffer#close(49f6e7a06ebc5aa8).(); |
| 130 | |
| 131 | /* |
| 132 | IOFactory::writeFile(QSL("%1%2.jpg") |
| 133 | .arg(name.toString(QUrl::ComponentFormattingOption::FullyEncoded), |
| 134 | QString::number(acceptable_width)) |
| 135 | .remove(QRegularExpression(":|\\/")), |
| 136 | save_arr); |
| 137 | */ |
| 138 | |
| 139 | resource_data_all_sizes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(acceptable_width, save_arr); |
| 140 | } |
| 141 | else { |
| 142 | qWarningNNcxx . . $ `src/librssguard/definitions/definitions.h:417:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Failed to save modified image" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(name) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "to cache."; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | return img; |
| 147 | } |
| 148 | |
| 149 | void TextBrowserViewercxx . . $ TextBrowserViewer#::bindToBrowsercxx . . $ TextBrowserViewer#bindToBrowser(ffbf97f3859aff07).(WebBrowsercxx . . $ WebBrowser#* browser) { |
| 150 | installEventFiltercxx . . $ QObject#installEventFilter(749de1b6ae65bddd).(browser); |
| 151 | |
| 152 | browser->m_actionBackcxx . . $ WebBrowser#m_actionBack. = nullptr; |
| 153 | browser->m_actionForwardcxx . . $ WebBrowser#m_actionForward. = nullptr; |
| 154 | browser->m_actionReloadcxx . . $ WebBrowser#m_actionReload. = nullptr; |
| 155 | browser->m_actionStopcxx . . $ WebBrowser#m_actionStop. = nullptr; |
| 156 | } |
| 157 | |
| 158 | void TextBrowserViewercxx . . $ TextBrowserViewer#::findTextcxx . . $ TextBrowserViewer#findText(37c160c81b6367f7).(const QStringcxx . . $ QString#& text, bool backwards) { |
| 159 | if (!text.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 160 | bool found = |
| 161 | QTextBrowsercxx . . $ QTextBrowser#::findcxx . . $ QTextEdit#find(a6e397b8ae6adea7).(text, backwardscxx . . $ QFlags#QFlags(93d577a3e9528307). ? QTextDocumentcxx . . $ QTextDocument#::FindFlagcxx . . $ QTextDocument#FindFlag#::FindBackwardcxx . . $ QTextDocument#FindBackward. : QTextDocumentcxx . . $ QTextDocument#::FindFlagcxx . . $ QTextDocument#FindFlag#(0)); |
| 162 | |
| 163 | if (!found) { |
| 164 | textCursorcxx . . $ QTextEdit#textCursor(878247cba2fd3c00).().clearSelectioncxx . . $ QTextCursor#clearSelection(49f6e7a06ebc5aa8).(); |
| 165 | moveCursorcxx . . $ QTextEdit#moveCursor(a1f32533f9180c25).(QTextCursorcxx . . $ QTextCursor#::MoveOperationcxx . . $ QTextCursor#MoveOperation#::Startcxx . . $ QTextCursor#Start.); |
| 166 | |
| 167 | QTextBrowsercxx . . $ QTextBrowser#::findcxx . . $ QTextEdit#find(a6e397b8ae6adea7).(text, backwardscxx . . $ QFlags#QFlags(93d577a3e9528307). ? QTextDocumentcxx . . $ QTextDocument#::FindFlagcxx . . $ QTextDocument#FindFlag#::FindBackwardcxx . . $ QTextDocument#FindBackward. : QTextDocumentcxx . . $ QTextDocument#::FindFlagcxx . . $ QTextDocument#FindFlag#(0)); |
| 168 | } |
| 169 | } |
| 170 | else { |
| 171 | textCursorcxx . . $ QTextEdit#textCursor(878247cba2fd3c00).().clearSelectioncxx . . $ QTextCursor#clearSelection(49f6e7a06ebc5aa8).(); |
| 172 | moveCursorcxx . . $ QTextEdit#moveCursor(a1f32533f9180c25).(QTextCursorcxx . . $ QTextCursor#::MoveOperationcxx . . $ QTextCursor#MoveOperation#::Startcxx . . $ QTextCursor#Start.); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | BlockingResultcxx . . $ BlockingResult# TextBrowserViewercxx . . $ TextBrowserViewer#::blockedWithAdblockcxx . . $ TextBrowserViewer#blockedWithAdblock(a0d96f330f741bcd).(const QUrlcxx . . $ QUrl#& url) { |
| 177 | AdblockRequestInfocxx . . $ AdblockRequestInfo# block_requestcxx . . $ AdblockRequestInfo#AdblockRequestInfo(37355d2f77053a23).(url); |
| 178 | |
| 179 | if (url.pathcxx . . $ QUrl#path(9d7420bec8bfe6c9).().endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("css"))) { |
| 180 | block_request.setResourceTypecxx . . $ AdblockRequestInfo#setResourceType(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("stylesheet")); |
| 181 | } |
| 182 | else { |
| 183 | block_request.setResourceTypecxx . . $ AdblockRequestInfo#setResourceType(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image")); |
| 184 | } |
| 185 | |
| 186 | auto block_result = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->adBlockcxx . . $ WebFactory#adBlock(dd9ae43777736cac).()->blockcxx . . $ AdBlockManager#block(b0689f1a9ed52a60).(block_request); |
| 187 | |
| 188 | if (block_result.m_blockedcxx . . $ BlockingResult#m_blocked.) { |
| 189 | qWarningNNcxx . . $ `src/librssguard/definitions/definitions.h:417:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_ADBLOCKcxx . . $ `src/librssguard/definitions/definitions.h:169:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Blocked request:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(block_request.requestUrl().toString()); |
| 190 | return block_result; |
| 191 | } |
| 192 | else { |
| 193 | return block_result; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setUrlcxx . . $ TextBrowserViewer#setUrl(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 198 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! loadingStartedcxx . . $ TextBrowserViewer#loadingStarted(49f6e7a06ebc5aa8).(); |
| 199 | |
| 200 | QStringcxx . . $ QString# html_strcxx . . $ QString#QString(ced63f7c635d850d).; |
| 201 | QUrlcxx . . $ QUrl# nonconst_url = urlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 202 | bool is_error = false; |
| 203 | auto block_result = blockedWithAdblockcxx . . $ TextBrowserViewer#blockedWithAdblock(a0d96f330f741bcd).(url); |
| 204 | |
| 205 | if (block_result.m_blockedcxx . . $ BlockingResult#m_blocked.) { |
| 206 | is_error = true; |
| 207 | nonconst_url =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). QUrlcxx . . $ QUrl#::fromUserInputcxx . . $ QUrl#fromUserInput(6a862b781f6237c0).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(INTERNAL_URL_ADBLOCKEDcxx . . $ `src/librssguard/definitions/definitions.h:208:9`!)); |
| 208 | |
| 209 | html_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Blocked!!!<br/>%1").argcxx . . $ QString#arg(ad0bca07273edcc2).(url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).()); |
| 210 | } |
| 211 | else { |
| 212 | QEventLoopcxx . . $ QEventLoop# loopcxx . . $ QEventLoop#QEventLoop(749de1b6ae65bddd).; |
| 213 | |
| 214 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_downloadercxx . . $ TextBrowserViewer#m_downloader..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).(), |
| 215 | &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., |
| 216 | &loop, |
| 217 | &QEventLoopcxx . . $ QEventLoop#::quitcxx . . $ QEventLoop#quit(49f6e7a06ebc5aa8)., |
| 218 | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#(Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::UniqueConnectioncxx . . $ Qt/UniqueConnection. | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::AutoConnectioncxx . . $ Qt/AutoConnection.)); |
| 219 | m_downloadercxx . . $ TextBrowserViewer#m_downloader.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).manipulateDatacxx . . $ Downloader#manipulateData(3688cabcec565115).(url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(), QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., {}, 5000); |
| 220 | |
| 221 | loop.execcxx . . $ QEventLoop#exec(f981dedee5b32481).(); |
| 222 | |
| 223 | const auto net_error = m_downloadercxx . . $ TextBrowserViewer#m_downloader.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).lastOutputErrorcxx . . $ Downloader#lastOutputError(c916dcceceba1ae7).(); |
| 224 | const QStringcxx . . $ QString# content_type = m_downloadercxx . . $ TextBrowserViewer#m_downloader.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).lastContentTypecxx . . $ Downloader#lastContentType(6ef7b6c27b00b43d).(); |
| 225 | |
| 226 | if (net_error != QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 227 | is_error = true; |
| 228 | html_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Error!<br/>%1").argcxx . . $ QString#arg(ad0bca07273edcc2).(NetworkFactorycxx . . $ NetworkFactory#::networkErrorTextcxx . . $ NetworkFactory#networkErrorText(76e9e349cca0e801).(net_error)); |
| 229 | } |
| 230 | else { |
| 231 | if (content_type.startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image/"))) { |
| 232 | html_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<img src=\"%1\">").argcxx . . $ QString#arg(ad0bca07273edcc2).(nonconst_url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).()); |
| 233 | } |
| 234 | else { |
| 235 | html_str =cxx . . $ QString#`operator=`(4f35bf974e7f8568). decodeHtmlDatacxx . . $ TextBrowserViewer#decodeHtmlData(e33c60696f3f2fb3).(m_downloadercxx . . $ TextBrowserViewer#m_downloader.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).lastOutputDatacxx . . $ Downloader#lastOutputData(a96750bfbcb1fbe9).(), content_type); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | setHtmlcxx . . $ TextBrowserViewer#setHtml(9b3514a5b076b66b).(html_str, nonconst_url); |
| 241 | |
| 242 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! loadingFinishedcxx . . $ TextBrowserViewer#loadingFinished(b45ddcbc8423892c).(!is_error); |
| 243 | } |
| 244 | |
| 245 | QStringcxx . . $ QString# TextBrowserViewercxx . . $ TextBrowserViewer#::decodeHtmlDatacxx . . $ TextBrowserViewer#decodeHtmlData(e33c60696f3f2fb3).(const QByteArraycxx . . $ QByteArray#& data, const QStringcxx . . $ QString#& content_type) const { |
| 246 | QStringcxx . . $ QString# found_charset = QRegularExpressioncxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).("charset=([0-9a-zA-Z-_]+)"cxx . . $ QString#QString(85c52e162fed56f9).).matchcxx . . $ QRegularExpression#match(d076266091fa4922).(content_type).capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 247 | QTextCodeccxx . . $ QTextCodec#* codec = QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(9094647911411626).(found_charset.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).()); |
| 248 | |
| 249 | if (codec == nullptr) { |
| 250 | // No suitable codec for this encoding was found. |
| 251 | // Use UTF-8. |
| 252 | qWarningNNcxx . . $ `src/librssguard/definitions/definitions.h:417:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Did not find charset for content-type" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(content_type); |
| 253 | return QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(4e15edac36d215be).(data); |
| 254 | } |
| 255 | else { |
| 256 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Found charset for content-type" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(content_type); |
| 257 | return codec->toUnicodecxx . . $ QTextCodec#toUnicode(5b58488ffc88f4c0).(data); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | QStringcxx . . $ QString# TextBrowserViewercxx . . $ TextBrowserViewer#::htmlcxx . . $ TextBrowserViewer#html(6ef7b6c27b00b43d).() const { |
| 262 | return m_currentHtmlcxx . . $ QString#QString(132dd6869045752b).; |
| 263 | } |
| 264 | |
| 265 | QUrlcxx . . $ QUrl# TextBrowserViewercxx . . $ TextBrowserViewer#::urlcxx . . $ TextBrowserViewer#url(36d9834fe7321282).() const { |
| 266 | return m_currentUrlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 267 | } |
| 268 | |
| 269 | void TextBrowserViewercxx . . $ TextBrowserViewer#::clearcxx . . $ TextBrowserViewer#clear(49f6e7a06ebc5aa8).() { |
| 270 | setHtmlcxx . . $ TextBrowserViewer#setHtml(9b3514a5b076b66b).({cxx . . $ QString#QString(ced63f7c635d850d).}); |
| 271 | } |
| 272 | |
| 273 | void TextBrowserViewercxx . . $ TextBrowserViewer#::loadMessagescxx . . $ TextBrowserViewer#loadMessages(49f6da13449e8c82).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& messages, RootItemcxx . . $ RootItem#* root) { |
| 274 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! loadingStartedcxx . . $ TextBrowserViewer#loadingStarted(49f6e7a06ebc5aa8).(); |
| 275 | m_rootcxx . . $ TextBrowserViewer#m_root. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). root; |
| 276 | |
| 277 | auto html_messages = htmlForMessagescxx . . $ TextBrowserViewer#htmlForMessages(6b71c5483f38f48).(messages, root); |
| 278 | |
| 279 | /* |
| 280 | // Replace base64 images. |
| 281 | QRegularExpression exp_base64("src=\"data: ?image\\/[^;]+;base64,([^\"]+)\""); |
| 282 | QRegularExpressionMatch exp_base64_match; |
| 283 | |
| 284 | while ((exp_base64_match = exp_base64.match(html_messages.m_html)).hasMatch()) { |
| 285 | QString base64_img = exp_base64_match.captured(1); |
| 286 | QByteArray data_img = QByteArray::fromBase64Encoding(base64_img); |
| 287 | } |
| 288 | */ |
| 289 | |
| 290 | #if !defined(NDEBUGcxx . . $ `<built-in>:531:9`!) |
| 291 | // IOFactory::writeFile("aaa.html", html_messages.m_html.toUtf8()); |
| 292 | #endif |
| 293 | |
| 294 | setHtmlcxx . . $ TextBrowserViewer#setHtml(9b3514a5b076b66b).(html_messages.m_htmlcxx . . $ PreparedHtml#m_html., html_messages.m_baseUrlcxx . . $ PreparedHtml#m_baseUrl.); |
| 295 | |
| 296 | QTextOptioncxx . . $ QTextOption# opcxx . . $ QTextOption#QTextOption(49f6e7a06ebc5aa8).; |
| 297 | op.setTextDirectioncxx . . $ QTextOption#setTextDirection(c4f507b8ff4f71fc).((messages.atcxx . . $ QList#at(c7965f769b39929).(0).m_rtlBehaviorcxx . . $ Message#m_rtlBehavior. == RtlBehaviorcxx . . $ RtlBehavior#::Everywherecxx . . $ RtlBehavior#Everywhere. || |
| 298 | messages.atcxx . . $ QList#at(c7965f769b39929).(0).m_rtlBehaviorcxx . . $ Message#m_rtlBehavior. == RtlBehaviorcxx . . $ RtlBehavior#::EverywhereExceptFeedListcxx . . $ RtlBehavior#EverywhereExceptFeedList. || |
| 299 | messages.atcxx . . $ QList#at(c7965f769b39929).(0).m_rtlBehaviorcxx . . $ Message#m_rtlBehavior. == RtlBehaviorcxx . . $ RtlBehavior#::OnlyViewercxx . . $ RtlBehavior#OnlyViewer.) |
| 300 | ? Qtcxx . . $ Qt/::LayoutDirectioncxx . . $ Qt/LayoutDirection#::RightToLeftcxx . . $ Qt/RightToLeft. |
| 301 | : Qtcxx . . $ Qt/::LayoutDirectioncxx . . $ Qt/LayoutDirection#::LeftToRightcxx . . $ Qt/LeftToRight.); |
| 302 | documentcxx . . $ QTextEdit#document(f21741221844491e).()->setDefaultTextOptioncxx . . $ QTextDocument#setDefaultTextOption(c9f23c54980c86f9).(op); |
| 303 | |
| 304 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! loadingFinishedcxx . . $ TextBrowserViewer#loadingFinished(b45ddcbc8423892c).(true); |
| 305 | } |
| 306 | |
| 307 | PreparedHtmlcxx . . $ PreparedHtml# TextBrowserViewercxx . . $ TextBrowserViewer#::htmlForMessagescxx . . $ TextBrowserViewer#htmlForMessages(6b71c5483f38f48).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& messages, RootItemcxx . . $ RootItem#* root) const { |
| 308 | auto html_messages = |
| 309 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Messages::UseLegacyArticleFormat)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).() |
| 310 | ? prepareLegacyHtmlForMessagecxx . . $ TextBrowserViewer#prepareLegacyHtmlForMessage(6b71c5483f38f48).(messages, root) |
| 311 | : qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->skinscxx . . $ Application#skins(260b20d67347ae96).()->generateHtmlOfArticlescxx . . $ SkinFactory#generateHtmlOfArticles(e95722fdaa1a1d02).(messages, root, widthcxx . . $ QWidget#width(455f465bc33b4cdf).() * ACCEPTABLE_IMAGE_PERCENTUAL_WIDTHcxx . . $ `src/librssguard/gui/webviewers/webviewer.h:28:9`!); |
| 312 | |
| 313 | // Remove other characters which cannot be displayed properly. |
| 314 | static QRegularExpressioncxx . . $ QRegularExpression# exp_symbolscxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).("[0-9A-F]{3};"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 315 | |
| 316 | html_messages.m_htmlcxx . . $ PreparedHtml#m_html. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). html_messages.m_htmlcxx . . $ PreparedHtml#m_html..replacecxx . . $ QString#replace(bb08417d5c5b4bb6).(exp_symbols, QStringcxx . . $ QString#QString(ced63f7c635d850d).()); |
| 317 | |
| 318 | return html_messages; |
| 319 | } |
| 320 | |
| 321 | double TextBrowserViewercxx . . $ TextBrowserViewer#::verticalScrollBarPositioncxx . . $ TextBrowserViewer#verticalScrollBarPosition(21b6c25e127938e2).() const { |
| 322 | return verticalScrollBarcxx . . $ QAbstractScrollArea#verticalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).(); |
| 323 | } |
| 324 | |
| 325 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setVerticalScrollBarPositioncxx . . $ TextBrowserViewer#setVerticalScrollBarPosition(ba8836b59fb42830).(double pos) { |
| 326 | verticalScrollBarcxx . . $ QAbstractScrollArea#verticalScrollBar(49d9510c6adf8c19).()->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(int(pos)); |
| 327 | } |
| 328 | |
| 329 | void TextBrowserViewercxx . . $ TextBrowserViewer#::applyFontcxx . . $ TextBrowserViewer#applyFont(d0a4bd0c8524b912).(const QFontcxx . . $ QFont#& fon) { |
| 330 | m_baseFontcxx . . $ TextBrowserViewer#m_baseFont. =cxx . . $ QFont#`operator=`(49a3a30190653d0b). fon; |
| 331 | setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(fon); |
| 332 | setZoomFactorcxx . . $ TextBrowserViewer#setZoomFactor(ba8836b59fb42830).(zoomFactorcxx . . $ TextBrowserViewer#zoomFactor(21b6c25e127938e2).()); |
| 333 | } |
| 334 | |
| 335 | qrealcxx . . $ qreal# TextBrowserViewercxx . . $ TextBrowserViewer#::zoomFactorcxx . . $ TextBrowserViewer#zoomFactor(21b6c25e127938e2).() const { |
| 336 | return m_zoomFactorcxx . . $ TextBrowserViewer#m_zoomFactor.; |
| 337 | } |
| 338 | |
| 339 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setZoomFactorcxx . . $ TextBrowserViewer#setZoomFactor(ba8836b59fb42830).(qrealcxx . . $ qreal# zoom_factor) { |
| 340 | m_zoomFactorcxx . . $ TextBrowserViewer#m_zoomFactor. = zoom_factor; |
| 341 | |
| 342 | auto fon = fontcxx . . $ QFont#QFont(d0a4bd0c8524b912).(); |
| 343 | |
| 344 | fon.setPointSizeFcxx . . $ QFont#setPointSizeF(ba8836b59fb42830).(m_baseFontcxx . . $ TextBrowserViewer#m_baseFont..pointSizeFcxx . . $ QFont#pointSizeF(21b6c25e127938e2).() * zoom_factor); |
| 345 | |
| 346 | setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(fon); |
| 347 | } |
| 348 | |
| 349 | void TextBrowserViewercxx . . $ TextBrowserViewer#::contextMenuEventcxx . . $ TextBrowserViewer#contextMenuEvent(ebb2569a74e11126).(QContextMenuEventcxx . . $ QContextMenuEvent#* event) { |
| 350 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 351 | |
| 352 | auto* menu = createStandardContextMenucxx . . $ QTextEdit#createStandardContextMenu(2b7d59c5dd0df5b8).(event->poscxx . . $ QContextMenuEvent#pos(6de9f7a200ca710c).()); |
| 353 | |
| 354 | if (menu == nullptr) { |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | /* |
| 359 | connect(menu, &QMenu::aboutToHide, this, [menu] { |
| 360 | menu->deleteLater(); |
| 361 | });*/ |
| 362 | |
| 363 | if (m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..isNullcxx . . $ QScopedPointer#isNull(3482b152b9333168).()) { |
| 364 | m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..resetcxx . . $ QScopedPointer#reset(b1f27668ced7db9d).(new QActioncxx . . $ QAction#(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("viewimage"), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image-x-generic")), |
| 365 | trcxx . . $ TextBrowserViewer#tr(75d9f1c324b4579d).("Enable external resources"), |
| 366 | this)); |
| 367 | m_actionDownloadLinkcxx . . $ TextBrowserViewer#m_actionDownloadLink..resetcxx . . $ QScopedPointer#reset(b1f27668ced7db9d).(new QActioncxx . . $ QAction#(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("download")), trcxx . . $ TextBrowserViewer#tr(75d9f1c324b4579d).("Download"), this)); |
| 368 | |
| 369 | m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 370 | m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(resourcesEnabledcxx . . $ TextBrowserViewer#resourcesEnabled(50ce9a9e25b4a850).()); |
| 371 | |
| 372 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_actionDownloadLinkcxx . . $ TextBrowserViewer#m_actionDownloadLink..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).(), &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &TextBrowserViewercxx . . $ TextBrowserViewer#::downloadLinkcxx . . $ TextBrowserViewer#downloadLink(49f6e7a06ebc5aa8).); |
| 373 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).(), &QActioncxx . . $ QAction#::toggledcxx . . $ QAction#toggled(b45ddcbc8423892c)., this, &TextBrowserViewercxx . . $ TextBrowserViewer#::enableResourcescxx . . $ TextBrowserViewer#enableResources(b45ddcbc8423892c).); |
| 374 | } |
| 375 | |
| 376 | menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(m_actionEnableResourcescxx . . $ TextBrowserViewer#m_actionEnableResources..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()); |
| 377 | menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(m_actionDownloadLinkcxx . . $ TextBrowserViewer#m_actionDownloadLink..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()); |
| 378 | |
| 379 | auto anchor = anchorAtcxx . . $ QTextEdit#anchorAt(1aee97061bdd8881).(event->poscxx . . $ QContextMenuEvent#pos(6de9f7a200ca710c).()); |
| 380 | |
| 381 | m_lastContextMenuPoscxx . . $ TextBrowserViewer#m_lastContextMenuPos. =cxx . . $ QPoint#`operator=`(e5d756a35ca1af6b). event->poscxx . . $ QContextMenuEvent#pos(6de9f7a200ca710c).(); |
| 382 | m_actionDownloadLinkcxx . . $ TextBrowserViewer#m_actionDownloadLink..datacxx . . $ QScopedPointer#data(34d6acfd341ba7ab).()->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(!anchor.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()); |
| 383 | |
| 384 | processContextMenucxx . . $ WebViewer#processContextMenu(50faf3e001f68251).(menu, event); |
| 385 | |
| 386 | menu->popupcxx . . $ QMenu#popup(371d674a5bfc952e).(event->globalPoscxx . . $ QContextMenuEvent#globalPos(6de9f7a200ca710c).()); |
| 387 | } |
| 388 | |
| 389 | void TextBrowserViewercxx . . $ TextBrowserViewer#::resizeEventcxx . . $ TextBrowserViewer#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#* event) { |
| 390 | // Notify parents about changed geometry. |
| 391 | updateGeometrycxx . . $ QWidget#updateGeometry(49f6e7a06ebc5aa8).(); |
| 392 | QTextBrowsercxx . . $ QTextBrowser#::resizeEventcxx . . $ QTextEdit#resizeEvent(eeeec21cf8dc0387).(event); |
| 393 | } |
| 394 | |
| 395 | void TextBrowserViewercxx . . $ TextBrowserViewer#::wheelEventcxx . . $ TextBrowserViewer#wheelEvent(92d40974398e4832).(QWheelEventcxx . . $ QWheelEvent#* event) { |
| 396 | // NOTE: Skip base class implemetation. |
| 397 | QAbstractScrollAreacxx . . $ QAbstractScrollArea#::wheelEventcxx . . $ QAbstractScrollArea#wheelEvent(92d40974398e4832).(event); |
| 398 | updateMicroFocuscxx . . $ QWidget#updateMicroFocus(906b096467631113).(); |
| 399 | } |
| 400 | |
| 401 | void TextBrowserViewercxx . . $ TextBrowserViewer#::enableResourcescxx . . $ TextBrowserViewer#enableResources(b45ddcbc8423892c).(bool enable) { |
| 402 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), Messagescxx . . $ Messages/::ShowResourcesInArticlescxx . . $ Messages/ShowResourcesInArticles., enablecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).); |
| 403 | setResourcesEnabledcxx . . $ TextBrowserViewer#setResourcesEnabled(b45ddcbc8423892c).(enable); |
| 404 | } |
| 405 | |
| 406 | void TextBrowserViewercxx . . $ TextBrowserViewer#::downloadLinkcxx . . $ TextBrowserViewer#downloadLink(49f6e7a06ebc5aa8).() { |
| 407 | auto url = QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(anchorAtcxx . . $ QTextEdit#anchorAt(1aee97061bdd8881).(m_lastContextMenuPoscxx . . $ TextBrowserViewer#m_lastContextMenuPos.)); |
| 408 | |
| 409 | if (url.isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).()) { |
| 410 | const QUrlcxx . . $ QUrl# resolved_url = (m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).() && url.isRelativecxx . . $ QUrl#isRelative(50ce9a9e25b4a850).()) ? m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..resolvedcxx . . $ QUrl#resolved(12b57030d3a86ba7).(url) : urlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 411 | |
| 412 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->downloadManagercxx . . $ Application#downloadManager(456f9618ee541670).()->downloadcxx . . $ DownloadManager#download(37355d2f77053a23).(resolved_url); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | void TextBrowserViewercxx . . $ TextBrowserViewer#::onAnchorClickedcxx . . $ TextBrowserViewer#onAnchorClicked(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 417 | if (!url.isEmptycxx . . $ QUrl#isEmpty(50ce9a9e25b4a850).()) { |
| 418 | const QUrlcxx . . $ QUrl# resolved_url = (m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).() && url.isRelativecxx . . $ QUrl#isRelative(50ce9a9e25b4a850).()) ? m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl..resolvedcxx . . $ QUrl#resolved(12b57030d3a86ba7).(url) : urlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 419 | const bool ctrl_pressed = |
| 420 | Globalscxx . . $ Globals#::hasFlagcxx . . $ Globals#hasFlag(e81494ae8084f6ba).(QGuiApplicationcxx . . $ QGuiApplication#::keyboardModifierscxx . . $ QGuiApplication#keyboardModifiers(bd131f8973b1b71c).(), Qtcxx . . $ Qt/::KeyboardModifiercxx . . $ Qt/KeyboardModifier#::ControlModifiercxx . . $ Qt/ControlModifier.); |
| 421 | |
| 422 | if (ctrl_pressed) { |
| 423 | // Open in new tab. |
| 424 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormcxx . . $ Application#mainForm(da73b49c3e1670d9).()->tabWidgetcxx . . $ FormMain#tabWidget(331dafdc3f7547ba).()->addLinkedBrowsercxx . . $ TabWidget#addLinkedBrowser(2d9a7f822672be54).(resolved_url); |
| 425 | } |
| 426 | else { |
| 427 | bool open_externally_now = |
| 428 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Browser), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Browser::OpenLinksInExternalBrowserRightAway)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 429 | |
| 430 | if (open_externally_now) { |
| 431 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->openUrlInExternalBrowsercxx . . $ WebFactory#openUrlInExternalBrowser(dd54f9efb9153ea5).(resolved_urlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb)..toStringcxx . . $ QUrl#toString(632475ebea3355f1).()); |
| 432 | |
| 433 | if (qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).() |
| 434 | ->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Messages::BringAppToFrontAfterMessageOpenedExternally)) |
| 435 | .toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) { |
| 436 | QTimercxx . . $ QTimer#::singleShotcxx . . $ QTimer#singleShot(aa6a4c6cfc6f625a).(1000, qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!, []() { |
| 437 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormcxx . . $ Application#mainForm(da73b49c3e1670d9).()->displaycxx . . $ FormMain#display(49f6e7a06ebc5aa8).(); |
| 438 | }); |
| 439 | } |
| 440 | } |
| 441 | else { |
| 442 | setUrlcxx . . $ TextBrowserViewer#setUrl(37355d2f77053a23).(resolved_url); |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setHtmlcxx . . $ TextBrowserViewer#setHtml(9b3514a5b076b66b).(const QStringcxx . . $ QString#& html, const QUrlcxx . . $ QUrl#& base_url) { |
| 449 | if (m_resourcesEnabledcxx . . $ TextBrowserViewer#m_resourcesEnabled.) { |
| 450 | // NOTE: This regex is problematic as it does not work for ALL |
| 451 | // HTMLs, maybe use XML parsing to extract what we need? |
| 452 | static QRegularExpressioncxx . . $ QRegularExpression# img_tag_rgxcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).("\\<img[^\\>]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 453 | QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 454 | QRegularExpressionMatchIteratorcxx . . $ QRegularExpressionMatchIterator# i = img_tag_rgx.globalMatchcxx . . $ QRegularExpression#globalMatch(27b5aa3d61ae1b2f).(html); |
| 455 | QListcxx . . $ QList#<QUrlcxx . . $ QUrl#> found_resourcescxx . . $ QList#QList(ced63f7c635d850d).; |
| 456 | |
| 457 | while (i.hasNextcxx . . $ QRegularExpressionMatchIterator#hasNext(50ce9a9e25b4a850).()) { |
| 458 | QRegularExpressionMatchcxx . . $ QRegularExpressionMatch# match = i.nextcxx . . $ QRegularExpressionMatchIterator#next(5870644aafa115db).(); |
| 459 | auto captured_url = QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(match.capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1)); |
| 460 | auto resolved_captured_url = |
| 461 | (base_url.isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).() && captured_url.isRelativecxx . . $ QUrl#isRelative(50ce9a9e25b4a850).()) ? base_url.resolvedcxx . . $ QUrl#resolved(12b57030d3a86ba7).(captured_url) : captured_urlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 462 | |
| 463 | if (!found_resources.containscxx . . $ QListSpecialMethodsBase#contains(7349e39e0b02d05c).(resolved_captured_url)) { |
| 464 | found_resources.appendcxx . . $ QList#append(200d2dc08238a4ed).(resolved_captured_url); |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | auto really_needed_resources = boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(found_resources) |
| 469 | .wherecxx . . $ boolinq/Linq#where(d169c8e6e9294137).([cxx . . $ std/function#function(bdc3712e480e4d04).this](const QUrlcxx . . $ QUrl#& res) { |
| 470 | return !m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources..containscxx . . $ QMap#contains(8877ebe272b9620d).(res); |
| 471 | }) |
| 472 | .toStdListcxx . . $ boolinq/Linq#toStdList(2989115be80c3067).(); |
| 473 | |
| 474 | m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources. =cxx . . $ QList#`operator=`(b57f420797d06e3a). FROM_STD_LISTcxx . . $ `src/librssguard/definitions/definitions.h:405:9`!(QList<QUrl>, really_needed_resources); |
| 475 | } |
| 476 | else { |
| 477 | m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources. =cxx . . $ QList#`operator=`(f67483249d2fd4fc). {cxx . . $ std/initializer_list#initializer_list(ced63f7c635d850d).}; |
| 478 | } |
| 479 | |
| 480 | setHtmlPrivatecxx . . $ TextBrowserViewer#setHtmlPrivate(9b3514a5b076b66b).(html, base_url); |
| 481 | |
| 482 | /* |
| 483 | QTextCursor cr(m_document.data()); |
| 484 | |
| 485 | cr.movePosition(QTextCursor::MoveOperation::Start); |
| 486 | |
| 487 | // this can be used instead of regexps, just browse document and collect resource addresses directly |
| 488 | while (!cr.atEnd()) { |
| 489 | if (!cr.movePosition(QTextCursor::MoveOperation::NextBlock)) { |
| 490 | break; |
| 491 | } |
| 492 | |
| 493 | QTextBlock::iterator it; |
| 494 | for (it = cr.block().begin(); !(it.atEnd()); ++it) { |
| 495 | QTextFragment currentFragment = it.fragment(); |
| 496 | if (currentFragment.isValid()) { |
| 497 | auto aa = currentFragment.charFormat().anchorHref(); |
| 498 | |
| 499 | if (!aa.isEmpty()) { |
| 500 | auto xx = 5; |
| 501 | } |
| 502 | else if (currentFragment.charFormat().isImageFormat()) { |
| 503 | aa = currentFragment.charFormat().toImageFormat().name(); |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | } |
| 508 | */ |
| 509 | |
| 510 | if (!m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 511 | QTimercxx . . $ QTimer#::singleShotcxx . . $ QTimer#singleShot(aa6a4c6cfc6f625a).(20, this, &TextBrowserViewercxx . . $ TextBrowserViewer#::reloadHtmlDelayedcxx . . $ TextBrowserViewer#reloadHtmlDelayed(49f6e7a06ebc5aa8).); |
| 512 | } |
| 513 | |
| 514 | setVerticalScrollBarPositioncxx . . $ TextBrowserViewer#setVerticalScrollBarPosition(ba8836b59fb42830).(0.0); |
| 515 | } |
| 516 | |
| 517 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setReadabledHtmlcxx . . $ TextBrowserViewer#setReadabledHtml(9b3514a5b076b66b).(const QStringcxx . . $ QString#& html, const QUrlcxx . . $ QUrl#& base_url) { |
| 518 | setHtmlcxx . . $ TextBrowserViewer#setHtml(9b3514a5b076b66b).(html, base_url); |
| 519 | } |
| 520 | |
| 521 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setHtmlPrivatecxx . . $ TextBrowserViewer#setHtmlPrivate(9b3514a5b076b66b).(const QStringcxx . . $ QString#& html, const QUrlcxx . . $ QUrl#& base_url) { |
| 522 | m_currentUrlcxx . . $ TextBrowserViewer#m_currentUrl. =cxx . . $ QUrl#`operator=`(5236b30dc3aa36dd). base_url; |
| 523 | m_currentHtmlcxx . . $ TextBrowserViewer#m_currentHtml. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). html; |
| 524 | |
| 525 | QTextBrowsercxx . . $ QTextBrowser#::setHtmlcxx . . $ QTextEdit#setHtml(3520e46b33348bf6).(html); |
| 526 | setZoomFactorcxx . . $ TextBrowserViewer#setZoomFactor(ba8836b59fb42830).(m_zoomFactorcxx . . $ TextBrowserViewer#m_zoomFactor.); |
| 527 | |
| 528 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! pageTitleChangedcxx . . $ TextBrowserViewer#pageTitleChanged(3520e46b33348bf6).(documentTitlecxx . . $ QTextEdit#documentTitle(6ef7b6c27b00b43d).()); |
| 529 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! pageUrlChangedcxx . . $ TextBrowserViewer#pageUrlChanged(37355d2f77053a23).(base_url); |
| 530 | } |
| 531 | |
| 532 | TextBrowserDocumentcxx . . $ TextBrowserDocument#::TextBrowserDocumentcxx . . $ TextBrowserDocument#TextBrowserDocument(77e7dbd57f0acfc5).(TextBrowserViewercxx . . $ TextBrowserViewer#* parent) : QTextDocumentcxx . . $ QTextDocument#(parent) { |
| 533 | m_viewercxx . . $ TextBrowserDocument#m_viewer. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). parent; |
| 534 | } |
| 535 | |
| 536 | QVariantcxx . . $ QVariant# TextBrowserDocumentcxx . . $ TextBrowserDocument#::loadResourcecxx . . $ TextBrowserDocument#loadResource(8c09c4293100362).(int type, const QUrlcxx . . $ QUrl#& name) { |
| 537 | return m_viewercxx . . $ TextBrowserDocument#m_viewer.->cxx . . $ QPointer#`operator->`(34d6acfd341ba7ab).loadOneResourcecxx . . $ TextBrowserViewer#loadOneResource(8c09c4293100362).(type, name); |
| 538 | } |
| 539 | |
| 540 | void TextBrowserViewercxx . . $ TextBrowserViewer#::reloadHtmlDelayedcxx . . $ TextBrowserViewer#reloadHtmlDelayed(49f6e7a06ebc5aa8).() { |
| 541 | if (!m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 542 | downloadNextNeededResourcecxx . . $ TextBrowserViewer#downloadNextNeededResource(49f6e7a06ebc5aa8).(); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | void TextBrowserViewercxx . . $ TextBrowserViewer#::downloadNextNeededResourcecxx . . $ TextBrowserViewer#downloadNextNeededResource(49f6e7a06ebc5aa8).() { |
| 547 | if (m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 548 | // Everything is downloaded. |
| 549 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! reloadDocumentcxx . . $ TextBrowserViewer#reloadDocument(49f6e7a06ebc5aa8).(); |
| 550 | } |
| 551 | else { |
| 552 | QUrlcxx . . $ QUrl# res = m_neededResourcescxx . . $ TextBrowserViewer#m_neededResources..takeFirstcxx . . $ QList#takeFirst(5f357b03ed472e5e).(); |
| 553 | |
| 554 | QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(8b0e30ae6de741c4).(m_resourceDownloadercxx . . $ TextBrowserViewer#m_resourceDownloader., |
| 555 | "manipulateData", |
| 556 | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::QueuedConnectioncxx . . $ Qt/QueuedConnection., |
| 557 | Q_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:63:9`!(QString, WebFactory::unescapeHtml(res.toString())), |
| 558 | Q_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:63:9`!(QNetworkAccessManager::Operation, QNetworkAccessManager::Operation::GetOperation), |
| 559 | Q_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:63:9`!(QByteArray, {}), |
| 560 | Q_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:63:9`!(int, 5000)); |
| 561 | |
| 562 | /* |
| 563 | m_resourceDownloader.data()->manipulateData(qApp->web()->unescapeHtml(res.toString()), |
| 564 | QNetworkAccessManager::Operation::GetOperation, |
| 565 | {}, |
| 566 | 5000); |
| 567 | */ |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | void TextBrowserViewercxx . . $ TextBrowserViewer#::resourceDownloadedcxx . . $ TextBrowserViewer#resourceDownloaded(377b816ef29857eb).(const QUrlcxx . . $ QUrl#& url, |
| 572 | QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# status, |
| 573 | int http_code, |
| 574 | const QByteArraycxx . . $ QByteArray#& contents) { |
| 575 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(http_code) |
| 576 | if (!m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources..containscxx . . $ QMap#contains(8877ebe272b9620d).(url)) { |
| 577 | m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources..insertcxx . . $ QMap#insert(929a1ed410fe8423).(url, QMapcxx . . $ QMap#QMap(49f6e7a06ebc5aa8).<int, QByteArraycxx . . $ QByteArray#>()); |
| 578 | } |
| 579 | |
| 580 | QMapcxx . . $ QMap#<int, QByteArraycxx . . $ QByteArray#>& resource_data_all_sizes = m_loadedResourcescxx . . $ TextBrowserViewer#m_loadedResources.[cxx . . $ QMap#`operator[]`(bbd415b616967878).url]; |
| 581 | |
| 582 | resource_data_all_sizes.clearcxx . . $ QMap#clear(49f6e7a06ebc5aa8).(); |
| 583 | |
| 584 | if (status == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 585 | resource_data_all_sizes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(0, contents); |
| 586 | } |
| 587 | else { |
| 588 | resource_data_all_sizes.insertcxx . . $ QMap#insert(929a1ed410fe8423).(0, {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}); |
| 589 | } |
| 590 | |
| 591 | downloadNextNeededResourcecxx . . $ TextBrowserViewer#downloadNextNeededResource(49f6e7a06ebc5aa8).(); |
| 592 | } |
| 593 | |
| 594 | PreparedHtmlcxx . . $ PreparedHtml# TextBrowserViewercxx . . $ TextBrowserViewer#::prepareLegacyHtmlForMessagecxx . . $ TextBrowserViewer#prepareLegacyHtmlForMessage(6b71c5483f38f48).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& messages, |
| 595 | RootItemcxx . . $ RootItem#* selected_item) const { |
| 596 | PreparedHtmlcxx . . $ PreparedHtml# html; |
| 597 | bool acc_displays_enclosures = |
| 598 | selected_item == nullptr || selected_item->getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).()->displaysEnclosurescxx . . $ ServiceRoot#displaysEnclosures(50ce9a9e25b4a850).(); |
| 599 | |
| 600 | for (const Messagecxx . . $ Message#& message : messages) { |
| 601 | bool is_plain = !TextFactorycxx . . $ TextFactory#::couldBeHtmlcxx . . $ TextFactory#couldBeHtml(e1defb592416720d).(message.m_contentscxx . . $ Message#m_contents.); |
| 602 | |
| 603 | // Add title. |
| 604 | if (!message.m_urlcxx . . $ Message#m_url..isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 605 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<h2 align=\"center\"><a href=\"%2\">%1</a></h2>").argcxx . . $ QString#arg(89b093bd48b6d6c0).(message.m_titlecxx . . $ Message#m_title., message.m_urlcxx . . $ Message#m_url.); |
| 606 | } |
| 607 | else { |
| 608 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<h2 align=\"center\">%1</h2>").argcxx . . $ QString#arg(ad0bca07273edcc2).(message.m_titlecxx . . $ Message#m_title.); |
| 609 | } |
| 610 | |
| 611 | // Start contents. |
| 612 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<div>"); |
| 613 | |
| 614 | // Add links to enclosures. |
| 615 | if (acc_displays_enclosures) { |
| 616 | for (const Enclosurecxx . . $ Enclosure#& enc : message.m_enclosurescxx . . $ Message#m_enclosures.) { |
| 617 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("[<a href=\"%1\">%2</a>]").argcxx . . $ QString#arg(89b093bd48b6d6c0).(enc.m_urlcxx . . $ Enclosure#m_url., enc.m_mimeTypecxx . . $ Enclosure#m_mimeType.); |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | // Display enclosures which are pictures if user has it enabled. |
| 622 | auto first_enc_break_added = false; |
| 623 | |
| 624 | if (acc_displays_enclosures && |
| 625 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Messages::DisplayEnclosuresInMessage)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) { |
| 626 | for (const Enclosurecxx . . $ Enclosure#& enc : message.m_enclosurescxx . . $ Message#m_enclosures.) { |
| 627 | if (enc.m_mimeTypecxx . . $ Enclosure#m_mimeType..startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("image/"))) { |
| 628 | if (!first_enc_break_added) { |
| 629 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<br/>"); |
| 630 | first_enc_break_added = true; |
| 631 | } |
| 632 | |
| 633 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<img src=\"%1\" /><br/>").argcxx . . $ QString#arg(ad0bca07273edcc2).(enc.m_urlcxx . . $ Enclosure#m_url.); |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | // Append actual contents of article and convert to HTML if needed. |
| 639 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). is_plain ? Qtcxx . . $ Qt/::convertFromPlainTextcxx . . $ Qt/convertFromPlainText(6e04cfe71d3709ab).(message.m_contentscxx . . $ Message#m_contents., Qtcxx . . $ Qt/::WhiteSpaceModecxx . . $ Qt/WhiteSpaceMode#::WhiteSpaceNormalcxx . . $ Qt/WhiteSpaceNormal.) |
| 640 | : messagecxx . . $ QString#QString(132dd6869045752b)..m_contentscxx . . $ Message#m_contents.; |
| 641 | |
| 642 | static QRegularExpressioncxx . . $ QRegularExpression# img_tag_rgxcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("\\<img[^\\>]*src\\s*=\\s*[\"\']([^\"\']*)[\"\'][^\\>]*\\>"), |
| 643 | QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 644 | |
| 645 | // Extract all images links from article to be appended to end of article. |
| 646 | QRegularExpressionMatchIteratorcxx . . $ QRegularExpressionMatchIterator# i = img_tag_rgx.globalMatchcxx . . $ QRegularExpression#globalMatch(27b5aa3d61ae1b2f).(html.m_htmlcxx . . $ PreparedHtml#m_html.); |
| 647 | QStringcxx . . $ QString# pictures_htmlcxx . . $ QString#QString(ced63f7c635d850d).; |
| 648 | |
| 649 | while (i.hasNextcxx . . $ QRegularExpressionMatchIterator#hasNext(50ce9a9e25b4a850).()) { |
| 650 | QRegularExpressionMatchcxx . . $ QRegularExpressionMatch# match = i.nextcxx . . $ QRegularExpressionMatchIterator#next(5870644aafa115db).(); |
| 651 | auto captured_url = match.capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 652 | |
| 653 | pictures_html +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<br/>[%1] <a href=\"%2\">%2</a>").argcxx . . $ QString#arg(89b093bd48b6d6c0).(trcxx . . $ TextBrowserViewer#tr(75d9f1c324b4579d).("image"), captured_url); |
| 654 | } |
| 655 | |
| 656 | // Make alla images clickable as links and also resize them if user has it setup. |
| 657 | auto forced_img_size = |
| 658 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Messages), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Messages::LimitArticleImagesHeight)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 659 | |
| 660 | // Fixup all "img" tags. |
| 661 | html.m_htmlcxx . . $ PreparedHtml#m_html. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). html.m_htmlcxx . . $ PreparedHtml#m_html..replacecxx . . $ QString#replace(bb08417d5c5b4bb6).(img_tag_rgx, |
| 662 | QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<a href=\"\\1\"><img height=\"%1\" src=\"\\1\" /></a>") |
| 663 | .argcxx . . $ QString#arg(ad0bca07273edcc2).(forced_img_size <= 0 ? QStringcxx . . $ QString#QString(ced63f7c635d850d).() : QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(forced_img_size))); |
| 664 | |
| 665 | // Append generated list of images. |
| 666 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). pictures_html; |
| 667 | } |
| 668 | |
| 669 | // Close contents. |
| 670 | html.m_htmlcxx . . $ PreparedHtml#m_html. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("</div>"); |
| 671 | |
| 672 | QStringcxx . . $ QString# base_urlcxx . . $ QString#QString(ced63f7c635d850d).; |
| 673 | auto* feed = selected_item->getParentServiceRootcxx . . $ RootItem#getParentServiceRoot(56209a8cf0725652).() |
| 674 | ->getItemFromSubTreecxx . . $ RootItem#getItemFromSubTree(d39f768279e67ac5).([cxx . . $ std/function#function(bdc3712e480e4d04).messages](const RootItemcxx . . $ RootItem#* it) { |
| 675 | return it->kindcxx . . $ RootItem#kind(faa800885e6a64b).() == RootItemcxx . . $ RootItem#::Kindcxx . . $ RootItem#Kind#::Feedcxx . . $ RootItem#Kind#Feed. && it->customIdcxx . . $ RootItem#customId(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(5bc2975d2d751687). messages.atcxx . . $ QList#at(c7965f769b39929).(0).m_feedIdcxx . . $ Message#m_feedId.; |
| 676 | }) |
| 677 | ->toFeedcxx . . $ RootItem#toFeed(6205f4b142e8b232).(); |
| 678 | |
| 679 | if (feed != nullptr) { |
| 680 | QUrlcxx . . $ QUrl# urlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(NetworkFactorycxx . . $ NetworkFactory#::sanitizeUrlcxx . . $ NetworkFactory#sanitizeUrl(fd988a2ab94d906b).(feed->sourcecxx . . $ Feed#source(6ef7b6c27b00b43d).())); |
| 681 | |
| 682 | if (url.isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).()) { |
| 683 | base_url =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url.schemecxx . . $ QUrl#scheme(6ef7b6c27b00b43d).() + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("://") + url.hostcxx . . $ QUrl#host(9d7420bec8bfe6c9).(); |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | html.m_baseUrlcxx . . $ PreparedHtml#m_baseUrl. =cxx . . $ QUrl#`operator=`(d8b3c366b09df6fa). base_url; |
| 688 | |
| 689 | return html; |
| 690 | } |
| 691 | |
| 692 | bool TextBrowserViewercxx . . $ TextBrowserViewer#::resourcesEnabledcxx . . $ TextBrowserViewer#resourcesEnabled(50ce9a9e25b4a850).() const { |
| 693 | return m_resourcesEnabledcxx . . $ TextBrowserViewer#m_resourcesEnabled.; |
| 694 | } |
| 695 | |
| 696 | void TextBrowserViewercxx . . $ TextBrowserViewer#::setResourcesEnabledcxx . . $ TextBrowserViewer#setResourcesEnabled(b45ddcbc8423892c).(bool enabled) { |
| 697 | m_resourcesEnabledcxx . . $ TextBrowserViewer#m_resourcesEnabled. = enabled; |
| 698 | } |
| 699 | |
| 700 | ContextMenuDatacxx . . $ ContextMenuData# TextBrowserViewercxx . . $ TextBrowserViewer#::provideContextMenuDatacxx . . $ TextBrowserViewer#provideContextMenuData(f150d2abff9f3aa2).(QContextMenuEventcxx . . $ QContextMenuEvent#* event) const { |
| 701 | ContextMenuDatacxx . . $ ContextMenuData# c; |
| 702 | |
| 703 | QStringcxx . . $ QString# anchor = anchorAtcxx . . $ QTextEdit#anchorAt(1aee97061bdd8881).(event->poscxx . . $ QContextMenuEvent#pos(6de9f7a200ca710c).()); |
| 704 | |
| 705 | if (!anchor.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 706 | c.m_linkUrlcxx . . $ ContextMenuData#m_linkUrl. =cxx . . $ QUrl#`operator=`(d8b3c366b09df6fa). anchor; |
| 707 | } |
| 708 | |
| 709 | return c; |
| 710 | } |