1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-04 12:11:33 +02:00

Compare commits

..

170 Commits

Author SHA1 Message Date
Camila
0a62628f8a Bump version to 3.0.1.
Signed-off-by: Camila <hello@camila.codes>
2020-08-28 11:45:24 +02:00
Nextcloud bot
772a34ba46 [tx-robot] updated from transifex 2020-08-28 03:25:46 +00:00
Nextcloud bot
42ea6b5427 [tx-robot] updated from transifex 2020-08-27 03:28:47 +00:00
Michael Schuster
3ea57abfec Remove remaining QLinkedList includes in addition to #2300
Now the only remaining reference is in:

src/3rdparty/libcrashreporter-qt/3rdparty/drkonqi-parser/backtraceparser.cpp:269:        || line.functionName().startsWith(QLatin1String("QLinkedList")

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 5945f18d5a)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 03:41:14 +02:00
Michael Schuster
6f2156cacd Merge pull request #2323 from nextcloud/backport/2300/stable-3.0
[stable-3.0] Support client builds on VS2019 (QLinkedList is deprecated)
2020-08-27 02:22:45 +02:00
Michael Schuster
9e5225d83d Adapt code style in addition to #2300
- Use "!empty()" instead of "size() > 0" in std::list
- Add comments for namespace brackets

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit bd519ffe7a)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 02:13:06 +02:00
V.C
957dd16770 Code review changes implemented
Code review changes implemented for bandwidthmanager.cpp
1. Use auto instead of size_t
2. Check for empty instead of size comparisions

Signed-off-by: V.C <c******@rediffmail.com>
(cherry picked from commit b20ea25201)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 02:12:53 +02:00
V.C
95401e5985 Support client builds on VS2019
Scenario: Build fails on Qt 5.15.0 + VS2019 16.7.2
Root cause: QLinkedList seems to be depreciated. Advise to use std::list instead.
Fix: Used std::list insead of QLinkedList.

Signed-off-by: V.C <c******@rediffmail.com>
(cherry picked from commit af1bb7e98c)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 02:12:51 +02:00
Nextcloud bot
a15b66d525 [tx-robot] updated from transifex 2020-08-26 03:28:55 +00:00
Nextcloud bot
e0b53b3bda [tx-robot] updated from transifex 2020-08-25 03:31:22 +00:00
Nextcloud bot
2015aab626 [tx-robot] updated from transifex 2020-08-24 03:29:52 +00:00
Nextcloud bot
90402f8dcb [tx-robot] updated from transifex 2020-08-22 03:27:54 +00:00
Michael Schuster
0de6823cca Merge pull request #2304 from nextcloud/backport/2302/stable-3.0
[stable-3.0] Do not build for Eoan
2020-08-22 00:57:03 +02:00
István Váradi
c560db000a Do not build for Eoan
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-08-21 22:56:18 +00:00
Nextcloud bot
fba819e65b [tx-robot] updated from transifex 2020-08-21 03:29:21 +00:00
Michael Schuster
d02f1b80f3 Merge pull request #2297 from nextcloud/backport/2288/stable-3.0
[stable-3.0] Windows shell extensions: Use custom GUIDs and prepare for MSI
2020-08-20 21:39:48 +02:00
Michael Schuster
fc79e035c6 Fix spacing
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 4df8db4ff6)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:32:06 +02:00
Michael Schuster
ee332dcaec Windows shell extensions: Add WiX (MSI) fragment
Use CMake to generate a WXI fragment to handle the DLL registration and file deployment for the shellext components.

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit db05f65e0d)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:31:56 +02:00
Michael Schuster
b5fc4f86a7 Windows shell extensions: Change NCUtil Pipe name from ownCloud to APPLICATION_EXECUTABLE
Avoid interference with foreign pipes as this is always a bad idea ;p

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 11632da7ea)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:31:23 +02:00
Michael Schuster
3ac99c75b0 Windows shell extensions: Rename all files and classes from OC* to NC*, update version info
This also ensures a clear separation in the system registry.

SelfReg is not recommended by Microsoft and will be handled by the MSI package to allow proper Repair and Uninstall.
However, we keep it for backward compatibility with the NSIS installer.

For details 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

Another fix by this commit:
The "Version" registry value in the NCOverlays self reg should be a key and not a value.

Details: https://wixtoolset.org/documentation/manual/v3/xsd/wix/class.html

Example:

  [HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Version]
  @="1.0.0.0"

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 0ba5df597f)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:28:18 +02:00
Michael Schuster
a02e4a2913 Windows shell extensions: Use custom GUIDs via CMake and prepare MSI reg
Previously side by side installation with ownCloud or other NC custom builds would break the shell integration because the same GUIDs and registry keys were used.

Now we specify our custom GUIDs in NEXTCLOUD.cmake and use CMake to generate a header file and WiX (MSI) include file with these constants.

Note: Using generators like "guidgen" or "uuidgen" ensures that GUIDs are unique, as manual changes are not guaranteed to be.

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 8ce13b7bdb)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:28:10 +02:00
Hannah von Reth
a7b93e36ff Remove dead code
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 4675869fb3)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:28:02 +02:00
Hannah von Reth
a742a42f4c 2.7 has less automatic includes on Windows
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit bfd7707ff4)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:53 +02:00
Hannah von Reth
2537f0cd4c Cleanup Windows shell extensions
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 34e9e2f288)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:44 +02:00
Hannah von Reth
4e44f46b9e Remove outdated visual studio projects, we now use cmake
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 6c9a31f6ee)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:35 +02:00
Dominik Schmidt
b86bc92875 Avoid warning because /MT overrides /MD flag
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 13d4b91935)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:27 +02:00
Dominik Schmidt
c3b1e4bd9a Make OCUtil helper lib static and link it statically against crt
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit e4b53b12e1)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:11 +02:00
Olivier Goffart
3fd3f85558 Windows Shell Integration: Don't limit the size of the buffer
Otherwise we can't have operation that has many many filename

As reported in #6780

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 906556640d)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:27:01 +02:00
Christian Kamm
811b0eb6db Windows shellext: Update copyrights and company name
Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 77cc262337)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:26:52 +02:00
Olivier Goffart
7acc7dae35 windows shell extension: add OCUtil/resource.h
It's a copy from OCContextMenu/resources.h

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit 6274462036)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:26:42 +02:00
Christian Kamm
4c9e19b82c Windows shellext: Add rc for OCUtil #6554
To set the dll's metadata.

Signed-off-by: Michael Schuster <michael@schuster.ms>
(cherry picked from commit c6fc46aa09)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 21:26:12 +02:00
Kevin Ottens
3770e75561 Merge pull request #2294 from nextcloud/backport/2292/stable-3.0
[stable-3.0] Disable context menu actions for E2EE files and folders
2020-08-20 18:39:02 +02:00
Kevin Ottens
14d4160729 Present sharing of E2EE files from the main dialog too
The visibility of the share button for the activity list is tied to the
path role in the ActivityListModel, so make sure we don't return a path
for E2EE files and folders.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-20 16:37:26 +00:00
Kevin Ottens
6dcf261abe Disable context menu actions for E2EE files and folders
Those files and folders are not shareable and the "Edit" or "Open in
browser" actions will lead to showing an error in the web GUI. No need
to lead users there so just disable them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-20 16:37:26 +00:00
Nextcloud bot
3d3d6bf2d9 [tx-robot] updated from transifex 2020-08-20 03:31:35 +00:00
Nextcloud bot
a957a9924e [tx-robot] updated from transifex 2020-08-19 03:31:55 +00:00
Kevin Ottens
7de04654c5 Show the "Display mnemonic" button only when we know e2e is supported
Turns out that showing the button straight from the page ctor is a bit
too early. At that point the account might not be connected yet and thus
we wouldn't have proper information. Currently we were displaying that
button all the time, now we wait for the account to be connected to
decide to show it or not.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-18 18:01:07 +02:00
Kevin Ottens
a60fa8ba85 [stable-3.0] Make sure we don't assert when calling fileStatus
It happens that sometimes we leak a directory path ending with a slash,
but that violates fileStatus' precondition so let's catch it early and
skip such path.

Of course the right fix would be a larger swipe in the sync engine and
around it to not use naked strings anymore but rely on the typesystem.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-18 16:12:44 +02:00
Nextcloud bot
6ad1357ac0 [tx-robot] updated from transifex 2020-08-18 03:33:47 +00:00
Nextcloud bot
48b8848dcc [tx-robot] updated from transifex 2020-08-17 03:27:18 +00:00
Nextcloud bot
42f7d3e538 [tx-robot] updated from transifex 2020-08-16 03:27:23 +00:00
Nextcloud bot
ce126e6d7f [tx-robot] updated from transifex 2020-08-14 03:43:45 +00:00
Nextcloud bot
824e853b2a [tx-robot] updated from transifex 2020-08-13 03:29:42 +00:00
Nextcloud bot
97020728c1 [tx-robot] updated from transifex 2020-08-12 03:29:22 +00:00
Kevin Ottens
ff175088a3 Merge pull request #2259 from nextcloud/backport/2258/stable-3.0
[stable-3.0] Keep the E2EE info message around to allow displaying mnemonic
2020-08-11 15:13:02 +02:00
Kevin Ottens
0066de26bb Keep the E2EE info message around to allow displaying mnemonic
We lost the ability to display the E2EE mnemonic during the GUI
redesign and the info message wasn't displayed again on restart. So now
we display it every time, it still can be dismissed and the button text
is different in such a case to make the intent clearer.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-11 13:12:34 +00:00
Nextcloud bot
68f137fff5 [tx-robot] updated from transifex 2020-08-11 03:29:04 +00:00
Kevin Ottens
aa5ff75fa2 Merge pull request #2257 from nextcloud/backport/2255/stable-3.0
[stable-3.0] Restore E2EE old key storage format compatibility
2020-08-10 16:11:55 +02:00
Kevin Ottens
37a0474f09 Add support for BASE64 encoded '|' when decrypting
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 14:08:00 +00:00
Kevin Ottens
802c5f0a0a Move the private key salt handling in its own function
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 14:08:00 +00:00
Kevin Ottens
d45c8aee8e Ignore the salt part of the key during decryption
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 14:08:00 +00:00
Kevin Ottens
2424803bdd Restore the symmetry between *StringSymmetric functions
If we receive data without base64 encoding for encryption, it makes
sense to get it without base64 encoding out of decryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 14:07:59 +00:00
Kevin Ottens
63233bf09e Add unit tests for the encryption helpers
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 14:07:59 +00:00
Nextcloud bot
493cba2e55 [tx-robot] updated from transifex 2020-08-09 03:28:46 +00:00
Nextcloud bot
de3b56d999 [tx-robot] updated from transifex 2020-08-08 03:30:53 +00:00
Nextcloud bot
e3c10bde59 [tx-robot] updated from transifex 2020-08-07 03:31:19 +00:00
Kevin Ottens
ff60f75b2a Merge pull request #2248 from nextcloud/bump_version_to_3.0
There won't be a 2.7, this is called 3.0 instead
2020-08-06 14:25:00 +02:00
Kevin Ottens
39de633828 There won't be a 2.7, this is called 3.0 instead
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-06 13:40:00 +02:00
Nextcloud bot
2ebc4041ac [tx-robot] updated from transifex 2020-08-06 03:31:10 +00:00
Nextcloud bot
8a89edc1f9 [tx-robot] updated from transifex 2020-08-05 08:58:21 +00:00
Nextcloud bot
cfbc343c69 [tx-robot] updated from transifex 2020-08-05 08:53:47 +00:00
Nextcloud bot
1906e5aac9 [tx-robot] updated from transifex 2020-08-05 03:31:20 +00:00
Kevin Ottens
662df54371 Merge pull request #2245 from nextcloud/fix-issue-2243
Fix #2243
2020-08-04 18:54:55 +02:00
Camila
8f300ffe66 Remove extra check for talk app on server in AccountState.
- Remove repeated hard coded "spreed" string.

