File indexing completed on 2024-04-28 15:30:52

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     Q_OBJECT
0026 
0027 public:
0028     enum Sorting { Position, Creation };
0029     explicit KateBookmarks(KTextEditor::ViewPrivate *parent, Sorting sort = Position);
0030     ~KateBookmarks() override;
0031 
0032     void createActions(KActionCollection *);
0033 
0034     KateBookmarks::Sorting sorting()
0035     {
0036         return m_sorting;
0037     }
0038     void setSorting(Sorting s)
0039     {
0040         m_sorting = s;
0041     }
0042 
0043 protected:
0044     void insertBookmarks(QMenu &menu);
0045 
0046 private Q_SLOTS:
0047     void toggleBookmark();
0048     void clearBookmarks();
0049 
0050     void gotoLine(int line);
0051 
0052     void bookmarkMenuAboutToShow();
0053 
0054     void goNext();
0055     void goPrevious();
0056 
0057     void marksChanged();
0058 
0059 private:
0060     KTextEditor::ViewPrivate *m_view;
0061     KToggleAction *m_bookmarkToggle;
0062     QAction *m_bookmarkClear;
0063     QAction *m_goNext;
0064     QAction *m_goPrevious;
0065 
0066     Sorting m_sorting;
0067     QMenu *m_bookmarksMenu;
0068 
0069     uint _tries;
0070 };
0071 
0072 #endif