diff options
author | Leandro Melo <leandro.melo@nokia.com> | 2011-11-29 13:51:00 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@nokia.com> | 2011-12-02 11:07:07 +0100 |
commit | 67ab31c224d2c7628e5fdd19df77378af6d0b13a (patch) | |
tree | 1dac63e4e2af58fc2c4597a35b542c6c2487ef13 /src/plugins/bookmarks | |
parent | d4a881e6ee9b6b0ba6fc4bc06beb5a57c9e0e8f2 (diff) | |
download | qt-creator-67ab31c224d2c7628e5fdd19df77378af6d0b13a.tar.gz |
Editor: Bookmark when Shift-clicking the gutter
Task-number: QTCREATORBUG-2852
Change-Id: If539f812bce76c1c1e7b63e7133e2a7c962990ea
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Diffstat (limited to 'src/plugins/bookmarks')
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.cpp | 8 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.h | 9 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarksplugin.cpp | 7 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index e988598aec..d196587213 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -760,6 +760,14 @@ void BookmarkManager::loadBookmarks() updateActionStatus(); } +void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor, + int line, + TextEditor::ITextEditor::MarkRequestKind kind) +{ + if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->file()) + toggleBookmark(textEditor->file()->fileName(), line); +} + // BookmarkViewFactory BookmarkViewFactory::BookmarkViewFactory(BookmarkManager *bm) diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 3e450290c6..a0ac93cbb6 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -36,6 +36,8 @@ #include <coreplugin/icontext.h> #include <coreplugin/inavigationwidgetfactory.h> +#include <texteditor/itexteditor.h> + #include <QtCore/QAbstractItemModel> #include <QtCore/QMultiMap> #include <QtCore/QList> @@ -51,10 +53,6 @@ namespace Core { class IEditor; } -namespace TextEditor { -class ITextEditor; -} - namespace Bookmarks { namespace Internal { @@ -115,6 +113,9 @@ signals: private slots: void updateActionStatus(); void loadBookmarks(); + void handleBookmarkRequest(TextEditor::ITextEditor * textEditor, + int line, + TextEditor::ITextEditor::MarkRequestKind kind); private: TextEditor::ITextEditor *currentTextEditor() const; diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index bada612f12..19d9cb5b24 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -179,6 +179,13 @@ void BookmarksPlugin::editorOpened(Core::IEditor *editor) if (qobject_cast<ITextEditor *>(editor)) { connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); + + connect(editor, + SIGNAL(markRequested(TextEditor::ITextEditor*,int, + TextEditor::ITextEditor::MarkRequestKind)), + m_bookmarkManager, + SLOT(handleBookmarkRequest(TextEditor::ITextEditor*,int, + TextEditor::ITextEditor::MarkRequestKind))); } } |