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:
Jarek Kobus
2010-08-16 18:23:30 +02:00
parent 8cd3b54949
commit 573006f370
18 changed files with 1870 additions and 31 deletions

View File

@@ -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
//