Changeset View
Changeset View
Standalone View
Standalone View
src/document/katedocument.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 2191 | { | |||
---|---|---|---|---|---|
2203 | message->addAction(tryAgainAction); | 2203 | message->addAction(tryAgainAction); | ||
2204 | message->addAction(closeAction); | 2204 | message->addAction(closeAction); | ||
2205 | 2205 | | |||
2206 | // finally post message | 2206 | // finally post message | ||
2207 | postMessage(message); | 2207 | postMessage(message); | ||
2208 | 2208 | | |||
2209 | // remember error | 2209 | // remember error | ||
2210 | m_openingError = true; | 2210 | m_openingError = true; | ||
2211 | m_openingErrorMessage = i18n("The file %1 could not be loaded, as it was not possible to read from it.\n\nCheck if you have read access to this file.", this->url().toDisplayString(QUrl::PreferLocalFile)); | | |||
2212 | 2211 | | |||
2213 | } | 2212 | } | ||
2214 | //END: error | 2213 | //END: error | ||
2215 | 2214 | | |||
2216 | void KTextEditor::DocumentPrivate::openWithLineLengthLimitOverride() | 2215 | void KTextEditor::DocumentPrivate::openWithLineLengthLimitOverride() | ||
2217 | { | 2216 | { | ||
2218 | // raise line length limit to the next power of 2 | 2217 | // raise line length limit to the next power of 2 | ||
2219 | const int longestLine = m_buffer->longestLineLoaded(); | 2218 | const int longestLine = m_buffer->longestLineLoaded(); | ||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 2326 | = new KTextEditor::Message(i18n("The file %1 was opened with %2 encoding but contained invalid characters.<br />" | |||
2329 | "Either reopen the file with the correct encoding chosen or enable the read-write mode again in the tools menu to be able to edit it.", this->url().toDisplayString(QUrl::PreferLocalFile), | 2328 | "Either reopen the file with the correct encoding chosen or enable the read-write mode again in the tools menu to be able to edit it.", this->url().toDisplayString(QUrl::PreferLocalFile), | ||
2330 | QString::fromLatin1(m_buffer->textCodec()->name())), | 2329 | QString::fromLatin1(m_buffer->textCodec()->name())), | ||
2331 | KTextEditor::Message::Warning); | 2330 | KTextEditor::Message::Warning); | ||
2332 | message->setWordWrap(true); | 2331 | message->setWordWrap(true); | ||
2333 | postMessage(message); | 2332 | postMessage(message); | ||
2334 | 2333 | | |||
2335 | // remember error | 2334 | // remember error | ||
2336 | m_openingError = true; | 2335 | m_openingError = true; | ||
2337 | m_openingErrorMessage = i18n("The file %1 was opened with %2 encoding but contained invalid characters." | | |||
2338 | " It is set to read-only mode, as saving might destroy its content." | | |||
2339 | " Either reopen the file with the correct encoding chosen or enable the read-write mode again in the tools menu to be able to edit it.", this->url().toDisplayString(QUrl::PreferLocalFile), QString::fromLatin1(m_buffer->textCodec()->name())); | | |||
2340 | } | 2336 | } | ||
2341 | 2337 | | |||
2342 | // warn: too long lines | 2338 | // warn: too long lines | ||
2343 | if (m_buffer->tooLongLinesWrapped()) { | 2339 | if (m_buffer->tooLongLinesWrapped()) { | ||
2344 | // this file can't be saved again without modifications | 2340 | // this file can't be saved again without modifications | ||
2345 | setReadWrite(false); | 2341 | setReadWrite(false); | ||
2346 | m_readWriteStateBeforeLoading = false; | 2342 | m_readWriteStateBeforeLoading = false; | ||
2347 | QPointer<KTextEditor::Message> message | 2343 | QPointer<KTextEditor::Message> message | ||
2348 | = new KTextEditor::Message(i18n("The file %1 was opened and contained lines longer than the configured Line Length Limit (%2 characters).<br />" | 2344 | = new KTextEditor::Message(i18n("The file %1 was opened and contained lines longer than the configured Line Length Limit (%2 characters).<br />" | ||
2349 | "The longest of those lines was %3 characters long<br/>" | 2345 | "The longest of those lines was %3 characters long<br/>" | ||
2350 | "Those lines were wrapped and the document is set to read-only mode, as saving will modify its content.", | 2346 | "Those lines were wrapped and the document is set to read-only mode, as saving will modify its content.", | ||
2351 | this->url().toDisplayString(QUrl::PreferLocalFile), config()->lineLengthLimit(), m_buffer->longestLineLoaded()), | 2347 | this->url().toDisplayString(QUrl::PreferLocalFile), config()->lineLengthLimit(), m_buffer->longestLineLoaded()), | ||
2352 | KTextEditor::Message::Warning); | 2348 | KTextEditor::Message::Warning); | ||
2353 | QAction *increaseAndReload = new QAction(i18n("Temporarily raise limit and reload file"), message); | 2349 | QAction *increaseAndReload = new QAction(i18n("Temporarily raise limit and reload file"), message); | ||
2354 | connect(increaseAndReload, SIGNAL(triggered()), this, SLOT(openWithLineLengthLimitOverride())); | 2350 | connect(increaseAndReload, SIGNAL(triggered()), this, SLOT(openWithLineLengthLimitOverride())); | ||
2355 | message->addAction(increaseAndReload, true); | 2351 | message->addAction(increaseAndReload, true); | ||
2356 | message->addAction(new QAction(i18n("Close"), message), true); | 2352 | message->addAction(new QAction(i18n("Close"), message), true); | ||
2357 | message->setWordWrap(true); | 2353 | message->setWordWrap(true); | ||
2358 | postMessage(message); | 2354 | postMessage(message); | ||
2359 | 2355 | | |||
2360 | // remember error | 2356 | // remember error | ||
2361 | m_openingError = true; | 2357 | m_openingError = true; | ||
2362 | m_openingErrorMessage = i18n("The file %1 was opened and contained lines longer than the configured Line Length Limit (%2 characters).<br/>" | | |||
2363 | "The longest of those lines was %3 characters long<br/>" | | |||
2364 | "Those lines were wrapped and the document is set to read-only mode, as saving will modify its content.", this->url().toDisplayString(QUrl::PreferLocalFile), config()->lineLengthLimit(),m_buffer->longestLineLoaded()); | | |||
2365 | } | 2358 | } | ||
2366 | 2359 | | |||
2367 | // | 2360 | // | ||
2368 | // return the success | 2361 | // return the success | ||
2369 | // | 2362 | // | ||
2370 | return success; | 2363 | return success; | ||
2371 | } | 2364 | } | ||
2372 | 2365 | | |||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |