1 /* This file is part of the KDE libraries
2 Copyright (C) 2001 Simon Hausmann <hausmann@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "kxmlguifactory_p.h"
21 #include "kxmlguiclient.h"
22 #include "kxmlguibuilder.h"
24 #include <QtGui/QWidget>
30 #include <kcomponentdata.h>
32 using namespace KXMLGUI
;
34 void ActionList::plug( QWidget
*container
, int index
) const
36 QAction
* before
= 0L; // Insert after end of widget's current actions (default).
38 if ((index
< 0) || (index
> container
->actions().count()))
39 kWarning() << "Index " << index
<< " is not within range (0 - " << container
->actions().count();
40 else if (index
!= container
->actions().count())
41 before
= container
->actions().at(index
); // Insert before indexed action.
43 foreach (QAction
* action
, *this) {
44 container
->insertAction(before
, action
);
45 // before = action; // BUG FIX: do not insert actions in reverse order.
49 void ActionList::unplug( QWidget
*container
) const
51 foreach (QAction
* action
, *this) {
52 if (container
->actions().contains(action
))
53 container
->removeAction( action
);
57 ContainerNode::ContainerNode( QWidget
*_container
, const QString
&_tagName
,
58 const QString
&_name
, ContainerNode
*_parent
,
59 KXMLGUIClient
*_client
, KXMLGUIBuilder
*_builder
,
60 QAction
* _containerAction
, const QString
&_mergingName
,
61 const QString
&_groupName
, const QStringList
&customTags
,
62 const QStringList
&containerTags
)
63 : parent( _parent
), client( _client
), builder( _builder
),
64 builderCustomTags( customTags
), builderContainerTags( containerTags
),
65 container( _container
), containerAction( _containerAction
), tagName( _tagName
), name( _name
),
66 groupName( _groupName
), index( 0 ), mergingName( _mergingName
)
69 parent
->children
.append( this );
72 ContainerNode::~ContainerNode()
78 void ContainerNode::removeChild( ContainerNode
* child
)
80 MergingIndexList::Iterator mergingIt
= findIndex( child
->mergingName
);
81 adjustMergingIndices( -1, mergingIt
);
82 children
.removeAll(child
);
86 void ContainerNode::removeChild( QMutableListIterator
<ContainerNode
*>& childIterator
)
88 MergingIndexList::Iterator mergingIt
= findIndex( childIterator
.peekNext()->mergingName
);
89 adjustMergingIndices( -1, mergingIt
);
90 delete childIterator
.next();
91 childIterator
.remove();
95 * Find a merging index with the given name. Used to find an index defined by <Merge name="blah"/>
96 * or by a <DefineGroup name="foo" /> tag.
98 MergingIndexList::Iterator
ContainerNode::findIndex( const QString
&name
)
100 MergingIndexList::Iterator
it( mergingIndices
.begin() );
101 MergingIndexList::Iterator
end( mergingIndices
.end() );
102 for (; it
!= end
; ++it
)
103 if ( (*it
).mergingName
== name
)
109 * Check if the given container widget is a child of this node and return the node structure
112 ContainerNode
*ContainerNode::findContainerNode( QWidget
*container
)
114 foreach (ContainerNode
* child
, children
)
115 if ( child
->container
== container
)
122 * Find a container recursively with the given name. Either compares _name with the
123 * container's tag name or the value of the container's name attribute. Specified by
126 ContainerNode
*ContainerNode::findContainer( const QString
&_name
, bool tag
)
128 if ( ( tag
&& tagName
== _name
) ||
129 ( !tag
&& name
== _name
) )
132 foreach (ContainerNode
* child
, children
)
134 ContainerNode
*res
= child
->findContainer( _name
, tag
);
143 * Finds a child container node (not recursively) with the given name and tagname. Explicitly
144 * leaves out container widgets specified in the exludeList . Also ensures that the containers
145 * belongs to currClient.
147 ContainerNode
*ContainerNode::findContainer( const QString
&name
, const QString
&tagName
,
148 const QList
<QWidget
*> *excludeList
,
149 KXMLGUIClient
* /*currClient*/ )
151 ContainerNode
*res
= 0L;
152 ContainerNodeList::ConstIterator nIt
= children
.constBegin();
154 if ( !name
.isEmpty() )
156 for (; nIt
!= children
.constEnd(); ++nIt
)
157 if ( (*nIt
)->name
== name
&&
158 !excludeList
->contains( (*nIt
)->container
) )
167 if ( !tagName
.isEmpty() )
168 for (; nIt
!= children
.constEnd(); ++nIt
)
170 if ( (*nIt
)->tagName
== tagName
&&
171 !excludeList
->contains( (*nIt
)->container
)
173 * It is a bad idea to also compare the client, because
174 * we don't want to do so in situations like these:
185 && (*nIt)->client == currClient )
197 ContainerClient
*ContainerNode::findChildContainerClient( KXMLGUIClient
*currentGUIClient
,
198 const QString
&groupName
,
199 const MergingIndexList::Iterator
&mergingIdx
)
201 if ( !clients
.isEmpty() )
203 foreach (ContainerClient
* client
, clients
)
204 if ( client
->client
== currentGUIClient
)
206 if ( groupName
.isEmpty() )
209 if ( groupName
== client
->groupName
)
214 ContainerClient
*client
= new ContainerClient
;
215 client
->client
= currentGUIClient
;
216 client
->groupName
= groupName
;
218 if ( mergingIdx
!= mergingIndices
.end() )
219 client
->mergingName
= (*mergingIdx
).mergingName
;
221 clients
.append( client
);
226 void ContainerNode::plugActionList( BuildState
&state
)
228 MergingIndexList::Iterator
mIt( mergingIndices
.begin() );
229 MergingIndexList::Iterator
mEnd( mergingIndices
.end() );
230 for (; mIt
!= mEnd
; ++mIt
)
231 plugActionList( state
, mIt
);
233 foreach (ContainerNode
* child
, children
)
234 child
->plugActionList( state
);
237 void ContainerNode::plugActionList( BuildState
&state
, const MergingIndexList::Iterator
&mergingIdxIt
)
239 static const QString
&tagActionList
= KGlobal::staticQString( "actionlist" );
241 MergingIndex mergingIdx
= *mergingIdxIt
;
243 QString
k( mergingIdx
.mergingName
);
245 if ( k
.indexOf( tagActionList
) == -1 )
248 k
= k
.mid( tagActionList
.length() );
250 if ( mergingIdx
.clientName
!= state
.clientName
)
253 if ( k
!= state
.actionListName
)
256 ContainerClient
*client
= findChildContainerClient( state
.guiClient
,
258 mergingIndices
.end() );
260 client
->actionLists
.insert( k
, state
.actionList
);
262 state
.actionList
.plug( container
, mergingIdx
.value
);
264 adjustMergingIndices( state
.actionList
.count(), mergingIdxIt
);
267 void ContainerNode::unplugActionList( BuildState
&state
)
269 MergingIndexList::Iterator
mIt( mergingIndices
.begin() );
270 MergingIndexList::Iterator
mEnd( mergingIndices
.end() );
271 for (; mIt
!= mEnd
; ++mIt
)
272 unplugActionList( state
, mIt
);
274 foreach (ContainerNode
* child
, children
)
275 child
->unplugActionList( state
);
278 void ContainerNode::unplugActionList( BuildState
&state
, const MergingIndexList::Iterator
&mergingIdxIt
)
280 static const QString
&tagActionList
= KGlobal::staticQString( "actionlist" );
282 MergingIndex mergingIdx
= *mergingIdxIt
;
284 QString k
= mergingIdx
.mergingName
;
286 if ( k
.indexOf( tagActionList
) == -1 )
289 k
= k
.mid( tagActionList
.length() );
291 if ( mergingIdx
.clientName
!= state
.clientName
)
294 if ( k
!= state
.actionListName
)
297 ContainerClient
*client
= findChildContainerClient( state
.guiClient
,
299 mergingIndices
.end() );
301 ActionListMap::Iterator
lIt( client
->actionLists
.find( k
) );
302 if ( lIt
== client
->actionLists
.end() )
305 lIt
.value().unplug( container
);
307 adjustMergingIndices( -int(lIt
.value().count()), mergingIdxIt
);
309 client
->actionLists
.erase( lIt
);
312 void ContainerNode::adjustMergingIndices( int offset
,
313 const MergingIndexList::Iterator
&it
)
315 MergingIndexList::Iterator mergingIt
= it
;
316 MergingIndexList::Iterator mergingEnd
= mergingIndices
.end();
318 for (; mergingIt
!= mergingEnd
; ++mergingIt
)
319 (*mergingIt
).value
+= offset
;
324 bool ContainerNode::destruct( QDomElement element
, BuildState
&state
) //krazy:exclude=passbyvalue (this is correct QDom usage, and a ref wouldn't allow passing doc.documentElement() as argument)
326 destructChildren( element
, state
);
328 unplugActions( state
);
330 // remove all merging indices the client defined
331 QMutableListIterator
<MergingIndex
> cmIt
= mergingIndices
;
332 while ( cmIt
.hasNext() )
333 if ( cmIt
.next().clientName
== state
.clientName
)
336 // ### check for merging index count, too?
337 if ( clients
.count() == 0 && children
.count() == 0 && container
&&
338 client
== state
.guiClient
)
340 QWidget
*parentContainer
= 0L;
342 if ( parent
&& parent
->container
)
343 parentContainer
= parent
->container
;
347 builder
->removeContainer( container
, parentContainer
, element
, containerAction
);
354 if ( client
== state
.guiClient
)
361 void ContainerNode::destructChildren( const QDomElement
&element
, BuildState
&state
)
363 QMutableListIterator
<ContainerNode
*> childIt
= children
;
364 while ( childIt
.hasNext() )
366 ContainerNode
*childNode
= childIt
.peekNext();
368 QDomElement childElement
= findElementForChild( element
, childNode
);
370 // destruct returns true in case the container really got deleted
371 if ( childNode
->destruct( childElement
, state
) )
372 removeChild( childIt
);
378 QDomElement
ContainerNode::findElementForChild( const QDomElement
&baseElement
,
379 ContainerNode
*childNode
)
381 static const QString
&attrName
= KGlobal::staticQString( "name" );
384 for ( QDomNode n
= baseElement
.firstChild(); !n
.isNull();
385 n
= n
.nextSibling() )
387 QDomElement e
= n
.toElement();
388 if ( e
.tagName().toLower() == childNode
->tagName
&&
389 e
.attribute( attrName
) == childNode
->name
)
393 return QDomElement();
396 void ContainerNode::unplugActions( BuildState
&state
)
401 QMutableListIterator
<ContainerClient
*> clientIt( clients
);
404 Disabled because it means in KToolBar::saveState isHidden is always true then,
405 which is clearly wrong.
407 if ( clients.count() == 1 && clientIt.current()->client == client &&
408 client == state.guiClient )
409 container->hide(); // this container is going to die, that's for sure.
410 // in this case let's just hide it, which makes the
411 // destruction faster
414 while ( clientIt
.hasNext() )
415 //only unplug the actions of the client we want to remove, as the container might be owned
416 //by a different client
417 if ( clientIt
.peekNext()->client
== state
.guiClient
)
419 unplugClient( clientIt
.peekNext() );
420 delete clientIt
.next();
427 void ContainerNode::unplugClient( ContainerClient
*client
)
429 static const QString
&tagActionList
= KGlobal::staticQString( "actionlist" );
433 // now quickly remove all custom elements (i.e. separators) and unplug all actions
435 QList
<QAction
*>::ConstIterator custIt
= client
->customElements
.constBegin();
436 QList
<QAction
*>::ConstIterator custEnd
= client
->customElements
.constEnd();
437 for (; custIt
!= custEnd
; ++custIt
)
438 builder
->removeCustomElement( container
, *custIt
);
440 client
->actions
.unplug( container
);
442 // now adjust all merging indices
444 MergingIndexList::Iterator mergingIt
= findIndex( client
->mergingName
);
446 adjustMergingIndices( - int( client
->actions
.count()
447 + client
->customElements
.count() ),
450 // unplug all actionslists
452 ActionListMap::ConstIterator alIt
= client
->actionLists
.constBegin();
453 ActionListMap::ConstIterator alEnd
= client
->actionLists
.constEnd();
454 for (; alIt
!= alEnd
; ++alIt
)
456 alIt
.value().unplug( container
);
458 // construct the merging index key (i.e. like named merging) , find the
459 // corresponding merging index and adjust all indices
460 QString mergingKey
= alIt
.key();
461 mergingKey
.prepend( tagActionList
);
463 MergingIndexList::Iterator mIt
= findIndex( mergingKey
);
464 if ( mIt
== mergingIndices
.end() )
467 adjustMergingIndices( -int(alIt
.value().count()), mIt
);
469 // remove the actionlists' merging index
470 // ### still needed? we clean up below anyway?
471 mergingIndices
.erase( mIt
);
475 void ContainerNode::reset()
477 foreach (ContainerNode
* child
, children
)
481 client
->setFactory( 0L );
484 int ContainerNode::calcMergingIndex( const QString
&mergingName
,
485 MergingIndexList::Iterator
&it
,
487 bool ignoreDefaultMergingIndex
)
489 MergingIndexList::Iterator mergingIt
;
491 if ( mergingName
.isEmpty() )
492 mergingIt
= findIndex( state
.clientName
);
494 mergingIt
= findIndex( mergingName
);
496 MergingIndexList::Iterator mergingEnd
= mergingIndices
.end();
499 if ( ( mergingIt
== mergingEnd
&& state
.currentDefaultMergingIt
== mergingEnd
) ||
500 ignoreDefaultMergingIndex
)
503 if ( mergingIt
!= mergingEnd
)
506 it
= state
.currentDefaultMergingIt
;
511 int BuildHelper::calcMergingIndex( const QDomElement
&element
, MergingIndexList::Iterator
&it
, QString
&group
)
513 static const QString
&attrGroup
= KGlobal::staticQString( "group" );
515 bool haveGroup
= false;
516 group
= element
.attribute( attrGroup
);
517 if ( !group
.isEmpty() ) {
518 group
.prepend( attrGroup
);
524 idx
= parentNode
->calcMergingIndex( group
, it
, m_state
, ignoreDefaultMergingIndex
);
525 else if ( m_state
.currentClientMergingIt
== parentNode
->mergingIndices
.end() )
526 idx
= parentNode
->index
;
528 idx
= (*m_state
.currentClientMergingIt
).value
;
533 BuildHelper::BuildHelper( BuildState
&state
, ContainerNode
*node
)
534 : containerClient( 0 ), ignoreDefaultMergingIndex( false ), m_state( state
),
537 static const QString
&defaultMergingName
= KGlobal::staticQString( "<default>" );
539 // create a list of supported container and custom tags
540 customTags
= m_state
.builderCustomTags
;
541 containerTags
= m_state
.builderContainerTags
;
543 if ( parentNode
->builder
!= m_state
.builder
)
545 customTags
+= parentNode
->builderCustomTags
;
546 containerTags
+= parentNode
->builderContainerTags
;
549 if ( m_state
.clientBuilder
) {
550 customTags
= m_state
.clientBuilderCustomTags
+ customTags
;
551 containerTags
= m_state
.clientBuilderContainerTags
+ containerTags
;
554 m_state
.currentDefaultMergingIt
= parentNode
->findIndex( defaultMergingName
);
555 parentNode
->calcMergingIndex( QString(), m_state
.currentClientMergingIt
,
556 m_state
, /*ignoreDefaultMergingIndex*/ false );
559 void BuildHelper::build( const QDomElement
&element
)
561 for (QDomNode n
= element
.firstChild(); !n
.isNull(); n
= n
.nextSibling() )
563 QDomElement e
= n
.toElement();
564 if (e
.isNull()) continue;
569 void BuildHelper::processElement( const QDomElement
&e
)
571 // some often used QStrings
572 static const QString
&tagAction
= KGlobal::staticQString( "action" );
573 static const QString
&tagMerge
= KGlobal::staticQString( "merge" );
574 static const QString
&tagState
= KGlobal::staticQString( "state" );
575 static const QString
&tagDefineGroup
= KGlobal::staticQString( "definegroup" );
576 static const QString
&tagActionList
= KGlobal::staticQString( "actionlist" );
577 static const QString
&attrName
= KGlobal::staticQString( "name" );
579 QString
tag( e
.tagName().toLower() );
580 QString
currName( e
.attribute( attrName
) );
582 bool isActionTag
= ( tag
== tagAction
);
584 if ( isActionTag
|| customTags
.indexOf( tag
) != -1 )
585 processActionOrCustomElement( e
, isActionTag
);
586 else if ( containerTags
.indexOf( tag
) != -1 )
587 processContainerElement( e
, tag
, currName
);
588 else if ( tag
== tagMerge
|| tag
== tagDefineGroup
|| tag
== tagActionList
)
589 processMergeElement( tag
, currName
, e
);
590 else if ( tag
== tagState
)
591 processStateElement( e
);
594 void BuildHelper::processActionOrCustomElement( const QDomElement
&e
, bool isActionTag
)
596 if ( !parentNode
->container
)
599 MergingIndexList::Iterator
it( m_state
.currentClientMergingIt
);
602 int idx
= calcMergingIndex( e
, it
, group
);
604 containerClient
= parentNode
->findChildContainerClient( m_state
.guiClient
, group
, it
);
606 bool guiElementCreated
= false;
608 guiElementCreated
= processActionElement( e
, idx
);
610 guiElementCreated
= processCustomElement( e
, idx
);
612 if ( guiElementCreated
)
613 // adjust any following merging indices and the current running index for the container
614 parentNode
->adjustMergingIndices( 1, it
);
617 bool BuildHelper::processActionElement( const QDomElement
&e
, int idx
)
619 assert( m_state
.guiClient
);
621 // look up the action and plug it in
622 QAction
*action
= m_state
.guiClient
->action( e
);
624 //kDebug(260) << "BuildHelper::processActionElement " << e.attribute( "name" ) << " -> " << action << " (in " << m_state.guiClient->actionCollection() << ")";
628 QAction
* before
= 0L;
629 if (idx
>= 0 && idx
< parentNode
->container
->actions().count())
630 before
= parentNode
->container
->actions()[idx
];
632 parentNode
->container
->insertAction(before
, action
);
634 // save a reference to the plugged action, in order to properly unplug it afterwards.
635 containerClient
->actions
.append( action
);
640 bool BuildHelper::processCustomElement( const QDomElement
&e
, int idx
)
642 assert( parentNode
->builder
);
644 QAction
* action
= parentNode
->builder
->createCustomElement( parentNode
->container
, idx
, e
);
648 containerClient
->customElements
.append( action
);
652 void BuildHelper::processStateElement( const QDomElement
&element
)
654 QString stateName
= element
.attribute( "name" );
656 if ( stateName
.isNull() || !stateName
.length() ) return;
658 for (QDomNode n
= element
.firstChild(); !n
.isNull(); n
= n
.nextSibling() )
660 QDomElement e
= n
.toElement();
661 if (e
.isNull()) continue;
663 QString tagName
= e
.tagName().toLower();
665 if ( tagName
!= "enable" && tagName
!= "disable" )
668 bool processingActionsToEnable
= (tagName
== "enable");
670 // process action names
671 for (QDomNode n2
= n
.firstChild(); !n2
.isNull(); n2
= n2
.nextSibling() )
673 QDomElement actionEl
= n2
.toElement();
674 if ( actionEl
.tagName().toLower() != "action" ) continue;
676 QString actionName
= actionEl
.attribute( "name" );
677 if ( actionName
.isEmpty() ) return;
679 if ( processingActionsToEnable
)
680 m_state
.guiClient
->addStateActionEnabled( stateName
, actionName
);
682 m_state
.guiClient
->addStateActionDisabled( stateName
, actionName
);
688 void BuildHelper::processMergeElement( const QString
&tag
, const QString
&name
, const QDomElement
&e
)
690 static const QString
&tagDefineGroup
= KGlobal::staticQString( "definegroup" );
691 static const QString
&tagActionList
= KGlobal::staticQString( "actionlist" );
692 static const QString
&defaultMergingName
= KGlobal::staticQString( "<default>" );
693 static const QString
&attrGroup
= KGlobal::staticQString( "group" );
695 QString
mergingName( name
);
696 if ( mergingName
.isEmpty() )
698 if ( tag
== tagDefineGroup
)
700 kError(1000) << "cannot define group without name!" << endl
;
703 if ( tag
== tagActionList
)
705 kError(1000) << "cannot define actionlist without name!" << endl
;
708 mergingName
= defaultMergingName
;
711 if ( tag
== tagDefineGroup
)
712 mergingName
.prepend( attrGroup
); //avoid possible name clashes by prepending
713 // "group" to group definitions
714 else if ( tag
== tagActionList
)
715 mergingName
.prepend( tagActionList
);
717 if ( parentNode
->findIndex( mergingName
) != parentNode
->mergingIndices
.end() )
718 return; //do not allow the redefinition of merging indices!
720 MergingIndexList::Iterator
mIt( parentNode
->mergingIndices
.end() );
722 QString
group( e
.attribute( attrGroup
) );
723 if ( !group
.isEmpty() )
724 group
.prepend( attrGroup
);
726 // calculate the index of the new merging index. Usually this does not need any calculation,
727 // we just want the last available index (i.e. append) . But in case the <Merge> tag appears
728 // "inside" another <Merge> tag from a previously build client, then we have to use the
729 // "parent's" index. That's why we call calcMergingIndex here.
731 newIdx
.value
= parentNode
->calcMergingIndex( group
, mIt
, m_state
, ignoreDefaultMergingIndex
);
732 newIdx
.mergingName
= mergingName
;
733 newIdx
.clientName
= m_state
.clientName
;
735 // if that merging index is "inside" another one, then append it right after the "parent" .
736 if ( mIt
!= parentNode
->mergingIndices
.end() )
737 parentNode
->mergingIndices
.insert( ++mIt
, newIdx
);
739 parentNode
->mergingIndices
.append( newIdx
);
741 if ( mergingName
== defaultMergingName
)
743 ignoreDefaultMergingIndex
= true;
745 // re-calculate the running default and client merging indices.
746 m_state
.currentDefaultMergingIt
= parentNode
->findIndex( defaultMergingName
);
747 parentNode
->calcMergingIndex( QString(), m_state
.currentClientMergingIt
,
748 m_state
, ignoreDefaultMergingIndex
);
751 void BuildHelper::processContainerElement( const QDomElement
&e
, const QString
&tag
,
752 const QString
&name
)
754 static const QString
&defaultMergingName
= KGlobal::staticQString( "<default>" );
756 ContainerNode
*containerNode
= parentNode
->findContainer( name
, tag
,
760 if ( !containerNode
)
762 MergingIndexList::Iterator
it( m_state
.currentClientMergingIt
);
765 int idx
= calcMergingIndex( e
, it
, group
);
767 QAction
* containerAction
;
769 KXMLGUIBuilder
*builder
;
771 QWidget
*container
= createContainer( parentNode
->container
, idx
, e
, containerAction
, &builder
);
773 // no container? (probably some <text> tag or so ;-)
777 parentNode
->adjustMergingIndices( 1, it
);
779 assert( !parentNode
->findContainerNode( container
) );
781 containerList
.append( container
);
784 if ( it
!= parentNode
->mergingIndices
.end() )
785 mergingName
= (*it
).mergingName
;
787 QStringList cusTags
= m_state
.builderCustomTags
;
788 QStringList conTags
= m_state
.builderContainerTags
;
789 if ( builder
!= m_state
.builder
)
791 cusTags
= m_state
.clientBuilderCustomTags
;
792 conTags
= m_state
.clientBuilderContainerTags
;
795 containerNode
= new ContainerNode( container
, tag
, name
, parentNode
,
796 m_state
.guiClient
, builder
, containerAction
,
797 mergingName
, group
, cusTags
, conTags
);
800 BuildHelper( m_state
, containerNode
).build( e
);
802 // and re-calculate running values, for better performance
803 m_state
.currentDefaultMergingIt
= parentNode
->findIndex( defaultMergingName
);
804 parentNode
->calcMergingIndex( QString(), m_state
.currentClientMergingIt
,
805 m_state
, ignoreDefaultMergingIndex
);
808 QWidget
*BuildHelper::createContainer( QWidget
*parent
, int index
,
809 const QDomElement
&element
, QAction
*& containerAction
,
810 KXMLGUIBuilder
**builder
)
814 if ( m_state
.clientBuilder
)
816 res
= m_state
.clientBuilder
->createContainer( parent
, index
, element
, containerAction
);
820 *builder
= m_state
.clientBuilder
;
825 KComponentData oldInstance
= m_state
.builder
->builderComponentData();
826 KXMLGUIClient
*oldClient
= m_state
.builder
->builderClient();
828 m_state
.builder
->setBuilderClient( m_state
.guiClient
);
830 res
= m_state
.builder
->createContainer( parent
, index
, element
, containerAction
);
832 m_state
.builder
->setBuilderComponentData(oldInstance
);
833 m_state
.builder
->setBuilderClient( oldClient
);
836 *builder
= m_state
.builder
;
841 void BuildState::reset()
844 actionListName
.clear();
849 currentDefaultMergingIt
= currentClientMergingIt
= MergingIndexList::Iterator();