File indexing completed on 2024-04-14 03:55:28
0001 /* 0002 SPDX-FileCopyrightText: 2002, 2003, 2004 Anders Lund <anders.lund@lund.tdcadsl.dk> 0003 SPDX-FileCopyrightText: 2002 John Firebaugh <jfirebaugh@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KATE_BOOKMARKS_H 0009 #define KATE_BOOKMARKS_H 0010 0011 #include <QObject> 0012 0013 namespace KTextEditor 0014 { 0015 class ViewPrivate; 0016 } 0017 0018 class KToggleAction; 0019 class KActionCollection; 0020 class QMenu; 0021 class QAction; 0022 0023 class KateBookmarks : public QObject 0024 { 0025 public: 0026 enum Sorting { Position, Creation }; 0027 explicit KateBookmarks(KTextEditor::ViewPrivate *parent, Sorting sort = Position); 0028 ~KateBookmarks() override; 0029 0030 void createActions(KActionCollection *); 0031 0032 KateBookmarks::Sorting sorting() 0033 { 0034 return m_sorting; 0035 } 0036 void setSorting(Sorting s) 0037 { 0038 m_sorting = s; 0039 } 0040 0041 protected: 0042 void insertBookmarks(QMenu &menu); 0043 0044 private: 0045 void toggleBookmark(); 0046 void clearBookmarks(); 0047 0048 void gotoLine(int line); 0049 0050 void bookmarkMenuAboutToShow(); 0051 0052 void goNext(); 0053 void goPrevious(); 0054 0055 void marksChanged(); 0056 0057 private: 0058 KTextEditor::ViewPrivate *m_view; 0059 KToggleAction *m_bookmarkToggle; 0060 QAction *m_bookmarkClear; 0061 QAction *m_goNext; 0062 QAction *m_goPrevious; 0063 0064 Sorting m_sorting; 0065 QMenu *m_bookmarksMenu; 0066 0067 uint _tries; 0068 }; 0069 0070 #endif