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
This commit is contained in:
Julien Wadel 2020-09-16 10:22:42 +02:00
parent 85b09ee908
commit d54ebbcc59
8 changed files with 140 additions and 25 deletions

View file

@ -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 $<TARGET_OBJECTS:${APP_LIBRARY}> ${ASSETS_DIR}/app-icon.rc ${MAIN_FILE} ${QRC_BIG_RESOURCES})
add_executable(${TARGET_NAME} WIN32 $<TARGET_OBJECTS:${APP_LIBRARY}> ${MAIN_FILE} ${QRC_BIG_RESOURCES} ${RC_FILE})
if(TARGET_NAME_ONLY)
add_executable(${TARGET_NAME_ONLY} WIN32 EXCLUDE_FROM_ALL $<TARGET_OBJECTS:${APP_LIBRARY_ONLY}> ${ASSETS_DIR}/app-icon.rc ${MAIN_FILE} ${QRC_BIG_RESOURCES})
add_executable(${TARGET_NAME_ONLY} WIN32 EXCLUDE_FROM_ALL $<TARGET_OBJECTS:${APP_LIBRARY_ONLY}> ${MAIN_FILE} ${QRC_BIG_RESOURCES} ${RC_FILE})
endif()
else ()
add_executable(${TARGET_NAME} $<TARGET_OBJECTS:${APP_LIBRARY}> ${MAIN_FILE} ${QRC_BIG_RESOURCES})
@ -513,3 +522,6 @@ source_group(
source_group(
"Lang" REGULAR_EXPRESSION ".+\.ts$"
)
source_group(
"Rc" REGULAR_EXPRESSION ".+\.rc$"
)

View file

@ -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

View file

@ -43,6 +43,8 @@
<string>sip-linphone</string>
<string>sips</string>
<string>sips-linphone</string>
<string>tel</string>
<string>callto</string>
</array>
</dict>
</array>

View file

@ -0,0 +1,40 @@
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "assets/icon.ico"
# if defined(UNDER_CE)
# include <winbase.h>
# else
# include <winver.h>
# 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 */

View file

@ -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"

View file

@ -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"

View file

@ -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;

View file

@ -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`.")