mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Delete visible local contacts
This commit is contained in:
parent
4d63204cc9
commit
8c54034f09
3 changed files with 11 additions and 5 deletions
|
@ -104,6 +104,7 @@ public interface DaoContact {
|
||||||
int deleteContacts(long before);
|
int deleteContacts(long before);
|
||||||
|
|
||||||
@Query("DELETE FROM contact" +
|
@Query("DELETE FROM contact" +
|
||||||
" WHERE type IN (:types)")
|
" WHERE (:account IS NULL OR account = :account)" +
|
||||||
int clearContacts(int[] types);
|
" AND type IN (:types)")
|
||||||
|
int clearContacts(Long account, int[] types);
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,6 +267,7 @@ public class FragmentContacts extends FragmentBase {
|
||||||
|
|
||||||
private void onMenuDeleteAll() {
|
private void onMenuDeleteAll() {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
args.putLong("account", account == null ? -1L : account);
|
||||||
args.putBoolean("junk", junk);
|
args.putBoolean("junk", junk);
|
||||||
|
|
||||||
FragmentDelete fragment = new FragmentDelete();
|
FragmentDelete fragment = new FragmentDelete();
|
||||||
|
@ -501,13 +502,17 @@ public class FragmentContacts extends FragmentBase {
|
||||||
new SimpleTask<Void>() {
|
new SimpleTask<Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
protected Void onExecute(Context context, Bundle args) {
|
||||||
boolean junk = (args != null && args.getBoolean("junk"));
|
Long account = args.getLong("account");
|
||||||
|
boolean junk = args.getBoolean("junk");
|
||||||
|
|
||||||
|
if (account < 0)
|
||||||
|
account = null;
|
||||||
int[] types = (junk
|
int[] types = (junk
|
||||||
? new int[]{EntityContact.TYPE_JUNK, EntityContact.TYPE_NO_JUNK}
|
? new int[]{EntityContact.TYPE_JUNK, EntityContact.TYPE_NO_JUNK}
|
||||||
: new int[]{EntityContact.TYPE_FROM, EntityContact.TYPE_TO});
|
: new int[]{EntityContact.TYPE_FROM, EntityContact.TYPE_TO});
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
int count = db.contact().clearContacts(types);
|
int count = db.contact().clearContacts(account, types);
|
||||||
Log.i("Cleared contacts=" + count);
|
Log.i("Cleared contacts=" + count);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1035,7 +1035,7 @@
|
||||||
<string name="title_delete_operation_flag">Flag operations</string>
|
<string name="title_delete_operation_flag">Flag operations</string>
|
||||||
<string name="title_delete_operation_delete">Delete operations</string>
|
<string name="title_delete_operation_delete">Delete operations</string>
|
||||||
<string name="title_delete_operation_deleted">%1$d operations deleted</string>
|
<string name="title_delete_operation_deleted">%1$d operations deleted</string>
|
||||||
<string name="title_delete_contacts">Delete all local contacts?</string>
|
<string name="title_delete_contacts">Delete visible local contacts?</string>
|
||||||
<string name="title_no_operations">No pending operations</string>
|
<string name="title_no_operations">No pending operations</string>
|
||||||
<string name="title_check_operations">Checking for operations</string>
|
<string name="title_check_operations">Checking for operations</string>
|
||||||
<string name="title_hint_operations">Deleting operations can result in disappearing messages and synchronization problems</string>
|
<string name="title_hint_operations">Deleting operations can result in disappearing messages and synchronization problems</string>
|
||||||
|
|
Loading…
Reference in a new issue