KHTML
kjavaappletviewer.h
Go to the documentation of this file.
00001 // -*- c++ -*- 00002 00003 /* This file is part of the KDE project 00004 * 00005 * Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 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 <kpluginfactory.h> 00030 #include <kdialog.h> 00031 #include <kurl.h> 00032 #include <QtCore/QObject> 00033 #include <QtCore/QStringList> 00034 #include <QtCore/QPointer> 00035 00036 #include "kjavaappletwidget.h" 00037 00038 class QTableWidget; 00039 class QLabel; 00040 class KJavaProcess; 00041 class KJavaAppletViewer; 00042 class KAboutData; 00043 class KComponentData; 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 setBrowserArguments(const KParts::BrowserArguments & args); 00055 void saveState (QDataStream & stream); 00056 void restoreState (QDataStream & stream); 00057 public Q_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 Q_SLOTS: 00073 void jsEvent (const QStringList & args); 00074 Q_SIGNALS: 00075 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, QObject * parent, const QStringList &args); 00086 ~KJavaAppletViewer (); 00087 CoverWidget * view () const; 00088 static KAboutData* createAboutData (); 00089 00090 KJavaAppletViewerBrowserExtension * browserextension() const 00091 { return m_browserextension; } 00092 KParts::LiveConnectExtension * liveConnectExtension () const 00093 { return m_liveconnect; } 00094 00095 bool eventFilter (QObject *o, QEvent *e); 00096 00097 bool appletAlive () const; 00098 public Q_SLOTS: 00099 virtual bool openUrl (const KUrl & url); 00100 virtual bool closeUrl (); 00101 void appletLoaded (); 00102 void infoMessage (const QString &); 00103 protected: 00104 bool openFile(); 00105 private Q_SLOTS: 00106 void delayedCreateTimeOut (); 00107 private: 00108 QPointer <CoverWidget> m_view; 00109 KConfig * m_config; 00110 KJavaProcess * process; 00111 KJavaAppletViewerBrowserExtension * m_browserextension; 00112 KJavaAppletViewerLiveConnectExtension * m_liveconnect; 00113 KParts::StatusBarExtension * m_statusbar; 00114 QPointer <QLabel> m_statusbar_icon; 00115 QString baseurl; 00116 bool m_closed; 00117 }; 00118 00119 class KJavaAppletViewerFactory : public KPluginFactory { 00120 Q_OBJECT 00121 public: 00122 KJavaAppletViewerFactory (); 00123 virtual ~KJavaAppletViewerFactory (); 00124 virtual QObject *create(const char *, QWidget *wparent, QObject *parent, 00125 const QVariantList & args, const QString &); 00126 static const KComponentData &componentData() { return *s_componentData; } 00127 static KIconLoader * iconLoader () { return s_iconLoader; } 00128 private: 00129 static KComponentData *s_componentData; 00130 static KIconLoader * s_iconLoader; 00131 }; 00132 00133 class AppletParameterDialog : public KDialog { 00134 Q_OBJECT 00135 public: 00136 AppletParameterDialog (KJavaAppletWidget * parent); 00137 protected Q_SLOTS: 00138 void slotClose (); 00139 private: 00140 KJavaAppletWidget * m_appletWidget; 00141 QTableWidget * table; 00142 }; 00143 00144 #endif
KDE 4.6 API Reference