- FIX: File browser "This PC" section empy

- FIX: File browser "Path incorrect" error on multiple folders selected
- FIX: File browser allowed addition of incorrect file share paths (will now throw an error when the path does not exist)
- Changed: Some changes to the UI for the file browser (no more dropdown select for "This PC". Instead a "localhost" entry is now added to the tree selection
This commit is contained in:
2026-05-28 12:41:05 +02:00
parent 2fd4860dc2
commit 3225a4fd8e
4 changed files with 82 additions and 90 deletions

View File

@@ -453,9 +453,11 @@ namespace Permissions
foreach (string f in folderList) foreach (string f in folderList)
{ {
updateDebugInfo("Checking if directory exists: " + f);
if (!Directory.Exists(f)) if (!Directory.Exists(f))
{ {
dirExists = false; dirExists = false;
updateDebugInfo(" dirExists: " + dirExists);
} }
} }

View File

@@ -35,14 +35,13 @@
this.treeView1 = new System.Windows.Forms.TreeView(); this.treeView1 = new System.Windows.Forms.TreeView();
this.folderScan = new System.ComponentModel.BackgroundWorker(); this.folderScan = new System.ComponentModel.BackgroundWorker();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.loading_pnl = new System.Windows.Forms.Panel(); this.loading_pnl = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.path_panel = new System.Windows.Forms.Panel();
this.startFrom_textbox = new System.Windows.Forms.TextBox(); this.startFrom_textbox = new System.Windows.Forms.TextBox();
this.refresh_button = new System.Windows.Forms.Button(); this.refresh_button = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.startFrom_select = new System.Windows.Forms.ComboBox();
this.path_panel = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.loading_pnl.SuspendLayout(); this.loading_pnl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -53,10 +52,9 @@
// //
this.Error_label.AutoSize = true; this.Error_label.AutoSize = true;
this.Error_label.ForeColor = System.Drawing.Color.DarkRed; this.Error_label.ForeColor = System.Drawing.Color.DarkRed;
this.Error_label.Location = new System.Drawing.Point(97, 418); this.Error_label.Location = new System.Drawing.Point(73, 340);
this.Error_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Error_label.Name = "Error_label"; this.Error_label.Name = "Error_label";
this.Error_label.Size = new System.Drawing.Size(78, 17); this.Error_label.Size = new System.Drawing.Size(57, 13);
this.Error_label.TabIndex = 4; this.Error_label.TabIndex = 4;
this.Error_label.Text = "Error_label"; this.Error_label.Text = "Error_label";
// //
@@ -64,19 +62,17 @@
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(205, 5); this.label1.Location = new System.Drawing.Point(154, 4);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(126, 20); this.label1.Size = new System.Drawing.Size(103, 16);
this.label1.TabIndex = 5; this.label1.TabIndex = 5;
this.label1.Text = "Select folders"; this.label1.Text = "Select folders";
// //
// ok_bttn // ok_bttn
// //
this.ok_bttn.Location = new System.Drawing.Point(101, 438); this.ok_bttn.Location = new System.Drawing.Point(76, 356);
this.ok_bttn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ok_bttn.Name = "ok_bttn"; this.ok_bttn.Name = "ok_bttn";
this.ok_bttn.Size = new System.Drawing.Size(212, 28); this.ok_bttn.Size = new System.Drawing.Size(159, 23);
this.ok_bttn.TabIndex = 6; this.ok_bttn.TabIndex = 6;
this.ok_bttn.Text = "OK"; this.ok_bttn.Text = "OK";
this.ok_bttn.UseVisualStyleBackColor = true; this.ok_bttn.UseVisualStyleBackColor = true;
@@ -84,10 +80,9 @@
// //
// cancel_bttn // cancel_bttn
// //
this.cancel_bttn.Location = new System.Drawing.Point(321, 438); this.cancel_bttn.Location = new System.Drawing.Point(241, 356);
this.cancel_bttn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cancel_bttn.Name = "cancel_bttn"; this.cancel_bttn.Name = "cancel_bttn";
this.cancel_bttn.Size = new System.Drawing.Size(100, 28); this.cancel_bttn.Size = new System.Drawing.Size(75, 23);
this.cancel_bttn.TabIndex = 7; this.cancel_bttn.TabIndex = 7;
this.cancel_bttn.Text = "Cancel"; this.cancel_bttn.Text = "Cancel";
this.cancel_bttn.UseVisualStyleBackColor = true; this.cancel_bttn.UseVisualStyleBackColor = true;
@@ -96,10 +91,9 @@
// treeView1 // treeView1
// //
this.treeView1.CheckBoxes = true; this.treeView1.CheckBoxes = true;
this.treeView1.Location = new System.Drawing.Point(3, 58); this.treeView1.Location = new System.Drawing.Point(2, 47);
this.treeView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.treeView1.Name = "treeView1"; this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(543, 356); this.treeView1.Size = new System.Drawing.Size(408, 290);
this.treeView1.TabIndex = 8; this.treeView1.TabIndex = 8;
this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand); this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand);
// //
@@ -110,7 +104,6 @@
// //
// panel1 // panel1
// //
this.panel1.Controls.Add(this.startFrom_select);
this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.loading_pnl); this.panel1.Controls.Add(this.loading_pnl);
this.panel1.Controls.Add(this.cancel_bttn); this.panel1.Controls.Add(this.cancel_bttn);
@@ -119,105 +112,89 @@
this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.ok_bttn); this.panel1.Controls.Add(this.ok_bttn);
this.panel1.Controls.Add(this.path_panel); this.panel1.Controls.Add(this.path_panel);
this.panel1.Location = new System.Drawing.Point(16, 13); this.panel1.Location = new System.Drawing.Point(12, 11);
this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(549, 476); this.panel1.Size = new System.Drawing.Size(412, 387);
this.panel1.TabIndex = 9; this.panel1.TabIndex = 9;
// //
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(32, 26);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(112, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Scan additional share:";
//
// loading_pnl // loading_pnl
// //
this.loading_pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.loading_pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.loading_pnl.Controls.Add(this.label2); this.loading_pnl.Controls.Add(this.label2);
this.loading_pnl.Controls.Add(this.pictureBox1); this.loading_pnl.Controls.Add(this.pictureBox1);
this.loading_pnl.Location = new System.Drawing.Point(196, 211); this.loading_pnl.Location = new System.Drawing.Point(147, 171);
this.loading_pnl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.loading_pnl.Name = "loading_pnl"; this.loading_pnl.Name = "loading_pnl";
this.loading_pnl.Size = new System.Drawing.Size(151, 64); this.loading_pnl.Size = new System.Drawing.Size(114, 52);
this.loading_pnl.TabIndex = 9; this.loading_pnl.TabIndex = 9;
this.loading_pnl.Visible = false; this.loading_pnl.Visible = false;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(57, 23); this.label2.Location = new System.Drawing.Point(43, 19);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 17); this.label2.Size = new System.Drawing.Size(56, 13);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
this.label2.Text = "Working..."; this.label2.Text = "Working...";
// //
// label3 // pictureBox1
// //
this.label3.AutoSize = true; this.pictureBox1.Image = global::Permissions.Properties.Resources.loading_transparent;
this.label3.Location = new System.Drawing.Point(14, 30); this.pictureBox1.InitialImage = global::Permissions.Properties.Resources.loading_transparent;
this.label3.Name = "label3"; this.pictureBox1.Location = new System.Drawing.Point(23, 15);
this.label3.Size = new System.Drawing.Size(74, 17); this.pictureBox1.Name = "pictureBox1";
this.label3.TabIndex = 10; this.pictureBox1.Size = new System.Drawing.Size(26, 27);
this.label3.Text = "Start from:"; this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// path_panel
//
this.path_panel.Controls.Add(this.startFrom_textbox);
this.path_panel.Controls.Add(this.refresh_button);
this.path_panel.Location = new System.Drawing.Point(146, 15);
this.path_panel.Margin = new System.Windows.Forms.Padding(2);
this.path_panel.Name = "path_panel";
this.path_panel.Size = new System.Drawing.Size(244, 33);
this.path_panel.TabIndex = 14;
this.path_panel.Visible = false;
// //
// startFrom_textbox // startFrom_textbox
// //
this.startFrom_textbox.Location = new System.Drawing.Point(3, 10); this.startFrom_textbox.Location = new System.Drawing.Point(2, 8);
this.startFrom_textbox.Margin = new System.Windows.Forms.Padding(2);
this.startFrom_textbox.Name = "startFrom_textbox"; this.startFrom_textbox.Name = "startFrom_textbox";
this.startFrom_textbox.Size = new System.Drawing.Size(254, 22); this.startFrom_textbox.Size = new System.Drawing.Size(192, 20);
this.startFrom_textbox.TabIndex = 11; this.startFrom_textbox.TabIndex = 11;
this.startFrom_textbox.Text = "\\\\server\\share"; this.startFrom_textbox.Text = "\\\\server\\share";
// //
// refresh_button // refresh_button
// //
this.refresh_button.Image = global::Permissions.Properties.Resources.refresh25x25; this.refresh_button.Image = global::Permissions.Properties.Resources.refresh25x25;
this.refresh_button.Location = new System.Drawing.Point(263, 7); this.refresh_button.Location = new System.Drawing.Point(197, 6);
this.refresh_button.Margin = new System.Windows.Forms.Padding(0); this.refresh_button.Margin = new System.Windows.Forms.Padding(0);
this.refresh_button.Name = "refresh_button"; this.refresh_button.Name = "refresh_button";
this.refresh_button.Size = new System.Drawing.Size(28, 28); this.refresh_button.Size = new System.Drawing.Size(32, 23);
this.refresh_button.TabIndex = 12; this.refresh_button.TabIndex = 12;
this.refresh_button.UseVisualStyleBackColor = true; this.refresh_button.UseVisualStyleBackColor = true;
this.refresh_button.Click += new System.EventHandler(this.refresh_button_Click); this.refresh_button.Click += new System.EventHandler(this.refresh_button_Click);
// //
// pictureBox1
//
this.pictureBox1.Image = global::Permissions.Properties.Resources.loading_transparent;
this.pictureBox1.InitialImage = global::Permissions.Properties.Resources.loading_transparent;
this.pictureBox1.Location = new System.Drawing.Point(31, 19);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(35, 33);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// startFrom_select
//
this.startFrom_select.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.startFrom_select.FormattingEnabled = true;
this.startFrom_select.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.startFrom_select.Items.AddRange(new object[] {
"This PC",
"Path:"});
this.startFrom_select.Location = new System.Drawing.Point(94, 27);
this.startFrom_select.Name = "startFrom_select";
this.startFrom_select.Size = new System.Drawing.Size(96, 24);
this.startFrom_select.TabIndex = 13;
this.startFrom_select.SelectedIndexChanged += new System.EventHandler(this.startFrom_select_SelectedIndexChanged);
//
// path_panel
//
this.path_panel.Controls.Add(this.startFrom_textbox);
this.path_panel.Controls.Add(this.refresh_button);
this.path_panel.Location = new System.Drawing.Point(195, 18);
this.path_panel.Name = "path_panel";
this.path_panel.Size = new System.Drawing.Size(326, 41);
this.path_panel.TabIndex = 14;
this.path_panel.Visible = false;
//
// multiPath // multiPath
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(585, 495); this.ClientSize = new System.Drawing.Size(439, 402);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "multiPath"; this.Name = "multiPath";
@@ -250,7 +227,6 @@
private System.Windows.Forms.Button refresh_button; private System.Windows.Forms.Button refresh_button;
private System.Windows.Forms.TextBox startFrom_textbox; private System.Windows.Forms.TextBox startFrom_textbox;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox startFrom_select;
private System.Windows.Forms.Panel path_panel; private System.Windows.Forms.Panel path_panel;
} }
} }