Signed-off-by: Camila <hello@camila.codes>
2020-08-04 16:28:19 +00:00
Camila
6d6cc3852b Fix #2243: use server url instead of hard coded string.
Signed-off-by: Camila <hello@camila.codes>
2020-08-04 16:28:19 +00:00
Kevin Ottens
0516db5e10 Make sure we always have a CLSID when Explorer integration is used
We update properly the CLSID of folders to integrate them with the
Explorer pane when they are added or removed from the GUI. That said,
there might be cases of users adding folders to sync straight from the
GUI. In such a case the CLSID might be missing on config load so now we
assign one on the fly when that happens.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-04 07:33:53 +02:00
Nextcloud bot
cc4b12ce8b [tx-robot] updated from transifex 2020-08-04 03:30:42 +00:00
Michael Schuster
e02be629bb Windows: Enable CFG and SafeSEH linker security flags
See:
https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard
https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-03 10:11:33 +02:00
Michael Schuster
bc5888e8e4 Always show Settings in the context menu (amends #2164)
The context menu should allow access to the Settings even when no accounts are configured.

Users may specify proxy / startup / update and other settings at any time.

This slipped through in #2164.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-03 10:10:05 +02:00
Nextcloud bot
480c3e6f86 [tx-robot] updated from transifex 2020-08-03 03:31:51 +00:00
Nextcloud bot
d457d87c86 [tx-robot] updated from transifex 2020-08-02 03:30:48 +00:00
Nextcloud bot
da814c9e44 [tx-robot] updated from transifex 2020-08-01 03:30:21 +00:00
Nextcloud bot
b1a92e8db9 [tx-robot] updated from transifex 2020-07-31 03:31:56 +00:00
Nextcloud bot
739edaa801 [tx-robot] updated from transifex 2020-07-30 03:31:15 +00:00
Nextcloud bot
5913cdd8d6 [tx-robot] updated from transifex 2020-07-29 03:32:53 +00:00
Kevin Ottens
b6826bf6ea Merge pull request #2227 from nextcloud/support_png_for_branded_clients_systray
Support png for branded clients systray
2020-07-28 12:06:03 +02:00
Kevin Ottens
66ede652f8 Use PNGs for branded clients
For branded clients try to load a png of the right size, for unbranded
clients use the SVGs. If something fails at load time skip it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens
72eba2b93d Move the svg rendering part in a lambda
This simplifies the loop body a bit, opening the door to what's next.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens
73c3aa7898 Extract the svg renderer from the loop
No need to recreate it each time for nothing.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens
16a37c6aa0 Branded clients have more size variety for their icons
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens
983c02b6db Switch to for range loop
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens
14ecf535f9 Let Theme tell us if we're branded or not
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Camila
e89177b25b Add OpacityMask to fix mouse hover on round corner.
- Fix for #2173.
- Removed the workaround for the left round corner which was also
fixed with the OpacityMask.

Signed-off-by: Camila <hello@camila.codes>
2020-07-28 11:19:22 +02:00
Nextcloud bot
e5572faeba [tx-robot] updated from transifex 2020-07-28 03:30:52 +00:00
Nextcloud bot
d2ea938ac0 [tx-robot] updated from transifex 2020-07-26 03:28:55 +00:00
Nextcloud bot
0c533ca387 [tx-robot] updated from transifex 2020-07-25 03:29:52 +00:00
Nextcloud bot
f3b22b33e3 [tx-robot] updated from transifex 2020-07-24 03:31:38 +00:00
Stephan Beyer
cd008ffe59 Let context menu open wizard if there are no accounts
The context menu offers to open the main dialog and the settings
even if no accounts are configured.  In this case, the main dialog
is useless and the settings are probably confusing.  Hence, this
commit replaces these actions in the context menu by an action
to open the wizard (which also opens on left click, so this is
the most natural thing to do).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-23 21:08:53 +02:00
Nextcloud bot
3fd32e55f9 [tx-robot] updated from transifex 2020-07-23 03:32:46 +00:00
Michael Schuster
fba50c7c42 Merge pull request #2224 from nextcloud/qt-5.12.9-update
Update CI for Qt 5.12.9
2020-07-22 15:21:48 +02:00
Michael Schuster
6cc1aa723e Update CI for Qt 5.12.9
Also remove the jq package installation from the AppImage build script because
the package is included in the new Docker image (see nextcloud/docker-ci#231).

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-22 14:19:57 +02:00
Nextcloud bot
ccff6e00dc [tx-robot] updated from transifex 2020-07-22 03:31:25 +00:00
Kevin Ottens
f8fb26424d Merge pull request #2209 from nextcloud/fix-pause-sync-states
Fix pause sync states
2020-07-21 13:12:39 +02:00
Dominique Fuchs
a07db657d5 sigh, too
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 12:44:45 +02:00
Dominique Fuchs
cd3a72822e Get a const auto for the FolderMap to iterate over
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs
dbdf40ea45 Replaced Qt foreach by C++11 ranged for loop
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs
82c70f0c95 Properly set syncPause state on Systray creation when account init is done
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs
5ac3099b37 Fixed copy/paste bug, resulting in a wrong signal ::pauseSync used instead of ::resumeSync
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Michael Schuster
815cd7f3fc Fix Windows installer graphics files for 2.7
For some reason the exported bitmaps in #2211 were not properly saved in the right
format for display by the NSIS installer system.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-21 10:54:02 +02:00
Nextcloud bot
30f7ef319c [tx-robot] updated from transifex 2020-07-21 03:31:14 +00:00
Michael Schuster
b801a74281 Drone Upload: Fix if condition for master, in addition to #2213
Don't try to comment on master (old condition was from a previous version of the script).

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-21 01:20:19 +02:00
Michael Schuster
8fb272a95f Merge pull request #2213 from nextcloud/enh/ci-upload
Drone: Upload AppImage to GitHub using nextcloud-desktop-bot
2020-07-20 18:28:44 +02:00
Michael Schuster
c3f5a9b9cc Drone: Upload AppImage to GitHub using nextcloud-desktop-bot
Uploading AppImage's to transfer.sh often fail and cause the CI to wait for
the 15 minutes timeout.

This new approach uses a bot user to create releases in a dedicated ci-builds
repository. Each PR (or master) will get a dedicated release with the AppImage
supplied as a release asset. Older assets will be deleted prior uploading the
recent build.

The bot will then (in case of a PR) create a comment in the PR, containing the
download link.

Home of the CI releases: https://github.com/nextcloud-desktop-bot/ci-builds/releases

Inspired by: https://github.com/nextcloud/android/blob/master/scripts/uploadArtifact.sh

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-20 17:11:33 +02:00
Dominique Fuchs
6ab55eddae Add -no-strip cmd line arg to macdeployqt if when building with Debug profile
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-20 15:04:33 +02:00
Nextcloud bot
f285a29463 [tx-robot] updated from transifex 2020-07-20 03:30:19 +00:00
Michael Schuster
51ce085ab5 Merge pull request #2215 from jneplokh/pr/ownCloud-reference-fix
Change ownCloud reference to Nextcloud
2020-07-20 02:12:57 +02:00
Jacob Neplokh
c4e8211687 Change ownCloud reference to Nextcloud
Signed-off-by: Jacob Neplokh <me@jacobneplokh.com>
2020-07-19 11:36:34 -07:00
Nextcloud bot
274e3491f3 [tx-robot] updated from transifex 2020-07-19 03:31:58 +00:00
Michael Schuster
d55fd09b27 Merge pull request #2211 from nextcloud/logo-2.7
Logo update for 2.7
2020-07-18 14:41:40 +02:00
Michael Schuster
b997f3e10a Update Windows installer graphics with 2.7 logo
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-18 12:29:47 +00:00
Michael Schuster
4cd77d96ae Update logo for 2.7
Based on: c876a02584/nextcloud-icon.svg

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-18 12:29:47 +00:00
Nextcloud bot
15b0da8904 [tx-robot] updated from transifex 2020-07-18 03:30:12 +00:00
Nextcloud bot
cd91309fd8 [tx-robot] updated from transifex 2020-07-17 03:31:27 +00:00
Nextcloud bot
27d08f02f4 [tx-robot] updated from transifex 2020-07-16 03:41:39 +00:00
Kevin Ottens
f46276d70d Update our E2E API requirement
Now that we adjusted our protocol to follow the slightly updated server
API, let's make sure we don't try to talk to a server with an older API.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 18:39:29 +02:00
Kevin Ottens
15f9eeeb08 Merge pull request #2201 from nextcloud/disable_parallelism_for_e2e_remote_mkdir_jobs
Disable parallelism for e2e remote mkdir jobs
2020-07-15 17:24:11 +02:00
Kevin Ottens
c369d33015 Disable parallelism if we think the parent is e2e
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:54 +02:00
Kevin Ottens
cfd3771818 Allow to override the parallelism
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:11 +02:00
Kevin Ottens
5cfbf34501 Move PropagateRemoteMkdir ctor to the cpp file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:03:55 +02:00
Kevin Ottens
6b8d2270c6 Make sure the tray icon point is in screen coordinates
Previously we were using QCursor::pos() in the Linux case, which is a
fair heuristic except it will always be relative to the primary screen
and not the current screen. This explains why we had to adjust with the
virtual geometry.

In the Windows and Mac case we got the position out of QSystemTrayIcon
and that one was already relative to the current screen.

So now we use QCursor::pos(currentScreen()) which ensures we give the
coordinates relatively to the current screen also in the Linux case.

Since all platforms are now having that point in the same coordinate
system we don't need to mess around with the virtual geometry to
compensate.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 12:22:54 +02:00
Nextcloud bot
2c50ecd4d3 [tx-robot] updated from transifex 2020-07-15 03:57:54 +00:00
Nextcloud bot
5c442af1ca [tx-robot] updated from transifex 2020-07-14 03:29:35 +00:00
Kevin Ottens
62e2f64165 Merge pull request #2188 from nextcloud/upgrade-syncjournaldb-to27
Move existing syncjournal db files from client ver <2.7
2020-07-13 18:04:28 +02:00
Dominique Fuchs
6bc70ddd5b Fix typo, use compound assignment op
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:19 +02:00
Dominique Fuchs
bc20edc582 Only attempt to move if file exist
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:18 +02:00
Dominique Fuchs
4656748130 Move existing syncjournal db files from client ver <2.7
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:11 +02:00
Nextcloud bot
ac837d19ee [tx-robot] updated from transifex 2020-07-12 03:29:20 +00:00
István Váradi
69a37e10ce Fetch tags for Debian build
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-07-11 17:39:17 +02:00
Nextcloud bot
fe7d22e4ce [tx-robot] updated from transifex 2020-07-11 03:29:57 +00:00
Nextcloud bot
6c79231d1a [tx-robot] updated from transifex 2020-07-10 03:33:30 +00:00
Nextcloud bot
2b97549266 [tx-robot] updated from transifex 2020-07-09 23:51:47 +00:00
Michael Schuster
a0284d07f6 Merge pull request #2183 from nextcloud/fix-delete-base-folders-instr
Prevent empty FileMap in local csync to be processed if folder not empty
2020-07-09 23:36:13 +02:00
Dominique Fuchs
19d46f0541 Merge branch 'fix-delete-base-folders-instr' of https://github.com/Nextcloud/desktop into fix-delete-base-folders-instr 2020-07-09 21:47:34 +02:00
Dominique Fuchs
f8920f969f Remove debug variable
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:47:19 +02:00
Dominique Fuchs
8deb38ac24 Merge branch 'master' into fix-delete-base-folders-instr 2020-07-09 21:38:11 +02:00
Dominique Fuchs
d47e570ff3 Prevent empty FileMap in local csync to be processed if folder not empty
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:23:24 +02:00
Kevin Ottens
3ccac1b1be Properly register folder as encrypted during sync
Turns out that when we added a new e2e folder during sync, we were
passing the wrong path to the e2e object. We have several path
convention in the sync code, just happened to be the wrong one.

I still long for the day when we'll use the type system to deal with
paths. All those strings are error-prone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 17:16:21 +02:00
Kevin Ottens
26686ecd45 Recover from missing metadata on uploads
Other clients seem to allow creating empty encrypted folders with no
metadata associated to them, so let's get ready to handle it. In case of
a 404 to get the metadata, we create an empty metadata payload and pass
it further down.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
4ef42e53d3 Change the separator in the private key
It used to be a base64 encoded '|', now it is still a '|' but not
encoded, let's adjust accordingly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
3c20b2414e Prevent parallelism when deleting encrypted files
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
1be869fdc7 Unlock the folder only after we actually deleted the file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
8e0ab5ce47 Allow to specify the e2e-token on DeleteJob
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
0575d0e793 Stop unlocking from within PropagateRemoteDeleteEncrypted
We need to finish deleting the file before we can actually unlock. Also
the token will be necessary for the delete to succeed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
7e251edd6e Compare the unencrypted filename with the originalName
Otherwise obviously we'd never find the files in the metadata.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
2831b22be4 Use the encrypted path for collection listing
If we use the local path we'll get a 404.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
511a6e66dc Pass e2e-token to PropagateUpload subjobs
The headers() method is used to pass extra headers to the PUT jobs for
instance, definitely needed for uploads now.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
9a4c63404d Pass the e2e-token for encrypted MKCOL
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
01f5501ad8 Allow to pass extraHeaders to a path based MkColJob
We could specify the extra headers with a URL but not a simple path.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens
e14ae806b6 E2EE RFC has been updated to use e2e-token instead of token
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Michael Schuster
a94def0e54 Merge pull request #2177 from nextcloud/fix-issue-2175
Share link display the correct permissions for files and folders.
2020-07-09 06:16:18 +02:00
Camila
f018f7df3b Fix text in the permissions menu for share link.
Changed word capitalization and replace && for andi to match the server.

Signed-off-by: Camila <hello@camila.codes>
2020-07-09 03:21:04 +00:00
Camila
30a533d49c Share link display the correct permissions for files and folders.
- Fix #2175:
	- Shows the correct default permissions
	- Shows the permissions the user set

Signed-off-by: Camila <hello@camila.codes>
2020-07-09 03:21:04 +00:00
Michael Schuster
4fec77e9c0 Merge pull request #2168 from nextcloud/display-default-permissions-share
Display the correct default permissions when creating a share.
2020-07-09 05:19:56 +02:00
Camila
d7a1367292 Display the correct default permissions when creating a share.
- The default displayed was not in sync with the server because
the client was setting permissions when creating a share while it
should get the default permissions from the server to display it to the
user first.

Signed-off-by: Camila <hello@camila.codes>
2020-07-08 18:15:36 +02:00
Stephan Beyer
308bed0da7 Use braced initializer list for returns in Systray::taskbarGeometry()
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
a87b6157ee Make csync_file_stat_s::isE2eEncrypted a bitfield
This is in line with other bools of that struct and gets rid
of clang-tidy's modernize-use-default-member-init warning.
(The trivial alternative to get rid of that warning would be
to use default member init for that bool variable, but I think
it is better to have it as a bitfield.)

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
1e6747cd1d Remove redundant initialization of ElidedLabel::_elideMode
The value gets already initialized by default member initialization,
so there is no need to set it again in the constructor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
293be2c2e6 Remove redundant initialization of HttpCredentials::_keychainMigration
The value gets already initialized by default member initialization,
so there is no need to set it again.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
a9de465927 Remove redundant initialization of SyncFileStatus::_shared attribute
The value gets already initialized by default member initialization,
so there is no need to set it again in the copy constructor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
ed570d6274 Use default member init for PKeyCtx::_ctx and PKey::_pkey
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
00f93fdb77 Use more auto in folderstatusdelegate.cpp
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
82f38aa37d Filter clang-tidy output on Drone for errors
The run-clang-tidy is very verbose and prints a lot of unneccessary
information.  This commit greps for errors in the output.
Moreover, we add the -quiet switch.

As a desired "side" effect, this commit repairs the issue of
run-clang-tidy-6.0 that it does not return a usable exit code.
Hence clang-tidy errors will lead to CI failures now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer
8e6d9401c7 Simplify clang-tidy invocation for Drone
Symlinking and running bash is not necessary.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Kevin Ottens
2492e241ac Adjust to makeDbName returning an absolute path
PR #1451 changed the behavior of makeDbName which now returns an
absolute path. This obviously then failed in nextcloudcmd which
prepended to it the path to the local folder to sync. We just stop doing
this to have the journal db end up at the right place in that case as
well.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-08 13:09:13 +02:00
Nextcloud bot
31bc07417b [tx-robot] updated from transifex 2020-07-08 03:40:45 +00:00
Kevin Ottens
c2632eb604 Handle properly null avatar
If we try to produce the avatar before we managed to connect we'd end up
trying to paint in a null image. Just return early, which will allow the
caller to do something else instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 18:07:33 +02:00
Kevin Ottens
32b51a52ef Merge pull request #2167 from nextcloud/fix_url_decoding_for_folder_encryption_status
Fix url decoding for folder encryption status
2020-07-07 18:06:19 +02:00
Kevin Ottens
217869e95c Decode the href from the XML payload
The XML we get as reply has href entities properly percent encoded.
Since we didn't go through QUrl next we didn't get a properly decoded
version. Make sure we decode it before storage.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Kevin Ottens
f90d6951c2 No need to compute base at each loop run
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Stephan Beyer
e32bd75519 Set maximum height of account and app menu
The menus may become too large if they have too many items
(the account menu has this in case of many accounts, the apps
menu in case of many apps).  This commit limits the maximum
height such that the menus do not hide the header.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-07 17:35:09 +02:00
194 changed files with 35381 additions and 21526 deletions

View File

@@ -3,13 +3,13 @@ name: qt-5.12
steps:
- name: build and test
image: nextcloudci/client-5.12:client-5.12-7
image: nextcloudci/client-5.12:client-5.12-9
commands:
# Install QtKeyChain
- /bin/bash -c "
export CC=gcc-7 &&
export CXX=g++-7 &&
export QT_BASE_DIR=/opt/qt5.12.8 &&
export QT_BASE_DIR=/opt/qt5.12.9 &&
export QTDIR=\$QT_BASE_DIR &&
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
@@ -27,7 +27,7 @@ steps:
- /bin/bash -c "
export CC=gcc-7 &&
export CXX=g++-7 &&
export QT_BASE_DIR=/opt/qt5.12.8 &&
export QT_BASE_DIR=/opt/qt5.12.9 &&
export QTDIR=\$QT_BASE_DIR &&
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
@@ -52,13 +52,13 @@ name: qt-5.12-clang
steps:
- name: build and test
image: nextcloudci/client-5.12:client-5.12-7
image: nextcloudci/client-5.12:client-5.12-9
commands:
# Install QtKeyChain
- /bin/bash -c "
export CC=clang-6.0 &&
export CXX=clang++-6.0 &&
export QT_BASE_DIR=/opt/qt5.12.8 &&
export QT_BASE_DIR=/opt/qt5.12.9 &&
export QTDIR=\$QT_BASE_DIR &&
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
@@ -76,7 +76,7 @@ steps:
- /bin/bash -c "
export CC=clang-6.0 &&
export CXX=clang++-6.0 &&
export QT_BASE_DIR=/opt/qt5.12.8 &&
export QT_BASE_DIR=/opt/qt5.12.9 &&
export QTDIR=\$QT_BASE_DIR &&
export PATH=\$QT_BASE_DIR/bin:\$PATH &&
export LD_LIBRARY_PATH=\$QT_BASE_DIR/lib/x86_64-linux-gnu:\$QT_BASE_DIR/lib:/usr/local/lib:\$LD_LIBRARY_PATH &&
@@ -89,9 +89,7 @@ steps:
chown -R test:test . &&
su -c 'ASAN_OPTIONS=detect_leaks=0 ctest --output-on-failure' test"
# Static analysis with clang-tidy
- /bin/bash -c "
ln -s build/compile_commands.json . &&
run-clang-tidy-6.0"
- "! run-clang-tidy-6.0 -p build -quiet | grep -A 5 ': error:'"
trigger:
branch:
- master
@@ -105,10 +103,15 @@ name: AppImage
steps:
- name: build
image: nextcloudci/client-5.12:client-5.12-7
image: nextcloudci/client-5.12:client-5.12-9
environment:
CI_UPLOAD_GIT_TOKEN:
from_secret: CI_UPLOAD_GIT_TOKEN
CI_UPLOAD_GIT_USERNAME:
from_secret: CI_UPLOAD_GIT_USERNAME
commands:
- /bin/bash -c "./admin/linux/build-appimage.sh"
- /bin/bash -c "./admin/linux/upload-appimage.sh"
- /bin/bash -c "./admin/linux/upload-appimage.sh" || echo "Upload failed, however this is an optional step."
trigger:
branch:
- master

View File

@@ -199,6 +199,6 @@ X-GNOME-Autostart-Delay=3
# Translations
Icon[ca]=@APPLICATION_ICON_NAME@
Name[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
Name[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
Comment[ca]=Client de sincronització d'escriptori del @APPLICATION_NAME@
GenericName[ca]=Directori de sincronització
GenericName[ca]=Sincronització de carpetes

View File

@@ -198,7 +198,7 @@ X-GNOME-Autostart-Delay=3
# Translations
Icon[de_DE]=@APPLICATION_ICON_NAME@
Name[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
Comment[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
GenericName[de_DE]=Synchronisierungsordner
Icon[de]=@APPLICATION_ICON_NAME@
Name[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
Comment[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
GenericName[de]=Synchronisierungsordner

View File

@@ -35,3 +35,17 @@ set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR "#0082c9" CACHE STRING "Hex colo
set( APPLICATION_WIZARD_HEADER_TITLE_COLOR "#ffffff" CACHE STRING "Hex color of the text in the wizard header")
option( APPLICATION_WIZARD_USE_CUSTOM_LOGO "Use the logo from ':/client/theme/colored/wizard_logo.png' else the default application icon is used" ON )
#
## Windows Shell Extensions - IMPORTANT: Generate new GUIDs for custom builds with "guidgen" or "uuidgen"
#
# Context Menu
set( WIN_SHELLEXT_CONTEXT_MENU_GUID "{BC6988AB-ACE2-4B81-84DC-DC34F9B24401}" )
# Overlays
set( WIN_SHELLEXT_OVERLAY_GUID_ERROR "{E0342B74-7593-4C70-9D61-22F294AAFE05}" )
set( WIN_SHELLEXT_OVERLAY_GUID_OK "{E1094E94-BE93-4EA2-9639-8475C68F3886}" )
set( WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED "{E243AD85-F71B-496B-B17E-B8091CBE93D2}" )
set( WIN_SHELLEXT_OVERLAY_GUID_SYNC "{E3D6DB20-1D83-4829-B5C9-941B31C0C35A}" )
set( WIN_SHELLEXT_OVERLAY_GUID_WARNING "{E4977F33-F93A-4A0A-9D3C-83DEA0EE8483}" )

View File

@@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 2 )
set( MIRALL_VERSION_MINOR 7 )
set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_VERSION_MAJOR 3 )
set( MIRALL_VERSION_MINOR 0 )
set( MIRALL_VERSION_PATCH 1 )
set( MIRALL_VERSION_YEAR 2020 )
set( MIRALL_SOVERSION 0 )

View File

@@ -6,7 +6,7 @@ mkdir /app
mkdir /build
#Set Qt-5.12
export QT_BASE_DIR=/opt/qt5.12.8
export QT_BASE_DIR=/opt/qt5.12.9
export QTDIR=$QT_BASE_DIR
export PATH=$QT_BASE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib:$LD_LIBRARY_PATH

View File

@@ -15,10 +15,10 @@ OBS_PROJECT_BETA=home:ivaradi:beta
OBS_PACKAGE=nextcloud-desktop
if test "${DRONE_TARGET_BRANCH}" = "stable-2.6"; then
UBUNTU_DISTRIBUTIONS="bionic eoan focal groovy"
UBUNTU_DISTRIBUTIONS="bionic focal groovy"
DEBIAN_DISTRIBUTIONS="buster stretch testing"
else
UBUNTU_DISTRIBUTIONS="eoan focal groovy"
UBUNTU_DISTRIBUTIONS="focal groovy"
DEBIAN_DISTRIBUTIONS="testing"
fi
@@ -43,6 +43,7 @@ fi
set -x
cd "${DRONE_WORKSPACE}"
git fetch --tags
read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable)
cd "${DRONE_DIR}"

View File

@@ -1,21 +1,135 @@
#! /bin/bash
set -xe
# Env
export BUILD=${DRONE_BUILD_NUMBER}
export PR=${DRONE_PULL_REQUEST}
export GIT_USERNAME=${CI_UPLOAD_GIT_USERNAME}
export GIT_TOKEN=${CI_UPLOAD_GIT_TOKEN}
# Defaults
export GIT_REPO=ci-builds
export API_BASE_URL=https://api.github.com/repos/$GIT_USERNAME/$GIT_REPO
export DESKTOP_API_BASE_URL=https://api.github.com/repos/nextcloud/desktop
# PR / master
export TAG_NAME=${PR:=master}
export RELEASE_BODY=https://github.com/nextcloud/desktop
if [ $TAG_NAME != "master" ]; then
TAG_NAME="PR-$TAG_NAME"
RELEASE_BODY="nextcloud/desktop#$PR"
fi
cd /build
# Upload AppImage
APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
BASENAME=$(basename ${APPIMAGE})
# AppImage
export APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
export BASENAME=$(basename ${APPIMAGE})
if curl --max-time 900 --upload-file ${APPIMAGE} https://transfer.sh/${BASENAME}
then
echo
echo "Get the AppImage at the link above!"
else
echo
echo "Upload failed, however this is an optional step."
if ! test -e $APPIMAGE ; then
exit 1
fi
# Don't let the Drone build fail
exit 0
echo "Found AppImage: $BASENAME"
if [ $TAG_NAME != "master" ]; then
# Delete all old comments in desktop PR, starting with "AppImage file:"
oldComments=$(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $DESKTOP_API_BASE_URL/issues/$PR/comments | jq '.[] | (.id |tostring) + "|" + (.user.login | test("'${GIT_USERNAME}'") | tostring) + "|" + (.body | test("AppImage file:.*") | tostring)' | grep "true|true" | tr -d "\"" | cut -f1 -d"|")
if [[ "$oldComments" != "" ]]; then
echo $oldComments | while read comment ; do
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X DELETE $DESKTOP_API_BASE_URL/issues/comments/$comment
done
fi
fi
# Helper functions
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
create_release()
{
name=$TAG_NAME
body=$RELEASE_BODY
tagName=$TAG_NAME
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X POST $API_BASE_URL/releases -d "{ \"tag_name\": \"$tagName\", \"target_commitish\": \"master\", \"name\": \"$name\", \"body\": \"$body\", \"draft\": false, \"prerelease\": true }")
}
get_release()
{
tagName=$TAG_NAME
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $API_BASE_URL/releases/tags/$tagName)
}
get_release_assets()
{
releaseId=$1
echo $(curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X GET $API_BASE_URL/releases/$releaseId/assets)
}
upload_release_asset()
{
uploadUrl=$1
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrl --header "Content-Type: application/octet-stream" --upload-file $APPIMAGE)
}
delete_release_asset()
{
assetId=$1
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X DELETE $API_BASE_URL/releases/assets/$assetId
}
# Try to get an already existing release
json=$(get_release)
releaseId=$(echo $json | jq -r '.id')
uploadUrl=$(echo $json | jq -r '.upload_url')
if [[ "$uploadUrl" == "null" ]]; then
# Try to create a release
json=$(create_release)
releaseId=$(echo $json | jq -r '.id')
uploadUrl=$(echo $json | jq -r '.upload_url')
if [[ "$uploadUrl" == "null" ]]; then
echo "create_release failed: $json"
exit 2
fi
fi
# Prepare upload url
uploadUrl=$(echo "${uploadUrl/'{?name,label}'/?name=$BASENAME}")
# Try to delete existing AppImage assets for this PR
assets=$(get_release_assets $releaseId)
for data in $(echo $assets | jq -r '.[] | @uri'); do
json=$(urldecode "$data")
assetId=$(echo $json | jq -r '.id')
name=$(echo $json | jq -r '.name')
if [[ "$name" == *.AppImage ]]; then
echo "Deleting old asset: $name"
$(delete_release_asset $assetId)
fi
done
# Upload release asset
echo "Uploading new asset: $BASENAME"
json=$(upload_release_asset "$uploadUrl")
browserDownloadUrl=$(echo $json | jq -r '.browser_download_url')
if [[ "$browserDownloadUrl" == "null" ]]; then
echo "upload_release_asset failed: $json"
exit 3
fi
if [ $TAG_NAME != "master" ]; then
# Create comment in desktop PR
curl 2>/dev/null -u $GIT_USERNAME:$GIT_TOKEN -X POST $DESKTOP_API_BASE_URL/issues/$PR/comments -d "{ \"body\" : \"AppImage file: [$BASENAME]($browserDownloadUrl) <br/><br/>To test this change/fix you can simply download above AppImage file and test it. <br/><br/>Please make sure to quit your existing Nextcloud app and backup your data. \" }"
fi
echo
echo "AppImage link: $browserDownloadUrl"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@@ -7,7 +7,7 @@ Conflicts
Overview
--------
The ownCloud desktop client uploads local changes and downloads remote changes.
The Nextcloud desktop client uploads local changes and downloads remote changes.
When a file has changed on the local side and on the remote between synchronization
runs the client will be unable to resolve the situation on its own. It will
create a conflict file with the local version, download the remote version and

View File

@@ -1,4 +1,15 @@
add_subdirectory(OCContextMenu)
add_subdirectory(OCOverlays)
add_subdirectory(OCUtil)
# Use static runtime for all subdirectories
foreach(buildType "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
string(REPLACE "/MD" "/MT" "CMAKE_CXX_FLAGS${buildType}" "${CMAKE_CXX_FLAGS${buildType}}")
endforeach()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
configure_file(WinShellExtConstants.h.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExtConstants.h)
configure_file(WinShellExt.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExt.wxs)
add_subdirectory(NCContextMenu)
add_subdirectory(NCOverlays)
add_subdirectory(NCUtil)

View 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}
)

View File

@@ -12,9 +12,7 @@
* details.
*/
#include "stdafx.h"
#include "OCClientInterface.h"
#include "NCClientInterface.h"
#include "CommunicationSocket.h"
#include "StringUtil.h"
@@ -32,9 +30,8 @@
using namespace std;
#define PIPE_TIMEOUT 5*1000 //ms
#define SOCK_BUFFER 4096
OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo(const std::wstring &files)
NCClientInterface::ContextMenuInfo NCClientInterface::FetchInfo(const std::wstring &files)
{
auto pipename = CommunicationSocket::DefaultPipePath();
@@ -80,7 +77,7 @@ OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo(const std::wstri
return info;
}
void OCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &path)
void NCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &path)
{
auto pipename = CommunicationSocket::DefaultPipePath();
@@ -92,9 +89,5 @@ void OCClientInterface::SendRequest(const wchar_t *verb, const std::wstring &pat
return;
}
wchar_t msg[SOCK_BUFFER] = { 0 };
if (SUCCEEDED(StringCchPrintf(msg, SOCK_BUFFER, L"%s:%s\n", verb, path.c_str())))
{
socket.SendMsg(msg);
}
socket.SendMsg((verb + (L":" + path + L"\n")).data());
}

