Changeset View
Changeset View
Standalone View
Standalone View
mobile/components/documentitem.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | 50 | | |||
51 | DocumentItem::~DocumentItem() | 51 | DocumentItem::~DocumentItem() | ||
52 | { | 52 | { | ||
53 | delete m_document; | 53 | delete m_document; | ||
54 | } | 54 | } | ||
55 | 55 | | |||
56 | void DocumentItem::setPath(const QString &path) | 56 | void DocumentItem::setUrl(const QUrl & url) | ||
57 | { | 57 | { | ||
58 | //TODO: remote urls | | |||
59 | //TODO: password | 58 | //TODO: password | ||
60 | QMimeDatabase db; | 59 | QMimeDatabase db; | ||
61 | m_document->openDocument(path, QUrl::fromLocalFile(path), db.mimeTypeForUrl(QUrl::fromLocalFile(path))); | 60 | | ||
61 | const QString path = url.isLocalFile() ? url.toLocalFile() : QLatin1String("-"); | ||||
62 | | ||||
63 | m_document->openDocument(path, url, db.mimeTypeForUrl(url)); | ||||
62 | 64 | | |||
63 | m_tocModel->clear(); | 65 | m_tocModel->clear(); | ||
64 | m_tocModel->fill(m_document->documentSynopsis()); | 66 | m_tocModel->fill(m_document->documentSynopsis()); | ||
65 | m_tocModel->setCurrentViewport(m_document->viewport()); | 67 | m_tocModel->setCurrentViewport(m_document->viewport()); | ||
66 | 68 | | |||
67 | m_matchingPages.clear(); | 69 | m_matchingPages.clear(); | ||
68 | for (uint i = 0; i < m_document->pages(); ++i) { | 70 | for (uint i = 0; i < m_document->pages(); ++i) { | ||
69 | m_matchingPages << (int)i; | 71 | m_matchingPages << (int)i; | ||
70 | } | 72 | } | ||
71 | emit matchingPagesChanged(); | 73 | emit matchingPagesChanged(); | ||
72 | emit pathChanged(); | 74 | emit urlChanged(); | ||
73 | emit pageCountChanged(); | 75 | emit pageCountChanged(); | ||
74 | emit openedChanged(); | 76 | emit openedChanged(); | ||
75 | emit supportsSearchingChanged(); | 77 | emit supportsSearchingChanged(); | ||
76 | emit windowTitleForDocumentChanged(); | 78 | emit windowTitleForDocumentChanged(); | ||
77 | emit bookmarkedPagesChanged(); | 79 | emit bookmarkedPagesChanged(); | ||
78 | } | 80 | } | ||
79 | 81 | | |||
80 | QString DocumentItem::windowTitleForDocument() const | 82 | QString DocumentItem::windowTitleForDocument() const | ||
Show All 9 Lines | 89 | if (Okular::Settings::displayDocumentTitle()) { | |||
90 | if (!docTitle.isEmpty() && !docTitle.trimmed().isEmpty()) { | 92 | if (!docTitle.isEmpty() && !docTitle.trimmed().isEmpty()) { | ||
91 | title = docTitle; | 93 | title = docTitle; | ||
92 | } | 94 | } | ||
93 | } | 95 | } | ||
94 | 96 | | |||
95 | return title; | 97 | return title; | ||
96 | } | 98 | } | ||
97 | 99 | | |||
98 | QString DocumentItem::path() const | 100 | QUrl DocumentItem::url() const | ||
99 | { | 101 | { | ||
100 | return m_document->currentDocument().toDisplayString(); | 102 | return m_document->currentDocument(); | ||
101 | } | 103 | } | ||
102 | 104 | | |||
103 | void DocumentItem::setCurrentPage(int page) | 105 | void DocumentItem::setCurrentPage(int page) | ||
104 | { | 106 | { | ||
105 | m_document->setViewportPage(page); | 107 | m_document->setViewportPage(page); | ||
106 | m_tocModel->setCurrentViewport(m_document->viewport()); | 108 | m_tocModel->setCurrentViewport(m_document->viewport()); | ||
107 | emit currentPageChanged(); | 109 | emit currentPageChanged(); | ||
108 | } | 110 | } | ||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |