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

« back to all changes in this revision

Viewing changes to addons/snippets/snippet.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
 *
 
8
 *  This library is free software; you can redistribute it and/or
 
9
 *  modify it under the terms of the GNU Library General Public
 
10
 *  License as published by the Free Software Foundation; either
 
11
 *  version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 *  This library is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 *  Library General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU Library General Public License
 
19
 *  along with this library; see the file COPYING.LIB.  If not, write to
 
20
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
21
 *  Boston, MA 02110-1301, USA.
 
22
 */
 
23
 
 
24
#ifndef __SNIPPET_H__
 
25
#define __SNIPPET_H__
 
26
 
 
27
#include <QStandardItem>
 
28
 
 
29
class QAction;
 
30
 
 
31
/**
 
32
 * One object of this class represents a single snippet.
 
33
 * Multiple snippets are stored in one repository (XML-file).
 
34
 *
 
35
 * To access the snippet's name (which should also be used for matching
 
36
 * during code completion) use @p QStandardItem::text().
 
37
 *
 
38
 * @author Robert Gruber <rgruber@users.sourceforge.net>
 
39
 * @author Milian Wolff <mail@milianw.de>
 
40
 */
 
41
class Snippet : public QStandardItem
 
42
{
 
43
public:
 
44
    /**
 
45
     * Construct an empty snippet.
 
46
     */
 
47
    Snippet();
 
48
    ~Snippet();
 
49
 
 
50
    /**
 
51
     * Returns the actual contents of this snippet.
 
52
     */
 
53
    QString snippet() const;
 
54
    /**
 
55
     * Sets the actual contents of this snippet.
 
56
     */
 
57
    void setSnippet(const QString& snippet);
 
58
 
 
59
    /**
 
60
     * Action to trigger insertion of this snippet.
 
61
     */
 
62
    QAction* action();
 
63
 
 
64
    void registerActionForView(QWidget* view);
 
65
 
 
66
    virtual QVariant data(int role = Qt::UserRole + 1) const;
 
67
 
 
68
private:
 
69
    /// the actual snippet contents aka \code<fillin>\endcode
 
70
    QString m_snippet;
 
71
    /// the insertion action for this snippet.
 
72
    QAction* m_action;
 
73
};
 
74
 
 
75
Q_DECLARE_METATYPE ( Snippet* )
 
76
 
 
77
#endif