KHtml

kjavaappletserver.h
1 // -*- c++ -*-
2 
3 /* This file is part of the KDE project
4  *
5  * Copyright (C) 2000 Richard Moore <[email protected]>
6  * 2000 Wynn Wilkes <[email protected]>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef KJAVAAPPLETSERVER_H
25 #define KJAVAAPPLETSERVER_H
26 
27 #include "kjavaprocess.h"
28 #include <QObject>
29 #include <QMap>
30 #include <QSize>
31 
32 /**
33  * @short Communicates with a KJAS server to display and control Java applets.
34  *
35  * @author Richard J. Moore, [email protected]
36  */
37 
38 class KJavaAppletContext;
39 class KJavaAppletServerPrivate;
40 class JSStackFrame;
41 
42 class KJavaAppletServer : public QObject
43 {
44  Q_OBJECT
45 
46 public:
47  /**
48  * Create the applet server. These shouldn't be used directly,
49  * use allocateJavaServer instead
50  */
51  KJavaAppletServer();
52  ~KJavaAppletServer();
53 
54  /**
55  * A factory method that returns the default server. This is the way this
56  * class is usually instantiated.
57  */
58  static KJavaAppletServer *allocateJavaServer();
59 
60  /**
61  * When you are done using your reference to the AppletServer, you must
62  * dereference it by calling freeJavaServer().
63  */
64  static void freeJavaServer();
65 
66  /**
67  * This allows the KJavaAppletWidget to display some feedback in a QLabel
68  * while the applet is being loaded. If the java process could not be
69  * started, an error message is displayed instead.
70  */
71  static QString getAppletLabel();
72 
73  /**
74  * Create an applet context with the specified id.
75  */
76  void createContext(int contextId, KJavaAppletContext *context);
77 
78  /**
79  * Destroy the applet context with the specified id. All the applets in the
80  * context will be destroyed as well.
81  */
82  void destroyContext(int contextId);
83 
84  /**
85  * Create an applet in the specified context with the specified id. The applet
86  * name, class etc. are specified in the same way as in the HTML APPLET tag.
87  */
88  bool createApplet(int contextId, int appletId,
89  const QString &name, const QString &clazzName,
90  const QString &baseURL, const QString &user,
91  const QString &password, const QString &authname,
92  const QString &codeBase, const QString &jarFile,
93  QSize size, const QMap<QString, QString> &params,
94  const QString &windowTitle);
95 
96  /**
97  * This should be called by the KJavaAppletWidget
98  */
99  void initApplet(int contextId, int appletId);
100 
101  /**
102  * Destroy an applet in the specified context with the specified id.
103  */
104  void destroyApplet(int contextId, int appletId);
105 
106  /**
107  * Start the specified applet.
108  */
109  void startApplet(int contextId, int appletId);
110 
111  /**
112  * Stop the specified applet.
113  */
114  void stopApplet(int contextId, int appletId);
115 
116  /**
117  * Show java console.
118  */
119  void showConsole();
120 
121  /**
122  * Send data we got back from a KJavaDownloader back to the appropriate
123  * class loader.
124  */
125  void sendURLData(int loaderID, int code, const QByteArray &data);
126  /**
127  * Removes KJavaDownloader from the list (deletes it too).
128  */
129  void removeDataJob(int loaderID);
130 
131  /**
132  * Shut down the KJAS server.
133  */
134  void quit();
135  KJavaProcess *javaProcess()
136  {
137  return process;
138  }
139 
140  QString appletLabel();
141 
142  void waitForReturnData(JSStackFrame *);
143  void endWaitForReturnData();
144 
145  bool getMember(QStringList &args, QStringList &ret_args);
146  bool putMember(QStringList &args);
147  bool callMember(QStringList &args, QStringList &ret_args);
148  void derefObject(QStringList &args);
149 
150  bool usingKIO();
151 protected:
152  void setupJava(KJavaProcess *p);
153 
154  KJavaProcess *process;
155 
156 protected Q_SLOTS:
157  void slotJavaRequest(const QByteArray &qb);
158  void checkShutdown();
159  void timerEvent(QTimerEvent *) override;
160  void killTimers();
161 
162 private:
163  KJavaAppletServerPrivate *const d;
164 
165 };
166 
167 class PermissionDialog : public QObject
168 {
169  Q_OBJECT
170 public:
171  PermissionDialog(QWidget *);
172  ~PermissionDialog();
173 
174  QString exec(const QString &cert, const QString &perm);
175 
176 private Q_SLOTS:
177  void clicked();
178 
179 private:
180  QString m_button;
181 };
182 
183 #endif // KJAVAAPPLETSERVER_H
virtual void timerEvent(QTimerEvent *event)
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
const QList< QKeySequence > & quit()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.