Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Writing plugins for Kate and enhancing Kate

3,581 views

Published on

My 1st presentation Presentation at Foss.in 2010 on Writing plugins for Kate and enhancing Kate.

Published in: Technology
  • Be the first to comment

Writing plugins for Kate and enhancing Kate

  1. 1. Writing Kate plugins and enhancing Kate
  2. 2. About me <ul><li>Abhishek Patil (http://thezeroth.net)
  3. 3. Software Engineer
  4. 4. Vcreate Logic Pvt. Ltd (http://vcreatelogic.com)
  5. 5. @abhishekworld </li></ul>
  6. 6. Why me? <ul><li>A Qt/KDE developer
  7. 7. Mainly contributes to Kate
  8. 8. Tabify Plugin for kate (KDE 4.5)
  9. 9. And other features from kate's wishlist (KDE 4.5) </li></ul>
  10. 10. Aim of this talk! <ul><li>Understand how kate plugins are written
  11. 11. Create Tabify Plugin </li></ul>
  12. 12. Kate Application base <ul><li>Plugin Architecture
  13. 13. Based on KParts </li></ul>
  14. 14. Important classes in KATE <ul><li>Kate::Application
  15. 15. Kate::MainWindow
  16. 16. Kate::DocumentManager
  17. 17. Kate::PluginManager
  18. 18. Kate::Plugin
  19. 19. Kate::PluginView
  20. 20. Kate::PluginConfigPageInterface </li></ul>
  21. 21. Bacis of Kate Plugin <ul><li>3 Important Files in Kate Plugin </li><ul><li>A desktop file with some information about the plugin
  22. 22. An XmlGui rc file named ui.rc
  23. 23. A library containing the plugin </li></ul></ul>
  24. 24. Desktop File [Desktop Entry] Encoding=UTF-8 X-Kate-Version=2.8 X-KDE-Library=katetabifyplugin ServiceTypes=Kate/Plugin Type=Service Icon=korganizer Name=Tabify X-Kate-MajorProfiles=Kate X-Kate-MinorProfiles=* Name of the files has to be in kate” yourpluginname”.desktop format. katetabify.desktop IMPORTANT
  25. 25. XmlGUI file <!DOCTYPE kpartgui> <gui name=&quot;tabifyplugin&quot; library=&quot;katetabifyplugin&quot; version=&quot;1&quot;> <ToolBar> <text>Tabify Plugin</text> <Action name=&quot;tabbar_widget&quot;/> </ToolBar> </gui> The name of this file has to be ui.rc
  26. 26. <ul><ul><li>The Library </li></ul></ul>class MyPlugin : public Kate::Plugin { Q_OBJECT public: // other methods etc... PluginView *createView(MainWindow *mainWindow) { return new MyPluginView(mainWindow); } };
  27. 27. <ul><ul><li>… </li></ul></ul>class MyPluginView : public Kate::PluginView { Q_OBJECT public: MyPluginView(MainWindow *mainWindow); // possibilities of gui: // - hook into the menus with KXMLGUIClient // - create a toolView and put a widget into it // with MainWindow::createToolView() };
  28. 28. Code http://websvn.kde.org/trunk/KDE/kdesdk/kate/plugins/tabify/
  29. 29. Compile your plugin CMakeList.txt find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories(${KDE4_INCLUDES}) kde4_add_plugin(katetabifyplugin tabify.cpp) target_link_libraries(katetabifyplugin ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} kateinterfaces) install(TARGETS katetabifyplugin DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES ui.rc DESTINATION ${DATA_INSTALL_DIR}/kate/plugins/katetabify) install(FILES katetabifyplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
  30. 30. Referances <ul><li>http://api.kde.org/4.x-api/kdesdk-apidocs/kate/interfaces/kate/html/index.html
  31. 31. http://kate-editor.org/2004/01/06/writing-a-kate-plugin/
  32. 32. http://kate-editor.org/featured-articles/ </li></ul>
  33. 33. Thank You.... Questions??? [email_address] @abhishekworld http://thezeroth.net

×