1
/* This file is part of the Kate project.
2
* Based on the snippet plugin from KDevelop 4.
4
* Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
5
* Copyright (C) 2010 Milian Wolff <mail@milianw.de>
6
* Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
7
* Copyright (C) 2014 Sven Brauch <svenbrauch@gmail.com>
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Library General Public
11
* License as published by the Free Software Foundation; either
12
* version 2 of the License, or (at your option) any later version.
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Library General Public License for more details.
19
* You should have received a copy of the GNU Library General Public License
20
* along with this library; see the file COPYING.LIB. If not, write to
21
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
* Boston, MA 02110-1301, USA.
28
#include "ui_snippetview.h"
31
class KateSnippetGlobal;
33
class QSortFilterProxyModel;
35
namespace KTextEditor {
39
* This class gets embedded into the right tool view by the KateSnippetGlobal.
40
* @author Robert Gruber <rgruber@users.sourceforge.net>
41
* @author Milian Wolff <mail@milianw.de>
43
class SnippetView : public QWidget, public Ui::SnippetViewBase
48
explicit SnippetView(KateSnippetGlobal* plugin, QWidget* parent = 0);
51
void setupActionsForWindow(QWidget* widget);
55
* Opens the "Add Repository" dialog.
60
* Opens the "Edit repository" dialog.
65
* Removes the selected repository from the disk.
67
void slotRemoveRepo();
70
* Insert the selected snippet into the current file
72
void slotSnippetClicked(const QModelIndex & index);
75
* Open the edit dialog for the selected snippet
77
void slotEditSnippet();
80
* Removes the selected snippet from the tree and the filesystem
82
void slotRemoveSnippet();
85
* Creates a new snippet and open the edit dialog for it
87
void slotAddSnippet();
90
* Slot to get hot new stuff.
95
* Slot to put the selected snippet to GHNS
97
void slotSnippetToGHNS();
99
void contextMenu (const QPoint & pos);
100
/// disables or enables available actions based on the currently selected item
101
void validateActions();
103
/// insert snippet on double click
104
virtual bool eventFilter(QObject* , QEvent* );
106
QStandardItem* currentItem();
108
KateSnippetGlobal* m_plugin;
109
QSortFilterProxyModel* m_proxy;
111
QAction *m_addRepoAction;
112
QAction *m_removeRepoAction;
113
QAction *m_editRepoAction;
114
QAction *m_addSnippetAction;
115
QAction *m_removeSnippetAction;
116
QAction *m_editSnippetAction;
117
QAction *m_getNewStuffAction;
118
QAction *m_putNewStuffAction;