View File

@@ -40,7 +40,7 @@
class CommunicationSocket;
class OCClientInterface
class NCClientInterface
{
public:
struct ContextMenuInfo {

View File

@@ -12,25 +12,24 @@
* details.
*/
#include "stdafx.h"
#include "OCContextMenu.h"
#include "OCClientInterface.h"
#include "NCContextMenu.h"
#include "NCClientInterface.h"
#include <shobjidl.h>
#include <shlwapi.h>
#include <shellapi.h>
#include <StringUtil.h>
#include <strsafe.h>
extern long g_cDllRef;
OCContextMenu::OCContextMenu(void)
NCContextMenu::NCContextMenu(void)
: m_cRef(1)
{
InterlockedIncrement(&g_cDllRef);
}
OCContextMenu::~OCContextMenu(void)
NCContextMenu::~NCContextMenu(void)
{
InterlockedDecrement(&g_cDllRef);
}
@@ -38,25 +37,25 @@ OCContextMenu::~OCContextMenu(void)
#pragma region IUnknown
// Query to the interface the component supported.
IFACEMETHODIMP OCContextMenu::QueryInterface(REFIID riid, void **ppv)
IFACEMETHODIMP NCContextMenu::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(OCContextMenu, IContextMenu),
QITABENT(OCContextMenu, IShellExtInit),
QITABENT(NCContextMenu, IContextMenu),
QITABENT(NCContextMenu, IShellExtInit),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}
// Increase the reference count for an interface on an object.
IFACEMETHODIMP_(ULONG) OCContextMenu::AddRef()
IFACEMETHODIMP_(ULONG) NCContextMenu::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
// Decrease the reference count for an interface on an object.
IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
IFACEMETHODIMP_(ULONG) NCContextMenu::Release()
{
ULONG cRef = InterlockedDecrement(&m_cRef);
if (0 == cRef) {
@@ -72,7 +71,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenu::Release()
#pragma region IShellExtInit
// Initialize the context menu handler.
IFACEMETHODIMP OCContextMenu::Initialize(
IFACEMETHODIMP NCContextMenu::Initialize(
LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID)
{
m_selectedFiles.clear();
@@ -128,7 +127,7 @@ void InsertSeperator(HMENU hMenu, UINT indexMenu)
InsertMenuItem(hMenu, indexMenu, TRUE, &sep);
}
IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
IFACEMETHODIMP NCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
// If uFlags include CMF_DEFAULTONLY then we should not do anything.
if (CMF_DEFAULTONLY & uFlags)
@@ -136,7 +135,7 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
}
m_info = OCClientInterface::FetchInfo(m_selectedFiles);
m_info = NCClientInterface::FetchInfo(m_selectedFiles);
if (m_info.menuItems.empty()) {
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
}
@@ -178,7 +177,7 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(indexSubMenu));
}
IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
IFACEMETHODIMP NCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
{
std::wstring command;
@@ -216,11 +215,11 @@ IFACEMETHODIMP OCContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
return E_FAIL;
}
OCClientInterface::SendRequest(command.data(), m_selectedFiles);
NCClientInterface::SendRequest(command.data(), m_selectedFiles);
return S_OK;
}
IFACEMETHODIMP OCContextMenu::GetCommandString(UINT_PTR idCommand,
IFACEMETHODIMP NCContextMenu::GetCommandString(UINT_PTR idCommand,
UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
{
if (idCommand < m_info.menuItems.size() && uFlags == GCS_VERBW) {

View File

@@ -12,15 +12,15 @@
* details.
*/
#ifndef OCCONTEXTMENU_H
#define OCCONTEXTMENU_H
#ifndef NCCONTEXTMENU_H
#define NCCONTEXTMENU_H
#pragma once
#include <shlobj.h> // For IShellExtInit and IContextMenu
#include <string>
#include "OCClientInterface.h"
#include "NCClientInterface.h"
class OCContextMenu : public IShellExtInit, public IContextMenu
class NCContextMenu : public IShellExtInit, public IContextMenu
{
public:
// IUnknown
@@ -36,10 +36,10 @@ public:
IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
OCContextMenu();
NCContextMenu();
protected:
~OCContextMenu();
~NCContextMenu();
private:
// Reference count of component.
@@ -47,7 +47,7 @@ private:
// The name of the selected files (separated by '\x1e')
std::wstring m_selectedFiles;
OCClientInterface::ContextMenuInfo m_info;
NCClientInterface::ContextMenuInfo m_info;
};
#endif //OCCONTEXTMENU_H
#endif //NCCONTEXTMENU_H

View File

@@ -12,10 +12,8 @@
* details.
*/
#include "stdafx.h"
#include "OCContextMenuFactory.h"
#include "OCContextMenu.h"
#include "NCContextMenuFactory.h"
#include "NCContextMenu.h"
#include <new>
#include <Shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
@@ -24,12 +22,12 @@
extern long g_cDllRef;
OCContextMenuFactory::OCContextMenuFactory() : m_cRef(1)
NCContextMenuFactory::NCContextMenuFactory() : m_cRef(1)
{
InterlockedIncrement(&g_cDllRef);
}
OCContextMenuFactory::~OCContextMenuFactory()
NCContextMenuFactory::~NCContextMenuFactory()
{
InterlockedDecrement(&g_cDllRef);
}
@@ -37,18 +35,18 @@ OCContextMenuFactory::~OCContextMenuFactory()
// IUnknown methods
IFACEMETHODIMP OCContextMenuFactory::QueryInterface(REFIID riid, void **ppv)
IFACEMETHODIMP NCContextMenuFactory::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] = { QITABENT(OCContextMenuFactory, IClassFactory), { 0 }, };
static const QITAB qit[] = { QITABENT(NCContextMenuFactory, IClassFactory), { 0 }, };
return QISearch(this, qit, riid, ppv);
}
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::AddRef()
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
IFACEMETHODIMP_(ULONG) NCContextMenuFactory::Release()
{
ULONG cRef = InterlockedDecrement(&m_cRef);
if (0 == cRef) {
@@ -60,7 +58,7 @@ IFACEMETHODIMP_(ULONG) OCContextMenuFactory::Release()
// IClassFactory methods
IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
IFACEMETHODIMP NCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HRESULT hr = CLASS_E_NOAGGREGATION;
@@ -69,7 +67,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
hr = E_OUTOFMEMORY;
// Create the COM component.
OCContextMenu *pExt = new (std::nothrow) OCContextMenu();
NCContextMenu *pExt = new (std::nothrow) NCContextMenu();
if (pExt) {
// Query the specified interface.
hr = pExt->QueryInterface(riid, ppv);
@@ -80,7 +78,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
return hr;
}
IFACEMETHODIMP OCContextMenuFactory::LockServer(BOOL fLock)
IFACEMETHODIMP NCContextMenuFactory::LockServer(BOOL fLock)
{
if (fLock) {
InterlockedIncrement(&g_cDllRef);

View File

@@ -13,14 +13,14 @@
*/
#ifndef OCCONTEXTMENUFACTORY_H
#define OCCONTEXTMENUFACTORY_H
#ifndef NCCONTEXTMENUFACTORY_H
#define NCCONTEXTMENUFACTORY_H
#pragma once
#include <unknwn.h> // For IClassFactory
class OCContextMenuFactory : public IClassFactory
class NCContextMenuFactory : public IClassFactory
{
public:
// IUnknown
@@ -32,11 +32,11 @@ public:
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
IFACEMETHODIMP LockServer(BOOL fLock);
OCContextMenuFactory();
NCContextMenuFactory();
private:
~OCContextMenuFactory();
~NCContextMenuFactory();
long m_cRef;
};
#endif //OCCONTEXTMENUFACTORY_H
#endif //NCCONTEXTMENUFACTORY_H

View File

@@ -12,9 +12,7 @@
* details.
*/
#include "stdafx.h"
#include "OCContextMenuRegHandler.h"
#include "NCContextMenuRegHandler.h"
#include "RegDelnode.h"
#include <strsafe.h>
#include <objbase.h>
@@ -70,7 +68,7 @@ HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR
}
HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
{
if (!pszModule || !pszThreadModel)
{
@@ -113,7 +111,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
return hr;
}
HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
HRESULT NCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
{
HRESULT hr = S_OK;
@@ -133,7 +131,7 @@ HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
}
HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
HRESULT NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName)
{
if (!pszFileType)
@@ -177,7 +175,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
return hr;
}
HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
HRESULT NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
PCWSTR pszFileType, PCWSTR pszFriendlyName)
{
if (!pszFileType)

View File

@@ -13,14 +13,14 @@
*/
#ifndef OCCONTEXTMENUREGHANDLER_H
#define OCCONTEXTMENUREGHANDLER_H
#ifndef NCCONTEXTMENUREGHANDLER_H
#define NCCONTEXTMENUREGHANDLER_H
#pragma once
#include "stdafx.h"
#include <windows.h>
class __declspec(dllexport) OCContextMenuRegHandler
class __declspec(dllexport) NCContextMenuRegHandler
{
public:
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);
@@ -35,4 +35,4 @@ public:
static HRESULT UnregisterShellExtContextMenuHandler(PCWSTR pszFileType, PCWSTR pszFriendlyName);
};
#endif //OCCONTEXTMENUREGHANDLER_H
#endif //NCCONTEXTMENUREGHANDLER_H

View 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;
}

View File

@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by OCContextMenu.rc
// Used by NCContextMenu.rc
// Next default values for new objects
//

View 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}
)

View File

@@ -12,10 +12,9 @@
* details.
*/
#include "stdafx.h"
#include "OCOverlayRegistrationHandler.h"
#include "OCOverlayFactory.h"
#include "NCOverlayRegistrationHandler.h"
#include "NCOverlayFactory.h"
#include "WinShellExtConstants.h"
HINSTANCE instanceHandle = nullptr;
@@ -42,11 +41,11 @@ HRESULT CreateFactory(REFIID riid, void **ppv, int state)
{
HRESULT hResult = E_OUTOFMEMORY;
OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(state);
NCOverlayFactory* ncOverlayFactory = new NCOverlayFactory(state);
if (ocOverlayFactory) {
hResult = ocOverlayFactory->QueryInterface(riid, ppv);
ocOverlayFactory->Release();
if (ncOverlayFactory) {
hResult = ncOverlayFactory->QueryInterface(riid, ppv);
ncOverlayFactory->Release();
}
return hResult;
}
@@ -95,13 +94,13 @@ HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule)
return hResult;
}
hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_GENERIC_NAME, guid);
hResult = NCOverlayRegistrationHandler::RegisterCOMObject(szModule, OVERLAY_DESCRIPTION, guid);
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
hResult = NCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr);
return hResult;
}
@@ -117,13 +116,13 @@ HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
return hResult;
}
hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid);
hResult = NCOverlayRegistrationHandler::UnregisterCOMObject(guid);
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
hResult = NCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr);
return hResult;
}
@@ -139,13 +138,6 @@ HRESULT _stdcall DllRegisterServer(void)
return hResult;
}
// Unregister any obsolete CLSID when we register here
// Those CLSID were removed in 2.1, but we need to make sure to prevent any previous version
// of the extension on the system from loading at the same time as a new version to avoid crashing explorer.
UnregisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED);
UnregisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED);
UnregisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED);
hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);

