diff options
Diffstat (limited to 'UMain.pas')
| -rw-r--r-- | UMain.pas | 85 |
1 files changed, 49 insertions, 36 deletions
@@ -1147,8 +1147,10 @@ begin Break; end; b := b or (LeftPanelEngine is TVFSEngine) or (RightPanelEngine is TVFSEngine); + +(* -- Disabled, makes users confused. We have that 'usaved connection' message now anyway if b and ConfOpenConnectionsWarning then begin - res := MessageBoxShowOnce(LANGOpenConnectionsWarning, LANGDontShowAgain, DontShowAgain, [mbYes, mbNo], mbWarning, mbYes, mbNo); + res := MessageBoxShowOnce(PGtkWindow(FWidget), LANGOpenConnectionsWarning, LANGDontShowAgain, DontShowAgain, [mbYes, mbNo], mbWarning, mbYes, mbNo); if DontShowAgain then begin ConfOpenConnectionsWarning := False; WriteMainGUISettings; @@ -1158,7 +1160,7 @@ begin Exit; end; end; - +*) ApplicationShuttingDown := True; // Avoid emitting config files refresh event // Close all active connections @@ -3485,7 +3487,7 @@ begin if not (SrcEngine is TLocalTreeEngine) then begin if ConfSwitchOtherPanelBehaviour < 0 then begin - MessageBoxShowOnce(LANGSwitchOtherPanelWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbWarning, mbOK, mbOK); + MessageBoxShowOnce(PGtkWindow(FWidget), LANGSwitchOtherPanelWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbWarning, mbOK, mbOK); if DontShowAgain then begin ConfSwitchOtherPanelBehaviour := 1; WriteMainGUISettings; @@ -4953,7 +4955,7 @@ begin ((not (TargetEngine is TLocalTreeEngine)) and (LeftPanel = LeftArrowPressed)) then begin if ConfSwitchOtherPanelBehaviour < 0 then begin - MessageBoxShowOnce(LANGSwitchOtherPanelWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbWarning, mbOK, mbOK); + MessageBoxShowOnce(PGtkWindow(FWidget), LANGSwitchOtherPanelWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbWarning, mbOK, mbOK); if DontShowAgain then begin ConfSwitchOtherPanelBehaviour := 1; WriteMainGUISettings; @@ -5527,7 +5529,7 @@ begin end; // Show warning that we couldn't duplicate the VFS location if ConfDuplicateTabWarning then begin - MessageBoxShowOnce(LANGDuplicateTabWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbInfo, mbOK, mbOK); + MessageBoxShowOnce(PGtkWindow(FWidget), LANGDuplicateTabWarning, LANGDontShowAgain, DontShowAgain, [mbOK], mbInfo, mbOK, mbOK); if DontShowAgain then begin ConfDuplicateTabWarning := False; WriteMainGUISettings; @@ -6067,6 +6069,8 @@ var Buttons: TMessageButtons; URI: string; ConnMgrItem: TConnMgrItem; i: integer; + DontShowAgain: boolean; + res: TMessageButton; begin Result := True; URI := Engine.GetPathURI; @@ -6077,39 +6081,48 @@ begin Include(Buttons, mbCancel); CancelButton := mbCancel; end; - case Application.MessageBox('The active connection has not been saved. Do you want to save it to Connection Manager?', Buttons, mbWarning, mbYes, CancelButton) of - mbYes: begin - AFConnectionProperties := TFConnectionProperties.Create(Self); - try - AFConnectionProperties.URIEntry.Text := URI; - if (Engine.CustomPluginIDSave <> '') and (AFConnectionProperties.PluginOptionMenu.Items.Count > 0) then - for i := 0 to PluginList.Count - 1 do - if TVFSPlugin(PluginList[i]).VFSName = Engine.CustomPluginIDSave - then AFConnectionProperties.PluginOptionMenu.ItemIndex := i + 1; - if AFConnectionProperties.Run = mbOK then begin - ReadConnections; - ConnMgrItem := TConnMgrItem.Create; - ConnMgrItem.ConnectionName := AFConnectionProperties.NameEntry.Text; - ConnMgrItem.ServiceType := AFConnectionProperties.GetService; - ConnMgrItem.Server := AFConnectionProperties.ServerEntry.Text; - ConnMgrItem.Username := AFConnectionProperties.UserNameEntry.Text; - ConnMgrItem.Password := AFConnectionProperties.PasswordEntry.Text; - ConnMgrItem.TargetDir := AFConnectionProperties.TargetDirEntry.Text; - ConnMgrItem.PluginID := ''; - if AFConnectionProperties.PluginOptionMenu.ItemIndex <> 0 then - ConnMgrItem.PluginID := TVFSPlugin(PluginList[AFConnectionProperties.PluginOptionMenu.ItemIndex - 1]).VFSName; - ConfConnMgrActiveItem := ConnectionMgrList.Add(ConnMgrItem); - WriteConnections; + + if ConfWarnUnsavedConnection then begin + DontShowAgain := False; + res := MessageBoxShowOnce(PGtkWindow(FWidget), PChar(Format('The active connection has not been saved. Do you want to save it to Connection Manager?'#10#10'%s', [Engine.GetPathURI])), LANGDontShowAgain, DontShowAgain, Buttons, mbWarning, mbNo, CancelButton); + if DontShowAgain then begin + ConfWarnUnsavedConnection := False; + WriteMainGUISettings; + end; + case res of + mbYes: begin + AFConnectionProperties := TFConnectionProperties.Create(Self); + try + AFConnectionProperties.URIEntry.Text := URI; + if (Engine.CustomPluginIDSave <> '') and (AFConnectionProperties.PluginOptionMenu.Items.Count > 0) then + for i := 0 to PluginList.Count - 1 do + if TVFSPlugin(PluginList[i]).VFSName = Engine.CustomPluginIDSave + then AFConnectionProperties.PluginOptionMenu.ItemIndex := i + 1; + if AFConnectionProperties.Run = mbOK then begin + ReadConnections; + ConnMgrItem := TConnMgrItem.Create; + ConnMgrItem.ConnectionName := AFConnectionProperties.NameEntry.Text; + ConnMgrItem.ServiceType := AFConnectionProperties.GetService; + ConnMgrItem.Server := AFConnectionProperties.ServerEntry.Text; + ConnMgrItem.Username := AFConnectionProperties.UserNameEntry.Text; + ConnMgrItem.Password := AFConnectionProperties.PasswordEntry.Text; + ConnMgrItem.TargetDir := AFConnectionProperties.TargetDirEntry.Text; + ConnMgrItem.PluginID := ''; + if AFConnectionProperties.PluginOptionMenu.ItemIndex <> 0 then + ConnMgrItem.PluginID := TVFSPlugin(PluginList[AFConnectionProperties.PluginOptionMenu.ItemIndex - 1]).VFSName; + ConfConnMgrActiveItem := ConnectionMgrList.Add(ConnMgrItem); + WriteConnections; + end; + finally + AFConnectionProperties.Free; end; - finally - AFConnectionProperties.Free; + Result := True; end; - Result := True; - end; - mbNo: Result := True; - mbCancel: Result := False; - else {Cancel?} Result := not AllowCancel; - end; + mbNo: Result := True; + mbCancel: Result := False; + else {Cancel?} Result := not AllowCancel; + end; + end else Result := True; end; end; |
