~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to addons/snippets/snippetview.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the Kate project.
 
2
 *  Based on the snippet plugin from KDevelop 4.
 
3
 *
 
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>
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 *
 
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.
 
23
 */
 
24
 
 
25
#ifndef SNIPPETVIEW_H
 
26
#define SNIPPETVIEW_H
 
27
 
 
28
#include "ui_snippetview.h"
 
29
 
 
30
class QStandardItem;
 
31
class KateSnippetGlobal;
 
32
class QAction;
 
33
class QSortFilterProxyModel;
 
34
 
 
35
namespace KTextEditor {
 
36
}
 
37
 
 
38
/**
 
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>
 
42
 */
 
43
class SnippetView : public QWidget, public Ui::SnippetViewBase
 
44
{
 
45
    Q_OBJECT
 
46
 
 
47
public:
 
48
    explicit SnippetView(KateSnippetGlobal* plugin, QWidget* parent = 0);
 
49
 
 
50
public:
 
51
    void setupActionsForWindow(QWidget* widget);
 
52
 
 
53
private Q_SLOTS:
 
54
    /**
 
55
     * Opens the "Add Repository" dialog.
 
56
     */
 
57
    void slotAddRepo();
 
58
 
 
59
    /**
 
60
     * Opens the "Edit repository" dialog.
 
61
     */
 
62
    void slotEditRepo();
 
63
 
 
64
    /**
 
65
     * Removes the selected repository from the disk.
 
66
     */
 
67
    void slotRemoveRepo();
 
68
 
 
69
    /**
 
70
     * Insert the selected snippet into the current file
 
71
     */
 
72
    void slotSnippetClicked(const QModelIndex & index);
 
73
 
 
74
    /**
 
75
     * Open the edit dialog for the selected snippet
 
76
     */
 
77
    void slotEditSnippet();
 
78
 
 
79
    /**
 
80
     * Removes the selected snippet from the tree and the filesystem
 
81
     */
 
82
    void slotRemoveSnippet();
 
83
 
 
84
    /**
 
85
     * Creates a new snippet and open the edit dialog for it
 
86
     */
 
87
    void slotAddSnippet();
 
88
 
 
89
    /**
 
90
     * Slot to get hot new stuff.
 
91
     */
 
92
    void slotGHNS();
 
93
 
 
94
    /**
 
95
     * Slot to put the selected snippet to GHNS
 
96
     */
 
97
    void slotSnippetToGHNS();
 
98
 
 
99
    void contextMenu (const QPoint & pos);
 
100
    /// disables or enables available actions based on the currently selected item
 
101
    void validateActions();
 
102
 
 
103
    /// insert snippet on double click
 
104
    virtual bool eventFilter(QObject* , QEvent* );
 
105
private:
 
106
    QStandardItem* currentItem();
 
107
 
 
108
    KateSnippetGlobal* m_plugin;
 
109
    QSortFilterProxyModel* m_proxy;
 
110
 
 
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;
 
119
};
 
120
 
 
121
#endif
 
122