Package: zotero-standalone-build / 4.0.29.16+dfsg-1

messagebox.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Description: Fix FTBFS related to obsolete MessageBox API
Author: Sébastien Villemot <sebastien@debian.org>
Forwarded: no
Last-Update: 2015-12-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/zotero-standalone-build/modules/zotero-libreoffice-integration/build/source/org/zotero/integration/ooo/comp/Document.java
+++ b/zotero-standalone-build/modules/zotero-libreoffice-integration/build/source/org/zotero/integration/ooo/comp/Document.java
@@ -142,10 +142,6 @@ public class Document {
         XWindowPeer xWindow = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, frame.getContainerWindow());
         XMessageBoxFactory xToolkit = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, xWindow.getToolkit());
         XMessageBox box;
-        int majorVersion = Integer.parseInt(Application.ooVersion.substring(0, 1));
-        if(majorVersion > 4 ||
-           (majorVersion == 4 && (Application.ooName.equals("OpenOffice") ||
-        		                  Integer.parseInt(Application.ooVersion.substring(2, 3)) >= 2))) {
         	// CreateMessageBox method differs in AOO 4+ and LO 4.1+, so get it using reflection
         	try {
         		Class MessageBoxTypeClass = (Class<Enum>) Class.forName("com.sun.star.awt.MessageBoxType");
@@ -162,10 +158,6 @@ public class Document {
         		e.printStackTrace();
         		return 0;
         	}
-        } else {
-        	String[] boxTypes = {"errorbox", "messbox", "warningbox"};
-        	box = xToolkit.createMessageBox(xWindow, new Rectangle(), boxTypes[icon], ooButtons, "Zotero Integration", text);
-        }
         short result = box.execute();
 		
 		if(buttons == 2) {
@@ -513,4 +505,4 @@ public class Document {
     	e.printStackTrace(new PrintWriter(sw));
     	return "An error occurred communicating with Zotero:\n"+sw.toString();
     }
-}
\ No newline at end of file
+}
--- a/zotero-standalone-build/modules/zotero-libreoffice-integration/build/source/org/zotero/integration/ooo/comp/SaveEventListener.java
+++ b/zotero-standalone-build/modules/zotero-libreoffice-integration/build/source/org/zotero/integration/ooo/comp/SaveEventListener.java
@@ -3,6 +3,7 @@ package org.zotero.integration.ooo.comp;
 import java.util.Hashtable;
 
 import com.sun.star.awt.MessageBoxButtons;
+import com.sun.star.awt.MessageBoxType;
 import com.sun.star.awt.Rectangle;
 import com.sun.star.awt.XMessageBox;
 import com.sun.star.awt.XMessageBoxFactory;
@@ -36,7 +37,7 @@ class SaveEventListener implements XEven
 			XFrame frame = Application.desktop.getCurrentFrame();
 			XWindowPeer xWindow = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, frame.getContainerWindow());
 	        XMessageBoxFactory xToolkit = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, xWindow.getToolkit());
-			XMessageBox box = xToolkit.createMessageBox(xWindow, new Rectangle(), "warningBox",
+			XMessageBox box = xToolkit.createMessageBox(xWindow, MessageBoxType.WARNINGBOX,
 					MessageBoxButtons.BUTTONS_OK, "Zotero Integration",
 					Document.SAVE_WARNING_STRING);
 			box.execute();