kate part
Sandy Meier
smeier at kdevelop.org
Tue Dec 18 23:24:01 UTC 2001
On Sunday, 16. December 2001 05:11, you wrote:
> A Kate::Document inherits half a dozen classes that are all virtual
> from KTextEditor, e.g. KTextEditor::Document, KTextEditor::Editor and
> so on. Similar for a Kate::View. These together make up the interface.
> The implementation classes are called KateDocument and KateView, these
> actually do all the work and are the ones created throught the factory.
>
>
> Create the documentation and you will see how this works.
Ok, I understand. Thanks!
But I have a question using the kate part through the KTextEditor interface.
for instance:
// meta
KTrader::OfferList offers = KTrader::self()->query( "KTextEditor/Document" );
KService::Ptr service = *offers.begin();
KLibFactory *factory = KLibLoader::self()->factory( service->library() );
// now a doc
KTextEditor::Document* doc = static_cast<KTextEditor::Document
*>(factory->create( this, 0, "KTextEditor::Document" ) );
The document class contains only 2-3 methods, but no mechanismen to ask the
interfaces which are available (Matthias added some query methods for this in
the old interface) . Should I use RTTI or is there an other approach?
This following one works but maybe the designer (Christoph?) had an other
solution in mind?
KTextEditor::EditInterface* edit = dynamic_cast <KTextEditor::EditInterface*>
(doc);
if(edit !=0){
// ok, edit interface available
}
BTW: the code completion interface isn't implemented at the moment or? If
not, is it possible to add it before KDE3final? Otherwise we will end with a
copy of kate in the KDevelop branch. :-(
Ciao!
Sandy
More information about the KDevelop-devel
mailing list