View File

@@ -12,19 +12,11 @@
* details.
*/
#include "stdafx.h"
#include "OCOverlay.h"
#include "OCOverlayFactory.h"
#include "RegistryUtil.h"
#include "NCOverlay.h"
#include "NCOverlayFactory.h"
#include "StringUtil.h"
#include "UtilConstants.h"
#include "RemotePathChecker.h"
#include "resource.h"
#include <algorithm>
#include <iostream>
#include <fstream>
@@ -55,23 +47,23 @@ RemotePathChecker *getGlobalChecker()
}
}
OCOverlay::OCOverlay(int state)
NCOverlay::NCOverlay(int state)
: _referenceCount(1)
, _state(state)
{
}
OCOverlay::~OCOverlay(void)
NCOverlay::~NCOverlay(void)
{
}
IFACEMETHODIMP_(ULONG) OCOverlay::AddRef()
IFACEMETHODIMP_(ULONG) NCOverlay::AddRef()
{
return InterlockedIncrement(&_referenceCount);
}
IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
IFACEMETHODIMP NCOverlay::QueryInterface(REFIID riid, void **ppv)
{
HRESULT hr = S_OK;
@@ -93,7 +85,7 @@ IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
return hr;
}
IFACEMETHODIMP_(ULONG) OCOverlay::Release()
IFACEMETHODIMP_(ULONG) NCOverlay::Release()
{
ULONG cRef = InterlockedDecrement(&_referenceCount);
if (0 == cRef)
@@ -104,7 +96,7 @@ IFACEMETHODIMP_(ULONG) OCOverlay::Release()
return cRef;
}
IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
IFACEMETHODIMP NCOverlay::GetPriority(int *pPriority)
{
// this defines which handler has prededence, so
// we order this in terms of likelyhood
@@ -126,7 +118,7 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority)
return S_OK;
}
IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
IFACEMETHODIMP NCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
{
RemotePathChecker* checker = getGlobalChecker();
std::shared_ptr<const std::vector<std::wstring>> watchedDirectories = checker->WatchedDirectories();
@@ -154,7 +146,7 @@ IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib)
return MAKE_HRESULT(state == _state ? S_OK : S_FALSE, 0, 0);
}
IFACEMETHODIMP OCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
IFACEMETHODIMP NCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
{
*pIndex = 0;
*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;

View File

@@ -12,16 +12,18 @@
* details.
*/
#ifndef OCOVERLAY_H
#define OCOVERLAY_H
#ifndef NCOVERLAY_H
#define NCOVERLAY_H
#pragma once
class OCOverlay : public IShellIconOverlayIdentifier
#include <shlobj.h>
class NCOverlay : public IShellIconOverlayIdentifier
{
public:
OCOverlay(int state);
NCOverlay(int state);
IFACEMETHODIMP_(ULONG) AddRef();
IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
@@ -31,7 +33,7 @@ public:
IFACEMETHODIMP_(ULONG) Release();
protected:
~OCOverlay();
~NCOverlay();
private:
long _referenceCount;

View File

@@ -12,25 +12,26 @@
* details.
*/
#include "stdafx.h"
#include <windows.h>
#include <new>
#include "OCOverlayFactory.h"
#include "OCOverlay.h"
#include "NCOverlayFactory.h"
#include "NCOverlay.h"
extern long dllReferenceCount;
OCOverlayFactory::OCOverlayFactory(int state)
NCOverlayFactory::NCOverlayFactory(int state)
: _referenceCount(1), _state(state)
{
InterlockedIncrement(&dllReferenceCount);
}
OCOverlayFactory::~OCOverlayFactory()
NCOverlayFactory::~NCOverlayFactory()
{
InterlockedDecrement(&dllReferenceCount);
}
IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
IFACEMETHODIMP NCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
{
HRESULT hResult = S_OK;
@@ -49,12 +50,12 @@ IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
return hResult;
}
IFACEMETHODIMP_(ULONG) OCOverlayFactory::AddRef()
IFACEMETHODIMP_(ULONG) NCOverlayFactory::AddRef()
{
return InterlockedIncrement(&_referenceCount);
}
IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
IFACEMETHODIMP_(ULONG) NCOverlayFactory::Release()
{
ULONG cRef = InterlockedDecrement(&_referenceCount);
@@ -65,7 +66,7 @@ IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release()
return cRef;
}
IFACEMETHODIMP OCOverlayFactory::CreateInstance(
IFACEMETHODIMP NCOverlayFactory::CreateInstance(
IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HRESULT hResult = CLASS_E_NOAGGREGATION;
@@ -73,7 +74,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
if (pUnkOuter) { return hResult; }
hResult = E_OUTOFMEMORY;
OCOverlay *lrOverlay = new (std::nothrow) OCOverlay(_state);
NCOverlay *lrOverlay = new (std::nothrow) NCOverlay(_state);
if (!lrOverlay) { return hResult; }
hResult = lrOverlay->QueryInterface(riid, ppv);
@@ -82,7 +83,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
return hResult;
}
IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock)
IFACEMETHODIMP NCOverlayFactory::LockServer(BOOL fLock)
{
if (fLock) {
InterlockedIncrement(&dllReferenceCount);

View File

@@ -12,11 +12,13 @@
* details.
*/
#ifndef OCOVERLAYFACTORY_H
#define OCOVERLAYFACTORY_H
#ifndef NCOVERLAYFACTORY_H
#define NCOVERLAYFACTORY_H
#pragma once
#include <unknwn.h>
enum State {
State_Error = 0,
State_OK, State_OKShared,
@@ -24,10 +26,10 @@ enum State {
State_Warning
};
class OCOverlayFactory : public IClassFactory
class NCOverlayFactory : public IClassFactory
{
public:
OCOverlayFactory(int state);
NCOverlayFactory(int state);
IFACEMETHODIMP_(ULONG) AddRef();
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
@@ -36,7 +38,7 @@ public:
IFACEMETHODIMP_(ULONG) Release();
protected:
~OCOverlayFactory();
~NCOverlayFactory();
private:
long _referenceCount;

View File

@@ -12,16 +12,24 @@
* details.
*/
#include "stdafx.h"
#include "OCOverlayRegistrationHandler.h"
#include "NCOverlayRegistrationHandler.h"
#include <windows.h>
#include <objbase.h>
#include <iostream>
#include <fstream>
#define REGISTRY_OVERLAY_KEY LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers)"
#define REGISTRY_CLSID L"CLSID"
#define REGISTRY_IN_PROCESS L"InprocServer32"
#define REGISTRY_THREADING L"ThreadingModel"
#define REGISTRY_APARTMENT L"Apartment"
#define REGISTRY_VERSION L"Version"
#define REGISTRY_VERSION_NUMBER L"1.0"
using namespace std;
HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
HRESULT NCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
{
HRESULT hResult;
HKEY shellOverlayKey = nullptr;
@@ -52,7 +60,7 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
return hResult;
}
HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
HRESULT NCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
{
HRESULT hResult;
HKEY shellOverlayKey = nullptr;
@@ -71,7 +79,7 @@ HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
return hResult;
}
HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
HRESULT NCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
{
if (!modulePath) {
return E_FAIL;
@@ -89,7 +97,7 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
HKEY clsidKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &clsidKey, nullptr));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
@@ -97,30 +105,36 @@ HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWST
HKEY inprocessKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &inprocessKey, nullptr));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, nullptr, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_THREADING, 0, REG_SZ, (LPBYTE)REGISTRY_APARTMENT, (DWORD)((wcslen(REGISTRY_APARTMENT)+1) * sizeof(TCHAR))));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_VERSION, 0, REG_SZ, (LPBYTE)REGISTRY_VERSION_NUMBER, (DWORD)(wcslen(REGISTRY_VERSION_NUMBER)+1) * sizeof(TCHAR)));
if(!SUCCEEDED(hResult)) {
HKEY versionKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_VERSION, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &versionKey, nullptr));
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegSetValueEx(versionKey, nullptr, 0, REG_SZ, (LPBYTE)REGISTRY_VERSION_NUMBER, (DWORD)(wcslen(REGISTRY_VERSION_NUMBER)+1) * sizeof(TCHAR)));
if (!SUCCEEDED(hResult)) {
return hResult;
}
return S_OK;
}
HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
HRESULT NCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
{
wchar_t stringCLSID[MAX_PATH];
@@ -134,17 +148,22 @@ HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
HKEY clsidKey = nullptr;
hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegDeleteKey(clsidKey, REGISTRY_IN_PROCESS));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegDeleteKey(clsidKey, REGISTRY_VERSION));
if (!SUCCEEDED(hResult)) {
return hResult;
}
hResult = HRESULT_FROM_WIN32(RegDeleteKey(hKey, stringCLSID));
if(!SUCCEEDED(hResult)) {
if (!SUCCEEDED(hResult)) {
return hResult;
}

View File

@@ -12,12 +12,14 @@
* details.
*/
#ifndef OCOVERLAYREGISTRATIONHANDLER_H
#define OCOVERLAYREGISTRATIONHANDLER_H
#ifndef NCOVERLAYREGISTRATIONHANDLER_H
#define NCOVERLAYREGISTRATIONHANDLER_H
#pragma once
class __declspec(dllexport) OCOverlayRegistrationHandler
#include <windows.h>
class __declspec(dllexport) NCOverlayRegistrationHandler
{
public:
static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType);

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View 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}"
)

