(not) Adding a statusbar widget
Koos Vriezen
koos.vriezen at xs4all.nl
Thu Jun 2 20:50:15 BST 2005
On Thu, Jun 02, 2005 at 08:59:49PM +0200, Koos Vriezen wrote:
> Anyhow, it works :-). Commit it?
Well almost everything but the kjas part :-(. Context idea sucks I'm
afraid. So updated for each applet an icon ..
> Koos
-------------- next part --------------
Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp (revision 421260)
+++ khtml_part.cpp (working copy)
@@ -4393,6 +4403,9 @@
if (::qt_cast<KHTMLPart*>(part)) {
static_cast<KHTMLPart*>(part)->d->m_frame = child;
} else if (child->m_frame) {
+ KParts::StatusBarExtension *sb = KParts::StatusBarExtension::childObject(part);
+ if (sb)
+ sb->setStatusBar( d->m_statusBarExtension->statusBar() );
child->m_liveconnect = KParts::LiveConnectExtension::childObject(part);
if (child->m_liveconnect)
connect(child->m_liveconnect, SIGNAL(partEvent(const unsigned long, const QString &, const KParts::LiveConnectExtension::ArgList &)), child, SLOT(liveConnectEvent(const unsigned long, const QString&, const KParts::LiveConnectExtension::ArgList &)));
Index: java/kjavaappletcontext.cpp
===================================================================
--- java/kjavaappletcontext.cpp (revision 421260)
+++ java/kjavaappletcontext.cpp (working copy)
@@ -26,6 +26,7 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <kdebug.h>
+#include <kparts/statusbarextension.h>
#include <qmap.h>
#include <qguardedptr.h>
#include <qstringlist.h>
Index: java/kjavaappletviewer.cpp
===================================================================
--- java/kjavaappletviewer.cpp (revision 421260)
+++ java/kjavaappletviewer.cpp (working copy)
@@ -27,11 +27,14 @@
#include <qpair.h>
#include <qtimer.h>
#include <qguardedptr.h>
+#include <qlabel.h>
#include <klibloader.h>
#include <kaboutdata.h>
#include <kstaticdeleter.h>
#include <klocale.h>
+#include <kstatusbar.h>
+#include <kiconloader.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
@@ -198,6 +201,8 @@
: KParts::ReadOnlyPart (parent, name),
m_browserextension (new KJavaAppletViewerBrowserExtension (this)),
m_liveconnect (new KJavaAppletViewerLiveConnectExtension (this)),
+ m_statusbar (new KParts::StatusBarExtension (this)),
+ m_statusbar_icon (0L),
m_closed (true)
{
if (!serverMaintainer) {
@@ -352,6 +357,8 @@
KJavaAppletViewer::~KJavaAppletViewer () {
m_view = 0L;
serverMaintainer->releaseContext (parent(), baseurl);
+ if (m_statusbar_icon)
+ m_statusbar->removeStatusBarItem (m_statusbar_icon);
}
bool KJavaAppletViewer::openURL (const KURL & url) {
@@ -371,6 +378,14 @@
AppletParameterDialog (w).exec ();
applet->setSize (w->sizeHint());
}
+ if (!m_statusbar_icon) {
+ KStatusBar *sb = m_statusbar->statusBar();
+ if (sb) {
+ m_statusbar_icon = new QLabel (sb);
+ m_statusbar_icon->setPixmap (SmallIcon (QString ("source_java")));
+ m_statusbar->addStatusBarItem (m_statusbar_icon, 0, false);
+ }
+ }
// delay showApplet if size is unknown and m_view not shown
if (applet->size().width() > 0 || m_view->isVisible())
w->showApplet ();
Index: java/kjavaappletviewer.h
===================================================================
--- java/kjavaappletviewer.h (revision 421260)
+++ java/kjavaappletviewer.h (working copy)
@@ -25,6 +25,7 @@
#include <kparts/part.h>
#include <kparts/browserextension.h>
+#include <kparts/statusbarextension.h>
#include <kparts/factory.h>
#include <kdialogbase.h>
#include <kurl.h>
@@ -35,6 +36,7 @@
#include "kjavaappletwidget.h"
class QTable;
+class QLabel;
class KJavaProcess;
class KJavaAppletViewer;
class KAboutData;
@@ -109,6 +111,8 @@
KJavaProcess * process;
KJavaAppletViewerBrowserExtension * m_browserextension;
KJavaAppletViewerLiveConnectExtension * m_liveconnect;
+ KParts::StatusBarExtension * m_statusbar;
+ QGuardedPtr <QLabel> m_statusbar_icon;
QString baseurl;
bool m_closed;
};
More information about the kfm-devel
mailing list