Quellcode durchsuchen

added warning message box on compact and repair button is clicked

sabrogden vor 7 Jahren
Ursprung
Commit
cb73cec883
2 geänderte Dateien mit 19 neuen und 11 gelöschten Zeilen
  1. 17 11
      AdvGeneral.cpp
  2. 2 0
      Debug/Language/English.xml

+ 17 - 11
AdvGeneral.cpp

@@ -703,27 +703,33 @@ void CAdvGeneral::OnSize(UINT nType, int cx, int cy)
 
 void CAdvGeneral::OnBnClickedBtCompactAndRepair()
 {
-	CWaitCursor wait;
+	auto msg = theApp.m_Language.GetString("CompactRepairWarning", "Warning this can take quite a long time and require up to double the hard drive space as your current database size, Continue?");
+	int ret = MessageBox(msg, _T("Ditto"), MB_YESNO);
 
-	try
+	if (ret == IDYES)
 	{
+		CWaitCursor wait;
+
 		try
 		{
-			for (int i = 0; i < 100; i++)
+			try
 			{
-				int toDeleteCount = theApp.m_db.execScalar(_T("SELECT COUNT(clipID) FROM MainDeletes"));
-				if (toDeleteCount <= 0)
-					break;
+				for (int i = 0; i < 100; i++)
+				{
+					int toDeleteCount = theApp.m_db.execScalar(_T("SELECT COUNT(clipID) FROM MainDeletes"));
+					if (toDeleteCount <= 0)
+						break;
 
-				RemoveOldEntries(false);
+					RemoveOldEntries(false);
+				}
 			}
+			CATCH_SQLITE_EXCEPTION
+
+			theApp.m_db.execDML(_T("PRAGMA auto_vacuum = 1"));
+			theApp.m_db.execQuery(_T("VACUUM"));
 		}
 		CATCH_SQLITE_EXCEPTION
-
-		theApp.m_db.execDML(_T("PRAGMA auto_vacuum = 1"));
-		theApp.m_db.execQuery(_T("VACUUM"));
 	}
-	CATCH_SQLITE_EXCEPTION
 }
 
 void CAdvGeneral::OnBnClickedButtonCopyScripts()

+ 2 - 0
Debug/Language/English.xml

@@ -414,6 +414,8 @@
 		<Item English_Text = "Ditto is running minimized, Ditto can be opened by hot keys or by clicking the task tray icon" ID = "StartuMsg"></Item>
 		
 		<Item English_Text = "There are no results for" ID = "NoSearchResults"></Item>
+		
+		<Item English_Text = "Warning this can take quite a long time and require up to double the hard drive space as your current database size, Continue?" ID = "CompactRepairWarning"></Item>
 				
 	</Ditto_String_Table>
 	<Ditto_Options_Sheet>