Browse Source

U3 changes to account for drive letter changes
[SAB]


git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@387 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 19 years ago
parent
commit
cc29f96a47
3 changed files with 43 additions and 25 deletions
  1. 1 1
      DittoSetup/U3/manifest/manifest.u3i
  2. 22 22
      MainFrm.cpp
  3. 20 2
      Options.cpp

+ 1 - 1
DittoSetup/U3/manifest/manifest.u3i

@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <u3manifest version="1.0">
-  <application uuid="33820de7-c934-490a-8445-3212afbd9bf9" version="03.11.00.00">
+  <application uuid="33820de7-c934-490a-8445-3212afbd9bf9" version="03.14.00.00">
     <icon>Ditto.ico</icon>
     <name>Ditto</name>
     <description>Ditto is an extension to the standard windows clipboard. It saves each item placed on the clipboard allowing you access to any of those items at a later time.</description>

+ 22 - 22
MainFrm.cpp

@@ -237,7 +237,7 @@ void CMainFrame::OnFirstExit()
 
 LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 {
-	if(wParam == theApp.m_pDittoHotKey->m_Atom)
+	if(theApp.m_pDittoHotKey && wParam == theApp.m_pDittoHotKey->m_Atom)
 	{
 		if(g_Opt.m_HideDittoOnHotKeyIfAlreadyShown && QuickPaste.IsWindowVisibleEx())
 		{
@@ -249,7 +249,7 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 			QuickPaste.ShowQPasteWnd(this, false, true, FALSE);
 		}		
 	}
-	else if(wParam == theApp.m_pNamedCopy->m_Atom)
+	else if(theApp.m_pNamedCopy && wParam == theApp.m_pNamedCopy->m_Atom)
 	{
 		if(g_Opt.m_bU3 == false)
 		{
@@ -259,7 +259,7 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 			}
 		}
 	}
-	else if(wParam == theApp.m_pNamedPaste->m_Atom)
+	else if(theApp.m_pNamedPaste && wParam == theApp.m_pNamedPaste->m_Atom)
 	{
 		if(g_Opt.m_bU3 == false)
 		{
@@ -268,79 +268,79 @@ LRESULT CMainFrame::OnHotKey(WPARAM wParam, LPARAM lParam)
 			}
 		}
 	}
-	else if(wParam == theApp.m_pPosOne->m_Atom)
+	else if(theApp.m_pPosOne && wParam == theApp.m_pPosOne->m_Atom)
 	{
 		DoFirstTenPositionsPaste(0);
 	}
-	else if(wParam == theApp.m_pPosTwo->m_Atom)
+	else if(theApp.m_pPosTwo && wParam == theApp.m_pPosTwo->m_Atom)
 	{
 		DoFirstTenPositionsPaste(1);
 	}
-	else if(wParam == theApp.m_pPosThree->m_Atom)
+	else if(theApp.m_pPosThree && wParam == theApp.m_pPosThree->m_Atom)
 	{
 		DoFirstTenPositionsPaste(2);
 	}
-	else if(wParam == theApp.m_pPosFour->m_Atom)
+	else if(theApp.m_pPosFour && wParam == theApp.m_pPosFour->m_Atom)
 	{
 		DoFirstTenPositionsPaste(3);
 	}
-	else if(wParam == theApp.m_pPosFive->m_Atom)
+	else if(theApp.m_pPosFive && wParam == theApp.m_pPosFive->m_Atom)
 	{
 		DoFirstTenPositionsPaste(4);
 	}
-	else if(wParam == theApp.m_pPosSix->m_Atom)
+	else if(theApp.m_pPosSix && wParam == theApp.m_pPosSix->m_Atom)
 	{
 		DoFirstTenPositionsPaste(5);
 	}
-	else if(wParam == theApp.m_pPosSeven->m_Atom)
+	else if(theApp.m_pPosSeven && wParam == theApp.m_pPosSeven->m_Atom)
 	{
 		DoFirstTenPositionsPaste(6);
 	}
