| 17 | using namespace Txt; |
| 18 | |
| 19 | Document::Document(const QString &fileName) |
| 20 | { |
| 21 | #ifdef TXT_DEBUG |
| 22 | qCDebug(OkularTxtDebug) << "Opening file" << fileName; |
| 23 | #endif |
| 24 | |
| 25 | QFile plainFile(fileName); |
| 26 | if (!plainFile.open(QIODevice::ReadOnly | QIODevice::Text)) { |
| 27 | qCDebug(OkularTxtDebug) << "Can't open file" << plainFile.fileName(); |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | const QByteArray buffer = plainFile.readAll(); |
| 32 | setPlainText(toUnicode(buffer)); |
| 33 | } |
| 34 | |
| 35 | Document::~Document() |
| 36 | { |