diff --git a/KeeOneDriveSync.plgx b/KeeOneDriveSync.plgx index 39b0a30..fdab2b2 100644 Binary files a/KeeOneDriveSync.plgx and b/KeeOneDriveSync.plgx differ diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.Designer.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.Designer.cs index a8ddbc5..a404f7e 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.Designer.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.NoNeverAskAgainRadio = new System.Windows.Forms.RadioButton(); this.OKButton = new System.Windows.Forms.Button(); this.CancelButton = new System.Windows.Forms.Button(); + this.OneDriveDatabasePath = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // ExplanationLabel @@ -43,16 +44,17 @@ private void InitializeComponent() this.ExplanationLabel.Location = new System.Drawing.Point(9, 7); this.ExplanationLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ExplanationLabel.Name = "ExplanationLabel"; - this.ExplanationLabel.Size = new System.Drawing.Size(375, 49); + this.ExplanationLabel.Size = new System.Drawing.Size(375, 35); this.ExplanationLabel.TabIndex = 0; - this.ExplanationLabel.Text = "This KeePass database is not being synced with OneDrive. Would you like to set up" + - " a synchronization connection now?"; + this.ExplanationLabel.Text = "The following KeePass database is not being synced with OneDrive. Would you like " + + "to set up a synchronization connection now?"; // // YesRadio // + this.YesRadio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.YesRadio.AutoSize = true; this.YesRadio.Checked = true; - this.YesRadio.Location = new System.Drawing.Point(11, 58); + this.YesRadio.Location = new System.Drawing.Point(11, 75); this.YesRadio.Margin = new System.Windows.Forms.Padding(2); this.YesRadio.Name = "YesRadio"; this.YesRadio.Size = new System.Drawing.Size(43, 17); @@ -63,8 +65,9 @@ private void InitializeComponent() // // NotNowRadio // + this.NotNowRadio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.NotNowRadio.AutoSize = true; - this.NotNowRadio.Location = new System.Drawing.Point(11, 80); + this.NotNowRadio.Location = new System.Drawing.Point(11, 97); this.NotNowRadio.Margin = new System.Windows.Forms.Padding(2); this.NotNowRadio.Name = "NotNowRadio"; this.NotNowRadio.Size = new System.Drawing.Size(65, 17); @@ -74,8 +77,9 @@ private void InitializeComponent() // // NoNeverAskAgainRadio // + this.NoNeverAskAgainRadio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.NoNeverAskAgainRadio.AutoSize = true; - this.NoNeverAskAgainRadio.Location = new System.Drawing.Point(11, 101); + this.NoNeverAskAgainRadio.Location = new System.Drawing.Point(11, 118); this.NoNeverAskAgainRadio.Margin = new System.Windows.Forms.Padding(2); this.NoNeverAskAgainRadio.Name = "NoNeverAskAgainRadio"; this.NoNeverAskAgainRadio.Size = new System.Drawing.Size(220, 17); @@ -86,7 +90,7 @@ private void InitializeComponent() // OKButton // this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.OKButton.Location = new System.Drawing.Point(127, 133); + this.OKButton.Location = new System.Drawing.Point(127, 154); this.OKButton.Margin = new System.Windows.Forms.Padding(2); this.OKButton.Name = "OKButton"; this.OKButton.Size = new System.Drawing.Size(74, 41); @@ -99,7 +103,7 @@ private void InitializeComponent() // this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelButton.Location = new System.Drawing.Point(206, 133); + this.CancelButton.Location = new System.Drawing.Point(206, 154); this.CancelButton.Margin = new System.Windows.Forms.Padding(2); this.CancelButton.Name = "CancelButton"; this.CancelButton.Size = new System.Drawing.Size(74, 41); @@ -107,12 +111,27 @@ private void InitializeComponent() this.CancelButton.Text = "&Cancel"; this.CancelButton.UseVisualStyleBackColor = true; // + // OneDriveDatabasePath + // + this.OneDriveDatabasePath.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.OneDriveDatabasePath.BackColor = System.Drawing.SystemColors.Control; + this.OneDriveDatabasePath.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.OneDriveDatabasePath.Location = new System.Drawing.Point(12, 45); + this.OneDriveDatabasePath.Name = "OneDriveDatabasePath"; + this.OneDriveDatabasePath.ReadOnly = true; + this.OneDriveDatabasePath.Size = new System.Drawing.Size(369, 13); + this.OneDriveDatabasePath.TabIndex = 7; + this.OneDriveDatabasePath.Text = "?"; + // // OneDriveAskToStartSyncingDialog // this.AcceptButton = this.OKButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(393, 184); + this.ClientSize = new System.Drawing.Size(393, 205); + this.Controls.Add(this.OneDriveDatabasePath); this.Controls.Add(this.CancelButton); this.Controls.Add(this.OKButton); this.Controls.Add(this.NoNeverAskAgainRadio); @@ -122,7 +141,7 @@ private void InitializeComponent() this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(409, 223); + this.MinimumSize = new System.Drawing.Size(409, 244); this.Name = "OneDriveAskToStartSyncingDialog"; this.ShowIcon = false; this.ShowInTaskbar = false; @@ -141,5 +160,6 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton YesRadio; private System.Windows.Forms.RadioButton NotNowRadio; private System.Windows.Forms.RadioButton NoNeverAskAgainRadio; - } + private System.Windows.Forms.TextBox OneDriveDatabasePath; + } } \ No newline at end of file diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.cs index 2bce33d..d693a1c 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveAskToStartSyncingDialog.cs @@ -16,6 +16,8 @@ public OneDriveAskToStartSyncingDialog(Configuration configuration) InitializeComponent(); _configuration = configuration; + + OneDriveDatabasePath.Text = configuration.KeePassDatabase.IOConnectionInfo.Path; } private void OKButton_Click(object sender, EventArgs e) diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveCloudTypeForm.Designer.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveCloudTypeForm.Designer.cs index c5c978c..3e1876e 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveCloudTypeForm.Designer.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveCloudTypeForm.Designer.cs @@ -34,11 +34,11 @@ private void InitializeComponent() this.OneDriveTab = new System.Windows.Forms.TabPage(); this.GraphPictureButton = new System.Windows.Forms.Button(); this.SharePointTab = new System.Windows.Forms.TabPage(); + this.SharePointPictureButton = new System.Windows.Forms.Button(); this.OtherTab = new System.Windows.Forms.TabPage(); this.OtherLabel = new System.Windows.Forms.Label(); this.OneDriveForBusinessPictureButton = new System.Windows.Forms.Button(); this.OneDriveConsumerPictureButton = new System.Windows.Forms.Button(); - this.SharePointPictureButton = new System.Windows.Forms.Button(); this.CloudPlatformTabs.SuspendLayout(); this.OneDriveTab.SuspendLayout(); this.SharePointTab.SuspendLayout(); @@ -50,10 +50,10 @@ private void InitializeComponent() this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelButton.Location = new System.Drawing.Point(177, 346); - this.CancelButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.CancelButton.Location = new System.Drawing.Point(133, 281); + this.CancelButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.CancelButton.Name = "CancelButton"; - this.CancelButton.Size = new System.Drawing.Size(149, 35); + this.CancelButton.Size = new System.Drawing.Size(112, 28); this.CancelButton.TabIndex = 1; this.CancelButton.Text = "Cancel"; this.CancelButton.UseVisualStyleBackColor = true; @@ -63,9 +63,10 @@ private void InitializeComponent() // this.ExplanationLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ExplanationLabel.Location = new System.Drawing.Point(20, 7); + this.ExplanationLabel.Location = new System.Drawing.Point(15, 6); + this.ExplanationLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ExplanationLabel.Name = "ExplanationLabel"; - this.ExplanationLabel.Size = new System.Drawing.Size(472, 29); + this.ExplanationLabel.Size = new System.Drawing.Size(354, 24); this.ExplanationLabel.TabIndex = 0; this.ExplanationLabel.Text = "Choose the cloud service you wish to store the KeePass database on:"; // @@ -77,20 +78,20 @@ private void InitializeComponent() this.CloudPlatformTabs.Controls.Add(this.OneDriveTab); this.CloudPlatformTabs.Controls.Add(this.SharePointTab); this.CloudPlatformTabs.Controls.Add(this.OtherTab); - this.CloudPlatformTabs.Location = new System.Drawing.Point(23, 38); - this.CloudPlatformTabs.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.CloudPlatformTabs.Location = new System.Drawing.Point(17, 31); + this.CloudPlatformTabs.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.CloudPlatformTabs.Name = "CloudPlatformTabs"; this.CloudPlatformTabs.SelectedIndex = 0; - this.CloudPlatformTabs.Size = new System.Drawing.Size(457, 303); + this.CloudPlatformTabs.Size = new System.Drawing.Size(343, 246); this.CloudPlatformTabs.TabIndex = 0; // // OneDriveTab // this.OneDriveTab.Controls.Add(this.GraphPictureButton); - this.OneDriveTab.Location = new System.Drawing.Point(4, 25); - this.OneDriveTab.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.OneDriveTab.Location = new System.Drawing.Point(4, 22); + this.OneDriveTab.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OneDriveTab.Name = "OneDriveTab"; - this.OneDriveTab.Size = new System.Drawing.Size(449, 274); + this.OneDriveTab.Size = new System.Drawing.Size(335, 220); this.OneDriveTab.TabIndex = 0; this.OneDriveTab.Text = "OneDrive"; this.OneDriveTab.UseVisualStyleBackColor = true; @@ -101,9 +102,10 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.GraphPictureButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.GraphPictureButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.GraphPictureButton.Location = new System.Drawing.Point(10, 14); + this.GraphPictureButton.Location = new System.Drawing.Point(8, 11); + this.GraphPictureButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.GraphPictureButton.Name = "GraphPictureButton"; - this.GraphPictureButton.Size = new System.Drawing.Size(429, 120); + this.GraphPictureButton.Size = new System.Drawing.Size(322, 98); this.GraphPictureButton.TabIndex = 0; this.GraphPictureButton.Text = "OneDrive & OneDrive for Business"; this.GraphPictureButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -114,23 +116,41 @@ private void InitializeComponent() // SharePointTab // this.SharePointTab.Controls.Add(this.SharePointPictureButton); - this.SharePointTab.Location = new System.Drawing.Point(4, 25); - this.SharePointTab.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.SharePointTab.Location = new System.Drawing.Point(4, 22); + this.SharePointTab.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SharePointTab.Name = "SharePointTab"; - this.SharePointTab.Size = new System.Drawing.Size(449, 274); + this.SharePointTab.Size = new System.Drawing.Size(335, 220); this.SharePointTab.TabIndex = 1; this.SharePointTab.Text = "SharePoint"; this.SharePointTab.UseVisualStyleBackColor = true; // + // SharePointPictureButton + // + this.SharePointPictureButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.SharePointPictureButton.BackColor = System.Drawing.Color.White; + this.SharePointPictureButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.SharePointPictureButton.ForeColor = System.Drawing.SystemColors.ControlText; + this.SharePointPictureButton.Location = new System.Drawing.Point(8, 11); + this.SharePointPictureButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.SharePointPictureButton.Name = "SharePointPictureButton"; + this.SharePointPictureButton.Size = new System.Drawing.Size(322, 84); + this.SharePointPictureButton.TabIndex = 8; + this.SharePointPictureButton.Text = "SharePoint 2013, 2016, 2019 & Online"; + this.SharePointPictureButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; + this.SharePointPictureButton.UseMnemonic = false; + this.SharePointPictureButton.UseVisualStyleBackColor = false; + this.SharePointPictureButton.Click += new System.EventHandler(this.SharePointPictureButton_Click); + // // OtherTab // this.OtherTab.Controls.Add(this.OtherLabel); this.OtherTab.Controls.Add(this.OneDriveForBusinessPictureButton); this.OtherTab.Controls.Add(this.OneDriveConsumerPictureButton); - this.OtherTab.Location = new System.Drawing.Point(4, 25); - this.OtherTab.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.OtherTab.Location = new System.Drawing.Point(4, 22); + this.OtherTab.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OtherTab.Name = "OtherTab"; - this.OtherTab.Size = new System.Drawing.Size(449, 274); + this.OtherTab.Size = new System.Drawing.Size(335, 220); this.OtherTab.TabIndex = 2; this.OtherTab.Text = "Other"; this.OtherTab.UseVisualStyleBackColor = true; @@ -140,9 +160,10 @@ private void InitializeComponent() this.OtherLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.OtherLabel.Location = new System.Drawing.Point(14, 14); + this.OtherLabel.Location = new System.Drawing.Point(10, 11); + this.OtherLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.OtherLabel.Name = "OtherLabel"; - this.OtherLabel.Size = new System.Drawing.Size(425, 27); + this.OtherLabel.Size = new System.Drawing.Size(319, 22); this.OtherLabel.TabIndex = 9; this.OtherLabel.Text = "Only use these if the OneDrive tab doesn\'t work"; this.OtherLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -153,9 +174,10 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.OneDriveForBusinessPictureButton.BackColor = System.Drawing.Color.White; this.OneDriveForBusinessPictureButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.OneDriveForBusinessPictureButton.Location = new System.Drawing.Point(10, 157); + this.OneDriveForBusinessPictureButton.Location = new System.Drawing.Point(8, 128); + this.OneDriveForBusinessPictureButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OneDriveForBusinessPictureButton.Name = "OneDriveForBusinessPictureButton"; - this.OneDriveForBusinessPictureButton.Size = new System.Drawing.Size(429, 104); + this.OneDriveForBusinessPictureButton.Size = new System.Drawing.Size(322, 84); this.OneDriveForBusinessPictureButton.TabIndex = 8; this.OneDriveForBusinessPictureButton.Text = "OneDrive for Business"; this.OneDriveForBusinessPictureButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -169,41 +191,25 @@ private void InitializeComponent() this.OneDriveConsumerPictureButton.BackColor = System.Drawing.Color.White; this.OneDriveConsumerPictureButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.OneDriveConsumerPictureButton.ForeColor = System.Drawing.Color.White; - this.OneDriveConsumerPictureButton.Location = new System.Drawing.Point(10, 44); + this.OneDriveConsumerPictureButton.Location = new System.Drawing.Point(8, 36); + this.OneDriveConsumerPictureButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OneDriveConsumerPictureButton.Name = "OneDriveConsumerPictureButton"; - this.OneDriveConsumerPictureButton.Size = new System.Drawing.Size(429, 104); + this.OneDriveConsumerPictureButton.Size = new System.Drawing.Size(322, 84); this.OneDriveConsumerPictureButton.TabIndex = 7; this.OneDriveConsumerPictureButton.Text = "OneDrive"; this.OneDriveConsumerPictureButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.OneDriveConsumerPictureButton.UseVisualStyleBackColor = false; this.OneDriveConsumerPictureButton.Click += new System.EventHandler(this.OneDriveConsumerPictureButton_Click); // - // SharePointPictureButton - // - this.SharePointPictureButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.SharePointPictureButton.BackColor = System.Drawing.Color.White; - this.SharePointPictureButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.SharePointPictureButton.ForeColor = System.Drawing.SystemColors.ControlText; - this.SharePointPictureButton.Location = new System.Drawing.Point(10, 14); - this.SharePointPictureButton.Name = "SharePointPictureButton"; - this.SharePointPictureButton.Size = new System.Drawing.Size(429, 104); - this.SharePointPictureButton.TabIndex = 8; - this.SharePointPictureButton.Text = "SharePoint 2013, 2016 & Online"; - this.SharePointPictureButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; - this.SharePointPictureButton.UseMnemonic = false; - this.SharePointPictureButton.UseVisualStyleBackColor = false; - this.SharePointPictureButton.Click += new System.EventHandler(this.SharePointPictureButton_Click); - // // OneDriveCloudTypeForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(502, 392); + this.ClientSize = new System.Drawing.Size(376, 318); this.Controls.Add(this.CloudPlatformTabs); this.Controls.Add(this.ExplanationLabel); this.Controls.Add(this.CancelButton); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "OneDriveCloudTypeForm"; diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.Designer.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.Designer.cs index 3bf9c55..967d3a5 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.Designer.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.Designer.cs @@ -43,6 +43,7 @@ private void InitializeComponent() this.CloseButton = new System.Windows.Forms.Button(); this.StatusLabel = new System.Windows.Forms.Label(); this.AboutButton = new System.Windows.Forms.Button(); + this.ConfigurationListViewContextItemRenameStorage = new System.Windows.Forms.ToolStripMenuItem(); this.ConfigurationListViewContextMenu.SuspendLayout(); this.SuspendLayout(); // @@ -112,38 +113,39 @@ private void InitializeComponent() this.ConfigurationListViewContextMenu.ImageScalingSize = new System.Drawing.Size(20, 20); this.ConfigurationListViewContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ConfigurationListViewContextItemViewDetails, + this.ConfigurationListViewContextItemRenameStorage, this.ConfigurationListViewContextItemSyncNow, this.ConfigurationListViewContextItemOpenFileLocation, this.ConfigurationListViewContextItemDelete}); this.ConfigurationListViewContextMenu.Name = "ConfigurationListViewContextMenu"; - this.ConfigurationListViewContextMenu.Size = new System.Drawing.Size(169, 92); + this.ConfigurationListViewContextMenu.Size = new System.Drawing.Size(181, 136); this.ConfigurationListViewContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ConfigurationListViewContextMenu_Opening); // // ConfigurationListViewContextItemViewDetails // this.ConfigurationListViewContextItemViewDetails.Name = "ConfigurationListViewContextItemViewDetails"; - this.ConfigurationListViewContextItemViewDetails.Size = new System.Drawing.Size(168, 22); + this.ConfigurationListViewContextItemViewDetails.Size = new System.Drawing.Size(180, 22); this.ConfigurationListViewContextItemViewDetails.Text = "&View Details"; this.ConfigurationListViewContextItemViewDetails.Click += new System.EventHandler(this.ConfigurationListViewContextItemViewDetails_Click); // // ConfigurationListViewContextItemSyncNow // this.ConfigurationListViewContextItemSyncNow.Name = "ConfigurationListViewContextItemSyncNow"; - this.ConfigurationListViewContextItemSyncNow.Size = new System.Drawing.Size(168, 22); + this.ConfigurationListViewContextItemSyncNow.Size = new System.Drawing.Size(180, 22); this.ConfigurationListViewContextItemSyncNow.Text = "&Sync Now"; this.ConfigurationListViewContextItemSyncNow.Click += new System.EventHandler(this.ConfigurationListViewContextItemSyncNow_Click); // // ConfigurationListViewContextItemOpenFileLocation // this.ConfigurationListViewContextItemOpenFileLocation.Name = "ConfigurationListViewContextItemOpenFileLocation"; - this.ConfigurationListViewContextItemOpenFileLocation.Size = new System.Drawing.Size(168, 22); + this.ConfigurationListViewContextItemOpenFileLocation.Size = new System.Drawing.Size(180, 22); this.ConfigurationListViewContextItemOpenFileLocation.Text = "Open file &location"; this.ConfigurationListViewContextItemOpenFileLocation.Click += new System.EventHandler(this.ConfigurationListViewContextItemOpenFileLocation_Click); // // ConfigurationListViewContextItemDelete // this.ConfigurationListViewContextItemDelete.Name = "ConfigurationListViewContextItemDelete"; - this.ConfigurationListViewContextItemDelete.Size = new System.Drawing.Size(168, 22); + this.ConfigurationListViewContextItemDelete.Size = new System.Drawing.Size(180, 22); this.ConfigurationListViewContextItemDelete.Text = "&Delete"; this.ConfigurationListViewContextItemDelete.Click += new System.EventHandler(this.ConfigurationListViewContextItemDelete_Click); // @@ -182,6 +184,13 @@ private void InitializeComponent() this.AboutButton.UseVisualStyleBackColor = true; this.AboutButton.Click += new System.EventHandler(this.AboutButton_Click); // + // ConfigurationListViewContextItemRenameStorage + // + this.ConfigurationListViewContextItemRenameStorage.Name = "ConfigurationListViewContextItemRenameStorage"; + this.ConfigurationListViewContextItemRenameStorage.Size = new System.Drawing.Size(180, 22); + this.ConfigurationListViewContextItemRenameStorage.Text = "&Rename"; + this.ConfigurationListViewContextItemRenameStorage.Click += new System.EventHandler(this.ConfigurationListViewContextItemRenameStorage_Click); + // // OneDriveConfigForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -224,5 +233,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem ConfigurationListViewContextItemOpenFileLocation; private System.Windows.Forms.CheckBox UseSystemProxyCheckBox; private System.Windows.Forms.ColumnHeader StorageProviderColumn; + private System.Windows.Forms.ToolStripMenuItem ConfigurationListViewContextItemRenameStorage; } } \ No newline at end of file diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.cs index 175a072..bf6439a 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveConfigForm.cs @@ -84,6 +84,7 @@ private void ConfigurationListViewContextMenu_Opening(object sender, System.Comp ConfigurationListViewContextItemViewDetails.Enabled = ConfigurationListView.SelectedItems.Count == 1; ConfigurationListViewContextItemOpenFileLocation.Enabled = ConfigurationListView.SelectedItems.Count > 0; ConfigurationListViewContextItemSyncNow.Enabled = ConfigurationListView.SelectedItems.Count == 1 && !((KeyValuePair)ConfigurationListView.SelectedItems[0].Tag).Value.DoNotSync && KoenZomersKeePassOneDriveSyncExt.Host.Database.IOConnectionInfo.Path.Equals(ConfigurationListView.SelectedItems[0].Text, StringComparison.InvariantCultureIgnoreCase); + ConfigurationListViewContextItemRenameStorage.Enabled = ConfigurationListView.SelectedItems.Count == 1; } private void ConfigurationListView_DoubleClick(object sender, EventArgs e) @@ -121,6 +122,27 @@ private void ViewDetails() LoadConfigurations(); } + private void RenameEntry() + { + if (ConfigurationListView.SelectedItems.Count != 1) return; + var configuration = ((KeyValuePair)ConfigurationListView.SelectedItems[0].Tag); + + var renameItemDialog = new Forms.OneDriveRequestInputDialog + { + FormTitle = string.Format("Enter new storage name name for {0}", configuration.Value.OneDriveName), + InputValue = configuration.Value.OneDriveName + }; + renameItemDialog.ShowDialog(this); + if (renameItemDialog.DialogResult != DialogResult.OK) return; + if (renameItemDialog.InputValue == configuration.Value.OneDriveName) return; + + configuration.Value.OneDriveName = renameItemDialog.InputValue; + Configuration.Save(); + + ConfigurationListView.SelectedItems[0].SubItems[1].Text = configuration.Value.OneDriveName; + UpdateStatus("Storage Name has been changed"); + } + private async Task SyncNow() { // Only allow syncing if the database is not marked with the DoNotSync flag @@ -177,6 +199,10 @@ private void ConfigurationListView_KeyUp(object sender, KeyEventArgs e) case Keys.F5: LoadConfigurations(); break; + + case Keys.F2: + RenameEntry(); + break; } } @@ -191,5 +217,10 @@ private void ConfigurationListViewContextItemOpenFileLocation_Click(object sende Process.Start("explorer.exe", File.Exists(databaseFileLocation) ? string.Concat("/select, ", databaseFileLocation) : Directory.GetParent(databaseFileLocation).FullName); } } + + private void ConfigurationListViewContextItemRenameStorage_Click(object sender, EventArgs e) + { + RenameEntry(); + } } } diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.Designer.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.Designer.cs index 764a2df..f8134d6 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.Designer.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.Designer.cs @@ -28,29 +28,32 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.FolderNameTextBox = new System.Windows.Forms.TextBox(); + this.InputTextBox = new System.Windows.Forms.TextBox(); this.CancelButton = new System.Windows.Forms.Button(); this.OKButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // - // FolderNameTextBox + // InputTextBox // - this.FolderNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.InputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.FolderNameTextBox.Location = new System.Drawing.Point(12, 12); - this.FolderNameTextBox.Name = "FolderNameTextBox"; - this.FolderNameTextBox.Size = new System.Drawing.Size(400, 22); - this.FolderNameTextBox.TabIndex = 0; - this.FolderNameTextBox.TextChanged += new System.EventHandler(this.FolderNameTextBox_TextChanged); + this.InputTextBox.Location = new System.Drawing.Point(9, 10); + this.InputTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.InputTextBox.Name = "InputTextBox"; + this.InputTextBox.Size = new System.Drawing.Size(301, 20); + this.InputTextBox.TabIndex = 0; + this.InputTextBox.TextChanged += new System.EventHandler(this.InputTextBoxTextBox_TextChanged); + this.InputTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.InputTextBox_KeyPress); + this.InputTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.InputTextBox_KeyUp); // // CancelButton // this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelButton.Location = new System.Drawing.Point(316, 51); - this.CancelButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.CancelButton.Location = new System.Drawing.Point(237, 41); + this.CancelButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.CancelButton.Name = "CancelButton"; - this.CancelButton.Size = new System.Drawing.Size(96, 39); + this.CancelButton.Size = new System.Drawing.Size(72, 32); this.CancelButton.TabIndex = 7; this.CancelButton.Text = "&Cancel"; this.CancelButton.UseVisualStyleBackColor = true; @@ -59,30 +62,30 @@ private void InitializeComponent() // OKButton // this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK; this.OKButton.Enabled = false; - this.OKButton.Location = new System.Drawing.Point(213, 51); - this.OKButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.OKButton.Location = new System.Drawing.Point(160, 41); + this.OKButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OKButton.Name = "OKButton"; - this.OKButton.Size = new System.Drawing.Size(96, 39); + this.OKButton.Size = new System.Drawing.Size(72, 32); this.OKButton.TabIndex = 6; this.OKButton.Text = "&OK"; this.OKButton.UseVisualStyleBackColor = true; this.OKButton.Click += new System.EventHandler(this.OKButton_Click); // - // OneDriveNewFolderDialog + // OneDriveRequestInputDialog // - this.AcceptButton = this.OKButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.CancelButton; - this.ClientSize = new System.Drawing.Size(424, 101); + this.ClientSize = new System.Drawing.Size(318, 82); this.ControlBox = false; this.Controls.Add(this.CancelButton); this.Controls.Add(this.OKButton); - this.Controls.Add(this.FolderNameTextBox); + this.Controls.Add(this.InputTextBox); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "OneDriveNewFolderDialog"; + this.Name = "OneDriveRequestInputDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.ResumeLayout(false); this.PerformLayout(); @@ -91,7 +94,7 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.TextBox FolderNameTextBox; + private System.Windows.Forms.TextBox InputTextBox; private System.Windows.Forms.Button CancelButton; private System.Windows.Forms.Button OKButton; } diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.cs b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.cs index ac15554..e3a1fab 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/OneDriveRequestInputDialog.cs @@ -10,8 +10,8 @@ public partial class OneDriveRequestInputDialog : Form /// public string InputValue { - get { return FolderNameTextBox.Text; } - set { FolderNameTextBox.Text = value; } + get { return InputTextBox.Text; } + set { InputTextBox.Text = value; } } /// @@ -28,11 +28,6 @@ public OneDriveRequestInputDialog() InitializeComponent(); } - private void FolderNameTextBox_TextChanged(object sender, EventArgs e) - { - OKButton.Enabled = FolderNameTextBox.Text.Length > 0; - } - private void OKButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; @@ -43,5 +38,21 @@ private void CancelButton_Click(object sender, EventArgs e) { Close(); } + + private void InputTextBoxTextBox_TextChanged(object sender, EventArgs e) + { + OKButton.Enabled = InputTextBox.Text.Length > 0; + } + + private void InputTextBox_KeyPress(object sender, KeyPressEventArgs e) + { + + } + + private void InputTextBox_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) OKButton_Click(sender, e); + if (e.KeyCode == Keys.Escape) Close(); + } } } diff --git a/KoenZomers.KeePass.OneDriveSync/Forms/SharePointCredentialsForm.Designer.cs b/KoenZomers.KeePass.OneDriveSync/Forms/SharePointCredentialsForm.Designer.cs index 27e39ae..2e8d1a3 100644 --- a/KoenZomers.KeePass.OneDriveSync/Forms/SharePointCredentialsForm.Designer.cs +++ b/KoenZomers.KeePass.OneDriveSync/Forms/SharePointCredentialsForm.Designer.cs @@ -45,19 +45,21 @@ private void InitializeComponent() this.ExplanationLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ExplanationLabel.Location = new System.Drawing.Point(12, 9); + this.ExplanationLabel.Location = new System.Drawing.Point(9, 7); + this.ExplanationLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ExplanationLabel.Name = "ExplanationLabel"; - this.ExplanationLabel.Size = new System.Drawing.Size(564, 36); + this.ExplanationLabel.Size = new System.Drawing.Size(423, 29); this.ExplanationLabel.TabIndex = 1; - this.ExplanationLabel.Text = "Enter the details of the SharePoint 2013, 2016 or Online environment you wish to " + - "store the KeePass database on."; + this.ExplanationLabel.Text = "Enter the details of the SharePoint 2013, 2016, 2019 or Online environment you wi" + + "sh to store the KeePass database on."; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label1.Location = new System.Drawing.Point(12, 67); + this.label1.Location = new System.Drawing.Point(9, 54); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(151, 23); + this.label1.Size = new System.Drawing.Size(113, 19); this.label1.TabIndex = 2; this.label1.Text = "SharePoint site URL:"; // @@ -65,9 +67,10 @@ private void InitializeComponent() // this.SharePointUrlTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.SharePointUrlTextBox.Location = new System.Drawing.Point(161, 67); + this.SharePointUrlTextBox.Location = new System.Drawing.Point(121, 54); + this.SharePointUrlTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SharePointUrlTextBox.Name = "SharePointUrlTextBox"; - this.SharePointUrlTextBox.Size = new System.Drawing.Size(415, 22); + this.SharePointUrlTextBox.Size = new System.Drawing.Size(312, 20); this.SharePointUrlTextBox.TabIndex = 0; this.SharePointUrlTextBox.TextChanged += new System.EventHandler(this.SharePointUrlTextBox_TextChanged); this.SharePointUrlTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SharePointUrlTextBox_KeyUp); @@ -75,9 +78,10 @@ private void InitializeComponent() // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.Location = new System.Drawing.Point(12, 99); + this.label2.Location = new System.Drawing.Point(9, 80); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(151, 23); + this.label2.Size = new System.Drawing.Size(113, 19); this.label2.TabIndex = 4; this.label2.Text = "Client Id:"; // @@ -85,9 +89,10 @@ private void InitializeComponent() // this.ClientIdTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ClientIdTextBox.Location = new System.Drawing.Point(161, 96); + this.ClientIdTextBox.Location = new System.Drawing.Point(121, 78); + this.ClientIdTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ClientIdTextBox.Name = "ClientIdTextBox"; - this.ClientIdTextBox.Size = new System.Drawing.Size(415, 22); + this.ClientIdTextBox.Size = new System.Drawing.Size(312, 20); this.ClientIdTextBox.TabIndex = 1; this.ClientIdTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ClientIdTextBox_KeyUp); // @@ -95,18 +100,20 @@ private void InitializeComponent() // this.ClientSecretTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ClientSecretTextBox.Location = new System.Drawing.Point(161, 124); + this.ClientSecretTextBox.Location = new System.Drawing.Point(121, 101); + this.ClientSecretTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ClientSecretTextBox.Name = "ClientSecretTextBox"; - this.ClientSecretTextBox.Size = new System.Drawing.Size(415, 22); + this.ClientSecretTextBox.Size = new System.Drawing.Size(312, 20); this.ClientSecretTextBox.TabIndex = 2; this.ClientSecretTextBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ClientSecretTextBox_KeyUp); // // label3 // this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.Location = new System.Drawing.Point(12, 127); + this.label3.Location = new System.Drawing.Point(9, 103); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(151, 23); + this.label3.Size = new System.Drawing.Size(113, 19); this.label3.TabIndex = 6; this.label3.Text = "Client Secret:"; // @@ -114,10 +121,10 @@ private void InitializeComponent() // this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelButton.Location = new System.Drawing.Point(427, 161); - this.CancelButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.CancelButton.Location = new System.Drawing.Point(320, 131); + this.CancelButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.CancelButton.Name = "CancelButton"; - this.CancelButton.Size = new System.Drawing.Size(149, 35); + this.CancelButton.Size = new System.Drawing.Size(112, 28); this.CancelButton.TabIndex = 5; this.CancelButton.Text = "Cancel"; this.CancelButton.UseVisualStyleBackColor = true; @@ -127,10 +134,10 @@ private void InitializeComponent() // this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.OKButton.Location = new System.Drawing.Point(272, 161); - this.OKButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.OKButton.Location = new System.Drawing.Point(204, 131); + this.OKButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.OKButton.Name = "OKButton"; - this.OKButton.Size = new System.Drawing.Size(149, 35); + this.OKButton.Size = new System.Drawing.Size(112, 28); this.OKButton.TabIndex = 4; this.OKButton.Text = "OK"; this.OKButton.UseVisualStyleBackColor = true; @@ -139,10 +146,10 @@ private void InitializeComponent() // TestButton // this.TestButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.TestButton.Location = new System.Drawing.Point(117, 161); - this.TestButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.TestButton.Location = new System.Drawing.Point(88, 131); + this.TestButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.TestButton.Name = "TestButton"; - this.TestButton.Size = new System.Drawing.Size(149, 35); + this.TestButton.Size = new System.Drawing.Size(112, 28); this.TestButton.TabIndex = 3; this.TestButton.Text = "Test Connection"; this.TestButton.UseVisualStyleBackColor = true; @@ -151,9 +158,9 @@ private void InitializeComponent() // SharePointCredentialsForm // this.AcceptButton = this.OKButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(588, 207); + this.ClientSize = new System.Drawing.Size(441, 168); this.Controls.Add(this.TestButton); this.Controls.Add(this.OKButton); this.Controls.Add(this.CancelButton); @@ -164,6 +171,7 @@ private void InitializeComponent() this.Controls.Add(this.SharePointUrlTextBox); this.Controls.Add(this.label1); this.Controls.Add(this.ExplanationLabel); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SharePointCredentialsForm"; diff --git a/KoenZomers.KeePass.OneDriveSync/KoenZomers.KeePass.OneDriveSync.csproj b/KoenZomers.KeePass.OneDriveSync/KoenZomers.KeePass.OneDriveSync.csproj index 8e0b5b7..4ef8cf8 100644 --- a/KoenZomers.KeePass.OneDriveSync/KoenZomers.KeePass.OneDriveSync.csproj +++ b/KoenZomers.KeePass.OneDriveSync/KoenZomers.KeePass.OneDriveSync.csproj @@ -41,8 +41,8 @@ C:\Program Files (x86)\KeePass Password Safe 2\KeePass.exe - - Packages\KoenZomers.OneDrive.Api.2.3.0.1\lib\net452\KoenZomers.OneDrive.Api.dll + + Packages\KoenZomers.OneDrive.Api.2.3.0.3\lib\net452\KoenZomers.OneDrive.Api.dll Packages\Microsoft.IdentityModel.6.1.7600.16394\lib\net35\Microsoft.IdentityModel.dll diff --git a/KoenZomers.KeePass.OneDriveSync/Properties/AssemblyInfo.cs b/KoenZomers.KeePass.OneDriveSync/Properties/AssemblyInfo.cs index 1d1e815..e916fc4 100644 --- a/KoenZomers.KeePass.OneDriveSync/Properties/AssemblyInfo.cs +++ b/KoenZomers.KeePass.OneDriveSync/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.4.0")] +[assembly: AssemblyVersion("2.0.4.2")] diff --git a/KoenZomers.KeePass.OneDriveSync/Providers/OneDriveProvider.cs b/KoenZomers.KeePass.OneDriveSync/Providers/OneDriveProvider.cs index 5c7366f..de6d660 100644 --- a/KoenZomers.KeePass.OneDriveSync/Providers/OneDriveProvider.cs +++ b/KoenZomers.KeePass.OneDriveSync/Providers/OneDriveProvider.cs @@ -287,30 +287,51 @@ public static async Task SyncUsingOneDriveCloudProvider(Configuration data updateStatus("Uploading the new KeePass database to OneDrive"); OneDriveItem uploadResult = null; - if(!string.IsNullOrEmpty(databaseConfig.RemoteItemId)) - { - // Database is already present on OneDrive, update it - uploadResult = await oneDriveApi.UpdateFile(temporaryKeePassDatabasePath, oneDriveItem); - } - else + + // Due to some issues with the OneDrive API throwing random errors for no reason, retry a few times to upload the database before it will be considered failed + for (var uploadAttempts = 1; uploadAttempts <= 5; uploadAttempts++) { - // Database resides on the user its own OneDrive in the root folder - if (oneDriveItem.ParentReference.Path.Equals("/drive/root:", StringComparison.CurrentCultureIgnoreCase)) - { - uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetDriveRoot()); - } - else + try { - if (string.IsNullOrEmpty(databaseConfig.RemoteDriveId)) + if (!string.IsNullOrEmpty(databaseConfig.RemoteItemId)) { - // Database resides on the user its own OneDrive in a folder - uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetItemById(oneDriveItem.ParentReference.Id)); + // Database is already present on OneDrive, update it + uploadResult = await oneDriveApi.UpdateFile(temporaryKeePassDatabasePath, oneDriveItem); } else { - // Database resides on another OneDrive - uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetItemFromDriveById(oneDriveItem.ParentReference.Id, oneDriveItem.ParentReference.DriveId)); + // Database resides on the user its own OneDrive in the root folder + if (oneDriveItem.ParentReference.Path.Equals("/drive/root:", StringComparison.CurrentCultureIgnoreCase)) + { + uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetDriveRoot()); + } + else + { + if (string.IsNullOrEmpty(databaseConfig.RemoteDriveId)) + { + // Database resides on the user its own OneDrive in a folder + uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetItemById(oneDriveItem.ParentReference.Id)); + } + else + { + // Database resides on another OneDrive + uploadResult = await oneDriveApi.UploadFileAs(temporaryKeePassDatabasePath, oneDriveItem.Name, await oneDriveApi.GetItemFromDriveById(oneDriveItem.ParentReference.Id, oneDriveItem.ParentReference.DriveId)); + } + } + } + + // Uploading succeeded + break; + } + catch (ArgumentNullException e) + { + // If any other exception than the one we will get if the OneDrive API throws the random error, then ensure we pass on the exception instead of swallowing it + if (e.ParamName != "oneDriveUploadSession") + { + throw; } + + updateStatus(string.Format("Uploading the new KeePass database to OneDrive (attempt {0})", uploadAttempts + 1)); } } diff --git a/KoenZomers.KeePass.OneDriveSync/packages.config b/KoenZomers.KeePass.OneDriveSync/packages.config index 31d1f36..b6ff1ee 100644 --- a/KoenZomers.KeePass.OneDriveSync/packages.config +++ b/KoenZomers.KeePass.OneDriveSync/packages.config @@ -1,6 +1,6 @@  - + diff --git a/README.md b/README.md index 8166b29..7f03aa4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,16 @@ Download the PLGX and place it inside your KeePass\Plugins folder. Typically thi ## Latest Version +Version 2.0.4.2 - May 22, 2019 + +- Still was receiving reports on issues uploading larger than 5 MB databases. Did an additional fix hoping for it to have caught all scenarios this time. Discussed in [issue 88](https://github.com/KoenZomers/KeePassOneDriveSync/issues/88). +- Added option to rename the storage entry on the KeePassOneDriveSync entry using F2 or right click and then choosing Rename. Requested through [issue 91](https://github.com/KoenZomers/KeePassOneDriveSync/issues/91). +- In the dialog where it asks if you want to sync the database, it will now also show for which database it asks the question. Just in case you would use triggers to open multiple databases at once. Requested through [issue 93](https://github.com/KoenZomers/KeePassOneDriveSync/issues/93). + +Version 2.0.4.1 - May 17, 2019 + +- Fixed an issue introduced in 2.0.4.0 where KeePass databases bigger than 5 MB would no longer upload and return an error [issue 88](https://github.com/KoenZomers/KeePassOneDriveSync/issues/88) + Version 2.0.4.0 - May 5, 2019 - Fixed issue where synchronizing with a OneDrive database on someone else their OneDrive Consumer space would throw an error [issue 73](https://github.com/KoenZomers/KeePassOneDriveSync/issues/73)