summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UConfig.pas8
-rw-r--r--UConnectionManager.pas12
-rw-r--r--UGnome.pas10
-rw-r--r--UMain.pas85
-rw-r--r--UQuickConnect.pas12
5 files changed, 81 insertions, 46 deletions
diff --git a/UConfig.pas b/UConfig.pas
index a58363a..e4f919f 100644
--- a/UConfig.pas
+++ b/UConfig.pas
@@ -103,7 +103,7 @@ var ConfPanelSep, ConfRowHeight, ConfRowHeightReal, ConfNumHistoryItems,
ConfMounterUseFSTab, ConfShowTextUIDs, ConfMounterPushDown, ConfSavePanelTabs, ConfDuplicateTabWarning,
ConfOpenConnectionsWarning, ConfSortDirectoriesLikeFiles, ConfQuickRenameSkipExt, ConfRightClickSelect,
ConfSearchFilterCaseSensitive, ConfSearchOtherFS, ConfSearchArchives, ConfSearchTextCaseSensitive,
- ConfMakeSymlinkRelative: boolean;
+ ConfMakeSymlinkRelative, ConfReplaceConnectionWarning, ConfWarnUnsavedConnection: boolean;
ConfShowMounterBar: integer;
ConfColumnSizes, ConfColumnIDs: array[1..ConstNumPanelColumns] of integer;
@@ -271,6 +271,8 @@ begin
ConfSearchArchives := False;
ConfSearchTextCaseSensitive := False;
ConfMakeSymlinkRelative := False;
+ ConfReplaceConnectionWarning := True;
+ ConfWarnUnsavedConnection := True;
// Setup default values for colors
@@ -517,6 +519,8 @@ begin
(********************************************* NEW SINCE 0.6.55 *************************************************)
ConfRightClickSelect := IniFile.ReadBool(ConfProfileName, 'RightClickSelect', ConfRightClickSelect);
+ ConfReplaceConnectionWarning := IniFile.ReadBool(ConfProfileName, 'ReplaceConnectionWarning', ConfReplaceConnectionWarning);
+ ConfWarnUnsavedConnection := IniFile.ReadBool(ConfProfileName, 'WarnUnsavedConnection', ConfWarnUnsavedConnection);
SearchForDefaultApps;
@@ -610,6 +614,8 @@ begin
(********************************************* NEW SINCE 0.6.55 *************************************************)
IniFile.WriteBool(ConfProfileName, 'RightClickSelect', ConfRightClickSelect);
+ IniFile.WriteBool(ConfProfileName, 'ReplaceConnectionWarning', ConfReplaceConnectionWarning);
+ IniFile.WriteBool(ConfProfileName, 'WarnUnsavedConnection', ConfWarnUnsavedConnection);
except
on E: Exception do DebugMsg(['*** Error: Cannot save user settings (', E.ClassName, '): ', E.Message]);
diff --git a/UConnectionManager.pas b/UConnectionManager.pas
index f7c2993..026a975 100644
--- a/UConnectionManager.pas
+++ b/UConnectionManager.pas
@@ -534,6 +534,8 @@ var Engine: TVFSEngine;
i, j: integer;
VFSPlugin: TVFSPlugin;
FActiveConnInfo: TConnMgrItem;
+ DontShowAgain: boolean;
+ res: TMessageButton;
begin
FActiveConnInfo := nil;
if ListView.Selected <> nil then FActiveConnInfo := ListView.Selected.AsPointer(0);
@@ -565,7 +567,15 @@ begin
if VFSPlugin = nil then VFSPlugin := PluginList[0]; // Fallback in hope some other plugin can handle it
end;
- if (SourcePanelEngine is TVFSEngine) and (Application.MessageBox(PGtkWindow(FWidget), LANGCloseOpenConnection, [mbYes, mbNo], mbWarning, mbYes, mbNo) <> mbYes) then Exit;
+ if (SourcePanelEngine is TVFSEngine) and ConfReplaceConnectionWarning then begin
+ DontShowAgain := False;
+ res := MessageBoxShowOnce(PGtkWindow(FWidget), LANGCloseOpenConnection, LANGDontShowAgain, DontShowAgain, [mbYes, mbNo], mbWarning, mbYes, mbNo);
+ if DontShowAgain then begin
+ ConfReplaceConnectionWarning := False;
+ WriteMainGUISettings;
+ end;
+ if res <> mbYes then Exit;
+ end;
ListViewTable.Enabled := False;
CloseButton.Enabled := False;
diff --git a/UGnome.pas b/UGnome.pas
index 347d0b6..709da4a 100644
--- a/UGnome.pas
+++ b/UGnome.pas
@@ -144,7 +144,7 @@ type TGnomeColorButton = class(TGTKButton)
-function MessageBoxShowOnce(const Text: string; const DontShowAgainText: string; var DontShowAgainChecked: boolean;
+function MessageBoxShowOnce(ParentWindow: PGtkWindow; const Text: string; const DontShowAgainText: string; var DontShowAgainChecked: boolean;
Buttons: TMessageButtons = [mbOK]; Style: TMessageStyle = mbInfo;
Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton;
@@ -1191,12 +1191,11 @@ begin
end;
end;
-function MessageBoxShowOnce(const Text: string; const DontShowAgainText: string; var DontShowAgainChecked: boolean;
+function MessageBoxShowOnce(ParentWindow: PGtkWindow; const Text: string; const DontShowAgainText: string; var DontShowAgainChecked: boolean;
Buttons: TMessageButtons = [mbOK]; Style: TMessageStyle = mbInfo;
Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton;
const TMessageStyleID : array[0..3] of TGtkMessageType = (GTK_MESSAGE_ERROR, GTK_MESSAGE_INFO, GTK_MESSAGE_QUESTION, GTK_MESSAGE_WARNING);
var Dialog: PGtkWidget;
- DialogParent: PGtkWindow;
CheckBox: PGtkCheckButton;
i: integer;
begin
@@ -1205,10 +1204,7 @@ begin
Result := Escape;
Exit;
end;
- if Screen.FormCount > 0
- then DialogParent := PGtkWindow(Screen.Forms[0].FWidget)
- else DialogParent := nil;
- Dialog := gtk_message_dialog_new(DialogParent, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
+ Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
GTK_BUTTONS_NONE, StringToPgchar(Text));
CheckBox := PGtkCheckButton(gtk_check_button_new_with_mnemonic(StringToPgchar(DontShowAgainText)));
gtk_widget_show(PGtkWidget(CheckBox));
diff --git a/UMain.pas b/UMain.pas
index f6d8b08..b78bbe6 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -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;
diff --git a/UQuickConnect.pas b/UQuickConnect.pas
index 7533bd4..91be256 100644
--- a/UQuickConnect.pas
+++ b/UQuickConnect.pas
@@ -269,6 +269,8 @@ var Engine: TVFSEngine;
i, j: integer;
VFSPlugin: TVFSPlugin;
URI, Scheme: string;
+ DontShowAgain: boolean;
+ res: TMessageButton;
begin
if ConnectionManager <> nil then AFConnectionManager := ConnectionManager
else AFConnectionManager := TFConnectionManager.Create(Self);
@@ -304,7 +306,15 @@ begin
if VFSPlugin = nil then VFSPlugin := PluginList[0]; // Fallback in hope some other plugin can handle it
end;
- if (SourcePanelEngine is TVFSEngine) and (Application.MessageBox(PGtkWindow(FWidget), LANGCloseOpenConnection, [mbYes, mbNo], mbWarning, mbYes, mbNo) <> mbYes) then Exit;
+ if (SourcePanelEngine is TVFSEngine) and ConfReplaceConnectionWarning then begin
+ DontShowAgain := False;
+ res := MessageBoxShowOnce(PGtkWindow(FWidget), LANGCloseOpenConnection, LANGDontShowAgain, DontShowAgain, [mbYes, mbNo], mbWarning, mbYes, mbNo);
+ if DontShowAgain then begin
+ ConfReplaceConnectionWarning := False;
+ WriteMainGUISettings;
+ end;
+ if res <> mbYes then Exit;
+ end;
Table.Enabled := False;
CloseButton.Enabled := False;