Browse Source

profile need at least a name now when saving

Alexander Brakowski 10 years ago
parent
commit
657143212f

+ 2 - 0
res/values-de/strings.xml

@@ -23,6 +23,8 @@
     <string name="wifi_not_connected_msg">Sie sind nicht mit einem WLAN Netzwerk verbunden. \n\nBitte verbinden sie sich mit einem, bevor sie HosTaGe starten.</string>
 	<string name="profile_no_services_msg">Das aktive Profil scheint keine Dienste zu &#252;berwachen.\n\nBitte aktivieren Sie Dienste in dem aktiven Profil.</string>
 
+	<string name="profile_needs_name">Ein Profil benötigt ein Name. Bitte geben Sie einen Namen an und drücken Sie auf Speichern.</string>
+
     <string name="monitor_current_connection">&#220;berwache Verbindung</string>
     <string name="active_profile">Aktives Profil: </string>
 

+ 2 - 0
res/values/strings.xml

@@ -25,6 +25,8 @@
 	<string name="no_network_connection_threatmap_msg">Currently you are not connected to the Internet.\n\nPlease establish a connection to use the Threatmap.</string>
 	<string name="profile_no_services_msg">The current active profile does not seem to monitor any services.\n\nPlease activate some services to monitor in the profile.</string>
 
+	<string name="profile_needs_name">An profile needs a name. Please type in a name and press save again.</string>
+
     <string name="monitor_current_connection">Monitor current connection</string>
     <string name="active_profile">Active profile: </string>
 

+ 12 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/ProfileEditFragment.java

@@ -2,7 +2,9 @@ package de.tudarmstadt.informatik.hostage.ui2.fragment;
 
 import android.app.ActionBar;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.database.Cursor;
@@ -95,6 +97,16 @@ public class ProfileEditFragment extends PreferenceFragment implements
 				profile.mGhostActive = prefs.getBoolean("pref_profile_protocols_ghost_active", profile.mGhostActive);
 				profile.mGhostPorts = prefs.getString("pref_profile_protocols_ghost_text", "");
 
+				if(profile.mLabel == null || profile.mLabel.isEmpty()){
+					new AlertDialog.Builder(getActivity()).setTitle(R.string.information).setMessage(R.string.profile_needs_name)
+							.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+								public void onClick(DialogInterface dialog, int which) {
+
+								}
+							}).setIcon(android.R.drawable.ic_dialog_info).show();
+					return;
+				}
+
 				if(profile.mGhostPorts.isEmpty()){
 					profile.mGhostActive = false;
 				}