Compare commits
114 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 |
21
.drone.yml
@@ -3,13 +3,13 @@ name: qt-5.12
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build and test
|
- name: build and test
|
||||||
image: nextcloudci/client-5.12:client-5.12-7
|
image: nextcloudci/client-5.12:client-5.12-9
|
||||||
commands:
|
commands:
|
||||||
# Install QtKeyChain
|
# Install QtKeyChain
|
||||||
- /bin/bash -c "
|
- /bin/bash -c "
|
||||||
export CC=gcc-7 &&
|
export CC=gcc-7 &&
|
||||||
export CXX=g++-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 QTDIR=\$QT_BASE_DIR &&
|
||||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
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 &&
|
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 "
|
- /bin/bash -c "
|
||||||
export CC=gcc-7 &&
|
export CC=gcc-7 &&
|
||||||
export CXX=g++-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 QTDIR=\$QT_BASE_DIR &&
|
||||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
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 &&
|
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:
|
steps:
|
||||||
- name: build and test
|
- name: build and test
|
||||||
image: nextcloudci/client-5.12:client-5.12-7
|
image: nextcloudci/client-5.12:client-5.12-9
|
||||||
commands:
|
commands:
|
||||||
# Install QtKeyChain
|
# Install QtKeyChain
|
||||||
- /bin/bash -c "
|
- /bin/bash -c "
|
||||||
export CC=clang-6.0 &&
|
export CC=clang-6.0 &&
|
||||||
export CXX=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 QTDIR=\$QT_BASE_DIR &&
|
||||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
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 &&
|
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 "
|
- /bin/bash -c "
|
||||||
export CC=clang-6.0 &&
|
export CC=clang-6.0 &&
|
||||||
export CXX=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 QTDIR=\$QT_BASE_DIR &&
|
||||||
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
|
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 &&
|
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
|
||||||
@@ -103,10 +103,15 @@ name: AppImage
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- 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:
|
commands:
|
||||||
- /bin/bash -c "./admin/linux/build-appimage.sh"
|
- /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:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
|
|||||||
@@ -199,6 +199,6 @@ X-GNOME-Autostart-Delay=3
|
|||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
Icon[ca]=@APPLICATION_ICON_NAME@
|
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@
|
Comment[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
|
||||||
GenericName[ca]=Directori de sincronització
|
GenericName[ca]=Sincronització de carpetes
|
||||||
|
|||||||
@@ -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")
|
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 )
|
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_MAJOR 3 )
|
||||||
set( MIRALL_VERSION_MINOR 7 )
|
set( MIRALL_VERSION_MINOR 0 )
|
||||||
set( MIRALL_VERSION_PATCH 0 )
|
set( MIRALL_VERSION_PATCH 1 )
|
||||||
set( MIRALL_VERSION_YEAR 2020 )
|
set( MIRALL_VERSION_YEAR 2020 )
|
||||||
set( MIRALL_SOVERSION 0 )
|
set( MIRALL_SOVERSION 0 )
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ mkdir /app
|
|||||||
mkdir /build
|
mkdir /build
|
||||||
|
|
||||||
#Set Qt-5.12
|
#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 QTDIR=$QT_BASE_DIR
|
||||||
export PATH=$QT_BASE_DIR/bin:$PATH
|
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
|
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
|
OBS_PACKAGE=nextcloud-desktop
|
||||||
|
|
||||||
if test "${DRONE_TARGET_BRANCH}" = "stable-2.6"; then
|
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"
|
DEBIAN_DISTRIBUTIONS="buster stretch testing"
|
||||||
else
|
else
|
||||||
UBUNTU_DISTRIBUTIONS="eoan focal groovy"
|
UBUNTU_DISTRIBUTIONS="focal groovy"
|
||||||
DEBIAN_DISTRIBUTIONS="testing"
|
DEBIAN_DISTRIBUTIONS="testing"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,135 @@
|
|||||||
#! /bin/bash
|
#! /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
|
cd /build
|
||||||
|
|
||||||
# Upload AppImage
|
# AppImage
|
||||||
APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
|
export APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
|
||||||
BASENAME=$(basename ${APPIMAGE})
|
export BASENAME=$(basename ${APPIMAGE})
|
||||||
|
|
||||||
if curl --max-time 900 --upload-file ${APPIMAGE} https://transfer.sh/${BASENAME}
|
if ! test -e $APPIMAGE ; then
|
||||||
then
|
exit 1
|
||||||
echo
|
|
||||||
echo "Get the AppImage at the link above!"
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "Upload failed, however this is an optional step."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't let the Drone build fail
|
echo "Found AppImage: $BASENAME"
|
||||||
exit 0
|
|
||||||
|
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
|
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
|
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
|
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
|
create a conflict file with the local version, download the remote version and
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
add_subdirectory(OCContextMenu)
|
# Use static runtime for all subdirectories
|
||||||
add_subdirectory(OCOverlays)
|
foreach(buildType "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
|
||||||
add_subdirectory(OCUtil)
|
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.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCClientInterface.h"
|
||||||
|
|
||||||
#include "OCClientInterface.h"
|
|
||||||
|
|
||||||
#include "CommunicationSocket.h"
|
#include "CommunicationSocket.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
@@ -32,9 +30,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define PIPE_TIMEOUT 5*1000 //ms
|
#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();
|
auto pipename = CommunicationSocket::DefaultPipePath();
|
||||||
|
|
||||||
@@ -80,7 +77,7 @@ OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo(const std::wstri
|
|||||||
return info;
|
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();
|
auto pipename = CommunicationSocket::DefaultPipePath();
|
||||||
|
|
||||||
@@ -92,9 +89,5 @@ void OCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &pat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t msg[SOCK_BUFFER] = { 0 };
|
socket.SendMsg((verb + (L":" + path + L"\n")).data());
|
||||||
if (SUCCEEDED(StringCchPrintf(msg, SOCK_BUFFER, L"%s:%s\n", verb, path.c_str())))
|
|
||||||
{
|
|
||||||
socket.SendMsg(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
class CommunicationSocket;
|
class CommunicationSocket;
|
||||||
|
|
||||||
class OCClientInterface
|
class NCClientInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct ContextMenuInfo {
|
struct ContextMenuInfo {
|
||||||
@@ -12,25 +12,24 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCContextMenu.h"
|
||||||
|
#include "NCClientInterface.h"
|
||||||
#include "OCContextMenu.h"
|
|
||||||
#include "OCClientInterface.h"
|
|
||||||
|
|
||||||
#include <shobjidl.h>
|
#include <shobjidl.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <StringUtil.h>
|
#include <StringUtil.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
extern long g_cDllRef;
|
extern long g_cDllRef;
|
||||||
|
|
||||||
OCContextMenu::OCContextMenu(void)
|
NCContextMenu::NCContextMenu(void)
|
||||||
: m_cRef(1)
|
: m_cRef(1)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&g_cDllRef);
|
InterlockedIncrement(&g_cDllRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
OCContextMenu::~OCContextMenu(void)
|
NCContextMenu::~NCContextMenu(void)
|
||||||
{
|
{
|
||||||
InterlockedDecrement(&g_cDllRef);
|
InterlockedDecrement(&g_cDllRef);
|
||||||
}
|
}
|
||||||
@@ -38,25 +37,25 @@ OCContextMenu::~OCContextMenu(void)
|
|||||||
#pragma region IUnknown
|
#pragma region IUnknown
|
||||||
|
|
||||||
// Query to the interface the component supported.
|
// 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[] =
|
static const QITAB qit[] =
|
||||||
{
|
{
|
||||||
QITABENT(OCContextMenu, IContextMenu),
|
QITABENT(NCContextMenu, IContextMenu),
|
||||||
QITABENT(OCContextMenu, IShellExtInit),
|
QITABENT(NCContextMenu, IShellExtInit),
|
||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
return QISearch(this, qit, riid, ppv);
|
return QISearch(this, qit, riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the reference count for an interface on an object.
|
// Increase the reference count for an interface on an object.
|
||||||
IFACEMETHODIMP_(ULONG) OCContextMenu::AddRef()
|
IFACEMETHODIMP_(ULONG) NCContextMenu::AddRef()
|
||||||
{
|
{
|
||||||
return InterlockedIncrement(&m_cRef);
|
return InterlockedIncrement(&m_cRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrease the reference count for an interface on an object.
|
// Decrease the reference count for an interface on an object.
|
||||||
IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
|
IFACEMETHODIMP_(ULONG) NCContextMenu::Release()
|
||||||
{
|
{
|
||||||
ULONG cRef = InterlockedDecrement(&m_cRef);
|
ULONG cRef = InterlockedDecrement(&m_cRef);
|
||||||
if (0 == cRef) {
|
if (0 == cRef) {
|
||||||
@@ -72,7 +71,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
|
|||||||
#pragma region IShellExtInit
|
#pragma region IShellExtInit
|
||||||
|
|
||||||
// Initialize the context menu handler.
|
// Initialize the context menu handler.
|
||||||
IFACEMETHODIMP OCContextMenu::Initialize(
|
IFACEMETHODIMP NCContextMenu::Initialize(
|
||||||
LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID)
|
LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID)
|
||||||
{
|
{
|
||||||
m_selectedFiles.clear();
|
m_selectedFiles.clear();
|
||||||
@@ -128,7 +127,7 @@ void InsertSeperator(HMENU hMenu, UINT indexMenu)
|
|||||||
InsertMenuItem(hMenu, indexMenu, TRUE, &sep);
|
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 uFlags include CMF_DEFAULTONLY then we should not do anything.
|
||||||
if (CMF_DEFAULTONLY & uFlags)
|
if (CMF_DEFAULTONLY & uFlags)
|
||||||
@@ -136,7 +135,7 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
|
|||||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
|
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()) {
|
if (m_info.menuItems.empty()) {
|
||||||
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
|
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));
|
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(indexSubMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
IFACEMETHODIMP NCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
||||||
{
|
{
|
||||||
std::wstring command;
|
std::wstring command;
|
||||||
|
|
||||||
@@ -216,11 +215,11 @@ IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OCClientInterface::SendRequest(command.data(), m_selectedFiles);
|
NCClientInterface::SendRequest(command.data(), m_selectedFiles);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCContextMenu::GetCommandString(UINT_PTR idCommand,
|
IFACEMETHODIMP NCContextMenu::GetCommandString(UINT_PTR idCommand,
|
||||||
UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
|
UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
|
||||||
{
|
{
|
||||||
if (idCommand < m_info.menuItems.size() && uFlags == GCS_VERBW) {
|
if (idCommand < m_info.menuItems.size() && uFlags == GCS_VERBW) {
|
||||||
@@ -12,15 +12,15 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OCCONTEXTMENU_H
|
#ifndef NCCONTEXTMENU_H
|
||||||
#define OCCONTEXTMENU_H
|
#define NCCONTEXTMENU_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <shlobj.h> // For IShellExtInit and IContextMenu
|
#include <shlobj.h> // For IShellExtInit and IContextMenu
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "OCClientInterface.h"
|
#include "NCClientInterface.h"
|
||||||
|
|
||||||
class OCContextMenu : public IShellExtInit, public IContextMenu
|
class NCContextMenu : public IShellExtInit, public IContextMenu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// IUnknown
|
// IUnknown
|
||||||
@@ -36,10 +36,10 @@ public:
|
|||||||
IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
|
IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
|
||||||
IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
|
IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
|
||||||
|
|
||||||
OCContextMenu();
|
NCContextMenu();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~OCContextMenu();
|
~NCContextMenu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Reference count of component.
|
// Reference count of component.
|
||||||
@@ -47,7 +47,7 @@ private:
|
|||||||
|
|
||||||
// The name of the selected files (separated by '\x1e')
|
// The name of the selected files (separated by '\x1e')
|
||||||
std::wstring m_selectedFiles;
|
std::wstring m_selectedFiles;
|
||||||
OCClientInterface::ContextMenuInfo m_info;
|
NCClientInterface::ContextMenuInfo m_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //OCCONTEXTMENU_H
|
#endif //NCCONTEXTMENU_H
|
||||||
@@ -12,10 +12,8 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCContextMenuFactory.h"
|
||||||
|
#include "NCContextMenu.h"
|
||||||
#include "OCContextMenuFactory.h"
|
|
||||||
#include "OCContextMenu.h"
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
#pragma comment(lib, "shlwapi.lib")
|
#pragma comment(lib, "shlwapi.lib")
|
||||||
@@ -24,12 +22,12 @@
|
|||||||
extern long g_cDllRef;
|
extern long g_cDllRef;
|
||||||
|
|
||||||
|
|
||||||
OCContextMenuFactory::OCContextMenuFactory() : m_cRef(1)
|
NCContextMenuFactory::NCContextMenuFactory() : m_cRef(1)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&g_cDllRef);
|
InterlockedIncrement(&g_cDllRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
OCContextMenuFactory::~OCContextMenuFactory()
|
NCContextMenuFactory::~NCContextMenuFactory()
|
||||||
{
|
{
|
||||||
InterlockedDecrement(&g_cDllRef);
|
InterlockedDecrement(&g_cDllRef);
|
||||||
}
|
}
|
||||||
@@ -37,18 +35,18 @@ OCContextMenuFactory::~OCContextMenuFactory()
|
|||||||
|
|
||||||
// IUnknown methods
|
// 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);
|
return QISearch(this, qit, riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::AddRef()
|
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::AddRef()
|
||||||
{
|
{
|
||||||
return InterlockedIncrement(&m_cRef);
|
return InterlockedIncrement(&m_cRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
|
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::Release()
|
||||||
{
|
{
|
||||||
ULONG cRef = InterlockedDecrement(&m_cRef);
|
ULONG cRef = InterlockedDecrement(&m_cRef);
|
||||||
if (0 == cRef) {
|
if (0 == cRef) {
|
||||||
@@ -60,7 +58,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
|
|||||||
|
|
||||||
// IClassFactory methods
|
// 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;
|
HRESULT hr = CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
@@ -69,7 +67,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
|
|||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
|
|
||||||
// Create the COM component.
|
// Create the COM component.
|
||||||
OCContextMenu *pExt = new (std::nothrow) OCContextMenu();
|
NCContextMenu *pExt = new (std::nothrow) NCContextMenu();
|
||||||
if (pExt) {
|
if (pExt) {
|
||||||
// Query the specified interface.
|
// Query the specified interface.
|
||||||
hr = pExt->QueryInterface(riid, ppv);
|
hr = pExt->QueryInterface(riid, ppv);
|
||||||
@@ -80,7 +78,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCContextMenuFactory::LockServer(BOOL fLock)
|
IFACEMETHODIMP NCContextMenuFactory::LockServer(BOOL fLock)
|
||||||
{
|
{
|
||||||
if (fLock) {
|
if (fLock) {
|
||||||
InterlockedIncrement(&g_cDllRef);
|
InterlockedIncrement(&g_cDllRef);
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef OCCONTEXTMENUFACTORY_H
|
#ifndef NCCONTEXTMENUFACTORY_H
|
||||||
#define OCCONTEXTMENUFACTORY_H
|
#define NCCONTEXTMENUFACTORY_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <unknwn.h> // For IClassFactory
|
#include <unknwn.h> // For IClassFactory
|
||||||
|
|
||||||
class OCContextMenuFactory : public IClassFactory
|
class NCContextMenuFactory : public IClassFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// IUnknown
|
// IUnknown
|
||||||
@@ -32,11 +32,11 @@ public:
|
|||||||
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
||||||
IFACEMETHODIMP LockServer(BOOL fLock);
|
IFACEMETHODIMP LockServer(BOOL fLock);
|
||||||
|
|
||||||
OCContextMenuFactory();
|
NCContextMenuFactory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~OCContextMenuFactory();
|
~NCContextMenuFactory();
|
||||||
long m_cRef;
|
long m_cRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //OCCONTEXTMENUFACTORY_H
|
#endif //NCCONTEXTMENUFACTORY_H
|
||||||
@@ -12,9 +12,7 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCContextMenuRegHandler.h"
|
||||||
|
|
||||||
#include "OCContextMenuRegHandler.h"
|
|
||||||
#include "RegDelnode.h"
|
#include "RegDelnode.h"
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#include <objbase.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)
|
if (!pszModule || !pszThreadModel)
|
||||||
{
|
{
|
||||||
@@ -113,7 +111,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
HRESULT NCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
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)
|
PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName)
|
||||||
{
|
{
|
||||||
if (!pszFileType)
|
if (!pszFileType)
|
||||||
@@ -177,7 +175,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
|
HRESULT NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
|
||||||
PCWSTR pszFileType, PCWSTR pszFriendlyName)
|
PCWSTR pszFileType, PCWSTR pszFriendlyName)
|
||||||
{
|
{
|
||||||
if (!pszFileType)
|
if (!pszFileType)
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef OCCONTEXTMENUREGHANDLER_H
|
#ifndef NCCONTEXTMENUREGHANDLER_H
|
||||||
#define OCCONTEXTMENUREGHANDLER_H
|
#define NCCONTEXTMENUREGHANDLER_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include <windows.h>
|
||||||
|
|
||||||
class __declspec(dllexport) OCContextMenuRegHandler
|
class __declspec(dllexport) NCContextMenuRegHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
|
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
|
||||||
@@ -35,4 +35,4 @@ public:
|
|||||||
static HRESULT UnregisterShellExtContextMenuHandler(PCWSTR pszFileType, PCWSTR pszFriendlyName);
|
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}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// Microsoft Visual C++ generated include file.
|
// Microsoft Visual C++ generated include file.
|
||||||
// Used by OCContextMenu.rc
|
// Used by NCContextMenu.rc
|
||||||
|
|
||||||
// Next default values for new objects
|
// 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.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCOverlayRegistrationHandler.h"
|
||||||
|
#include "NCOverlayFactory.h"
|
||||||
#include "OCOverlayRegistrationHandler.h"
|
#include "WinShellExtConstants.h"
|
||||||
#include "OCOverlayFactory.h"
|
|
||||||
|
|
||||||
HINSTANCE instanceHandle = nullptr;
|
HINSTANCE instanceHandle = nullptr;
|
||||||
|
|
||||||
@@ -42,11 +41,11 @@ HRESULT CreateFactory(REFIID riid, void **ppv, int state)
|
|||||||
{
|
{
|
||||||
HRESULT hResult = E_OUTOFMEMORY;
|
HRESULT hResult = E_OUTOFMEMORY;
|
||||||
|
|
||||||
OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(state);
|
NCOverlayFactory* ncOverlayFactory = new NCOverlayFactory(state);
|
||||||
|
|
||||||
if (ocOverlayFactory) {
|
if (ncOverlayFactory) {
|
||||||
hResult = ocOverlayFactory->QueryInterface(riid, ppv);
|
hResult = ncOverlayFactory->QueryInterface(riid, ppv);
|
||||||
ocOverlayFactory->Release();
|
ncOverlayFactory->Release();
|
||||||
}
|
}
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
@@ -95,13 +94,13 @@ HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule)
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_GENERIC_NAME, guid);
|
hResult = NCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_DESCRIPTION, guid);
|
||||||
|
|
||||||
if (!SUCCEEDED(hResult)) {
|
if (!SUCCEEDED(hResult)) {
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
|
hResult = NCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
|
||||||
|
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
@@ -117,13 +116,13 @@ HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid);
|
hResult = NCOverlayRegistrationHandler::UnregisterCOMObject(guid);
|
||||||
|
|
||||||
if (!SUCCEEDED(hResult)) {
|
if (!SUCCEEDED(hResult)) {
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
|
hResult = NCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
|
||||||
|
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
@@ -139,13 +138,6 @@ HRESULT _stdcall DllRegisterServer(void)
|
|||||||
return hResult;
|
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);
|
hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule);
|
||||||
if (!SUCCEEDED(hResult)) { return hResult; }
|
if (!SUCCEEDED(hResult)) { return hResult; }
|
||||||
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);
|
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);
|
||||||
@@ -12,19 +12,11 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCOverlay.h"
|
||||||
|
#include "NCOverlayFactory.h"
|
||||||
#include "OCOverlay.h"
|
|
||||||
|
|
||||||
#include "OCOverlayFactory.h"
|
|
||||||
#include "RegistryUtil.h"
|
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
|
||||||
#include "UtilConstants.h"
|
|
||||||
#include "RemotePathChecker.h"
|
#include "RemotePathChecker.h"
|
||||||
|
|
||||||
#include "resource.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -55,23 +47,23 @@ RemotePathChecker *getGlobalChecker()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
OCOverlay::OCOverlay(int state)
|
NCOverlay::NCOverlay(int state)
|
||||||
: _referenceCount(1)
|
: _referenceCount(1)
|
||||||
, _state(state)
|
, _state(state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
OCOverlay::~OCOverlay(void)
|
NCOverlay::~NCOverlay(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCOverlay::AddRef()
|
IFACEMETHODIMP_(ULONG) NCOverlay::AddRef()
|
||||||
{
|
{
|
||||||
return InterlockedIncrement(&_referenceCount);
|
return InterlockedIncrement(&_referenceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
|
IFACEMETHODIMP NCOverlay::QueryInterface(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
@@ -93,7 +85,7 @@ IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCOverlay::Release()
|
IFACEMETHODIMP_(ULONG) NCOverlay::Release()
|
||||||
{
|
{
|
||||||
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
||||||
if (0 == cRef)
|
if (0 == cRef)
|
||||||
@@ -104,7 +96,7 @@ IFACEMETHODIMP_(ULONG) OCOverlay::Release()
|
|||||||
return cRef;
|
return cRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
|
IFACEMETHODIMP NCOverlay::GetPriority(int *pPriority)
|
||||||
{
|
{
|
||||||
// this defines which handler has prededence, so
|
// this defines which handler has prededence, so
|
||||||
// we order this in terms of likelyhood
|
// we order this in terms of likelyhood
|
||||||
@@ -126,7 +118,7 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
|
IFACEMETHODIMP NCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
|
||||||
{
|
{
|
||||||
RemotePathChecker* checker = getGlobalChecker();
|
RemotePathChecker* checker = getGlobalChecker();
|
||||||
std::shared_ptr<const std::vector<std::wstring>> watchedDirectories = checker->WatchedDirectories();
|
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);
|
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;
|
*pIndex = 0;
|
||||||
*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
|
*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
|
||||||
@@ -12,16 +12,18 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OCOVERLAY_H
|
#ifndef NCOVERLAY_H
|
||||||
#define OCOVERLAY_H
|
#define NCOVERLAY_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class OCOverlay : public IShellIconOverlayIdentifier
|
#include <shlobj.h>
|
||||||
|
|
||||||
|
class NCOverlay : public IShellIconOverlayIdentifier
|
||||||
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OCOverlay(int state);
|
NCOverlay(int state);
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) AddRef();
|
IFACEMETHODIMP_(ULONG) AddRef();
|
||||||
IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
|
IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
|
||||||
@@ -31,7 +33,7 @@ public:
|
|||||||
IFACEMETHODIMP_(ULONG) Release();
|
IFACEMETHODIMP_(ULONG) Release();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~OCOverlay();
|
~NCOverlay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long _referenceCount;
|
long _referenceCount;
|
||||||
@@ -12,25 +12,26 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include <windows.h>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include "OCOverlayFactory.h"
|
#include "NCOverlayFactory.h"
|
||||||
#include "OCOverlay.h"
|
#include "NCOverlay.h"
|
||||||
|
|
||||||
extern long dllReferenceCount;
|
extern long dllReferenceCount;
|
||||||
|
|
||||||
OCOverlayFactory::OCOverlayFactory(int state)
|
NCOverlayFactory::NCOverlayFactory(int state)
|
||||||
: _referenceCount(1), _state(state)
|
: _referenceCount(1), _state(state)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&dllReferenceCount);
|
InterlockedIncrement(&dllReferenceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
OCOverlayFactory::~OCOverlayFactory()
|
NCOverlayFactory::~NCOverlayFactory()
|
||||||
{
|
{
|
||||||
InterlockedDecrement(&dllReferenceCount);
|
InterlockedDecrement(&dllReferenceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
IFACEMETHODIMP NCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
HRESULT hResult = S_OK;
|
HRESULT hResult = S_OK;
|
||||||
|
|
||||||
@@ -49,12 +50,12 @@ IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCOverlayFactory::AddRef()
|
IFACEMETHODIMP_(ULONG) NCOverlayFactory::AddRef()
|
||||||
{
|
{
|
||||||
return InterlockedIncrement(&_referenceCount);
|
return InterlockedIncrement(&_referenceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
|
IFACEMETHODIMP_(ULONG) NCOverlayFactory::Release()
|
||||||
{
|
{
|
||||||
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
ULONG cRef = InterlockedDecrement(&_referenceCount);
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
|
|||||||
return cRef;
|
return cRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
IFACEMETHODIMP NCOverlayFactory::CreateInstance(
|
||||||
IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
HRESULT hResult = CLASS_E_NOAGGREGATION;
|
HRESULT hResult = CLASS_E_NOAGGREGATION;
|
||||||
@@ -73,7 +74,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
|||||||
if (pUnkOuter) { return hResult; }
|
if (pUnkOuter) { return hResult; }
|
||||||
|
|
||||||
hResult = E_OUTOFMEMORY;
|
hResult = E_OUTOFMEMORY;
|
||||||
OCOverlay *lrOverlay = new (std::nothrow) OCOverlay(_state);
|
NCOverlay *lrOverlay = new (std::nothrow) NCOverlay(_state);
|
||||||
if (!lrOverlay) { return hResult; }
|
if (!lrOverlay) { return hResult; }
|
||||||
|
|
||||||
hResult = lrOverlay->QueryInterface(riid, ppv);
|
hResult = lrOverlay->QueryInterface(riid, ppv);
|
||||||
@@ -82,7 +83,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock)
|
IFACEMETHODIMP NCOverlayFactory::LockServer(BOOL fLock)
|
||||||
{
|
{
|
||||||
if (fLock) {
|
if (fLock) {
|
||||||
InterlockedIncrement(&dllReferenceCount);
|
InterlockedIncrement(&dllReferenceCount);
|
||||||
@@ -12,11 +12,13 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OCOVERLAYFACTORY_H
|
#ifndef NCOVERLAYFACTORY_H
|
||||||
#define OCOVERLAYFACTORY_H
|
#define NCOVERLAYFACTORY_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <unknwn.h>
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
State_Error = 0,
|
State_Error = 0,
|
||||||
State_OK, State_OKShared,
|
State_OK, State_OKShared,
|
||||||
@@ -24,10 +26,10 @@ enum State {
|
|||||||
State_Warning
|
State_Warning
|
||||||
};
|
};
|
||||||
|
|
||||||
class OCOverlayFactory : public IClassFactory
|
class NCOverlayFactory : public IClassFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OCOverlayFactory(int state);
|
NCOverlayFactory(int state);
|
||||||
|
|
||||||
IFACEMETHODIMP_(ULONG) AddRef();
|
IFACEMETHODIMP_(ULONG) AddRef();
|
||||||
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
|
||||||
@@ -36,7 +38,7 @@ public:
|
|||||||
IFACEMETHODIMP_(ULONG) Release();
|
IFACEMETHODIMP_(ULONG) Release();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~OCOverlayFactory();
|
~NCOverlayFactory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long _referenceCount;
|
long _referenceCount;
|
||||||
@@ -12,16 +12,24 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "NCOverlayRegistrationHandler.h"
|
||||||
|
|
||||||
#include "OCOverlayRegistrationHandler.h"
|
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <objbase.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#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;
|
using namespace std;
|
||||||
|
|
||||||
HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
|
HRESULT NCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
HKEY shellOverlayKey = nullptr;
|
HKEY shellOverlayKey = nullptr;
|
||||||
@@ -52,7 +60,7 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
HRESULT NCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
HKEY shellOverlayKey = nullptr;
|
HKEY shellOverlayKey = nullptr;
|
||||||
@@ -71,7 +79,7 @@ HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
|
|||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
|
HRESULT NCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
|
||||||
{
|
{
|
||||||
if (!modulePath) {
|
if (!modulePath) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
@@ -89,7 +97,7 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
|
|||||||
|
|
||||||
HKEY clsidKey = nullptr;
|
HKEY clsidKey = nullptr;
|
||||||
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &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;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,30 +105,36 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
|
|||||||
|
|
||||||
HKEY inprocessKey = nullptr;
|
HKEY inprocessKey = nullptr;
|
||||||
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &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;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, nullptr, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
|
hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, nullptr, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
|
||||||
|
|
||||||
if(!SUCCEEDED(hResult)) {
|
if (!SUCCEEDED(hResult)) {
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_THREADING, 0, REG_SZ, (LPBYTE)REGISTRY_APARTMENT, (DWORD)((wcslen(REGISTRY_APARTMENT)+1) * sizeof(TCHAR))));
|
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;
|
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)));
|
HKEY versionKey = nullptr;
|
||||||
if(!SUCCEEDED(hResult)) {
|
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 hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
HRESULT NCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
||||||
{
|
{
|
||||||
wchar_t stringCLSID[MAX_PATH];
|
wchar_t stringCLSID[MAX_PATH];
|
||||||
|
|
||||||
@@ -134,17 +148,22 @@ HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
|
|||||||
|
|
||||||
HKEY clsidKey = nullptr;
|
HKEY clsidKey = nullptr;
|
||||||
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey));
|
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey));
|
||||||
if(!SUCCEEDED(hResult)) {
|
if (!SUCCEEDED(hResult)) {
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = HRESULT_FROM_WIN32(RegDeleteKey(clsidKey, REGISTRY_IN_PROCESS));
|
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;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
hResult = HRESULT_FROM_WIN32(RegDeleteKey(hKey, stringCLSID));
|
hResult = HRESULT_FROM_WIN32(RegDeleteKey(hKey, stringCLSID));
|
||||||
if(!SUCCEEDED(hResult)) {
|
if (!SUCCEEDED(hResult)) {
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,12 +12,14 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OCOVERLAYREGISTRATIONHANDLER_H
|
#ifndef NCOVERLAYREGISTRATIONHANDLER_H
|
||||||
#define OCOVERLAYREGISTRATIONHANDLER_H
|
#define NCOVERLAYREGISTRATIONHANDLER_H
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class __declspec(dllexport) OCOverlayRegistrationHandler
|
#include <windows.h>
|
||||||
|
|
||||||
|
class __declspec(dllexport) NCOverlayRegistrationHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
|
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.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include "CommunicationSocket.h"
|
#include "CommunicationSocket.h"
|
||||||
#include "UtilConstants.h"
|
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
#include "WinShellExtConstants.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -44,8 +42,9 @@ std::wstring getUserName() {
|
|||||||
|
|
||||||
std::wstring CommunicationSocket::DefaultPipePath()
|
std::wstring CommunicationSocket::DefaultPipePath()
|
||||||
{
|
{
|
||||||
auto pipename = std::wstring(L"\\\\.\\pipe\\");
|
auto pipename = std::wstring(LR"(\\.\pipe\)");
|
||||||
pipename += L"ownCloud-";
|
pipename += std::wstring(UTIL_PIPE_APP_NAME);
|
||||||
|
pipename += L"-";
|
||||||
pipename += getUserName();
|
pipename += getUserName();
|
||||||
return pipename;
|
return pipename;
|
||||||
}
|
}
|
||||||
BIN
shell_integration/windows/NCUtil/NCUtil.rc
Normal file
@@ -11,8 +11,6 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include "CommunicationSocket.h"
|
#include "CommunicationSocket.h"
|
||||||
|
|
||||||
#include "RemotePathChecker.h"
|
#include "RemotePathChecker.h"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
class __declspec(dllexport) RemotePathChecker {
|
class __declspec(dllexport) RemotePathChecker {
|
||||||
public:
|
public:
|
||||||
enum FileState {
|
enum FileState {
|
||||||
// Order synced with OCOverlay
|
// Order synced with NCOverlay
|
||||||
StateError = 0,
|
StateError = 0,
|
||||||
StateOk, StateOkSWM,
|
StateOk, StateOkSWM,
|
||||||
StateSync,
|
StateSync,
|
||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
std::queue<std::wstring> _pending;
|
std::queue<std::wstring> _pending;
|
||||||
|
|
||||||
std::unordered_map<std::wstring, FileState> _cache;
|
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.
|
// 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;
|
std::shared_ptr<const std::vector<std::wstring>> _watchedDirectories;
|
||||||
bool _connected;
|
bool _connected;
|
||||||
@@ -11,8 +11,6 @@
|
|||||||
* details.
|
* details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
// This is the number that will end up in the version window of the DLLs.
|
// 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.
|
// 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 STRINGIZE2(s) #s
|
||||||
#define STRINGIZE(s) STRINGIZE2(s)
|
#define STRINGIZE(s) STRINGIZE2(s)
|
||||||
|
|
||||||
#define OCEXT_VERSION 1,0,0,OCEXT_BUILD_NUM
|
#define NCEXT_VERSION 3,0,0,NCEXT_BUILD_NUM
|
||||||
#define OCEXT_VERSION_STRING STRINGIZE(OCEXT_VERSION)
|
#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()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Enable DEP & ASLR
|
# Enable DEP, ASLR and CFG
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase")
|
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)
|
elseif(UNIX AND NOT APPLE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
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")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
||||||
|
|||||||
@@ -395,12 +395,19 @@ if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
|
|||||||
|
|
||||||
set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
|
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
|
add_custom_command(TARGET ${APPLICATION_EXECUTABLE} POST_BUILD
|
||||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
|
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
|
||||||
"$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
|
"$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
|
||||||
-qmldir=${CMAKE_SOURCE_DIR}/src/gui
|
-qmldir=${CMAKE_SOURCE_DIR}/src/gui
|
||||||
-always-overwrite
|
-always-overwrite
|
||||||
-executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
|
-executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
|
||||||
|
${NO_STRIP}
|
||||||
COMMENT "Running macdeployqt..."
|
COMMENT "Running macdeployqt..."
|
||||||
)
|
)
|
||||||
endif()
|
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::showMnemonic, this, &AccountSettings::slotShowMnemonic);
|
||||||
|
|
||||||
connect(_accountState->account()->e2e(), &ClientSideEncryption::mnemonicGenerated, this, &AccountSettings::slotNewMnemonicGenerated);
|
connect(_accountState->account()->e2e(), &ClientSideEncryption::mnemonicGenerated, this, &AccountSettings::slotNewMnemonicGenerated);
|
||||||
if (_accountState->account()->e2e()->newMnemonicGenerated())
|
if (_accountState->account()->e2e()->newMnemonicGenerated()) {
|
||||||
{
|
|
||||||
slotNewMnemonicGenerated();
|
slotNewMnemonicGenerated();
|
||||||
} else {
|
} 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();
|
_ui->encryptionMessage->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,6 +841,10 @@ void AccountSettings::slotAccountStateChanged()
|
|||||||
*/
|
*/
|
||||||
qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
|
qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
|
||||||
<< "Client Side Encryption" << accountsState()->account()->capabilities().clientSideEncryptionAvailable();
|
<< "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)
|
, _waitingForNewCredentials(false)
|
||||||
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
|
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
|
||||||
, _remoteWipe(new RemoteWipe(_account))
|
, _remoteWipe(new RemoteWipe(_account))
|
||||||
, _hasTalk(false)
|
|
||||||
{
|
{
|
||||||
qRegisterMetaType<AccountState *>("AccountState*");
|
qRegisterMetaType<AccountState *>("AccountState*");
|
||||||
|
|
||||||
@@ -74,11 +73,6 @@ AccountPtr AccountState::account() const
|
|||||||
return _account;
|
return _account;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountState::hasTalk() const
|
|
||||||
{
|
|
||||||
return _hasTalk;
|
|
||||||
}
|
|
||||||
|
|
||||||
AccountState::ConnectionStatus AccountState::connectionStatus() const
|
AccountState::ConnectionStatus AccountState::connectionStatus() const
|
||||||
{
|
{
|
||||||
return _connectionStatus;
|
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.";
|
qCWarning(lcAccountState) << "Status code " << statusCode << " Not Modified - No new navigation apps.";
|
||||||
} else {
|
} else {
|
||||||
_apps.clear();
|
_apps.clear();
|
||||||
_hasTalk = false;
|
|
||||||
|
|
||||||
if(!reply.isEmpty()){
|
if(!reply.isEmpty()){
|
||||||
auto element = reply.object().value("ocs").toObject().value("data");
|
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()));
|
navLink.value("id").toString(), QUrl(navLink.value("icon").toString()));
|
||||||
|
|
||||||
_apps << app;
|
_apps << app;
|
||||||
|
|
||||||
if(app->id() == QLatin1String("spreed"))
|
|
||||||
_hasTalk = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,8 +103,6 @@ public:
|
|||||||
|
|
||||||
bool isSignedOut() const;
|
bool isSignedOut() const;
|
||||||
|
|
||||||
bool hasTalk() const;
|
|
||||||
|
|
||||||
AccountAppList appList() const;
|
AccountAppList appList() const;
|
||||||
AccountApp* findApp(const QString &appId) const;
|
AccountApp* findApp(const QString &appId) const;
|
||||||
|
|
||||||
@@ -195,7 +193,6 @@ private:
|
|||||||
ConnectionStatus _connectionStatus;
|
ConnectionStatus _connectionStatus;
|
||||||
QStringList _connectionErrors;
|
QStringList _connectionErrors;
|
||||||
bool _waitingForNewCredentials;
|
bool _waitingForNewCredentials;
|
||||||
bool _hasTalk;
|
|
||||||
QElapsedTimer _timeSinceLastETagCheck;
|
QElapsedTimer _timeSinceLastETagCheck;
|
||||||
QPointer<ConnectionValidator> _connectionValidator;
|
QPointer<ConnectionValidator> _connectionValidator;
|
||||||
QByteArray _notificationsEtagResponseHeader;
|
QByteArray _notificationsEtagResponseHeader;
|
||||||
|
|||||||
@@ -945,6 +945,11 @@ Folder *FolderMan::addFolderInternal(FolderDefinition folderDefinition,
|
|||||||
|
|
||||||
auto folder = new Folder(folderDefinition, accountState, this);
|
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();
|
qCInfo(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias();
|
||||||
_folderMap[folder->alias()] = folder;
|
_folderMap[folder->alias()] = folder;
|
||||||
if (folder->syncPaused()) {
|
if (folder->syncPaused()) {
|
||||||
|
|||||||
@@ -79,12 +79,15 @@ ownCloudGui::ownCloudGui(Application *parent)
|
|||||||
connect(_tray.data(), &Systray::pauseSync,
|
connect(_tray.data(), &Systray::pauseSync,
|
||||||
this, &ownCloudGui::slotPauseAllFolders);
|
this, &ownCloudGui::slotPauseAllFolders);
|
||||||
|
|
||||||
connect(_tray.data(), &Systray::pauseSync,
|
connect(_tray.data(), &Systray::resumeSync,
|
||||||
this, &ownCloudGui::slotUnpauseAllFolders);
|
this, &ownCloudGui::slotUnpauseAllFolders);
|
||||||
|
|
||||||
connect(_tray.data(), &Systray::openHelp,
|
connect(_tray.data(), &Systray::openHelp,
|
||||||
this, &ownCloudGui::slotHelp);
|
this, &ownCloudGui::slotHelp);
|
||||||
|
|
||||||
|
connect(_tray.data(), &Systray::openAccountWizard,
|
||||||
|
this, &ownCloudGui::slotNewAccountWizard);
|
||||||
|
|
||||||
connect(_tray.data(), &Systray::openMainDialog,
|
connect(_tray.data(), &Systray::openMainDialog,
|
||||||
this, &ownCloudGui::slotOpenMainDialog);
|
this, &ownCloudGui::slotOpenMainDialog);
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ SocketApi::SocketApi(QObject *parent)
|
|||||||
|
|
||||||
if (Utility::isWindows()) {
|
if (Utility::isWindows()) {
|
||||||
socketPath = QLatin1String(R"(\\.\pipe\)")
|
socketPath = QLatin1String(R"(\\.\pipe\)")
|
||||||
+ QLatin1String("ownCloud-")
|
+ QLatin1String(APPLICATION_EXECUTABLE)
|
||||||
|
+ QLatin1String("-")
|
||||||
+ QString::fromLocal8Bit(qgetenv("USERNAME"));
|
+ QString::fromLocal8Bit(qgetenv("USERNAME"));
|
||||||
// TODO: once the windows extension supports multiple
|
// TODO: once the windows extension supports multiple
|
||||||
// client connections, switch back to the theme name
|
// 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"));
|
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();
|
auto record = fileData.journalRecord();
|
||||||
bool isOnTheServer = record.isValid();
|
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 capabilities = fileData.folder->accountState()->account()->capabilities();
|
||||||
auto theme = Theme::instance();
|
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
|
bool hasSeveralFiles = argument.contains(QLatin1Char('\x1e')); // Record Separator
|
||||||
FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument);
|
FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument);
|
||||||
bool isOnTheServer = fileData.journalRecord().isValid();
|
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()) {
|
if (fileData.folder && fileData.folder->accountState()->isConnected()) {
|
||||||
DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath);
|
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"));
|
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"));
|
listener->sendMessage(QString("GET_MENU_ITEMS:END"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ private:
|
|||||||
Q_INVOKABLE void command_GET_STRINGS(const QString &argument, SocketListener *listener);
|
Q_INVOKABLE void command_GET_STRINGS(const QString &argument, SocketListener *listener);
|
||||||
|
|
||||||
// Sends the context menu options relating to sharing to 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)
|
/** 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'
|
* 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
|
#ifndef Q_OS_MAC
|
||||||
auto contextMenu = new QMenu();
|
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("Settings"), this, &Systray::openSettings);
|
||||||
contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
|
contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
|
||||||
setContextMenu(contextMenu);
|
setContextMenu(contextMenu);
|
||||||
@@ -105,6 +109,14 @@ void Systray::create()
|
|||||||
}
|
}
|
||||||
hideWindow();
|
hideWindow();
|
||||||
emit activated(QSystemTrayIcon::ActivationReason::Unknown);
|
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()
|
void Systray::slotNewUserSelected()
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentUserChanged();
|
void currentUserChanged();
|
||||||
|
void openAccountWizard();
|
||||||
void openMainDialog();
|
void openMainDialog();
|
||||||
void openSettings();
|
void openSettings();
|
||||||
void openHelp();
|
void openHelp();
|
||||||
@@ -91,7 +92,7 @@ private:
|
|||||||
QPoint computeWindowPosition(int width, int height) const;
|
QPoint computeWindowPosition(int width, int height) const;
|
||||||
|
|
||||||
bool _isOpen = false;
|
bool _isOpen = false;
|
||||||
bool _syncIsPaused = false;
|
bool _syncIsPaused = true;
|
||||||
QPointer<QQmlApplicationEngine> _trayEngine;
|
QPointer<QQmlApplicationEngine> _trayEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -90,21 +90,36 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
|||||||
return QString();
|
return QString();
|
||||||
case PathRole:
|
case PathRole:
|
||||||
if (!a._file.isEmpty()) {
|
if (!a._file.isEmpty()) {
|
||||||
auto folder = FolderMan::instance()->folder(a._folder);
|
auto folder = FolderMan::instance()->folderForPath(a._folder);
|
||||||
|
|
||||||
QString relPath(a._file);
|
QString relPath(a._file);
|
||||||
if (folder)
|
if (folder)
|
||||||
relPath.prepend(folder->remotePath());
|
relPath.prepend(folder->remotePath());
|
||||||
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
|
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
|
// 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());
|
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();
|
return QString();
|
||||||
case AbsolutePathRole: {
|
case AbsolutePathRole: {
|
||||||
|
|||||||
@@ -483,7 +483,12 @@ bool User::hasLocalFolder() const
|
|||||||
|
|
||||||
bool User::serverHasTalk() const
|
bool User::serverHasTalk() const
|
||||||
{
|
{
|
||||||
return _account->hasTalk();
|
return talkApp() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountApp *User::talkApp() const
|
||||||
|
{
|
||||||
|
return _account->findApp(QStringLiteral("spreed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool User::hasActivities() const
|
bool User::hasActivities() const
|
||||||
@@ -597,14 +602,6 @@ Q_INVOKABLE QString UserModel::currentUserServer()
|
|||||||
return _users[_currentUserId]->server();
|
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)
|
void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent)
|
||||||
{
|
{
|
||||||
bool containsUser = false;
|
bool containsUser = false;
|
||||||
@@ -643,14 +640,15 @@ Q_INVOKABLE void UserModel::openCurrentAccountLocalFolder()
|
|||||||
|
|
||||||
Q_INVOKABLE void UserModel::openCurrentAccountTalk()
|
Q_INVOKABLE void UserModel::openCurrentAccountTalk()
|
||||||
{
|
{
|
||||||
if (_users.isEmpty())
|
if (!currentUser())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString url = _users[_currentUserId]->server(false) + "/apps/spreed";
|
const auto talkApp = currentUser()->talkApp();
|
||||||
if (!(url.contains("http://") || url.contains("https://"))) {
|
if (talkApp) {
|
||||||
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed";
|
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()
|
Q_INVOKABLE void UserModel::openCurrentAccountServer()
|
||||||
@@ -864,9 +862,10 @@ void UserAppsModel::buildAppList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (UserModel::instance()->appList().count() > 0) {
|
if (UserModel::instance()->appList().count() > 0) {
|
||||||
|
const auto talkApp = UserModel::instance()->currentUser()->talkApp();
|
||||||
foreach (AccountApp *app, UserModel::instance()->appList()) {
|
foreach (AccountApp *app, UserModel::instance()->appList()) {
|
||||||
// Filter out Talk because we have a dedicated button for it
|
// Filter out Talk because we have a dedicated button for it
|
||||||
if (app->id() == QLatin1String("spreed"))
|
if (talkApp && app->id() == talkApp->id())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
QString server(bool shortened = true) const;
|
QString server(bool shortened = true) const;
|
||||||
bool hasLocalFolder() const;
|
bool hasLocalFolder() const;
|
||||||
bool serverHasTalk() const;
|
bool serverHasTalk() const;
|
||||||
|
AccountApp *talkApp() const;
|
||||||
bool hasActivities() const;
|
bool hasActivities() const;
|
||||||
AccountAppList appList() const;
|
AccountAppList appList() const;
|
||||||
QImage avatar(bool whiteBg = false) const;
|
QImage avatar(bool whiteBg = false) const;
|
||||||
@@ -112,7 +113,6 @@ public:
|
|||||||
Q_INVOKABLE QString currentUserServer();
|
Q_INVOKABLE QString currentUserServer();
|
||||||
Q_INVOKABLE bool currentUserHasActivities();
|
Q_INVOKABLE bool currentUserHasActivities();
|
||||||
Q_INVOKABLE bool currentUserHasLocalFolder();
|
Q_INVOKABLE bool currentUserHasLocalFolder();
|
||||||
Q_INVOKABLE bool currentServerHasTalk();
|
|
||||||
Q_INVOKABLE int currentUserId() const;
|
Q_INVOKABLE int currentUserId() const;
|
||||||
Q_INVOKABLE bool isUserConnected(const int &id);
|
Q_INVOKABLE bool isUserConnected(const int &id);
|
||||||
Q_INVOKABLE void switchCurrentUser(const int &id);
|
Q_INVOKABLE void switchCurrentUser(const int &id);
|
||||||
|
|||||||
@@ -75,6 +75,19 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpacityMask {
|
||||||
|
anchors.fill: parent
|
||||||
|
source: ShaderEffectSource {
|
||||||
|
sourceItem: trayWindowBackground
|
||||||
|
hideSource: true
|
||||||
|
}
|
||||||
|
maskSource: Rectangle {
|
||||||
|
width: trayWindowBackground.width
|
||||||
|
height: trayWindowBackground.height
|
||||||
|
radius: trayWindowBackground.radius
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: trayWindowBackground
|
id: trayWindowBackground
|
||||||
|
|
||||||
@@ -90,7 +103,6 @@ Window {
|
|||||||
anchors.top: trayWindowBackground.top
|
anchors.top: trayWindowBackground.top
|
||||||
height: Style.trayWindowHeaderHeight
|
height: Style.trayWindowHeaderHeight
|
||||||
width: Style.trayWindowWidth
|
width: Style.trayWindowWidth
|
||||||
radius: (Style.trayWindowRadius > 0) ? (Style.trayWindowRadius - 1) : 0
|
|
||||||
color: Style.ncBlue
|
color: Style.ncBlue
|
||||||
|
|
||||||
// The overlay rectangle below eliminates the rounded corners from the bottom of the header
|
// The overlay rectangle below eliminates the rounded corners from the bottom of the header
|
||||||
@@ -271,51 +283,9 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background:
|
background: Rectangle {
|
||||||
Item {
|
color: accountBtnMouseArea.containsMouse ? "white" : "transparent"
|
||||||
id: leftHoverContainer
|
opacity: 0.2
|
||||||
|
|
||||||
height: Style.trayWindowHeaderHeight
|
|
||||||
width: Style.currentAccountButtonWidth
|
|
||||||
Rectangle {
|
|
||||||
width: Style.currentAccountButtonWidth / 2
|
|
||||||
height: Style.trayWindowHeaderHeight / 2
|
|
||||||
color: "transparent"
|
|
||||||
clip: true
|
|
||||||
Rectangle {
|
|
||||||
width: Style.currentAccountButtonWidth
|
|
||||||
height: Style.trayWindowHeaderHeight
|
|
||||||
radius: Style.trayWindowRadius
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.2
|
|
||||||
visible: accountBtnMouseArea.containsMouse
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
width: Style.currentAccountButtonWidth / 2
|
|
||||||
height: Style.trayWindowHeaderHeight / 2
|
|
||||||
anchors.bottom: leftHoverContainer.bottom
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.2
|
|
||||||
visible: accountBtnMouseArea.containsMouse
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
width: Style.currentAccountButtonWidth / 2
|
|
||||||
height: Style.trayWindowHeaderHeight / 2
|
|
||||||
anchors.right: leftHoverContainer.right
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.2
|
|
||||||
visible: accountBtnMouseArea.containsMouse
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
width: Style.currentAccountButtonWidth / 2
|
|
||||||
height: Style.trayWindowHeaderHeight / 2
|
|
||||||
anchors.right: leftHoverContainer.right
|
|
||||||
anchors.bottom: leftHoverContainer.bottom
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.2
|
|
||||||
visible: accountBtnMouseArea.containsMouse
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ BandwidthManager::~BandwidthManager() = default;
|
|||||||
|
|
||||||
void BandwidthManager::registerUploadDevice(UploadDevice *p)
|
void BandwidthManager::registerUploadDevice(UploadDevice *p)
|
||||||
{
|
{
|
||||||
_absoluteUploadDeviceList.append(p);
|
_absoluteUploadDeviceList.push_back(p);
|
||||||
_relativeUploadDeviceList.append(p);
|
_relativeUploadDeviceList.push_back(p);
|
||||||
QObject::connect(p, &QObject::destroyed, this, &BandwidthManager::unregisterUploadDevice);
|
QObject::connect(p, &QObject::destroyed, this, &BandwidthManager::unregisterUploadDevice);
|
||||||
|
|
||||||
if (usingAbsoluteUploadLimit()) {
|
if (usingAbsoluteUploadLimit()) {
|
||||||
@@ -110,8 +110,8 @@ void BandwidthManager::registerUploadDevice(UploadDevice *p)
|
|||||||
void BandwidthManager::unregisterUploadDevice(QObject *o)
|
void BandwidthManager::unregisterUploadDevice(QObject *o)
|
||||||
{
|
{
|
||||||
auto p = reinterpret_cast<UploadDevice *>(o); // note, we might already be in the ~QObject
|
auto p = reinterpret_cast<UploadDevice *>(o); // note, we might already be in the ~QObject
|
||||||
_absoluteUploadDeviceList.removeAll(p);
|
_absoluteUploadDeviceList.remove(p);
|
||||||
_relativeUploadDeviceList.removeAll(p);
|
_relativeUploadDeviceList.remove(p);
|
||||||
if (p == _relativeLimitCurrentMeasuredDevice) {
|
if (p == _relativeLimitCurrentMeasuredDevice) {
|
||||||
_relativeLimitCurrentMeasuredDevice = nullptr;
|
_relativeLimitCurrentMeasuredDevice = nullptr;
|
||||||
_relativeUploadLimitProgressAtMeasuringRestart = 0;
|
_relativeUploadLimitProgressAtMeasuringRestart = 0;
|
||||||
@@ -120,7 +120,7 @@ void BandwidthManager::unregisterUploadDevice(QObject *o)
|
|||||||
|
|
||||||
void BandwidthManager::registerDownloadJob(GETFileJob *j)
|
void BandwidthManager::registerDownloadJob(GETFileJob *j)
|
||||||
{
|
{
|
||||||
_downloadJobList.append(j);
|
_downloadJobList.push_back(j);
|
||||||
QObject::connect(j, &QObject::destroyed, this, &BandwidthManager::unregisterDownloadJob);
|
QObject::connect(j, &QObject::destroyed, this, &BandwidthManager::unregisterDownloadJob);
|
||||||
|
|
||||||
if (usingAbsoluteDownloadLimit()) {
|
if (usingAbsoluteDownloadLimit()) {
|
||||||
@@ -138,7 +138,7 @@ void BandwidthManager::registerDownloadJob(GETFileJob *j)
|
|||||||
void BandwidthManager::unregisterDownloadJob(QObject *o)
|
void BandwidthManager::unregisterDownloadJob(QObject *o)
|
||||||
{
|
{
|
||||||
auto *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
|
auto *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
|
||||||
_downloadJobList.removeAll(j);
|
_downloadJobList.remove(j);
|
||||||
if (_relativeLimitCurrentMeasuredJob == j) {
|
if (_relativeLimitCurrentMeasuredJob == j) {
|
||||||
_relativeLimitCurrentMeasuredJob = nullptr;
|
_relativeLimitCurrentMeasuredJob = nullptr;
|
||||||
_relativeDownloadLimitProgressAtMeasuringRestart = 0;
|
_relativeDownloadLimitProgressAtMeasuringRestart = 0;
|
||||||
@@ -147,7 +147,7 @@ void BandwidthManager::unregisterDownloadJob(QObject *o)
|
|||||||
|
|
||||||
void BandwidthManager::relativeUploadMeasuringTimerExpired()
|
void BandwidthManager::relativeUploadMeasuringTimerExpired()
|
||||||
{
|
{
|
||||||
if (!usingRelativeUploadLimit() || _relativeUploadDeviceList.count() == 0) {
|
if (!usingRelativeUploadLimit() || _relativeUploadDeviceList.empty()) {
|
||||||
// Not in this limiting mode, just wait 1 sec to continue the cycle
|
// Not in this limiting mode, just wait 1 sec to continue the cycle
|
||||||
_relativeUploadDelayTimer.setInterval(1000);
|
_relativeUploadDelayTimer.setInterval(1000);
|
||||||
_relativeUploadDelayTimer.start();
|
_relativeUploadDelayTimer.start();
|
||||||
@@ -160,7 +160,7 @@ void BandwidthManager::relativeUploadMeasuringTimerExpired()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(lcBandwidthManager) << _relativeUploadDeviceList.count() << "Starting Delay";
|
qCDebug(lcBandwidthManager) << _relativeUploadDeviceList.size() << "Starting Delay";
|
||||||
|
|
||||||
qint64 relativeLimitProgressMeasured = (_relativeLimitCurrentMeasuredDevice->_readWithProgress
|
qint64 relativeLimitProgressMeasured = (_relativeLimitCurrentMeasuredDevice->_readWithProgress
|
||||||
+ _relativeLimitCurrentMeasuredDevice->_read)
|
+ _relativeLimitCurrentMeasuredDevice->_read)
|
||||||
@@ -191,7 +191,7 @@ void BandwidthManager::relativeUploadMeasuringTimerExpired()
|
|||||||
_relativeUploadDelayTimer.setInterval(realWaitTimeMsec);
|
_relativeUploadDelayTimer.setInterval(realWaitTimeMsec);
|
||||||
_relativeUploadDelayTimer.start();
|
_relativeUploadDelayTimer.start();
|
||||||
|
|
||||||
int deviceCount = _relativeUploadDeviceList.count();
|
auto deviceCount = _relativeUploadDeviceList.size();
|
||||||
qint64 quotaPerDevice = relativeLimitProgressDifference * (uploadLimitPercent / 100.0) / deviceCount + 1.0;
|
qint64 quotaPerDevice = relativeLimitProgressDifference * (uploadLimitPercent / 100.0) / deviceCount + 1.0;
|
||||||
Q_FOREACH (UploadDevice *ud, _relativeUploadDeviceList) {
|
Q_FOREACH (UploadDevice *ud, _relativeUploadDeviceList) {
|
||||||
ud->setBandwidthLimited(true);
|
ud->setBandwidthLimited(true);
|
||||||
@@ -211,15 +211,16 @@ void BandwidthManager::relativeUploadDelayTimerExpired()
|
|||||||
return; // oh, not actually needed
|
return; // oh, not actually needed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_relativeUploadDeviceList.isEmpty()) {
|
if (_relativeUploadDeviceList.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(lcBandwidthManager) << _relativeUploadDeviceList.count() << "Starting measuring";
|
qCDebug(lcBandwidthManager) << _relativeUploadDeviceList.size() << "Starting measuring";
|
||||||
|
|
||||||
// Take first device and then append it again (= we round robin all devices)
|
// Take first device and then append it again (= we round robin all devices)
|
||||||
_relativeLimitCurrentMeasuredDevice = _relativeUploadDeviceList.takeFirst();
|
_relativeLimitCurrentMeasuredDevice = _relativeUploadDeviceList.front();
|
||||||
_relativeUploadDeviceList.append(_relativeLimitCurrentMeasuredDevice);
|
_relativeUploadDeviceList.pop_front();
|
||||||
|
_relativeUploadDeviceList.push_back(_relativeLimitCurrentMeasuredDevice);
|
||||||
|
|
||||||
_relativeUploadLimitProgressAtMeasuringRestart = (_relativeLimitCurrentMeasuredDevice->_readWithProgress
|
_relativeUploadLimitProgressAtMeasuringRestart = (_relativeLimitCurrentMeasuredDevice->_readWithProgress
|
||||||
+ _relativeLimitCurrentMeasuredDevice->_read)
|
+ _relativeLimitCurrentMeasuredDevice->_read)
|
||||||
@@ -241,7 +242,7 @@ void BandwidthManager::relativeUploadDelayTimerExpired()
|
|||||||
// for downloads:
|
// for downloads:
|
||||||
void BandwidthManager::relativeDownloadMeasuringTimerExpired()
|
void BandwidthManager::relativeDownloadMeasuringTimerExpired()
|
||||||
{
|
{
|
||||||
if (!usingRelativeDownloadLimit() || _downloadJobList.count() == 0) {
|
if (!usingRelativeDownloadLimit() || _downloadJobList.empty()) {
|
||||||
// Not in this limiting mode, just wait 1 sec to continue the cycle
|
// Not in this limiting mode, just wait 1 sec to continue the cycle
|
||||||
_relativeDownloadDelayTimer.setInterval(1000);
|
_relativeDownloadDelayTimer.setInterval(1000);
|
||||||
_relativeDownloadDelayTimer.start();
|
_relativeDownloadDelayTimer.start();
|
||||||
@@ -254,7 +255,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(lcBandwidthManager) << _downloadJobList.count() << "Starting Delay";
|
qCDebug(lcBandwidthManager) << _downloadJobList.size() << "Starting Delay";
|
||||||
|
|
||||||
qint64 relativeLimitProgressMeasured = _relativeLimitCurrentMeasuredJob->currentDownloadPosition();
|
qint64 relativeLimitProgressMeasured = _relativeLimitCurrentMeasuredJob->currentDownloadPosition();
|
||||||
qint64 relativeLimitProgressDifference = relativeLimitProgressMeasured - _relativeDownloadLimitProgressAtMeasuringRestart;
|
qint64 relativeLimitProgressDifference = relativeLimitProgressMeasured - _relativeDownloadLimitProgressAtMeasuringRestart;
|
||||||
@@ -280,7 +281,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired()
|
|||||||
_relativeDownloadDelayTimer.setInterval(realWaitTimeMsec);
|
_relativeDownloadDelayTimer.setInterval(realWaitTimeMsec);
|
||||||
_relativeDownloadDelayTimer.start();
|
_relativeDownloadDelayTimer.start();
|
||||||
|
|
||||||
int jobCount = _downloadJobList.count();
|
auto jobCount = _downloadJobList.size();
|
||||||
qint64 quota = relativeLimitProgressDifference * (downloadLimitPercent / 100.0);
|
qint64 quota = relativeLimitProgressDifference * (downloadLimitPercent / 100.0);
|
||||||
if (quota > 20 * 1024) {
|
if (quota > 20 * 1024) {
|
||||||
qCInfo(lcBandwidthManager) << "ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20 * 1024;
|
qCInfo(lcBandwidthManager) << "ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20 * 1024;
|
||||||
@@ -305,16 +306,17 @@ void BandwidthManager::relativeDownloadDelayTimerExpired()
|
|||||||
return; // oh, not actually needed
|
return; // oh, not actually needed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_downloadJobList.isEmpty()) {
|
if (_downloadJobList.empty()) {
|
||||||
qCDebug(lcBandwidthManager) << _downloadJobList.count() << "No jobs?";
|
qCDebug(lcBandwidthManager) << _downloadJobList.size() << "No jobs?";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(lcBandwidthManager) << _downloadJobList.count() << "Starting measuring";
|
qCDebug(lcBandwidthManager) << _downloadJobList.size() << "Starting measuring";
|
||||||
|
|
||||||
// Take first device and then append it again (= we round robin all devices)
|
// Take first device and then append it again (= we round robin all devices)
|
||||||
_relativeLimitCurrentMeasuredJob = _downloadJobList.takeFirst();
|
_relativeLimitCurrentMeasuredJob = _downloadJobList.front();
|
||||||
_downloadJobList.append(_relativeLimitCurrentMeasuredJob);
|
_downloadJobList.pop_front();
|
||||||
|
_downloadJobList.push_back(_relativeLimitCurrentMeasuredJob);
|
||||||
|
|
||||||
_relativeDownloadLimitProgressAtMeasuringRestart = _relativeLimitCurrentMeasuredJob->currentDownloadPosition();
|
_relativeDownloadLimitProgressAtMeasuringRestart = _relativeLimitCurrentMeasuredJob->currentDownloadPosition();
|
||||||
_relativeLimitCurrentMeasuredJob->setBandwidthLimited(false);
|
_relativeLimitCurrentMeasuredJob->setBandwidthLimited(false);
|
||||||
@@ -373,21 +375,22 @@ void BandwidthManager::switchingTimerExpired()
|
|||||||
|
|
||||||
void BandwidthManager::absoluteLimitTimerExpired()
|
void BandwidthManager::absoluteLimitTimerExpired()
|
||||||
{
|
{
|
||||||
if (usingAbsoluteUploadLimit() && _absoluteUploadDeviceList.count() > 0) {
|
if (usingAbsoluteUploadLimit() && !_absoluteUploadDeviceList.empty()) {
|
||||||
qint64 quotaPerDevice = _currentUploadLimit / qMax(1, _absoluteUploadDeviceList.count());
|
qint64 quotaPerDevice = _currentUploadLimit / qMax((std::list<UploadDevice *>::size_type)1, _absoluteUploadDeviceList.size());
|
||||||
qCDebug(lcBandwidthManager) << quotaPerDevice << _absoluteUploadDeviceList.count() << _currentUploadLimit;
|
qCDebug(lcBandwidthManager) << quotaPerDevice << _absoluteUploadDeviceList.size() << _currentUploadLimit;
|
||||||
Q_FOREACH (UploadDevice *device, _absoluteUploadDeviceList) {
|
Q_FOREACH (UploadDevice *device, _absoluteUploadDeviceList) {
|
||||||
device->giveBandwidthQuota(quotaPerDevice);
|
device->giveBandwidthQuota(quotaPerDevice);
|
||||||
qCDebug(lcBandwidthManager) << "Gave " << quotaPerDevice / 1024.0 << " kB to" << device;
|
qCDebug(lcBandwidthManager) << "Gave " << quotaPerDevice / 1024.0 << " kB to" << device;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usingAbsoluteDownloadLimit() && _downloadJobList.count() > 0) {
|
if (usingAbsoluteDownloadLimit() && !_downloadJobList.empty()) {
|
||||||
qint64 quotaPerJob = _currentDownloadLimit / qMax(1, _downloadJobList.count());
|
qint64 quotaPerJob = _currentDownloadLimit / qMax((std::list<GETFileJob *>::size_type)1, _downloadJobList.size());
|
||||||
qCDebug(lcBandwidthManager) << quotaPerJob << _downloadJobList.count() << _currentDownloadLimit;
|
qCDebug(lcBandwidthManager) << quotaPerJob << _downloadJobList.size() << _currentDownloadLimit;
|
||||||
Q_FOREACH (GETFileJob *j, _downloadJobList) {
|
Q_FOREACH (GETFileJob *j, _downloadJobList) {
|
||||||
j->giveBandwidthQuota(quotaPerJob);
|
j->giveBandwidthQuota(quotaPerJob);
|
||||||
qCDebug(lcBandwidthManager) << "Gave " << quotaPerJob / 1024.0 << " kB to" << j;
|
qCDebug(lcBandwidthManager) << "Gave " << quotaPerJob / 1024.0 << " kB to" << j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // namespace OCC
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
#define BANDWIDTHMANAGER_H
|
#define BANDWIDTHMANAGER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QLinkedList>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ private:
|
|||||||
QTimer _absoluteLimitTimer;
|
QTimer _absoluteLimitTimer;
|
||||||
|
|
||||||
// FIXME merge these two lists
|
// FIXME merge these two lists
|
||||||
QLinkedList<UploadDevice *> _absoluteUploadDeviceList;
|
std::list<UploadDevice *> _absoluteUploadDeviceList;
|
||||||
QLinkedList<UploadDevice *> _relativeUploadDeviceList;
|
std::list<UploadDevice *> _relativeUploadDeviceList;
|
||||||
|
|
||||||
QTimer _relativeUploadMeasuringTimer;
|
QTimer _relativeUploadMeasuringTimer;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ private:
|
|||||||
qint64 _relativeUploadLimitProgressAtMeasuringRestart;
|
qint64 _relativeUploadLimitProgressAtMeasuringRestart;
|
||||||
qint64 _currentUploadLimit;
|
qint64 _currentUploadLimit;
|
||||||
|
|
||||||
QLinkedList<GETFileJob *> _downloadJobList;
|
std::list<GETFileJob *> _downloadJobList;
|
||||||
QTimer _relativeDownloadMeasuringTimer;
|
QTimer _relativeDownloadMeasuringTimer;
|
||||||
|
|
||||||
// for relative bw limiting, we need to wait this amount before measuring again
|
// for relative bw limiting, we need to wait this amount before measuring again
|
||||||
@@ -100,6 +100,7 @@ private:
|
|||||||
|
|
||||||
qint64 _currentDownloadLimit;
|
qint64 _currentDownloadLimit;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace OCC
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -61,6 +61,31 @@ namespace {
|
|||||||
const char e2e_cert[] = "_e2e-certificate";
|
const char e2e_cert[] = "_e2e-certificate";
|
||||||
const char e2e_private[] = "_e2e-private";
|
const char e2e_private[] = "_e2e-private";
|
||||||
const char e2e_mnemonic[] = "_e2e-mnemonic";
|
const char e2e_mnemonic[] = "_e2e-mnemonic";
|
||||||
|
|
||||||
|
QList<QByteArray> oldCipherFormatSplit(const QByteArray &cipher)
|
||||||
|
{
|
||||||
|
const auto separator = QByteArrayLiteral("fA=="); // BASE64 encoded '|'
|
||||||
|
auto result = QList<QByteArray>();
|
||||||
|
|
||||||
|
auto data = cipher;
|
||||||
|
auto index = data.indexOf(separator);
|
||||||
|
while (index >=0) {
|
||||||
|
result.append(data.left(index));
|
||||||
|
data = data.mid(index + separator.size());
|
||||||
|
index = data.indexOf(separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QByteArray> splitCipherParts(const QByteArray &data)
|
||||||
|
{
|
||||||
|
const auto isOldFormat = !data.contains('|');
|
||||||
|
const auto parts = isOldFormat ? oldCipherFormatSplit(data) : data.split('|');
|
||||||
|
qCInfo(lcCse()) << "found parts:" << parts << "old format?" << isOldFormat;
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -371,11 +396,14 @@ QByteArray decryptPrivateKey(const QByteArray& key, const QByteArray& data) {
|
|||||||
qCInfo(lcCse()) << "decryptStringSymmetric key: " << key;
|
qCInfo(lcCse()) << "decryptStringSymmetric key: " << key;
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric data: " << data;
|
qCInfo(lcCse()) << "decryptStringSymmetric data: " << data;
|
||||||
|
|
||||||
int sep = data.indexOf('|');
|
const auto parts = splitCipherParts(data);
|
||||||
qCInfo(lcCse()) << "sep at" << sep;
|
if (parts.size() < 2) {
|
||||||
|
qCInfo(lcCse()) << "Not enough parts found";
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray cipherTXT64 = data.left(sep);
|
QByteArray cipherTXT64 = parts.at(0);
|
||||||
QByteArray ivB64 = data.right(data.size() - sep - 1);
|
QByteArray ivB64 = parts.at(1);
|
||||||
|
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric cipherTXT: " << cipherTXT64;
|
qCInfo(lcCse()) << "decryptStringSymmetric cipherTXT: " << cipherTXT64;
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric IV: " << ivB64;
|
qCInfo(lcCse()) << "decryptStringSymmetric IV: " << ivB64;
|
||||||
@@ -443,15 +471,29 @@ QByteArray decryptPrivateKey(const QByteArray& key, const QByteArray& data) {
|
|||||||
return QByteArray::fromBase64(result);
|
return QByteArray::fromBase64(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray extractPrivateKeySalt(const QByteArray &data)
|
||||||
|
{
|
||||||
|
const auto parts = splitCipherParts(data);
|
||||||
|
if (parts.size() < 3) {
|
||||||
|
qCInfo(lcCse()) << "Not enough parts found";
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QByteArray::fromBase64(parts.at(2));
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray decryptStringSymmetric(const QByteArray& key, const QByteArray& data) {
|
QByteArray decryptStringSymmetric(const QByteArray& key, const QByteArray& data) {
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric key: " << key;
|
qCInfo(lcCse()) << "decryptStringSymmetric key: " << key;
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric data: " << data;
|
qCInfo(lcCse()) << "decryptStringSymmetric data: " << data;
|
||||||
|
|
||||||
int sep = data.indexOf('|');
|
const auto parts = splitCipherParts(data);
|
||||||
qCInfo(lcCse()) << "sep at" << sep;
|
if (parts.size() < 2) {
|
||||||
|
qCInfo(lcCse()) << "Not enough parts found";
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray cipherTXT64 = data.left(sep);
|
QByteArray cipherTXT64 = parts.at(0);
|
||||||
QByteArray ivB64 = data.right(data.size() - sep - 1);
|
QByteArray ivB64 = parts.at(1);
|
||||||
|
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric cipherTXT: " << cipherTXT64;
|
qCInfo(lcCse()) << "decryptStringSymmetric cipherTXT: " << cipherTXT64;
|
||||||
qCInfo(lcCse()) << "decryptStringSymmetric IV: " << ivB64;
|
qCInfo(lcCse()) << "decryptStringSymmetric IV: " << ivB64;
|
||||||
@@ -515,7 +557,7 @@ QByteArray decryptStringSymmetric(const QByteArray& key, const QByteArray& data)
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QByteArray(ptext, plen);
|
return QByteArray::fromBase64(QByteArray(ptext, plen));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray privateKeyToPem(const QByteArray key) {
|
QByteArray privateKeyToPem(const QByteArray key) {
|
||||||
@@ -1130,15 +1172,12 @@ void ClientSideEncryption::decryptPrivateKey(const QByteArray &key) {
|
|||||||
qCInfo(lcCse()) << "mnemonic:" << mnemonic;
|
qCInfo(lcCse()) << "mnemonic:" << mnemonic;
|
||||||
|
|
||||||
// split off salt
|
// split off salt
|
||||||
// Todo better place?
|
const auto salt = EncryptionHelper::extractPrivateKeySalt(key);
|
||||||
auto pos = key.lastIndexOf('|');
|
|
||||||
QByteArray salt = QByteArray::fromBase64(key.mid(pos + 1));
|
|
||||||
auto key2 = key.left(pos);
|
|
||||||
|
|
||||||
auto pass = EncryptionHelper::generatePassword(mnemonic, salt);
|
auto pass = EncryptionHelper::generatePassword(mnemonic, salt);
|
||||||
qCInfo(lcCse()) << "Generated key:" << pass;
|
qCInfo(lcCse()) << "Generated key:" << pass;
|
||||||
|
|
||||||
QByteArray privateKey = EncryptionHelper::decryptPrivateKey(pass, key2);
|
QByteArray privateKey = EncryptionHelper::decryptPrivateKey(pass, key);
|
||||||
//_privateKey = QSslKey(privateKey, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
|
//_privateKey = QSslKey(privateKey, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
|
||||||
_privateKey = privateKey;
|
_privateKey = privateKey;
|
||||||
|
|
||||||
@@ -1288,7 +1327,7 @@ void FolderMetadata::setupExistingMetadata(const QByteArray& metadata)
|
|||||||
// Cool, We actually have the key, we can decrypt the rest of the metadata.
|
// Cool, We actually have the key, we can decrypt the rest of the metadata.
|
||||||
qCDebug(lcCse) << "Sharing: " << sharing;
|
qCDebug(lcCse) << "Sharing: " << sharing;
|
||||||
if (sharing.size()) {
|
if (sharing.size()) {
|
||||||
auto sharingDecrypted = QByteArray::fromBase64(decryptJsonObject(sharing, _metadataKeys.last()));
|
auto sharingDecrypted = decryptJsonObject(sharing, _metadataKeys.last());
|
||||||
qCDebug(lcCse) << "Sharing Decrypted" << sharingDecrypted;
|
qCDebug(lcCse) << "Sharing Decrypted" << sharingDecrypted;
|
||||||
|
|
||||||
//Sharing is also a JSON object, so extract it and populate.
|
//Sharing is also a JSON object, so extract it and populate.
|
||||||
@@ -1313,7 +1352,7 @@ void FolderMetadata::setupExistingMetadata(const QByteArray& metadata)
|
|||||||
//Decrypt encrypted part
|
//Decrypt encrypted part
|
||||||
QByteArray key = _metadataKeys[file.metadataKey];
|
QByteArray key = _metadataKeys[file.metadataKey];
|
||||||
auto encryptedFile = fileObj["encrypted"].toString().toLocal8Bit();
|
auto encryptedFile = fileObj["encrypted"].toString().toLocal8Bit();
|
||||||
auto decryptedFile = QByteArray::fromBase64(decryptJsonObject(encryptedFile, key));
|
auto decryptedFile = decryptJsonObject(encryptedFile, key);
|
||||||
auto decryptedFileDoc = QJsonDocument::fromJson(decryptedFile);
|
auto decryptedFileDoc = QJsonDocument::fromJson(decryptedFile);
|
||||||
auto decryptedFileObj = decryptedFileDoc.object();
|
auto decryptedFileObj = decryptedFileDoc.object();
|
||||||
|
|
||||||
|
|||||||
@@ -29,20 +29,21 @@ namespace EncryptionHelper {
|
|||||||
QByteArray generateRandomFilename();
|
QByteArray generateRandomFilename();
|
||||||
QByteArray generateRandom(int size);
|
QByteArray generateRandom(int size);
|
||||||
QByteArray generatePassword(const QString &wordlist, const QByteArray& salt);
|
QByteArray generatePassword(const QString &wordlist, const QByteArray& salt);
|
||||||
QByteArray encryptPrivateKey(
|
OWNCLOUDSYNC_EXPORT QByteArray encryptPrivateKey(
|
||||||
const QByteArray& key,
|
const QByteArray& key,
|
||||||
const QByteArray& privateKey,
|
const QByteArray& privateKey,
|
||||||
const QByteArray &salt
|
const QByteArray &salt
|
||||||
);
|
);
|
||||||
QByteArray decryptPrivateKey(
|
OWNCLOUDSYNC_EXPORT QByteArray decryptPrivateKey(
|
||||||
const QByteArray& key,
|
const QByteArray& key,
|
||||||
const QByteArray& data
|
const QByteArray& data
|
||||||
);
|
);
|
||||||
QByteArray encryptStringSymmetric(
|
OWNCLOUDSYNC_EXPORT QByteArray extractPrivateKeySalt(const QByteArray &data);
|
||||||
|
OWNCLOUDSYNC_EXPORT QByteArray encryptStringSymmetric(
|
||||||
const QByteArray& key,
|
const QByteArray& key,
|
||||||
const QByteArray& data
|
const QByteArray& data
|
||||||
);
|
);
|
||||||
QByteArray decryptStringSymmetric(
|
OWNCLOUDSYNC_EXPORT QByteArray decryptStringSymmetric(
|
||||||
const QByteArray& key,
|
const QByteArray& key,
|
||||||
const QByteArray& data
|
const QByteArray& data
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "networkjobs.h"
|
#include "networkjobs.h"
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
#include <QLinkedList>
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "syncoptions.h"
|
#include "syncoptions.h"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QLinkedList>
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|||||||
@@ -290,8 +290,14 @@ void SyncFileStatusTracker::slotSyncFinished()
|
|||||||
// Clear the sync counts to reduce the impact of unsymetrical inc/dec calls (e.g. when directory job abort)
|
// Clear the sync counts to reduce the impact of unsymetrical inc/dec calls (e.g. when directory job abort)
|
||||||
QHash<QString, int> oldSyncCount;
|
QHash<QString, int> oldSyncCount;
|
||||||
std::swap(_syncCount, oldSyncCount);
|
std::swap(_syncCount, oldSyncCount);
|
||||||
for (auto it = oldSyncCount.begin(); it != oldSyncCount.end(); ++it)
|
for (auto it = oldSyncCount.begin(); it != oldSyncCount.end(); ++it) {
|
||||||
|
// Don't announce folders, fileStatus expect only paths without '/', otherwise it asserts
|
||||||
|
if (it.key().endsWith('/')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
emit fileStatusChanged(getSystemDestination(it.key()), fileStatus(it.key()));
|
emit fileStatusChanged(getSystemDestination(it.key()), fileStatus(it.key()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncFileStatusTracker::slotSyncEngineRunningChanged()
|
void SyncFileStatusTracker::slotSyncEngineRunningChanged()
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ QString Theme::statusHeaderText(SyncResult::Status status) const
|
|||||||
return resultStr;
|
return resultStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Theme::isBranded() const
|
||||||
|
{
|
||||||
|
return appNameGUI() != QStringLiteral("Nextcloud");
|
||||||
|
}
|
||||||
|
|
||||||
QString Theme::appNameGUI() const
|
QString Theme::appNameGUI() const
|
||||||
{
|
{
|
||||||
return APPLICATION_NAME;
|
return APPLICATION_NAME;
|
||||||
@@ -139,16 +144,28 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray) const
|
|||||||
return cached = QIcon::fromTheme(name);
|
return cached = QIcon::fromTheme(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> sizes;
|
const auto svgName = QString::fromLatin1(":/client/theme/%1/%2.svg").arg(flavor).arg(name);
|
||||||
sizes << 16 << 32 << 64 << 128 << 256;
|
QSvgRenderer renderer(svgName);
|
||||||
foreach (int size, sizes) {
|
const auto createPixmapFromSvg = [&renderer] (int size) {
|
||||||
QString svgName = QString::fromLatin1(":/client/theme/%1/%2.svg").arg(flavor).arg(name);
|
|
||||||
QSvgRenderer renderer(svgName);
|
|
||||||
QImage img(size, size, QImage::Format_ARGB32);
|
QImage img(size, size, QImage::Format_ARGB32);
|
||||||
img.fill(Qt::GlobalColor::transparent);
|
img.fill(Qt::GlobalColor::transparent);
|
||||||
QPainter imgPainter(&img);
|
QPainter imgPainter(&img);
|
||||||
renderer.render(&imgPainter);
|
renderer.render(&imgPainter);
|
||||||
auto px = QPixmap::fromImage(img);
|
return QPixmap::fromImage(img);
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto loadPixmap = [flavor, name] (int size) {
|
||||||
|
const auto pixmapName = QString::fromLatin1(":/client/theme/%1/%2-%3.png").arg(flavor).arg(name).arg(size);
|
||||||
|
return QPixmap(pixmapName);
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto sizes = isBranded() ? QVector<int>{ 16, 22, 32, 48, 64, 128, 256, 512, 1024 }
|
||||||
|
: QVector<int>{ 16, 32, 64, 128, 256 };
|
||||||
|
for (int size : sizes) {
|
||||||
|
auto px = isBranded() ? loadPixmap(size) : createPixmapFromSvg(size);
|
||||||
|
if (px.isNull()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// HACK, get rid of it by supporting FDO icon themes, this is really just emulating ubuntu-mono
|
// HACK, get rid of it by supporting FDO icon themes, this is really just emulating ubuntu-mono
|
||||||
if (qgetenv("DESKTOP_SESSION") == "ubuntu") {
|
if (qgetenv("DESKTOP_SESSION") == "ubuntu") {
|
||||||
QBitmap mask = px.createMaskFromColor(Qt::white, Qt::MaskOutColor);
|
QBitmap mask = px.createMaskFromColor(Qt::white, Qt::MaskOutColor);
|
||||||
|
|||||||