Esempio n. 1
0
        private void StartAddEntry()
        {
            PwEntry defaultTemplate = new PwEntry(false, false);

            defaultTemplate.IconId = PwIcon.Key;
            defaultTemplate.Strings.Set(PwDefs.TitleField, new ProtectedString(false, GetString(Resource.String.DefaultTemplate)));
            List <PwEntry> templates = new List <PwEntry>()
            {
                defaultTemplate
            };

            if ((!PwUuid.Zero.Equals(App.Kp2a.CurrentDb.KpDatabase.EntryTemplatesGroup)) &&
                (App.Kp2a.CurrentDb.KpDatabase.RootGroup.FindGroup(App.Kp2a.CurrentDb.KpDatabase.EntryTemplatesGroup, true) != null))
            {
                templates.AddRange(
                    App.Kp2a.CurrentDb.GroupsById[App.Kp2a.CurrentDb.KpDatabase.EntryTemplatesGroup].Entries.OrderBy(
                        entr => entr.Strings.ReadSafe(PwDefs.TitleField)));
            }
            if (templates.Count > 1)
            {
                new AlertDialog.Builder(this)
                .SetAdapter(new TemplateListAdapter(this, Android.Resource.Layout.SelectDialogItem,
                                                    Android.Resource.Id.Text1, templates),
                            (o, args) => { EntryEditActivity.Launch(this, Group, templates[args.Which].Uuid, AppTask); })
                .Show();
            }
            else
            {
                EntryEditActivity.Launch(this, Group, PwUuid.Zero, AppTask);
            }
        }
Esempio n. 2
0
        protected void SetupEditButtons()
        {
            View edit = FindViewById(Resource.Id.entry_edit);

            if (App.Kp2a.GetDb().CanWrite)
            {
                edit.Visibility = ViewStates.Visible;
                edit.Click     += (sender, e) =>
                {
                    EntryEditActivity.Launch(this, Entry, _appTask);
                };
            }
            else
            {
                edit.Visibility = ViewStates.Gone;
            }
        }
Esempio n. 3
0
 private void OnEdit(AutoExecItem item)
 {
     EntryEditActivity.Launch(this, item.Entry, new NullTask());
 }