[kde-de] Parts problem

Thomas Schwarzgruber thomas_schwarzgruber at gmx.at
So Okt 12 17:27:06 CEST 2003


Hallo !

Habe vor einiger Zeit eine Appl. auf das Kparts System umgeschrieben.
Nun habe ich das Problem, dass die Shell der App. die Menüpunkte des geladenen 
Parts anzeigt, aber die eigenen nicht mehr (so allgemeine wie Quit usw.) 
Wo kann da das Problem liegen ? Hat jemand schon so etwas gehabt ?

Hier evtl. relevanter Code:

Auszug aus shell.rc:

<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kompile_parted_shell" version="1">
<MenuBar>
  <Menu noMerge="1" name="file"><text>&amp;File</text>
    <Action name="file_new"/>
    <Merge/>
    <Separator/>
    <Action name="file_quit"/>
  </Menu>

Auszug aus part.rc:

<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kompile_parted_part" version="1">
<MenuBar>
  <Menu name="file">
    <Action name="file_open"/>
    <Separator/>
    <Action name="start_make" />
    <Action name="start_conf" />
    <Action name="start_cvs" />
    <Separator />
    <Action name="stop" />
    <Action name="clear" />
  </Menu>
</MenuBar>

Auszug aus shell.cpp:

kompile_parted::kompile_parted()
    : KParts::MainWindow( 0L, "kompile_parted" )
{
    // set the shell's ui resource file
    setXMLFile("kompile_parted_shell.rc");

    // this routine will find and load our Part.  it finds the Part by
    // name which is a bad idea usually.. but it's alright in this
    // case since our Part is made for this Shell
    KLibFactory *factory = KLibLoader::self()->factory
("libkompile_partedpart");
    if (factory)
    {
        // now that the Part is loaded, we cast it to a Part to get
        // our hands on it
        m_part = static_cast<KParts::ReadWritePart *>(factory->create(this,
                                "kompile_parted_part", "KParts::
ReadOnlyPart" ));

        if (m_part)
        {
            // tell the KParts::MainWindow that this is indeed the main widget
            setCentralWidget(m_part->widget());


            // and integrate the part's GUI with the shell's
            createGUI(m_part);

        }
    }
    else
    {
        // if we couldn't find our Part, we exit since the Shell by
        // itself can't do anything useful
        KMessageBox::error(this, i18n("Could not find our part!"));
        kapp->quit();
        // we return here, cause kapp->quit() only means "exit the
        // next time we enter the event loop...
        return;
    }

     // then, setup our actions
    setupActions();

    // and a status bar
    statusBar()->show();

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();
}


Auszug aus part.cpp:

kompile_partedPart::kompile_partedPart( QWidget *parentWidget, const char 
*widgetName,
                                  QObject *parent, const char *name )
    : KParts::ReadOnlyPart(parent, name)
{
    // we need an instance
    setInstance( kompile_partedPartFactory::instance() );
    new kompileBrowserExtension( this );

    // this should be your custom internal widget
    //QSplitter *widget = new QSplitter(parentWidget);

    m_widget = new KompileEngine(parentWidget);
<snip>
// notify the part that this is our internal widget
    setWidget(m_widget->splitter);     <--/// Kann es sein das dies das 				        
							   problem ist 


    // set our XML-UI resource file
    setXMLFile("kompile_parted_part.rc");

    // we are read-write by default
    //setReadWrite(true);

    // we are not modified since we haven't done anything yet
    //setModified(false);


-- 
Thomas Schwarzgruber
<thomas_schwarzgruber at gmx.at>
linux user since 2.0.38

In a world without walls and fences,
who needs windows and gates ?