Changeset View
Changeset View
Standalone View
Standalone View
kate/katedocmanager.cpp
Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 182 | } else { | |||
---|---|---|---|---|---|
183 | doc = createDoc(docInfo); | 183 | doc = createDoc(docInfo); | ||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | if (!encoding.isEmpty()) { | 186 | if (!encoding.isEmpty()) { | ||
187 | doc->setEncoding(encoding); | 187 | doc->setEncoding(encoding); | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | if (!u.isEmpty()) { | 190 | if (!u.isEmpty()) { | ||
191 | if (!loadMetaInfos(doc, u)) { | | |||
192 | doc->openUrl(u); | 191 | doc->openUrl(u); | ||
193 | } | 192 | loadMetaInfos(doc, u); | ||
194 | } | 193 | } | ||
195 | } | 194 | } | ||
196 | 195 | | |||
197 | // | 196 | // | ||
198 | // if needed, register as temporary file | 197 | // if needed, register as temporary file | ||
199 | // | 198 | // | ||
200 | if (isTempFile && u.isLocalFile()) { | 199 | if (isTempFile && u.isLocalFile()) { | ||
201 | QFileInfo fi(u.toLocalFile()); | 200 | QFileInfo fi(u.toLocalFile()); | ||
▲ Show 20 Lines • Show All 271 Lines • ▼ Show 20 Line(s) | 471 | { | |||
473 | if (m_docInfos.contains(doc)) { | 472 | if (m_docInfos.contains(doc)) { | ||
474 | m_docInfos[doc]->modifiedOnDisc = b; | 473 | m_docInfos[doc]->modifiedOnDisc = b; | ||
475 | m_docInfos[doc]->modifiedOnDiscReason = reason; | 474 | m_docInfos[doc]->modifiedOnDiscReason = reason; | ||
476 | slotModChanged1(doc); | 475 | slotModChanged1(doc); | ||
477 | } | 476 | } | ||
478 | } | 477 | } | ||
479 | 478 | | |||
480 | /** | 479 | /** | ||
481 | * Load file and file's meta-information if the MD5 didn't change since last time. | 480 | * Load file's meta-information if the checksum didn't change since last time. | ||
482 | */ | 481 | */ | ||
483 | bool KateDocManager::loadMetaInfos(KTextEditor::Document *doc, const QUrl &url) | 482 | bool KateDocManager::loadMetaInfos(KTextEditor::Document *doc, const QUrl &url) | ||
484 | { | 483 | { | ||
485 | if (!m_saveMetaInfos) { | 484 | if (!m_saveMetaInfos) { | ||
486 | return false; | 485 | return false; | ||
487 | } | 486 | } | ||
488 | 487 | | |||
489 | if (!m_metaInfos.hasGroup(url.toDisplayString())) { | 488 | if (!m_metaInfos.hasGroup(url.toDisplayString())) { | ||
490 | return false; | 489 | return false; | ||
491 | } | 490 | } | ||
492 | 491 | | |||
493 | const QByteArray checksum = doc->checksum().toHex(); | 492 | const QByteArray checksum = doc->checksum().toHex(); | ||
494 | bool ok = true; | 493 | bool ok = true; | ||
495 | if (!checksum.isEmpty()) { | 494 | if (!checksum.isEmpty()) { | ||
496 | KConfigGroup urlGroup(&m_metaInfos, url.toDisplayString()); | 495 | KConfigGroup urlGroup(&m_metaInfos, url.toDisplayString()); | ||
497 | const QString old_checksum = urlGroup.readEntry("Checksum"); | 496 | const QString old_checksum = urlGroup.readEntry("Checksum"); | ||
498 | 497 | | |||
499 | if (QString::fromLatin1(checksum) == old_checksum) { | 498 | if (QString::fromLatin1(checksum) == old_checksum) { | ||
500 | QSet<QString> flags; | 499 | QSet<QString> flags; | ||
501 | if (documentInfo(doc)->openedByUser) { | 500 | if (documentInfo(doc)->openedByUser) { | ||
502 | flags << QStringLiteral ("SkipEncoding"); | 501 | flags << QStringLiteral ("SkipEncoding"); | ||
503 | } | 502 | } | ||
503 | flags << QStringLiteral ("SkipUrl"); | ||||
504 | doc->readSessionConfig(urlGroup, flags); | 504 | doc->readSessionConfig(urlGroup, flags); | ||
505 | } else { | 505 | } else { | ||
506 | urlGroup.deleteGroup(); | 506 | urlGroup.deleteGroup(); | ||
507 | ok = false; | 507 | ok = false; | ||
508 | } | 508 | } | ||
509 | 509 | | |||
510 | m_metaInfos.sync(); | 510 | m_metaInfos.sync(); | ||
511 | } | 511 | } | ||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |