| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #include "gui/webbrowser.h" |
| 4 | |
| 5 | #include "definitions/globals.h" |
| 6 | #include "gui/dialogs/formmain.h" |
| 7 | #include "gui/messagebox.h" |
| 8 | #include "gui/reusable/locationlineedit.h" |
| 9 | #include "gui/reusable/searchtextwidget.h" |
| 10 | #include "gui/tabwidget.h" |
| 11 | #include "gui/webviewers/webviewer.h" |
| 12 | #include "miscellaneous/application.h" |
| 13 | #include "miscellaneous/iconfactory.h" |
| 14 | #include "miscellaneous/settings.h" |
| 15 | #include "network-web/articleparse.h" |
| 16 | #include "network-web/networkfactory.h" |
| 17 | #include "network-web/readability.h" |
| 18 | #include "network-web/webfactory.h" |
| 19 | |
| 20 | #include <QJsonObject> |
| 21 | #include <QKeyEvent> |
| 22 | #include <QProgressBar> |
| 23 | #include <QScrollBar> |
| 24 | #include <QTimer> |
| 25 | #include <QToolBar> |
| 26 | #include <QToolTip> |
| 27 | #include <QWidgetAction> |
| 28 | |
| 29 | WebBrowser::WebBrowser(WebViewer* viewer, QWidget* parent) |
| 30 | : TabContent(parent), m_layout(new QVBoxLayout(this)), m_toolBar(new QToolBar(tr("Navigation panel"), this)), |
| 31 | m_webView(viewer), m_searchWidget(new SearchTextWidget(this)), m_txtLocation(new LocationLineEdit(this)), |
| 32 | m_actionOpenInSystemBrowser(new QAction(qApp->icons()->fromTheme(QSL("document-open")), |
| 33 | tr("Open this website in system web browser"), |
| 34 | this)), |
| 35 | #if defined(ENABLE_MEDIAPLAYER) |
| 36 | m_actionPlayPageInMediaPlayer(new QAction(qApp->icons()->fromTheme(QSL("player_play"), QSL("media-playback-start")), |
| 37 | tr("Play in media player"), |
| 38 | this)), |
| 39 | #endif |
| 40 | m_actionReadabilePage(new QAction(qApp->icons()->fromTheme(QSL("text-html")), |
| 41 | tr("View website in reader mode"), |
| 42 | this)), |
| 43 | m_actionGetFullArticle(new QAction(qApp->icons()->fromTheme(QSL("applications-office")), |
| 44 | tr("Load full source article"), |
| 45 | this)) { |
| 46 | if (m_webView == nullptr) { |
| 47 | m_webView = qApp->createWebView(); |
| 48 | dynamic_cast<QWidget*>(m_webView)->setParent(this); |
| 49 | } |
| 50 | |
| 51 | // Initialize the components and layout. |
| 52 | bindWebView(); |
| 53 | |
| 54 | m_webView->setZoomFactor(qApp->settings()->value(GROUP(Messages), SETTING(Messages::Zoom)).toDouble()); |
| 55 | |
| 56 | initializeLayout(); |
| 57 | |
| 58 | setFocusProxy(m_txtLocation); |
| 59 | setTabOrder(m_txtLocation, m_toolBar); |
| 60 | setTabOrder(m_toolBar, dynamic_cast<QWidget*>(m_webView)); |
| 61 | |
| 62 | createConnections(); |
| 63 | reloadFontSettings(); |
| 64 | } |
| 65 | |
| 66 | void WebBrowser::bindWebView() { |
| 67 | m_webView->bindToBrowser(this); |
| 68 | |
| 69 | auto* qobj_viewer = dynamic_cast<QObject*>(m_webView); |
| 70 | |
| 71 | connect(qobj_viewer, SIGNAL(linkMouseHighlighted(QUrl)), this, SLOT(onLinkHovered(QUrl))); |
| 72 | connect(qobj_viewer, SIGNAL(pageTitleChanged(QString)), this, SLOT(onTitleChanged(QString))); |
| 73 | connect(qobj_viewer, SIGNAL(pageUrlChanged(QUrl)), this, SLOT(updateUrl(QUrl))); |
| 74 | connect(qobj_viewer, SIGNAL(pageIconChanged(QIcon)), this, SLOT(onIconChanged(QIcon))); |
| 75 | connect(qobj_viewer, SIGNAL(loadingStarted()), this, SLOT(onLoadingStarted())); |
| 76 | connect(qobj_viewer, SIGNAL(loadingProgress(int)), this, SLOT(onLoadingProgress(int))); |
| 77 | connect(qobj_viewer, SIGNAL(loadingFinished(bool)), this, SLOT(onLoadingFinished(bool))); |
| 78 | connect(qobj_viewer, SIGNAL(newWindowRequested(WebViewer*)), this, SLOT(newWindowRequested(WebViewer*))); |
| 79 | connect(qobj_viewer, SIGNAL(closeWindowRequested()), this, SIGNAL(windowCloseRequested())); |
| 80 | } |
| 81 | |
| 82 | void WebBrowser::createConnections() { |
| 83 | installEventFilter(this); |
| 84 | |
| 85 | connect(m_searchWidget, &SearchTextWidget::searchCancelled, this, [this]() { |
| 86 | m_webView->findText(QString(), {}); |
| 87 | }); |
| 88 | connect(m_searchWidget, &SearchTextWidget::searchForText, this, [this](const QString& text, bool backwards) { |
| 89 | m_webView->findText(text, backwards); |
| 90 | m_searchWidget->setFocus(); |
| 91 | }); |
| 92 | |
| 93 | connect(m_actionOpenInSystemBrowser, &QAction::triggered, this, &WebBrowser::openCurrentSiteInSystemBrowser); |
| 94 | connect(m_actionReadabilePage, &QAction::triggered, this, &WebBrowser::readabilePage); |
| 95 | connect(m_actionGetFullArticle, &QAction::triggered, this, &WebBrowser::getFullArticle); |
| 96 | |
| 97 | #if defined(ENABLE_MEDIAPLAYER) |
| 98 | connect(m_actionPlayPageInMediaPlayer, &QAction::triggered, this, &WebBrowser::playCurrentSiteInMediaPlayer); |
| 99 | #endif |
| 100 | |
| 101 | connect(m_txtLocation, |
| 102 | &LocationLineEdit::submitted, |
| 103 | this, |
| 104 | static_cast<void (WebBrowser::*)(const QString&)>(&WebBrowser::loadUrl)); |
| 105 | |
| 106 | connect(qApp->web()->readability(), &Readability::htmlReadabled, this, &WebBrowser::setReadabledHtml); |
| 107 | connect(qApp->web()->readability(), &Readability::errorOnHtmlReadabiliting, this, &WebBrowser::readabilityFailed); |
| 108 | |
| 109 | connect(qApp->web()->articleParse(), &ArticleParse::articleParsed, this, &WebBrowser::setFullArticleHtml); |
| 110 | connect(qApp->web()->articleParse(), &ArticleParse::errorOnArticleParsing, this, &WebBrowser::fullArticleFailed); |
| 111 | } |
| 112 | |
| 113 | void WebBrowser::updateUrl(const QUrl& url) { |
| 114 | m_txtLocation->setText(url.toString()); |
| 115 | } |
| 116 | |
| 117 | void WebBrowser::loadUrl(const QUrl& url) { |
| 118 | if (url.isValid()) { |
| 119 | m_webView->setUrl(url); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | WebBrowser::~WebBrowser() {} |
| 124 | |
| 125 | double WebBrowser::verticalScrollBarPosition() const { |
| 126 | return m_webView->verticalScrollBarPosition(); |
| 127 | } |
| 128 | |
| 129 | void WebBrowser::setVerticalScrollBarPosition(double pos) { |
| 130 | m_webView->setVerticalScrollBarPosition(pos); |
| 131 | } |
| 132 | |
| 133 | void WebBrowser::scrollUp() { |
| 134 | setVerticalScrollBarPosition(verticalScrollBarPosition() - WEB_BROWSER_SCROLL_STEP); |
| 135 | } |
| 136 | |
| 137 | void WebBrowser::scrollDown() { |
| 138 | setVerticalScrollBarPosition(verticalScrollBarPosition() + WEB_BROWSER_SCROLL_STEP); |
| 139 | } |
| 140 | |
| 141 | void WebBrowser::reloadFontSettings() { |
| 142 | QFont fon; |
| 143 | |
| 144 | fon.fromString(qApp->settings()->value(GROUP(Messages), SETTING(Messages::PreviewerFontStandard)).toString()); |
| 145 | |
| 146 | m_webView->applyFont(fon); |
| 147 | } |
| 148 | |
| 149 | void WebBrowser::onZoomFactorChanged() { |
| 150 | auto fact = m_webView->zoomFactor(); |
| 151 | qApp->settings()->setValue(GROUP(Messages), Messages::Zoom, fact); |
| 152 | } |
| 153 | |
| 154 | #if defined(ENABLE_MEDIAPLAYER) |
| 155 | void WebBrowser::playCurrentSiteInMediaPlayer() { |
| 156 | qApp->mainForm()->tabWidget()->addMediaPlayer(m_webView->url().toString(), true); |
| 157 | } |
| 158 | #endif |
| 159 | |
| 160 | void WebBrowser::clear(bool also_hide) { |
| 161 | m_webView->clear(); |
| 162 | m_messages.clear(); |
| 163 | |
| 164 | if (also_hide) { |
| 165 | hide(); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | void WebBrowser::loadUrl(const QString& url) { |
| 170 | return loadUrl(QUrl::fromUserInput(url)); |
| 171 | } |
| 172 | |
| 173 | void WebBrowser::setHtml(const QString& html, const QUrl& base_url) { |
| 174 | m_webView->setHtml(html, base_url); |
| 175 | } |
| 176 | |
| 177 | void WebBrowser::loadMessages(const QList<Message>& messages, RootItem* root) { |
| 178 | m_messages = messages; |
| 179 | m_root = root; |
| 180 | |
| 181 | setNavigationBarVisible(m_toolBar->isVisible() && m_messages.size() <= 1); |
| 182 | |
| 183 | if (!m_root.isNull()) { |
| 184 | m_searchWidget->hide(); |
| 185 | m_webView->loadMessages(messages, root); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | void WebBrowser::readabilePage() { |
| 190 | m_actionReadabilePage->setEnabled(false); |
| 191 | qApp->web()->readability()->makeHtmlReadable(this, m_webView->html(), m_webView->url().toString()); |
| 192 | } |
| 193 | |
| 194 | void WebBrowser::getFullArticle() { |
| 195 | QString url; |
| 196 | |
| 197 | if (!m_messages.isEmpty() && !m_messages.first().m_url.isEmpty()) { |
| 198 | url = m_messages.first().m_url; |
| 199 | } |
| 200 | else if (m_webView->url().isValid()) { |
| 201 | url = m_webView->url().toString(); |
| 202 | } |
| 203 | else { |
| 204 | return; |
| 205 | } |
| 206 | |
| 207 | m_actionGetFullArticle->setEnabled(false); |
| 208 | qApp->web()->articleParse()->parseArticle(this, url); |
| 209 | } |
| 210 | |
| 211 | bool WebBrowser::eventFilter(QObject* watched, QEvent* event) { |
| 212 | Q_UNUSED(watched) |
| 213 | |
| 214 | if (event->type() == QEvent::Type::Wheel) { |
| 215 | QWheelEvent* wh_event = static_cast<QWheelEvent*>(event); |
| 216 | |
| 217 | // Zoom with mouse. |
| 218 | if (Globals::hasFlag(wh_event->modifiers(), Qt::KeyboardModifier::ControlModifier)) { |
| 219 | if (wh_event->angleDelta().y() > 0 && m_webView->canZoomIn()) { |
| 220 | m_webView->zoomIn(); |
| 221 | onZoomFactorChanged(); |
| 222 | return true; |
| 223 | } |
| 224 | else if (wh_event->angleDelta().y() < 0 && m_webView->canZoomOut()) { |
| 225 | m_webView->zoomOut(); |
| 226 | onZoomFactorChanged(); |
| 227 | return true; |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | else if (event->type() == QEvent::KeyPress) { |
| 232 | QKeyEvent* key_event = static_cast<QKeyEvent*>(event); |
| 233 | |
| 234 | // Find text. |
| 235 | if (key_event->matches(QKeySequence::StandardKey::Find)) { |
| 236 | m_searchWidget->clear(); |
| 237 | m_searchWidget->show(); |
| 238 | m_searchWidget->setFocus(); |
| 239 | return true; |
| 240 | } |
| 241 | |
| 242 | // Hide visible search box. |
| 243 | if (key_event->key() == Qt::Key::Key_Escape && m_searchWidget->isVisible()) { |
| 244 | m_searchWidget->hide(); |
| 245 | return true; |
| 246 | } |
| 247 | |
| 248 | // Zoom with keyboard. |
| 249 | if ((key_event->modifiers() & Qt::KeyboardModifier::ControlModifier) > 0) { |
| 250 | if (key_event->key() == Qt::Key::Key_Plus && m_webView->canZoomIn()) { |
| 251 | m_webView->zoomIn(); |
| 252 | onZoomFactorChanged(); |
| 253 | return true; |
| 254 | } |
| 255 | else if (key_event->key() == Qt::Key::Key_Minus && m_webView->canZoomOut()) { |
| 256 | m_webView->zoomOut(); |
| 257 | onZoomFactorChanged(); |
| 258 | return true; |
| 259 | } |
| 260 | else if (key_event->key() == Qt::Key::Key_0) { |
| 261 | m_webView->setZoomFactor(1.0f); |
| 262 | onZoomFactorChanged(); |
| 263 | return true; |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | void WebBrowser::openCurrentSiteInSystemBrowser() { |
| 272 | auto url = m_webView->url(); |
| 273 | |
| 274 | if (!url.isValid() || url.host().contains(QSL(APP_LOW_NAME))) { |
| 275 | return; |
| 276 | } |
| 277 | |
| 278 | qApp->web()->openUrlInExternalBrowser(url.toString()); |
| 279 | } |
| 280 | |
| 281 | void WebBrowser::onTitleChanged(const QString& new_title) { |
| 282 | if (new_title.isEmpty()) { |
| 283 | //: Webbrowser tab title when no title is available. |
| 284 | emit titleChanged(m_index, tr("No title")); |
| 285 | } |
| 286 | else { |
| 287 | emit titleChanged(m_index, new_title.simplified()); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | void WebBrowser::onIconChanged(const QIcon& icon) { |
| 292 | emit iconChanged(m_index, icon); |
| 293 | } |
| 294 | |
| 295 | void WebBrowser::onLinkHovered(const QUrl& url) { |
| 296 | qDebugNN << LOGSEC_GUI << "Hovered link:" << QUOTE_W_SPACE_DOT(url); |
| 297 | |
| 298 | qApp->showGuiMessage(Notification::Event::GeneralEvent, |
| 299 | {url.toString(), url.toString(), QSystemTrayIcon::MessageIcon::NoIcon}, |
| 300 | {false, false, true}); |
| 301 | } |
| 302 | |
| 303 | void WebBrowser::newWindowRequested(WebViewer* viewer) { |
| 304 | WebBrowser* browser = new WebBrowser(viewer, this); |
| 305 | |
| 306 | qApp->mainForm()->tabWidget()->addBrowser(false, false, browser); |
| 307 | } |
| 308 | |
| 309 | void WebBrowser::setReadabledHtml(const QObject* sndr, const QString& better_html) { |
| 310 | if (sndr == this && !better_html.isEmpty()) { |
| 311 | m_webView->setReadabledHtml(better_html, m_webView->url()); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | void WebBrowser::readabilityFailed(const QObject* sndr, const QString& error) { |
| 316 | if (sndr == this && !error.isEmpty()) { |
| 317 | m_webView->setReadabledHtml(error, m_webView->url()); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | Message WebBrowser::messageFromExtractor(const QJsonDocument& extracted_data) const { |
| 322 | QJsonObject extracted_obj = extracted_data.object(); |
| 323 | Message msg; |
| 324 | |
| 325 | msg.m_title = extracted_obj["title"].toString(); |
| 326 | msg.m_author = extracted_obj["author"].toString(); |
| 327 | msg.m_created = TextFactory::parseDateTime(extracted_obj["published"].toString()); |
| 328 | msg.m_createdFromFeed = true; |
| 329 | msg.m_url = extracted_obj["url"].toString(); |
| 330 | msg.m_contents = extracted_obj["content"].toString(); |
| 331 | |
| 332 | QString image = extracted_obj["image"].toString(); |
| 333 | |
| 334 | if (!image.isEmpty()) { |
| 335 | // NOTE: Prepend image to content. |
| 336 | msg.m_contents = msg.m_contents.prepend(QSL("<div>" |
| 337 | "<a href=\"%1\">" |
| 338 | "<img src=\"%1\" />" |
| 339 | "</a>" |
| 340 | "</div>") |
| 341 | .arg(image)); |
| 342 | } |
| 343 | |
| 344 | return msg; |
| 345 | } |
| 346 | |
| 347 | void WebBrowser::setFullArticleHtml(const QObject* sndr, const QString& url, const QString& json_answer) { |
| 348 | if (sndr == this && !json_answer.isEmpty()) { |
| 349 | QJsonDocument json_doc = QJsonDocument::fromJson(json_answer.toUtf8()); |
| 350 | |
| 351 | Message full_article = messageFromExtractor(json_doc); |
| 352 | |
| 353 | if (!m_messages.isEmpty() && m_messages.first().m_url == url) { |
| 354 | const Message displayed_article = m_messages.first(); |
| 355 | |
| 356 | // Copy rest of original attributes which might influence the "full" article. |
| 357 | full_article.m_feedId = displayed_article.m_feedId; |
| 358 | full_article.m_feedTitle = displayed_article.m_feedTitle; |
| 359 | full_article.m_customId = displayed_article.m_customId; |
| 360 | full_article.m_customHash = displayed_article.m_customHash; |
| 361 | full_article.m_id = displayed_article.m_id; |
| 362 | full_article.m_accountId = displayed_article.m_accountId; |
| 363 | full_article.m_assignedLabels = displayed_article.m_assignedLabels; |
| 364 | full_article.m_assignedLabelsIds = displayed_article.m_assignedLabelsIds; |
| 365 | full_article.m_categories = displayed_article.m_categories; |
| 366 | full_article.m_rawContents = displayed_article.m_rawContents; |
| 367 | |
| 368 | full_article.m_isRead = displayed_article.m_isRead; |
| 369 | full_article.m_isImportant = displayed_article.m_isImportant; |
| 370 | full_article.m_isDeleted = displayed_article.m_isDeleted; |
| 371 | full_article.m_score = displayed_article.m_score; |
| 372 | full_article.m_rtlBehavior = displayed_article.m_rtlBehavior; |
| 373 | full_article.m_enclosures = displayed_article.m_enclosures; |
| 374 | |
| 375 | loadMessages({full_article}, m_root); |
| 376 | } |
| 377 | else { |
| 378 | auto html_message = m_webView->htmlForMessages({full_article}, nullptr); |
| 379 | |
| 380 | setHtml(html_message.m_html, url); |
| 381 | } |
| 382 | |
| 383 | // |
| 384 | // m_webView->setReadabledHtml(full_article.m_contents, m_webView->url()); |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | void WebBrowser::fullArticleFailed(const QObject* sndr, const QString& error) { |
| 389 | if (sndr == this && !error.isEmpty()) { |
| 390 | m_webView->setReadabledHtml(error, m_webView->url()); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | void WebBrowser::initializeLayout() { |
| 395 | m_toolBar->setFloatable(false); |
| 396 | m_toolBar->setMovable(false); |
| 397 | m_toolBar->setAllowedAreas(Qt::ToolBarArea::TopToolBarArea); |
| 398 | |
| 399 | // Modify action texts. |
| 400 | if (m_actionBack != nullptr) { |
| 401 | m_actionBack->setText(tr("Back")); |
| 402 | m_actionBack->setIcon(qApp->icons()->fromTheme(QSL("go-previous"))); |
| 403 | m_toolBar->addAction(m_actionBack); |
| 404 | } |
| 405 | |
| 406 | if (m_actionForward != nullptr) { |
| 407 | m_actionForward->setText(tr("Forward")); |
| 408 | m_actionForward->setIcon(qApp->icons()->fromTheme(QSL("go-next"))); |
| 409 | m_toolBar->addAction(m_actionForward); |
| 410 | } |
| 411 | |
| 412 | if (m_actionReload != nullptr) { |
| 413 | m_actionReload->setText(tr("Reload")); |
| 414 | m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("reload"), QSL("view-refresh"))); |
| 415 | m_toolBar->addAction(m_actionReload); |
| 416 | } |
| 417 | |
| 418 | if (m_actionStop != nullptr) { |
| 419 | m_actionStop->setText(tr("Stop")); |
| 420 | m_actionStop->setIcon(qApp->icons()->fromTheme(QSL("process-stop"))); |
| 421 | m_toolBar->addAction(m_actionStop); |
| 422 | } |
| 423 | |
| 424 | m_actionOpenInSystemBrowser->setEnabled(false); |
| 425 | m_actionReadabilePage->setEnabled(false); |
| 426 | m_actionGetFullArticle->setEnabled(false); |
| 427 | |
| 428 | // Add needed actions into toolbar. |
| 429 | m_toolBar->addAction(m_actionOpenInSystemBrowser); |
| 430 | m_toolBar->addAction(m_actionGetFullArticle); |
| 431 | m_toolBar->addAction(m_actionReadabilePage); |
| 432 | |
| 433 | #if defined(ENABLE_MEDIAPLAYER) |
| 434 | m_actionPlayPageInMediaPlayer->setEnabled(false); |
| 435 | m_toolBar->addAction(m_actionPlayPageInMediaPlayer); |
| 436 | #endif |
| 437 | |
| 438 | m_txtLocationAction = m_toolBar->addWidget(m_txtLocation); |
| 439 | |
| 440 | m_loadingProgress = new QProgressBar(this); |
| 441 | m_loadingProgress->setFixedHeight(10); |
| 442 | m_loadingProgress->setMinimum(0); |
| 443 | m_loadingProgress->setTextVisible(false); |
| 444 | m_loadingProgress->setMaximum(100); |
| 445 | m_loadingProgress->setAttribute(Qt::WidgetAttribute::WA_TranslucentBackground); |
| 446 | |
| 447 | // Setup layout. |
| 448 | m_layout->addWidget(m_toolBar); |
| 449 | m_layout->addWidget(dynamic_cast<QWidget*>(m_webView)); |
| 450 | m_layout->addWidget(m_loadingProgress); |
| 451 | m_layout->addWidget(m_searchWidget); |
| 452 | m_layout->setContentsMargins({0, 0, 0, 0}); |
| 453 | m_layout->setSpacing(0); |
| 454 | |
| 455 | m_searchWidget->hide(); |
| 456 | } |
| 457 | |
| 458 | void WebBrowser::onLoadingStarted() { |
| 459 | m_loadingProgress->show(); |
| 460 | m_actionOpenInSystemBrowser->setEnabled(false); |
| 461 | m_actionReadabilePage->setEnabled(false); |
| 462 | m_actionGetFullArticle->setEnabled(false); |
| 463 | |
| 464 | #if defined(ENABLE_MEDIAPLAYER) |
| 465 | m_actionPlayPageInMediaPlayer->setEnabled(false); |
| 466 | #endif |
| 467 | } |
| 468 | |
| 469 | void WebBrowser::onLoadingProgress(int progress) { |
| 470 | m_loadingProgress->setMaximum(progress < 0 ? 0 : 100); |
| 471 | m_loadingProgress->setValue(progress < 0 ? 0 : progress); |
| 472 | } |
| 473 | |
| 474 | void WebBrowser::onLoadingFinished(bool success) { |
| 475 | if (success) { |
| 476 | auto url = m_webView->url(); |
| 477 | |
| 478 | if (url.isValid() && !url.host().isEmpty()) { |
| 479 | m_actionOpenInSystemBrowser->setEnabled(true); |
| 480 | m_actionGetFullArticle->setEnabled(true); |
| 481 | m_actionReadabilePage->setEnabled(true); |
| 482 | |
| 483 | #if defined(ENABLE_MEDIAPLAYER) |
| 484 | m_actionPlayPageInMediaPlayer->setEnabled(true); |
| 485 | #endif |
| 486 | } |
| 487 | else { |
| 488 | m_actionOpenInSystemBrowser->setEnabled(false); |
| 489 | m_actionReadabilePage->setEnabled(false); |
| 490 | m_actionGetFullArticle->setEnabled(false); |
| 491 | |
| 492 | #if defined(ENABLE_MEDIAPLAYER) |
| 493 | m_actionPlayPageInMediaPlayer->setEnabled(false); |
| 494 | #endif |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | m_loadingProgress->hide(); |
| 499 | m_loadingProgress->setValue(0); |
| 500 | } |