From d54ebbcc598a834d4e6ea4c0fb05fba9a019cee6 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 16 Sep 2020 10:22:42 +0200 Subject: [PATCH] Fix : sip protocol handlers on Windows and add support to tel and callto protocols on Windows/Linux/Mac - Replace app-icon by a specific windows file that describe the application properties - Add Windows Description file - Update NSIS Installation/Uninstallation to support handlers (sip, sip-linphone, sips, sips-linphone, tel and callto) - Cleaner use of Windows registries --- linphone-app/CMakeLists.txt | 16 +++- linphone-app/assets/linphone.desktop.cmake | 2 +- .../linphone_package/macos/Info.plist.in | 2 + .../windows/appDetailsWindows.rc.in | 40 +++++++++ .../linphone_package/windows/install.nsi.in | 82 +++++++++++++++---- .../linphone_package/windows/uninstall.nsi.in | 19 ++++- linphone-app/src/app/App.cpp | 2 +- linphone-app/src/app/cli/Cli.cpp | 2 +- 8 files changed, 140 insertions(+), 25 deletions(-) create mode 100644 linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index 14f6bae7d..44feef871 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -33,6 +33,7 @@ bc_parse_full_version("${FULL_VERSION}" version_major version_minor version_patc project(linphoneqt VERSION "${version_major}.${version_minor}.${version_patch}") + if(ENABLE_BUILD_VERBOSE) #message("CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}") message("Options : ${ENABLE_UPDATE_CHECK}, ${ENABLE_UNIT_TESTS}, ${ENABLE_TESTS}, ${ENABLE_TESTS_COMPONENTS}, ${ENABLE_TOOLS}, ${ENABLE_STRICT}, ${ENABLE_FFMPEG}, ${ENABLE_OPUS}") @@ -370,15 +371,23 @@ list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_F get_directory_property(TS_FILES DIRECTORY "${LANGUAGES_DIRECTORY}" DEFINITION TS_FILES) list(APPEND SOURCES ${TS_FILES}) +# set application details +if(WIN32) + string(TIMESTAMP CURRENT_YEAR "%Y") + set(COPYRIGTH_RANGE_DATE "2010-${CURRENT_YEAR}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/appDetailsWindows.rc") + set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/appDetailsWindows.rc) +endif() + add_library(${APP_LIBRARY} OBJECT ${SOURCES} ${HEADERS} ${QML_SOURCES} ${QRC_RESOURCES}) #add_library(${APP_LIBRARY} OBJECT ${SOURCES} ${HEADERS} ${QML_SOURCES}) if(TARGET_NAME_ONLY) add_library(${APP_LIBRARY_ONLY} OBJECT EXCLUDE_FROM_ALL ${SOURCES} ${HEADERS} ${QML_SOURCES}}) endif() if (WIN32) - add_executable(${TARGET_NAME} WIN32 $ ${ASSETS_DIR}/app-icon.rc ${MAIN_FILE} ${QRC_BIG_RESOURCES}) + add_executable(${TARGET_NAME} WIN32 $ ${MAIN_FILE} ${QRC_BIG_RESOURCES} ${RC_FILE}) if(TARGET_NAME_ONLY) - add_executable(${TARGET_NAME_ONLY} WIN32 EXCLUDE_FROM_ALL $ ${ASSETS_DIR}/app-icon.rc ${MAIN_FILE} ${QRC_BIG_RESOURCES}) + add_executable(${TARGET_NAME_ONLY} WIN32 EXCLUDE_FROM_ALL $ ${MAIN_FILE} ${QRC_BIG_RESOURCES} ${RC_FILE}) endif() else () add_executable(${TARGET_NAME} $ ${MAIN_FILE} ${QRC_BIG_RESOURCES}) @@ -513,3 +522,6 @@ source_group( source_group( "Lang" REGULAR_EXPRESSION ".+\.ts$" ) +source_group( + "Rc" REGULAR_EXPRESSION ".+\.rc$" + ) diff --git a/linphone-app/assets/linphone.desktop.cmake b/linphone-app/assets/linphone.desktop.cmake index f6bd88b91..23f3b6b9f 100644 --- a/linphone-app/assets/linphone.desktop.cmake +++ b/linphone-app/assets/linphone.desktop.cmake @@ -7,5 +7,5 @@ Exec=@EXECUTABLE_NAME@ %u Icon=@EXECUTABLE_NAME@ Terminal=false Categories=Network;Telephony; -MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips; +MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips;x-scheme-handler/tel;x-scheme-handler/callto; X-PulseAudio-Properties=media.role=phone diff --git a/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in b/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in index fb7c0cb1d..bab2f6e76 100644 --- a/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in +++ b/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in @@ -43,6 +43,8 @@ sip-linphone sips sips-linphone + tel + callto diff --git a/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in b/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in new file mode 100644 index 000000000..3495f1f9c --- /dev/null +++ b/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in @@ -0,0 +1,40 @@ +A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "assets/icon.ico" + +# if defined(UNDER_CE) +# include +# else +# include +# endif + +VS_VERSION_INFO VERSIONINFO + PRODUCTVERSION ${version_major},${version_minor},${version_patch},0 + FILEVERSION ${version_major},${version_minor},${version_patch},${identifiers} + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "${APPLICATION_VENDOR}\0" + VALUE "FileDescription", "${APPLICATION_NAME} - ${APPLICATION_DESCRIPTION}\0" + VALUE "FileVersion", "${FULL_VERSION}" + VALUE "ProductVersion", "${version_major}.${version_minor}.${version_patch}\0" + VALUE "LegalCopyright", "Copyright (C) ${COPYRIGTH_RANGE_DATE} ${APPLICATION_VENDOR} ${APPLICATION_URL}\0" + VALUE "OriginalFilename", "${EXECUTABLE_NAME}.exe\0" + VALUE "ProductName", "${APPLICATION_NAME}\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END +/* End of Version info */ \ No newline at end of file diff --git a/linphone-app/cmake_builder/linphone_package/windows/install.nsi.in b/linphone-app/cmake_builder/linphone_package/windows/install.nsi.in index 8502a5a58..866e925fc 100644 --- a/linphone-app/cmake_builder/linphone_package/windows/install.nsi.in +++ b/linphone-app/cmake_builder/linphone_package/windows/install.nsi.in @@ -1,27 +1,77 @@ + +# Application details + +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@" "" "" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@" "" "" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities" "ApplicationDescription" "@APPLICATION_DESCRIPTION@" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities" "ApplicationName" "@APPLICATION_NAME@" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities" "FriendlyAppName" "@APPLICATION_NAME@" +WriteRegStr HKLM "SOFTWARE\RegisteredApplications" "@APPLICATION_NAME@" "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities" +WriteRegStr HKLM "SOFTWARE\IM Providers\@APPLICATION_NAME@" "ProcessName" "@EXECUTABLE_NAME@.exe" +WriteRegStr HKLM "SOFTWARE\IM Providers\@APPLICATION_NAME@" "FriendlyName" "@APPLICATION_NAME@" + + +# PROTOCOL declaration + WriteRegStr HKCR "sip" "" "URL:sip Protocol" WriteRegStr HKCR "sip" "URL Protocol" "" -WriteRegStr HKCR "sip\DefaultIcon" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe" -WriteRegStr HKCR "sip\shell" "" "open" -WriteRegStr HKCR "sip\shell\open" "" "command" -WriteRegStr HKCR "sip\shell\open\command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" WriteRegStr HKCR "sip-linphone" "" "URL:sip-linphone Protocol" WriteRegStr HKCR "sip-linphone" "URL Protocol" "" -WriteRegStr HKCR "sip-linphone\DefaultIcon" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe" -WriteRegStr HKCR "sip-linphone\shell" "" "open" -WriteRegStr HKCR "sip-linphone\shell\open" "" "command" -WriteRegStr HKCR "sip-linphone\shell\open\command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" WriteRegStr HKCR "sips" "" "URL:sips Protocol" WriteRegStr HKCR "sips" "URL Protocol" "" -WriteRegStr HKCR "sips\DefaultIcon" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe" -WriteRegStr HKCR "sips\shell" "" "open" -WriteRegStr HKCR "sips\shell\open" "" "command" -WriteRegStr HKCR "sips\shell\open\command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" WriteRegStr HKCR "sips-linphone" "" "URL:sips-linphone Protocol" WriteRegStr HKCR "sips-linphone" "URL Protocol" "" -WriteRegStr HKCR "sips-linphone\DefaultIcon" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe" -WriteRegStr HKCR "sips-linphone\shell" "" "open" -WriteRegStr HKCR "sips-linphone\shell\open" "" "command" -WriteRegStr HKCR "sips-linphone\shell\open\command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" + +WriteRegStr HKCR "tel" "" "URL:tel Protocol" +WriteRegStr HKCR "tel" "URL Protocol" "" + +WriteRegStr HKCR "callto" "" "URL:callto Protocol" +WriteRegStr HKCR "callto" "URL Protocol" "" + + +# Application protocol handlers + +## SIP +WriteRegStr HKCR "@APPLICATION_NAME@.sip" "" "@APPLICATION_NAME@ sip Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.sip\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sip\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sip\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "sip" "@APPLICATION_NAME@.sip" + +## SIP-LINPHONE +WriteRegStr HKCR "@APPLICATION_NAME@.sip-linphone" "" "@APPLICATION_NAME@ sip-linphone Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.sip-linphone\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sip-linphone\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sip-linphone\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "sip-linphone" "@APPLICATION_NAME@.sip-linphone" + +## SIPS +WriteRegStr HKCR "@APPLICATION_NAME@.sips" "" "@APPLICATION_NAME@ sips Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.sips\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sips\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sips\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "sips" "@APPLICATION_NAME@.sips" + +## SIPS-LINPHONE +WriteRegStr HKCR "@APPLICATION_NAME@.sips-linphone" "" "@APPLICATION_NAME@ sips-linphone Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.sips-linphone\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sips-linphone\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.sips-linphone\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "sips-linphone" "@APPLICATION_NAME@.sips-linphone" + +## TEL +WriteRegStr HKCR "@APPLICATION_NAME@.tel" "" "@APPLICATION_NAME@ tel Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.tel\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.tel\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.tel\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "tel" "@APPLICATION_NAME@.tel" + +## CALLTO +WriteRegStr HKCR "@APPLICATION_NAME@.callto" "" "@APPLICATION_NAME@ callto Protocol" +WriteRegStr HKCR "@APPLICATION_NAME@.callto\Shell" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.callto\Shell\Open" "" "" +WriteRegStr HKCR "@APPLICATION_NAME@.callto\Shell\Open\Command" "" "$INSTDIR\bin\@EXECUTABLE_NAME@.exe $\"%1$\"" +WriteRegStr HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@\Capabilities\URLAssociations" "callto" "@APPLICATION_NAME@.callto" diff --git a/linphone-app/cmake_builder/linphone_package/windows/uninstall.nsi.in b/linphone-app/cmake_builder/linphone_package/windows/uninstall.nsi.in index b295e9470..1f288ba0e 100644 --- a/linphone-app/cmake_builder/linphone_package/windows/uninstall.nsi.in +++ b/linphone-app/cmake_builder/linphone_package/windows/uninstall.nsi.in @@ -5,7 +5,18 @@ Abort notRunningInUninstall: -DeleteRegKey HKCR "sip" -DeleteRegKey HKCR "sip-linphone" -DeleteRegKey HKCR "sips" -DeleteRegKey HKCR "sips-linphone" +## Application + +DeleteRegKey HKLM "SOFTWARE\IM Providers\@APPLICATION_NAME@" +DeleteRegKey HKLM "SOFTWARE\@APPLICATION_VENDOR@\@APPLICATION_NAME@" +DeleteRegValue HKLM "SOFTWARE\RegisteredApplications" "@APPLICATION_NAME@" + +## Handlers + +DeleteRegKey HKCR "@APPLICATION_NAME@.sip" +DeleteRegKey HKCR "@APPLICATION_NAME@.sip-linphone" +DeleteRegKey HKCR "@APPLICATION_NAME@.sips" +DeleteRegKey HKCR "@APPLICATION_NAME@.sips-linphone" +DeleteRegKey HKCR "@APPLICATION_NAME@.tel" +DeleteRegKey HKCR "@APPLICATION_NAME@.callto" + diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index 5a50057ca..7342eab24 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -726,7 +726,7 @@ void App::setAutoStart (bool enabled) { "Icon=\n" "Terminal=false\n" "Categories=Network;Telephony;\n" - "MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips;\n" + "MimeType=x-scheme-handler/sip-linphone;x-scheme-handler/sip;x-scheme-handler/sips-linphone;x-scheme-handler/sips;x-scheme-handler/tel;x-scheme-handler/callto;\n" ); mAutoStart = enabled; diff --git a/linphone-app/src/app/cli/Cli.cpp b/linphone-app/src/app/cli/Cli.cpp index 63bf7ded3..a3542a8ce 100644 --- a/linphone-app/src/app/cli/Cli.cpp +++ b/linphone-app/src/app/cli/Cli.cpp @@ -383,7 +383,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) { } string scheme = address->getScheme(); - for (const string &validScheme : { "sip", "sip-linphone", "sips", "sips-linphone" }) + for (const string &validScheme : { "sip", "sip-linphone", "sips", "sips-linphone", "tel", "callto" }) if (scheme == validScheme) goto success; qWarning() << QStringLiteral("Not a valid uri: `%1` Unsupported scheme: `%2`.")