Index: /applications/editors/josm/plugins/wmsplugin/Makefile
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/Makefile	(revision 13261)
+++ /applications/editors/josm/plugins/wmsplugin/Makefile	(revision 13262)
@@ -1,10 +1,14 @@
 #!/usr/bin/make
+
+MOC=moc
+#MOC=/usr/share/qt4/bin/moc
+CFLAGS  =
 LDFLAGS = `pkg-config --libs --cflags QtCore QtGui QtWebKit`
 
-compile: webkit-image.cpp webkit-image.h
-	g++ -W -o webkit-image -I/usr/include/qt4/ -O2 $(LDFLAGS) webkit-image.cpp
+webkit-image: webkit-image.cpp webkit-image.h
+	g++ -W -o $@ -O2 $(CFLAGS) $(LDFLAGS) webkit-image.cpp
 
 webkit-image.h: webkit-image.cpp
-	/usr/share/qt4/bin/moc webkit-image.cpp >webkit-image.h 
+	$(MOC) webkit-image.cpp >$@
 
 clean:
Index: /applications/editors/josm/plugins/wmsplugin/webkit-image.cpp
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/webkit-image.cpp	(revision 13261)
+++ /applications/editors/josm/plugins/wmsplugin/webkit-image.cpp	(revision 13262)
@@ -13,4 +13,6 @@
 #include <QtWebKit/QWebPage>
 #include <QtWebKit/QWebFrame>
+#include <QtNetwork/QNetworkProxy>
+#include <QtCore/QProcess>
 
 /* using mingw to set binary mode */
@@ -70,4 +72,28 @@
   Save * s = new Save(page);
 
+  QStringList environment = QProcess::systemEnvironment();
+  int idx = environment.indexOf(QRegExp("http_proxy=.*"));
+  if(idx != -1)
+  {
+     QString proxyHost;
+     int proxyPort = 8080;
+     QStringList tmpList = environment.at(idx).split("=");
+     QStringList host_port = tmpList.at(1).split(":");
+     proxyHost = host_port.at(0);
+     if(host_port.size() == 2)
+     {
+       bool ok;
+       int port = host_port.at(1).toInt(&ok);
+       if(ok)
+         proxyPort = port;
+     }
+
+     QNetworkProxy proxy;
+     proxy.setType(QNetworkProxy::HttpCachingProxy);
+     proxy.setHostName(proxyHost);
+     proxy.setPort(proxyPort);
+     page->networkAccessManager()->setProxy(proxy);
+  }
+
   QObject::connect(page, SIGNAL(loadFinished(bool)), s, SLOT(loaded(bool)));
   QObject::connect(s, SIGNAL(finish(void)), &a, SLOT(quit()));
