浏览代码

Added option "Append Computer Name and IP when receiving clips" to not append the computer name and ip address when receiving clip from the network (#785)

sabrogden 9 月之前
父节点
当前提交
6ef92a91f3
共有 5 个文件被更改,包括 38 次插入8 次删除
  1. 11 1
      AdvGeneral.cpp
  2. 6 6
      CP_Main.rc
  3. 10 0
      Options.cpp
  4. 3 0
      Options.h
  5. 8 1
      Server.cpp

+ 11 - 1
AdvGeneral.cpp

@@ -150,6 +150,7 @@ END_MESSAGE_MAP()
 #define SETTING_RTF_EDITOR_PATH 99
 #define SETTING_RTF_EDITOR_PATH 99
 #define SETTING_UPDATE_DESC_ON_CLIP_EDIT 100
 #define SETTING_UPDATE_DESC_ON_CLIP_EDIT 100
 #define SETTING_QR_CODE_URL 101
 #define SETTING_QR_CODE_URL 101
+#define SETTING_APPEND_NAME_IP 120
 
 
 BOOL CAdvGeneral::OnInitDialog()
 BOOL CAdvGeneral::OnInitDialog()
 {
 {
@@ -174,7 +175,7 @@ BOOL CAdvGeneral::OnInitDialog()
 	HDITEM hdItem;
 	HDITEM hdItem;
 	hdItem.mask = HDI_WIDTH; // indicating cxy is width
 	hdItem.mask = HDI_WIDTH; // indicating cxy is width
 	CDPI dpi(m_hWnd);
 	CDPI dpi(m_hWnd);
-	hdItem.cxy = dpi.Scale(325); // whatever you want the property name column width to be
+	hdItem.cxy = dpi.Scale(400); // whatever you want the property name column width to be
 	m_propertyGrid.GetHeaderCtrl().SetItem(0, &hdItem);
 	m_propertyGrid.GetHeaderCtrl().SetItem(0, &hdItem);
 
 
 	m_propertyGrid.SetFont(this->GetFont());	
 	m_propertyGrid.SetFont(this->GetFont());	
@@ -187,6 +188,8 @@ BOOL CAdvGeneral::OnInitDialog()
 	AddTrueFalse(pGroupTest, _T("Allow back to back duplicates (if allowing duplicates)"), CGetSetOptions::GetAllowBackToBackDuplicates(), SETTING_ALOW_BACK_TO_BACK_DUPLICATES);
 	AddTrueFalse(pGroupTest, _T("Allow back to back duplicates (if allowing duplicates)"), CGetSetOptions::GetAllowBackToBackDuplicates(), SETTING_ALOW_BACK_TO_BACK_DUPLICATES);
 
 
 	AddTrueFalse(pGroupTest, _T("Always show scroll bar"), CGetSetOptions::GetShowScrollBar(), SETTING_ALWAYS_SHOW_SCROLL_BAR);
 	AddTrueFalse(pGroupTest, _T("Always show scroll bar"), CGetSetOptions::GetShowScrollBar(), SETTING_ALWAYS_SHOW_SCROLL_BAR);
+	AddTrueFalse(pGroupTest, _T("Append Computer Name and IP when receiving clips"), CGetSetOptions::GetAppendRemoveComputerNameAndIPToDescription(), SETTING_APPEND_NAME_IP);
+
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Amount of text to save for description"), CGetSetOptions::m_bDescTextSize, _T(""), SETTING_DESC_SIZE));
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Amount of text to save for description"), CGetSetOptions::m_bDescTextSize, _T(""), SETTING_DESC_SIZE));
 	AddTrueFalse(pGroupTest, _T("Center window below cursor or caret"), CGetSetOptions::GetCenterWindowBelowCursorOrCaret(), SETTING_CENTER_WINDOW_BELOW_CURSOR_CARET);
 	AddTrueFalse(pGroupTest, _T("Center window below cursor or caret"), CGetSetOptions::GetCenterWindowBelowCursorOrCaret(), SETTING_CENTER_WINDOW_BELOW_CURSOR_CARET);
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Copy and save clipboard delay (ms)"), (long)CGetSetOptions::GetCopyAndSveDelay(), _T(""), SETTING_COPY_SAVE_DELAY));
 	pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Copy and save clipboard delay (ms)"), (long)CGetSetOptions::GetCopyAndSveDelay(), _T(""), SETTING_COPY_SAVE_DELAY));
@@ -898,6 +901,13 @@ void CAdvGeneral::OnBnClickedOk()
 					CGetSetOptions::SetQRCodeUrl(pNewValue->bstrVal);
 					CGetSetOptions::SetQRCodeUrl(pNewValue->bstrVal);
 				}
 				}
 				break;
 				break;
+			case SETTING_APPEND_NAME_IP:
+				if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0)
+				{
+					BOOL val = wcscmp(pNewValue->bstrVal, L"True") == 0;
+					CGetSetOptions::SetAppendRemoveComputerNameAndIPToDescription(val);
+				}
+				break;
 			}
 			}
 		}
 		}
 	}
 	}