View File

@@ -22,8 +22,19 @@ namespace Permissions
{ {
InitializeComponent(); InitializeComponent();
Error_label.Visible = false; Error_label.Visible = false;
startFrom_select.SelectedIndex = 0;
makeDocumentTree(); path_panel.Visible = true;
string[] drives = System.IO.Directory.GetLogicalDrives(); // Get local drives
foreach (string str in drives)
{
string strShare = "\\\\localhost\\" + str.Replace(":\\", "$\\"); ;
basePath = strShare;
makeDocumentTree();
}
} }
private void cancel_bttn_Click(object sender, EventArgs e) private void cancel_bttn_Click(object sender, EventArgs e)
@@ -230,13 +241,19 @@ namespace Permissions
private void startFrom_select_SelectedIndexChanged(object sender, EventArgs e) private void startFrom_select_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (startFrom_select.SelectedIndex == 1) { path_panel.Visible = true; } else { path_panel.Visible = false; makeDocumentTree(); };
} }
private void refresh_button_Click(object sender, EventArgs e) private void refresh_button_Click(object sender, EventArgs e)
{ {
basePath = startFrom_textbox.Text; if (!Directory.Exists(startFrom_textbox.Text))
makeDocumentTree(); { Error_label.Text = "Invalid path: " + startFrom_textbox.Text; Error_label.Visible = true; }
else
{
Error_label.Text = ""; Error_label.Visible = false;
basePath = startFrom_textbox.Text;
makeDocumentTree();
}
} }
} }
} }

View File

@@ -112,15 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="folderScan.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="folderScan.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="startFrom_select.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>