Hi all,

IMHO, the proxy support of QLandkarte GT is a little confusing and could be 
improved.

(1) The option "manual configuration" implies that the application will auto-detect a system-wide 
configuration.  Unfortunately, this is not the case.  I attach a small patch which *seems* to detect the standard 
"HTTP_PROXY" and "https_proxy" environment variables correctly if the "manual 
configuration" is inactive.  No being a c++ programmer, I have no idea if the code is correct, produces a leak or 
a bad karma.  Sorry in advance for any glitches...

(2) The entries "URL" and "Port" in the config dialogue are confusing.  An URL is something like 
"scheme://user:passw...@host:port/more/stuff" (see [1]).  Thus, in case of a proxy like squid, URL (or URI according to RFC3986) is 
"http://my.server.com:3128";.  But the entry "URL" actually wants only the /host/ here.  It took me half an hour (o.k., I didn't 
try to read any docs...) to find that out.  Thus I suggest to rename the entry to "Host", unless you want to have one single 
"URI" entry as a replacement instead of host (!) and port.  I would prefer the URI as it is closer to the environment variable, but in the 
end it's a matter of taste.

(3) I might be a good idea to add a check box and two entries to support 
proxies which need authentication:

    [ ] Proxy needs authentication
    User name ___________   Password __________

However, it is of course a no-no to store the password in the user's config 
file.  No idea if Qt has a method to easily access a secure storage (like kde's 
wallet or gnome's keyring).


Comments?

Best, Albrecht.


[1] <http://tools.ietf.org/html/rfc3986>
Index: CPackConfig.cmake
===================================================================
--- CPackConfig.cmake	(Revision 2186)
+++ CPackConfig.cmake	(Arbeitskopie)
@@ -1,27 +1,83 @@
-include(InstallRequiredSystemLibraries)
+# This file will be configured to contain variables for CPack. These variables
+# should be set in the CMake list file of the project before CPack module is
+# included. Example variables are:
+#   CPACK_GENERATOR                     - Generator used to create package
+#   CPACK_INSTALL_CMAKE_PROJECTS        - For each project (path, name, component)
+#   CPACK_CMAKE_GENERATOR               - CMake Generator used for the projects
+#   CPACK_INSTALL_COMMANDS              - Extra commands to install components
+#   CPACK_INSTALL_DIRECTORIES           - Extra directories to install
+#   CPACK_PACKAGE_DESCRIPTION_FILE      - Description file for the package
+#   CPACK_PACKAGE_DESCRIPTION_SUMMARY   - Summary of the package
+#   CPACK_PACKAGE_EXECUTABLES           - List of pairs of executables and labels
+#   CPACK_PACKAGE_FILE_NAME             - Name of the package generated
+#   CPACK_PACKAGE_ICON                  - Icon used for the package
+#   CPACK_PACKAGE_INSTALL_DIRECTORY     - Name of directory for the installer
+#   CPACK_PACKAGE_NAME                  - Package project name
+#   CPACK_PACKAGE_VENDOR                - Package project vendor
+#   CPACK_PACKAGE_VERSION               - Package project version
+#   CPACK_PACKAGE_VERSION_MAJOR         - Package project version (major)
+#   CPACK_PACKAGE_VERSION_MINOR         - Package project version (minor)
+#   CPACK_PACKAGE_VERSION_PATCH         - Package project version (patch)
 
-# For help take a look at:
-# http://www.cmake.org/Wiki/CMake:CPackConfiguration
+# There are certain generator specific ones
 
-### general settings
-string(TOLOWER ${APPLICATION_NAME} CPACK_PACKAGE_NAME)
-set(CPACK_PACKAGE_VENDOR "QLandkarte")
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GPS Map, Route, Waypoint and Tracking Tool")
+# NSIS Generator:
+#   CPACK_PACKAGE_INSTALL_REGISTRY_KEY  - Name of the registry key for the installer
+#   CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall
+#   CPACK_NSIS_EXTRA_INSTALL_COMMANDS   - Extra commands used during install
 
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
 
-### versions
-# set(CPACK_PACKAGE_VERSION_MAJOR "0")
-# set(CPACK_PACKAGE_VERSION_MINOR "9")
-# set(CPACK_PACKAGE_VERSION_PATCH "3")
-set(CPACK_PACKAGE_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
-
-set(CPACK_GENERATOR "TGZ")
-set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
-
-### source package settings
-set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
-
-include(CPack)
+SET(CPACK_BINARY_BUNDLE "")
+SET(CPACK_BINARY_CYGWIN "")
+SET(CPACK_BINARY_DEB "")
+SET(CPACK_BINARY_DRAGNDROP "")
+SET(CPACK_BINARY_NSIS "")
+SET(CPACK_BINARY_OSXX11 "")
+SET(CPACK_BINARY_PACKAGEMAKER "")
+SET(CPACK_BINARY_RPM "")
+SET(CPACK_BINARY_STGZ "")
+SET(CPACK_BINARY_TBZ2 "")
+SET(CPACK_BINARY_TGZ "")
+SET(CPACK_BINARY_TZ "")
+SET(CPACK_BINARY_ZIP "")
+SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
+SET(CPACK_COMPONENTS_ALL "")
+SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE")
+SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE")
+SET(CPACK_GENERATOR "TGZ")
+SET(CPACK_INSTALL_CMAKE_PROJECTS "/home/albrecht/Neues/QLandkarteGT;QLandkarteGT;ALL;/")
+SET(CPACK_INSTALL_PREFIX "/usr/local")
+SET(CPACK_MODULE_PATH "/home/albrecht/Neues/QLandkarteGT/cmake/Modules")
+SET(CPACK_NSIS_DISPLAY_NAME "qlandkartegt-0.18.3.post")
+SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
+SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+SET(CPACK_NSIS_PACKAGE_NAME "qlandkartegt-0.18.3.post")
+SET(CPACK_OUTPUT_CONFIG_FILE "/home/albrecht/Neues/QLandkarteGT/CPackConfig.cmake")
+SET(CPACK_PACKAGE_DEFAULT_LOCATION "/")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake-2.8/Templates/CPack.GenericDescription.txt")
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GPS Map, Route, Waypoint and Tracking Tool")
+SET(CPACK_PACKAGE_FILE_NAME "qlandkartegt-0.18.3.post-Linux")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "qlandkartegt-0.18.3.post")
+SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "qlandkartegt 0.18.3.post")
+SET(CPACK_PACKAGE_NAME "qlandkartegt")
+SET(CPACK_PACKAGE_RELOCATABLE "true")
+SET(CPACK_PACKAGE_VENDOR "QLandkarte")
+SET(CPACK_PACKAGE_VERSION "0.18.3.post")
+SET(CPACK_PACKAGE_VERSION_MAJOR "0")
+SET(CPACK_PACKAGE_VERSION_MINOR "1")
+SET(CPACK_PACKAGE_VERSION_PATCH "1")
+SET(CPACK_RESOURCE_FILE_LICENSE "/home/albrecht/Neues/QLandkarteGT/LICENSE")
+SET(CPACK_RESOURCE_FILE_README "/usr/share/cmake-2.8/Templates/CPack.GenericDescription.txt")
+SET(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake-2.8/Templates/CPack.GenericWelcome.txt")
+SET(CPACK_SET_DESTDIR "OFF")
+SET(CPACK_SOURCE_CYGWIN "")
+SET(CPACK_SOURCE_GENERATOR "TGZ")
+SET(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*")
+SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/home/albrecht/Neues/QLandkarteGT/CPackSourceConfig.cmake")
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "qlandkartegt-0.18.3.post")
+SET(CPACK_SOURCE_TBZ2 "")
+SET(CPACK_SOURCE_TGZ "")
+SET(CPACK_SOURCE_TZ "")
+SET(CPACK_SOURCE_ZIP "")
+SET(CPACK_SYSTEM_NAME "Linux")
+SET(CPACK_TOPLEVEL_TAG "Linux")
Index: src/CResources.cpp
===================================================================
--- src/CResources.cpp	(Revision 2186)
+++ src/CResources.cpp	(Arbeitskopie)
@@ -154,6 +154,22 @@
 
 bool CResources::getHttpProxy(QString& url, quint16& port)
 {
+    const char *proxy;
+
+    // unless a manual proxy is configured, use the environment settings "HTTP_PROXY" or "http_proxy"
+    if (!m_useHttpProxy && ((proxy = getenv("HTTP_PROXY")) || (proxy = getenv("http_proxy"))))
+    {
+	QString theProxy(proxy);
+	QRegExp re("^http://([^:]+):(\\d+)$", Qt::CaseInsensitive);
+	if (re.indexIn(theProxy) != -1)
+	{
+	    qDebug() << "http proxy host" << re.cap(1) << "port" << re.cap(2);
+	    url = re.cap(1);
+	    port = re.cap(2).toInt();
+	    return true;
+	}
+    }
+
     url  = m_httpProxy;
     port = m_httpProxyPort;
     return m_useHttpProxy;

Attachment: pgpscHeLcZghr.pgp
Description: PGP signature

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QLandkarte-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkarte-users

Reply via email to