+ 6 - 6
CP_Main.rc

@@ -1016,14 +1016,14 @@ BEGIN
     LTEXT           "Description",IDC_STATIC_FRIEND_DESC,7,24,53,14,SS_CENTERIMAGE
     LTEXT           "Description",IDC_STATIC_FRIEND_DESC,7,24,53,14,SS_CENTERIMAGE
 END
 END
 
 
-IDD_ADV_OPTIONS DIALOGEX 0, 0, 262, 268
+IDD_ADV_OPTIONS DIALOGEX 0, 0, 390, 269
 STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
 STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
 CAPTION "Advanced Options"
 CAPTION "Advanced Options"
 FONT 10, "Segoe UI", 400, 0, 0x0
 FONT 10, "Segoe UI", 400, 0, 0x0
 BEGIN
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,147,250,50,11
-    PUSHBUTTON      "Cancel",IDCANCEL,205,249,50,12
-    CONTROL         "",IDC_MFCPROPERTYGRID1,"MfcPropertyGrid",0x100,7,7,248,212
+    DEFPUSHBUTTON   "OK",IDOK,280,251,50,11
+    PUSHBUTTON      "Cancel",IDCANCEL,333,250,50,12
+    CONTROL         "",IDC_MFCPROPERTYGRID1,"MfcPropertyGrid",0x100,7,7,376,212
     PUSHBUTTON      "Compact and Repair Database",IDC_BT_COMPACT_AND_REPAIR,7,251,108,11
     PUSHBUTTON      "Compact and Repair Database",IDC_BT_COMPACT_AND_REPAIR,7,251,108,11
     PUSHBUTTON      "On Copy Scripts",IDC_BUTTON_COPY_SCRIPTS,7,224,108,11
     PUSHBUTTON      "On Copy Scripts",IDC_BUTTON_COPY_SCRIPTS,7,224,108,11
     PUSHBUTTON      "On Paste Scripts",IDC_BUTTON_PASTE_SCRIPTS,7,237,108,11
     PUSHBUTTON      "On Paste Scripts",IDC_BUTTON_PASTE_SCRIPTS,7,237,108,11
@@ -1274,9 +1274,9 @@ BEGIN
     IDD_ADV_OPTIONS, DIALOG
     IDD_ADV_OPTIONS, DIALOG
     BEGIN
     BEGIN
         LEFTMARGIN, 7
         LEFTMARGIN, 7
-        RIGHTMARGIN, 255
+        RIGHTMARGIN, 383
         TOPMARGIN, 7
         TOPMARGIN, 7
-        BOTTOMMARGIN, 261
+        BOTTOMMARGIN, 262
     END
     END
 
 
     IDD_SCRIPT_EDITOR, DIALOG
     IDD_SCRIPT_EDITOR, DIALOG

+ 10 - 0
Options.cpp

@@ -3118,4 +3118,14 @@ CString CGetSetOptions::GetQRCodeUrl()
 	}
 	}
 
 
 	return url;
 	return url;
+}
+
+void CGetSetOptions::SetAppendRemoveComputerNameAndIPToDescription(BOOL val)
+{
+	SetProfileLong("AppendRemoveComputerNameAndIPToDescription", val);	
+}
+
+BOOL CGetSetOptions::GetAppendRemoveComputerNameAndIPToDescription()
+{
+	return GetProfileLong("AppendRemoveComputerNameAndIPToDescription", TRUE);
 }
 }

+ 3 - 0
Options.h

@@ -698,6 +698,9 @@ public:
 
 
 	static BOOL SetQRCodeUrl(CString path);
 	static BOOL SetQRCodeUrl(CString path);
 	static CString GetQRCodeUrl();
 	static CString GetQRCodeUrl();
+
+	static void SetAppendRemoveComputerNameAndIPToDescription(BOOL val);
+	static BOOL GetAppendRemoveComputerNameAndIPToDescription();
 };
 };
 
 
 // global for easy access and for initialization of fast access variables
 // global for easy access and for initialization of fast access variables

+ 8 - 1
Server.cpp

@@ -219,7 +219,14 @@ void CServer::OnStart(CSendInfo &info)
 	m_pClip = new CClip;
 	m_pClip = new CClip;
 	
 	
 	CString cs;
 	CString cs;
-	cs.Format(_T("%s\n(%s)(%s)"), m_csDesc, m_csComputerName, m_csIP);
+	if (CGetSetOptions::GetAppendRemoveComputerNameAndIPToDescription())
+	{
+		cs.Format(_T("%s\n(%s)(%s)"), m_csDesc, m_csComputerName, m_csIP);
+	}
+	else
+	{
+		cs = m_csDesc;
+	}
 	
 	
 	if(m_pClip)
 	if(m_pClip)
 	{
 	{