From kde-devel Wed May 29 20:42:09 2013 From: Milian Wolff Date: Wed, 29 May 2013 20:42:09 +0000 To: kde-devel Subject: Re: Interacting with KatePart from code Message-Id: <2407505.TDoBbpL4yx () minime> X-MARC-Message: https://marc.info/?l=kde-devel&m=136986015614157 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============3536052797102815666==" --===============3536052797102815666== Content-Type: multipart/signed; boundary="nextPart1870536.VszUc1l5mL"; micalg="pgp-sha1"; protocol="application/pgp-signature" --nextPart1870536.VszUc1l5mL Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Wednesday 29 May 2013 21:38:03 Adri=C3=A1n Chaves Fern=C3=A1ndez wro= te: > Hi, >=20 > I want to start an application with a text editor that provides a spe= cific > syntax highlighting, as the application is only going to support a sp= ecific > type of files (MediaWiki). Then I plan to build some features > (auto-complete, etc.) on top of it. >=20 > Not to reinvent the wheel, I wanted to reuse Kate=E2=80=99s text edit= ion widget. > I=E2=80=99ve actually been working on improving the MediaWiki syntax = highlighting > support in Kate, so reusing that work for my app would be ideal. >=20 > So I found myself copying and pasting the code in > http://techbase.kde.org/Development/Tutorials/Using_KParts >=20 > Now I have a working KatePart. But I have no idea whatsoever about > interacting with it from code (such as getting an instance of > KateDocument). Any recommendation that puts me in the right direction= to > set the KatePart syntax highlighting from code? Look at KTextEditor and its apidox. If in doubt grep for it in KDevplat= form to=20 see how its being used. > Also, I want to manually define the context-menu items and any other = actions > in the interface, so I=E2=80=99m not calling createGUI(m_part). Most = KatePart > actions I don=E2=80=99t want to provide, so is KatePart the right cho= ice for me > nonetheless? Or is there another way (without kparts) of reusing Kate= =E2=80=99s > text edition widget that fits my use case better? You can use KTextEditor::Editor::createDocument (e.g. from=20 KTextEditor::Factory) and then create a view for that document. Regardi= ng=20 filtering of context menu items, I'm not sure anymore whether there is=20= anything being added automatically. If so and you cannot find a way to=20= circumvent that, feel free to contact us on kwrite-devel and we'll find= a way=20 to solve this. Cheers --=20 Milian Wolff mail@milianw.de http://milianw.de --nextPart1870536.VszUc1l5mL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iEYEABECAAYFAlGmaCMACgkQDA6yEs0dE5Nc9gCfSfkYMxI3AnDJmvcrySwwcSXe owMAoJZU6gCngkBay1oECqw1Gfj2OZIb =EnLq -----END PGP SIGNATURE----- --nextPart1870536.VszUc1l5mL-- --===============3536052797102815666== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============3536052797102815666==--