View File

@@ -12,11 +12,9 @@
* details.
*/
#include "stdafx.h"
#include "CommunicationSocket.h"
#include "UtilConstants.h"
#include "StringUtil.h"
#include "WinShellExtConstants.h"
#include <iostream>
#include <vector>
@@ -44,8 +42,9 @@ std::wstring getUserName() {
std::wstring CommunicationSocket::DefaultPipePath()
{
auto pipename = std::wstring(L"\\\\.\\pipe\\");
pipename += L"ownCloud-";
auto pipename = std::wstring(LR"(\\.\pipe\)");
pipename += std::wstring(UTIL_PIPE_APP_NAME);
pipename += L"-";
pipename += getUserName();
return pipename;
}

Binary file not shown.

View File

@@ -11,8 +11,6 @@
* details.
*/
#include "stdafx.h"
#include "CommunicationSocket.h"
#include "RemotePathChecker.h"

View File

@@ -29,7 +29,7 @@
class __declspec(dllexport) RemotePathChecker {
public:
enum FileState {
// Order synced with OCOverlay
// Order synced with NCOverlay
StateError = 0,
StateOk, StateOkSWM,
StateSync,
@@ -53,7 +53,7 @@ private:
std::queue<std::wstring> _pending;
std::unordered_map<std::wstring, FileState> _cache;
// The vector is const since it will be accessed from multiple threads through OCOverlay::IsMemberOf.
// The vector is const since it will be accessed from multiple threads through NCOverlay::IsMemberOf.
// Each modification needs to be made onto a copy and then atomically replaced in the shared_ptr.
std::shared_ptr<const std::vector<std::wstring>> _watchedDirectories;
bool _connected;

View File

@@ -11,8 +11,6 @@
* details.
*/
#include "stdafx.h"
#include <locale>
#include <string>
#include <codecvt>

View File

@@ -16,6 +16,7 @@
#pragma once
#include <windows.h>
#include <string>
#include <cassert>

View File

@@ -2,10 +2,10 @@
// This is the number that will end up in the version window of the DLLs.
// Increment this version before committing a new build if you are today's shell_integration build master.
#define OCEXT_BUILD_NUM 46
#define NCEXT_BUILD_NUM 47
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define OCEXT_VERSION 1,0,0,OCEXT_BUILD_NUM
#define OCEXT_VERSION_STRING STRINGIZE(OCEXT_VERSION)
#define NCEXT_VERSION 3,0,0,NCEXT_BUILD_NUM
#define NCEXT_VERSION_STRING STRINGIZE(NCEXT_VERSION)

View 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

View File

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

View File

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

View File

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

View File

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

View File

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

View 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1 +0,0 @@
#include "stdafx.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1 +0,0 @@
#include "stdafx.h"

View File

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

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

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

View File

@@ -34,9 +34,15 @@ if(NOT MSVC)
endif()
if(WIN32)
# Enable DEP & ASLR
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase")
# Enable DEP, ASLR and CFG
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
# x86 only: Enable SafeSEH
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /safeseh")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /safeseh")
endif()
elseif(UNIX AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")

View File

@@ -499,7 +499,7 @@ restart_sync:
}
Cmd cmd;
QString dbPath = options.source_dir + SyncJournalDb::makeDbName(credentialFreeUrl, folder, user);
QString dbPath = SyncJournalDb::makeDbName(credentialFreeUrl, folder, user);
SyncJournalDb db(dbPath);
if (!selectiveSyncList.empty()) {

View File

@@ -158,6 +158,7 @@ struct OCSYNC_EXPORT csync_file_stat_s {
bool child_modified BITFIELD(1);
bool has_ignored_files BITFIELD(1); // Specify that a directory, or child directory contains ignored files.
bool is_hidden BITFIELD(1); // Not saved in the DB, only used during discovery for local files.
bool isE2eEncrypted BITFIELD(1);
QByteArray path;
QByteArray rename_path;
@@ -173,7 +174,6 @@ struct OCSYNC_EXPORT csync_file_stat_s {
// In both cases, the format is "SHA1:baff".
QByteArray checksumHeader;
QByteArray e2eMangledName;
bool isE2eEncrypted;
CSYNC_STATUS error_status = CSYNC_STATUS_OK;

View File

@@ -395,12 +395,19 @@ if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(NO_STRIP "-no-strip")
else()
set(NO_STRIP "")
endif()
add_custom_command(TARGET ${APPLICATION_EXECUTABLE} POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
"$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
-qmldir=${CMAKE_SOURCE_DIR}/src/gui
-always-overwrite
-executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
${NO_STRIP}
COMMENT "Running macdeployqt..."
)
endif()

View File

@@ -197,10 +197,14 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
connect(_accountState->account()->e2e(), &ClientSideEncryption::showMnemonic, this, &AccountSettings::slotShowMnemonic);
connect(_accountState->account()->e2e(), &ClientSideEncryption::mnemonicGenerated, this, &AccountSettings::slotNewMnemonicGenerated);
if (_accountState->account()->e2e()->newMnemonicGenerated())
{
if (_accountState->account()->e2e()->newMnemonicGenerated()) {
slotNewMnemonicGenerated();
} else {
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
auto *mnemonic = new QAction(tr("Display mnemonic"), this);
connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic);
_ui->encryptionMessage->addAction(mnemonic);
_ui->encryptionMessage->hide();
}
@@ -837,6 +841,10 @@ void AccountSettings::slotAccountStateChanged()
*/
qCInfo(lcAccountSettings) << "Account" << accountsState()->account()->displayName()
<< "Client Side Encryption" << accountsState()->account()->capabilities().clientSideEncryptionAvailable();
if (_accountState->account()->capabilities().clientSideEncryptionAvailable()) {
_ui->encryptionMessage->show();
}
}
}

View File

@@ -44,7 +44,6 @@ AccountState::AccountState(AccountPtr account)
, _waitingForNewCredentials(false)
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
, _remoteWipe(new RemoteWipe(_account))
, _hasTalk(false)
{
qRegisterMetaType<AccountState *>("AccountState*");
@@ -74,11 +73,6 @@ AccountPtr AccountState::account() const
return _account;
}
bool AccountState::hasTalk() const
{
return _hasTalk;
}
AccountState::ConnectionStatus AccountState::connectionStatus() const
{
return _connectionStatus;
@@ -444,7 +438,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
qCWarning(lcAccountState) << "Status code " << statusCode << " Not Modified - No new navigation apps.";
} else {
_apps.clear();
_hasTalk = false;
if(!reply.isEmpty()){
auto element = reply.object().value("ocs").toObject().value("data");
@@ -458,9 +451,6 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
navLink.value("id").toString(), QUrl(navLink.value("icon").toString()));
_apps << app;
if(app->id() == QLatin1String("spreed"))
_hasTalk = true;
}
}
}

View File

@@ -103,8 +103,6 @@ public:
bool isSignedOut() const;
bool hasTalk() const;
AccountAppList appList() const;
AccountApp* findApp(const QString &appId) const;
@@ -195,7 +193,6 @@ private:
ConnectionStatus _connectionStatus;
QStringList _connectionErrors;
bool _waitingForNewCredentials;
bool _hasTalk;
QElapsedTimer _timeSinceLastETagCheck;
QPointer<ConnectionValidator> _connectionValidator;
QByteArray _notificationsEtagResponseHeader;

View File

@@ -26,7 +26,6 @@ ElidedLabel::ElidedLabel(QWidget *parent)
ElidedLabel::ElidedLabel(const QString &text, QWidget *parent)
: QLabel(text, parent)
, _text(text)
, _elideMode(Qt::ElideNone)
{
}

View File

@@ -218,13 +218,27 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
socketApi()->slotUnregisterPath(folderAlias);
auto settings = account->settings();
auto journalFileMoveSuccess = true;
// Due to db logic can't be sure which of these file exist.
if (oldJournal.exists()) {
journalFileMoveSuccess &= oldJournal.rename(folderDefinition.journalPath);
}
if (oldJournalShm.exists()) {
journalFileMoveSuccess &= oldJournalShm.rename(folderDefinition.journalPath.append("-shm"));
}
if (oldJournalWal.exists()) {
journalFileMoveSuccess &= oldJournalWal.rename(folderDefinition.journalPath.append("-wal"));
}
if (!journalFileMoveSuccess) {
qCWarning(lcFolderMan) << "Wasn't able to move pre-2.7 syncjournal database files to new location. One-time loss off sync settings possible.";
} else {
qCInfo(lcFolderMan) << "Successfully migrated syncjournal database.";
}
Folder *f = addFolderInternal(folderDefinition, account.data());
f->saveToSettings();
oldJournal.remove();
oldJournalShm.remove();
oldJournalWal.remove();
return;
}
@@ -931,6 +945,11 @@ Folder *FolderMan::addFolderInternal(FolderDefinition folderDefinition,
auto folder = new Folder(folderDefinition, accountState, this);
if (_navigationPaneHelper.showInExplorerNavigationPane() && folderDefinition.navigationPaneClsid.isNull()) {
folder->setNavigationPaneClsid(QUuid::createUuid());
folder->saveToSettings();
}
qCInfo(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias();
_folderMap[folder->alias()] = folder;
if (folder->syncPaused()) {

View File

@@ -156,23 +156,23 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
}
painter->save();
QIcon statusIcon = qvariant_cast<QIcon>(index.data(FolderStatusIconRole));
QString aliasText = qvariant_cast<QString>(index.data(HeaderRole));
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
QString remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
QStringList conflictTexts = qvariant_cast<QStringList>(index.data(FolderConflictMsg));
QStringList errorTexts = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
auto statusIcon = qvariant_cast<QIcon>(index.data(FolderStatusIconRole));
auto aliasText = qvariant_cast<QString>(index.data(HeaderRole));
auto pathText = qvariant_cast<QString>(index.data(FolderPathRole));
auto remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
auto conflictTexts = qvariant_cast<QStringList>(index.data(FolderConflictMsg));
auto errorTexts = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
int overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
QString overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
QString itemString = qvariant_cast<QString>(index.data(SyncProgressItemString));
int warningCount = qvariant_cast<int>(index.data(WarningCount));
bool syncOngoing = qvariant_cast<bool>(index.data(SyncRunning));
QDateTime syncDate = qvariant_cast<QDateTime>(index.data(SyncDate));
bool syncEnabled = qvariant_cast<bool>(index.data(FolderAccountConnected));
auto overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
auto overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
auto itemString = qvariant_cast<QString>(index.data(SyncProgressItemString));
auto warningCount = qvariant_cast<int>(index.data(WarningCount));
auto syncOngoing = qvariant_cast<bool>(index.data(SyncRunning));
auto syncDate = qvariant_cast<QDateTime>(index.data(SyncDate));
auto syncEnabled = qvariant_cast<bool>(index.data(FolderAccountConnected));
QRect iconRect = option.rect;
QRect aliasRect = option.rect;
auto iconRect = option.rect;
auto aliasRect = option.rect;
iconRect.setLeft(option.rect.left() + aliasMargin);
iconRect.setTop(iconRect.top() + aliasMargin); // (iconRect.height()-iconsize.height())/2);
@@ -183,12 +183,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
aliasRect.setRight(aliasRect.right() - aliasMargin);
// remote directory box
QRect remotePathRect = aliasRect;
auto remotePathRect = aliasRect;
remotePathRect.setTop(aliasRect.bottom() + margin);
remotePathRect.setBottom(remotePathRect.top() + subFm.height());
// local directory box
QRect localPathRect = remotePathRect;
auto localPathRect = remotePathRect;
localPathRect.setTop(remotePathRect.bottom() + margin);
localPathRect.setBottom(localPathRect.top() + subFm.height());

View File

@@ -149,9 +149,6 @@ void OcsShareJob::createShare(const QString &path,
addParam(QString::fromLatin1("path"), path);
addParam(QString::fromLatin1("shareType"), QString::number(shareType));
addParam(QString::fromLatin1("shareWith"), shareWith);
if (!(permissions & SharePermissionDefault)) {
addParam(QString::fromLatin1("permissions"), QString::number(permissions));
}
start();
}

View File

@@ -79,12 +79,15 @@ ownCloudGui::ownCloudGui(Application *parent)
connect(_tray.data(), &Systray::pauseSync,
this, &ownCloudGui::slotPauseAllFolders);
connect(_tray.data(), &Systray::pauseSync,
connect(_tray.data(), &Systray::resumeSync,
this, &ownCloudGui::slotUnpauseAllFolders);
connect(_tray.data(), &Systray::openHelp,
this, &ownCloudGui::slotHelp);
connect(_tray.data(), &Systray::openAccountWizard,
this, &ownCloudGui::slotNewAccountWizard);
connect(_tray.data(), &Systray::openMainDialog,
this, &ownCloudGui::slotOpenMainDialog);

View File

@@ -154,24 +154,25 @@ void ShareLinkWidget::setupUiOptions()
permissionsGroup->setExclusive(true);
if (_isFile) {
checked = perm & (SharePermissionRead & SharePermissionUpdate);
_allowEditingLinkAction = _linkContextMenu->addAction(tr("Allow Editing"));
checked = (perm & SharePermissionRead) && (perm & SharePermissionUpdate);
_allowEditingLinkAction = _linkContextMenu->addAction(tr("Allow editing"));
_allowEditingLinkAction->setCheckable(true);
_allowEditingLinkAction->setChecked(checked);
} else {
checked = perm & SharePermissionRead;
checked = (perm == SharePermissionRead);
_readOnlyLinkAction = permissionsGroup->addAction(tr("Read only"));
_readOnlyLinkAction->setCheckable(true);
_readOnlyLinkAction->setChecked(checked);
checked = perm & (SharePermissionRead & SharePermissionCreate & SharePermissionUpdate & SharePermissionDelete);
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow Upload && Editing"));
checked = (perm & SharePermissionRead) && (perm & SharePermissionCreate)
&& (perm & SharePermissionUpdate) && (perm & SharePermissionDelete);
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow upload and editing"));
_allowUploadEditingLinkAction->setCheckable(true);
_allowUploadEditingLinkAction->setChecked(checked);
checked = perm & SharePermissionCreate;
_allowUploadLinkAction = permissionsGroup->addAction(tr("File Drop (Upload Only)"));
checked = (perm == SharePermissionCreate);
_allowUploadLinkAction = permissionsGroup->addAction(tr("File drop (upload only)"));
_allowUploadLinkAction->setCheckable(true);
_allowUploadLinkAction->setChecked(checked);
}
@@ -186,7 +187,7 @@ void ShareLinkWidget::setupUiOptions()
}
// Adds action to display note widget (check box)
_noteLinkAction = _linkContextMenu->addAction(tr("Add note to recipient"));
_noteLinkAction = _linkContextMenu->addAction(tr("Note to recipient"));
_noteLinkAction->setCheckable(true);
if (_linkShare->getNote().isSimpleText() && !_linkShare->getNote().isEmpty()) {
@@ -196,7 +197,7 @@ void ShareLinkWidget::setupUiOptions()
}
// Adds action to display password widget (check box)
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect"));
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password protect"));
_passwordProtectLinkAction->setCheckable(true);
if (_linkShare.data()->isPasswordSet()) {
@@ -213,7 +214,7 @@ void ShareLinkWidget::setupUiOptions()
}
// Adds action to display expiration date widget (check box)
_expirationDateLinkAction = _linkContextMenu->addAction(tr("Expiration Date"));
_expirationDateLinkAction = _linkContextMenu->addAction(tr("Set expiration date"));
_expirationDateLinkAction->setCheckable(true);
if (!expireDate.isNull()) {
_ui->calendar->setDate(expireDate);
@@ -232,7 +233,7 @@ void ShareLinkWidget::setupUiOptions()
// Adds action to unshare widget (check box)
_unshareLinkAction = _linkContextMenu->addAction(QIcon(":/client/theme/delete.svg"),
tr("Unshare"));
tr("Delete share link"));
_linkContextMenu->addSeparator();
@@ -564,11 +565,11 @@ void ShareLinkWidget::customizeStyle()
_addAnotherLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/add.svg"));
_ui->enableShareLink->setIcon(Theme::createColorAwareIcon(":/client/theme/copy.svg"));
_ui->shareLinkIconLabel->setPixmap(Theme::createColorAwarePixmap(":/client/theme/public.svg"));
_ui->shareLinkToolButton->setIcon(Theme::createColorAwareIcon(":/client/theme/more.svg"));
_ui->confirmNote->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
_ui->confirmPassword->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
_ui->confirmExpirationDate->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));

