Browse Source

Added option to request remote files by either the ip or host name

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@757 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 11 years ago
parent
commit
2ed46b1ff4
6 changed files with 60 additions and 12 deletions
  1. 13 10
      CP_Main.rc
  2. 11 1
      Client.cpp
  3. 18 0
      OptionFriends.cpp
  4. 10 0
      Options.cpp
  5. 3 0
      Options.h
  6. 5 1
      Resource.h

+ 13 - 10
CP_Main.rc

@@ -683,7 +683,7 @@ BEGIN
     LTEXT           "Name",IDC_STATIC,7,1,59,10
 END
 
-IDD_OPTIONS_FRIENDS DIALOGEX 0, 0, 353, 247
+IDD_OPTIONS_FRIENDS DIALOGEX 0, 0, 366, 292
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Friends"
 FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -692,16 +692,19 @@ BEGIN
     CONTROL         "Disable Recieving Clips",IDC_CHECK_DISABLE_FRIENDS,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,53,146,10
     EDITTEXT        IDC_EDIT_PASSWORD,96,66,210,13,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_ADDITIONAL,95,110,210,12,ES_AUTOHSCROLL
-    CONTROL         "List1",IDC_LIST,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,7,159,339,68
+    EDITTEXT        IDC_EDIT_ADDITIONAL,95,108,210,12,ES_AUTOHSCROLL
+    CONTROL         "List1",IDC_LIST,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,7,200,352,76
     CONTROL         "Log Send Receive Commands",IDC_CHECK_LOG_SEND_RECIEVE,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,339,12
-    LTEXT           "If Send All Copies is selected then all copies from this computer will be sent to the other computer.  If that is not selected then it will just be in the right click menu to send a copy to that computer.",IDC_STATIC_6,7,126,339,28
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,279,352,12
+    LTEXT           "If Send All Copies is selected then all copies from this computer will be sent to the other computer.  If that is not selected then it will just be in the right click menu to send a copy to that computer.",IDC_STATIC_6,7,170,352,26
     LTEXT           "IP/Computer Names seperated by commas",IDC_STATIC_2,7,37,84,17
-    LTEXT           "When you recieve a sent copy if their ip or computer name is in this list then it will be put on the clipboard.  Otherwise it will be in the saved clips to use at a later time.",IDC_STATIC_1,7,10,339,26
+    LTEXT           "When you recieve a sent copy if their ip or computer name is in this list then it will be put on the clipboard.  Otherwise it will be in the saved clips to use at a later time.",IDC_STATIC_1,7,10,352,26
     LTEXT           "Network Password",IDC_STATIC_3,7,69,79,9
-    LTEXT           "If you are receiving clips from computers where your network password does not match, enter additional network passwords separated by commas",IDC_STATIC_4,7,83,339,22
-    LTEXT           "Receive Passwords",IDC_STATIC_5,7,112,79,9
+    LTEXT           "If you are receiving clips from computers where your network password does not match, enter additional network passwords separated by commas",IDC_STATIC_4,7,83,352,22
+    LTEXT           "Receive Passwords",IDC_STATIC_5,7,110,79,9
+    CONTROL         "Request using IP Address",IDC_RADIO_USE_IP,"Button",BS_AUTORADIOBUTTON,15,136,98,10
+    GROUPBOX        "Remote Files",IDC_STATIC_REMOTE_FILES,7,124,352,39
+    CONTROL         "Request using Host Name",IDC_RADIO_USE_HOST_NAME,"Button",BS_AUTORADIOBUTTON,15,148,98,10
 END
 
 IDD_FRIEND_DETAILS DIALOGEX 0, 0, 203, 79
@@ -969,9 +972,9 @@ BEGIN
     IDD_OPTIONS_FRIENDS, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 346
+        RIGHTMARGIN, 359
         TOPMARGIN, 4
-        BOTTOMMARGIN, 244
+        BOTTOMMARGIN, 289
     END
 
     IDD_FRIEND_DETAILS, DIALOG

+ 11 - 1
Client.cpp

@@ -304,9 +304,19 @@ HGLOBAL CClient::RequestCopiedFiles(CClipFormat &HDropFormat, CString csIP, CStr
 	pProgress->SetMessage(StrF(_T("Opening Connection to %s (%s)"), csComputerName, csIP));
 	pProgress->PumpMessages();
 
+	CString requestFrom;
+	if(g_Opt.GetRequestFilesUsingIP())
+	{
+		requestFrom = csIP;
+	}
+	else
+	{
+		requestFrom = csComputerName;
+	}
+
 	do 
 	{
-		if(OpenConnection(csIP) == FALSE)
+		if(OpenConnection(requestFrom) == FALSE)
 		{
 			csErrorString.Format(_T("Error Opening Connection to %s (%s)"), csComputerName, csIP);
 			break;

+ 18 - 0
OptionFriends.cpp

@@ -80,6 +80,15 @@ BOOL COptionFriends::OnInitDialog()
 	m_csPassword = g_Opt.m_csPassword;
 	m_csAdditionalPasswords = CGetSetOptions::GetExtraNetworkPassword(false);
 
+	if(g_Opt.GetRequestFilesUsingIP())
+	{
+		::CheckDlgButton(m_hWnd, IDC_RADIO_USE_IP, BST_CHECKED);
+	}
+	else
+	{
+		::CheckDlgButton(m_hWnd, IDC_RADIO_USE_HOST_NAME, BST_CHECKED);
+	}
+
 	UpdateData(FALSE);
 
 	theApp.m_Language.UpdateOptionFriends(this);
@@ -123,6 +132,15 @@ BOOL COptionFriends::OnApply()
 	g_Opt.SetExtraNetworkPassword(m_csAdditionalPasswords);
 	//get get to refill the array extra passwords
 	g_Opt.GetExtraNetworkPassword(true);
+
+	if(::IsDlgButtonChecked(m_hWnd, IDC_RADIO_USE_IP) == BST_CHECKED)
+	{
+		g_Opt.SetRequestFilesUsingIP(TRUE);
+	}
+	else if(::IsDlgButtonChecked(m_hWnd, IDC_RADIO_USE_HOST_NAME) == BST_CHECKED)
+	{
+		g_Opt.SetRequestFilesUsingIP(FALSE);
+	}
 	
 	return CPropertyPage::OnApply();
 }

+ 10 - 0
Options.cpp

@@ -2182,4 +2182,14 @@ void CGetSetOptions::SetNetworkReadTimeoutMS(int val)
 int CGetSetOptions::GetNetworkReadTimeoutMS()
 {
 	return GetProfileLong(_T("NetworkReadTimeoutMS"), 30000);
+}
+
+void CGetSetOptions::SetRequestFilesUsingIP(int val)
+{
+	SetProfileLong(_T("RequestFilesUsingIP"), val);
+}
+
+int CGetSetOptions::GetRequestFilesUsingIP()
+{
+	return GetProfileLong(_T("RequestFilesUsingIP"), 1);
 }

+ 3 - 0
Options.h

@@ -470,6 +470,9 @@ public:
 	static void SetNetworkReadTimeoutMS(int val);
 	static int GetNetworkReadTimeoutMS();
 
+	static void SetRequestFilesUsingIP(int val);
+	static int GetRequestFilesUsingIP();
+
 
 };
 

+ 5 - 1
Resource.h

@@ -373,6 +373,10 @@
 #define IDC_BUTTON_DIFF_BROWSE          2124
 #define IDC_STATIC_QUICK_PASTE          2125
 #define IDC_STATIC_DESC                 2126
+#define IDC_RADIO_USE_IP                2127
+#define IDC_STATIC_REMOTE_FILES         2128
+#define IDC_RADIO_USE_HOST_NAME         2129
+#define IDC_STATIC_REMOTE_FILE_REQUEST  2130
 #define ID_FIRST_OPTION                 32771
 #define ID_FIRST_EXIT                   32772
 #define ID_FIRST_SHOWQUICKPASTE         32773
@@ -502,7 +506,7 @@
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        240
 #define _APS_NEXT_COMMAND_VALUE         32901
-#define _APS_NEXT_CONTROL_VALUE         2127
+#define _APS_NEXT_CONTROL_VALUE         2131
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif