From 84da08d7b7fcda12c85caeb5a10b4903770a6f69 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kate/helloworld/Makefile.am | 18 +++++ kate/helloworld/katehelloworld.desktop | 119 ++++++++++++++++++++++++++++++ kate/helloworld/plugin_katehelloworld.cpp | 66 +++++++++++++++++ kate/helloworld/plugin_katehelloworld.h | 30 ++++++++ kate/helloworld/ui.rc | 8 ++ 5 files changed, 241 insertions(+) create mode 100644 kate/helloworld/Makefile.am create mode 100644 kate/helloworld/katehelloworld.desktop create mode 100644 kate/helloworld/plugin_katehelloworld.cpp create mode 100644 kate/helloworld/plugin_katehelloworld.h create mode 100644 kate/helloworld/ui.rc (limited to 'kate/helloworld') diff --git a/kate/helloworld/Makefile.am b/kate/helloworld/Makefile.am new file mode 100644 index 0000000..b3fca29 --- /dev/null +++ b/kate/helloworld/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = katehelloworldplugin.la + +katehelloworldplugin_la_SOURCES = plugin_katehelloworld.cpp +katehelloworldplugin_la_LIBADD = -lkateinterfaces +katehelloworldplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/kate/plugins/katehelloworld +plugins_DATA = ui.rc + +kde_services_DATA = katehelloworld.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/katehelloworld.pot + diff --git a/kate/helloworld/katehelloworld.desktop b/kate/helloworld/katehelloworld.desktop new file mode 100644 index 0000000..e8d2bf7 --- /dev/null +++ b/kate/helloworld/katehelloworld.desktop @@ -0,0 +1,119 @@ +[Desktop Entry] +Type=Service +ServiceTypes=Kate/Plugin +X-KDE-Library=katehelloworldplugin +X-Kate-Version=2.5 +Name=My First Kate Plugin +Name[br]=Ma lugent Kate kentañ +Name[ca]=El meu primer connector per a Kate +Name[cs]=Můj první modul pro Kate +Name[cy]=F'ategyn cyntaf Kate +Name[da]=Mit første Kate-plugin +Name[de]=Mein erstes Kate-Modul +Name[el]=Το πρώτο μου πρόσθετο για το Kate +Name[eo]=Mia unua kromaĵo por Kodredaktilo +Name[es]=Mi primer complemento de Kate +Name[et]=Kate näidisplugin +Name[eu]=Nire lehen Kate plugina +Name[fa]=اولین وصلۀ Kate من +Name[fi]=Minun ensimmäinen Kate-sovelma +Name[fr]=Mon premier module Kate +Name[fy]=Myn earste Kate-plugin +Name[ga]=Mo Chéad Bhreiseán Kate +Name[gl]=O Meu Primeiro plugin para Kate +Name[he]=התוסף הראשון שלי ל־Kate +Name[hr]=Moj prvi dodatak za Kate +Name[hu]=Az első Kate-bővítőmodulom +Name[is]=Fyrsta Kate viðbótin mín +Name[it]=Il mio primo plugin di Kate +Name[ja]=はじめての Kate プラグイン +Name[ka]=ჩემი პირველი Kate მოდული +Name[kk]=Менің алғашқы Kate плагин модулім +Name[km]=កម្មវិធី​ជំនួយ​របស់ Kate ដំបូង​របស់​ខ្ញុំ +Name[lt]=Mano pirmas Kate priedas +Name[mk]=Мојот прв приклучок за Кате +Name[ms]=Plugin Kate Pertama Saya +Name[nb]=Mitt første programtillegg til Kate +Name[nds]=Mien eerst Kate-Moduul +Name[ne]=मेरो पहिलो केट प्लगइन +Name[nl]=Mijn eerste Kate-plugin +Name[nn]=Mitt første programtillegg til Kate +Name[pa]=ਮੇਰੀ ਪਹਿਲੀ ਕੇਟ ਪਲੱਗਇਨ +Name[pl]=Moja pierwsza wtyczka do Kate +Name[pt]=O Meu Primeiro 'Plugin' para o Kate +Name[pt_BR]=Meu Primeiro Plugin para o Kate +Name[ru]=Простой модуль для Kate +Name[sk]=Môj prvý modul pre Kate +Name[sl]=Moj prvi vstavek za Kate +Name[sr]=Мој први прикључак за Kate +Name[sr@Latn]=Moj prvi priključak za Kate +Name[sv]=Mitt första insticksprogram för Kate +Name[ta]=என் முதல் கேட் சொருகுப்பொருள் +Name[tr]=İlk Kate Eklentim +Name[uk]=Мій перший втулок до Kate +Name[vi]=Bổ sung Kate đầu tiên của tôi +Name[zh_CN]=我的第一个 Kate 插件 +Name[zh_TW]=我的第一個 Kate 的外掛程式 +Comment=Your short description about the plugin goes here +Comment[af]=Jou kort beskrywing aangaande die inplak gaan hier +Comment[ar]=اكتب وصف قصير عن هذا الملحق هنا +Comment[az]=Əlavə haqqında qisaca izahat burada yer almalıdır +Comment[bg]=Описание на вашата първа приставка за Kate +Comment[bs]=Ovdje treba biti vaše malo objašnjenje o dodatku +Comment[ca]=La vostra descripció referent al connector va aquí +Comment[cs]=Zde by měl být krátký popis modulu +Comment[cy]=Mae eich disgrifiad byr am yr ategyn yn mynd yma +Comment[da]=Her er plads til din korte beskrivelse af hvad dette plugin gør +Comment[de]=Hier sollte eine kurze Beschreibung Ihres Moduls stehen +Comment[el]=Η σύντομη περιγραφή του προσθέτου σας πηγαίνει εδώ +Comment[eo]=Jen estu la mallonga priskribo pri la kromaĵo +Comment[es]=Aquí deberá incluir una breve descripción de su complemento +Comment[et]=Näidisplugina lühikirjeldus +Comment[eu]=Hemen duzu pluginari buruzko deskribapen laburra +Comment[fa]=توصیف کوتاه شما دربارۀ وصله‌ای که در اینجا می‌آید +Comment[fi]=Tässä pitäisi olla pieni kuvaus sovelmasta +Comment[fo]=Her kann tú skriva ein lýsing av ístingurin. +Comment[fr]=La description brève de votre module se place ici +Comment[fy]=Set hjir in lytse omskriuwing fan jo plugin +Comment[ga]=Cuir do chur síos gearr ar an mbreiseán anseo +Comment[gl]=Aqui deberá colocar unha descrición do plugin +Comment[he]=כאן אמור להיות התיאור הקצר שלך אודות התוסף +Comment[hi]=प्लगइन के बारे में आपका संक्षिप्त वर्णन यहाँ जाएगा +Comment[hr]=Mjesto za kratak opis vašeg dodatka +Comment[hu]=Ez a bővítőmodul leírása +Comment[is]=Hér ætti að vera smá lýsing á viðbótinni +Comment[it]=Inserisci qui la descrizione del tuo plugin +Comment[ja]=プラグインの簡単な説明をここに書きます +Comment[ka]=მოდულის მოკლე აღწერა იქნება აქ +Comment[kk]=Бұл плагин модульдің қысқаша сипаттамасының орны +Comment[km]=សេចក្ដី​អធិប្បាយ​ដ៏​​​ខ្លី​របស់​អ្នក​អំពី​កម្មវិធី​ជំនួយ​ទៅ​ទីនេះ +Comment[lt]=Čia turėtų būti trumpas priedo aprašymas +Comment[mk]=Тука доаѓа вашиот краток опис за приклучокот +Comment[ms]=Huraian ringkas anda tentang plugin anda di sini +Comment[nb]=Her skriver du en kort beskrivelse av programtillegget +Comment[nds]=Dien korte Beschrieven vun Dien Moduul kummt hierhen +Comment[ne]=प्लगइनका बारेको तपाईँको छोटो वर्णन यहाँ जान्छ +Comment[nl]=Plaats hier een kleine omschrijving van uw plugin +Comment[nn]=Her skildrar du kort programtillegget +Comment[nso]=Thlaloso ya gago ye kopana kaga plugin e tsamaya mo +Comment[pl]=Tu powinien być Twój krótki opis wtyczki +Comment[pt]=Aqui deverá colocar uma descrição do 'plugin' +Comment[pt_BR]=Uma pequena descrição maior sobre o que um plugin faz +Comment[ro]=Aici trebuie să fie descrierea modulului dumneavoastră +Comment[ru]=А здесь должно быть описание модуля +Comment[sk]=Tu by mal byť popis o module +Comment[sl]=Vaš kratek opis o vstavku je tukaj +Comment[sr]=Ваш кратак опис прикључка иде овде +Comment[sr@Latn]=Vaš kratak opis priključka ide ovde +Comment[sv]=Kort beskrivning av vad insticksprogrammet gör +Comment[ta]= உங்கள் சொருகு பொருளைப் பற்றிய சிறு விவரிப்பு இங்கே போகும் +Comment[tg]=Дар инҷо бояд тасвири модул бошад +Comment[th]=นี่เป็นรายละเอียดสั้น ๆ เกี่ยวกับปลั๊กอินที่ควรมี +Comment[tr]=Eklentinizin küçük bir açıklamasını buraya yazın +Comment[uk]=Тут повинен бути ваш короткий опис втулку +Comment[uz]=Plagin haqida qisqacha maʼlumot +Comment[uz@cyrillic]=Плагин ҳақида қисқача маълумот +Comment[vi]=Mô tả ngắn về bổ sung nằm ở đây +Comment[xh]=Inkcazelo yakho emfutshane malunga ne plagi yangaphakathi ihamba apha +Comment[zh_CN]=这里应该提供插件的简短描述 +Comment[zh_TW]=您對於這個外掛程式的一些描述放在這裡 diff --git a/kate/helloworld/plugin_katehelloworld.cpp b/kate/helloworld/plugin_katehelloworld.cpp new file mode 100644 index 0000000..7499c08 --- /dev/null +++ b/kate/helloworld/plugin_katehelloworld.cpp @@ -0,0 +1,66 @@ + +#include "plugin_katehelloworld.h" +#include "plugin_katehelloworld.moc" + +#include +#include +#include + +K_EXPORT_COMPONENT_FACTORY( katehelloworldplugin, KGenericFactory( "katehelloworld" ) ) + +class PluginView : public KXMLGUIClient +{ + friend class KatePluginHelloWorld; + + public: + Kate::MainWindow *win; +}; + +KatePluginHelloWorld::KatePluginHelloWorld( QObject* parent, const char* name, const QStringList& ) + : Kate::Plugin ( (Kate::Application*)parent, name ) +{ +} + +KatePluginHelloWorld::~KatePluginHelloWorld() +{ +} + +void KatePluginHelloWorld::addView(Kate::MainWindow *win) +{ + // TODO: doesn't this have to be deleted? + PluginView *view = new PluginView (); + + (void) new KAction ( i18n("Insert Hello World"), 0, this, + SLOT( slotInsertHello() ), view->actionCollection(), + "edit_insert_helloworld" ); + + view->setInstance (new KInstance("kate")); + view->setXMLFile("plugins/katehelloworld/ui.rc"); + win->guiFactory()->addClient (view); + view->win = win; + + m_views.append (view); +} + +void KatePluginHelloWorld::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 KatePluginHelloWorld::slotInsertHello() +{ + if (!application()->activeMainWindow()) + return; + + Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView(); + + if (kv) + kv->insertText ("Hello World"); +} diff --git a/kate/helloworld/plugin_katehelloworld.h b/kate/helloworld/plugin_katehelloworld.h new file mode 100644 index 0000000..84b3e86 --- /dev/null +++ b/kate/helloworld/plugin_katehelloworld.h @@ -0,0 +1,30 @@ +#ifndef _PLUGIN_KATE_HELLOWORLD_H_ +#define _PLUGIN_KATE_HELLOWORLD_H_ + +#include +#include +#include +#include +#include +#include +#include + +class KatePluginHelloWorld : public Kate::Plugin, Kate::PluginViewInterface +{ + Q_OBJECT + + public: + KatePluginHelloWorld( QObject* parent = 0, const char* name = 0, const QStringList& = QStringList() ); + virtual ~KatePluginHelloWorld(); + + void addView (Kate::MainWindow *win); + void removeView (Kate::MainWindow *win); + + public slots: + void slotInsertHello(); + + private: + QPtrList m_views; +}; + +#endif diff --git a/kate/helloworld/ui.rc b/kate/helloworld/ui.rc new file mode 100644 index 0000000..36b11a0 --- /dev/null +++ b/kate/helloworld/ui.rc @@ -0,0 +1,8 @@ + + + + &Tools + + + + -- cgit v1.2.1