KHTML
kjavaappletviewer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KJAVAAPPLETVIEWER_H
00024 #define KJAVAAPPLETVIEWER_H
00025
00026 #include <kparts/part.h>
00027 #include <kparts/browserextension.h>
00028 #include <kparts/statusbarextension.h>
00029 #include <kparts/factory.h>
00030 #include <kdialogbase.h>
00031 #include <kurl.h>
00032 #include <qobject.h>
00033 #include <qstringlist.h>
00034 #include <qguardedptr.h>
00035
00036 #include "kjavaappletwidget.h"
00037
00038 class QTable;
00039 class QLabel;
00040 class KJavaProcess;
00041 class KJavaAppletViewer;
00042 class KAboutData;
00043 class KInstance;
00044 class KConfig;
00045 class CoverWidget;
00046
00047 class KJavaAppletViewerBrowserExtension : public KParts::BrowserExtension {
00048 Q_OBJECT
00049 public:
00050 KJavaAppletViewerBrowserExtension (KJavaAppletViewer *parent);
00051 void urlChanged (const QString & url);
00052 void setLoadingProgress (int percentage);
00053
00054 void setURLArgs (const KParts::URLArgs & args);
00055 void saveState (QDataStream & stream);
00056 void restoreState (QDataStream & stream);
00057 public slots:
00058 void showDocument (const QString & doc, const QString & frame);
00059 };
00060
00061 class KJavaAppletViewerLiveConnectExtension : public KParts::LiveConnectExtension {
00062 Q_OBJECT
00063 public:
00064 KJavaAppletViewerLiveConnectExtension(KJavaAppletViewer * parent);
00065
00066 bool get (const unsigned long objid, const QString & field, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value);
00067 bool put(const unsigned long, const QString & field, const QString & value);
00068 bool call (const unsigned long , const QString & func, const QStringList & args, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value);
00069 void unregister (const unsigned long objid);
00070
00071 int jsSessions () const { return m_jssessions; }
00072 public slots:
00073 void jsEvent (const QStringList & args);
00074 signals:
00075 virtual void partEvent (const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args);
00076
00077 private:
00078 KJavaAppletViewer * m_viewer;
00079 static int m_jssessions;
00080 };
00081
00082 class KJavaAppletViewer : public KParts::ReadOnlyPart {
00083 Q_OBJECT
00084 public:
00085 KJavaAppletViewer (QWidget * wparent, const char * wname,
00086 QObject * parent, const char * name, const QStringList &args);
00087 ~KJavaAppletViewer ();
00088 CoverWidget * view () const { return m_view; }
00089 static KAboutData* createAboutData ();
00090
00091 KJavaAppletViewerBrowserExtension * browserextension() const
00092 { return m_browserextension; }
00093 KParts::LiveConnectExtension * liveConnectExtension () const
00094 { return m_liveconnect; }
00095
00096 bool eventFilter (QObject *o, QEvent *e);
00097
00098 bool appletAlive () const;
00099 public slots:
00100 virtual bool openURL (const KURL & url);
00101 virtual bool closeURL ();
00102 void appletLoaded ();
00103 void infoMessage (const QString &);
00104 protected:
00105 bool openFile();
00106 private slots:
00107 void delayedCreateTimeOut ();
00108 private:
00109 QGuardedPtr <CoverWidget> m_view;
00110 KConfig * m_config;
00111 KJavaProcess * process;
00112 KJavaAppletViewerBrowserExtension * m_browserextension;
00113 KJavaAppletViewerLiveConnectExtension * m_liveconnect;
00114 KParts::StatusBarExtension * m_statusbar;
00115 QGuardedPtr <QLabel> m_statusbar_icon;
00116 QString baseurl;
00117 bool m_closed;
00118 };
00119
00120 class KJavaAppletViewerFactory : public KParts::Factory {
00121 Q_OBJECT
00122 public:
00123 KJavaAppletViewerFactory ();
00124 virtual ~KJavaAppletViewerFactory ();
00125 virtual KParts::Part *createPartObject
00126 (QWidget *wparent, const char *wname,
00127 QObject *parent, const char *name,
00128 const char *className, const QStringList &args);
00129 static KInstance * instance () { return s_instance; }
00130 private:
00131 static KInstance * s_instance;
00132 };
00133
00134 class AppletParameterDialog : public KDialogBase {
00135 Q_OBJECT
00136 public:
00137 AppletParameterDialog (KJavaAppletWidget * parent);
00138 protected slots:
00139 void slotClose ();
00140 private:
00141 KJavaAppletWidget * m_appletWidget;
00142 QTable * table;
00143 };
00144
00145 #endif