Add "Add Library" action to project explorer's context menu

Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Task-number: QTCREATORBUG-4127
This commit is contained in:
Jarek Kobus
2011-04-13 13:54:15 +02:00
parent 52f52ffde3
commit d34c81a2a6
6 changed files with 80 additions and 43 deletions

View File

@@ -37,7 +37,6 @@
#include "qt4projectmanager.h"
#include "qt4projectmanagerconstants.h"
#include "profileeditorfactory.h"
#include "addlibrarywizard.h"
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -244,26 +243,6 @@ void ProFileEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
highlighter->rehighlight();
}
void ProFileEditorWidget::addLibrary()
{
AddLibraryWizard wizard(file()->fileName(), this);
if (wizard.exec() != QDialog::Accepted)
return;
TextEditor::BaseTextEditor *editable = editor();
const int endOfDoc = editable->position(TextEditor::ITextEditor::EndOfDoc);
editable->setCursorPosition(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);
}
void ProFileEditorWidget::jumpToFile()
{
openLink(findLinkAt(textCursor()));