aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/clipboard.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/clipboard.js b/lib/clipboard.js
index b87c477..ea14903 100644
--- a/lib/clipboard.js
+++ b/lib/clipboard.js
@@ -108,7 +108,7 @@ function createSupportsWString() {
createInstance(Ci.nsISupportsWString);
}
-var flavorsMethod = exports.getCurrentFlavors = function flavorsMethod() {
+var flavorsMethod = exports.getCurrentFlavors = function flavorsMethod(test) {
// currently the only possible flavors in Jetpack-prototype are "plain" and
// "html", i.e., "text/plain" (or text/unicode?) and "text/html" (or
// application/xml+xhtml?)
@@ -117,13 +117,18 @@ var flavorsMethod = exports.getCurrentFlavors = function flavorsMethod() {
"text/plain": "plain",
"text/html": "html"
};
- var flavourArray = [];
-
- for (mime in possibleTypes) {
- var kSuppString = createSupportsWString();
- kSuppString.data = mime;
- // FIXME Missing some kind of if (mime in flavors) ...
- flavourArray.add(possibleTypes[mime]);
+ var flavorArray = [];
+ var clip = getClipboard();
+
+ for (var flavor in possibleTypes) {
+ var presentFlavor = clip.hasDataMatchingFlavors(
+ [flavor],
+ 1,
+ clip.kGlobalClipboard
+ );
+ if (presentFlavor) {
+ flavorArray.push(possibleTypes[flavor])
+ }
}
- return flavourArray;
-};
+ return flavorArray;
+}; \ No newline at end of file