summaryrefslogtreecommitdiff
path: root/UMain.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-10-12 12:16:57 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-10-12 12:16:57 +0200
commit928e2dc79b46a455ef0c0096ddf40682e07b4a27 (patch)
tree85cf08ae19bdd5ac44261802b2e16972cc38e792 /UMain.pas
parentc29edff595cff9d43a607c15b5af6e2ec101263a (diff)
downloadtuxcmd-928e2dc79b46a455ef0c0096ddf40682e07b4a27.tar.xz
Implement VFS question and password callbacksv0.6.53
Diffstat (limited to 'UMain.pas')
-rw-r--r--UMain.pas50
1 files changed, 42 insertions, 8 deletions
diff --git a/UMain.pas b/UMain.pas
index 89a5b2c..c01b01f 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -1743,21 +1743,40 @@ var ListView: TGTKListView;
OpenDirThread.Resume;
tt := Now;
b := False;
- FRemoteWait := nil;
+ FRemoteWait := TFRemoteWait.Create(Application);
+ FRemoteWait.ParentForm := FMain;
repeat
Sleep(ConstInternalProgressTimer);
// DebugMsg([' (II) TFMain.ChangingDir: sleep.']);
Application.ProcessMessages;
if not b and (MilliSecondsBetween(tt, Now) >= ConstRemoteWaitDialogDelay) then begin
- FRemoteWait := TFRemoteWait.Create(Application);
- FRemoteWait.ParentForm := FMain;
FRemoteWait.ShowModal;
b := True;
end;
- if Assigned(FRemoteWait) then
- if FRemoteWait.Cancelled then OpenDirThread.CancelIt := True;
+ if FRemoteWait.Cancelled then OpenDirThread.CancelIt := True;
+ if OpenDirThread.VFSAskQuestion_Display then begin
+ OpenDirThread.VFSAskQuestion_Display := False;
+ DebugMsg(['Main thread: displaying question dialog']);
+ HandleVFSAskQuestionCallback(FRemoteWait.FWidget, OpenDirThread.VFSAskQuestion_Message, OpenDirThread.VFSAskQuestion_Choices, OpenDirThread.VFSAskQuestion_Choice);
+ OpenDirThread.VFSCallbackEvent.SetEvent;
+ end;
+ if OpenDirThread.VFSAskPassword_Display then begin
+ OpenDirThread.VFSAskPassword_Display := False;
+ DebugMsg(['Main thread: displaying password prompt']);
+ OpenDirThread.VFSAskPassword_Result := HandleVFSAskPasswordCallback(FRemoteWait.FWidget,
+ OpenDirThread.VFSAskPassword_Message,
+ OpenDirThread.VFSAskPassword_default_user,
+ OpenDirThread.VFSAskPassword_default_domain,
+ OpenDirThread.VFSAskPassword_flags,
+ OpenDirThread.VFSAskPassword_username,
+ OpenDirThread.VFSAskPassword_password,
+ OpenDirThread.VFSAskPassword_anonymous,
+ OpenDirThread.VFSAskPassword_domain,
+ OpenDirThread.VFSAskPassword_password_save);
+ OpenDirThread.VFSCallbackEvent.SetEvent;
+ end;
until OpenDirThread.Finished;
- if FRemoteWait <> nil then FRemoteWait.Free;
+ FRemoteWait.Free;
DebugMsg(['(II) TFMain.ChangingDir: end thread, running time = ', OpenDirThread.RunningTime, 'ms']);
except
on E: Exception do DebugMsg(['*** Exception raised in TFMain.ChangingDir:DoThread (', E.ClassName, '): ', E.Message]);
@@ -5246,7 +5265,7 @@ begin
FTestPlugin := TFTestPlugin.Create(Self);
if (FTestPlugin.Run = mbOK) and (PluginList.Count > 0) then begin
Engine := TVFSEngine.Create(PluginList[FTestPlugin.PluginOptionMenu.ItemIndex]);
- if not Engine.VFSOpenURI(FTestPlugin.CommandEntry.Text) then begin
+ if not Engine.VFSOpenURI(FTestPlugin.CommandEntry.Text, nil, nil, nil) then begin
Application.MessageBox(LANGCouldntOpenURI, [mbOK], mbError, mbOK, mbOK);
Exit;
end;
@@ -5939,6 +5958,21 @@ end;
(********************************************************************************************************************************)
(********************************************************************************************************************************)
+procedure vfs_ask_question_callback(const AMessage: PChar; const Choices: PPChar; choice: PInteger; user_data: Pointer); cdecl;
+begin
+// DebugMsg(['******* vfs_ask_question_callback spawned, user_data = 0x', IntToHex(QWord(user_data), 16), ', ThreadID = 0x', IntToHex(pthread_self, 16)]);
+ HandleVFSAskQuestionCallback(user_data, AMessage, Choices, choice);
+end;
+
+function vfs_ask_password_callback(const AMessage: PChar; const default_user: PChar; const default_domain: PChar; flags: TVFSAskPasswordFlags;
+ username, password: PPChar; anonymous: PInteger; domain: PPChar; password_save: PVFSPasswordSave;
+ user_data: Pointer): LongBool; cdecl;
+begin
+// DebugMsg(['******* vfs_ask_password_callback spawned, user_data = 0x', IntToHex(QWord(user_data), 16), ', ThreadID = 0x', IntToHex(pthread_self, 16)]);
+ Result := HandleVFSAskPasswordCallback(user_data, AMessage, default_user, default_domain, flags, username, password, anonymous, domain, password_save);
+// DebugMsg(['after vfs_ask_password_callback: password = ', password^]);
+end;
+
procedure TFMain.miOpenConnectionClick(Sender: TObject);
var Engine: TVFSEngine;
SourceEngine: TPanelEngine;
@@ -6004,7 +6038,7 @@ begin
FRemoteWait.ParentForm := FConnectionManager;
FRemoteWait.ShowModal;
Application.ProcessMessages;
- b := Engine.VFSOpenURI(UTF8ToStr(ConnInfo.URI));
+ b := Engine.VFSOpenURI(UTF8ToStr(ConnInfo.URI), @vfs_ask_question_callback, @vfs_ask_password_callback, FRemoteWait.FWidget);
FRemoteWait.Free;
if not b then begin
Application.MessageBox(LANGCouldntOpenURI, [mbOK], mbError, mbOK, mbOK);