Skip to content

Commit

Permalink
Fixed issues identified during testing.
Browse files Browse the repository at this point in the history
Signed-off-by: Robert F. Frasca <rffrasca@gmail.com>
  • Loading branch information
rffrasca committed Nov 22, 2023
1 parent c7205f2 commit 704d6e0
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Hide All Documents Button on Find Documents Dialog by Policy</title>
<meta name="generator" content="LibreOffice 7.6.2.1 (Windows)"/>
<meta name="created" content="2018-01-15T00:00:00.013124628"/>
<meta name="changed" content="2023-11-12T19:41:36.233000000"/>
<meta name="changed" content="2023-11-21T18:49:18.731000000"/>
<meta name="description" content="
*******************************************************************************
* PDFKeeper -- Open Source PDF Document Management
Expand Down Expand Up @@ -35,18 +35,20 @@
<ul>
<li><p><font face="Segoe UI, sans-serif">To hide the <b>All
Documents</b> button on the <b>Find Documents</b> dialog, apply
<b>SetHideAllDocumentsPolicy.reg</b> (included with PDFKeeper) to
the targeted computers. Elevated privileges are required to apply
this policy.</font></p></li>
<li><p><font face="Segoe UI, sans-serif">To </font><font face="Segoe UI, sans-serif">clear
the policy</font><font face="Segoe UI, sans-serif">, apply
<b>SetHideAllDocumentsPolicy.reg</b> to the targeted computers.</font></p></li>
<li><p><font face="Segoe UI, sans-serif">To clear the policy, apply
</font><font face="Segoe UI, sans-serif"><b>ClearHideAllDocumentsPolicy.reg</b></font>
<font face="Segoe UI, sans-serif">(included with PDFKeeper) to the
targeted computers. Elevated privileges are required to </font><font face="Segoe UI, sans-serif">clear
t</font><font face="Segoe UI, sans-serif">his </font><font face="Segoe UI, sans-serif">policy</font><font face="Segoe UI, sans-serif">.</font></p></li>
<font face="Segoe UI, sans-serif">to the targeted computers.</font></p></li>
</ul>
<p><font face="Segoe UI, sans-serif"><b>Additional Information:</b></font></p>
<ul>
<li><p><font face="Segoe UI, sans-serif"><b>SetHideAllDocumentsPolicy.reg</b>
and <b>ClearHideAllDocumentsPolicy.reg</b> can be found in
<b>%LOCALAPPDATA%\Programs\PDFKeeper</b>.</font></p></li>
<li><p><font face="Segoe UI, sans-serif">Elevated privileges are
required to set or clear this policy.</font></p></li>
<li><p><font face="Segoe UI, sans-serif">PDFKeeper will need to be
restarted for the change to take effect.</font></p></li>
<li><p><font face="Segoe UI, sans-serif">This policy is ignored when
using the single-user database option.</font></p></li>
</ul>
Expand Down
6 changes: 4 additions & 2 deletions src/PDFKeeper.Core/Application/ApplicationDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ private static void MigrateUploadConfigs(DirectoryInfo directory)
{
var uploadConfigDirectory = new DirectoryInfo(Path.Combine(Directory.GetParent(
directory.FullName).FullName, "UploadConfig"));
if (uploadConfigDirectory.Exists)
if (uploadConfigDirectory.Exists && uploadConfigDirectory.GetFiles("*.xml",
SearchOption.TopDirectoryOnly).Length > 0)
{
FileSystem.CopyDirectory(uploadConfigDirectory.FullName, directory.FullName);
foreach (FileInfo profile in directory.GetFiles("*.xml",
Expand All @@ -140,7 +141,8 @@ private static void UpgradeUploadProfiles(DirectoryInfo directory)
{
var backupDirectory = new DirectoryInfo(Path.Combine(Directory.GetParent(
directory.FullName).FullName, "UploadProfiles.Bak"));
if (!backupDirectory.Exists)
if (!backupDirectory.Exists && directory.GetFiles("*.xml",
SearchOption.TopDirectoryOnly).Length > 0)
{
FileSystem.CopyDirectory(directory.FullName, backupDirectory.FullName);
foreach (FileInfo profile in directory.GetFiles("*.xml",
Expand Down
2 changes: 1 addition & 1 deletion src/PDFKeeper.Core/FileIO/UploadProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal UploadProfile GetUploadProfile(string name)
{
if (formerName != null)
{
DeleteUploadProfile(formerName);
GetUploadProfileInfo(formerName).Delete();
}
XmlSerializer.Serialize(uploadProfile, GetUploadProfileInfo(name));
}
Expand Down
16 changes: 14 additions & 2 deletions src/PDFKeeper.Core/Presenters/MainPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class MainPresenter : PresenterBase<MainViewModel>
private readonly ExecutingAssembly executingAssembly;
private Document currentDocument;
private string textToPrint;
private decimal lastPixelDensity;

/// <summary>
/// Initializes a new instance of the MainPresenter class.
Expand Down Expand Up @@ -175,8 +176,18 @@ public void OpenPdfForEachSelectedDocument(bool showPdfWithDefaultApplication)
count += 1;
if (count <= openMaximum)
{
pdfViewerService.Show(fileCache.GetPdfFile(id).FullName,
showPdfWithDefaultApplication);
try
{
var currentDocument = documentRepository.GetDocument(id, null);
fileCache.AddPdf(currentDocument.Id, currentDocument.Pdf);
pdfViewerService.Show(fileCache.GetPdfFile(id).FullName,
showPdfWithDefaultApplication);
}
catch (DatabaseException ex)
{
messageBoxService.ShowMessage(ResourceHelper.GetString(
"DefaultDocumentException", ex.Message, id.ToString()), true);
}
}
}
if (count > openMaximum)
Expand Down Expand Up @@ -524,6 +535,7 @@ public void DocumentSelectionChanged(decimal previewPixelDensity)
/// </param>
public void SetPreviewImage(decimal pixelDensity)
{
lastPixelDensity = pixelDensity;
OnLongRunningOperationStarted();
fileCache.CreatePreview(ViewModel.CurrentDocumentId, pixelDensity);
ViewModel.Preview = fileCache.GetPreview(ViewModel.CurrentDocumentId, pixelDensity);
Expand Down
9 changes: 7 additions & 2 deletions src/PDFKeeper.Core/Presenters/UploadProfileEditorPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ public void SaveUploadProfile()
CancelViewClosing = false;
OnApplyPendingChangesRequested();
var rule = new PdfMetadataRule(ViewModel.UploadProfile);
if (ViewModel.Name.Length.Equals(0) || rule.ViolationFound)
if (string.IsNullOrEmpty(ViewModel.Name))
{
error = true;
messageBoxService.ShowMessage(Resources.NameCannotBeBlank, true);
}
else if (rule.ViolationFound)
{
error = true;
messageBoxService.ShowMessage(rule.ViolationMessage, true);
Expand All @@ -125,7 +130,7 @@ public void SaveUploadProfile()
messageBoxService.ShowMessage(Resources.NameContainsCharsNotAllowed, true);
}
else if (uploadProfileManager.GetUploadProfile(ViewModel.Name) != null &&
uploadProfileName.Equals(null, System.StringComparison.Ordinal))
uploadProfileName == null)
{
error = true;
messageBoxService.ShowMessage(Resources.UploadProfileExists, true);
Expand Down
9 changes: 9 additions & 0 deletions src/PDFKeeper.Core/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/PDFKeeper.Core/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
<data name="MandatoryFieldsAreBlank" xml:space="preserve">
<value>One or more mandatory fields are blank!</value>
</data>
<data name="NameCannotBeBlank" xml:space="preserve">
<value>Name cannot be blank!</value>
</data>
<data name="NameContainsCharsNotAllowed" xml:space="preserve">
<value>Name contains one or more characters not allowed in file names!</value>
</data>
Expand Down
7 changes: 3 additions & 4 deletions src/PDFKeeper.Presentation/Dialogs/OptionsDialog.designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions src/PDFKeeper.Presentation/Dialogs/OptionsDialog.resx
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@
<data name="FindFlaggedDocumentsOnStartupCheckBox.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 64</value>
</data>
<metadata name="HelpProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="FindFlaggedDocumentsOnStartupCheckBox.ShowHelp" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="FindFlaggedDocumentsOnStartupCheckBox.Size" type="System.Drawing.Size, System.Drawing">
<value>215, 19</value>
</data>
Expand Down Expand Up @@ -279,6 +273,9 @@
<data name="&gt;&gt;SelectLastRowWhenListingDocumentsCheckBox.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<metadata name="HelpProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down
18 changes: 12 additions & 6 deletions src/PDFKeeper.Presentation/Views/MainView.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 21 additions & 12 deletions src/PDFKeeper.Presentation/Views/MainView.resx
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@
<value />
</data>
<metadata name="MainViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>756, 13</value>
<value>17, 55</value>
</metadata>
<data name="DocumentsDataGridView.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
Expand Down Expand Up @@ -1182,10 +1182,10 @@
<value>0</value>
</data>
<metadata name="UploadTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>139, 52</value>
<value>358, 55</value>
</metadata>
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>427, 13</value>
<value>262, 19</value>
</metadata>
<data name="DocumentsLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 17</value>
Expand Down Expand Up @@ -1336,7 +1336,7 @@
<value>1</value>
</data>
<metadata name="ToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>327, 14</value>
<value>142, 17</value>
</metadata>
<data name="FileAddToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down Expand Up @@ -1719,16 +1719,19 @@
<value>2</value>
</data>
<metadata name="UpdateCheckTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>261, 52</value>
<value>480, 55</value>
</metadata>
<metadata name="DocumentsChecksTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>138, 18</value>
<metadata name="CheckForFlaggedDocumentsTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>639, 51</value>
</metadata>
<metadata name="DocumentsListTimedRefreshTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>531, 16</value>
<value>368, 18</value>
</metadata>
<metadata name="HelpProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 52</value>
<value>236, 55</value>
</metadata>
<metadata name="CheckForDocumentsListChangesTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>609, 15</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
Expand Down Expand Up @@ -2349,10 +2352,10 @@
<data name="&gt;&gt;UpdateCheckTimer.Type" xml:space="preserve">
<value>System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;DocumentsChecksTimer.Name" xml:space="preserve">
<value>DocumentsChecksTimer</value>
<data name="&gt;&gt;CheckForFlaggedDocumentsTimer.Name" xml:space="preserve">
<value>CheckForFlaggedDocumentsTimer</value>
</data>
<data name="&gt;&gt;DocumentsChecksTimer.Type" xml:space="preserve">
<data name="&gt;&gt;CheckForFlaggedDocumentsTimer.Type" xml:space="preserve">
<value>System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;DocumentsListTimedRefreshTimer.Name" xml:space="preserve">
Expand All @@ -2367,6 +2370,12 @@
<data name="&gt;&gt;HelpProvider.Type" xml:space="preserve">
<value>System.Windows.Forms.HelpProvider, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;CheckForDocumentsListChangesTimer.Name" xml:space="preserve">
<value>CheckForDocumentsListChangesTimer</value>
</data>
<data name="&gt;&gt;CheckForDocumentsListChangesTimer.Type" xml:space="preserve">
<value>System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainView</value>
</data>
Expand Down
Loading

0 comments on commit 704d6e0

Please sign in to comment.