| 118 | } |
| 119 | |
| 120 | bool CodeEditor::loadFile(const QString& f) |
| 121 | { |
| 122 | if(!QFile::exists(f)) |
| 123 | return false; |
| 124 | QFile file(f); |
| 125 | if(!file.open(QFile::ReadOnly)) |
| 126 | return false; |
| 127 | |
| 128 | QByteArray data=file.readAll(); |
| 129 | QString str=QString::fromLocal8Bit(data); |
| 130 | setPlainText(str); |
| 131 | |
| 132 | setFileName(f); |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | bool CodeEditor::openFile() |
| 137 | { |