[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase/nsplugins
From: George Staikos <staikos () kde ! org>
Date: 2004-01-27 4:08:17
Message-ID: 20040127040817.A3C03976E () office ! kde ! org
[Download RAW message or body]
CVS commit by staikos:
Implement Save As for nsplugins when viewing in non-embedded mode. Will not
be implemented in embedded mode due to semantics, though theoretically it
*could* be done if someone made a submenu that listed all the embeds and had
menus for each of those. Not worth it IMHO, so that's a WONTFIX as far as I'm
concerned.
CCMAIL: 71023-done@bugs.kde.org
A nspluginpart.rc 1.1
M +3 -0 Makefile.am 1.41
M +38 -20 plugin_part.cpp 1.54
M +1 -0 plugin_part.h 1.27
--- kdebase/nsplugins/Makefile.am #1.40:1.41
@@ -25,4 +25,7 @@
xdg_apps_DATA = khtml_plugins.desktop
+partrcdir = $(kde_datadir)/plugin
+partrc_DATA = nspluginpart.rc
+
messages:
$(EXTRACTRC) `find . -name *.ui` > rc.cpp
--- kdebase/nsplugins/plugin_part.cpp #1.53:1.54
@@ -1,16 +1,17 @@
-#include <kapplication.h>
-#include <klocale.h>
+#include <dcopclient.h>
#include <kaboutdata.h>
+#include <kaction.h>
+#include <kapplication.h>
#include <kdebug.h>
-#include <dcopclient.h>
-#include <qlabel.h>
-
+#include <kfiledialog.h>
+#include <kio/netaccess.h>
+#include <klocale.h>
#include <kparts/browserinterface.h>
#include <kparts/browserextension.h>
-#include "nspluginloader.h"
+#include <qlabel.h>
+#include "nspluginloader.h"
#include "plugin_part.h"
-#include "plugin_part.moc"
@@ -187,4 +188,11 @@ PluginPart::PluginPart(QWidget *parentWi
_liveconnect = new PluginLiveConnectExtension(this);
+ // Only create this if we have no parent since the parent part is
+ // responsible for "Save As" then
+ if (!parent || !parent->inherits("Part")) {
+ new KAction(i18n("&Save As..."), CTRL+Key_S, this, SLOT(saveAs()), \
actionCollection(), "saveDocument"); + setXMLFile("nspluginpart.rc");
+ }
+
// create
_loader = NSPluginLoader::instance();
@@ -274,9 +282,9 @@ bool PluginPart::openURL(const KURL &url
}
- _widget->resize( _canvas->width(), _canvas->height() );
+ _widget->resize(_canvas->width(), _canvas->height());
_widget->show();
kdDebug(1432) << "<- PluginPart::openURL = " << (inst!=0) << endl;
- return inst!=0;
+ return inst != 0L;
}
@@ -309,5 +317,5 @@ void PluginPart::postURL(const QString&
args.setContentType(mime);
- emit _extension->openURLRequest( new_url, args );
+ emit _extension->openURLRequest(new_url, args);
}
@@ -322,18 +330,19 @@ void PluginPart::requestURL(const QStrin
args.setDoPost(false);
- emit _extension->openURLRequest( new_url, args );
+ emit _extension->openURLRequest(new_url, args);
}
-void PluginPart::evalJavaScript( int id, const QString & script )
+void PluginPart::evalJavaScript(int id, const QString & script)
{
- if ( _widget )
- static_cast<NSPluginInstance *>((QWidget*)_widget)->javascriptResult
- ( id, _liveconnect->evalJavaScript( script ) );
+ if (_widget) {
+ QString rc = _liveconnect->evalJavaScript(script);
+ static_cast<NSPluginInstance*>((QWidget*)_widget)->javascriptResult(id, rc);
+ }
}
-void PluginPart::statusMessage( QString msg )
+void PluginPart::statusMessage(QString msg)
{
kdDebug(1422) << "PluginPart::statusMessage " << msg << endl;
- emit setStatusBarText( msg );
+ emit setStatusBarText(msg);
}
@@ -343,6 +352,7 @@ void PluginPart::pluginResized(int w, in
kdDebug(1432) << "PluginPart::pluginResized()" << endl;
- if ( _widget )
- _widget->resize( w, h );
+ if (_widget) {
+ _widget->resize(w, h);
+ }
}
@@ -353,4 +363,11 @@ void PluginPart::changeSrc(const QString
}
+
+void PluginPart::saveAs() {
+ KURL savefile = KFileDialog::getSaveURL(QString::null, QString::null, _widget);
+ KIO::NetAccess::copy(m_url, savefile, _widget);
+}
+
+
void PluginCanvasWidget::resizeEvent(QResizeEvent *ev)
{
@@ -360,2 +377,3 @@ void PluginCanvasWidget::resizeEvent(QRe
+#include "plugin_part.moc"
--- kdebase/nsplugins/plugin_part.h #1.26:1.27
@@ -99,4 +99,5 @@ protected:
protected slots:
void pluginResized(int,int);
+ void saveAs();
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic