Index: cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptions.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptions.pas	(revision 735)
+++ cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptions.pas	(revision 738)
@@ -7,5 +7,5 @@
   Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
   Buttons, ComCtrls, ExtCtrls, ORCtrls, OrFn, Dialogs, ORDtTmRng, fBAOptionsDiagnoses,
-  uBAGlobals, TntStdCtrls, DKLang, jpeg, inifiles;
+  uBAGlobals, TntStdCtrls, DKLang, jpeg, inifiles, uConst, StrUtils;
 
 //kt added 6/29/07 ------------------
@@ -139,5 +139,5 @@
     cboTransMethod: TComboBox;
     Label3: TLabel;
-    Edit1: TEdit;
+    editDropboxLocation: TEdit;
     Label4: TLabel;
     BitBtn1: TBitBtn;
@@ -145,5 +145,5 @@
     cbEnableScanning: TCheckBox;
     Label5: TLabel;
-    Edit2: TEdit;
+    editScannedLocation: TEdit;
     BitBtn2: TBitBtn;
     Label6: TLabel;
@@ -188,8 +188,17 @@
     procedure lbSkinsKeyPress(Sender: TObject; var Key: Char);
     procedure btnDisableSkinClick(Sender: TObject);
-    procedure cbSkinAtStartupClick(Sender: TObject);  //kt added 6/29/07
+    procedure cbSkinAtStartupClick(Sender: TObject);
+    procedure cboTransMethodChange(Sender: TObject);
+    procedure cbEnableImagesClick(Sender: TObject);
+    procedure editDropboxLocationChange(Sender: TObject);
+    procedure cbEnableScanningClick(Sender: TObject);
+    procedure editScannedLocationChange(Sender: TObject);
+    procedure edtPolFreqChange(Sender: TObject);
+    procedure BitBtn1Click(Sender: TObject);
+    procedure BitBtn2Click(Sender: TObject);  //kt added 6/29/07
   private
     { Private declarations }
     FdirtyNotifications: boolean;  // used to determine edit changes to Notifications
+    FdirtyImageSettings: boolean;  // used to determine edit changes to Image Settings
     FdirtyOrderChecks: boolean;    // used to determine edit changes to Order Checks
     FdirtyOtherStuff: boolean;     // used to determine edit changes to misc settings
@@ -201,11 +210,14 @@
     procedure Offset(var topnum: integer; topoffset: integer; var leftnum: integer; leftoffset: integer);
     procedure LoadNotifications;
+    procedure LoadImageSettings;
     procedure LoadOrderChecks;
     procedure ApplyNotifications;
     procedure ApplyOrderChecks;
     procedure ApplyOtherStuff;
+    procedure ApplyImageSettings;
     procedure CheckApply;
     procedure LoadListView(aListView: TListView; aList: TStrings);
     procedure ChangeOnOff(aListView: TListView; aListItem: TListItem);
+    function BrowseDialog(const Title: string; const Flag: integer): string;
   public
     { Public declarations }
@@ -228,4 +240,6 @@
     ShellAPI, //kt 9/8/08
     uTMGOptions, //kt 2/10/10
+    UploadImages, fImages, //elh 04/15/10
+    ShlObj,  //elh 04/15/10
     ORNet, //allows access to RPCBrokerV
     TntForms, TntSystem, TntSysUtils;
@@ -346,4 +360,6 @@
     LoadNotifications;
     LoadOrderChecks;
+    LoadImageSettings;
+    FdirtyImageSettings := false;
     FdirtyNotifications := false;
     FdirtyOrderChecks := false;
@@ -469,4 +485,6 @@
     if FdirtyNotifications then
       ApplyNotifications;
+    if FdirtyImageSettings then
+      ApplyImageSettings;
     if FdirtyOrderChecks then
       ApplyOrderChecks;
@@ -493,4 +511,17 @@
     btnSurrogate.Hint := surrogateinfo;
     LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText);
+  end;
+
+  procedure TfrmOptions.LoadImageSettings;
+  begin
+     cbEnableImages.Checked := uTMGOptions.ReadBool('EnableImages',false);
+     cboTransMethod.ItemIndex :=  uTMGOptions.ReadInteger('ImageTransferMethod',0);
+     editDropboxLocation.text := uTMGOptions.ReadString('Dropbox directory','');
+     cbEnableScanning.Checked := uTMGOptions.ReadBool('Scan Enabled',false);
+     editScannedLocation.text := uTMGOptions.ReadString('Pol Directory','');
+     edtPolFreq.text := IntToStr(uTMGOptions.ReadInteger('Pol Interval (milliseconds)',0));
+
+     cbEnableScanningClick(self);
+     cboTransMethodChange(self);
   end;
 
@@ -531,4 +562,30 @@
   end;
 
