Changeset View
Changeset View
Standalone View
Standalone View
core/document.cpp
Show First 20 Lines • Show All 1107 Lines • ▼ Show 20 Line(s) | 1079 | { | |||
---|---|---|---|---|---|
1108 | annot->setContents( newContents ); | 1108 | annot->setContents( newContents ); | ||
1109 | 1109 | | |||
1110 | // Tell the document the annotation has been modified | 1110 | // Tell the document the annotation has been modified | ||
1111 | performModifyPageAnnotation( pageNumber, annot, appearanceChanged ); | 1111 | performModifyPageAnnotation( pageNumber, annot, appearanceChanged ); | ||
1112 | } | 1112 | } | ||
1113 | 1113 | | |||
1114 | void DocumentPrivate::recalculateForms() | 1114 | void DocumentPrivate::recalculateForms() | ||
1115 | { | 1115 | { | ||
1116 | const QVariant fco = m_parent->metaData(QLatin1String("FormCalculateOrder")); | 1116 | const QVariant fco = m_parent->metaData(QStringLiteral("FormCalculateOrder")); | ||
1117 | const QVector<int> formCalculateOrder = fco.value<QVector<int>>(); | 1117 | const QVector<int> formCalculateOrder = fco.value<QVector<int>>(); | ||
1118 | foreach(int formId, formCalculateOrder) { | 1118 | foreach(int formId, formCalculateOrder) { | ||
1119 | for ( uint pageIdx = 0; pageIdx < m_parent->pages(); pageIdx++ ) | 1119 | for ( uint pageIdx = 0; pageIdx < m_parent->pages(); pageIdx++ ) | ||
1120 | { | 1120 | { | ||
1121 | const Page *p = m_parent->page( pageIdx ); | 1121 | const Page *p = m_parent->page( pageIdx ); | ||
1122 | if (p) | 1122 | if (p) | ||
1123 | { | 1123 | { | ||
1124 | bool pageNeedsRefresh = false; | 1124 | bool pageNeedsRefresh = false; | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 1175 | { | |||
1191 | QDomElement root = doc.createElement( QStringLiteral("documentInfo") ); | 1191 | QDomElement root = doc.createElement( QStringLiteral("documentInfo") ); | ||
1192 | root.setAttribute( QStringLiteral("url"), m_url.toDisplayString(QUrl::PreferLocalFile) ); | 1192 | root.setAttribute( QStringLiteral("url"), m_url.toDisplayString(QUrl::PreferLocalFile) ); | ||
1193 | doc.appendChild( root ); | 1193 | doc.appendChild( root ); | ||
1194 | 1194 | | |||
1195 | // 2.1. Save page attributes (bookmark state, annotations, ... ) to DOM | 1195 | // 2.1. Save page attributes (bookmark state, annotations, ... ) to DOM | ||
1196 | // -> do this if there are not-yet-migrated annots or forms in docdata/ | 1196 | // -> do this if there are not-yet-migrated annots or forms in docdata/ | ||
1197 | if ( m_docdataMigrationNeeded ) | 1197 | if ( m_docdataMigrationNeeded ) | ||
1198 | { | 1198 | { | ||
1199 | QDomElement pageList = doc.createElement( "pageList" ); | 1199 | QDomElement pageList = doc.createElement( QStringLiteral("pageList") ); | ||
1200 | root.appendChild( pageList ); | 1200 | root.appendChild( pageList ); | ||
1201 | // OriginalAnnotationPageItems and OriginalFormFieldPageItems tell to | 1201 | // OriginalAnnotationPageItems and OriginalFormFieldPageItems tell to | ||
1202 | // store the same unmodified annotation list and form contents that we | 1202 | // store the same unmodified annotation list and form contents that we | ||
1203 | // read when we opened the file and ignore any change made by the user. | 1203 | // read when we opened the file and ignore any change made by the user. | ||
1204 | // Since we don't store annotations and forms in docdata/ any more, this is | 1204 | // Since we don't store annotations and forms in docdata/ any more, this is | ||
1205 | // necessary to preserve annotations/forms that previous Okular version | 1205 | // necessary to preserve annotations/forms that previous Okular version | ||
1206 | // had stored there. | 1206 | // had stored there. | ||
1207 | const PageItems saveWhat = AllPageItems | OriginalAnnotationPageItems | OriginalFormFieldPageItems; | 1207 | const PageItems saveWhat = AllPageItems | OriginalAnnotationPageItems | OriginalFormFieldPageItems; | ||
▲ Show 20 Lines • Show All 1068 Lines • ▼ Show 20 Line(s) | 2246 | { | |||
2276 | return newokularfile; | 2276 | return newokularfile; | ||
2277 | } | 2277 | } | ||
2278 | 2278 | | |||
2279 | QVector<KPluginMetaData> DocumentPrivate::availableGenerators() | 2279 | QVector<KPluginMetaData> DocumentPrivate::availableGenerators() | ||
2280 | { | 2280 | { | ||
2281 | static QVector<KPluginMetaData> result; | 2281 | static QVector<KPluginMetaData> result; | ||
2282 | if (result.isEmpty()) | 2282 | if (result.isEmpty()) | ||
2283 | { | 2283 | { | ||
2284 | result = KPluginLoader::findPlugins( QLatin1String ( "okular/generators" ) ); | 2284 | result = KPluginLoader::findPlugins( QStringLiteral ( "okular/generators" ) ); | ||
2285 | } | 2285 | } | ||
2286 | return result; | 2286 | return result; | ||
2287 | } | 2287 | } | ||
2288 | 2288 | | |||
2289 | KPluginMetaData DocumentPrivate::generatorForMimeType(const QMimeType& type, QWidget* widget, const QVector<KPluginMetaData> &triedOffers) | 2289 | KPluginMetaData DocumentPrivate::generatorForMimeType(const QMimeType& type, QWidget* widget, const QVector<KPluginMetaData> &triedOffers) | ||
2290 | { | 2290 | { | ||
2291 | // First try to find an exact match, and then look for more general ones (e. g. the plain text one) | 2291 | // First try to find an exact match, and then look for more general ones (e. g. the plain text one) | ||
2292 | // Ideally we would rank these by "closeness", but that might be overdoing it | 2292 | // Ideally we would rank these by "closeness", but that might be overdoing it | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | |||||
2360 | { | 2360 | { | ||
2361 | QMimeDatabase db; | 2361 | QMimeDatabase db; | ||
2362 | QMimeType mime = _mime; | 2362 | QMimeType mime = _mime; | ||
2363 | QByteArray filedata; | 2363 | QByteArray filedata; | ||
2364 | int fd = -1; | 2364 | int fd = -1; | ||
2365 | if (url.scheme() == QLatin1String("fd")) | 2365 | if (url.scheme() == QLatin1String("fd")) | ||
2366 | { | 2366 | { | ||
2367 | bool ok; | 2367 | bool ok; | ||
2368 | fd = url.path().mid(1).toInt(&ok); | 2368 | fd = url.path().midRef(1).toInt(&ok); | ||
2369 | if (!ok) | 2369 | if (!ok) | ||
2370 | { | 2370 | { | ||
2371 | return OpenError; | 2371 | return OpenError; | ||
2372 | } | 2372 | } | ||
2373 | } | 2373 | } | ||
2374 | else if (url.fileName() == QLatin1String( "-" )) | 2374 | else if (url.fileName() == QLatin1String( "-" )) | ||
2375 | { | 2375 | { | ||
2376 | fd = 0; | 2376 | fd = 0; | ||
▲ Show 20 Lines • Show All 1848 Lines • ▼ Show 20 Line(s) | 4224 | { | |||
4225 | const SourceReference ref( lilySource, lilyRow, lilyCol ); | 4225 | const SourceReference ref( lilySource, lilyRow, lilyCol ); | ||
4226 | processSourceReference( &ref ); | 4226 | processSourceReference( &ref ); | ||
4227 | } | 4227 | } | ||
4228 | else | 4228 | else | ||
4229 | { | 4229 | { | ||
4230 | const QUrl url = browse->url(); | 4230 | const QUrl url = browse->url(); | ||
4231 | 4231 | | |||
4232 | // fix for #100366, documents with relative links that are the form of http:foo.pdf | 4232 | // fix for #100366, documents with relative links that are the form of http:foo.pdf | ||
4233 | if ((url.scheme() == "http") && url.host().isEmpty() && url.fileName().endsWith("pdf")) | 4233 | if ((url.scheme() == QLatin1String("http")) && url.host().isEmpty() && url.fileName().endsWith(QLatin1String("pdf"))) | ||
4234 | { | 4234 | { | ||
4235 | d->openRelativeFile(url.fileName()); | 4235 | d->openRelativeFile(url.fileName()); | ||
4236 | break; | 4236 | break; | ||
4237 | } | 4237 | } | ||
4238 | 4238 | | |||
4239 | // handle documents with relative path | 4239 | // handle documents with relative path | ||
4240 | if ( d->m_url.isValid() ) | 4240 | if ( d->m_url.isValid() ) | ||
4241 | { | 4241 | { | ||
▲ Show 20 Lines • Show All 1430 Lines • Show Last 20 Lines |