private String name;
private boolean permitPosting;
private boolean showCommodityByDefault;
+ private String defaultCommodity;
private String preferredAccountsFilter;
private String url;
private boolean authEnabled;
orderNo = origin.orderNo;
futureDates = origin.futureDates;
apiVersion = origin.apiVersion;
+ defaultCommodity = origin.defaultCommodity;
}
// loads all profiles into Data.profiles
// returns the profile with the given UUID
try (Cursor cursor = db.rawQuery("SELECT uuid, name, url, use_authentication, auth_user, " +
"auth_password, permit_posting, theme, order_no, " +
"preferred_accounts_filter, future_dates, api_version, " +
- "show_commodity_by_default FROM " +
+ "show_commodity_by_default, default_commodity FROM " +
"profiles order by order_no", null))
{
while (cursor.moveToNext()) {
item.setFutureDates(cursor.getInt(10));
item.setApiVersion(cursor.getInt(11));
item.setShowCommodityByDefault(cursor.getInt(12) == 1);
+ item.setDefaultCommodity(cursor.getString(13));
list.add(item);
if (item.getUuid()
.equals(currentProfileUUID))
public void setShowCommodityByDefault(boolean showCommodityByDefault) {
this.showCommodityByDefault = showCommodityByDefault;
}
+ public String getDefaultCommodity() {
+ return defaultCommodity;
+ }
+ public void setDefaultCommodity(String defaultCommodity) {
+ this.defaultCommodity = defaultCommodity;
+ }
+ public void setDefaultCommodity(CharSequence defaultCommodity) {
+ if (defaultCommodity == null)
+ this.defaultCommodity = null;
+ else
+ this.defaultCommodity = String.valueOf(defaultCommodity);
+ }
public SendTransactionTask.API getApiVersion() {
return apiVersion;
}
db.execSQL("REPLACE INTO profiles(uuid, name, permit_posting, url, " +
"use_authentication, auth_user, auth_password, theme, order_no, " +
"preferred_accounts_filter, future_dates, api_version, " +
- "show_commodity_by_default) " +
+ "show_commodity_by_default, default_commodity) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
new Object[]{uuid, name, permitPosting, url, authEnabled,
authEnabled ? authUserName : null,
authEnabled ? authPassword : null, themeHue, orderNo,
preferredAccountsFilter, futureDates.toInt(), apiVersion.toInt(),
- showCommodityByDefault
+ showCommodityByDefault, defaultCommodity
});
db.setTransactionSuccessful();
}
create table account_values(profile varchar not null, account varchar not null, currency varchar not null default '', keep boolean, value decimal not null );
create unique index un_account_values on account_values(profile,account,currency);
create table description_history(description varchar not null primary key, keep boolean, description_upper varchar);
-create table profiles(uuid varchar not null primary key, name not null, url not null, use_authentication boolean not null, auth_user varchar, auth_password varchar, order_no integer, permit_posting boolean default 0, theme integer default -1, preferred_accounts_filter varchar, future_dates integer, api_version integer, show_commodity_by_default boolean default 0);
+create table profiles(uuid varchar not null primary key, name not null, url not null, use_authentication boolean not null, auth_user varchar, auth_password varchar, order_no integer, permit_posting boolean default 0, theme integer default -1, preferred_accounts_filter varchar, future_dates integer, api_version integer, show_commodity_by_default boolean default 0, default_commodity varchar);
create table transactions(profile varchar not null, id integer not null, data_hash varchar not null, date varchar not null, description varchar not null, keep boolean not null default 0);
create unique index un_transactions_id on transactions(profile,id);
create unique index un_transactions_data_hash on transactions(profile,data_hash);