Commit 1e9aebf9 authored by Kåre Särs's avatar Kåre Särs
Browse files

Build plugin: Do not open files that do not exist.

If the file name is not parsed correctly don't try to open the broken
file-location. Display the parsed file so that the user might get a
hint of why the parsing failed.
parent 041e8c89
...@@ -462,6 +462,12 @@ void KateBuildView::slotErrorSelected(QTreeWidgetItem *item) ...@@ -462,6 +462,12 @@ void KateBuildView::slotErrorSelected(QTreeWidgetItem *item)
filename = caseFixed(filename); filename = caseFixed(filename);
#endif #endif
// Check if the file exists
if (!QFileInfo::exists(filename)) {
displayMessage(xi18nc("@info", "<title>Could not open file:</title><nl/>%1", filename), KTextEditor::Message::Error);
// open file (if needed, otherwise, this will activate only the right view...) // open file (if needed, otherwise, this will activate only the right view...)
m_win->openUrl(QUrl::fromLocalFile(filename)); m_win->openUrl(QUrl::fromLocalFile(filename));
...@@ -907,6 +913,23 @@ void KateBuildView::displayBuildResult(const QString &msg, KTextEditor::Message: ...@@ -907,6 +913,23 @@ void KateBuildView::displayBuildResult(const QString &msg, KTextEditor::Message:
kv->document()->postMessage(m_infoMessage); kv->document()->postMessage(m_infoMessage);
} }
void KateBuildView::displayMessage(const QString &msg, KTextEditor::Message::MessageType level)
KTextEditor::View *kv = m_win->activeView();
if (!kv)
delete m_infoMessage;
m_infoMessage = new KTextEditor::Message(msg, level);
/******************************************************************/ /******************************************************************/
void KateBuildView::slotProcExited(int exitCode, QProcess::ExitStatus) void KateBuildView::slotProcExited(int exitCode, QProcess::ExitStatus)
{ {
...@@ -127,6 +127,7 @@ private: ...@@ -127,6 +127,7 @@ private:
void clearBuildResults(); void clearBuildResults();
void displayBuildResult(const QString &message, KTextEditor::Message::MessageType level); void displayBuildResult(const QString &message, KTextEditor::Message::MessageType level);
void displayMessage(const QString &message, KTextEditor::Message::MessageType level);
void clearMarks(); void clearMarks();
void addMarks(KTextEditor::Document *doc, bool mark); void addMarks(KTextEditor::Document *doc, bool mark);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment