mirror of https://github.com/M66B/FairEmail.git
Synchronizing accounts by type
This commit is contained in:
parent
9360d39df8
commit
0868984f8f
|
@ -563,7 +563,7 @@ public class ActivityEML extends ActivityBase {
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -571,8 +571,7 @@ public class ActivityEML extends ActivityBase {
|
|||
ArrayAdapter<EntityAccount> adapter =
|
||||
new ArrayAdapter<>(ActivityEML.this, R.layout.spinner_item1, android.R.id.text1);
|
||||
for (EntityAccount account : accounts)
|
||||
if (account.protocol == EntityAccount.TYPE_IMAP)
|
||||
adapter.add(account);
|
||||
adapter.add(account);
|
||||
|
||||
new AlertDialog.Builder(ActivityEML.this)
|
||||
.setIcon(R.drawable.twotone_save_alt_24)
|
||||
|
|
|
@ -175,7 +175,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
|
|||
return true;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts();
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(null);
|
||||
boolean hasAccounts = (accounts != null && accounts.size() > 0);
|
||||
|
||||
prefs.edit().putBoolean("has_accounts", hasAccounts).apply();
|
||||
|
|
|
@ -205,7 +205,7 @@ public class ActivityWidget extends ActivityBase {
|
|||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -310,7 +310,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4879,7 +4879,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,9 +33,11 @@ public interface DaoAccount {
|
|||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getAccounts();
|
||||
|
||||
@Query("SELECT * FROM account WHERE synchronize" +
|
||||
@Query("SELECT * FROM account" +
|
||||
" WHERE synchronize" +
|
||||
" AND (:type IS NULL OR pop = :type)" +
|
||||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getSynchronizingAccounts();
|
||||
List<EntityAccount> getSynchronizingAccounts(Integer type);
|
||||
|
||||
@Query("SELECT * FROM account" +
|
||||
" WHERE (:id IS NULL OR id = :id)" +
|
||||
|
|
|
@ -447,7 +447,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
DB db = DB.getInstance(context);
|
||||
EntityAccount account = null;
|
||||
if (aid < 0) {
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts();
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP);
|
||||
if (accounts == null)
|
||||
return null;
|
||||
for (EntityAccount a : accounts)
|
||||
|
|
|
@ -44,7 +44,7 @@ public class FragmentDialogSelectAccount extends FragmentDialogBase {
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1255,12 +1255,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
List<EntityAccount> result = new ArrayList<>();
|
||||
DB db = DB.getInstance(context);
|
||||
if (aid < 0) {
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts();
|
||||
for (EntityAccount account : accounts)
|
||||
if (account.protocol == EntityAccount.TYPE_IMAP)
|
||||
result.add(account);
|
||||
} else {
|
||||
if (aid < 0)
|
||||
result.addAll(db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP));
|
||||
else {
|
||||
EntityAccount account = db.account().getAccount(aid);
|
||||
if (account != null && account.protocol == EntityAccount.TYPE_IMAP)
|
||||
result.add(account);
|
||||
|
@ -3269,9 +3266,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
result.accounts = new ArrayList<>();
|
||||
if (!result.hasPop)
|
||||
for (EntityAccount account : db.account().getSynchronizingAccounts())
|
||||
if (account.protocol == EntityAccount.TYPE_IMAP)
|
||||
result.accounts.add(account);
|
||||
result.accounts.addAll(db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP));
|
||||
|
||||
if (result.folders.size() > 1)
|
||||
result.folders = new ArrayList<>();
|
||||
|
@ -4344,7 +4339,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
DB db = DB.getInstance(context);
|
||||
if (folder < 0) {
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts();
|
||||
List<EntityAccount> accounts = db.account().getSynchronizingAccounts(null);
|
||||
if (accounts != null)
|
||||
for (EntityAccount account : accounts)
|
||||
db.message().ignoreAll(account.id, null, type);
|
||||
|
@ -8903,7 +8898,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
List<EntityAccount> accounts;
|
||||
if (account < 0)
|
||||
accounts = db.account().getSynchronizingAccounts();
|
||||
accounts = db.account().getSynchronizingAccounts(null);
|
||||
else {
|
||||
EntityAccount account = db.account().getAccount(aid);
|
||||
if (account == null)
|
||||
|
|
|
@ -98,7 +98,7 @@ public class FragmentOrder extends FragmentBase {
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -408,7 +408,7 @@ public class FragmentRule extends FragmentBase {
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(EntityAccount.TYPE_IMAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -648,7 +648,7 @@ public class FragmentSetup extends FragmentBase {
|
|||
@Override
|
||||
protected List<EntityAccount> onExecute(Context context, Bundle args) throws Throwable {
|
||||
DB db = DB.getInstance(context);
|
||||
return db.account().getSynchronizingAccounts();
|
||||
return db.account().getSynchronizingAccounts(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -148,7 +148,7 @@ public class ServiceExternal extends Service {
|
|||
DB db = DB.getInstance(context);
|
||||
List<EntityAccount> accounts;
|
||||
if (accountName == null)
|
||||
accounts = db.account().getSynchronizingAccounts();
|
||||
accounts = db.account().getSynchronizingAccounts(null);
|
||||
else {
|
||||
EntityAccount account = db.account().getAccount(accountName);
|
||||
if (account == null)
|
||||
|
|
Loading…
Reference in New Issue