BookMarks: Fix line contents display

This really needs the dynamic type for the update.
Also using the IEditor interface is sufficient for most parts.

Change-Id: Ic9806f39077065c43b6325b2345ef5d8bab4ff34
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-10-17 10:21:57 +02:00
parent 605deb55e8
commit 1eb4d2ab8b
5 changed files with 35 additions and 38 deletions

View File

@@ -162,11 +162,18 @@ void BookmarksPlugin::updateActions(int state)
void BookmarksPlugin::editorOpened(IEditor *editor)
{
if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
connect(widget, &TextEditorWidget::markRequested,
m_bookmarkManager, &BookmarkManager::handleBookmarkRequest);
connect(widget, &TextEditorWidget::markRequested, m_bookmarkManager,
[this, editor](TextEditorWidget *, int line, TextMarkRequestKind kind) {
if (kind == BookmarkRequest && editor->document())
m_bookmarkManager->toggleBookmark(editor->document()->filePath(), line);
});
connect(widget, &TextEditorWidget::markTooltipRequested,
m_bookmarkManager, &BookmarkManager::handleBookmarkTooltipRequest);
connect(widget, &TextEditorWidget::markTooltipRequested, m_bookmarkManager,
[this, editor](TextEditorWidget *, const QPoint &pos, int line) {
if (editor->document())
m_bookmarkManager->handleBookmarkTooltipRequest(editor, pos, line);
});
connect(widget, &TextEditorWidget::markContextMenuRequested,
this, &BookmarksPlugin::requestContextMenu);