diff --git a/res/values/config.xml b/res/values/config.xml
index 2563295db..1ee45326a 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -23,8 +23,17 @@
app
+ clip_timeout_key
db
rounds
keyfile
true
+
+ 300000
+
+ - 30000
+ - 60000
+ - 300000
+ - -1
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4a59d2b85..73a1d2811 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -33,6 +33,8 @@
Application settings
Cancel
Clipboard cleared.
+ Clipboard Timeout
+ Time before clearing clipboard after copying username or password
Copy username to clipboard
Copy password to clipboard
Current Group:
@@ -120,4 +122,11 @@
Entry title/description
Search
Show password
+
+
+ - 30 seconds
+ - 1 minute
+ - 5 minutes
+ - Never
+
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 683568eb5..ee455361c 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -44,5 +44,13 @@
android:title="@string/remember_keyfile_title"
android:summary="@string/remember_keyfile_summary"
android:defaultValue="@bool/keyfile_default"/>
+
diff --git a/src/com/keepassdroid/EntryActivity.java b/src/com/keepassdroid/EntryActivity.java
index 83d2f77c2..2a87ecb5f 100644
--- a/src/com/keepassdroid/EntryActivity.java
+++ b/src/com/keepassdroid/EntryActivity.java
@@ -37,8 +37,10 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.text.method.PasswordTransformationMethod;
import android.view.Menu;
import android.view.MenuItem;
@@ -64,8 +66,6 @@ public class EntryActivity extends LockCloseActivity {
private static final int MENU_COPY_PASS = Menu.FIRST + 4;
private static final int MENU_LOCK = Menu.FIRST + 5;
- private static final long CLIP_CLEAR_TIME = 5 * 60 * 1000;
-
public static final int NOTIFY_USERNAME = 1;
public static final int NOTIFY_PASSWORD = 2;
@@ -321,7 +321,15 @@ public class EntryActivity extends LockCloseActivity {
private void timeoutCopyToClipboard(String text) {
Util.copyToClipboard(this, text);
- mTimer.schedule(new ClearClipboardTask(this, text), CLIP_CLEAR_TIME);
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ String sClipClear = prefs.getString(getString(R.string.clipboard_timeout_key), getString(R.string.clipboard_timeout_default));
+
+ long clipClearTime = Integer.parseInt(sClipClear);
+
+ if ( clipClearTime > 0 ) {
+ mTimer.schedule(new ClearClipboardTask(this, text), clipClearTime);
+ }
}