summaryrefslogtreecommitdiffstats
path: root/kate/htmltools
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/htmltools
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/htmltools')
-rw-r--r--kate/htmltools/Makefile.am21
-rw-r--r--kate/htmltools/katehtmltools.desktop136
-rw-r--r--kate/htmltools/plugin_katehtmltools.cpp161
-rw-r--r--kate/htmltools/plugin_katehtmltools.h53
-rw-r--r--kate/htmltools/ui.rc8
5 files changed, 379 insertions, 0 deletions
diff --git a/kate/htmltools/Makefile.am b/kate/htmltools/Makefile.am
new file mode 100644
index 0000000..73795b7
--- /dev/null
+++ b/kate/htmltools/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = katehtmltoolsplugin.la
+
+# This is all standard. Remove the LIB_KHTML reference if you are not
+# using the KHTML Part
+katehtmltoolsplugin_la_SOURCES = plugin_katehtmltools.cpp
+katehtmltoolsplugin_la_LIBADD = -lkateinterfaces
+katehtmltoolsplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+# Install the .rc file in the Part's directory (in this case, the part
+# is KHTMLPart)
+pluginsdir = $(kde_datadir)/kate/plugins/katehtmltools
+plugins_DATA = ui.rc
+
+kde_services_DATA = katehtmltools.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/katehtmltools.pot
diff --git a/kate/htmltools/katehtmltools.desktop b/kate/htmltools/katehtmltools.desktop
new file mode 100644
index 0000000..ed9b1ec
--- /dev/null
+++ b/kate/htmltools/katehtmltools.desktop
@@ -0,0 +1,136 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katehtmltoolsplugin
+X-Kate-Version=2.5
+Name=Kate HTML Tools
+Name[af]=Kate Html Nutsprogramme
+Name[ar]=أدوات Kate HTML
+Name[az]=Kate HTML Vasitələri
+Name[br]=Ostilhoù Kate HTML
+Name[bs]=Kate HTML alati
+Name[ca]=Eines HTML per a Kate
+Name[cs]=HTML nástroje Kate
+Name[cy]=Offer HTML am Kate
+Name[da]=Kate HTML-værktøjer
+Name[de]=HTML-Dienstprogramme für Kate
+Name[el]=Εργαλεία HTML του Kate
+Name[eo]=HTML-iloj por Kodredaktilo
+Name[es]=Herramientas HTML de Kate
+Name[et]=Kate HTML-tööriistad
+Name[eu]=Kateren HTML tresnak
+Name[fa]=ابزارهای زنگام Kate
+Name[fi]=Kate HTML-työkalut
+Name[fo]=Kate HTML-amboð
+Name[fr]=Outils HTML pour Kate
+Name[fy]=Kate HTML Ark
+Name[ga]=Uirlisí HTML Kate
+Name[gl]=Ferramentas de HTML para Kate
+Name[he]=כלי ה־HTML של Kate
+Name[hi]=के-एटीई एचटीएमएल औज़ार
+Name[hr]=Kate HTML alati
+Name[hu]=Kate HTML-eszközök
+Name[is]=Kate HTML tól
+Name[it]=Strumenti HTML di Kate
+Name[ja]=Kate HTML ツール
+Name[ka]=Kate HTML ხელსაწყოები
+Name[kk]=Kate HTML құралдары
+Name[km]=ឧបករណ៍ Kate HTML
+Name[lt]=Kate HTML įrankiai
+Name[lv]=Kate HTML Rīki
+Name[mk]=HTML-алатки за Кате
+Name[ms]= Alat HTML Kate
+Name[mt]=Għodda HTML Kate
+Name[nb]=HTML-verktøy til Kate
+Name[nds]=HTML-Warktüüch för Kate
+Name[ne]=केट एचटीएमएल उपकरणहरू
+Name[nn]=Kate HTML-verktøy
+Name[nso]=Dibereka tsa HTML ya Kate
+Name[pa]=ਕੇਟ HTML ਸੰਦ
+Name[pl]=Narzędzia HTML do Kate
+Name[pt]=Ferramentas de HTML do Kate
+Name[pt_BR]=Ferramentas HTML do Kate
+Name[ro]=Unelte HTML Kate
+Name[ru]=Утилиты для работы с HTML в Kate
+Name[sk]=HTML nástroje Kate
+Name[sl]=Orodja za HTML Kate
+Name[sr]=HTML алати за Kate
+Name[sr@Latn]=HTML alati za Kate
+Name[sv]=HTML-verktyg för Kate
+Name[ta]=கேட் HTML கருவிகள்
+Name[tg]=Асбобҳо барои кор бо HTML дар Kate
+Name[th]=เครื่องมือ HTML ของ Kate
+Name[tr]=Kate HTML Araçları
+Name[uk]=Засоби HTML для Kate
+Name[uz]=Kate HTML vositalari
+Name[uz@cyrillic]=Kate HTML воситалари
+Name[ven]=Kate HTML Zwishumiswa
+Name[vi]=Công cụ HTML Kate
+Name[xh]=Izixhobo ze Kate HTML
+Name[zh_CN]=Kate HTML 工具
+Name[zh_TW]=Kate HTML 工具組
+Name[zu]=Amathuluzi e Kate HTML.
+Comment=Facilitated insertion of HTML tags
+Comment[af]=Bystand invoeg van Html etiket
+Comment[ar]=ادخال أسهل لعلامات HTML
+Comment[az]=HTML təqlərinin səliqəli əlavəsi
+Comment[bg]=Помощ при вмъкване на тагове и елементи HTML
+Comment[bs]=Primjenjeno ubacivanje HTML tagova
+Comment[ca]=Fàcil inserció d'etiquetes HTML
+Comment[cs]=Usnadněné vkládání HTML značek
+Comment[cy]=Hwyluso mewnosod tagiau HTML
+Comment[da]=Hjælper med indsætning af HTML-koder
+Comment[de]=Vereinfachte Eingabe von HTML-Formatierungen
+Comment[el]=Διευκόλυνση της εισαγωγής HTML tags
+Comment[eo]=Asistita enmeto de HTML-etikedoj
+Comment[es]=Facilita la inserción de etiquetas HTML
+Comment[et]=Hõlpus HTML-siltide lisamine
+Comment[eu]=HTML etiketen txertaketa erraza
+Comment[fa]=درج آسان برچسبهای زنگام
+Comment[fi]=Helpotettu HTML-tagien lisäys
+Comment[fo]=Gevur møguleiki fyri at innseta HTML-merki.
+Comment[fr]=Aide à l'insertion de balises HTML
+Comment[fy]=Maklike ynfoeging fan HTML-tags
+Comment[ga]=Ionsá éascaithe de chlibeanna HTML
+Comment[gl]=Introdución facilitada de marcas de HTML
+Comment[he]=הוספה מובנית של תגיות HTML
+Comment[hi]=एचटीएमएल टैग्स शामिल करने में मदद करता है
+Comment[hr]=Olakšano umetanje HTML oznaka
+Comment[hu]=HTML-tag-ek beszúrása
+Comment[is]=Hjálpar til við að setja HTML merki i texta
+Comment[it]=Inserimento facilitato dei tag HTML
+Comment[ja]=HTML タグ挿入を簡単にします
+Comment[ka]=HTML ჭდეების გამიზნული ჩადგმა
+Comment[kk]=HTML тегтерін енгізуін жеңілдету
+Comment[km]=ការ​បញ្ចូល​ដែល​បាន​​​សម្រួល​របស់​​ស្លាក HTML
+Comment[lt]=Palengvintas HTML tagų įdėjimas
+Comment[lv]=Atvieglota HTML tagu iespraušana
+Comment[mk]=Го олеснува вметнувањето на HTML-ознаки
+Comment[ms]=Memudahkan penyertaan tag HTML
+Comment[mt]=Jiffaċilita l-użu ta' tags HTML
+Comment[nb]=Forenklet innsetting av HTML-tagger
+Comment[nds]=HTML-Betekers eenfacher infögen
+Comment[ne]=एचटीएमएल ट्यागहरूको घुसाई सहजता
+Comment[nl]=Gemakkelijke invoeging van HTML-tags
+Comment[nn]=Enkel innsetjing av HTML-taggar
+Comment[pl]=Uproszczone wstawianie znaczników HTML
+Comment[pt]=Introdução facilitada de marcas de HTML
+Comment[pt_BR]=Inserção de tags HTML facilitada
+Comment[ro]=Facilitează inserarea de taguri HTML
+Comment[ru]=Интеллектуальная вставка тегов HTML
+Comment[sk]=Vkladanie tagov HTML
+Comment[sl]=Pospešeno vstavljanje oznak HTML
+Comment[sr]=Олакшано убацивање HTML ознака
+Comment[sr@Latn]=Olakšano ubacivanje HTML oznaka
+Comment[sv]=Kraftfull infogning av HTML-taggar
+Comment[ta]=HTML கட்டளைகளை இணைக்க உதவும்
+Comment[tg]=Барқарори маънавии тегҳои HTML
+Comment[th]=การแทรกแท็ก HTML ที่แสนสะดวก
+Comment[tr]=Kolaylaştırılmış HTML etiketleri eklenmesi
+Comment[uk]=Форматування тексту мітками HTML
+Comment[ven]=U dzhenisiwa zwo itwaho zwa dzi thege dza HTML
+Comment[vi]=Làm dễ dàng việc chèn thẻ HTML
+Comment[xh]=Ufakelo olulula lwe tags ze HTML
+Comment[zh_CN]=方便地插入 HTML 标签
+Comment[zh_TW]=輔助嵌入 HTML 標籤
+Comment[zu]=Kuqhubekisiwe Ukufakwa kwamathagi e HTML
diff --git a/kate/htmltools/plugin_katehtmltools.cpp b/kate/htmltools/plugin_katehtmltools.cpp
new file mode 100644
index 0000000..f0764f2
--- /dev/null
+++ b/kate/htmltools/plugin_katehtmltools.cpp
@@ -0,0 +1,161 @@
+/***************************************************************************
+ plugin_katehtmltools.cpp - description
+ -------------------
+ begin : FRE Feb 23 2001
+ copyright : (C) 2001 by Joseph Wenninger
+ email : jowenn@bigfoot.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 "plugin_katehtmltools.h"
+#include "plugin_katehtmltools.moc"
+
+#include <klineeditdlg.h>
+#include <kaction.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <cassert>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+
+K_EXPORT_COMPONENT_FACTORY( katehtmltoolsplugin, KGenericFactory<PluginKateHtmlTools>( "katehtmltools" ) )
+
+class PluginView : public KXMLGUIClient
+{
+ friend class PluginKateHtmlTools;
+
+ public:
+ Kate::MainWindow *win;
+};
+
+PluginKateHtmlTools::PluginKateHtmlTools( QObject* parent, const char* name, const QStringList& )
+ : Kate::Plugin ( (Kate::Application *)parent, name )
+{
+}
+
+PluginKateHtmlTools::~PluginKateHtmlTools()
+{
+}
+
+void PluginKateHtmlTools::addView(Kate::MainWindow *win)
+{
+ // TODO: doesn't this have to be deleted?
+ PluginView *view = new PluginView ();
+
+ (void) new KAction ( i18n("HT&ML Tag..."), /*"edit_HTML_tag",*/ ALT + Key_Minus, this,
+ SLOT( slotEditHTMLtag() ), view->actionCollection(), "edit_HTML_tag" );
+
+ view->setInstance (new KInstance("kate"));
+ view->setXMLFile( "plugins/katehtmltools/ui.rc" );
+ win->guiFactory()->addClient (view);
+ view->win = win;
+
+ m_views.append (view);
+}
+
+void PluginKateHtmlTools::removeView(Kate::MainWindow *win)
+{
+ for (uint z=0; z < m_views.count(); z++)
+ if (m_views.at(z)->win == win)
+ {
+ PluginView *view = m_views.at(z);
+ m_views.remove (view);
+ win->guiFactory()->removeClient (view);
+ delete view;
+ }
+}
+
+void PluginKateHtmlTools::slotEditHTMLtag()
+// PCP
+{
+ if (!application()->activeMainWindow())
+ return;
+
+ Kate::View *kv=application()->activeMainWindow()->viewManager()->activeView();
+ if (!kv) return;
+
+ QString text ( KatePrompt ( i18n("HTML Tag"),
+ i18n("Enter HTML tag contents (the <, >, and closing tag will be supplied):"),
+ (QWidget *)kv)
+ );
+
+ if ( !text.isEmpty () )
+ slipInHTMLtag (*kv, text); // user entered something and pressed ok
+
+}
+
+
+QString PluginKateHtmlTools::KatePrompt
+ (
+ const QString & strTitle,
+ const QString & strPrompt,
+ QWidget * that
+ )
+{
+ // TODO: Make this a "memory edit" field with a combo box
+ // containing prior entries
+
+ KLineEditDlg dlg(strPrompt, QString::null, that);
+ dlg.setCaption(strTitle);
+
+ if (dlg.exec())
+ return dlg.text();
+ else
+ return "";
+}
+
+
+void PluginKateHtmlTools::slipInHTMLtag (Kate::View & view, QString text) // PCP
+{
+
+ // We must add a heavy elaborate HTML markup system. Not!
+
+ QStringList list = QStringList::split (' ', text);
+ QString marked = view.getDoc()->selection ();
+ uint preDeleteLine = 0, preDeleteCol = 0;
+ view.cursorPosition (&preDeleteLine, &preDeleteCol);
+
+ if (marked.length() > 0)
+ view.keyDelete ();
+ uint line = 0, col = 0;
+ view.cursorPosition (&line, &col);
+ QString pre ("<" + text + ">");
+ QString post;
+ if (list.count () > 0) post = "</" + list[0] + ">";
+ view.insertText (pre + marked + post);
+
+ // all this muck to leave the cursor exactly where the user
+ // put it...
+
+ // Someday we will can all this (unless if it already
+ // is canned and I didn't find it...)
+
+ // The second part of the if disrespects the display bugs
+ // when we try to reselect. TODO: fix those bugs, and we can
+ // un-break this if...
+
+ if (preDeleteLine == line && -1 == marked.find ('\n'))
+ if (preDeleteLine == line && preDeleteCol == col)
+ {
+ view.setCursorPosition (line, col + pre.length () + marked.length () - 1);
+
+ for (int x (marked.length()); x--;)
+ view.shiftCursorLeft ();
+ }
+ else
+ {
+ view.setCursorPosition (line, col += pre.length ());
+
+ for (int x (marked.length()); x--;)
+ view.shiftCursorRight ();
+ }
+
+}
diff --git a/kate/htmltools/plugin_katehtmltools.h b/kate/htmltools/plugin_katehtmltools.h
new file mode 100644
index 0000000..8f134ce
--- /dev/null
+++ b/kate/htmltools/plugin_katehtmltools.h
@@ -0,0 +1,53 @@
+ /***************************************************************************
+ plugin_katehtmltools.h - description
+ -------------------
+ begin : FRE Feb 23 2001
+ copyright : (C) 2001 by Joseph Wenninger
+ email : jowenn@bigfoot.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 _PLUGIN_KANT_HTMLTOOLS_H
+#define _PLUGIN_KANT_HTMLTOOLS_H
+
+#include <qstring.h>
+
+#include <kate/plugin.h>
+#include <kate/application.h>
+#include <kate/view.h>
+#include <kate/document.h>
+#include <kate/documentmanager.h>
+#include <kate/mainwindow.h>
+#include <kate/viewmanager.h>
+
+class PluginKateHtmlTools : public Kate::Plugin, Kate::PluginViewInterface
+{
+ Q_OBJECT
+
+public:
+ PluginKateHtmlTools( QObject* parent = 0, const char* name = 0, const QStringList& = QStringList() );
+ virtual ~PluginKateHtmlTools();
+
+ void addView (Kate::MainWindow *win);
+ void removeView (Kate::MainWindow *win);
+
+private:
+ QPtrList<class PluginView> m_views;
+
+ QString KatePrompt (const QString & strTitle, const QString &strPrompt,
+ QWidget * that);
+ void slipInHTMLtag (Kate::View & view, QString text);
+
+public slots:
+ void slotEditHTMLtag();
+};
+
+#endif // _PLUGIN_KANT_HTMLTOOLS_H
diff --git a/kate/htmltools/ui.rc b/kate/htmltools/ui.rc
new file mode 100644
index 0000000..885f00e
--- /dev/null
+++ b/kate/htmltools/ui.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="katehtmltools" library="libkatehtmltoolsplugin" version="3">
+<MenuBar>
+ <Menu name="tools"><text>&amp;Tools</text>
+ <Action name="edit_HTML_tag" />
+ </Menu>
+</MenuBar>
+</kpartplugin>