diff --git a/res/values/strings.xml b/res/values/strings.xml
index 782a6dc..14cecd0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -398,7 +398,7 @@
Profile import
-Import successful!
+Imported profile: %s
Error importing profile: %s!
diff --git a/src/KeyfileImportActivity.scala b/src/KeyfileImportActivity.scala
index 6b90881..7d45b8f 100644
--- a/src/KeyfileImportActivity.scala
+++ b/src/KeyfileImportActivity.scala
@@ -23,6 +23,8 @@ class KeyfileImportActivity extends Activity {
val CALL_RE = ".*CALLSIGN=([0-9A-Za-z]+).*".r
+ lazy val db = StorageDatabase.open(this)
+
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
Log.d(TAG, "created: " + getIntent())
@@ -79,11 +81,17 @@ class KeyfileImportActivity extends Activity {
PreferenceManager.getDefaultSharedPreferences(this)
.edit().putString("callsign", callsign).commit()
- Toast.makeText(this, getString(R.string.ssl_import_ok, callsign), Toast.LENGTH_SHORT).show()
+ val msg = getString(R.string.ssl_import_ok, callsign)
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
+ db.addPost(System.currentTimeMillis(), StorageDatabase.Post.TYPE_INFO,
+ getString(R.string.post_info), msg)
}
} catch {
case e : Exception =>
- Toast.makeText(this, getString(R.string.ssl_import_error, e.getMessage()), Toast.LENGTH_LONG).show()
+ val errmsg = getString(R.string.ssl_import_error, e.getMessage())
+ Toast.makeText(this, errmsg, Toast.LENGTH_LONG).show()
+ db.addPost(System.currentTimeMillis(), StorageDatabase.Post.TYPE_ERROR,
+ getString(R.string.post_error), errmsg)
e.printStackTrace()
}
finish()
diff --git a/src/PrefsAct.scala b/src/PrefsAct.scala
index 73d1e56..036cd62 100644
--- a/src/PrefsAct.scala
+++ b/src/PrefsAct.scala
@@ -17,6 +17,8 @@ import java.util.Date
import org.json.JSONObject
class PrefsAct extends PreferenceActivity {
+ lazy val db = StorageDatabase.open(this)
+
def exportPrefs() {
val filename = "profile-%s.aprs".format(new SimpleDateFormat("yyyyMMdd-HHmm").format(new Date()))
val file = new File(Environment.getExternalStorageDirectory(), filename)
@@ -87,14 +89,15 @@ class PrefsAct extends PreferenceActivity {
if (file != null) {
PreferenceManager.getDefaultSharedPreferences(this)
.edit().putString(pref_name, file).commit()
- android.widget.Toast.makeText(this, file,
- android.widget.Toast.LENGTH_SHORT).show()
+ Toast.makeText(this, file, Toast.LENGTH_SHORT).show()
// reload prefs
finish()
startActivity(getIntent())
} else {
- android.widget.Toast.makeText(this, getString(error_id, data.getDataString()),
- android.widget.Toast.LENGTH_SHORT).show()
+ val errmsg = getString(error_id, data.getDataString())
+ Toast.makeText(this, errmsg, Toast.LENGTH_SHORT).show()
+ db.addPost(System.currentTimeMillis(), StorageDatabase.Post.TYPE_ERROR,
+ getString(R.string.post_error), errmsg)
}
}
diff --git a/src/ProfileImportActivity.scala b/src/ProfileImportActivity.scala
index 5a1b260..b5b15fc 100644
--- a/src/ProfileImportActivity.scala
+++ b/src/ProfileImportActivity.scala
@@ -18,6 +18,8 @@ import scala.collection.JavaConversions._ // for enumeration of config items
class ProfileImportActivity extends Activity {
val TAG = "APRSdroid.ProfileImport"
+ lazy val db = StorageDatabase.open(this)
+
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
Log.d(TAG, "created: " + getIntent())
@@ -46,11 +48,17 @@ class ProfileImportActivity extends Activity {
}
}
prefsedit.commit()
- Toast.makeText(this, R.string.profile_import_done, Toast.LENGTH_SHORT).show()
+ val msg = getString(R.string.profile_import_done, getIntent.getData().getPath())
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
+ db.addPost(System.currentTimeMillis(), StorageDatabase.Post.TYPE_INFO,
+ getString(R.string.profile_import_activity), msg)
} catch {
case e : Exception =>
- Toast.makeText(this, getString(R.string.profile_import_error, e.getMessage()), Toast.LENGTH_LONG).show()
- e.printStackTrace()
+ val errmsg = getString(R.string.profile_import_error, e.getMessage())
+ Toast.makeText(this, errmsg, Toast.LENGTH_LONG).show()
+ db.addPost(System.currentTimeMillis(), StorageDatabase.Post.TYPE_ERROR,
+ getString(R.string.profile_import_activity), errmsg)
+ e.printStackTrace()
}
finish()
}