+ static public void startEditProfileActivity(Context context, MobileLedgerProfile profile) {
+ Intent intent = new Intent(context, ProfileDetailActivity.class);
+ Bundle args = new Bundle();
+ if (profile != null) {
+ int index = Data.getProfileIndex(profile);
+ if (index != -1)
+ intent.putExtra(ProfileDetailFragment.ARG_ITEM_ID, index);
+ }
+ intent.putExtras(args);
+ context.startActivity(intent, args);
+ }
+ public static MobileLedgerProfile fromDBO(Profile newProfile) {
+ MobileLedgerProfile p = new MobileLedgerProfile(newProfile.getId());
+ p.setDetectedVersion(new HledgerVersion(newProfile.getDetectedVersionMajor(),
+ newProfile.getDetectedVersionMinor()));
+ p.setApiVersion(newProfile.getApiVersion());
+ p.setAuthEnabled(newProfile.useAuthentication());
+ p.setAuthUserName(newProfile.getAuthUser());
+ p.setAuthPassword(newProfile.getAuthPassword());
+ p.setDefaultCommodity(newProfile.getDefaultCommodity());
+ p.setFutureDates(newProfile.getFutureDates());
+ p.setName(newProfile.getName());
+ p.setPostingPermitted(newProfile.permitPosting());
+ p.setPreferredAccountsFilter(newProfile.getPreferredAccountsFilter());
+ p.setShowCommentsByDefault(newProfile.getShowCommentsByDefault());
+ p.setShowCommodityByDefault(newProfile.getShowCommodityByDefault());
+ p.setUrl(newProfile.getUrl());
+ p.setThemeId(newProfile.getTheme());
+
+ return p;
+ }
+ public HledgerVersion getDetectedVersion() {
+ return detectedVersion;
+ }
+ public void setDetectedVersion(HledgerVersion detectedVersion) {
+ this.detectedVersion = detectedVersion;
+ }