~ubuntu-branches/ubuntu/maverick/kdebase/maverick-updates

« back to all changes in this revision

Viewing changes to apps/nsplugins/nspluginloader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers, Martin Alfke, Modestas Vainius
  • Date: 2010-05-01 23:37:50 UTC
  • mfrom: (0.7.4 upstream) (0.4.4 experimental)
  • mto: This revision was merged to the branch mainline in revision 285.
  • Revision ID: james.westby@ubuntu.com-20100501233750-maq4i4sh8ymjbneb
Tags: 4:4.4.3-1
* New upstream release:
  - Konsole does not crash when closing a broken restored session.
    (Closes: #555831)
  - Konqueror does not crash when closing fast a tab. (Closes: #441298)

[Martin Alfke]
* Update of debian/copyright for kde 4.4

[ Modestas Vainius ]
* Bump kde-sc-dev-latest build dependency to 4.4.3.
* Confirm symbol files for 4.4.2 on hurd-i386 i386 ia64 kfreebsd-amd64
  kfreebsd-i386 mips powerpc s390 sparc.
* Release KDE SC 4.4.3 to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include <QTextStream>
47
47
#include <QRegExp>
48
48
#include <QTimer>
 
49
#include <QFrame>
49
50
 
50
51
#include "nsplugins_class_interface.h"
51
52
#include "nsplugins_instance_interface.h"
56
57
#include <X11/Xlib.h>
57
58
#include <unistd.h>
58
59
 
 
60
 
59
61
NSPluginLoader *NSPluginLoader::s_instance = 0;
60
62
int NSPluginLoader::s_refCount = 0;
61
63
 
62
64
 
63
65
NSPluginInstance::NSPluginInstance(QWidget *parent, const QString& viewerDBusId, const QString& id, const KUrl& baseUrl)
64
 
  : EMBEDCLASS(parent), _loader(0), inited(false), haveSize(false), _button(0)
 
66
  : EMBEDCLASS(parent), _loader(0), inited(false), haveSize(false), _frame(0)
65
67
{
66
68
    setWindowTitle("nsp.host"); // for debugging..
67
69
    _instanceInterface = new org::kde::nsplugins::Instance( viewerDBusId, id, QDBusConnection::sessionBus() );
80
82
                return;
81
83
            }
82
84
        }
83
 
        _button = new QPushButton(i18n("Start Plugin"), this);
84
 
        _layout->addWidget(_button, 0, 0);
85
 
        connect(_button, SIGNAL(clicked()), this, SLOT(loadPlugin()));
 
85
        _frame = new QFrame(this);
 
86
        _frame->setFrameShape(QFrame::Box);
 
87
        _frame->setFrameShadow(QFrame::Plain);
 
88
        _frame->setLineWidth(1);
 
89
        _layout->addWidget(_frame, 0, 0);
 
90
        QVBoxLayout *vlay = new QVBoxLayout(_frame);
 
91
        QPushButton *startPluginButton = new QPushButton(i18n("Start Plugin"), _frame);
 
92
        vlay->addWidget(startPluginButton);
 
93
        connect(startPluginButton, SIGNAL(clicked()), this, SLOT(loadPlugin()));
86
94
        show();
87
95
    }
88
96
}
89
97
 
90
98
void NSPluginInstance::loadPlugin()
91
99
{
92
 
    delete _button;
93
 
    _button = 0;
 
100
    delete _frame;
 
101
    _frame = 0;
94
102
    doLoadPlugin(width(), height());
95
103
}
96
104
 
97
105
void NSPluginInstance::doLoadPlugin(int w, int h) {
98
 
    if (!inited && !_button) {
 
106
    if (!inited && !_frame) {
99
107
        _loader = NSPluginLoader::instance();
100
108
        // resize before showing, some plugins are stupid and can't handle repeated
101
109
        // NPSetWindow() calls very well (viewer will avoid the call if not shown yet)
124
132
    }
125
133
}
126
134
 
127
 
void NSPluginInstance::pluginResized(int w, int h)
128
 
{
129
 
    kDebug() << w << h;
130
 
    haveSize = true;
131
 
    embedIfNeeded(w, h);
132
 
}
133
 
 
134
135
void NSPluginInstance::embedIfNeeded(int w, int h)
135
136
{
136
137
    if (isVisible()) {
145
146
{
146
147
    kDebug() << width() << height() << isVisible() << haveSize << inited;
147
148
    EMBEDCLASS::resizeEvent(event);
 
149
    haveSize = true;
148
150
 
149
151
    embedIfNeeded(width(), height());
150
152
}
378
380
   // get viewer dcop interface
379
381
   _viewer = new org::kde::nsplugins::Viewer( _viewerDBusId, "/Viewer", QDBusConnection::sessionBus() );
380
382
 
 
383
   // make sure we have the types setup
 
384
   kdeNsPluginViewer::initDBusTypes();
 
385
 
381
386
   return _viewer!=0;
382
387
}
383
388