-	else if(wParam == theApp.m_pPosEight->m_Atom)
+	else if(theApp.m_pPosEight && wParam == theApp.m_pPosEight->m_Atom)
 	{
 		DoFirstTenPositionsPaste(7);
 	}
-	else if(wParam == theApp.m_pPosNine->m_Atom)
+	else if(theApp.m_pPosNine && wParam == theApp.m_pPosNine->m_Atom)
 	{
 		DoFirstTenPositionsPaste(8);
 	}
-	else if(wParam == theApp.m_pPosTen->m_Atom)
+	else if(theApp.m_pPosTen && wParam == theApp.m_pPosTen->m_Atom)
 	{
 		DoFirstTenPositionsPaste(9);
 	}
-	else if(wParam == theApp.m_pCopyBuffer1->m_Atom)
+	else if(theApp.m_pCopyBuffer1 && wParam == theApp.m_pCopyBuffer1->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(0);
 	}
-	else if(wParam == theApp.m_pPasteBuffer1->m_Atom)
+	else if(theApp.m_pPasteBuffer1 && wParam == theApp.m_pPasteBuffer1->m_Atom)
 	{
 		theApp.m_CopyBuffer.PastCopyBuffer(0);
 	}
-	else if(wParam == theApp.m_pCutBuffer1->m_Atom)
+	else if(theApp.m_pCutBuffer1 && wParam == theApp.m_pCutBuffer1->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(0, true);
 	}
-	else if(wParam == theApp.m_pCopyBuffer2->m_Atom)
+	else if(theApp.m_pCopyBuffer2 && wParam == theApp.m_pCopyBuffer2->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(1);
 	}
-	else if(wParam == theApp.m_pPasteBuffer2->m_Atom)
+	else if(theApp.m_pPasteBuffer2 && wParam == theApp.m_pPasteBuffer2->m_Atom)
 	{
 		theApp.m_CopyBuffer.PastCopyBuffer(1);
 	}
-	else if(wParam == theApp.m_pCutBuffer2->m_Atom)
+	else if(theApp.m_pCutBuffer2 && wParam == theApp.m_pCutBuffer2->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(1, true);
 	}
-	else if(wParam == theApp.m_pCopyBuffer3->m_Atom)
+	else if(theApp.m_pCopyBuffer3 && wParam == theApp.m_pCopyBuffer3->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(2);
 	}
-	else if(wParam == theApp.m_pPasteBuffer3->m_Atom)
+	else if(theApp.m_pPasteBuffer3 && wParam == theApp.m_pPasteBuffer3->m_Atom)
 	{	
 		theApp.m_CopyBuffer.PastCopyBuffer(2);
 	}
-	else if(wParam == theApp.m_pCutBuffer3->m_Atom)
+	else if(theApp.m_pCutBuffer3 && wParam == theApp.m_pCutBuffer3->m_Atom)
 	{
 		theApp.m_CopyBuffer.StartCopy(2, true);
 	}

+ 20 - 2
Options.cpp

@@ -4,6 +4,9 @@
 #include "Misc.h"
 #include "TextConvert.h"
 #include "sqlite\CppSQLite3.h"
+#include "Path.h"
+
+using namespace nsPath;
 
 UINT WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nValue, LPCTSTR lpFileName)
 {
@@ -759,8 +762,23 @@ BOOL CGetSetOptions::SetDBPath(CString csPath)
 
 CString CGetSetOptions::GetDBPath()
 {
-	//First check the reg string
-	CString csDBPath = GetProfileString("DBPath3", "");
+	CString csDBPath;
+	if(m_bU3)
+	{
+		csDBPath = GetProfileString("DBPath3", "");
+		if(csDBPath.IsEmpty())
+		{
+			csDBPath = GetDefaultDBName();
+		}
+
+		CPath ExistingPath(csDBPath);
+		csDBPath = CGetSetOptions::GetPath(PATH_DATABASE);
+		csDBPath += ExistingPath.GetName();
+	}
+	else
+	{
+		csDBPath = GetProfileString("DBPath3", "");
+	}
 
 	return csDBPath;
 }