View File

@@ -28,7 +28,7 @@ enum SharePermission {
SharePermissionCreate = 4,
SharePermissionDelete = 8,
SharePermissionShare = 16,
SharePermissionDefault = 1 << 30
SharePermissionDefault = 31
};
Q_DECLARE_FLAGS(SharePermissions, SharePermission)
Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions)

View File

@@ -208,7 +208,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
}
// the owner of the file that shared it first
// leave out if it's the current user
// leave out if it's the current user
if(x == 0 && !share->getUidOwner().isEmpty() && !(share->getUidOwner() == _account->credentials()->user())) {
_ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName()));
}
@@ -320,7 +320,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
} else {
// Default permissions on creation
int permissions = SharePermissionRead | SharePermissionUpdate;
int permissions = SharePermissionCreate | SharePermissionUpdate
| SharePermissionDelete | SharePermissionShare;
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermission(permissions));
}

View File

@@ -178,7 +178,8 @@ SocketApi::SocketApi(QObject *parent)
if (Utility::isWindows()) {
socketPath = QLatin1String(R"(\\.\pipe\)")
+ QLatin1String("ownCloud-")
+ QLatin1String(APPLICATION_EXECUTABLE)
+ QLatin1String("-")
+ QString::fromLocal8Bit(qgetenv("USERNAME"));
// TODO: once the windows extension supports multiple
// client connections, switch back to the theme name
@@ -718,11 +719,11 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis
listener->sendMessage(QString("GET_STRINGS:END"));
}
void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener)
void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, bool enabled)
{
auto record = fileData.journalRecord();
bool isOnTheServer = record.isValid();
auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:");
auto flagString = isOnTheServer && enabled ? QLatin1String("::") : QLatin1String(":d:");
auto capabilities = fileData.folder->accountState()->account()->capabilities();
auto theme = Theme::instance();
@@ -798,7 +799,8 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
bool hasSeveralFiles = argument.contains(QLatin1Char('\x1e')); // Record Separator
FileData fileData = hasSeveralFiles ? FileData{} : FileData::get(argument);
bool isOnTheServer = fileData.journalRecord().isValid();
auto flagString = isOnTheServer ? QLatin1String("::") : QLatin1String(":d:");
const auto isE2eEncryptedPath = fileData.journalRecord()._isE2eEncrypted || !fileData.journalRecord()._e2eMangledName.isEmpty();
auto flagString = isOnTheServer && !isE2eEncryptedPath ? QLatin1String("::") : QLatin1String(":d:");
if (fileData.folder && fileData.folder->accountState()->isConnected()) {
DirectEditor* editor = getDirectEditorForLocalFile(fileData.localPath);
@@ -809,7 +811,7 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
listener->sendMessage(QLatin1String("MENU_ITEM:OPEN_PRIVATE_LINK") + flagString + tr("Open in browser"));
}
sendSharingContextMenuOptions(fileData, listener);
sendSharingContextMenuOptions(fileData, listener, !isE2eEncryptedPath);
}
listener->sendMessage(QString("GET_MENU_ITEMS:END"));
}

