| 79 | } |
| 80 | |
| 81 | bool KDevelop::createFile(const QUrl& file) |
| 82 | { |
| 83 | auto statJob = KIO::stat(file, KIO::StatJob::DestinationSide, KIO::StatNoDetails); |
| 84 | KJobWidgets::setWindow(statJob, QApplication::activeWindow()); |
| 85 | if (statJob->exec()) { |
| 86 | const QString messageText = i18n("The file <i>%1</i> already exists.", file.toDisplayString(QUrl::PreferLocalFile)); |
| 87 | auto* message = new Sublime::Message(messageText, Sublime::Message::Error); |
| 88 | ICore::self()->uiController()->postMessage(message); |
| 89 | return false; |
| 90 | } |
| 91 | |
| 92 | { |
| 93 | auto uploadJob = KIO::storedPut(QByteArray("\n"), file, -1); |
| 94 | KJobWidgets::setWindow(uploadJob, QApplication::activeWindow()); |
| 95 | if (!uploadJob->exec()) { |
| 96 | const QString messageText = i18n("Cannot create file <i>%1</i>.", file.toDisplayString(QUrl::PreferLocalFile)); |
| 97 | auto* message = new Sublime::Message(messageText, Sublime::Message::Error); |
| 98 | ICore::self()->uiController()->postMessage(message); |
| 99 | return false; |
| 100 | } |
| 101 | } |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | bool KDevelop::createFile(const KDevelop::Path& file) |
| 106 | { |
nothing calls this directly
no test coverage detected