forked from qt-creator/qt-creator
Add "Add library wizard" to the pro file editor
Reviewed-by: dt <qtc-committer@nokia.com> Task-number: QTCREATORBUG-125
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "qt4projectmanager.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "profileeditorfactory.h"
|
||||
#include "addlibrarywizard.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -147,6 +148,26 @@ void ProFileEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
highlighter->rehighlight();
|
||||
}
|
||||
|
||||
void ProFileEditor::addLibrary()
|
||||
{
|
||||
AddLibraryWizard wizard(file()->fileName(), this);
|
||||
if (wizard.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
TextEditor::BaseTextEditorEditable *editable = editableInterface();
|
||||
const int endOfDoc = editable->position(TextEditor::ITextEditor::EndOfDoc);
|
||||
editable->setCurPos(endOfDoc);
|
||||
QString snippet = wizard.snippet();
|
||||
|
||||
// add extra \n in case the last line is not empty
|
||||
int line, column;
|
||||
editable->convertPosition(endOfDoc, &line, &column);
|
||||
if (!editable->textAt(endOfDoc - column, column).simplified().isEmpty())
|
||||
snippet = QLatin1Char('\n') + snippet;
|
||||
|
||||
editable->insert(snippet);
|
||||
}
|
||||
|
||||
//
|
||||
// ProFileDocument
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user