Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser-plugin/scriptable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'browser-plugin/scriptable.cpp')
-rw-r--r--browser-plugin/scriptable.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/browser-plugin/scriptable.cpp b/browser-plugin/scriptable.cpp
index e8fbcb2..81caeb0 100644
--- a/browser-plugin/scriptable.cpp
+++ b/browser-plugin/scriptable.cpp
@@ -198,6 +198,7 @@ ScriptablePluginObject::ScriptablePluginObject (NPP npp) :
{
mTitleID = NPN_GetStringIdentifier ("title");
mZoomID = NPN_GetStringIdentifier ("zoom");
+ mCanCopyID = NPN_GetStringIdentifier ("canCopy");
mMagicWrapperID = NPN_GetStringIdentifier ("magicWrapper");
mZoomInID = NPN_GetStringIdentifier ("zoomIn");
@@ -231,6 +232,7 @@ ScriptablePluginObject::HasProperty (NPIdentifier name)
NPIdentifier properties[] = {
mTitleID,
mZoomID,
+ mCanCopyID,
mMagicWrapperID
};
@@ -261,6 +263,9 @@ ScriptablePluginObject::GetProperty (NPIdentifier name, NPVariant *result)
} else if (name == mZoomID) {
DOUBLE_TO_NPVARIANT (plugin->GetZoom(), *result);
return true;
+ } else if (name == mCanCopyID) {
+ BOOLEAN_TO_NPVARIANT (plugin->mHasSelection, *result);
+ return true;
}
return false;
@@ -310,6 +315,16 @@ ScriptablePluginObject::SetProperty (NPIdentifier name, const NPVariant *value)
plugin->SetZoom (zoom);
return true;
+ } else if (name == mCanCopyID) {
+ // FIXME fix method calls (using write access to a property as
+ // an awful workaround)
+ if (!plugin->mHasSelection) {
+ NPN_SetException (this, "Nothing to copy");
+ return false;
+ }
+
+ plugin->CopyClipboard ();
+ return true;
}
return false;