Compare commits
170 Commits
v2.7.0-bet
...
v3.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a62628f8a | ||
|
|
772a34ba46 | ||
|
|
42ea6b5427 | ||
|
|
3ea57abfec | ||
|
|
6f2156cacd | ||
|
|
9e5225d83d | ||
|
|
957dd16770 | ||
|
|
95401e5985 | ||
|
|
a15b66d525 | ||
|
|
e0b53b3bda | ||
|
|
2015aab626 | ||
|
|
90402f8dcb | ||
|
|
0de6823cca | ||
|
|
c560db000a | ||
|
|
fba819e65b | ||
|
|
d02f1b80f3 | ||
|
|
fc79e035c6 | ||
|
|
ee332dcaec | ||
|
|
b5fc4f86a7 | ||
|
|
3ac99c75b0 | ||
|
|
a02e4a2913 | ||
|
|
a7b93e36ff | ||
|
|
a742a42f4c | ||
|
|
2537f0cd4c | ||
|
|
4e44f46b9e | ||
|
|
b86bc92875 | ||
|
|
c3b1e4bd9a | ||
|
|
3fd3f85558 | ||
|
|
811b0eb6db | ||
|
|
7acc7dae35 | ||
|
|
4c9e19b82c | ||
|
|
3770e75561 | ||
|
|
14d4160729 | ||
|
|
6dcf261abe | ||
|
|
3d3d6bf2d9 | ||
|
|
a957a9924e | ||
|
|
7de04654c5 | ||
|
|
a60fa8ba85 | ||
|
|
6ad1357ac0 | ||
|
|
48b8848dcc | ||
|
|
42f7d3e538 | ||
|
|
ce126e6d7f | ||
|
|
824e853b2a | ||
|
|
97020728c1 | ||
|
|
ff175088a3 | ||
|
|
0066de26bb | ||
|
|
68f137fff5 | ||
|
|
aa5ff75fa2 | ||
|
|
37a0474f09 | ||
|
|
802c5f0a0a | ||
|
|
d45c8aee8e | ||
|
|
2424803bdd | ||
|
|
63233bf09e | ||
|
|
493cba2e55 | ||
|
|
de3b56d999 | ||
|
|
e3c10bde59 | ||
|
|
ff60f75b2a | ||
|
|
39de633828 | ||
|
|
2ebc4041ac | ||
|
|
8a89edc1f9 | ||
|
|
cfbc343c69 | ||
|
|
1906e5aac9 | ||
|
|
662df54371 | ||
|
|
8f300ffe66 | ||
|
|
6d6cc3852b | ||
|
|
0516db5e10 | ||
|
|
cc4b12ce8b | ||
|
|
e02be629bb | ||
|
|
bc5888e8e4 | ||
|
|
480c3e6f86 | ||
|
|
d457d87c86 | ||
|
|
da814c9e44 | ||
|
|
b1a92e8db9 | ||
|
|
739edaa801 | ||
|
|
5913cdd8d6 | ||
|
|
b6826bf6ea | ||
|
|
66ede652f8 | ||
|
|
72eba2b93d | ||
|
|
73c3aa7898 | ||
|
|
16a37c6aa0 | ||
|
|
983c02b6db | ||
|
|
14ecf535f9 | ||
|
|
e89177b25b | ||
|
|
e5572faeba | ||
|
|
d2ea938ac0 | ||
|
|
0c533ca387 | ||
|
|
f3b22b33e3 | ||
|
|
cd008ffe59 | ||
|
|
3fd32e55f9 | ||
|
|
fba50c7c42 | ||
|
|
6cc1aa723e | ||
|
|
ccff6e00dc | ||
|
|
f8fb26424d | ||
|
|
a07db657d5 | ||
|
|
cd3a72822e | ||
|
|
dbdf40ea45 | ||
|
|
82c70f0c95 | ||
|
|
5ac3099b37 | ||
|
|
815cd7f3fc | ||
|
|
30f7ef319c | ||
|
|
b801a74281 | ||
|
|
8fb272a95f | ||
|
|
c3f5a9b9cc | ||
|
|
6ab55eddae | ||
|
|
f285a29463 | ||
|
|
51ce085ab5 | ||
|
|
c4e8211687 | ||
|
|
274e3491f3 | ||
|
|
d55fd09b27 | ||
|
|
b997f3e10a | ||
|
|
4cd77d96ae | ||
|
|
15b0da8904 | ||
|
|
cd91309fd8 | ||
|
|
27d08f02f4 | ||
|
|
f46276d70d | ||
|
|
15f9eeeb08 | ||
|
|
c369d33015 | ||
|
|
cfd3771818 | ||
|
|
5cfbf34501 | ||
|
|
6b8d2270c6 | ||
|
|
2c50ecd4d3 | ||
|
|
5c442af1ca | ||
|
|
62e2f64165 | ||
|
|
6bc70ddd5b | ||
|
|
bc20edc582 | ||
|
|
4656748130 | ||
|
|
ac837d19ee | ||
|
|
69a37e10ce | ||
|
|
fe7d22e4ce | ||
|
|
6c79231d1a | ||
|
|
2b97549266 | ||
|
|
a0284d07f6 | ||
|
|
19d46f0541 | ||
|
|
f8920f969f | ||
|
|
8deb38ac24 | ||
|
|
d47e570ff3 | ||
|
|
3ccac1b1be | ||
|
|
26686ecd45 | ||
|
|
4ef42e53d3 | ||
|
|
3c20b2414e | ||
|
|
1be869fdc7 | ||
|
|
8e0ab5ce47 | ||
|
|
0575d0e793 | ||
|
|
7e251edd6e | ||
|
|
2831b22be4 | ||
|
|
511a6e66dc | ||
|
|
9a4c63404d | ||
|
|
01f5501ad8 | ||
|
|
e14ae806b6 | ||
|
|
a94def0e54 | ||
|
|
f018f7df3b | ||
|
|
30a533d49c | ||
|
|
4fec77e9c0 | ||
|
|
d7a1367292 | ||
|
|
308bed0da7 | ||
|
|
a87b6157ee | ||
|
|
1e6747cd1d | ||
|
|
293be2c2e6 | ||
|
|
a9de465927 | ||
|
|
ed570d6274 | ||
|
|
00f93fdb77 | ||
|
|
82f38aa37d | ||
|
|
8e6d9401c7 | ||
|
|
2492e241ac | ||
|
|
31bc07417b | ||
|
|
c2632eb604 | ||
|
|
32b51a52ef | ||
|
|
217869e95c | ||
|
|
f90d6951c2 | ||
|
|
e32bd75519 |
25
.drone.yml
@@ -3,13 +3,13 @@ name: qt-5.12
|
||||
|
||||
steps:
|
||||
- name: build and test
|
||||
image: nextcloudci/client-5.12:client-5.12-7
|
||||
image: nextcloudci/client-5.12:client-5.12-9
|
||||
commands:
|
||||
# Install QtKeyChain
|
||||
- /bin/bash -c "
|
||||
export CC=gcc-7 &&
|
||||
export CXX=g++-7 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.8 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.9 &&
|
||||
export QTDIR=\$QT_BASE_DIR &&
|
||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
||||
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
|
||||
@@ -27,7 +27,7 @@ steps:
|
||||
- /bin/bash -c "
|
||||
export CC=gcc-7 &&
|
||||
export CXX=g++-7 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.8 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.9 &&
|
||||
export QTDIR=\$QT_BASE_DIR &&
|
||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
||||
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
|
||||
@@ -52,13 +52,13 @@ name: qt-5.12-clang
|
||||
|
||||
steps:
|
||||
- name: build and test
|
||||
image: nextcloudci/client-5.12:client-5.12-7
|
||||
image: nextcloudci/client-5.12:client-5.12-9
|
||||
commands:
|
||||
# Install QtKeyChain
|
||||
- /bin/bash -c "
|
||||
export CC=clang-6.0 &&
|
||||
export CXX=clang++-6.0 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.8 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.9 &&
|
||||
export QTDIR=\$QT_BASE_DIR &&
|
||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
||||
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
|
||||
@@ -76,7 +76,7 @@ steps:
|
||||
- /bin/bash -c "
|
||||
export CC=clang-6.0 &&
|
||||
export CXX=clang++-6.0 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.8 &&
|
||||
export QT_BASE_DIR=/opt/qt5.12.9 &&
|
||||
export QTDIR=\$QT_BASE_DIR &&
|
||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
||||
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
|
||||
@@ -89,9 +89,7 @@ steps:
|
||||
chown -R test:test . &&
|
||||
su -c 'ASAN_OPTIONS=detect_leaks=0 ctest --output-on-failure' test"
|
||||
# Static analysis with clang-tidy
|
||||
- /bin/bash -c "
|
||||
ln -s build/compile_commands.json . &&
|
||||
run-clang-tidy-6.0"
|
||||
- "! run-clang-tidy-6.0 -p build -quiet | grep -A 5 ': error:'"
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
@@ -105,10 +103,15 @@ name: AppImage
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: nextcloudci/client-5.12:client-5.12-7
|
||||
image: nextcloudci/client-5.12:client-5.12-9
|
||||
environment:
|
||||
CI_UPLOAD_GIT_TOKEN:
|
||||
from_secret: CI_UPLOAD_GIT_TOKEN
|
||||
CI_UPLOAD_GIT_USERNAME:
|
||||
from_secret: CI_UPLOAD_GIT_USERNAME
|
||||
commands:
|
||||
- /bin/bash -c "./admin/linux/build-appimage.sh"
|
||||
- /bin/bash -c "./admin/linux/upload-appimage.sh"
|
||||
- /bin/bash -c "./admin/linux/upload-appimage.sh" || echo "Upload failed, however this is an optional step."
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
|
||||
@@ -199,6 +199,6 @@ X-GNOME-Autostart-Delay=3
|
||||
|
||||
# Translations
|
||||
Icon[ca]=@APPLICATION_ICON_NAME@
|
||||
Name[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
|
||||
Name[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
|
||||
Comment[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
|
||||
GenericName[ca]=Directori de sincronització
|
||||
GenericName[ca]=Sincronització de carpetes
|
||||
|
||||
@@ -198,7 +198,7 @@ X-GNOME-Autostart-Delay=3
|
||||
|
||||
|
||||
# Translations
|
||||
Icon[de_DE]=@APPLICATION_ICON_NAME@
|
||||
Name[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
|
||||
Comment[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
|
||||
GenericName[de_DE]=Synchronisierungsordner
|
||||
Icon[de]=@APPLICATION_ICON_NAME@
|
||||
Name[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
|
||||
Comment[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
|
||||
GenericName[de]=Synchronisierungsordner
|
||||
|
||||
@@ -35,3 +35,17 @@ set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "#0082c9" CACHE STRING "Hex colo
|
||||
set( APPLICATION_WIZARD_HEADER_TITLE_COLOR "#ffffff" CACHE STRING "Hex color of the text in the wizard header")
|
||||
option( APPLICATION_WIZARD_USE_CUSTOM_LOGO "Use the logo from ':/client/theme/colored/wizard_logo.png' else the default application icon is used" ON )
|
||||
|
||||
|
||||
#
|
||||
## Windows Shell Extensions - IMPORTANT: Generate new GUIDs for custom builds with "guidgen" or "uuidgen"
|
||||
#
|
||||
|
||||
# Context Menu
|
||||
set( WIN_SHELLEXT_CONTEXT_MENU_GUID "{BC6988AB-ACE2-4B81-84DC-DC34F9B24401}" )
|
||||
|
||||
# Overlays
|
||||
set( WIN_SHELLEXT_OVERLAY_GUID_ERROR "{E0342B74-7593-4C70-9D61-22F294AAFE05}" )
|
||||
set( WIN_SHELLEXT_OVERLAY_GUID_OK "{E1094E94-BE93-4EA2-9639-8475C68F3886}" )
|
||||
set( WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED "{E243AD85-F71B-496B-B17E-B8091CBE93D2}" )
|
||||
set( WIN_SHELLEXT_OVERLAY_GUID_SYNC "{E3D6DB20-1D83-4829-B5C9-941B31C0C35A}" )
|
||||
set( WIN_SHELLEXT_OVERLAY_GUID_WARNING "{E4977F33-F93A-4A0A-9D3C-83DEA0EE8483}" )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
set( MIRALL_VERSION_MAJOR 2 )
|
||||
set( MIRALL_VERSION_MINOR 7 )
|
||||
set( MIRALL_VERSION_PATCH 0 )
|
||||
set( MIRALL_VERSION_MAJOR 3 )
|
||||
set( MIRALL_VERSION_MINOR 0 )
|
||||
set( MIRALL_VERSION_PATCH 1 )
|
||||
set( MIRALL_VERSION_YEAR 2020 )
|
||||
set( MIRALL_SOVERSION 0 )
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ mkdir /app
|
||||
mkdir /build
|
||||
|
||||
#Set Qt-5.12
|
||||
export QT_BASE_DIR=/opt/qt5.12.8
|
||||
export QT_BASE_DIR=/opt/qt5.12.9
|
||||
export QTDIR=$QT_BASE_DIR
|
||||
export PATH=$QT_BASE_DIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib:$LD_LIBRARY_PATH
|
||||
|
||||
@@ -15,10 +15,10 @@ OBS_PROJECT_BETA=home:ivaradi:beta
|
||||
OBS_PACKAGE=nextcloud-desktop
|
||||
|
||||
if test "${DRONE_TARGET_BRANCH}" = "stable-2.6"; then
|
||||
UBUNTU_DISTRIBUTIONS="bionic eoan focal groovy"
|
||||
UBUNTU_DISTRIBUTIONS="bionic focal groovy"
|
||||
DEBIAN_DISTRIBUTIONS="buster stretch testing"
|
||||
else
|
||||
UBUNTU_DISTRIBUTIONS="eoan focal groovy"
|
||||
UBUNTU_DISTRIBUTIONS="focal groovy"
|
||||
DEBIAN_DISTRIBUTIONS="testing"
|
||||
fi
|
||||
|
||||
@@ -43,6 +43,7 @@ fi
|
||||
set -x
|
||||
|
||||
cd "${DRONE_WORKSPACE}"
|
||||
git fetch --tags
|
||||
read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable)
|
||||
|
||||
cd "${DRONE_DIR}"
|
||||
|
||||
@@ -1,21 +1,135 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -xe
|
||||
# Env
|
||||
export BUILD=${DRONE_BUILD_NUMBER}
|
||||
export PR=${DRONE_PULL_REQUEST}
|
||||
export GIT_USERNAME=${CI_UPLOAD_GIT_USERNAME}
|
||||
export GIT_TOKEN=${CI_UPLOAD_GIT_TOKEN}
|
||||
|
||||
# Defaults
|
||||
export GIT_REPO=ci-builds
|
||||
export API_BASE_URL=https://api.github.com/repos/$GIT_USERNAME/$GIT_REPO
|
||||
export DESKTOP_API_BASE_URL=https://api.github.com/repos/nextcloud/desktop
|
||||
|
||||
# PR / master
|
||||
export TAG_NAME=${PR:=master}
|
||||
export RELEASE_BODY=https://github.com/nextcloud/desktop
|
||||
|
||||
if [ $TAG_NAME != "master" ]; then
|
||||
TAG_NAME="PR-$TAG_NAME"
|
||||
RELEASE_BODY="nextcloud/desktop#$PR"
|
||||
fi
|
||||
|
||||
cd /build
|
||||
|
||||
# Upload AppImage
|
||||
APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
|
||||
BASENAME=$(basename ${APPIMAGE})
|
||||
# AppImage
|
||||
export APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
|
||||
export BASENAME=$(basename ${APPIMAGE})
|
||||
|
||||
if curl --max-time 900 --upload-file ${APPIMAGE} https://transfer.sh/${BASENAME}
|
||||
then
|
||||
echo
|
||||
echo "Get the AppImage at the link above!"
|
||||
else
|
||||
echo
|
||||
echo "Upload failed, however this is an optional step."
|
||||
if ! test -e $APPIMAGE ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Don't let the Drone build fail
|
||||
exit 0
|
||||
echo "Found AppImage: $BASENAME"
|
||||
|
||||
if [ $TAG_NAME != "master" ]; then
|
||||
# Delete all old comments in desktop PR, starting with "AppImage file:"
|
||||
oldComments=$(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $DESKTOP_API_BASE_URL/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("'${GIT_USERNAME}'") | tostring) + "|" + (.body | test("AppImage file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|")
|
||||
|
||||
if [[ "$oldComments" != "" ]]; then
|
||||
echo $oldComments | while read comment ; do
|
||||
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X DELETE $DESKTOP_API_BASE_URL/issues/comments/$comment
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Helper functions
|
||||
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
|
||||
create_release()
|
||||
{
|
||||
name=$TAG_NAME
|
||||
body=$RELEASE_BODY
|
||||
tagName=$TAG_NAME
|
||||
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X POST $API_BASE_URL/releases -d "{ \"tag_name\": \"$tagName\", \"target_commitish\": \"master\", \"name\": \"$name\", \"body\": \"$body\", \"draft\": false, \"prerelease\": true }")
|
||||
}
|
||||
|
||||
get_release()
|
||||
{
|
||||
tagName=$TAG_NAME
|
||||
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $API_BASE_URL/releases/tags/$tagName)
|
||||
}
|
||||
|
||||
get_release_assets()
|
||||
{
|
||||
releaseId=$1
|
||||
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $API_BASE_URL/releases/$releaseId/assets)
|
||||
}
|
||||
|
||||
upload_release_asset()
|
||||
{
|
||||
uploadUrl=$1
|
||||
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrl --header "Content-Type: application/octet-stream" --upload-file $APPIMAGE)
|
||||
}
|
||||
|
||||
delete_release_asset()
|
||||
{
|
||||
assetId=$1
|
||||
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X DELETE $API_BASE_URL/releases/assets/$assetId
|
||||
}
|
||||
|
||||
# Try to get an already existing release
|
||||
json=$(get_release)
|
||||
|
||||
releaseId=$(echo $json | jq -r '.id')
|
||||
uploadUrl=$(echo $json | jq -r '.upload_url')
|
||||
|
||||
if [[ "$uploadUrl" == "null" ]]; then
|
||||
# Try to create a release
|
||||
json=$(create_release)
|
||||
|
||||
releaseId=$(echo $json | jq -r '.id')
|
||||
uploadUrl=$(echo $json | jq -r '.upload_url')
|
||||
|
||||
if [[ "$uploadUrl" == "null" ]]; then
|
||||
echo "create_release failed: $json"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Prepare upload url
|
||||
uploadUrl=$(echo "${uploadUrl/'{?name,label}'/?name=$BASENAME}")
|
||||
|
||||
# Try to delete existing AppImage assets for this PR
|
||||
assets=$(get_release_assets $releaseId)
|
||||
|
||||
for data in $(echo $assets | jq -r '.[] | @uri'); do
|
||||
json=$(urldecode "$data")
|
||||
|
||||
assetId=$(echo $json | jq -r '.id')
|
||||
name=$(echo $json | jq -r '.name')
|
||||
|
||||
if [[ "$name" == *.AppImage ]]; then
|
||||
echo "Deleting old asset: $name"
|
||||
$(delete_release_asset $assetId)
|
||||
fi
|
||||
done
|
||||
|
||||
# Upload release asset
|
||||
echo "Uploading new asset: $BASENAME"
|
||||
|
||||
json=$(upload_release_asset "$uploadUrl")
|
||||
browserDownloadUrl=$(echo $json | jq -r '.browser_download_url')
|
||||
|
||||
if [[ "$browserDownloadUrl" == "null" ]]; then
|
||||
echo "upload_release_asset failed: $json"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ $TAG_NAME != "master" ]; then
|
||||
# Create comment in desktop PR
|
||||
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X POST $DESKTOP_API_BASE_URL/issues/$PR/comments -d "{ \"body\" : \"AppImage file: [$BASENAME]($browserDownloadUrl) <br/><br/>To test this change/fix you can simply download above AppImage file and test it. <br/><br/>Please make sure to quit your existing Nextcloud app and backup your data. \" }"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "AppImage link: $browserDownloadUrl"
|
||||
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 270 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
@@ -7,7 +7,7 @@ Conflicts
|
||||
Overview
|
||||
--------
|
||||
|
||||
The ownCloud desktop client uploads local changes and downloads remote changes.
|
||||
The Nextcloud desktop client uploads local changes and downloads remote changes.
|
||||
When a file has changed on the local side and on the remote between synchronization
|
||||
runs the client will be unable to resolve the situation on its own. It will
|
||||
create a conflict file with the local version, download the remote version and
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
add_subdirectory(OCContextMenu)
|
||||
add_subdirectory(OCOverlays)
|
||||
add_subdirectory(OCUtil)
|
||||
# Use static runtime for all subdirectories
|
||||
foreach(buildType "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
|
||||
string(REPLACE "/MD" "/MT" "CMAKE_CXX_FLAGS${buildType}" "${CMAKE_CXX_FLAGS${buildType}}")
|
||||
endforeach()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
configure_file(WinShellExtConstants.h.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExtConstants.h)
|
||||
configure_file(WinShellExt.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExt.wxs)
|
||||
|
||||
add_subdirectory(NCContextMenu)
|
||||
add_subdirectory(NCOverlays)
|
||||
add_subdirectory(NCUtil)
|
||||
|
||||
|
||||
17
shell_integration/windows/NCContextMenu/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
add_library(NCContextMenu MODULE
|
||||
dllmain.cpp
|
||||
NCClientInterface.cpp
|
||||
NCContextMenu.cpp
|
||||
NCContextMenuFactory.cpp
|
||||
NCContextMenuRegHandler.cpp
|
||||
NCContextMenu.rc
|
||||
NCContextMenu.def
|
||||
)
|
||||
|
||||
target_link_libraries(NCContextMenu
|
||||
NCUtil)
|
||||
|
||||
install(TARGETS NCContextMenu
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -12,9 +12,7 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCClientInterface.h"
|
||||
#include "NCClientInterface.h"
|
||||
|
||||
#include "CommunicationSocket.h"
|
||||
#include "StringUtil.h"
|
||||
@@ -32,9 +30,8 @@
|
||||
using namespace std;
|
||||
|
||||
#define PIPE_TIMEOUT 5*1000 //ms
|
||||
#define SOCK_BUFFER 4096
|
||||
|
||||
OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo(const std::wstring &files)
|
||||
NCClientInterface::ContextMenuInfo NCClientInterface::FetchInfo(const std::wstring &files)
|
||||
{
|
||||
auto pipename = CommunicationSocket::DefaultPipePath();
|
||||
|
||||
@@ -80,7 +77,7 @@ OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo(const std::wstri
|
||||
return info;
|
||||
}
|
||||
|
||||
void OCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &path)
|
||||
void NCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &path)
|
||||
{
|
||||
auto pipename = CommunicationSocket::DefaultPipePath();
|
||||
|
||||
@@ -92,9 +89,5 @@ void OCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &pat
|
||||
return;
|
||||
}
|
||||
|
||||
wchar_t msg[SOCK_BUFFER] = { 0 };
|
||||
if (SUCCEEDED(StringCchPrintf(msg, SOCK_BUFFER, L"%s:%s\n", verb, path.c_str())))
|
||||
{
|
||||
socket.SendMsg(msg);
|
||||
}
|
||||
socket.SendMsg((verb + (L":" + path + L"\n")).data());
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
class CommunicationSocket;
|
||||
|
||||
class OCClientInterface
|
||||
class NCClientInterface
|
||||
{
|
||||
public:
|
||||
struct ContextMenuInfo {
|
||||
@@ -12,25 +12,24 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCContextMenu.h"
|
||||
#include "OCClientInterface.h"
|
||||
#include "NCContextMenu.h"
|
||||
#include "NCClientInterface.h"
|
||||
|
||||
#include <shobjidl.h>
|
||||
#include <shlwapi.h>
|
||||
#include <shellapi.h>
|
||||
#include <StringUtil.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
extern long g_cDllRef;
|
||||
|
||||
OCContextMenu::OCContextMenu(void)
|
||||
NCContextMenu::NCContextMenu(void)
|
||||
: m_cRef(1)
|
||||
{
|
||||
InterlockedIncrement(&g_cDllRef);
|
||||
}
|
||||
|
||||
OCContextMenu::~OCContextMenu(void)
|
||||
NCContextMenu::~NCContextMenu(void)
|
||||
{
|
||||
InterlockedDecrement(&g_cDllRef);
|
||||
}
|
||||
@@ -38,25 +37,25 @@ OCContextMenu::~OCContextMenu(void)
|
||||
#pragma region IUnknown
|
||||
|
||||
// Query to the interface the component supported.
|
||||
IFACEMETHODIMP OCContextMenu::QueryInterface(REFIID riid, void **ppv)
|
||||
IFACEMETHODIMP NCContextMenu::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
static const QITAB qit[] =
|
||||
{
|
||||
QITABENT(OCContextMenu, IContextMenu),
|
||||
QITABENT(OCContextMenu, IShellExtInit),
|
||||
QITABENT(NCContextMenu, IContextMenu),
|
||||
QITABENT(NCContextMenu, IShellExtInit),
|
||||
{ 0 },
|
||||
};
|
||||
return QISearch(this, qit, riid, ppv);
|
||||
}
|
||||
|
||||
// Increase the reference count for an interface on an object.
|
||||
IFACEMETHODIMP_(ULONG) OCContextMenu::AddRef()
|
||||
IFACEMETHODIMP_(ULONG) NCContextMenu::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
// Decrease the reference count for an interface on an object.
|
||||
IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
|
||||
IFACEMETHODIMP_(ULONG) NCContextMenu::Release()
|
||||
{
|
||||
ULONG cRef = InterlockedDecrement(&m_cRef);
|
||||
if (0 == cRef) {
|
||||
@@ -72,7 +71,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
|
||||
#pragma region IShellExtInit
|
||||
|
||||
// Initialize the context menu handler.
|
||||
IFACEMETHODIMP OCContextMenu::Initialize(
|
||||
IFACEMETHODIMP NCContextMenu::Initialize(
|
||||
LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID)
|
||||
{
|
||||
m_selectedFiles.clear();
|
||||
@@ -128,7 +127,7 @@ void InsertSeperator(HMENU hMenu, UINT indexMenu)
|
||||
InsertMenuItem(hMenu, indexMenu, TRUE, &sep);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
|
||||
IFACEMETHODIMP NCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
|
||||
{
|
||||
// If uFlags include CMF_DEFAULTONLY then we should not do anything.
|
||||
if (CMF_DEFAULTONLY & uFlags)
|
||||
@@ -136,7 +135,7 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
|
||||
}
|
||||
|
||||
m_info = OCClientInterface::FetchInfo(m_selectedFiles);
|
||||
m_info = NCClientInterface::FetchInfo(m_selectedFiles);
|
||||
if (m_info.menuItems.empty()) {
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
|
||||
}
|
||||
@@ -178,7 +177,7 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
|
||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(indexSubMenu));
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
||||
IFACEMETHODIMP NCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
||||
{
|
||||
std::wstring command;
|
||||
|
||||
@@ -216,11 +215,11 @@ IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
OCClientInterface::SendRequest(command.data(), m_selectedFiles);
|
||||
NCClientInterface::SendRequest(command.data(), m_selectedFiles);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCContextMenu::GetCommandString(UINT_PTR idCommand,
|
||||
IFACEMETHODIMP NCContextMenu::GetCommandString(UINT_PTR idCommand,
|
||||
UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
|
||||
{
|
||||
if (idCommand < m_info.menuItems.size() && uFlags == GCS_VERBW) {
|
||||
@@ -12,15 +12,15 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef OCCONTEXTMENU_H
|
||||
#define OCCONTEXTMENU_H
|
||||
#ifndef NCCONTEXTMENU_H
|
||||
#define NCCONTEXTMENU_H
|
||||
|
||||
#pragma once
|
||||
#include <shlobj.h> // For IShellExtInit and IContextMenu
|
||||
#include <string>
|
||||
#include "OCClientInterface.h"
|
||||
#include "NCClientInterface.h"
|
||||
|
||||
class OCContextMenu : public IShellExtInit, public IContextMenu
|
||||
class NCContextMenu : public IShellExtInit, public IContextMenu
|
||||
{
|
||||
public:
|
||||
// IUnknown
|
||||
@@ -36,10 +36,10 @@ public:
|
||||
IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
|
||||
IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
|
||||
|
||||
OCContextMenu();
|
||||
NCContextMenu();
|
||||
|
||||
protected:
|
||||
~OCContextMenu();
|
||||
~NCContextMenu();
|
||||
|
||||
private:
|
||||
// Reference count of component.
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
|
||||
// The name of the selected files (separated by '\x1e')
|
||||
std::wstring m_selectedFiles;
|
||||
OCClientInterface::ContextMenuInfo m_info;
|
||||
NCClientInterface::ContextMenuInfo m_info;
|
||||
};
|
||||
|
||||
#endif //OCCONTEXTMENU_H
|
||||
#endif //NCCONTEXTMENU_H
|
||||
@@ -12,10 +12,8 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCContextMenuFactory.h"
|
||||
#include "OCContextMenu.h"
|
||||
#include "NCContextMenuFactory.h"
|
||||
#include "NCContextMenu.h"
|
||||
#include <new>
|
||||
#include <Shlwapi.h>
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
@@ -24,12 +22,12 @@
|
||||
extern long g_cDllRef;
|
||||
|
||||
|
||||
OCContextMenuFactory::OCContextMenuFactory() : m_cRef(1)
|
||||
NCContextMenuFactory::NCContextMenuFactory() : m_cRef(1)
|
||||
{
|
||||
InterlockedIncrement(&g_cDllRef);
|
||||
}
|
||||
|
||||
OCContextMenuFactory::~OCContextMenuFactory()
|
||||
NCContextMenuFactory::~NCContextMenuFactory()
|
||||
{
|
||||
InterlockedDecrement(&g_cDllRef);
|
||||
}
|
||||
@@ -37,18 +35,18 @@ OCContextMenuFactory::~OCContextMenuFactory()
|
||||
|
||||
// IUnknown methods
|
||||
|
||||
IFACEMETHODIMP OCContextMenuFactory::QueryInterface(REFIID riid, void **ppv)
|
||||
IFACEMETHODIMP NCContextMenuFactory::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
static const QITAB qit[] = { QITABENT(OCContextMenuFactory, IClassFactory), { 0 }, };
|
||||
static const QITAB qit[] = { QITABENT(NCContextMenuFactory, IClassFactory), { 0 }, };
|
||||
return QISearch(this, qit, riid, ppv);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::AddRef()
|
||||
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
|
||||
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::Release()
|
||||
{
|
||||
ULONG cRef = InterlockedDecrement(&m_cRef);
|
||||
if (0 == cRef) {
|
||||
@@ -60,7 +58,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
|
||||
|
||||
// IClassFactory methods
|
||||
|
||||
IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
||||
IFACEMETHODIMP NCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hr = CLASS_E_NOAGGREGATION;
|
||||
|
||||
@@ -69,7 +67,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
|
||||
hr = E_OUTOFMEMORY;
|
||||
|
||||
// Create the COM component.
|
||||
OCContextMenu *pExt = new (std::nothrow) OCContextMenu();
|
||||
NCContextMenu *pExt = new (std::nothrow) NCContextMenu();
|
||||
if (pExt) {
|
||||
// Query the specified interface.
|
||||
hr = pExt->QueryInterface(riid, ppv);
|
||||
@@ -80,7 +78,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
|
||||
return hr;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCContextMenuFactory::LockServer(BOOL fLock)
|
||||
IFACEMETHODIMP NCContextMenuFactory::LockServer(BOOL fLock)
|
||||
{
|
||||
if (fLock) {
|
||||
InterlockedIncrement(&g_cDllRef);
|
||||
@@ -13,14 +13,14 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OCCONTEXTMENUFACTORY_H
|
||||
#define OCCONTEXTMENUFACTORY_H
|
||||
#ifndef NCCONTEXTMENUFACTORY_H
|
||||
#define NCCONTEXTMENUFACTORY_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unknwn.h> // For IClassFactory
|
||||
|
||||
class OCContextMenuFactory : public IClassFactory
|
||||
class NCContextMenuFactory : public IClassFactory
|
||||
{
|
||||
public:
|
||||
// IUnknown
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
||||
IFACEMETHODIMP LockServer(BOOL fLock);
|
||||
|
||||
OCContextMenuFactory();
|
||||
NCContextMenuFactory();
|
||||
|
||||
private:
|
||||
~OCContextMenuFactory();
|
||||
~NCContextMenuFactory();
|
||||
long m_cRef;
|
||||
};
|
||||
|
||||
#endif //OCCONTEXTMENUFACTORY_H
|
||||
#endif //NCCONTEXTMENUFACTORY_H
|
||||
@@ -12,9 +12,7 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCContextMenuRegHandler.h"
|
||||
#include "NCContextMenuRegHandler.h"
|
||||
#include "RegDelnode.h"
|
||||
#include <strsafe.h>
|
||||
#include <objbase.h>
|
||||
@@ -70,7 +68,7 @@ HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR
|
||||
|
||||
}
|
||||
|
||||
HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
|
||||
HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
|
||||
{
|
||||
if (!pszModule || !pszThreadModel)
|
||||
{
|
||||
@@ -113,7 +111,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
||||
HRESULT NCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
@@ -133,7 +131,7 @@ HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
||||
}
|
||||
|
||||
|
||||
HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
|
||||
HRESULT NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
|
||||
PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName)
|
||||
{
|
||||
if (!pszFileType)
|
||||
@@ -177,7 +175,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
|
||||
HRESULT NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
|
||||
PCWSTR pszFileType, PCWSTR pszFriendlyName)
|
||||
{
|
||||
if (!pszFileType)
|
||||
@@ -13,14 +13,14 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OCCONTEXTMENUREGHANDLER_H
|
||||
#define OCCONTEXTMENUREGHANDLER_H
|
||||
#ifndef NCCONTEXTMENUREGHANDLER_H
|
||||
#define NCCONTEXTMENUREGHANDLER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <windows.h>
|
||||
|
||||
class __declspec(dllexport) OCContextMenuRegHandler
|
||||
class __declspec(dllexport) NCContextMenuRegHandler
|
||||
{
|
||||
public:
|
||||
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
|
||||
@@ -35,4 +35,4 @@ public:
|
||||
static HRESULT UnregisterShellExtContextMenuHandler(PCWSTR pszFileType, PCWSTR pszFriendlyName);
|
||||
};
|
||||
|
||||
#endif //OCCONTEXTMENUREGHANDLER_H
|
||||
#endif //NCCONTEXTMENUREGHANDLER_H
|
||||
124
shell_integration/windows/NCContextMenu/dllmain.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Daniel Molkentin <danimo@owncloud.com>. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <Guiddef.h>
|
||||
#include "NCContextMenuRegHandler.h"
|
||||
#include "NCContextMenuFactory.h"
|
||||
#include "WinShellExtConstants.h"
|
||||
|
||||
HINSTANCE g_hInst = nullptr;
|
||||
long g_cDllRef = 0;
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// Hold the instance of this DLL module, we will use it to get the
|
||||
// path of the DLL to register the component.
|
||||
g_hInst = hModule;
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
GUID guid;
|
||||
|
||||
hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = CLASS_E_CLASSNOTAVAILABLE;
|
||||
|
||||
if (IsEqualCLSID(guid, rclsid)) {
|
||||
hr = E_OUTOFMEMORY;
|
||||
|
||||
NCContextMenuFactory *pClassFactory = new NCContextMenuFactory();
|
||||
if (pClassFactory) {
|
||||
hr = pClassFactory->QueryInterface(riid, ppv);
|
||||
pClassFactory->Release();
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return g_cDllRef > 0 ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
GUID guid;
|
||||
|
||||
hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
wchar_t szModule[MAX_PATH];
|
||||
if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0) {
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Register the component.
|
||||
hr = NCContextMenuRegHandler::RegisterInprocServer(szModule, guid,
|
||||
CONTEXT_MENU_DESCRIPTION, L"Apartment");
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Register the context menu handler. The context menu handler is
|
||||
// associated with the .cpp file class.
|
||||
hr = NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(L"AllFileSystemObjects", guid, CONTEXT_MENU_REGKEY_NAME);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
GUID guid;
|
||||
|
||||
hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
wchar_t szModule[MAX_PATH];
|
||||
if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0) {
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Unregister the component.
|
||||
hr = NCContextMenuRegHandler::UnregisterInprocServer(guid);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Unregister the context menu handler.
|
||||
hr = NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(L"AllFileSystemObjects", CONTEXT_MENU_REGKEY_NAME);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by OCContextMenu.rc
|
||||
// Used by NCContextMenu.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
16
shell_integration/windows/NCOverlays/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
add_library(NCOverlays MODULE
|
||||
DllMain.cpp
|
||||
NCOverlay.cpp
|
||||
NCOverlayFactory.cpp
|
||||
NCOverlayRegistrationHandler.cpp
|
||||
NCOverlay.rc
|
||||
NCOverlays.def
|
||||
)
|
||||
|
||||
target_link_libraries(NCOverlays
|
||||
NCUtil)
|
||||
|
||||
install(TARGETS NCOverlays
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -12,10 +12,9 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCOverlayRegistrationHandler.h"
|
||||
#include "OCOverlayFactory.h"
|
||||
#include "NCOverlayRegistrationHandler.h"
|
||||
#include "NCOverlayFactory.h"
|
||||
#include "WinShellExtConstants.h"
|
||||
|
||||
HINSTANCE instanceHandle = nullptr;
|
||||
|
||||
@@ -42,11 +41,11 @@ HRESULT CreateFactory(REFIID riid, void **ppv, int state)
|
||||
{
|
||||
HRESULT hResult = E_OUTOFMEMORY;
|
||||
|
||||
OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(state);
|
||||
NCOverlayFactory* ncOverlayFactory = new NCOverlayFactory(state);
|
||||
|
||||
if (ocOverlayFactory) {
|
||||
hResult = ocOverlayFactory->QueryInterface(riid, ppv);
|
||||
ocOverlayFactory->Release();
|
||||
if (ncOverlayFactory) {
|
||||
hResult = ncOverlayFactory->QueryInterface(riid, ppv);
|
||||
ncOverlayFactory->Release();
|
||||
}
|
||||
return hResult;
|
||||
}
|
||||
@@ -95,13 +94,13 @@ HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule)
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_GENERIC_NAME, guid);
|
||||
hResult = NCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_DESCRIPTION, guid);
|
||||
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
|
||||
hResult = NCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
|
||||
|
||||
return hResult;
|
||||
}
|
||||
@@ -117,13 +116,13 @@ HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid);
|
||||
hResult = NCOverlayRegistrationHandler::UnregisterCOMObject(guid);
|
||||
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
|
||||
hResult = NCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
|
||||
|
||||
return hResult;
|
||||
}
|
||||
@@ -139,13 +138,6 @@ HRESULT _stdcall DllRegisterServer(void)
|
||||
return hResult;
|
||||
}
|
||||
|
||||
// Unregister any obsolete CLSID when we register here
|
||||
// Those CLSID were removed in 2.1, but we need to make sure to prevent any previous version
|
||||
// of the extension on the system from loading at the same time as a new version to avoid crashing explorer.
|
||||
UnregisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED);
|
||||
UnregisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED);
|
||||
UnregisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED);
|
||||
|
||||
hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule);
|
||||
if (!SUCCEEDED(hResult)) { return hResult; }
|
||||
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);
|
||||
@@ -12,19 +12,11 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCOverlay.h"
|
||||
|
||||
#include "OCOverlayFactory.h"
|
||||
#include "RegistryUtil.h"
|
||||
#include "NCOverlay.h"
|
||||
#include "NCOverlayFactory.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "UtilConstants.h"
|
||||
#include "RemotePathChecker.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@@ -55,23 +47,23 @@ RemotePathChecker *getGlobalChecker()
|
||||
}
|
||||
|
||||
}
|
||||
OCOverlay::OCOverlay(int state)
|
||||
NCOverlay::NCOverlay(int state)
|
||||
: _referenceCount(1)
|
||||
, _state(state)
|
||||
{
|
||||
}
|
||||
|
||||
OCOverlay::~OCOverlay(void)
|
||||
NCOverlay::~NCOverlay(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCOverlay::AddRef()
|
||||
IFACEMETHODIMP_(ULONG) NCOverlay::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&_referenceCount);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
|
||||
IFACEMETHODIMP NCOverlay::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
@@ -93,7 +85,7 @@ IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
|
||||
return hr;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCOverlay::Release()
|
||||
IFACEMETHODIMP_(ULONG) NCOverlay::Release()
|
||||
{
|
||||
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
||||
if (0 == cRef)
|
||||
@@ -104,7 +96,7 @@ IFACEMETHODIMP_(ULONG) OCOverlay::Release()
|
||||
return cRef;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
|
||||
IFACEMETHODIMP NCOverlay::GetPriority(int *pPriority)
|
||||
{
|
||||
// this defines which handler has prededence, so
|
||||
// we order this in terms of likelyhood
|
||||
@@ -126,7 +118,7 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
|
||||
IFACEMETHODIMP NCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
|
||||
{
|
||||
RemotePathChecker* checker = getGlobalChecker();
|
||||
std::shared_ptr<const std::vector<std::wstring>> watchedDirectories = checker->WatchedDirectories();
|
||||
@@ -154,7 +146,7 @@ IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
|
||||
return MAKE_HRESULT(state == _state ? S_OK : S_FALSE, 0, 0);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
|
||||
IFACEMETHODIMP NCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
|
||||
{
|
||||
*pIndex = 0;
|
||||
*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
|
||||
@@ -12,16 +12,18 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef OCOVERLAY_H
|
||||
#define OCOVERLAY_H
|
||||
#ifndef NCOVERLAY_H
|
||||
#define NCOVERLAY_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class OCOverlay : public IShellIconOverlayIdentifier
|
||||
#include <shlobj.h>
|
||||
|
||||
class NCOverlay : public IShellIconOverlayIdentifier
|
||||
|
||||
{
|
||||
public:
|
||||
OCOverlay(int state);
|
||||
NCOverlay(int state);
|
||||
|
||||
IFACEMETHODIMP_(ULONG) AddRef();
|
||||
IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
|
||||
@@ -31,7 +33,7 @@ public:
|
||||
IFACEMETHODIMP_(ULONG) Release();
|
||||
|
||||
protected:
|
||||
~OCOverlay();
|
||||
~NCOverlay();
|
||||
|
||||
private:
|
||||
long _referenceCount;
|
||||
@@ -12,25 +12,26 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <windows.h>
|
||||
#include <new>
|
||||
|
||||
#include "OCOverlayFactory.h"
|
||||
#include "OCOverlay.h"
|
||||
#include "NCOverlayFactory.h"
|
||||
#include "NCOverlay.h"
|
||||
|
||||
extern long dllReferenceCount;
|
||||
|
||||
OCOverlayFactory::OCOverlayFactory(int state)
|
||||
NCOverlayFactory::NCOverlayFactory(int state)
|
||||
: _referenceCount(1), _state(state)
|
||||
{
|
||||
InterlockedIncrement(&dllReferenceCount);
|
||||
}
|
||||
|
||||
OCOverlayFactory::~OCOverlayFactory()
|
||||
NCOverlayFactory::~NCOverlayFactory()
|
||||
{
|
||||
InterlockedDecrement(&dllReferenceCount);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
||||
IFACEMETHODIMP NCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hResult = S_OK;
|
||||
|
||||
@@ -49,12 +50,12 @@ IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
||||
return hResult;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCOverlayFactory::AddRef()
|
||||
IFACEMETHODIMP_(ULONG) NCOverlayFactory::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&_referenceCount);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
|
||||
IFACEMETHODIMP_(ULONG) NCOverlayFactory::Release()
|
||||
{
|
||||
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
||||
|
||||
@@ -65,7 +66,7 @@ IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
|
||||
return cRef;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
||||
IFACEMETHODIMP NCOverlayFactory::CreateInstance(
|
||||
IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hResult = CLASS_E_NOAGGREGATION;
|
||||
@@ -73,7 +74,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
||||
if (pUnkOuter) { return hResult; }
|
||||
|
||||
hResult = E_OUTOFMEMORY;
|
||||
OCOverlay *lrOverlay = new (std::nothrow) OCOverlay(_state);
|
||||
NCOverlay *lrOverlay = new (std::nothrow) NCOverlay(_state);
|
||||
if (!lrOverlay) { return hResult; }
|
||||
|
||||
hResult = lrOverlay->QueryInterface(riid, ppv);
|
||||
@@ -82,7 +83,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
||||
return hResult;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock)
|
||||
IFACEMETHODIMP NCOverlayFactory::LockServer(BOOL fLock)
|
||||
{
|
||||
if (fLock) {
|
||||
InterlockedIncrement(&dllReferenceCount);
|
||||
@@ -12,11 +12,13 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef OCOVERLAYFACTORY_H
|
||||
#define OCOVERLAYFACTORY_H
|
||||
#ifndef NCOVERLAYFACTORY_H
|
||||
#define NCOVERLAYFACTORY_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unknwn.h>
|
||||
|
||||
enum State {
|
||||
State_Error = 0,
|
||||
State_OK, State_OKShared,
|
||||
@@ -24,10 +26,10 @@ enum State {
|
||||
State_Warning
|
||||
};
|
||||
|
||||
class OCOverlayFactory : public IClassFactory
|
||||
class NCOverlayFactory : public IClassFactory
|
||||
{
|
||||
public:
|
||||
OCOverlayFactory(int state);
|
||||
NCOverlayFactory(int state);
|
||||
|
||||
IFACEMETHODIMP_(ULONG) AddRef();
|
||||
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
||||
@@ -36,7 +38,7 @@ public:
|
||||
IFACEMETHODIMP_(ULONG) Release();
|
||||
|
||||
protected:
|
||||
~OCOverlayFactory();
|
||||
~NCOverlayFactory();
|
||||
|
||||
private:
|
||||
long _referenceCount;
|
||||
@@ -12,16 +12,24 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "OCOverlayRegistrationHandler.h"
|
||||
#include "NCOverlayRegistrationHandler.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define REGISTRY_OVERLAY_KEY LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers)"
|
||||
#define REGISTRY_CLSID L"CLSID"
|
||||
#define REGISTRY_IN_PROCESS L"InprocServer32"
|
||||
#define REGISTRY_THREADING L"ThreadingModel"
|
||||
#define REGISTRY_APARTMENT L"Apartment"
|
||||
#define REGISTRY_VERSION L"Version"
|
||||
#define REGISTRY_VERSION_NUMBER L"1.0"
|
||||
|
||||
using namespace std;
|
||||
|
||||
HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
|
||||
HRESULT NCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
|
||||
{
|
||||
HRESULT hResult;
|
||||
HKEY shellOverlayKey = nullptr;
|
||||
@@ -52,7 +60,7 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
||||
HRESULT NCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
||||
{
|
||||
HRESULT hResult;
|
||||
HKEY shellOverlayKey = nullptr;
|
||||
@@ -71,7 +79,7 @@ HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
|
||||
HRESULT NCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
|
||||
{
|
||||
if (!modulePath) {
|
||||
return E_FAIL;
|
||||
@@ -89,7 +97,7 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
|
||||
|
||||
HKEY clsidKey = nullptr;
|
||||
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &clsidKey, nullptr));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
@@ -97,30 +105,36 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
|
||||
|
||||
HKEY inprocessKey = nullptr;
|
||||
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &inprocessKey, nullptr));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, nullptr, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
|
||||
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_THREADING, 0, REG_SZ, (LPBYTE)REGISTRY_APARTMENT, (DWORD)((wcslen(REGISTRY_APARTMENT)+1) * sizeof(TCHAR))));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_VERSION, 0, REG_SZ, (LPBYTE)REGISTRY_VERSION_NUMBER, (DWORD)(wcslen(REGISTRY_VERSION_NUMBER)+1) * sizeof(TCHAR)));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
HKEY versionKey = nullptr;
|
||||
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_VERSION, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &versionKey, nullptr));
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegSetValueEx(versionKey, nullptr, 0, REG_SZ, (LPBYTE)REGISTRY_VERSION_NUMBER, (DWORD)(wcslen(REGISTRY_VERSION_NUMBER)+1) * sizeof(TCHAR)));
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
||||
HRESULT NCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
||||
{
|
||||
wchar_t stringCLSID[MAX_PATH];
|
||||
|
||||
@@ -134,17 +148,22 @@ HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
||||
|
||||
HKEY clsidKey = nullptr;
|
||||
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegDeleteKey(clsidKey, REGISTRY_IN_PROCESS));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegDeleteKey(clsidKey, REGISTRY_VERSION));
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegDeleteKey(hKey, stringCLSID));
|
||||
if(!SUCCEEDED(hResult)) {
|
||||
if (!SUCCEEDED(hResult)) {
|
||||
return hResult;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef OCOVERLAYREGISTRATIONHANDLER_H
|
||||
#define OCOVERLAYREGISTRATIONHANDLER_H
|
||||
#ifndef NCOVERLAYREGISTRATIONHANDLER_H
|
||||
#define NCOVERLAYREGISTRATIONHANDLER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class __declspec(dllexport) OCOverlayRegistrationHandler
|
||||
#include <windows.h>
|
||||
|
||||
class __declspec(dllexport) NCOverlayRegistrationHandler
|
||||
{
|
||||
public:
|
||||
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
11
shell_integration/windows/NCUtil/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
add_library(NCUtil STATIC
|
||||
CommunicationSocket.cpp
|
||||
RemotePathChecker.cpp
|
||||
StringUtil.cpp
|
||||
NCUtil.rc
|
||||
)
|
||||
|
||||
target_include_directories(NCUtil
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
@@ -12,11 +12,9 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "CommunicationSocket.h"
|
||||
#include "UtilConstants.h"
|
||||
#include "StringUtil.h"
|
||||
#include "WinShellExtConstants.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@@ -44,8 +42,9 @@ std::wstring getUserName() {
|
||||
|
||||
std::wstring CommunicationSocket::DefaultPipePath()
|
||||
{
|
||||
auto pipename = std::wstring(L"\\\\.\\pipe\\");
|
||||
pipename += L"ownCloud-";
|
||||
auto pipename = std::wstring(LR"(\\.\pipe\)");
|
||||
pipename += std::wstring(UTIL_PIPE_APP_NAME);
|
||||
pipename += L"-";
|
||||
pipename += getUserName();
|
||||
return pipename;
|
||||
}
|
||||
BIN
shell_integration/windows/NCUtil/NCUtil.rc
Normal file
@@ -11,8 +11,6 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "CommunicationSocket.h"
|
||||
|
||||
#include "RemotePathChecker.h"
|
||||
@@ -29,7 +29,7 @@
|
||||
class __declspec(dllexport) RemotePathChecker {
|
||||
public:
|
||||
enum FileState {
|
||||
// Order synced with OCOverlay
|
||||
// Order synced with NCOverlay
|
||||
StateError = 0,
|
||||
StateOk, StateOkSWM,
|
||||
StateSync,
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
std::queue<std::wstring> _pending;
|
||||
|
||||
std::unordered_map<std::wstring, FileState> _cache;
|
||||
// The vector is const since it will be accessed from multiple threads through OCOverlay::IsMemberOf.
|
||||
// The vector is const since it will be accessed from multiple threads through NCOverlay::IsMemberOf.
|
||||
// Each modification needs to be made onto a copy and then atomically replaced in the shared_ptr.
|
||||
std::shared_ptr<const std::vector<std::wstring>> _watchedDirectories;
|
||||
bool _connected;
|
||||
@@ -11,8 +11,6 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <codecvt>
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
// This is the number that will end up in the version window of the DLLs.
|
||||
// Increment this version before committing a new build if you are today's shell_integration build master.
|
||||
#define OCEXT_BUILD_NUM 46
|
||||
#define NCEXT_BUILD_NUM 47
|
||||
|
||||
#define STRINGIZE2(s) #s
|
||||
#define STRINGIZE(s) STRINGIZE2(s)
|
||||
|
||||
#define OCEXT_VERSION 1,0,0,OCEXT_BUILD_NUM
|
||||
#define OCEXT_VERSION_STRING STRINGIZE(OCEXT_VERSION)
|
||||
#define NCEXT_VERSION 3,0,0,NCEXT_BUILD_NUM
|
||||
#define NCEXT_VERSION_STRING STRINGIZE(NCEXT_VERSION)
|
||||
14
shell_integration/windows/NCUtil/resource.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by NCContextMenu.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
add_library(OCContextMenu MODULE
|
||||
dllmain.cpp
|
||||
OCClientInterface.cpp
|
||||
OCContextMenu.cpp
|
||||
OCContextMenuFactory.cpp
|
||||
OCContextMenuRegHandler.cpp
|
||||
stdafx.cpp
|
||||
OCContextMenu.rc
|
||||
OCContextMenu.def
|
||||
)
|
||||
|
||||
target_link_libraries(OCContextMenu
|
||||
OCUtil)
|
||||
|
||||
install(TARGETS OCContextMenu
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -1,196 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FF34851F-1346-4809-A68A-B1188D7DFF32}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>OCContextMenu</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x86</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x86.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCContextMenu.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x86.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCContextMenu.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>OCContextMenu.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>OCUtil_x64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader />
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x64.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCContextMenu.def</ModuleDefinitionFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="OCClientInterface.h" />
|
||||
<ClInclude Include="OCContextMenuFactory.h" />
|
||||
<ClInclude Include="OCContextMenuRegHandler.h" />
|
||||
<ClInclude Include="OCContextMenu.h" />
|
||||
<ClInclude Include="RegDelnode.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</PrecompiledHeader>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OCClientInterface.cpp" />
|
||||
<ClCompile Include="OCContextMenu.cpp" />
|
||||
<ClCompile Include="OCContextMenuRegHandler.cpp" />
|
||||
<ClCompile Include="OCContextMenuFactory.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OCContextMenu.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="OCContextMenu.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OCContextMenu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OCContextMenuRegHandler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OCContextMenuFactory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OCClientInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegDelnode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OCContextMenu.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OCContextMenuRegHandler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OCContextMenuFactory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OCClientInterface.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OCContextMenu.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,108 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Daniel Molkentin <danimo@owncloud.com>. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <Guiddef.h>
|
||||
#include "OCContextMenuRegHandler.h"
|
||||
#include "OCContextMenuFactory.h"
|
||||
|
||||
// {841A0AAD-AA11-4B50-84D9-7F8E727D77D7}
|
||||
static const GUID CLSID_FileContextMenuExt = { 0x841a0aad, 0xaa11, 0x4b50, { 0x84, 0xd9, 0x7f, 0x8e, 0x72, 0x7d, 0x77, 0xd7 } };
|
||||
|
||||
HINSTANCE g_hInst = nullptr;
|
||||
long g_cDllRef = 0;
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// Hold the instance of this DLL module, we will use it to get the
|
||||
// path of the DLL to register the component.
|
||||
g_hInst = hModule;
|
||||
DisableThreadLibraryCalls(hModule);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
|
||||
{
|
||||
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
|
||||
|
||||
if (IsEqualCLSID(CLSID_FileContextMenuExt, rclsid)) {
|
||||
hr = E_OUTOFMEMORY;
|
||||
|
||||
OCContextMenuFactory *pClassFactory = new OCContextMenuFactory();
|
||||
if (pClassFactory) {
|
||||
hr = pClassFactory->QueryInterface(riid, ppv);
|
||||
pClassFactory->Release();
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return g_cDllRef > 0 ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
wchar_t szModule[MAX_PATH];
|
||||
if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0) {
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Register the component.
|
||||
hr = OCContextMenuRegHandler::RegisterInprocServer(szModule, CLSID_FileContextMenuExt,
|
||||
L"OCContextMenuHandler Class", L"Apartment");
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Register the context menu handler. The context menu handler is
|
||||
// associated with the .cpp file class.
|
||||
hr = OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(L"AllFileSystemObjects", CLSID_FileContextMenuExt, L"OCContextMenuHandler");
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
wchar_t szModule[MAX_PATH];
|
||||
if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0) {
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Unregister the component.
|
||||
hr = OCContextMenuRegHandler::UnregisterInprocServer(CLSID_FileContextMenuExt);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Unregister the context menu handler.
|
||||
hr = OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(L"AllFileSystemObjects", L"OCContextMenuHandler");
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// OCContextMenu.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
@@ -1,17 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
#include <memory>
|
||||
#include <strsafe.h>
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
// Note: Here was a #define for windows target version
|
||||
// e.g. WINVER / _WIN32_WINNT, see https://devblogs.microsoft.com/oldnewthing/20070411-00/?p=27283
|
||||
// Unnecessary because we define both in desktop/CMakeLists.txt
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
@@ -1,17 +0,0 @@
|
||||
add_library(OCOverlays MODULE
|
||||
DllMain.cpp
|
||||
OCOverlay.cpp
|
||||
OCOverlayFactory.cpp
|
||||
OCOverlayRegistrationHandler.cpp
|
||||
stdafx.cpp
|
||||
OCOverlay.rc
|
||||
OCOverlays.def
|
||||
)
|
||||
|
||||
target_link_libraries(OCOverlays
|
||||
OCUtil)
|
||||
|
||||
install(TARGETS OCOverlays
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -1,208 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}</ProjectGuid>
|
||||
<RootNamespace>OCOverlays</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x86</TargetName>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x86</TargetName>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCOverlays.def</ModuleDefinitionFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<SuppressStartupBanner>false</SuppressStartupBanner>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCOverlays.def</ModuleDefinitionFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCOverlays.def</ModuleDefinitionFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\OCUtil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>OCUtil_x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>OCOverlays.def</ModuleDefinitionFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\OCUtil</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DllMain.cpp" />
|
||||
<ClCompile Include="OCOverlay.cpp" />
|
||||
<ClCompile Include="OCOverlayFactory.cpp" />
|
||||
<ClCompile Include="OCOverlayRegistrationHandler.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="OCOverlay.h" />
|
||||
<ClInclude Include="OCOverlayFactory.h" />
|
||||
<ClInclude Include="OCOverlayRegistrationHandler.h" />
|
||||
<ClInclude Include="OverlayConstants.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OCOverlays.def" />
|
||||
<None Include="OverlayConstants.h.original" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="OCOverlay.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="ico\Error.ico" />
|
||||
<Image Include="ico\OK.ico" />
|
||||
<Image Include="ico\OK_Shared.ico" />
|
||||
<Image Include="ico\Sync.ico" />
|
||||
<Image Include="ico\Warning.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
|
||||
#define OVERLAY_GUID_ERROR L"{0960F090-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_ERROR_SHARED L"{0960F091-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_OK L"{0960F092-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_OK_SHARED L"{0960F093-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_SYNC L"{0960F094-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_SYNC_SHARED L"{0960F095-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_WARNING L"{0960F096-F328-48A3-B746-276B1E3C3722}"
|
||||
#define OVERLAY_GUID_WARNING_SHARED L"{0960F097-F328-48A3-B746-276B1E3C3722}"
|
||||
|
||||
#define OVERLAY_GENERIC_NAME L"ownCloud overlay handler"
|
||||
|
||||
// two spaces to put us ahead of the competition :/
|
||||
#define OVERLAY_NAME_ERROR L" OCError"
|
||||
#define OVERLAY_NAME_ERROR_SHARED L" OCErrorShared"
|
||||
#define OVERLAY_NAME_OK L" OCOK"
|
||||
#define OVERLAY_NAME_OK_SHARED L" OCOKShared"
|
||||
#define OVERLAY_NAME_SYNC L" OCSync"
|
||||
#define OVERLAY_NAME_SYNC_SHARED L" OCSyncShared"
|
||||
#define OVERLAY_NAME_WARNING L" OCWarning"
|
||||
#define OVERLAY_NAME_WARNING_SHARED L" OCWarningShared"
|
||||
|
||||
#define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers"
|
||||
#define REGISTRY_CLSID L"CLSID"
|
||||
#define REGISTRY_IN_PROCESS L"InprocServer32"
|
||||
#define REGISTRY_THREADING L"ThreadingModel"
|
||||
#define REGISTRY_APARTMENT L"Apartment"
|
||||
#define REGISTRY_VERSION L"Version"
|
||||
#define REGISTRY_VERSION_NUMBER L"1.0"
|
||||
|
||||
//Registry values for running
|
||||
#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay"
|
||||
|
||||
#define GET_FILE_OVERLAY_ID L"getFileIconId"
|
||||
|
||||
#define PORT 34001
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#define OVERLAY_ID [$overlay.id$]
|
||||
#define OVERLAY_GUID L"[$overlay.guid$]"
|
||||
#define OVERLAY_NAME L"[$overlay.name$]"
|
||||
|
||||
#define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers"
|
||||
#define REGISTRY_CLSID L"CLSID"
|
||||
#define REGISTRY_IN_PROCESS L"InprocServer32"
|
||||
#define REGISTRY_THREADING L"ThreadingModel"
|
||||
#define REGISTRY_APARTMENT L"Apartment"
|
||||
#define REGISTRY_VERSION L"Version"
|
||||
#define REGISTRY_VERSION_NUMBER L"1.0"
|
||||
|
||||
//Registry values for running
|
||||
#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay"
|
||||
|
||||
#define GET_FILE_OVERLAY_ID L"getFileIconId"
|
||||
|
||||
#define PORT 33001
|
||||
@@ -1 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
// Note: Here was a #define for windows target version
|
||||
// e.g. WINVER / _WIN32_WINNT, see https://devblogs.microsoft.com/oldnewthing/20070411-00/?p=27283
|
||||
// Unnecessary because we define both in desktop/CMakeLists.txt
|
||||
|
||||
#include "CommunicationSocket.h"
|
||||
#include "RegistryUtil.h"
|
||||
#include "OverlayConstants.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include <string>
|
||||
#include <new>
|
||||
#include <Guiddef.h>
|
||||
#include <windows.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <unknwn.h>
|
||||
#include <vector>
|
||||
#include <strsafe.h>
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCOverlays", "OCOverlays\OCOverlays.vcxproj", "{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3} = {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtil", "OCUtil\OCUtil.vcxproj", "{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCContextMenu", "OCContextMenu\OCContextMenu.vcxproj", "{FF34851F-1346-4809-A68A-B1188D7DFF32}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3} = {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|x64.Build.0 = Debug|x64
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|Win32.Build.0 = Release|Win32
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.ActiveCfg = Release|x64
|
||||
{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.Build.0 = Release|x64
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.Build.0 = Debug|x64
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.Build.0 = Release|Win32
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.ActiveCfg = Release|x64
|
||||
{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.Build.0 = Release|x64
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Debug|x64.Build.0 = Debug|x64
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Release|Win32.Build.0 = Release|Win32
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Release|x64.ActiveCfg = Release|x64
|
||||
{FF34851F-1346-4809-A68A-B1188D7DFF32}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,17 +0,0 @@
|
||||
add_library(OCUtil SHARED
|
||||
CommunicationSocket.cpp
|
||||
FileUtil.cpp
|
||||
RegistryUtil.cpp
|
||||
RemotePathChecker.cpp
|
||||
stdafx.cpp
|
||||
StringUtil.cpp
|
||||
)
|
||||
|
||||
target_include_directories(OCUtil
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
install(TARGETS OCUtil
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "FileUtil.h"
|
||||
#include "RegistryUtil.h"
|
||||
#include "UtilConstants.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool FileUtil::IsChildFile(const wchar_t* rootFolder, vector<wstring>* files)
|
||||
{
|
||||
for(vector<wstring>::iterator it = files->begin(); it != files->end(); it++)
|
||||
{
|
||||
wstring file = *it;
|
||||
|
||||
size_t found = file.find(rootFolder);
|
||||
|
||||
if(found != string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileUtil::IsChildFile(const wchar_t* rootFolder, const wchar_t* file)
|
||||
{
|
||||
const wstring f(file);
|
||||
|
||||
size_t found = f.find(rootFolder);
|
||||
|
||||
if(found != string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileUtil::IsChildFileOfRoot(std::vector<std::wstring>* files)
|
||||
{
|
||||
wstring* rootFolder = new wstring();
|
||||
bool needed = false;
|
||||
|
||||
if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_FILTER_FOLDER, rootFolder))
|
||||
{
|
||||
if(IsChildFile(rootFolder->c_str(), files))
|
||||
{
|
||||
needed = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete rootFolder;
|
||||
return needed;
|
||||
}
|
||||
|
||||
bool FileUtil::IsChildFileOfRoot(const wchar_t* filePath)
|
||||
{
|
||||
wstring* rootFolder = new wstring();
|
||||
bool needed = false;
|
||||
|
||||
if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_FILTER_FOLDER, rootFolder))
|
||||
{
|
||||
if(FileUtil::IsChildFile(rootFolder->c_str(), filePath))
|
||||
{
|
||||
needed = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete rootFolder;
|
||||
return needed;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef FILEUTIL_H
|
||||
#define FILEUTIL_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma warning (disable : 4251)
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class __declspec(dllexport) FileUtil
|
||||
{
|
||||
public:
|
||||
FileUtil();
|
||||
|
||||
~FileUtil();
|
||||
|
||||
static bool IsChildFile(const wchar_t*, std::vector<std::wstring>*);
|
||||
static bool IsChildFile(const wchar_t*, const wchar_t*);
|
||||
static bool IsChildFileOfRoot(std::vector<std::wstring>*);
|
||||
static bool IsChildFileOfRoot(const wchar_t*);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,176 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}</ProjectGuid>
|
||||
<RootNamespace>OCUtil</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x86</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<TargetName>$(ProjectName)_x64</TargetName>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<TargetName>$(ProjectName)_x86</TargetName>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\..\binary\shell_integration\windows\$(Configuration)\$(Platform)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PreprocessorDefinitions>NDEBUG;_USING_V110_SDK71_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="RemotePathChecker.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="StringUtil.h" />
|
||||
<ClInclude Include="UtilConstants.h" />
|
||||
<ClInclude Include="CommunicationSocket.h" />
|
||||
<ClInclude Include="FileUtil.h" />
|
||||
<ClInclude Include="RegistryUtil.h" />
|
||||
<ClInclude Include="Version.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CommunicationSocket.cpp" />
|
||||
<ClCompile Include="RemotePathChecker.cpp" />
|
||||
<ClCompile Include="FileUtil.cpp" />
|
||||
<ClCompile Include="RegistryUtil.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StringUtil.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "RegistryUtil.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define SIZE 4096
|
||||
|
||||
bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, int* result)
|
||||
{
|
||||
wstring* strResult = new wstring();
|
||||
|
||||
if(!ReadRegistry(key, name, strResult))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*result = stoi( strResult->c_str() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, wstring* result)
|
||||
{
|
||||
HRESULT hResult;
|
||||
|
||||
HKEY rootKey = nullptr;
|
||||
|
||||
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, 0, KEY_READ, &rootKey));
|
||||
|
||||
if(!SUCCEEDED(hResult))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wchar_t value[SIZE];
|
||||
DWORD value_length = SIZE;
|
||||
|
||||
hResult = RegQueryValueEx(rootKey, (LPCWSTR)name, nullptr, nullptr, (LPBYTE)value, &value_length );
|
||||
|
||||
if(!SUCCEEDED(hResult))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
result->append(value);
|
||||
|
||||
HRESULT hResult2 = RegCloseKey(rootKey);
|
||||
|
||||
if (!SUCCEEDED(hResult2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#ifndef REGISTRYUTIL_H
|
||||
#define REGISTRYUTIL_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma warning (disable : 4251)
|
||||
|
||||
#include <string>
|
||||
|
||||
class __declspec(dllexport) RegistryUtil
|
||||
{
|
||||
public:
|
||||
RegistryUtil();
|
||||
|
||||
~RegistryUtil();
|
||||
|
||||
static bool ReadRegistry(const wchar_t*, const wchar_t*, int*);
|
||||
static bool ReadRegistry(const wchar_t*, const wchar_t*, std::wstring*);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library 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 for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#define PLUG_IN_SOCKET_ADDRESS "127.0.0.1"
|
||||
|
||||
#define BACK_SLASH L"\\"
|
||||
#define CLOSE_BRACE L"]"
|
||||
#define CLOSE_CURLY_BRACE L"}"
|
||||
#define COLON L":"
|
||||
#define COMMAND L"command"
|
||||
#define COMMA L","
|
||||
#define OPEN_BRACE L"["
|
||||
#define OPEN_CURLY_BRACE L"{"
|
||||
#define QUOTE L"\""
|
||||
#define VALUE L"value"
|
||||
|
||||
#define REGISTRY_ROOT_KEY L"SOFTWARE\\ownCloud Inc\\ownCloud"
|
||||
#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay"
|
||||
#define REGISTRY_FILTER_FOLDER L"FilterFolder"
|
||||
@@ -1 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
// Note: Here was a #define for windows target version
|
||||
// e.g. WINVER / _WIN32_WINNT, see https://devblogs.microsoft.com/oldnewthing/20070411-00/?p=27283
|
||||
// Unnecessary because we define both in desktop/CMakeLists.txt
|
||||
|
||||
#include <windows.h>
|
||||
93
shell_integration/windows/WinShellExt.wxs.in
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
*
|
||||
* Copyright (C) by Michael Schuster <michael.schuster@nextcloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License
|
||||
* for more details.
|
||||
*
|
||||
-->
|
||||
<?include $(var.ProjectPath)Platform.wxi?>
|
||||
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Fragment>
|
||||
|
||||
<!--
|
||||
IMPORTANT: Keep these constants in sync with WinShellExtConstants.h.in
|
||||
-->
|
||||
|
||||
<!-- Context Menu -->
|
||||
<?define ContextMenuGuid = "@WIN_SHELLEXT_CONTEXT_MENU_GUID@" ?>
|
||||
<?define ContextMenuRegKeyName = "@APPLICATION_SHORTNAME@ContextMenuHandler" ?>
|
||||
|
||||
<?define ContextMenuDescription = "@APPLICATION_SHORTNAME@ context menu handler" ?>
|
||||
|
||||
<!-- Overlays -->
|
||||
<?define OverlayGuidError = "@WIN_SHELLEXT_OVERLAY_GUID_ERROR@" ?>
|
||||
<?define OverlayGuidOK = "@WIN_SHELLEXT_OVERLAY_GUID_OK@" ?>
|
||||
<?define OverlayGuidOKShared = "@WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED@" ?>
|
||||
<?define OverlayGuidSync = "@WIN_SHELLEXT_OVERLAY_GUID_SYNC@" ?>
|
||||
<?define OverlayGuidWarning = "@WIN_SHELLEXT_OVERLAY_GUID_WARNING@" ?>
|
||||
|
||||
<!--
|
||||
Preceeding spaces are intended, two spaces to put us ahead of the competition :/
|
||||
|
||||
There is a limit in Windows (oh wonder^^) so that only the first 15 extensions get invoked, this is why to use that dirty little trick to get ahead ;)
|
||||
See: https://docs.microsoft.com/en-us/windows/win32/shell/context-menu-handlers?redirectedfrom=MSDN#employing-the-verb-selection-model
|
||||
-->
|
||||
<?define OverlayNameError = " @APPLICATION_SHORTNAME@Error" ?>
|
||||
<?define OverlayNameOK = " @APPLICATION_SHORTNAME@OK" ?>
|
||||
<?define OverlayNameOKShared = " @APPLICATION_SHORTNAME@OKShared" ?>
|
||||
<?define OverlayNameSync = " @APPLICATION_SHORTNAME@Sync" ?>
|
||||
<?define OverlayNameWarning = " @APPLICATION_SHORTNAME@Warning" ?>
|
||||
|
||||
<?define OverlayDescription = "@APPLICATION_SHORTNAME@ overlay handler" ?>
|
||||
|
||||
<!--
|
||||
Integration for Windows Explorer
|
||||
|
||||
Avoid SelfReg by the DLLs, see:
|
||||
https://stackoverflow.com/questions/364187/how-do-you-register-a-win32-com-dll-file-in-wix-3#364210
|
||||
https://docs.microsoft.com/en-us/windows/win32/msi/selfreg-table#remarks
|
||||
-->
|
||||
|
||||
<DirectoryRef Id="ShellExtDir">
|
||||
<Component Id="NCContextMenu" Guid="*" Win64="$(var.PlatformWin64)">
|
||||
<File Id="NCContextMenu.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\shellext\NCContextMenu.dll">
|
||||
<Class Id="$(var.ContextMenuGuid)" Context="InprocServer32" Description="$(var.ContextMenuDescription)" ThreadingModel="apartment" />
|
||||
</File>
|
||||
<RegistryValue Root="HKCR" Key="AllFileSystemObjects\shellex\ContextMenuHandlers\$(var.ContextMenuRegKeyName)" Value="$(var.ContextMenuGuid)" Type="string" Action="write" />
|
||||
</Component>
|
||||
|
||||
<Component Id="NCOverlays" Guid="*" Win64="$(var.PlatformWin64)">
|
||||
<File Id="NCOverlays.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\shellext\NCOverlays.dll">
|
||||
<Class Id="$(var.OverlayGuidError)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
|
||||
<Class Id="$(var.OverlayGuidOK)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
|
||||
<Class Id="$(var.OverlayGuidOKShared)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
|
||||
<Class Id="$(var.OverlayGuidSync)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
|
||||
<Class Id="$(var.OverlayGuidWarning)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
|
||||
</File>
|
||||
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers">
|
||||
<RegistryValue Key="$(var.OverlayNameError)" Value="$(var.OverlayGuidError)" Type="string" Action="write" />
|
||||
<RegistryValue Key="$(var.OverlayNameOK)" Value="$(var.OverlayGuidOK)" Type="string" Action="write" />
|
||||
<RegistryValue Key="$(var.OverlayNameOKShared)" Value="$(var.OverlayGuidOKShared)" Type="string" Action="write" />
|
||||
<RegistryValue Key="$(var.OverlayNameSync)" Value="$(var.OverlayGuidSync)" Type="string" Action="write" />
|
||||
<RegistryValue Key="$(var.OverlayNameWarning)" Value="$(var.OverlayGuidWarning)" Type="string" Action="write" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<ComponentGroup Id="ShellExtensions">
|
||||
<ComponentRef Id="NCContextMenu" />
|
||||
<ComponentRef Id="NCOverlays" />
|
||||
</ComponentGroup>
|
||||
|
||||
</Fragment>
|
||||
</Wix>
|
||||
47
shell_integration/windows/WinShellExtConstants.h.in
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) by Michael Schuster <michael.schuster@nextcloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// IMPORTANT: Keep these constants in sync with WinShellExtConstants.wxi.in
|
||||
|
||||
// Context Menu
|
||||
#define CONTEXT_MENU_GUID L"@WIN_SHELLEXT_CONTEXT_MENU_GUID@"
|
||||
#define CONTEXT_MENU_REGKEY_NAME L"@APPLICATION_SHORTNAME@ContextMenuHandler"
|
||||
|
||||
#define CONTEXT_MENU_DESCRIPTION L"@APPLICATION_SHORTNAME@ context menu handler"
|
||||
|
||||
// Overlays
|
||||
#define OVERLAY_GUID_ERROR L"@WIN_SHELLEXT_OVERLAY_GUID_ERROR@"
|
||||
#define OVERLAY_GUID_OK L"@WIN_SHELLEXT_OVERLAY_GUID_OK@"
|
||||
#define OVERLAY_GUID_OK_SHARED L"@WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED@"
|
||||
#define OVERLAY_GUID_SYNC L"@WIN_SHELLEXT_OVERLAY_GUID_SYNC@"
|
||||
#define OVERLAY_GUID_WARNING L"@WIN_SHELLEXT_OVERLAY_GUID_WARNING@"
|
||||
|
||||
//
|
||||
// Preceeding spaces are intended, two spaces to put us ahead of the competition :/
|
||||
//
|
||||
// There is a limit in Windows (oh wonder^^) so that only the first 15 extensions get invoked, this is why to use that dirty little trick to get ahead ;)
|
||||
// See: https://docs.microsoft.com/en-us/windows/win32/shell/context-menu-handlers?redirectedfrom=MSDN#employing-the-verb-selection-model
|
||||
//
|
||||
#define OVERLAY_NAME_ERROR L" @APPLICATION_SHORTNAME@Error"
|
||||
#define OVERLAY_NAME_OK L" @APPLICATION_SHORTNAME@OK"
|
||||
#define OVERLAY_NAME_OK_SHARED L" @APPLICATION_SHORTNAME@OKShared"
|
||||
#define OVERLAY_NAME_SYNC L" @APPLICATION_SHORTNAME@Sync"
|
||||
#define OVERLAY_NAME_WARNING L" @APPLICATION_SHORTNAME@Warning"
|
||||
|
||||
#define OVERLAY_DESCRIPTION L"@APPLICATION_SHORTNAME@ overlay handler"
|
||||
|
||||
// NCUtil
|
||||
#define UTIL_PIPE_APP_NAME L"@APPLICATION_EXECUTABLE@"
|
||||
@@ -34,9 +34,15 @@ if(NOT MSVC)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# Enable DEP & ASLR
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase")
|
||||
# Enable DEP, ASLR and CFG
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
|
||||
|
||||
# x86 only: Enable SafeSEH
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /safeseh")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /safeseh")
|
||||
endif()
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
||||
|
||||
@@ -499,7 +499,7 @@ restart_sync:
|
||||
}
|
||||
|
||||
Cmd cmd;
|
||||
QString dbPath = options.source_dir + SyncJournalDb::makeDbName(credentialFreeUrl, folder, user);
|
||||
QString dbPath = SyncJournalDb::makeDbName(credentialFreeUrl, folder, user);
|
||||
SyncJournalDb db(dbPath);
|
||||
|
||||
if (!selectiveSyncList.empty()) {
|
||||
|
||||
@@ -158,6 +158,7 @@ struct OCSYNC_EXPORT csync_file_stat_s {
|
||||
bool child_modified BITFIELD(1);
|
||||
bool has_ignored_files BITFIELD(1); // Specify that a directory, or child directory contains ignored files.
|
||||
bool is_hidden BITFIELD(1); // Not saved in the DB, only used during discovery for local files.
|
||||
bool isE2eEncrypted BITFIELD(1);
|
||||
|
||||
QByteArray path;
|
||||
QByteArray rename_path;
|
||||
@@ -173,7 +174,6 @@ struct OCSYNC_EXPORT csync_file_stat_s {
|
||||
// In both cases, the format is "SHA1:baff".
|
||||
QByteArray checksumHeader;
|
||||
QByteArray e2eMangledName;
|
||||
bool isE2eEncrypted;
|
||||
|
||||
CSYNC_STATUS error_status = CSYNC_STATUS_OK;
|
||||
|
||||
|
||||
@@ -395,12 +395,19 @@ if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
|
||||
|
||||
set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(NO_STRIP "-no-strip")
|
||||
else()
|
||||
set(NO_STRIP "")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET ${APPLICATION_EXECUTABLE} POST_BUILD
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
|
||||
"$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
|
||||
-qmldir=${CMAKE_SOURCE_DIR}/src/gui
|
||||
-always-overwrite
|
||||
-executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
|
||||
${NO_STRIP}
|
||||
COMMENT "Running macdeployqt..."
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -197,10 +197,14 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
|
||||
connect(_accountState->account()->e2e(), &ClientSideEncryption::showMnemonic, this, &AccountSettings::slotShowMnemonic);
|
||||
|
||||
connect(_accountState->account()->e2e(), &ClientSideEncryption::mnemonicGenerated, this, &AccountSettings::slotNewMnemonicGenerated);
|
||||
if (_accountState->account()->e2e()->newMnemonicGenerated())
|
||||
{
|
||||
if (_accountState->account()->e2e()->newMnemonicGenerated()) {
|
||||
slotNewMnemonicGenerated();
|
||||
} else {
|
||||
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
|
||||
|
||||
auto *mnemonic = new QAction(tr("Display mnemonic"), this);
|
||||
connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic);
|
||||
_ui->encryptionMessage->addAction(mnemonic);
|
||||
_ui->encryptionMessage->hide();
|
||||
}
|
||||
|
||||
@@ -837,6 +841,10 @@ void AccountSettings::slotAccountStateChanged()
|
||||
*/
|
||||
qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
|
||||
<< "Client Side Encryption" << accountsState()->account()->capabilities().clientSideEncryptionAvailable();
|
||||
|
||||
if (_accountState->account()->capabilities().clientSideEncryptionAvailable()) {
|
||||
_ui->encryptionMessage->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ AccountState::AccountState(AccountPtr account)
|
||||
, _waitingForNewCredentials(false)
|
||||
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
|
||||
, _remoteWipe(new RemoteWipe(_account))
|
||||
, _hasTalk(false)
|
||||
{
|
||||
qRegisterMetaType<AccountState *>("AccountState*");
|
||||
|
||||
@@ -74,11 +73,6 @@ AccountPtr AccountState::account() const
|
||||
return _account;
|
||||
}
|
||||
|
||||
bool AccountState::hasTalk() const
|
||||
{
|
||||
return _hasTalk;
|
||||
}
|
||||
|
||||
AccountState::ConnectionStatus AccountState::connectionStatus() const
|
||||
{
|
||||
return _connectionStatus;
|
||||
@@ -444,7 +438,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
|
||||
qCWarning(lcAccountState) << "Status code " << statusCode << " Not Modified - No new navigation apps.";
|
||||
} else {
|
||||
_apps.clear();
|
||||
_hasTalk = false;
|
||||
|
||||
if(!reply.isEmpty()){
|
||||
auto element = reply.object().value("ocs").toObject().value("data");
|
||||
@@ -458,9 +451,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
|
||||
navLink.value("id").toString(), QUrl(navLink.value("icon").toString()));
|
||||
|
||||
_apps << app;
|
||||
|
||||
if(app->id() == QLatin1String("spreed"))
|
||||
_hasTalk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,8 +103,6 @@ public:
|
||||
|
||||
bool isSignedOut() const;
|
||||
|
||||
bool hasTalk() const;
|
||||
|
||||
AccountAppList appList() const;
|
||||
AccountApp* findApp(const QString &appId) const;
|
||||
|
||||
@@ -195,7 +193,6 @@ private:
|
||||
ConnectionStatus _connectionStatus;
|
||||
QStringList _connectionErrors;
|
||||
bool _waitingForNewCredentials;
|
||||
bool _hasTalk;
|
||||
QElapsedTimer _timeSinceLastETagCheck;
|
||||
QPointer<ConnectionValidator> _connectionValidator;
|
||||
QByteArray _notificationsEtagResponseHeader;
|
||||
|
||||
@@ -26,7 +26,6 @@ ElidedLabel::ElidedLabel(QWidget *parent)
|
||||
ElidedLabel::ElidedLabel(const QString &text, QWidget *parent)
|
||||
: QLabel(text, parent)
|
||||
, _text(text)
|
||||
, _elideMode(Qt::ElideNone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -218,13 +218,27 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
|
||||
socketApi()->slotUnregisterPath(folderAlias);
|
||||
auto settings = account->settings();
|
||||
|
||||
auto journalFileMoveSuccess = true;
|
||||
// Due to db logic can't be sure which of these file exist.
|
||||
if (oldJournal.exists()) {
|
||||
journalFileMoveSuccess &= oldJournal.rename(folderDefinition.journalPath);
|
||||
}
|
||||
if (oldJournalShm.exists()) {
|
||||
journalFileMoveSuccess &= oldJournalShm.rename(folderDefinition.journalPath.append("-shm"));
|
||||
}
|
||||
if (oldJournalWal.exists()) {
|
||||
journalFileMoveSuccess &= oldJournalWal.rename(folderDefinition.journalPath.append("-wal"));
|
||||
}
|
||||
|
||||
if (!journalFileMoveSuccess) {
|
||||
qCWarning(lcFolderMan) << "Wasn't able to move pre-2.7 syncjournal database files to new location. One-time loss off sync settings possible.";
|
||||
} else {
|
||||
qCInfo(lcFolderMan) << "Successfully migrated syncjournal database.";
|
||||
}
|
||||
|
||||
Folder *f = addFolderInternal(folderDefinition, account.data());
|
||||
f->saveToSettings();
|
||||
|
||||
oldJournal.remove();
|
||||
oldJournalShm.remove();
|
||||
oldJournalWal.remove();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -931,6 +945,11 @@ Folder *FolderMan::addFolderInternal(FolderDefinition folderDefinition,
|
||||
|
||||
auto folder = new Folder(folderDefinition, accountState, this);
|
||||
|
||||
if (_navigationPaneHelper.showInExplorerNavigationPane() && folderDefinition.navigationPaneClsid.isNull()) {
|
||||
folder->setNavigationPaneClsid(QUuid::createUuid());
|
||||
folder->saveToSettings();
|
||||
}
|
||||
|
||||
qCInfo(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias();
|
||||
_folderMap[folder->alias()] = folder;
|
||||
if (folder->syncPaused()) {
|
||||
|
||||
@@ -156,23 +156,23 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
}
|
||||
painter->save();
|
||||
|
||||
QIcon statusIcon = qvariant_cast<QIcon>(index.data(FolderStatusIconRole));
|
||||
QString aliasText = qvariant_cast<QString>(index.data(HeaderRole));
|
||||
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
|
||||
QString remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
|
||||
QStringList conflictTexts = qvariant_cast<QStringList>(index.data(FolderConflictMsg));
|
||||
QStringList errorTexts = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
|
||||
auto statusIcon = qvariant_cast<QIcon>(index.data(FolderStatusIconRole));
|
||||
auto aliasText = qvariant_cast<QString>(index.data(HeaderRole));
|
||||
auto pathText = qvariant_cast<QString>(index.data(FolderPathRole));
|
||||
auto remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
|
||||
auto conflictTexts = qvariant_cast<QStringList>(index.data(FolderConflictMsg));
|
||||
auto errorTexts = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
|
||||
|
||||
int overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
|
||||
QString overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
|
||||
QString itemString = qvariant_cast<QString>(index.data(SyncProgressItemString));
|
||||
int warningCount = qvariant_cast<int>(index.data(WarningCount));
|
||||
bool syncOngoing = qvariant_cast<bool>(index.data(SyncRunning));
|
||||
QDateTime syncDate = qvariant_cast<QDateTime>(index.data(SyncDate));
|
||||
bool syncEnabled = qvariant_cast<bool>(index.data(FolderAccountConnected));
|
||||
auto overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
|
||||
auto overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
|
||||
auto itemString = qvariant_cast<QString>(index.data(SyncProgressItemString));
|
||||
auto warningCount = qvariant_cast<int>(index.data(WarningCount));
|
||||
auto syncOngoing = qvariant_cast<bool>(index.data(SyncRunning));
|
||||
auto syncDate = qvariant_cast<QDateTime>(index.data(SyncDate));
|
||||
auto syncEnabled = qvariant_cast<bool>(index.data(FolderAccountConnected));
|
||||
|
||||
QRect iconRect = option.rect;
|
||||
QRect aliasRect = option.rect;
|
||||
auto iconRect = option.rect;
|
||||
auto aliasRect = option.rect;
|
||||
|
||||
iconRect.setLeft(option.rect.left() + aliasMargin);
|
||||
iconRect.setTop(iconRect.top() + aliasMargin); // (iconRect.height()-iconsize.height())/2);
|
||||
@@ -183,12 +183,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||
aliasRect.setRight(aliasRect.right() - aliasMargin);
|
||||
|
||||
// remote directory box
|
||||
QRect remotePathRect = aliasRect;
|
||||
auto remotePathRect = aliasRect;
|
||||
remotePathRect.setTop(aliasRect.bottom() + margin);
|
||||
remotePathRect.setBottom(remotePathRect.top() + subFm.height());
|
||||
|
||||
// local directory box
|
||||
QRect localPathRect = remotePathRect;
|
||||
auto localPathRect = remotePathRect;
|
||||
localPathRect.setTop(remotePathRect.bottom() + margin);
|
||||
localPathRect.setBottom(localPathRect.top() + subFm.height());
|
||||
|
||||
|
||||
@@ -149,9 +149,6 @@ void OcsShareJob::createShare(const QString &path,
|
||||
addParam(QString::fromLatin1("path"), path);
|
||||
addParam(QString::fromLatin1("shareType"), QString::number(shareType));
|
||||
addParam(QString::fromLatin1("shareWith"), shareWith);
|
||||
if (!(permissions & SharePermissionDefault)) {
|
||||
addParam(QString::fromLatin1("permissions"), QString::number(permissions));
|
||||
}
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
@@ -79,12 +79,15 @@ ownCloudGui::ownCloudGui(Application *parent)
|
||||
connect(_tray.data(), &Systray::pauseSync,
|
||||
this, &ownCloudGui::slotPauseAllFolders);
|
||||
|
||||
connect(_tray.data(), &Systray::pauseSync,
|
||||
connect(_tray.data(), &Systray::resumeSync,
|
||||
this, &ownCloudGui::slotUnpauseAllFolders);
|
||||
|
||||
connect(_tray.data(), &Systray::openHelp,
|
||||
this, &ownCloudGui::slotHelp);
|
||||
|
||||
connect(_tray.data(), &Systray::openAccountWizard,
|
||||
this, &ownCloudGui::slotNewAccountWizard);
|
||||
|
||||
connect(_tray.data(), &Systray::openMainDialog,
|
||||
this, &ownCloudGui::slotOpenMainDialog);
|
||||
|
||||
|
||||
@@ -154,24 +154,25 @@ void ShareLinkWidget::setupUiOptions()
|
||||
permissionsGroup->setExclusive(true);
|
||||
|
||||
if (_isFile) {
|
||||
checked = perm & (SharePermissionRead & SharePermissionUpdate);
|
||||
_allowEditingLinkAction = _linkContextMenu->addAction(tr("Allow Editing"));
|
||||
checked = (perm & SharePermissionRead) && (perm & SharePermissionUpdate);
|
||||
_allowEditingLinkAction = _linkContextMenu->addAction(tr("Allow editing"));
|
||||
_allowEditingLinkAction->setCheckable(true);
|
||||
_allowEditingLinkAction->setChecked(checked);
|
||||
|
||||
} else {
|
||||
checked = perm & SharePermissionRead;
|
||||
checked = (perm == SharePermissionRead);
|
||||
_readOnlyLinkAction = permissionsGroup->addAction(tr("Read only"));
|
||||
_readOnlyLinkAction->setCheckable(true);
|
||||
_readOnlyLinkAction->setChecked(checked);
|
||||
|
||||
checked = perm & (SharePermissionRead & SharePermissionCreate & SharePermissionUpdate & SharePermissionDelete);
|
||||
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow Upload && Editing"));
|
||||
checked = (perm & SharePermissionRead) && (perm & SharePermissionCreate)
|
||||
&& (perm & SharePermissionUpdate) && (perm & SharePermissionDelete);
|
||||
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow upload and editing"));
|
||||
_allowUploadEditingLinkAction->setCheckable(true);
|
||||
_allowUploadEditingLinkAction->setChecked(checked);
|
||||
|
||||
checked = perm & SharePermissionCreate;
|
||||
_allowUploadLinkAction = permissionsGroup->addAction(tr("File Drop (Upload Only)"));
|
||||
checked = (perm == SharePermissionCreate);
|
||||
_allowUploadLinkAction = permissionsGroup->addAction(tr("File drop (upload only)"));
|
||||
_allowUploadLinkAction->setCheckable(true);
|
||||
_allowUploadLinkAction->setChecked(checked);
|
||||
}
|
||||
@@ -186,7 +187,7 @@ void ShareLinkWidget::setupUiOptions()
|
||||
}
|
||||
|
||||
// Adds action to display note widget (check box)
|
||||
_noteLinkAction = _linkContextMenu->addAction(tr("Add note to recipient"));
|
||||
_noteLinkAction = _linkContextMenu->addAction(tr("Note to recipient"));
|
||||
_noteLinkAction->setCheckable(true);
|
||||
|
||||
if (_linkShare->getNote().isSimpleText() && !_linkShare->getNote().isEmpty()) {
|
||||
@@ -196,7 +197,7 @@ void ShareLinkWidget::setupUiOptions()
|
||||
}
|
||||
|
||||
// Adds action to display password widget (check box)
|
||||
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect"));
|
||||
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password protect"));
|
||||
_passwordProtectLinkAction->setCheckable(true);
|
||||
|
||||
if (_linkShare.data()->isPasswordSet()) {
|
||||
@@ -213,7 +214,7 @@ void ShareLinkWidget::setupUiOptions()
|
||||
}
|
||||
|
||||
// Adds action to display expiration date widget (check box)
|
||||
_expirationDateLinkAction = _linkContextMenu->addAction(tr("Expiration Date"));
|
||||
_expirationDateLinkAction = _linkContextMenu->addAction(tr("Set expiration date"));
|
||||
_expirationDateLinkAction->setCheckable(true);
|
||||
if (!expireDate.isNull()) {
|
||||
_ui->calendar->setDate(expireDate);
|
||||
@@ -232,7 +233,7 @@ void ShareLinkWidget::setupUiOptions()
|
||||
|
||||
// Adds action to unshare widget (check box)
|
||||
_unshareLinkAction = _linkContextMenu->addAction(QIcon(":/client/theme/delete.svg"),
|
||||
tr("Unshare"));
|
||||
tr("Delete share link"));
|
||||
|
||||
_linkContextMenu->addSeparator();
|
||||
|
||||
@@ -564,11 +565,11 @@ void ShareLinkWidget::customizeStyle()
|
||||
_addAnotherLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/add.svg"));
|
||||
|
||||
_ui->enableShareLink->setIcon(Theme::createColorAwareIcon(":/client/theme/copy.svg"));
|
||||
|
||||
|
||||
_ui->shareLinkIconLabel->setPixmap(Theme::createColorAwarePixmap(":/client/theme/public.svg"));
|
||||
|
||||
|
||||
_ui->shareLinkToolButton->setIcon(Theme::createColorAwareIcon(":/client/theme/more.svg"));
|
||||
|
||||
|
||||
_ui->confirmNote->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
|
||||
_ui->confirmPassword->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
|
||||
_ui->confirmExpirationDate->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
|
||||
|
||||
@@ -28,7 +28,7 @@ enum SharePermission {
|
||||
SharePermissionCreate = 4,
|
||||
SharePermissionDelete = 8,
|
||||
SharePermissionShare = 16,
|
||||
SharePermissionDefault = 1 << 30
|
||||
SharePermissionDefault = 31
|
||||
};
|
||||
Q_DECLARE_FLAGS(SharePermissions, SharePermission)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions)
|
||||
|
||||
@@ -208,7 +208,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
|
||||
}
|
||||
|
||||
// the owner of the file that shared it first
|
||||
// leave out if it's the current user
|
||||
// leave out if it's the current user
|
||||
if(x == 0 && !share->getUidOwner().isEmpty() && !(share->getUidOwner() == _account->credentials()->user())) {
|
||||
_ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName()));
|
||||
}
|
||||
@@ -320,7 +320,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
|
||||
} else {
|
||||
|
||||
// Default permissions on creation
|
||||
int permissions = SharePermissionRead | SharePermissionUpdate;
|
||||
int permissions = SharePermissionCreate | SharePermissionUpdate
|
||||
| SharePermissionDelete | SharePermissionShare;
|
||||
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
|
||||
sharee->shareWith(), SharePermission(permissions));
|
||||
}
|
||||
|
||||
@@ -178,7 +178,8 @@ SocketApi::SocketApi(QObject *parent)
|
||||
|
||||
if (Utility::isWindows()) {
|
||||
socketPath = QLatin1String(R"(\\.\pipe\)")
|
||||
+ QLatin1String("ownCloud-")
|
||||
+ QLatin1String(APPLICATION_EXECUTABLE)
|
||||
+ QLatin1String("-")
|
||||
+ QString::fromLocal8Bit(qgetenv("USERNAME"));
|
||||
// TODO: once the windows extension supports multiple
|
||||
// client connections, switch back to the theme name
|
||||
@@ -718,11 +719,11 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis
|
||||
listener->sendMessage(QString("GET_STRINGS:END"));
|
||||
}
|
||||
|
||||
void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener)
|
||||
void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, bool enabled)
|
||||
{
|
||||
auto record = fileData.journalRecord();
|
||||
bool isOnTheServer = record.isValid();
|
||||
auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:");
|
||||
auto flagString = isOnTheServer && enabled ? QLatin1String("::") : QLatin1String(":d:");
|
||||
|
||||
auto capabilities = fileData.folder->accountState()->account()->capabilities();
|
||||
auto theme = Theme::instance();
|
||||
@@ -798,7 +799,8 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
|
||||
bool hasSeveralFiles = argument.contains(QLatin1Char('\x1e')); // Record Separator
|
||||
FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument);
|
||||
bool isOnTheServer = fileData.journalRecord().isValid();
|
||||
auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:");
|
||||
const auto isE2eEncryptedPath = fileData.journalRecord()._isE2eEncrypted || !fileData.journalRecord()._e2eMangledName.isEmpty();
|
||||
auto flagString = isOnTheServer && !isE2eEncryptedPath ? QLatin1String("::") : QLatin1String(":d:");
|
||||
|
||||
if (fileData.folder && fileData.folder->accountState()->isConnected()) {
|
||||
DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath);
|
||||
@@ -809,7 +811,7 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
|
||||
listener->sendMessage(QLatin1String("MENU_ITEM:OPEN_PRIVATE_LINK") + flagString + tr("Open in browser"));
|
||||
}
|
||||
|
||||
sendSharingContextMenuOptions(fileData, listener);
|
||||
sendSharingContextMenuOptions(fileData, listener, !isE2eEncryptedPath);
|
||||
}
|
||||
listener->sendMessage(QString("GET_MENU_ITEMS:END"));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
Q_INVOKABLE void command_GET_STRINGS(const QString &argument, SocketListener *listener);
|
||||
|
||||
// Sends the context menu options relating to sharing to listener
|
||||
void sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener);
|
||||
void sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, bool enabled);
|
||||
|
||||
/** Send the list of menu item. (added in version 1.1)
|
||||
* argument is a list of files for which the menu should be shown, separated by '\x1e'
|
||||
|
||||
@@ -82,7 +82,11 @@ Systray::Systray()
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
auto contextMenu = new QMenu();
|
||||
contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
|
||||
if (AccountManager::instance()->accounts().isEmpty()) {
|
||||
contextMenu->addAction(tr("Add account"), this, &Systray::openAccountWizard);
|
||||
} else {
|
||||
contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
|
||||
}
|
||||
contextMenu->addAction(tr("Settings"), this, &Systray::openSettings);
|
||||
contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
|
||||
setContextMenu(contextMenu);
|
||||
@@ -105,6 +109,14 @@ void Systray::create()
|
||||
}
|
||||
hideWindow();
|
||||
emit activated(QSystemTrayIcon::ActivationReason::Unknown);
|
||||
|
||||
const auto folderMap = FolderMan::instance()->map();
|
||||
for (const auto *folder : folderMap) {
|
||||
if (!folder->syncPaused()) {
|
||||
_syncIsPaused = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Systray::slotNewUserSelected()
|
||||
@@ -264,14 +276,14 @@ QRect Systray::taskbarGeometry() const
|
||||
#elif defined(Q_OS_MACOS)
|
||||
// Finder bar is always 22px height on macOS (when treating as effective pixels)
|
||||
auto screenWidth = currentScreenRect().width();
|
||||
return QRect(0, 0, screenWidth, 22);
|
||||
return {0, 0, screenWidth, 22};
|
||||
#else
|
||||
if (taskbarOrientation() == TaskBarPosition::Bottom || taskbarOrientation() == TaskBarPosition::Top) {
|
||||
auto screenWidth = currentScreenRect().width();
|
||||
return QRect(0, 0, screenWidth, 32);
|
||||
return {0, 0, screenWidth, 32};
|
||||
} else {
|
||||
auto screenHeight = currentScreenRect().height();
|
||||
return QRect(0, 0, 32, screenHeight);
|
||||
return {0, 0, 32, screenHeight};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -279,8 +291,8 @@ QRect Systray::taskbarGeometry() const
|
||||
QRect Systray::currentScreenRect() const
|
||||
{
|
||||
const auto screen = currentScreen();
|
||||
const auto rect = screen->geometry();
|
||||
return rect.translated(screen->virtualGeometry().topLeft());
|
||||
Q_ASSERT(screen);
|
||||
return screen->geometry();
|
||||
}
|
||||
|
||||
QPoint Systray::computeWindowReferencePoint() const
|
||||
@@ -378,7 +390,7 @@ QPoint Systray::calcTrayIconCenter() const
|
||||
return trayIconCenter;
|
||||
#else
|
||||
// On Linux, fall back to mouse position (assuming tray icon is activated by mouse click)
|
||||
return QCursor::pos();
|
||||
return QCursor::pos(currentScreen());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
|
||||
signals:
|
||||
void currentUserChanged();
|
||||
void openAccountWizard();
|
||||
void openMainDialog();
|
||||
void openSettings();
|
||||
void openHelp();
|
||||
@@ -91,7 +92,7 @@ private:
|
||||
QPoint computeWindowPosition(int width, int height) const;
|
||||
|
||||
bool _isOpen = false;
|
||||
bool _syncIsPaused = false;
|
||||
bool _syncIsPaused = true;
|
||||
QPointer<QQmlApplicationEngine> _trayEngine;
|
||||
};
|
||||
|
||||
|
||||
@@ -90,21 +90,36 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
||||
return QString();
|
||||
case PathRole:
|
||||
if (!a._file.isEmpty()) {
|
||||
auto folder = FolderMan::instance()->folder(a._folder);
|
||||
auto folder = FolderMan::instance()->folderForPath(a._folder);
|
||||
|
||||
QString relPath(a._file);
|
||||
if (folder)
|
||||
relPath.prepend(folder->remotePath());
|
||||
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
|
||||
if (list.count() > 0) {
|
||||
return QUrl::fromLocalFile(list.at(0));
|
||||
}
|
||||
|
||||
// File does not exist anymore? Let's try to open its path
|
||||
if (QFileInfo(relPath).exists()) {
|
||||
if (list.isEmpty() && QFileInfo(relPath).exists()) {
|
||||
list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(relPath).path(), ast->account());
|
||||
if (list.count() > 0) {
|
||||
return QVariant(list.at(0));
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
const auto path = list.at(0);
|
||||
folder = FolderMan::instance()->folderForPath(path);
|
||||
|
||||
// If this is an E2EE file or folder, pretend we got no path, this leads to
|
||||
// hiding the share button which is what we want
|
||||
if (folder) {
|
||||
SyncJournalFileRecord rec;
|
||||
folder->journalDb()->getFileRecord(a._file.mid(1), &rec);
|
||||
if (rec.isValid() && (rec._isE2eEncrypted || !rec._e2eMangledName.isEmpty())) {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
return QUrl::fromLocalFile(path);
|
||||
}
|
||||
return QString();
|
||||
case AbsolutePathRole: {
|
||||
|
||||
@@ -483,7 +483,12 @@ bool User::hasLocalFolder() const
|
||||
|
||||
bool User::serverHasTalk() const
|
||||
{
|
||||
return _account->hasTalk();
|
||||
return talkApp() != nullptr;
|
||||
}
|
||||
|
||||
AccountApp *User::talkApp() const
|
||||
{
|
||||
return _account->findApp(QStringLiteral("spreed"));
|
||||
}
|
||||
|
||||
bool User::hasActivities() const
|
||||
@@ -597,14 +602,6 @@ Q_INVOKABLE QString UserModel::currentUserServer()
|
||||
return _users[_currentUserId]->server();
|
||||
}
|
||||
|
||||
Q_INVOKABLE bool UserModel::currentServerHasTalk()
|
||||
{
|
||||
if (_users.isEmpty())
|
||||
return false;
|
||||
|
||||
return _users[_currentUserId]->serverHasTalk();
|
||||
}
|
||||
|
||||
void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent)
|
||||
{
|
||||
bool containsUser = false;
|
||||
@@ -643,14 +640,15 @@ Q_INVOKABLE void UserModel::openCurrentAccountLocalFolder()
|
||||
|
||||
Q_INVOKABLE void UserModel::openCurrentAccountTalk()
|
||||
{
|
||||
if (_users.isEmpty())
|
||||
if (!currentUser())
|
||||
return;
|
||||
|
||||
QString url = _users[_currentUserId]->server(false) + "/apps/spreed";
|
||||
if (!(url.contains("http://") || url.contains("https://"))) {
|
||||
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed";
|
||||
const auto talkApp = currentUser()->talkApp();
|
||||
if (talkApp) {
|
||||
QDesktopServices::openUrl(talkApp->url());
|
||||
} else {
|
||||
qCWarning(lcActivity) << "The Talk app is not enabled on" << currentUser()->server();
|
||||
}
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
}
|
||||
|
||||
Q_INVOKABLE void UserModel::openCurrentAccountServer()
|
||||
@@ -864,9 +862,10 @@ void UserAppsModel::buildAppList()
|
||||
}
|
||||
|
||||
if (UserModel::instance()->appList().count() > 0) {
|
||||
const auto talkApp = UserModel::instance()->currentUser()->talkApp();
|
||||
foreach (AccountApp *app, UserModel::instance()->appList()) {
|
||||
// Filter out Talk because we have a dedicated button for it
|
||||
if (app->id() == QLatin1String("spreed"))
|
||||
if (talkApp && app->id() == talkApp->id())
|
||||
continue;
|
||||
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
QString server(bool shortened = true) const;
|
||||
bool hasLocalFolder() const;
|
||||
bool serverHasTalk() const;
|
||||
AccountApp *talkApp() const;
|
||||
bool hasActivities() const;
|
||||
AccountAppList appList() const;
|
||||
QImage avatar(bool whiteBg = false) const;
|
||||
@@ -112,7 +113,6 @@ public:
|
||||
Q_INVOKABLE QString currentUserServer();
|
||||
Q_INVOKABLE bool currentUserHasActivities();
|
||||
Q_INVOKABLE bool currentUserHasLocalFolder();
|
||||
Q_INVOKABLE bool currentServerHasTalk();
|
||||
Q_INVOKABLE int currentUserId() const;
|
||||
Q_INVOKABLE bool isUserConnected(const int &id);
|
||||
Q_INVOKABLE void switchCurrentUser(const int &id);
|
||||
|
||||