[sword-svn] r87 - trunk/src/gui

bdrake at www.crosswire.org bdrake at www.crosswire.org
Mon Jan 7 07:15:47 MST 2008


Author: bdrake
Date: 2008-01-07 07:15:46 -0700 (Mon, 07 Jan 2008)
New Revision: 87

Modified:
   trunk/src/gui/SimpleNavigator.cpp
Log:
Have added a test for startup module.  If there is no options.conf and no default (kjv) present, SwordReader starts with the first installed module found.  Avoids app. failing.  Should also prevent problem if last used module has been deleted.

Modified: trunk/src/gui/SimpleNavigator.cpp
===================================================================
--- trunk/src/gui/SimpleNavigator.cpp	2008-01-07 10:15:02 UTC (rev 86)
+++ trunk/src/gui/SimpleNavigator.cpp	2008-01-07 14:15:46 UTC (rev 87)
@@ -48,9 +48,13 @@
 	transEndID = 0;
 	options = 0;
 	opCount = 0;
-	
+
+	SWModule *mod = SwordIndex::manager->getModule((*g_swordConf)["History"].getWithDefault("LastVersion", "KJV"));
+	if (mod) {	
+		position.setModule(SwordIndex::manager->getModule((*g_swordConf)["History"].getWithDefault("LastVersion", "KJV")));
+		}
+	else setModule(transStartID); // if defaults not present, start with first module found
 	sword::VerseKey key = sword::VerseKey((*g_swordConf)["History"].getWithDefault("LastPassage", "Gen 1:1"));
-	position.setModule(SwordIndex::manager->getModule((*g_swordConf)["History"].getWithDefault("LastVersion", "KJV")));
 	position.setVerseKey(&key);
 }
 
@@ -257,6 +261,7 @@
 	const char * t = wstrtostr(target);
 	// MessageBox(0, strtowstr(t), L"This is 't'", MB_OK);
 	// SWMgr swmanager; // don't create new manager - use SwordIndex::manager
+	// TODO - make a copy of ["History"] ["LastModule"] and restore before leaving procedure
 	// Footnote MessageBox
 	if (strstr(t, "showNote")) {
 		URL footnote(t);  // t is char* to URL string




More information about the sword-cvs mailing list