[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ktexteditor-devel
Subject:    Re: hide/replace some ktexteditor features
From:       Hamish Rodda <rodda () kde ! org>
Date:       2005-10-05 12:16:01
Message-ID: 200510052216.03479.rodda () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hi,

On Wednesday 05 October 2005 03:17, Flavio Castelli wrote:
> I needed some text-editor features in my app so I used KTexteditor.
> The only problem is that I need to save my files in a different way
> compared to kate's one.
>
> So I created in my class a slotSave() method with my own code, and in the
> constructor I create its KStdAction:
>
> KStdAction::save( this, SLOT( slotSave() ), actionCollection(),
> "file_save" )->setWhatsThis(i18n("Use this command to save a document"));
>
> Now when I start the app I've two entries of "Save", the first inherits my
> code, the second kate's one.
>
> Here's my .rc file:
>
> <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
> <kpartgui name="sample" version="1">
> <MenuBar>
> <Menu name="file" noMerge="0"><Text>&amp;File</Text>
> 	<Merge/>
> </Menu>
> <Merge/>
> </MenuBar>
> </kpartgui>
>
> As suggested on #kate irc channel I tried to tell the actionCollection() to
> remove kate's save action.
>
> But using this code (at the end of my constructor):
>
> unsigned int actions = actionCollection()->count();
>
> for (unsigned int i =0 ; i < actions; i++)
> {
> 	KAction * action = actionCollection()->action(i);
> 	printf ("action number %i, text = %s\n",i,(action->text()).ascii());
> }
>
> I see only one "save" action, mine...

I think (and i haven't tested this but) the save action that you want to 
remove is in the actionCollection() of your document, not your app.  try 
iterating the actionCollection() of your KTextEditor::Document.

Hopefully someone has a better way than this though ;)

Cheers,
Hamish.

[Attachment #5 (application/pgp-signature)]

_______________________________________________
Ktexteditor-devel mailing list
Ktexteditor-devel@kde.org
https://mail.kde.org/mailman/listinfo/ktexteditor-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic