summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2011-12-19 16:37:06 +0100
committerMatúš Kukan <matus.kukan@gmail.com>2011-12-21 13:52:32 +0100
commit6c6055750dd4c0ddcff06fcf5b6d93d576245633 (patch)
treeaacbe5afbf1ef34823df3d6b76ee58f9e439260c /extensions
parentextensions: bin unused files (diff)
downloadcore-6c6055750dd4c0ddcff06fcf5b6d93d576245633.tar.gz
core-6c6055750dd4c0ddcff06fcf5b6d93d576245633.zip
move onlinecheck.cxx from sal to extensions
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Library_updchk.mk5
-rw-r--r--extensions/source/update/check/onlinecheck.cxx69
-rw-r--r--extensions/source/update/check/updatecheck.cxx33
3 files changed, 79 insertions, 28 deletions
diff --git a/extensions/Library_updchk.mk b/extensions/Library_updchk.mk
index a16f2a2e6160..c5286de8e08d 100644
--- a/extensions/Library_updchk.mk
+++ b/extensions/Library_updchk.mk
@@ -51,6 +51,11 @@ ifeq ($(OS),WNT)
$(eval $(call gb_Library_add_linked_libs,updchk,\
ole32 \
shell32 \
+ wininet \
+))
+
+$(eval $(call gb_Library_add_exception_objects,updchk,\
+ extensions/source/update/check/onlinecheck \
))
endif # OS WNT
diff --git a/extensions/source/update/check/onlinecheck.cxx b/extensions/source/update/check/onlinecheck.cxx
new file mode 100644
index 000000000000..0a765399cce3
--- /dev/null
+++ b/extensions/source/update/check/onlinecheck.cxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma warning( disable: 4668 )
+#endif
+
+#include <sal/types.h>
+#include <sal/macros.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <wininet.h>
+
+#ifdef UNICODE
+#define _UNICODE
+#endif
+#include <tchar.h>
+
+// #i71984
+extern "C" bool SAL_CALL WNT_hasInternetConnection()
+{
+ DWORD dwFlags;
+ TCHAR szConnectionName[1024];
+
+#ifndef __MINGW32__
+ __try {
+#endif
+ BOOL fIsConnected = InternetGetConnectedStateEx(
+ &dwFlags,
+ szConnectionName,
+ SAL_N_ELEMENTS(szConnectionName),
+ 0 );
+
+ return fIsConnected ? true : false;
+
+#ifndef __MINGW32__
+ } __except( EXCEPTION_EXECUTE_HANDLER ) {
+ return false;
+ }
+#endif
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index 66acb883033a..d0b204a3be3a 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -85,6 +85,7 @@ namespace uno = com::sun::star::uno ;
#define PROPERTY_DEFAULT_TEXT UNISTRING("DefaultText")
#define PROPERTY_SHOW_MENUICON UNISTRING("MenuIconVisible")
+extern "C" bool SAL_CALL WNT_hasInternetConnection();
//------------------------------------------------------------------------------
// Returns the URL of the release note for the given position
@@ -267,9 +268,11 @@ private:
/* Used to avoid dialup login windows (on platforms we know how to double this) */
inline bool hasInternetConnection() const
{
- if(m_pHasInternetConnection != NULL )
- return (sal_True == m_pHasInternetConnection());
+#ifdef WNT
+ return WNT_hasInternetConnection();
+#else
return true;
+#endif
}
/* Creates a new instance of UpdateInformationProvider and returns this instance */
@@ -295,10 +298,6 @@ protected:
osl::Condition& m_aCondition;
private:
-
-// const
- OnlineCheckFunc m_pHasInternetConnection;
-
const uno::Reference<uno::XComponentContext> m_xContext;
uno::Reference<deployment::XUpdateInformationProvider> m_xProvider;
};
@@ -373,30 +372,8 @@ private:
UpdateCheckThread::UpdateCheckThread( osl::Condition& rCondition,
const uno::Reference<uno::XComponentContext>& xContext ) :
m_aCondition(rCondition),
- m_pHasInternetConnection(NULL),
m_xContext(xContext)
{
-
-#ifdef WNT
- rtl::OUString aPath;
- if( osl_getExecutableFile(&aPath.pData) == osl_Process_E_None )
- {
- sal_uInt32 lastIndex = aPath.lastIndexOf('/');
- if ( lastIndex > 0 )
- {
- aPath = aPath.copy( 0, lastIndex+1 );
- aPath += UNISTRING( "onlinecheck" );
- }
-
- if ( m_aModule.load(aPath) )
- {
- m_pHasInternetConnection =
- reinterpret_cast < OnlineCheckFunc > (
- m_aModule.getFunctionSymbol( UNISTRING("hasInternetConnection")));
- }
- }
-#endif
-
createSuspended();
// actually run the thread