+  procedure TfrmOptions.ApplyImageSettings;
+  begin
+     uTMGOptions.WriteBool('EnableImages',cbEnableImages.Checked);
+     frmFrame.SetATabVisibility(CT_IMAGES, cbEnableImages.Checked, 'Images');
+
+     uTMGOptions.WriteInteger('ImageTransferMethod',cboTransMethod.itemindex);
+     if cboTransMethod.text = 'Dropbox Transfer' then begin
+        frmImages.UseDropBox := True;
+     end else begin
+        frmImages.UseDropBox := False;
+     end;
+
+     uTMGOptions.WriteString('Dropbox directory',editDropboxLocation.text);
+     frmImages.DropBoxDir := editDropboxLocation.text;
+
+     uTMGOptions.WriteBool('Scan Enabled',cbEnableScanning.Checked);
+
+     uTMGOptions.WriteString('Pol Directory',editScannedLocation.text);
+     UploadForm.FScanDir := editScannedLocation.text;
+
+     uTMGOptions.WriteInteger('Pol Interval (milliseconds)',StrToInt(edtPolFreq.text));
+     UploadForm.PolInterval := StrToInt(edtPolFreq.text);
+
+     FdirtyImageSettings := false;
+  end;
+
   procedure TfrmOptions.ApplyOrderChecks;
   // save Order Check changes
@@ -572,5 +629,5 @@
   // determine if Apply button is enabled
   begin
-    btnApply.Enabled :=  FdirtyOrderChecks or FdirtyNotifications or FdirtyOtherStuff;
+    btnApply.Enabled :=  FdirtyImageSettings or FdirtyOrderChecks or FdirtyNotifications or FdirtyOtherStuff;
   end;
 
@@ -961,4 +1018,102 @@
   end;
 
+procedure TfrmOptions.cboTransMethodChange(Sender: TObject);
+begin
+    if cboTransMethod.text = 'Dropbox Transfer' then begin
+       editDropboxLocation.enabled := true;
+       bitbtn1.enabled := true;
+    end else begin
+       editDropboxLocation.enabled := false;
+       bitbtn1.enabled := false;
+    end;
+    FdirtyImageSettings := true;
+    CheckApply;
+end;
+
+procedure TfrmOptions.cbEnableImagesClick(Sender: TObject);
+begin
+   FdirtyImageSettings := true;
+   CheckApply;
+end;
+
+procedure TfrmOptions.editDropboxLocationChange(Sender: TObject);
+begin
+   FdirtyImageSettings := true;
+   CheckApply;
+end;
+
+procedure TfrmOptions.cbEnableScanningClick(Sender: TObject);
+begin
+   editScannedLocation.enabled := cbEnableScanning.checked;
+   bitbtn2.enabled := cbEnableScanning.checked;
+   edtPolFreq.enabled := cbEnableScanning.checked;
+   FdirtyImageSettings := true;
+   CheckApply;
+end;
+
+procedure TfrmOptions.editScannedLocationChange(Sender: TObject);
+begin
+   FdirtyImageSettings := true;
+   CheckApply;
+end;
+
+procedure TfrmOptions.edtPolFreqChange(Sender: TObject);
+begin
+   FdirtyImageSettings := true;
+   CheckApply;
+end;
+
+procedure TfrmOptions.BitBtn1Click(Sender: TObject);
+var
+   sFolder: string;
+begin
+  sFolder := BrowseDialog('Choose a Dropbox folder', BIF_RETURNONLYFSDIRS);
+  if sFolder <> '' then begin
+    if rightstr(sFolder,1) = '\' then begin
+       editDropboxLocation.text := sFolder;
+    end else begin
+       editDropboxLocation.text := sFolder + '\';
+    end;
+  end;
+end;
+
+function TfrmOptions.BrowseDialog(const Title: string; const Flag: integer): string;
+var
+  lpItemID : PItemIDList;
+  BrowseInfo : TBrowseInfo;
+  DisplayName : array[0..MAX_PATH] of char;
+  TempPath : array[0..MAX_PATH] of char;
+begin
+  Result:='';
+  FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
+  with BrowseInfo do begin
+    hwndOwner := Application.Handle;
+    pszDisplayName := @DisplayName;
+    lpszTitle := PChar(Title);
+    ulFlags := Flag;
+  end;
+  lpItemID := SHBrowseForFolder(BrowseInfo);
+  if lpItemId <> nil then begin
+    SHGetPathFromIDList(lpItemID, TempPath);
+    Result := TempPath;
+    GlobalFreePtr(lpItemID);
+  end;
+end;
+
+
+procedure TfrmOptions.BitBtn2Click(Sender: TObject);
+var
+   sFolder: string;
+begin
+  sFolder := BrowseDialog('Choose a Scanned folder', BIF_RETURNONLYFSDIRS);
+  if sFolder <> '' then begin
+    if rightstr(sFolder,1) = '\' then begin
+       editScannedLocation.text := sFolder;
+    end else begin
+       editScannedLocation.text := sFolder + '\';
+    end;
+  end;
+end;
+
 end.
 
