| 298 | |
| 299 | |
| 300 | bool Window::loadFileIntoSourceFileView(const QString &fileName, bool box) |
| 301 | // ---------------------------------------------------------------------------- |
| 302 | // Update the source file view with the plain contents of a specific file |
| 303 | // ---------------------------------------------------------------------------- |
| 304 | { |
| 305 | QFile file(fileName); |
| 306 | if (!file.open(QFile::ReadOnly | QFile::Text)) |
| 307 | { |
| 308 | if (box) |
| 309 | QMessageBox::warning(this, tr("Cannot read file"), |
| 310 | tr("Cannot read file %1:\n%2.") |
| 311 | .arg(fileName) |
| 312 | .arg(file.errorString())); |
| 313 | srcEdit->clear(); |
| 314 | return false; |
| 315 | } |
| 316 | |
| 317 | QTextStream in(&file); |
| 318 | in.setCodec("UTF-8"); |
| 319 | #ifndef CONFIG_MACOSX |
| 320 | QApplication::setOverrideCursor(Qt::BusyCursor); |
| 321 | #endif |
| 322 | loadInProgress = true; |
| 323 | srcEdit->setPlainText(in.readAll()); |
| 324 | loadInProgress = false; |
| 325 | QApplication::restoreOverrideCursor(); |
| 326 | markChanged(false); |
| 327 | return true; |
| 328 | } |
| 329 | |
| 330 | #endif |
| 331 |
no test coverage detected