Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/sourceformatterjob.cpp
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 121 | { | |||
---|---|---|---|---|---|
136 | 136 | | |||
137 | qCDebug(SHELL) << "Processing file " << url << endl; | 137 | qCDebug(SHELL) << "Processing file " << url << endl; | ||
138 | auto getJob = KIO::storedGet(url); | 138 | auto getJob = KIO::storedGet(url); | ||
139 | // TODO: make also async and use start() and integrate using setError and setErrorString. | 139 | // TODO: make also async and use start() and integrate using setError and setErrorString. | ||
140 | if (getJob->exec()) { | 140 | if (getJob->exec()) { | ||
141 | // TODO: really fromLocal8Bit/toLocal8Bit? no encoding detection? added in b8062f736a2bf2eec098af531a7fda6ebcdc7cde | 141 | // TODO: really fromLocal8Bit/toLocal8Bit? no encoding detection? added in b8062f736a2bf2eec098af531a7fda6ebcdc7cde | ||
142 | QString text = QString::fromLocal8Bit(getJob->data()); | 142 | QString text = QString::fromLocal8Bit(getJob->data()); | ||
143 | text = formatter->formatSource(text, url, mime); | 143 | text = formatter->formatSource(text, url, mime); | ||
144 | text = m_sourceFormatterController->addModelineForCurrentLang(text, url, mime).toUtf8(); | 144 | text = m_sourceFormatterController->addModelineForCurrentLang(text, url, mime); | ||
145 | 145 | | |||
146 | auto putJob = KIO::storedPut(text.toLocal8Bit(), url, -1, KIO::Overwrite); | 146 | auto putJob = KIO::storedPut(text.toLocal8Bit(), url, -1, KIO::Overwrite); | ||
147 | // see getJob | 147 | // see getJob | ||
148 | if (!putJob->exec()) | 148 | if (!putJob->exec()) | ||
149 | // TODO: integrate with job error reporting, use showErrorMessage? | 149 | // TODO: integrate with job error reporting, use showErrorMessage? | ||
150 | KMessageBox::error(nullptr, putJob->errorString()); | 150 | KMessageBox::error(nullptr, putJob->errorString()); | ||
151 | } else | 151 | } else | ||
152 | KMessageBox::error(nullptr, getJob->errorString()); | 152 | KMessageBox::error(nullptr, getJob->errorString()); | ||
153 | } | 153 | } |