View File

@@ -120,7 +120,7 @@ private:
Q_INVOKABLE void command_GET_STRINGS(const QString &argument, SocketListener *listener);
// Sends the context menu options relating to sharing to listener
void sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener);
void sendSharingContextMenuOptions(const FileData &fileData, SocketListener *listener, bool enabled);
/** Send the list of menu item. (added in version 1.1)
* argument is a list of files for which the menu should be shown, separated by '\x1e'

View File

@@ -82,7 +82,11 @@ Systray::Systray()
#ifndef Q_OS_MAC
auto contextMenu = new QMenu();
contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
if (AccountManager::instance()->accounts().isEmpty()) {
contextMenu->addAction(tr("Add account"), this, &Systray::openAccountWizard);
} else {
contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
}
contextMenu->addAction(tr("Settings"), this, &Systray::openSettings);
contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
setContextMenu(contextMenu);
@@ -105,6 +109,14 @@ void Systray::create()
}
hideWindow();
emit activated(QSystemTrayIcon::ActivationReason::Unknown);
const auto folderMap = FolderMan::instance()->map();
for (const auto *folder : folderMap) {
if (!folder->syncPaused()) {
_syncIsPaused = false;
break;
}
}
}
void Systray::slotNewUserSelected()
@@ -264,14 +276,14 @@ QRect Systray::taskbarGeometry() const
#elif defined(Q_OS_MACOS)
// Finder bar is always 22px height on macOS (when treating as effective pixels)
auto screenWidth = currentScreenRect().width();
return QRect(0, 0, screenWidth, 22);
return {0, 0, screenWidth, 22};
#else
if (taskbarOrientation() == TaskBarPosition::Bottom || taskbarOrientation() == TaskBarPosition::Top) {
auto screenWidth = currentScreenRect().width();
return QRect(0, 0, screenWidth, 32);
return {0, 0, screenWidth, 32};
} else {
auto screenHeight = currentScreenRect().height();
return QRect(0, 0, 32, screenHeight);
return {0, 0, 32, screenHeight};
}
#endif
}
@@ -279,8 +291,8 @@ QRect Systray::taskbarGeometry() const
QRect Systray::currentScreenRect() const
{
const auto screen = currentScreen();
const auto rect = screen->geometry();
return rect.translated(screen->virtualGeometry().topLeft());
Q_ASSERT(screen);
return screen->geometry();
}
QPoint Systray::computeWindowReferencePoint() const
@@ -378,7 +390,7 @@ QPoint Systray::calcTrayIconCenter() const
return trayIconCenter;
#else
// On Linux, fall back to mouse position (assuming tray icon is activated by mouse click)
return QCursor::pos();
return QCursor::pos(currentScreen());
#endif
}

View File

@@ -64,6 +64,7 @@ public:
signals:
void currentUserChanged();
void openAccountWizard();
void openMainDialog();
void openSettings();
void openHelp();
@@ -91,7 +92,7 @@ private:
QPoint computeWindowPosition(int width, int height) const;
bool _isOpen = false;
bool _syncIsPaused = false;
bool _syncIsPaused = true;
QPointer<QQmlApplicationEngine> _trayEngine;
};

View File

@@ -90,21 +90,36 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
return QString();
case PathRole:
if (!a._file.isEmpty()) {
auto folder = FolderMan::instance()->folder(a._folder);
auto folder = FolderMan::instance()->folderForPath(a._folder);
QString relPath(a._file);
if (folder)
relPath.prepend(folder->remotePath());
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
if (list.count() > 0) {
return QUrl::fromLocalFile(list.at(0));
}
// File does not exist anymore? Let's try to open its path
if (QFileInfo(relPath).exists()) {
if (list.isEmpty() && QFileInfo(relPath).exists()) {
list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(relPath).path(), ast->account());
if (list.count() > 0) {
return QVariant(list.at(0));
}
if (list.isEmpty()) {
return QString();
}
const auto path = list.at(0);
folder = FolderMan::instance()->folderForPath(path);
// If this is an E2EE file or folder, pretend we got no path, this leads to
// hiding the share button which is what we want
if (folder) {
SyncJournalFileRecord rec;
folder->journalDb()->getFileRecord(a._file.mid(1), &rec);
if (rec.isValid() && (rec._isE2eEncrypted || !rec._e2eMangledName.isEmpty())) {
return QString();
}
}
return QUrl::fromLocalFile(path);
}
return QString();
case AbsolutePathRole: {

View File

@@ -483,7 +483,12 @@ bool User::hasLocalFolder() const
bool User::serverHasTalk() const
{
return _account->hasTalk();
return talkApp() != nullptr;
}
AccountApp *User::talkApp() const
{
return _account->findApp(QStringLiteral("spreed"));
}
bool User::hasActivities() const
@@ -597,14 +602,6 @@ Q_INVOKABLE QString UserModel::currentUserServer()
return _users[_currentUserId]->server();
}
Q_INVOKABLE bool UserModel::currentServerHasTalk()
{
if (_users.isEmpty())
return false;
return _users[_currentUserId]->serverHasTalk();
}
void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent)
{
bool containsUser = false;
@@ -643,14 +640,15 @@ Q_INVOKABLE void UserModel::openCurrentAccountLocalFolder()
Q_INVOKABLE void UserModel::openCurrentAccountTalk()
{
if (_users.isEmpty())
if (!currentUser())
return;
QString url = _users[_currentUserId]->server(false) + "/apps/spreed";
if (!(url.contains("http://") || url.contains("https://"))) {
url = "https://" + _users[_currentUserId]->server(false) + "/apps/spreed";
const auto talkApp = currentUser()->talkApp();
if (talkApp) {
QDesktopServices::openUrl(talkApp->url());
} else {
qCWarning(lcActivity) << "The Talk app is not enabled on" << currentUser()->server();
}
QDesktopServices::openUrl(QUrl(url));
}
Q_INVOKABLE void UserModel::openCurrentAccountServer()
@@ -864,9 +862,10 @@ void UserAppsModel::buildAppList()
}
if (UserModel::instance()->appList().count() > 0) {
const auto talkApp = UserModel::instance()->currentUser()->talkApp();
foreach (AccountApp *app, UserModel::instance()->appList()) {
// Filter out Talk because we have a dedicated button for it
if (app->id() == QLatin1String("spreed"))
if (talkApp && app->id() == talkApp->id())
continue;
beginInsertRows(QModelIndex(), rowCount(), rowCount());

View File

@@ -36,6 +36,7 @@ public:
QString server(bool shortened = true) const;
bool hasLocalFolder() const;
bool serverHasTalk() const;
AccountApp *talkApp() const;
bool hasActivities() const;
AccountAppList appList() const;
QImage avatar(bool whiteBg = false) const;
@@ -112,7 +113,6 @@ public:
Q_INVOKABLE QString currentUserServer();
Q_INVOKABLE bool currentUserHasActivities();
Q_INVOKABLE bool currentUserHasLocalFolder();
Q_INVOKABLE bool currentServerHasTalk();
Q_INVOKABLE int currentUserId() const;
Q_INVOKABLE bool isUserConnected(const int &id);
Q_INVOKABLE void switchCurrentUser(const int &id);

Some files were not shown because too many files have changed in this diff Show More