Exemple #1
0
void RenderApplet::layout()
{
    //kdDebug(6100) << "RenderApplet::layout" << endl;

    KHTMLAssert( needsLayout() );
    KHTMLAssert( minMaxKnown() );

    calcWidth();
    calcHeight();

    KJavaAppletWidget *tmp = static_cast<KJavaAppletWidget*>(m_widget);
    if ( tmp ) {
        NodeImpl *child = element()->firstChild();

        while(child) {

            if(child->id() == ID_PARAM) {
                HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
                if(tmp->applet())
                    tmp->applet()->setParameter( p->name(), p->value());
            }
            child = child->nextSibling();
        }
        //kdDebug(6100) << "setting applet widget to size: " << m_width << ", " << m_height << endl;
        m_widget->resize(m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
                         m_height-borderTop()-borderBottom()-paddingTop()-paddingBottom());
        tmp->showApplet();
    }

    setNeedsLayout(false);
}
Exemple #2
0
void RenderApplet::processArguments(const QMap< QString, QString > &args)
{
    KJavaAppletWidget *w = static_cast< KJavaAppletWidget * >(m_widget);
    KJavaApplet *applet = w ? w->applet() : 0;

    if(applet)
    {
        applet->setBaseURL(args[QString::fromLatin1("baseURL")]);
        applet->setAppletClass(args[QString::fromLatin1("code")]);

        QString str = args[QString::fromLatin1("codeBase")];
        if(!str.isEmpty())
            applet->setCodeBase(str);

        str = args[QString::fromLatin1("name")];
        if(!str.isNull())
            applet->setAppletName(str);
        else
            applet->setAppletName(args[QString::fromLatin1("code")]);

        str = args[QString::fromLatin1("archive")];
        if(!str.isEmpty())
            applet->setArchives(args[QString::fromLatin1("archive")]);
    }
}
bool HTMLAppletElementImpl::callMember(const QString & name, const QStringList & args, JType & type, QString & val) {
#if APPLE_CHANGES
    return false;
#else
#ifndef Q_WS_QWS // We don't have Java in Qt Embedded
    if ( !m_render || !m_render->isApplet() )
        return false;
    KJavaAppletWidget *w = static_cast<KJavaAppletWidget*>(static_cast<RenderApplet*>(m_render)->widget());
    return (w && w->applet() && w->applet()->callMember(name, args, type, val));
#else
    return false;
#endif
#endif
}
int main(int argc, char **argv)
{
    KCmdLineArgs::init( argc, argv, "testKJASSever", 0, ki18n("testKJASServer"), "0.0", ki18n("test program"));

    KCmdLineOptions options;
    options.add("+kdelibspath", ki18n("path to kdelibs directory"));

    KCmdLineArgs::addCmdLineOptions( options );
    //KCmdLineArgs::addStdCmdLineOptions();

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QByteArray path;
#if 0
    path = args->getOption("kdelibspath");
    if (path.isEmpty())
    {
      kWarning() << "you need to specify a path to your kdelibs source dir, see \"--help\"";
      return -1;
    }
#else
    #ifdef __GNUC__
    #warning better adjust this :)
    #endif
    path = "/home/danimo/src/kde/trunk/KDE/kdelibs/";
#endif
    QString testpath("file://" + path + "/kdelibs/khtml/test/");

    KJavaAppletContext *context = new KJavaAppletContext;
    KJavaAppletWidget *a = new KJavaAppletWidget;
    a->applet()->setAppletContext(context);

    a->show();

//    c->registerApplet(a->applet());

    a->applet()->setBaseURL( testpath );
    a->applet()->setAppletName( "Lake" );
    a->applet()->setAppletClass( "lake.class" );
    a->applet()->setParameter( "image", "konqi.gif" );

    a->showApplet();
    a->applet()->start();

    app.exec();
}
Exemple #5
0
void CoverWidget::resizeEvent(QResizeEvent *e)
{
    m_appletwidget->resize(e->size().width(), e->size().height());
}