summaryrefslogtreecommitdiffstats
path: root/kate/snippets
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
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /kate/snippets
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.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/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/snippets')
-rw-r--r--kate/snippets/CWidgetSnippetsBase.ui214
-rw-r--r--kate/snippets/CWidgetSnippetsBase.ui.h28
-rw-r--r--kate/snippets/Makefile.am17
-rw-r--r--kate/snippets/csnippet.cpp17
-rw-r--r--kate/snippets/csnippet.h39
-rw-r--r--kate/snippets/cwidgetsnippets.cpp22
-rw-r--r--kate/snippets/cwidgetsnippets.h26
-rw-r--r--kate/snippets/katesnippets.desktop101
-rw-r--r--kate/snippets/plugin_katesnippets.cpp321
-rw-r--r--kate/snippets/plugin_katesnippets.h78
-rw-r--r--kate/snippets/plugin_katesnippets.rc11
11 files changed, 874 insertions, 0 deletions
diff --git a/kate/snippets/CWidgetSnippetsBase.ui b/kate/snippets/CWidgetSnippetsBase.ui
new file mode 100644
index 0000000..7f370f9
--- /dev/null
+++ b/kate/snippets/CWidgetSnippetsBase.ui
@@ -0,0 +1,214 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>CWidgetSnippetsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>CWidgetSnippetsBase</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>531</width>
+ <height>740</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Snippets</string>
+ <comment>Snippets for Kate</comment>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Snippet</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvSnippets</cstring>
+ </property>
+ <property name="cursor">
+ <cursor>13</cursor>
+ </property>
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <property name="lineWidth">
+ <number>2</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="resizePolicy">
+ <enum>Manual</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="showToolTips">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="treeStepSize">
+ <number>20</number>
+ </property>
+ <property name="defaultRenameAction">
+ <enum>Accept</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>A list of Snippets</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A list of Snippets, what else</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>btnNew</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>btnSave</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>btnDelete</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>image3</iconset>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>teSnippetText</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ <property name="tabChangesFocus">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="1917">789c7dd4476fdb401005e0bb7e05e1bd19c158ec5c0439b897b8c9dd0e725816c94d6e926b90ff9ed9d9478a0e83686d409fe6f189c2aeb430ef9dedef78f30bbdc9d44caf0aafb8344fde7cf93c1ebffff8f9ed576fcecf3cfe4b032f98fbd29b1b4cbdc2dbbdbfab2c4831545f1ee2657196e8c488f7acfd7e52c21bb5d3d05a0dad031debc8cd2bebd00fb2c0f5ddc2057ce49cf9995c4f191cc363b10efb8116dfc111bcef9ce92c177fb78efcc6723f9189faa12f367004af386b5f47e2dc3a0e78eefa3f9cb5d685f8596c1a3f582781f18dbbfe526ce2129fffcab99917700cbf58a761e2c7b219740f6bb86cecfaa67089f9b538e7fd707eb7cec2348697600df71b4b9faae0fafa35715ecf6913aef73b74ce7ce4d71bbbf9161ca39fac75d4cc0f60cce9acb63b3fb4036b78575c6465eaf6f3d059fb706c9d470656aa36cecf051c637f13d8c0917511e709f6f35c5ce606fba3adcb38aff3a9739118c92b533b77f347715504e85b84eb7e1fae70bd9c878ab7af28c5396c9ce9585c9549ee1cc006ef770a57452c7eb21e268d4f9cab007d03980f9078049b52beffaaac5d25327f150f9bebb79d8701e66f8dddefc7044ee055d80c5dfe06e687fbf121e5d6603a5b64289fbde67e97a8a092aad9ab9c18d2882e3bb92bbaa61bba95d631dd71e686d77d27f7c07d765271ea919e68229a7672cfd267d70be75ee94d9ebfd7f74d0ab90ff4d98ec5a66f89df7ff9536e057dabb4d6ea5be7dcc65fb99233139e6fb6fab63a7ddfb96f9bd788765a7dbbecbd4fb97dee1bd180d741abefb0d377c47dc77442a77486be73fe14179dfbb3c93ef91450c87d1167624a28edf4d995f167d5fc44d19a322a57852a3fdf5f730eb85355dc75c4d7d4ffcbed5c93ccd49067aabbeadcec6cfd7bcd72ff4fb673ed64fbc4ca79f9fdb5f707a32dabb2</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="1055">789c5dd24b6fe2301000e03bbf222237b4a22d2259a2d51e80044a5b28ed69a5d51efc248f8600061a5aed7fdf8cc793a28da3c8df783cb623dff4bc5feba5d7bbe998233b66c213293b783d792acbcbef3f3f3f3bddbbd06bde61f3ed7eeb74fb9ef056d55641bf6cfafe773e0a2201fc20b221903b46c87720139c09093c00f990281c1592116500f42da51820f78e21f20c148160d2ee6ae6a8904f9692b824aa10b846ca018e268e218ec64019105347867c6969e7be5a2a1add39ba85b29636b940aa01b202aa6619e485a8eddc8d23436a4b45cc1d15f204d421718bd403ad8147475759b5b4a3c65247c1ed2db0768c9013a408915347869448cdb0d4d851df8d808fc48001e7c47000bc278e38f08118d99bb320727b375644bc2acf44bc0c6f44dc46bf797c868d377d8a89e6dfeb4d9a09fe15f3a554f9a6c87c9f7fe5bd2995e75956f2925fe76df36a97ee0f25c58c39aafc541467f68e79a6eed7469a3abf6467dfffb07f773c31e3b1998e4d9ccc667b9737bf5f2c1e1eeb2c4de2a7a5ab67a6abe78929b2348de3f575debc866012ff576f97256d1eacab4d5d14e94b1c5fedafaa8a62f7dad68373e41a826d3d88c139a975fffee8fc0371b41110</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="1345">789c5dd44b53db301007f07b3e8507df980e58b625dbd3e9018815de2101c2a3d3c35a9209818400e1d9e9776f76572a505fe2df7f572b3913677d353a3f3a8856d73b8f0b585c9bc88ce1215ab54fd3e9dbcf5f3f7e7756848a4411a93c122bdf3a2b6b91890eef660eeff5f23e4ee84296c4322905b1468a44e4a244a6c43270e059328f9169224c46bbec11abb44c2be433321359921113642e322353e41911f25211f3c0b2413aa6945c554899caa4c89085a764021164c5cde61f0129032b83cc3c2d3346aa545a6ebe662ac13c0ce4e67d22280939b2f2acf8cca7815c1d228bac10406b0f884d219923cfaaa1e62d4fcb7c419659e011b3148d4576894d29993b9e15731b59e5953012f9ee29991744132890b0fca20dadbd241a00663fd052f32bb2c9c1311f988d62be116d03967e66b748231bc79c324dea1472e2a9988f441b78efe9980ba495069863a64d1d4d7ef254cc19d105ce3d817917d8d2a82b4fc7d50da453d66f74eee9b8f984e9fcbebd40ae369e8ab9ebe9d75aa20bd54d4f7f8c1b64dbb6d0b6c8d6b365aef92bf69f9f3268ccffd9f271daf86b06576e39ca7ccee2f135cd8f3f329898f6864213b2f8763a89db9bd9dd6c7e1f73060fb7f03831f78ba7f9fcf9855fa1d737b0307e8f9b8dcde7ad6e4d7f3253e8f51ad8de31bb7bfb0775975e266d7bfd9e85a3adc170587779deb19e9ff47b7d189e8eea33edf7d5fabc777139381cd589d6da9f4febbe48b351adf547b60c07b9acd5976c19eed485fe9aade9b2c2009ff7cff7ce5fcf2134c0</data>
+ </image>
+ <image name="image3">
+ <data format="XPM.GZ" length="965">789c5dd1514fdb301007f0f77e8aa879aba6423b9a0d211e70431b284c7b44427b70ec334e89db244da165da77c7e7b393322791fcf3fd7d4e94b351f4f4fb311a9d0d762d6f0b1109cd9b6824f7c61c9fff5cff1d0c274964ef8bf36832fc36188e2311fdda6e00e78d9dc73fbeff9c5c0ae4bb631e283c67c41b2417792224f20d995f04724f20e68172868c1d65e09628a6c4bd6742fc408a99e0c47947f7ceb79e405c38cac07ba29c12d3404890779e09551f02a9aa917216987972e2c61388b52304161d5d67438429f188842470e59910db40e55abd7872a27204e0142e03a95a7902f1405453e22b52d96394422e89a1baebe8aae0991099a33ab703b9262a4e55e9a988e371cce31c1f31c6416bf68f817ad10517fd5a2cd7f05a9a4dbc155f725555178d68c4696e57b5b5debfbd9fe60e87a3f9e0377d8e31bbb9652c8e9b2eb766ac2c199bcff77d0e76cc0e9dde2efa7eb0ac18cbb2bb74f15faec8749af6fda0c4bdb5d6f77d6ec9d8cad8dd0fbaefc7586b4c6d4f39c955ed6a658acc36ecfae17786cbaefdbb1a7c029001f396</data>
+ </image>
+</images>
+<includes>
+ <include location="local" impldecl="in implementation">CWidgetSnippetsBase.ui.h</include>
+</includes>
+<signals>
+ <signal>lalala()</signal>
+</signals>
+<slots>
+ <slot>init()</slot>
+</slots>
+<functions>
+ <function returnType="QListViewItem *">insertItem( const QString&amp; name, bool bRename )</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kate/snippets/CWidgetSnippetsBase.ui.h b/kate/snippets/CWidgetSnippetsBase.ui.h
new file mode 100644
index 0000000..816d7d8
--- /dev/null
+++ b/kate/snippets/CWidgetSnippetsBase.ui.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+
+void CWidgetSnippetsBase::init()
+{
+
+}
+
+
+QListViewItem* CWidgetSnippetsBase::insertItem( const QString& name, bool bRename )
+{
+ QListViewItem *item = new QListViewItem(lvSnippets, name);
+ item->setRenameEnabled(0,true);
+ lvSnippets->setSelected( item, true );
+ if ( bRename ) {
+ teSnippetText->clear();
+ item->startRename (0);
+ }
+ return item;
+}
diff --git a/kate/snippets/Makefile.am b/kate/snippets/Makefile.am
new file mode 100644
index 0000000..23bc3cf
--- /dev/null
+++ b/kate/snippets/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = katesnippetsplugin.la
+
+katesnippetsplugin_la_SOURCES = plugin_katesnippets.cpp CWidgetSnippetsBase.ui cwidgetsnippets.h cwidgetsnippets.cpp csnippet.h csnippet.cpp CWidgetSnippetsBase.ui.h
+katesnippetsplugin_la_LIBADD = -lkateinterfaces
+katesnippetsplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+pluginsdir = $(kde_datadir)/kate/plugins/katesnippets
+plugins_DATA = plugin_katesnippets.rc
+
+kde_services_DATA = katesnippets.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/katesnippets.pot
diff --git a/kate/snippets/csnippet.cpp b/kate/snippets/csnippet.cpp
new file mode 100644
index 0000000..fc7d7e7
--- /dev/null
+++ b/kate/snippets/csnippet.cpp
@@ -0,0 +1,17 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Stephan M�res *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include "csnippet.h"
+
+CSnippet::CSnippet(QString sKey, QString sValue, QListViewItem *lvi, QObject *parent, const char *name)
+ : QObject(parent, name), _sKey(sKey), _sValue(sValue), _lvi(lvi) {}
+
+CSnippet::~CSnippet() {}
+
+#include "csnippet.moc"
diff --git a/kate/snippets/csnippet.h b/kate/snippets/csnippet.h
new file mode 100644
index 0000000..a139f03
--- /dev/null
+++ b/kate/snippets/csnippet.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Stephan M�res *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#ifndef CSNIPPET_H
+#define CSNIPPET_H
+
+#include <qobject.h>
+#include <qlistview.h>
+#include <kaction.h>
+#include <qsignalmapper.h>
+
+/**
+@author Stephan M�res
+*/
+
+class CSnippet : public QObject {
+ Q_OBJECT
+public:
+ CSnippet(QString sKey, QString sValue, QListViewItem *lvi, QObject *parent = 0, const char *name = 0);
+ ~CSnippet();
+ QString getKey() { return _sKey; }
+ QString getValue() { return _sValue; }
+ QListViewItem* getListViewItem() const { return _lvi; }
+ void setKey(const QString& sKey) { _sKey = sKey; }
+ void setValue(const QString& sValue) { _sValue = sValue; }
+
+protected:
+ QString _sKey;
+ QString _sValue;
+ QListViewItem *_lvi;
+};
+
+#endif
diff --git a/kate/snippets/cwidgetsnippets.cpp b/kate/snippets/cwidgetsnippets.cpp
new file mode 100644
index 0000000..cf44319
--- /dev/null
+++ b/kate/snippets/cwidgetsnippets.cpp
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Stephan M�res *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include "cwidgetsnippets.h"
+
+CWidgetSnippets::CWidgetSnippets( QWidget* parent, const char* name, WFlags fl)
+ : CWidgetSnippetsBase(parent, name, fl)
+{
+}
+
+
+CWidgetSnippets::~CWidgetSnippets()
+{
+}
+
+
diff --git a/kate/snippets/cwidgetsnippets.h b/kate/snippets/cwidgetsnippets.h
new file mode 100644
index 0000000..6d246c3
--- /dev/null
+++ b/kate/snippets/cwidgetsnippets.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Stephan M�res *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#ifndef CWIDGETSNIPPETS_H
+#define CWIDGETSNIPPETS_H
+
+#include <CWidgetSnippetsBase.h>
+
+/**
+@author Stephan M�res
+*/
+class CWidgetSnippets : public CWidgetSnippetsBase {
+public:
+ CWidgetSnippets( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ ~CWidgetSnippets();
+
+};
+
+#endif
diff --git a/kate/snippets/katesnippets.desktop b/kate/snippets/katesnippets.desktop
new file mode 100644
index 0000000..4479b06
--- /dev/null
+++ b/kate/snippets/katesnippets.desktop
@@ -0,0 +1,101 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katesnippetsplugin
+X-Kate-Version=2.5
+Name=Kate Snippets
+Name[ca]=Retalls del Kate
+Name[cs]=Kate útržky
+Name[da]=Kate-Stumper
+Name[de]=Kate-Schnipsel
+Name[el]=Δείγματα Kate
+Name[eo]=Erilo por Kodredaktilo
+Name[es]=Recorte de Kate
+Name[et]=Kate koodijupid
+Name[fa]=تکه‌های Kate
+Name[fi]=Kate tekstipalat
+Name[fr]=Fragments de codes pour Kate
+Name[fy]=Kate-fragminten
+Name[ga]=Blúirí Kate
+Name[gl]=Anacos para Kate
+Name[he]=טקעי קוד של Kate
+Name[hr]=Kate isječci
+Name[hu]=Kate-kódrészletek
+Name[is]=Kate úrklippur
+Name[it]=Frammenti di testo di Kate
+Name[ja]=Kate 定型表現
+Name[ka]=Kate ფრაგმენტები
+Name[km]=អត្ថបទ​ខ្លីៗ​របស់ Kate
+Name[lt]=Kate teksto fragmentai
+Name[mk]=Парчиња за Кате
+Name[nb]=Kate-biter
+Name[nds]=Kate-Snippets
+Name[ne]=केट स्निपेट
+Name[nl]=Kate-fragmenten
+Name[nn]=Kate-snuttar
+Name[pa]=ਕੇਟ ਸਨੇਪਿੱਟ
+Name[pl]=Fragmenty kodu dla Kate
+Name[pt]=Pedaços do Kate
+Name[pt_BR]=Trechos de Código (snippets) do Kate
+Name[ru]=Фрагменты текста Kate
+Name[sk]=Kate štipka
+Name[sl]=Odsek za Kate
+Name[sr]=Исечци за Kate
+Name[sr@Latn]=Isečci za Kate
+Name[sv]=Kate-snuttar
+Name[ta]=கேட் சிறுகுறிப்புகள்
+Name[tr]=Kate Parçacıkları
+Name[uk]=Kate-Snippets
+Name[vi]=Đoạn Kate
+Name[zh_CN]=Kate 段
+Comment=Configurable Text-Snippets for Kate
+Comment[bg]=Потребителски текстови пасажи за Kate
+Comment[ca]=Retalls de text configurables per al Kate
+Comment[cs]=Nastavitelné textové útržky v Kate
+Comment[da]=Indstillelige tekststumper for Kate
+Comment[de]=Konfigurierbare Textschnipsel für Kate
+Comment[el]=Ρυθμιζόμενα δείγματα κειμένου για το Kate
+Comment[eo]=Agordeblaj tekseroj por Kodredaktilo
+Comment[es]=Recortes de texto para Kate
+Comment[et]=Kate seadistatavad tekstijupid
+Comment[eu]=Text-Snippets konfiguragarria Katerako
+Comment[fa]=تکه‌های متن قابل پیکربندی برای Kate
+Comment[fi]=Aseteltavia tekstipaloja Kateen
+Comment[fr]=Fragments de codes configurables pour Kate
+Comment[fy]=Ynstelbere tekstfragminten foar Kate
+Comment[ga]=Blúirí Inchumraithe Téacs do Kate
+Comment[gl]=Pedazos de Texto Configurábeis para Kate
+Comment[he]=הגדרת קטעי קוד עבור Kate
+Comment[hi]=केएटीई हेतु कॉन्फ़िगर करने योग्य टैक्स्ट-स्निपेट्स
+Comment[hr]=Konfigurabilni tekstualni isječci za Kate
+Comment[hu]=Beállítható szövegrészletek a Kate-hez
+Comment[is]=Stillanlegar texta úrklippur fyrir Kate
+Comment[it]=Frammenti di testo configurabili per Kate
+Comment[ja]=よく使う表現を登録しておきます
+Comment[ka]=კონფიგურირებადი ტექსტის ფრაგმენტები Kate-სთვის
+Comment[kk]=Бапталатын Kate мәтін-фрагменттері
+Comment[km]=អត្ថបទ​ខ្លីៗ​​ដែល​អាច​កំណត់​រចនា​សម្ព័ន្ធ​បាន​សម្រាប់ Kate
+Comment[lt]=Konfigūruoti Kate teksto fragmentų priedą
+Comment[mk]=Конфигурабилни парчиња текст за Кате
+Comment[ms]=Teks-Snippets boleh konfigur untuk Kate
+Comment[nb]=Innstillbare tekstbiter til Kate
+Comment[nds]=Instellbor Textsnippels för Kate
+Comment[ne]=केटका लागि कन्फिगर योग्य पाठ- खण्ड
+Comment[nl]=Instelbare tekstfragmenten voor Kate
+Comment[nn]=Tilpassbare tekstsnuttar til Kate
+Comment[pl]=Konfigurowalne fragmenty kodu dla Kate
+Comment[pt]=Pedaços de Texto Configuráveis para o Kate
+Comment[pt_BR]=Snippets configuráveis para o Kate
+Comment[ru]=Настраиваемые фрагменты текста для Kate
+Comment[sk]=Konfigurovateľná textová štipka pre Kate
+Comment[sl]=nastavljivi besedilni odseki za Kate
+Comment[sr]=Подесиви исечци текста за Kate
+Comment[sr@Latn]=Podesivi isečci teksta za Kate
+Comment[sv]=Anpassningsbara textsnuttar för Kate
+Comment[ta]=வடிவமைக்கக்கூடிய கேட்டுக்கான உரை-குறிப்புகள்
+Comment[tr]=Kate için Yapılandırılabilir Kod Parçacıkları
+Comment[uk]=Текстові уривки для Kate, які можна налаштовувати
+Comment[vi]=Đoạn văn bản có thể cấu hình cho Kate
+Comment[zh_CN]=可配置的 Kate 文本段
+Comment[zh_TW]=設定 Kate Text-Snippets
+author=Stephan Möres, [email protected]
diff --git a/kate/snippets/plugin_katesnippets.cpp b/kate/snippets/plugin_katesnippets.cpp
new file mode 100644
index 0000000..07cba2b
--- /dev/null
+++ b/kate/snippets/plugin_katesnippets.cpp
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2004 Stephan M�res <[email protected]>
+ */
+
+#include "plugin_katesnippets.h"
+
+#include <kaction.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kgenericfactory.h>
+
+
+// let the world know ...
+K_EXPORT_COMPONENT_FACTORY(katesnippetsplugin, KGenericFactory<KatePluginSnippets>( "katesnippets" ) )
+
+
+// < IMPLEMENTAIONS for KatePluginSnippetsView >
+//
+//
+
+/**
+ * ctor KatePluginSnippetsView
+ * @param w
+ * @return
+ */
+KatePluginSnippetsView::KatePluginSnippetsView(Kate::MainWindow *w, QWidget *dock) : CWidgetSnippets(dock,"snippetswidget")
+ , dock (dock)
+{
+ setInstance (new KInstance("kate"));
+ setXMLFile("plugins/katesnippets/plugin_katesnippets.rc");
+
+ w->guiFactory()->addClient (this);
+ win = w;
+
+
+ //<make connections>
+ connect (
+ lvSnippets, SIGNAL( selectionChanged(QListViewItem *) ),
+ this, SLOT( slot_lvSnippetsSelectionChanged(QListViewItem *) )
+ );
+ connect (
+ lvSnippets, SIGNAL( doubleClicked (QListViewItem *) ),
+ this, SLOT( slot_lvSnippetsClicked(QListViewItem *) )
+ );
+ connect (
+ lvSnippets, SIGNAL( itemRenamed(QListViewItem *, int, const QString &) ),
+ this, SLOT( slot_lvSnippetsItemRenamed(QListViewItem *, int, const QString &) )
+ );
+
+ connect (
+ btnNew, SIGNAL( clicked () ),
+ this, SLOT( slot_btnNewClicked() )
+ );
+ connect (
+ btnSave, SIGNAL( clicked () ),
+ this, SLOT( slot_btnSaveClicked() )
+ );
+ connect (
+ btnDelete, SIGNAL( clicked () ),
+ this, SLOT( slot_btnDeleteClicked() )
+ );
+ //</make connections>
+
+ lSnippets.setAutoDelete( TRUE ); // the list owns the objects
+
+ config = new KConfig("katesnippetspluginrc");
+ readConfig();
+
+ // set text of selected item at startup
+ slot_lvSnippetsSelectionChanged(lvSnippets->selectedItem() );
+}
+
+
+/**
+ * dtor KatePluginSnippetsView
+ * @return
+ */
+KatePluginSnippetsView::~ KatePluginSnippetsView() {
+ writeConfig();
+
+ win->guiFactory()->removeClient(this);
+}
+
+
+//
+//
+// < IMPLEMENTAIONS for KatePluginSnippetsView >
+
+
+
+
+// < IMPLEMENTAIONS for KatePluginSnippets >
+//
+//
+
+/**
+ * ctor KatePluginSnippets
+ * @param parent
+ * @param name
+ * @return
+ */
+KatePluginSnippets::KatePluginSnippets( QObject* parent, const char* name, const QStringList& )
+ : Kate::Plugin ( (Kate::Application*)parent, name ) {}
+
+/**
+ * dtor KatePluginSnippets
+ * @return
+ */
+KatePluginSnippets::~KatePluginSnippets() {}
+
+/**
+ *
+ * @param win
+ */
+void KatePluginSnippets::addView(Kate::MainWindow *win)
+{
+ QWidget *dock = win->toolViewManager()->createToolView(
+ "kate_plugin_snippets",
+ Kate::ToolViewManager::Left,
+ SmallIcon("contents"),
+ i18n("Snippets"));
+
+ KatePluginSnippetsView *view = new KatePluginSnippetsView (win,dock);
+ m_views.append(view);
+}
+
+
+/**
+ *
+ * @param win
+ */
+void KatePluginSnippets::removeView(Kate::MainWindow *win) {
+ for (uint z=0; z < m_views.count(); z++)
+ if (m_views.at(z)->win == win) {
+ KatePluginSnippetsView *view = m_views.at(z);
+ m_views.remove (view);
+ delete view->dock;
+ }
+}
+
+/**
+ *
+ * @param item
+ */
+void KatePluginSnippetsView::slot_lvSnippetsSelectionChanged(QListViewItem * item) {
+ CSnippet *snippet;
+ if ( (snippet = findSnippetByListViewItem(item))!= NULL ) {
+ teSnippetText->setText(snippet->getValue());
+ }
+
+}
+
+
+/**
+ * Special meaning of <mark/> and <cursor/> ...
+ * @param item
+ */
+void KatePluginSnippetsView::slot_lvSnippetsClicked (QListViewItem * item) {
+ Kate::View *kv = win->viewManager()->activeView();
+ CSnippet *snippet;
+
+ if (kv) {
+ if ( (snippet = findSnippetByListViewItem(item))!= NULL ) {
+ QString sText = snippet->getValue();
+ QString sSelection = "";
+
+ if ( kv->getDoc()->hasSelection() ) {
+ sSelection = kv->getDoc()->selection();
+ // clear selection
+ kv->keyDelete();
+ }
+
+ sText.replace( QRegExp("<mark/>"), sSelection );
+ sText.replace( QRegExp("<date/>"), QDate::currentDate().toString(Qt::LocalDate) );
+ sText.replace( QRegExp("<time/>"), QTime::currentTime().toString(Qt::LocalDate) );
+ kv->insertText ( sText );
+ }
+ kv->setFocus();
+ }
+}
+
+
+/**
+ *
+ * @param lvi
+ * @param
+ * @param text
+ */
+void KatePluginSnippetsView::slot_lvSnippetsItemRenamed(QListViewItem *lvi,int /*col*/, const QString& text) {
+ CSnippet *snippet;
+ if ( (snippet = findSnippetByListViewItem(lvi)) != NULL ) {
+ snippet->setKey( text );
+ writeConfig();
+ }
+}
+
+
+/**
+ *
+ */
+void KatePluginSnippetsView::slot_btnNewClicked() {
+ QString sKey = "New Snippet";
+ QString sValue = "";
+
+ QListViewItem *lvi = insertItem(sKey, true);
+ lSnippets.append( new CSnippet(sKey, sValue, lvi) );
+}
+
+
+/**
+ *
+ */
+void KatePluginSnippetsView::slot_btnSaveClicked() {
+ CSnippet *snippet;
+ QListViewItem *lvi = lvSnippets->selectedItem();
+ if ( (snippet = findSnippetByListViewItem(lvi)) != NULL ) {
+ snippet->setValue(teSnippetText->text() );
+ writeConfig();
+ }
+}
+
+
+/**
+ *
+ */
+void KatePluginSnippetsView::slot_btnDeleteClicked() {
+ CSnippet *snippet;
+ QListViewItem *lvi = lvSnippets->selectedItem();
+
+
+ if ( (snippet = findSnippetByListViewItem(lvi)) != NULL ) {
+ lvSnippets->takeItem(lvi);
+ lSnippets.remove(snippet);
+ }
+}
+
+
+/**
+ *
+ */
+void KatePluginSnippetsView::readConfig() {
+ QString sKey, sValue;
+ QListViewItem *lvi;
+
+ config->setGroup("Snippets");
+
+ int iNrOfSnippets = config->readEntry("NumberOfSnippets", "0").toInt() ;
+ for (int i=0; i < iNrOfSnippets; i++) {
+ QStringList slFields;
+ slFields = config->readListEntry ( QString::number(i) );
+
+ sKey = slFields[0];
+ sValue = slFields[1];
+
+ lvi = insertItem(sKey, false);
+
+ lSnippets.append( new CSnippet(sKey, sValue, lvi, this) );
+ }
+
+ // <defaults>
+ if ( iNrOfSnippets == 0 ) {
+ sKey = "DEBUG variable";
+ sValue = "## < DEBUG >\nout \"<pre>\\$<mark/> : \\\"$<mark/>\\\"\\n</pre>\"\n## </DEBUG >\n";
+ lvi = insertItem(sKey, false);
+ lSnippets.append( new CSnippet(sKey, sValue, lvi, this) );
+
+ sKey = "proc-header";
+ sValue = "## [created : <date/>, <time/>]\n## Description:\n## ============\n## The function \"<mark/>\" ...\n##\n##\n##\n##\n## Input:\n## ======\n##\n##\n##\nproc <mark/> {args} {\n\n ## add your code here\n\n return \"\"\n}\n";
+ lvi = insertItem(sKey, false);
+ lSnippets.append( new CSnippet(sKey, sValue, lvi, this) );
+ }
+ // </defaults>
+
+}
+
+
+/**
+ *
+ */
+void KatePluginSnippetsView::writeConfig() {
+ config->setGroup("Snippets");
+
+ int iNrOfSnippets = lSnippets.count();
+
+ config->writeEntry("NumberOfSnippets", iNrOfSnippets );
+
+ int i=0;
+
+ CSnippet *snippet;
+ for ( snippet = lSnippets.first(); snippet; snippet = lSnippets.next() ) {
+ QStringList slFields;
+ slFields.append( snippet->getKey() );
+ slFields.append( snippet->getValue() );
+
+ config->writeEntry ( QString::number(i), slFields, ',' );
+ i++;
+ }
+ // sync to disc ...
+ config->sync();
+}
+
+
+/**
+ *
+ * @param item
+ * @return
+ */
+CSnippet* KatePluginSnippetsView::findSnippetByListViewItem(QListViewItem *item) {
+ CSnippet *snippet = NULL;
+ for ( snippet = lSnippets.first(); snippet; snippet = lSnippets.next() ) {
+ if ( snippet->getListViewItem() == item)
+ break;
+ }
+ return snippet;
+}
+
+//
+//
+// < IMPLEMENTAIONS for KatePluginSnippets >
+
+#include "plugin_katesnippets.moc"
diff --git a/kate/snippets/plugin_katesnippets.h b/kate/snippets/plugin_katesnippets.h
new file mode 100644
index 0000000..9a940e5
--- /dev/null
+++ b/kate/snippets/plugin_katesnippets.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2004 Stephan M�res <[email protected]>
+ */
+
+#ifndef _PLUGIN_KATESNIPPETS_H_
+#define _PLUGIN_KATESNIPPETS_H_
+
+#include <kate/application.h>
+#include <kate/documentmanager.h>
+#include <kate/document.h>
+#include <kate/mainwindow.h>
+#include <kate/plugin.h>
+#include <kate/view.h>
+#include <kate/viewmanager.h>
+#include <klibloader.h>
+#include <klocale.h>
+
+#include <kate/toolviewmanager.h>
+
+#include <qlistview.h>
+#include <qregexp.h>
+#include <kconfig.h>
+#include <qptrlist.h>
+#include <qtoolbutton.h>
+#include <qtextedit.h>
+#include <kiconloader.h>
+
+#include "csnippet.h"
+#include "cwidgetsnippets.h"
+
+class KatePluginSnippetsView : public CWidgetSnippets, public KXMLGUIClient {
+
+ Q_OBJECT
+
+ friend class KatePluginSnippets;
+
+public:
+ KatePluginSnippetsView (Kate::MainWindow *w, QWidget *dock);
+ virtual ~KatePluginSnippetsView ();
+ CSnippet* findSnippetByListViewItem(QListViewItem *item);
+
+public slots:
+ void slot_lvSnippetsSelectionChanged(QListViewItem * item);
+ void slot_lvSnippetsClicked (QListViewItem * item);
+ void slot_lvSnippetsItemRenamed(QListViewItem *lvi,int col, const QString& text);
+ void slot_btnNewClicked();
+ void slot_btnSaveClicked();
+ void slot_btnDeleteClicked();
+
+protected:
+ void readConfig();
+ void writeConfig();
+
+private:
+ KConfig *config;
+ QPtrList<CSnippet> lSnippets;
+
+public:
+ Kate::MainWindow *win;
+ QWidget *dock;
+};
+
+class KatePluginSnippets : public Kate::Plugin, Kate::PluginViewInterface {
+ Q_OBJECT
+
+public:
+ KatePluginSnippets( QObject* parent = 0, const char* name = 0, const QStringList& = QStringList() );
+ virtual ~KatePluginSnippets();
+
+ void addView (Kate::MainWindow *win);
+ void removeView (Kate::MainWindow *win);
+
+private:
+ QPtrList<class KatePluginSnippetsView> m_views;
+
+};
+
+#endif // _PLUGIN_KATESNIPPETS_H_
diff --git a/kate/snippets/plugin_katesnippets.rc b/kate/snippets/plugin_katesnippets.rc
new file mode 100644
index 0000000..86c92da
--- /dev/null
+++ b/kate/snippets/plugin_katesnippets.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="katesnippets" library="katesnippetsplugin" version="1">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="edit_insert_katesnippets"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="extraToolBar">
+ <Action name="edit_insert_katesnippets"/>
+</ToolBar>
+</kpartplugin>