KHtml

kjavaappletviewer.h
1 // -*- c++ -*-
2 
3 /* This file is part of the KDE project
4  *
5  * Copyright (C) 2003 Koos Vriezen <[email protected]>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef KJAVAAPPLETVIEWER_H
24 #define KJAVAAPPLETVIEWER_H
25 
26 #include <kparts/part.h>
27 #include <kparts/browserextension.h>
28 #include <kparts/statusbarextension.h>
29 #include <kparts/liveconnectextension.h>
30 #include <kpluginfactory.h>
31 #include <QDialog>
32 #include <QUrl>
33 #include <QObject>
34 #include <QStringList>
35 #include <QPointer>
36 
37 #include "kjavaappletwidget.h"
38 
39 class QTableWidget;
40 class QLabel;
41 class KJavaProcess;
42 class KJavaAppletViewer;
43 class KAboutData;
44 class KComponentData;
45 class KConfig;
46 class CoverWidget;
47 
48 class KJavaAppletViewerBrowserExtension : public KParts::BrowserExtension
49 {
50  Q_OBJECT
51 public:
52  KJavaAppletViewerBrowserExtension(KJavaAppletViewer *parent);
53  void urlChanged(const QString &url);
54  void setLoadingProgress(int percentage);
55 
56  void setBrowserArguments(const KParts::BrowserArguments &args) override;
57  void saveState(QDataStream &stream) override;
58  void restoreState(QDataStream &stream) override;
59 public Q_SLOTS:
60  void showDocument(const QString &doc, const QString &frame);
61 };
62 
63 class KJavaAppletViewerLiveConnectExtension : public KParts::LiveConnectExtension
64 {
65  Q_OBJECT
66 public:
67  KJavaAppletViewerLiveConnectExtension(KJavaAppletViewer *parent);
68 
69  bool get(const unsigned long objid, const QString &field, KParts::LiveConnectExtension::Type &type, unsigned long &retobjid, QString &value) override;
70  bool put(const unsigned long, const QString &field, const QString &value) override;
71  bool call(const unsigned long, const QString &func, const QStringList &args, KParts::LiveConnectExtension::Type &type, unsigned long &retobjid, QString &value) override;
72  void unregister(const unsigned long objid) override;
73 
74  int jsSessions() const
75  {
76  return m_jssessions;
77  }
78 public Q_SLOTS:
79  void jsEvent(const QStringList &args);
80 Q_SIGNALS:
81  void partEvent(const unsigned long objid, const QString &event, const KParts::LiveConnectExtension::ArgList &args);
82 
83 private:
84  KJavaAppletViewer *m_viewer;
85  static int m_jssessions;
86 };
87 
88 class KJavaAppletViewer : public KParts::ReadOnlyPart
89 {
90  Q_OBJECT
91 public:
92  KJavaAppletViewer(QWidget *wparent, QObject *parent, const QStringList &args);
93  ~KJavaAppletViewer();
94  CoverWidget *view() const;
95 
96  KJavaAppletViewerBrowserExtension *browserextension() const
97  {
98  return m_browserextension;
99  }
100  KParts::LiveConnectExtension *liveConnectExtension() const
101  {
102  return m_liveconnect;
103  }
104 
105  bool eventFilter(QObject *o, QEvent *e) override;
106 
107  bool appletAlive() const;
108 public Q_SLOTS:
109  bool openUrl(const QUrl &url) override;
110  bool closeUrl() override;
111  void appletLoaded();
112  void infoMessage(const QString &);
113 protected:
114  bool openFile() override;
115 private Q_SLOTS:
116  void delayedCreateTimeOut();
117 private:
118  QPointer <CoverWidget> m_view;
119  KConfig *m_config;
120  KJavaProcess *process;
121  KJavaAppletViewerBrowserExtension *m_browserextension;
122  KJavaAppletViewerLiveConnectExtension *m_liveconnect;
123  KParts::StatusBarExtension *m_statusbar;
124  QPointer <QLabel> m_statusbar_icon;
125  QString baseurl;
126  bool m_closed;
127 };
128 
129 class KJavaAppletViewerFactory : public KPluginFactory
130 {
131  Q_OBJECT
132 public:
133  KJavaAppletViewerFactory();
134  virtual ~KJavaAppletViewerFactory();
135  virtual QObject *create(const char *, QWidget *wparent, QObject *parent,
136  const QVariantList &args, const QString &) override;
137  static const KAboutData &componentData()
138  {
139  return *s_aboutData;
140  }
141  static KIconLoader *iconLoader()
142  {
143  return s_iconLoader;
144  }
145 private:
146  static KAboutData *s_aboutData;
147  static KIconLoader *s_iconLoader;
148 };
149 
150 class AppletParameterDialog : public QDialog
151 {
152  Q_OBJECT
153 public:
154  AppletParameterDialog(KJavaAppletWidget *parent);
155 protected Q_SLOTS:
156  void slotClose();
157 private:
158  KJavaAppletWidget *m_appletWidget;
159  QTableWidget *table;
160 };
161 
162 #endif
QAction * create(StandardAction id, const QObject *recvr, Func slot, QObject *parent)
virtual void saveState(QDataStream &stream)
virtual void restoreState(QDataStream &stream)
Q_OBJECTQ_OBJECT
Type type(const QSqlDatabase &db)
KIOCORE_EXPORT TransferJob * put(const QUrl &url, int permissions, JobFlags flags=DefaultFlags)
Q_SLOTSQ_SLOTS
virtual void setBrowserArguments(const BrowserArguments &args)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.