Changeset View
Changeset View
Standalone View
Standalone View
documentation/manpage/manpagedocumentation.cpp
Show All 26 Lines | |||||
27 | #include "manpagedocumentationwidget.h" | 27 | #include "manpagedocumentationwidget.h" | ||
28 | 28 | | |||
29 | #include <KIO/TransferJob> | 29 | #include <KIO/TransferJob> | ||
30 | #include <kio/jobclasses.h> | 30 | #include <kio/jobclasses.h> | ||
31 | #include <documentation/standarddocumentationview.h> | 31 | #include <documentation/standarddocumentationview.h> | ||
32 | 32 | | |||
33 | ManPagePlugin* ManPageDocumentation::s_provider=nullptr; | 33 | ManPagePlugin* ManPageDocumentation::s_provider=nullptr; | ||
34 | 34 | | |||
35 | | ||||
36 | ManPageDocumentation::ManPageDocumentation(const QString& name, const QUrl& url) | 35 | ManPageDocumentation::ManPageDocumentation(const QString& name, const QUrl& url) | ||
37 | : m_url(url), m_name(name) | 36 | : m_url(url), m_name(name) | ||
38 | { | 37 | { | ||
39 | KIO::StoredTransferJob* transferJob = KIO::storedGet(m_url, KIO::NoReload, KIO::HideProgressInfo); | 38 | KIO::StoredTransferJob* transferJob = KIO::storedGet(m_url, KIO::NoReload, KIO::HideProgressInfo); | ||
40 | connect( transferJob, &KIO::StoredTransferJob::finished, this, &ManPageDocumentation::finished); | 39 | connect( transferJob, &KIO::StoredTransferJob::finished, this, &ManPageDocumentation::finished); | ||
41 | transferJob->start(); | 40 | transferJob->start(); | ||
42 | } | 41 | } | ||
43 | 42 | | |||
Show All 17 Lines | |||||
61 | { | 60 | { | ||
62 | return m_description; | 61 | return m_description; | ||
63 | } | 62 | } | ||
64 | 63 | | |||
65 | QWidget* ManPageDocumentation::documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent ) | 64 | QWidget* ManPageDocumentation::documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent ) | ||
66 | { | 65 | { | ||
67 | KDevelop::StandardDocumentationView* view = new KDevelop::StandardDocumentationView(findWidget, parent); | 66 | KDevelop::StandardDocumentationView* view = new KDevelop::StandardDocumentationView(findWidget, parent); | ||
68 | view->setDocumentation(IDocumentation::Ptr(this)); | 67 | view->setDocumentation(IDocumentation::Ptr(this)); | ||
68 | view->setDelegateLinks(true); | ||||
69 | QObject::connect(view, &KDevelop::StandardDocumentationView::linkClicked, ManPageDocumentation::s_provider->model(), &ManPageModel::showItemFromUrl); | ||||
69 | 70 | | |||
70 | // apply custom style-sheet to normalize look of the page | 71 | // apply custom style-sheet to normalize look of the page | ||
71 | const QString cssFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdevmanpage/manpagedocumentation.css"); | 72 | const QString cssFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kdevmanpage/manpagedocumentation.css"); | ||
72 | QWebSettings* settings = view->settings(); | 73 | view->setOverrideCss(QUrl::fromLocalFile(cssFile)); | ||
73 | settings->setUserStyleSheetUrl(QUrl::fromLocalFile(cssFile)); | | |||
74 | | ||||
75 | view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); | | |||
76 | QObject::connect(view, &KDevelop::StandardDocumentationView::linkClicked, ManPageDocumentation::s_provider->model(), &ManPageModel::showItemFromUrl); | | |||
77 | return view; | 74 | return view; | ||
78 | } | 75 | } | ||
79 | 76 | | |||
80 | bool ManPageDocumentation::providesWidget() const | 77 | bool ManPageDocumentation::providesWidget() const | ||
81 | { | 78 | { | ||
82 | return false; | 79 | return false; | ||
83 | } | 80 | } | ||
84 | 81 | | |||
Show All 16 Lines |