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

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)
filename = caseFixed(filename);
#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);
return;
}
// open file (if needed, otherwise, this will activate only the right view...)
m_win->openUrl(QUrl::fromLocalFile(filename));
......@@ -907,6 +913,23 @@ void KateBuildView::displayBuildResult(const QString &msg, KTextEditor::Message:
kv->document()->postMessage(m_infoMessage);
}
/******************************************************************/
void KateBuildView::displayMessage(const QString &msg, KTextEditor::Message::MessageType level)
{
KTextEditor::View *kv = m_win->activeView();
if (!kv)
return;
delete m_infoMessage;
m_infoMessage = new KTextEditor::Message(msg, level);
m_infoMessage->setWordWrap(true);
m_infoMessage->setPosition(KTextEditor::Message::BottomInView);
m_infoMessage->setAutoHide(8000);
m_infoMessage->setAutoHideMode(KTextEditor::Message::Immediate);
m_infoMessage->setView(kv);
kv->document()->postMessage(m_infoMessage);
}
/******************************************************************/
void KateBuildView::slotProcExited(int exitCode, QProcess::ExitStatus)
{
......
......@@ -127,6 +127,7 @@ private:
void clearBuildResults();
void displayBuildResult(const QString &message, KTextEditor::Message::MessageType level);
void displayMessage(const QString &message, KTextEditor::Message::MessageType level);
void clearMarks();
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