summaryrefslogtreecommitdiffstats
path: root/parts/snippet/snippetitem.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/snippet/snippetitem.h
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/snippet/snippetitem.h')
-rw-r--r--parts/snippet/snippetitem.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/parts/snippet/snippetitem.h b/parts/snippet/snippetitem.h
new file mode 100644
index 00000000..ac6fb416
--- /dev/null
+++ b/parts/snippet/snippetitem.h
@@ -0,0 +1,70 @@
+/*
+ * File : snippetitem.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#ifndef SNIPPETITEM_H
+#define SNIPPETITEM_H
+
+#include <klistview.h>
+#include <klocale.h>
+
+class QString;
+
+class SnippetGroup;
+
+/**
+This class represents one CodeSnippet-Item in the listview.
+It also holds the needed data for one snippet.
+@author Robert Gruber
+*/
+class SnippetItem : public QListViewItem {
+friend class SnippetGroup;
+public:
+ SnippetItem(QListViewItem * parent, QString name, QString text);
+
+ ~SnippetItem();
+ QString getName();
+ QString getText();
+ int getParent() { return iParent; }
+ void resetParent();
+ void setText(QString text);
+ void setName(QString name);
+ static SnippetItem * findItemByName(QString name, QPtrList<SnippetItem> &list);
+ static SnippetGroup * findGroupById(int id, QPtrList<SnippetItem> &list);
+
+private:
+ SnippetItem(QListView * parent, QString name, QString text);
+ QString strName;
+ QString strText;
+ int iParent;
+};
+
+/**
+This class represents one group in the listview.
+It is derived from SnippetItem in order to allow storing
+it in the main QPtrList<SnippetItem>.
+@author Robert Gruber
+*/
+class SnippetGroup : public SnippetItem {
+public:
+ SnippetGroup(QListView * parent, QString name, int id, QString lang=i18n("All"));
+ ~SnippetGroup();
+
+ int getId() { return iId; }
+ static int getMaxId() { return iMaxId; }
+ QString getLanguage() { return strLanguage; }
+
+ void setId(int id);
+ void setLanguage(QString lang) { strLanguage = lang; }
+
+private:
+ static int iMaxId;
+ int iId;
+ QString strLanguage;
+};
+
+#endif