1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Files can be downloaded directly to an external drop location even without a loaded drag&drop shell extension.

Part of "Make WinSCP available in Windows Store (UWP/AppX package)"
https://winscp.net/tracker/1639
(though useful for portable package too and for first uses of WinSCP after installation before restart)

Counters DownloadsDragDropQueue + DownloadsDragDropFakeFile
Counter DownloadsDragDropExternalExtNotInstalled removed

Source commit: 694f55c42d1bc0ec0ecf037a99d889f492080cd9
This commit is contained in:
Martin Prikryl
2018-04-29 09:24:19 +00:00
parent 8d3d20da4a
commit dc855630a2
15 changed files with 192 additions and 91 deletions

View File

@@ -96,7 +96,10 @@
<BuildOrder>3</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\my\CompThread.pas">
<BuildOrder>4</BuildOrder>
<BuildOrder>22</BuildOrder>
</DelphiCompile>
<DelphiCompile Include="packages\my\DirectoryMonitor.pas">
<BuildOrder>23</BuildOrder>
</DelphiCompile>
<ResFiles Include="packages\my\DiscMon.dcr">
<BuildOrder>6</BuildOrder>

View File

@@ -208,7 +208,7 @@ DllMain(HINSTANCE HInstance, DWORD Reason, LPVOID /*Reserved*/)
if (GRefThisDll == 0)
{
GLogMutex = CreateMutex(NULL, false, L"WinSCPDragExtLogMutex");
GLogMutex = CreateMutex(NULL, false, DRAG_EXT_RUNNING_MUTEX);
for (int Root = 0; Root <= 1; Root++)
{

View File

@@ -4,6 +4,7 @@
//---------------------------------------------------------------------------
#define DRAG_EXT_MAPPING L"WinSCPDragExtMapping"
#define DRAG_EXT_MUTEX L"WinSCPDragExtMutex"
#define DRAG_EXT_RUNNING_MUTEX L"WinSCPDragExtLogMutex"
#define DRAG_EXT_DUMMY_DIR_PREFIX L"scp"
#define DRAG_EXT_DUMMY_DIR_PREFIX_LEN 3
//---------------------------------------------------------------------------

View File

@@ -35,6 +35,7 @@
#include <Consts.hpp>
#include <DateUtils.hpp>
#include <TB2Common.hpp>
#include <DirectoryMonitor.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CustomDirView"
@@ -6702,30 +6703,63 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDCreateDragFileList(
FDDExtMapFile = NULL;
}
if (WinConfiguration->DDExtEnabled)
if (WinConfiguration->DDFakeFile)
{
if (!WinConfiguration->DDExtInstalled)
{
Configuration->Usage->Inc(L"DownloadsDragDropExternalExtNotInstalled");
throw ExtException(NULL, LoadStr(DRAGEXT_TARGET_NOT_INSTALLED2), HELP_DRAGEXT_TARGET_NOT_INSTALLED);
}
DDExtInitDrag(FileList, Created);
DDFakeFileInitDrag(FileList, Created);
}
}
//---------------------------------------------------------------------------
void __fastcall TCustomScpExplorerForm::DDExtInitDrag(TFileList * FileList,
void __fastcall TCustomScpExplorerForm::DDFakeCreated(TObject * /*Sender*/, const UnicodeString FileName)
{
if (DebugAlwaysTrue(!FDragFakeDirectory.IsEmpty()) &&
SameText(ExtractFileName(FileName), ExtractFileName(FDragFakeDirectory)))
{
FFakeFileDropTarget = FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall TCustomScpExplorerForm::DDFakeFileInitDrag(TFileList * FileList,
bool & Created)
{
FDragExtFakeDirectory =
FFakeFileDropTarget = UnicodeString();
FDragFakeDirectory =
ExcludeTrailingBackslash(WinConfiguration->TemporaryDir());
if (!ForceDirectories(ApiPath(FDragExtFakeDirectory)))
if (!ForceDirectories(ApiPath(FDragFakeDirectory)))
{
throw Exception(FMTLOAD(CREATE_TEMP_DIR_ERROR, (FDragExtFakeDirectory)));
throw Exception(FMTLOAD(CREATE_TEMP_DIR_ERROR, (FDragFakeDirectory)));
}
FileList->AddItem(NULL, FDragExtFakeDirectory);
FileSetAttr(ApiPath(FDragFakeDirectory), faHidden);
FileList->AddItem(NULL, FDragFakeDirectory);
Created = true;
if (!WinConfiguration->IsDDExtRunning())
{
FDragFakeMonitors = new TObjectList();
for (char Drive = FirstDrive; Drive <= LastDrive; Drive++)
{
std::unique_ptr<TDirectoryMonitor> Monitor(new TDirectoryMonitor(this));
TDriveInfoRec * DriveInfoRec = DriveInfo->Get(Drive);
if (DriveInfoRec->Valid &&
(DriveInfoRec->DriveType != DRIVE_CDROM))
{
try
{
Monitor->Path = DriveInfo->GetDriveRoot(Drive);
Monitor->WatchSubtree = true;
Monitor->WatchFilters = FILE_NOTIFY_CHANGE_DIR_NAME;
Monitor->OnCreated = DDFakeCreated;
Monitor->Active = true;
FDragFakeMonitors->Add(Monitor.release());
}
catch (Exception & E)
{
// Ignore errors watching not-ready drives
}
}
}
}
FDDExtMapFile = CreateFileMappingA((HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE,
0, sizeof(TDragExtCommStruct), AnsiString(DRAG_EXT_MAPPING).c_str());
@@ -6737,7 +6771,7 @@ void __fastcall TCustomScpExplorerForm::DDExtInitDrag(TFileList * FileList,
DebugAssert(CommStruct != NULL);
CommStruct->Version = TDragExtCommStruct::CurrentVersion;
CommStruct->Dragging = true;
wcsncpy(CommStruct->DropDest, FDragExtFakeDirectory.c_str(),
wcsncpy(CommStruct->DropDest, FDragFakeDirectory.c_str(),
LENOF(CommStruct->DropDest));
NULL_TERMINATE(CommStruct->DropDest);
UnmapViewOfFile(CommStruct);
@@ -6790,6 +6824,11 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
// Drops of local files (uploads) are handled in QueueDDProcessDropped.
SAFE_DESTROY(FDDFileList);
if (!FFakeFileDropTarget.IsEmpty())
{
RemoveDir(ApiPath(FFakeFileDropTarget));
}
if ((FDDExtMapFile != NULL) || (FDDTargetControl == QueueView3))
{
try
@@ -6833,9 +6872,9 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
}
TTransferOperationParam Param;
bool Internal;
UnicodeString CounterName;
bool ForceQueue;
if (!DDGetTarget(Param.TargetDirectory, ForceQueue, Internal))
if (!DDGetTarget(Param.TargetDirectory, ForceQueue, CounterName))
{
// we get drInvalid both if d&d was intercepted by ddext,
// and when users drops on no-drop location.
@@ -6852,7 +6891,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
}
else
{
// download using ddext
// download using fake file
Param.Temp = false;
Param.DragDrop = true;
if (ForceQueue)
@@ -6867,8 +6906,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
if (RemoteFileControlFileOperation(Sender, Operation,
(WinConfiguration->DDTransferConfirmation == asOff), &Param))
{
Configuration->Usage->Inc(
Internal ? L"DownloadsDragDropInternal" : L"DownloadsDragDropExternalExt");
Configuration->Usage->Inc(CounterName);
}
}
}
@@ -6877,8 +6915,11 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDEnd(TObject * Sender)
{
CloseHandle(FDDExtMapFile);
FDDExtMapFile = NULL;
RemoveDir(ApiPath(FDragExtFakeDirectory));
FDragExtFakeDirectory = L"";
delete FDragFakeMonitors;
FDragFakeMonitors = NULL;
RemoveDir(ApiPath(FDragFakeDirectory));
FDragFakeDirectory = L"";
FFakeFileDropTarget = UnicodeString();
}
}
@@ -6910,16 +6951,23 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDGiveFeedback(
}
//---------------------------------------------------------------------------
bool __fastcall TCustomScpExplorerForm::DDGetTarget(
UnicodeString & Directory, bool & ForceQueue, bool & Internal)
UnicodeString & Directory, bool & ForceQueue, UnicodeString & CounterName)
{
bool Result;
if (FDDTargetControl == QueueView3)
{
Directory = DefaultDownloadTargetDirectory();
Result = true;
Internal = true;
CounterName = L"DownloadsDragDropQueue";
ForceQueue = true;
}
else if (!FFakeFileDropTarget.IsEmpty())
{
Directory = ExcludeTrailingBackslash(ExtractFilePath(FFakeFileDropTarget));
Result = true;
ForceQueue = false;
CounterName = L"DownloadsDragDropFakeFile";
}
else
{
ForceQueue = false;
@@ -6941,7 +6989,7 @@ bool __fastcall TCustomScpExplorerForm::DDGetTarget(
if (Result)
{
Directory = ExtractFilePath(CommStruct->DropDest);
Internal = false;
CounterName = L"DownloadsDragDropExternalExt";
}
UnmapViewOfFile(CommStruct);
}

View File

@@ -202,7 +202,8 @@ private:
unsigned short FIgnoreNextDialogChar;
TStringList * FErrorList;
HANDLE FDDExtMutex;
UnicodeString FDragExtFakeDirectory;
UnicodeString FDragFakeDirectory;
TObjectList * FDragFakeMonitors;
TStrings * FDelayedDeletionList;
TTimer * FDelayedDeletionTimer;
TStrings * FDDFileList;
@@ -328,6 +329,7 @@ protected:
TPoint FLastContextPopupScreenPoint;
bool FRemoteDirViewWasFocused;
bool FDoNotIdleCurrentTerminal;
UnicodeString FFakeFileDropTarget;
virtual bool __fastcall CopyParamDialog(TTransferDirection Direction,
TTransferType Type, bool Temp, TStrings * FileList,
@@ -421,8 +423,9 @@ protected:
bool __fastcall ExecuteFileOperation(TFileOperation Operation, TOperationSide Side,
TStrings * FileList, bool NoConfirmation, void * Param);
virtual bool __fastcall DDGetTarget(UnicodeString & Directory,
bool & ForceQueue, bool & Internal);
virtual void __fastcall DDExtInitDrag(TFileList * FileList, bool & Created);
bool & ForceQueue, UnicodeString & CounterName);
virtual void __fastcall DDFakeFileInitDrag(TFileList * FileList, bool & Created);
void __fastcall DDFakeCreated(TObject * Sender, const UnicodeString FileName);
virtual void __fastcall SideEnter(TOperationSide Side);
virtual TOperationSide __fastcall GetSide(TOperationSide Side);
TStrings * __fastcall PanelExport(TOperationSide Side, TPanelExport Export);

View File

@@ -286,8 +286,8 @@ void __fastcall TPreferencesDialog::LoadConfiguration()
int(static_cast<double>(GUIConfiguration->BeepOnFinishAfter) * SecsPerDay);
BOOLPROP(BalloonNotifications);
DDExtEnabledButton->Checked = WinConfiguration->DDExtEnabled;
DDExtDisabledButton->Checked = !DDExtEnabledButton->Checked;
DDFakeFileEnabledButton->Checked = WinConfiguration->DDFakeFile;
DDFakeFileDisabledButton->Checked = !DDFakeFileEnabledButton->Checked;
DDWarnOnMoveCheck->Checked = !WinConfiguration->DDAllowMove;
if (WinConfiguration->DDTemporaryDirectory.IsEmpty())
@@ -664,7 +664,7 @@ void __fastcall TPreferencesDialog::SaveConfiguration()
BOOLPROP(BalloonNotifications);
WinConfiguration->DDAllowMove = !DDWarnOnMoveCheck->Checked;
WinConfiguration->DDExtEnabled = DDExtEnabledButton->Checked;
WinConfiguration->DDFakeFile = DDFakeFileEnabledButton->Checked;
if (DDSystemTemporaryDirectoryButton->Checked)
{
@@ -1216,13 +1216,28 @@ void __fastcall TPreferencesDialog::UpdateControls()
}
SetLabelHintPopup(CopyParamLabel, InfoStr);
EnableControl(DDExtEnabledButton, WinConfiguration->DDExtInstalled);
EnableControl(DDExtEnabledLabel, WinConfiguration->DDExtInstalled);
EnableControl(DDExtDisabledPanel, DDExtDisabledButton->Checked);
if (!WinConfiguration->DDExtInstalled)
{
DragExtStatusLabel->Caption = LoadStr(PREFERENCES_DRAGEXT_NOT_INSTALLED);
DragExtStatusLabel->Enabled = false;
DragExtStatusLabel->Font->Color = clWindowText;
}
else if (!WinConfiguration->IsDDExtRunning())
{
DragExtStatusLabel->Caption = LoadStr(PREFERENCES_DRAGEXT_NOT_RUNNING);
DragExtStatusLabel->Enabled = true;
DragExtStatusLabel->Font->Color = clGrayText;
}
else
{
DragExtStatusLabel->Caption = LoadStr(PREFERENCES_DRAGEXT_RUNNING);
DragExtStatusLabel->Enabled = true;
DragExtStatusLabel->Font->Color = clWindowText;
}
EnableControl(DDFakeFileDisabledPanel, DDFakeFileDisabledButton->Checked);
EnableControl(DDTemporaryDirectoryEdit, DDCustomTemporaryDirectoryButton->Enabled &&
DDCustomTemporaryDirectoryButton->Checked);
EnableControl(DDWarnOnMoveCheck, DDExtDisabledButton->Checked &&
DDAllowMoveInitCheck->Checked);
EnableControl(DDWarnOnMoveCheck, DDFakeFileDisabledButton->Checked && DDAllowMoveInitCheck->Checked);
EnableControl(ConfirmTemporaryDirectoryCleanupCheck,
TemporaryDirectoryCleanupCheck->Checked);
// allow only when some of the known storages is selected,
@@ -2101,10 +2116,9 @@ void __fastcall TPreferencesDialog::MakeDefaultHandlerItemClick(TObject * /*Send
LaunchAdvancedAssociationUI();
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDialog::DDExtLabelClick(TObject * Sender)
void __fastcall TPreferencesDialog::DDLabelClick(TObject * Sender)
{
((Sender == DDExtEnabledLabel) ? DDExtEnabledButton : DDExtDisabledButton)->
SetFocus();
((Sender != DDFakeFileDisabledLabel) ? DDFakeFileEnabledButton : DDFakeFileDisabledButton)->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TPreferencesDialog::AddSearchPathButtonClick(

View File

@@ -1303,14 +1303,14 @@ object PreferencesDialog: TPreferencesDialog
Left = 8
Top = 8
Width = 389
Height = 252
Height = 277
Anchors = [akLeft, akTop, akRight]
Caption = 'Drag && Drop downloads'
TabOrder = 0
DesignSize = (
389
252)
object DDExtEnabledLabel: TLabel
277)
object DDFakeFileEnabledLabel: TLabel
Left = 35
Top = 68
Width = 345
@@ -1318,15 +1318,16 @@ object PreferencesDialog: TPreferencesDialog
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption =
'Allows direct downloads to regular local folders (e.g. Window Ex' +
'plorer). Does not allow downloads to other destinations (ZIP arc' +
'hives, FTP, etc.)'
'Allow direct downloads to regular local folders (e.g. Window Exp' +
'lorer). Does not allow downloads to other destinations (ZIP arch' +
'ives, FTP, etc.). Uses drag&&drop shell extension, when availab' +
'le.'
WordWrap = True
OnClick = DDExtLabelClick
OnClick = DDLabelClick
end
object DDExtDisabledLabel: TLabel
object DDFakeFileDisabledLabel: TLabel
Left = 35
Top = 144
Top = 165
Width = 346
Height = 54
Anchors = [akLeft, akTop, akRight]
@@ -1336,31 +1337,42 @@ object PreferencesDialog: TPreferencesDialog
'ves, FTP, etc.). Files are downloaded first to temporary folder' +
', from where they are delivered to the destination.'
WordWrap = True
OnClick = DDExtLabelClick
OnClick = DDLabelClick
end
object DDExtEnabledButton: TRadioButton
object DragExtStatusLabel: TLabel
Left = 35
Top = 120
Width = 345
Height = 26
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = 'DragExtStatusLabel'
WordWrap = True
OnClick = DDLabelClick
end
object DDFakeFileEnabledButton: TRadioButton
Left = 16
Top = 48
Width = 364
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Use &shell extension'
Caption = 'Determine drop target by dragging a &fake file'
TabOrder = 1
OnClick = ControlChange
end
object DDExtDisabledButton: TRadioButton
object DDFakeFileDisabledButton: TRadioButton
Left = 16
Top = 124
Top = 145
Width = 356
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Use &temporary folder'
Caption = 'Download files via &temporary folder'
TabOrder = 2
OnClick = ControlChange
end
object DDExtDisabledPanel: TPanel
object DDFakeFileDisabledPanel: TPanel
Left = 34
Top = 195
Top = 216
Width = 315
Height = 51
BevelOuter = bvNone

View File

@@ -83,11 +83,11 @@ __published:
TButton *RegisterAsUrlHandlersButton;
TTabSheet *DragDropSheet;
TGroupBox *DragDropDownloadsGroup;
TLabel *DDExtEnabledLabel;
TLabel *DDExtDisabledLabel;
TRadioButton *DDExtEnabledButton;
TRadioButton *DDExtDisabledButton;
TPanel *DDExtDisabledPanel;
TLabel *DDFakeFileEnabledLabel;
TLabel *DDFakeFileDisabledLabel;
TRadioButton *DDFakeFileEnabledButton;
TRadioButton *DDFakeFileDisabledButton;
TPanel *DDFakeFileDisabledPanel;
TCheckBox *DDWarnLackOfTempSpaceCheck;
TCheckBox *DDWarnOnMoveCheck;
TCheckBox *ConfirmExitOnCompletionCheck;
@@ -320,6 +320,7 @@ __published:
TFilenameEdit *CustomIniFileStorageEdit;
TPathLabel *AutomaticIniFileStorageLabel;
TCheckBox *NaturalOrderNumericalSortingCheck;
TLabel *DragExtStatusLabel;
void __fastcall FormShow(TObject *Sender);
void __fastcall ControlChange(TObject *Sender);
void __fastcall EditorFontButtonClick(TObject *Sender);
@@ -341,7 +342,7 @@ __published:
void __fastcall NavigationTreeChange(TObject *Sender, TTreeNode *Node);
void __fastcall PageControlChange(TObject *Sender);
void __fastcall RegisterAsUrlHandlersButtonClick(TObject *Sender);
void __fastcall DDExtLabelClick(TObject *Sender);
void __fastcall DDLabelClick(TObject *Sender);
void __fastcall CustomCommandsViewDblClick(TObject *Sender);
void __fastcall AddSearchPathButtonClick(TObject *Sender);
void __fastcall EditorFontLabelDblClick(TObject *Sender);

View File

@@ -581,10 +581,8 @@ void __fastcall TScpCommanderForm::ConfigurationChanged()
}
// See also LocalDirViewDDTargetHasDropHandler
LocalDirView->DragDropFilesEx->ShellExtensions->DropHandler =
!WinConfiguration->DDExtEnabled;
LocalDriveView->DragDropFilesEx->ShellExtensions->DropHandler =
!WinConfiguration->DDExtEnabled;
LocalDirView->DragDropFilesEx->ShellExtensions->DropHandler = !WinConfiguration->DDFakeFile;
LocalDriveView->DragDropFilesEx->ShellExtensions->DropHandler = !WinConfiguration->DDFakeFile;
if (Panel(true)->Left > Panel(false)->Left)
{
@@ -1431,7 +1429,7 @@ void __fastcall TScpCommanderForm::LocalDirViewDDTargetHasDropHandler(
// cannot allow drop when when using shellex,
// as drop handlers are disabled, so drop would error
// (see TShellExtension.DropHandler assignment in ConfigurationChanged),
if (WinConfiguration->DDExtEnabled &&
if (WinConfiguration->DDFakeFile &&
!LocalDirView->ItemIsDirectory(Item))
{
DropHandler = false;
@@ -1453,29 +1451,29 @@ void __fastcall TScpCommanderForm::LocalFileControlDDDragOver(TObject * /*Sender
}
//---------------------------------------------------------------------------
bool __fastcall TScpCommanderForm::DDGetTarget(
UnicodeString & Directory, bool & ForceQueue, bool & Internal)
UnicodeString & Directory, bool & ForceQueue, UnicodeString & CounterName)
{
bool Result;
if (!FDDExtTarget.IsEmpty())
if (!FDDFakeFileTarget.IsEmpty())
{
Directory = FDDExtTarget;
FDDExtTarget = L"";
Directory = FDDFakeFileTarget;
FDDFakeFileTarget = L"";
Result = true;
Internal = true;
CounterName = L"DownloadsDragDropInternal";
ForceQueue = false;
}
else
{
Result = TCustomScpExplorerForm::DDGetTarget(Directory, ForceQueue, Internal);
Result = TCustomScpExplorerForm::DDGetTarget(Directory, ForceQueue, CounterName);
}
return Result;
}
//---------------------------------------------------------------------------
void __fastcall TScpCommanderForm::DDExtInitDrag(TFileList * FileList,
void __fastcall TScpCommanderForm::DDFakeFileInitDrag(TFileList * FileList,
bool & Created)
{
FDDExtTarget = L"";
TCustomScpExplorerForm::DDExtInitDrag(FileList, Created);
FDDFakeFileTarget = L"";
TCustomScpExplorerForm::DDFakeFileInitDrag(FileList, Created);
}
//---------------------------------------------------------------------------
void __fastcall TScpCommanderForm::LocalFileControlDDFileOperation(
@@ -1490,7 +1488,7 @@ void __fastcall TScpCommanderForm::LocalFileControlDDFileOperation(
// See TCustomScpExplorerForm::QueueDDProcessDropped
if (FDDExtMapFile != NULL)
{
FDDExtTarget = TargetDirectory;
FDDFakeFileTarget = TargetDirectory;
}
else
{

View File

@@ -493,7 +493,7 @@ private:
TStrings * FInternalDDDownloadList;
UnicodeString FPrevPath[2];
bool FFirstTerminal;
UnicodeString FDDExtTarget;
UnicodeString FDDFakeFileTarget;
bool FCommandLineComboPopulated;
TStrings* FLocalPathComboBoxPaths;
int FLocalSpecialPaths;
@@ -537,8 +537,8 @@ protected:
TOperationSide Side);
bool __fastcall InternalDDDownload(UnicodeString & TargetDirectory);
virtual bool __fastcall DDGetTarget(
UnicodeString & Directory, bool & ForceQueue, bool & Internal);
virtual void __fastcall DDExtInitDrag(TFileList * FileList, bool & Created);
UnicodeString & Directory, bool & ForceQueue, UnicodeString & CounterName);
virtual void __fastcall DDFakeFileInitDrag(TFileList * FileList, bool & Created);
virtual void __fastcall SideEnter(TOperationSide Side);
void __fastcall SaveCommandLine();
bool __fastcall ExecuteCommandLine();

View File

@@ -53,8 +53,7 @@
#define HELP_MOVE_CONFIGURATION HELP_IMPORT_CONFIGURATION
#define HELP_DELETE_FILE "task_delete"
#define HELP_COLOR "task_connections#session_color"
#define HELP_DRAGEXT_TARGET_NOT_INSTALLED "dragext"
#define HELP_DRAGEXT_TARGET_UNKNOWN HELP_DRAGEXT_TARGET_NOT_INSTALLED
#define HELP_DRAGEXT_TARGET_UNKNOWN "dragext"
#define HELP_KEY_TYPE_UNSUPPORTED "ui_puttygen#other_formats"
#define HELP_TIPS "ui_tips"
#define HELP_DEBUGGING "debugging"

View File

@@ -28,7 +28,6 @@
#define DRAGEXT_TARGET_UNKNOWN2 1134
#define UNKNOWN_TRANSLATION 1135
#define INCOMPATIBLE_TRANSLATION 1136
#define DRAGEXT_TARGET_NOT_INSTALLED2 1137
#define GSSAPI_NOT_INSTALLED2 1138
#define WATCH_ERROR_GENERAL 1139
#define WATCH_ERROR_DIRECTORY 1140
@@ -596,6 +595,9 @@
#define EDIT_SELECT_ALL 1988
#define EXTENSION_SHORTCUT 1989
#define EXTENSION_GENERAL_GROUP 1999
#define PREFERENCES_DRAGEXT_NOT_INSTALLED 6000
#define PREFERENCES_DRAGEXT_NOT_RUNNING 6001
#define PREFERENCES_DRAGEXT_RUNNING 6002
// 2xxx is reserved for TextsFileZilla.h

View File

@@ -33,7 +33,6 @@ BEGIN
DRAGEXT_TARGET_UNKNOWN2, "**WinSCP was not able to detect folder, where the dragged file(s) was dropped.** Either you have not dropped the file(s) to regular folder (e.g. Windows Explorer) or you have not restarted your computer yet after installation to load drag&drop shell extension. \n\nAlternatively you can switch to compatible drag&drop mode (from Preferences window), which uses temporary folder for downloads. It allows you to drop files to any destination."
UNKNOWN_TRANSLATION, "File '%s' does not contain translation for this product version."
INCOMPATIBLE_TRANSLATION, "File '%s' contains translation for %s version %s."
DRAGEXT_TARGET_NOT_INSTALLED2, "**Drag&drop shell extension use is enabled, but the extension is not installed.** Install the extension or switch to compatible drag&drop mode (from Preferences window), which uses temporary folder for downloads."
GSSAPI_NOT_INSTALLED2, "GSSAPI/SSPI with Kerberos is not supported on this system."
WATCH_ERROR_GENERAL, "Error watching for changes."
WATCH_ERROR_DIRECTORY, "Error watching for changes in directory '%s'."
@@ -599,6 +598,9 @@ BEGIN
EDIT_SELECT_ALL, "Select &All"
EXTENSION_SHORTCUT, "&Keyboard shortcut:"
EXTENSION_GENERAL_GROUP, "General"
PREFERENCES_DRAGEXT_NOT_INSTALLED, "Shell extension is not installed."
PREFERENCES_DRAGEXT_NOT_RUNNING, "Shell extension is installed, but is not loaded."
PREFERENCES_DRAGEXT_RUNNING, "Shell extension is installed and loaded."
WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
WINSCP_COPYRIGHT, "Copyright © 2000-2018 Martin Prikryl"

View File

@@ -494,7 +494,7 @@ void __fastcall TWinConfiguration::Default()
FDDTemporaryDirectory = L"";
FDDWarnLackOfTempSpace = true;
FDDWarnLackOfTempSpaceRatio = 1.1;
FDDExtEnabled = DDExtInstalled;
FDDFakeFile = true;
FDDExtTimeout = MSecsPerSec;
FDeleteToRecycleBin = true;
FSelectDirectories = false;
@@ -917,7 +917,7 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
KEY(Bool, UseLocationProfiles); \
KEY(Bool, UseSharedBookmarks); \
KEY(Integer, LocaleSafe); \
KEY(Bool, DDExtEnabled); \
KEY(Bool, DDFakeFile); \
KEY(Integer, DDExtTimeout); \
KEY(Bool, DefaultDirIsHome); \
KEY(Bool, TemporaryDirectoryAppendSession); \
@@ -1635,6 +1635,23 @@ bool __fastcall TWinConfiguration::GetDDExtInstalled()
return (FDDExtInstalled > 0);
}
//---------------------------------------------------------------------------
bool __fastcall TWinConfiguration::IsDDExtRunning()
{
bool Result;
if (!DDExtInstalled)
{
Result = false;
}
else
{
HANDLE H = OpenMutex(SYNCHRONIZE, False, DRAG_EXT_RUNNING_MUTEX);
Result = (H != NULL);
CloseHandle(H);
}
return Result;
}
//---------------------------------------------------------------------------
RawByteString __fastcall TWinConfiguration::StronglyRecryptPassword(RawByteString Password, UnicodeString Key)
{
RawByteString Dummy;
@@ -1829,9 +1846,9 @@ void __fastcall TWinConfiguration::SetDDTemporaryDirectory(UnicodeString value)
SET_CONFIG_PROPERTY(DDTemporaryDirectory);
}
//---------------------------------------------------------------------------
void __fastcall TWinConfiguration::SetDDExtEnabled(bool value)
void __fastcall TWinConfiguration::SetDDFakeFile(bool value)
{
SET_CONFIG_PROPERTY(DDExtEnabled);
SET_CONFIG_PROPERTY(DDFakeFile);
}
//---------------------------------------------------------------------------
void __fastcall TWinConfiguration::SetDDExtTimeout(int value)

View File

@@ -356,7 +356,7 @@ private:
bool FUseSharedBookmarks;
UnicodeString FDDTemporaryDirectory;
bool FDDWarnLackOfTempSpace;
bool FDDExtEnabled;
bool FDDFakeFile;
int FDDExtInstalled;
int FDDExtTimeout;
bool FConfirmClosingSession;
@@ -466,7 +466,7 @@ private:
void __fastcall SetUseSharedBookmarks(bool value);
void __fastcall SetDDTemporaryDirectory(UnicodeString value);
void __fastcall SetDDWarnLackOfTempSpace(bool value);
void __fastcall SetDDExtEnabled(bool value);
void __fastcall SetDDFakeFile(bool value);
void __fastcall SetDDExtTimeout(int value);
void __fastcall SetConfirmClosingSession(bool value);
void __fastcall SetDDWarnLackOfTempSpaceRatio(double value);
@@ -615,6 +615,7 @@ public:
UnicodeString __fastcall ExtensionStringTranslation(const UnicodeString & ExtensionId, const UnicodeString & S);
UnicodeString __fastcall UniqueExtensionName(const UnicodeString & ExtensionName, int Counter);
UnicodeString __fastcall GetProvisionaryExtensionId(const UnicodeString & FileName);
bool __fastcall IsDDExtRunning();
static void __fastcall RestoreFont(const TFontConfiguration & Configuration, TFont * Font);
static void __fastcall StoreFont(TFont * Font, TFontConfiguration & Configuration);
@@ -649,7 +650,7 @@ public:
__property bool UseSharedBookmarks = { read = FUseSharedBookmarks, write = SetUseSharedBookmarks};
__property UnicodeString DDTemporaryDirectory = { read=FDDTemporaryDirectory, write=SetDDTemporaryDirectory };
__property bool DDWarnLackOfTempSpace = { read=FDDWarnLackOfTempSpace, write=SetDDWarnLackOfTempSpace };
__property bool DDExtEnabled = { read=FDDExtEnabled, write=SetDDExtEnabled };
__property bool DDFakeFile = { read=FDDFakeFile, write=SetDDFakeFile };
__property bool DDExtInstalled = { read=GetDDExtInstalled };
__property int DDExtTimeout = { read=FDDExtTimeout, write=SetDDExtTimeout };
__property bool ConfirmClosingSession = { read=FConfirmClosingSession, write=SetConfirmClosingSession };