*** empty log message ***

hb2143 [2005-04-08 01:46:49]
*** empty log message ***
Filename
src/psl/crunch3/Crunch3Settings.java
src/psl/crunch3/MainWindow.java
src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
src/psl/crunch3/plugins/contentextractor/ContentExtractorDescriptionGUI.java
diff --git a/src/psl/crunch3/Crunch3Settings.java b/src/psl/crunch3/Crunch3Settings.java
index 59ca4e2..89a93cf 100644
--- a/src/psl/crunch3/Crunch3Settings.java
+++ b/src/psl/crunch3/Crunch3Settings.java
@@ -27,7 +27,8 @@ public class Crunch3Settings {
 	public static final String[] FILTER_TYPES_DEF = { "text/html" };
 	public static final boolean FILTER_HOMEPAGES_DEF = true;
 	public static final boolean PROXY_MODE_DEF = true;
-	public static String SETTINGS_FILE = "custom.ini";
+	public static String SETTINGS_FILE = "config/level2.ini";
+	public static final boolean CHECK_HOMEPAGE_DEF = false;

 	//internal variables
 	private String[] arguments;
@@ -73,7 +74,12 @@ public class Crunch3Settings {

 	private boolean settingsFile;
 	private boolean settingsFileSet = false;
+
+	private boolean checkHomePage;
+	private boolean checkHomePageSet = false;

+
+
 	/**
 	 * Constructs a new Crunch3Settings using a given set of arguments. Usually
 	 * the arguments given will be from the main function.
@@ -169,8 +175,11 @@ public class Crunch3Settings {
 		} else if ("-g".equals(argument) || "--gui".equals(argument)) {
 			setGUI(true);
 		} else if ("-f".equals(argument) || "--file".equals(argument)){
-			SETTINGS_FILE = arguments[argNumber+1];
+			setSettingsFile(arguments[argNumber+1]);
+		} else if ("-h".equals(argument) || "--homepage".equals(argument)){
+			setHomePageCheck(true);
 		}
+
 		else {
 			additionalArgs.add(argument);
 		}
@@ -376,6 +385,14 @@ public class Crunch3Settings {
 		guiSet = true;
 	}

+	public void setHomePageCheck(boolean b){
+		if(!settingsFileSet){
+			checkHomePage = true;
+			checkHomePageSet = true;
+		}
+
+	}
+
 	/**
 	 * @return the time the server socket should wait for data before timing
 	 *         out
@@ -463,6 +480,14 @@ public class Crunch3Settings {
 		}
 	}

+	public void setSettingsFile(String s){
+		SETTINGS_FILE = s;
+		settingsFileSet = true;
+		if(checkHomePageSet == true){
+			checkHomePage = false;
+		}
+	}
+
 	/**
 	 * @param b whether or not to filter content.
 	 */
@@ -533,5 +558,10 @@ public class Crunch3Settings {
 		filterHomepages = b;
 		filterHomepagesSet = true;
 	}
+
+	public boolean isHomePageCheck(){
+		return checkHomePage;
+
+	}

 }
diff --git a/src/psl/crunch3/MainWindow.java b/src/psl/crunch3/MainWindow.java
index 73f360a..b58c724 100644
--- a/src/psl/crunch3/MainWindow.java
+++ b/src/psl/crunch3/MainWindow.java
@@ -4,6 +4,7 @@
  */
 package psl.crunch3;

+import java.io.File;
 import java.io.InputStream;
 import java.util.StringTokenizer;
 import java.util.Vector;
@@ -61,7 +62,8 @@ public class MainWindow extends Thread {
 	private Vector connections = new Vector();
 	private Thread updateThread = null;
 	private Thread trayShutdownHook = null;
-
+	private ContentExtractorDescriptionGUI gui = null;
+
 	// START VISUALS_DECLARATION
 	public Image crunchIcon = null;
 	public Image crunchIconActive = null;
@@ -883,8 +885,8 @@ public class MainWindow extends Thread {
 				windowHeight);
 			if(Crunch3.settings.isGUISet())
 			mainShell.open();
-			//this opens crunch without GUI and loads one settings file for the whole session
-			else{
+
+			else{//this opens crunch without GUI and loads one settings file for the whole session
 				processNoGUI();
 			}
 			isInitialized = true;
@@ -1144,7 +1146,32 @@ public class MainWindow extends Thread {
 	}

 	private void processNoGUI(){
-		ContentExtractorDescriptionGUI dg = new ContentExtractorDescriptionGUI(mainShell);
+		gui = new ContentExtractorDescriptionGUI(mainShell);
+
+	}
+
+	public void setGUIHomepage(){
+		Crunch3.Display_1.syncExec(new Runnable(){
+			public void run(){
+				if(gui != null){
+					gui.commitSettings("config" + File.separator + "level8.ini", 8);
+					gui.setSettingsLevel(8);
+				}
+			}
+		});
+
+	}
+
+	public void setGUINoHomepage(){
+		Crunch3.Display_1.syncExec(new Runnable(){
+			public void run(){
+				if(gui != null){
+					gui.commitSettings("config" + File.separator + "level2.ini", 2);
+					gui.setSettingsLevel(2);
+				}
+			}
+		});
+
 	}

 	private String[] split(final String text, final String delimiters) {
diff --git a/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java b/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
index f6948c1..6b44596 100644
--- a/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
+++ b/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
@@ -1749,7 +1749,7 @@ public class ContentExtractor extends EnhancedProxyFilter implements SiteDepende

 		currentAddress = URL;

-		if (!Crunch3.settings.isGUISet()) return;
+		//if (!Crunch3.settings.isGUISet()) return;
 		psl.crunch3.util.HomePageTester hpt = new psl.crunch3.util.HomePageTester(Crunch3.mainWindow.getURL().trim());
 		if (Crunch3.settings.isVerbose()){
 			if (hpt.isHomePage())
@@ -1757,7 +1757,18 @@ public class ContentExtractor extends EnhancedProxyFilter implements SiteDepende
 			else System.out.println("This is not a Homepage");
 		}

-
+		if(descriptionGUI == null) {
+
+			if(Crunch3.settings.isHomePageCheck()){
+			if( hpt.isHomePage()){
+			 	 Crunch3.mainWindow.setGUIHomepage();
+			 }
+			 else {
+			 	 Crunch3.mainWindow.setGUINoHomepage();
+			 }
+			}
+			return;
+		}
 		if (descriptionGUI.isAuto()){
 			//check what cluster the site belongs to and determine the correct filter.
 			int cluster = 0;
@@ -1812,7 +1823,7 @@ public class ContentExtractor extends EnhancedProxyFilter implements SiteDepende
 		else{
 			if(descriptionGUI.checkFrontPage() && hpt.isHomePage()){

-				if((descriptionGUI.getSettingsLabel()).equals("news")){
+				if((descriptionGUI.getSettingsLabel()).equals("shopping")){
 					descriptionGUI.commitSettings("config" + File.separator + "level9.ini", 9);
 					descriptionGUI.setSettingsLevel(9);
 				}
diff --git a/src/psl/crunch3/plugins/contentextractor/ContentExtractorDescriptionGUI.java b/src/psl/crunch3/plugins/contentextractor/ContentExtractorDescriptionGUI.java
index db4f2d2..76b30f1 100644
--- a/src/psl/crunch3/plugins/contentextractor/ContentExtractorDescriptionGUI.java
+++ b/src/psl/crunch3/plugins/contentextractor/ContentExtractorDescriptionGUI.java
@@ -451,7 +451,8 @@ public class ContentExtractorDescriptionGUI {
 		normalButton.setSelection(true);

 		if(!(Crunch3.settings.isGUISet())){
-			commitSettings(Crunch3.settings.getSettings(), 0);
+			commitSettings(Crunch3.settings.getSettings(), 2);
+			settingsLabel = "news";
 		}
 	}