Bug in KXMLGuiFactory::addClient()

Andras Mantia amantia at kde.org
Wed Mar 31 18:35:19 BST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 31 March 2004 20:12, Anders Lund wrote:
> So I'll support your suggestion, and please show me/ushow to do this right
> :)

kdewebdev/quanta/src/quanta.cpp:
void QuantaApp::slotOptionsConfigureKeys()
{
  Document *w = ViewManager::ref()->activeDocument();
  KKeyDialog dlg( false, this );
  QPtrList<KXMLGUIClient> clients = guiFactory()->clients();
  for( QPtrListIterator<KXMLGUIClient> it( clients );
       it.current(); ++it ) {
    dlg.insert( (*it)->actionCollection() );
  }
  if ( dlg.configure() == KKeyDialog::Accepted )
  {
    // this is needed for when we have multiple embedded kateparts and change one of them.
    // it also needs to be done to their views, as they too have actioncollections to update
      if( const QPtrList<KParts::Part> * partlist = m_partManager->parts() )
      {
          QPtrListIterator<KParts::Part> it( *partlist );
          while ( KParts::Part* part = it.current() )
          {
              if ( KTextEditor::Document * doc = dynamic_cast<KTextEditor::Document*>( part ) )
              {
                  KActionPtrList actionList = doc->actionCollection()->actions();
                  KActionPtrList::Iterator actionIt;
                  if (!w || w->doc() != doc)
                  {
                    for ( actionIt = actionList.begin(); actionIt != actionList.end(); ++actionIt )
                    {
                        (*actionIt)->setShortcut((*actionIt)->shortcutDefault());
                    }
                  }
                  doc->reloadXML();

                  QPtrList<KTextEditor::View> const & list = doc->views();
                  QPtrListIterator<KTextEditor::View> itt( list );
                  while( KTextEditor::View * view = itt.current() )
                  {
                     if (!w || w->view() != view)
                     {
                        actionList = view->actionCollection()->actions();
                        for ( actionIt = actionList.begin(); actionIt != actionList.end(); ++actionIt )
                        {
                            (*actionIt)->setShortcut((*actionIt)->shortcutDefault());
                        }
                     }
                     view->reloadXML();
                     ++itt;
                  }
              }
              ++it;
          }
      }
}

w->doc() / w->view() is the current KTextEditor::Document/View, and for those we shouldn't reset the shortcuts.

But I believe a general solution might be better, just as I posted in the first mail.

Andras
- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAawFXTQdfac6L/08RAlqiAJ9dutExLASS+ZulPgxWB+/RgIU9UQCgkOPn
171SNNI05BBlLrNnq8UUuM4=
=HAVs
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list