private void confirmNewKey(final Contact contact, final PGPUtils.PGPCoderKey key) { WebPanel panel = new GroupPanel(GAP_DEFAULT, false); panel.setOpaque(false); panel.add(new WebLabel(Tr.tr("Received new key for contact")).setBoldFont()); panel.add(new WebSeparator(true, true)); panel.add(new WebLabel(Tr.tr("Contact:"))); String contactText = Utils.name(contact) + " " + Utils.jid(contact.getJID(), 30, true); panel.add(new WebLabel(contactText).setBoldFont()); panel.add(new WebLabel(Tr.tr("Key fingerprint:"))); WebTextArea fpArea = Utils.createFingerprintArea(); fpArea.setText(Utils.fingerprint(key.fingerprint)); panel.add(fpArea); String expl = Tr.tr( "When declining the key further communication to and from this contact will be blocked."); WebTextArea explArea = new WebTextArea(expl, 3, 30); explArea.setEditable(false); explArea.setLineWrap(true); explArea.setWrapStyleWord(true); panel.add(explArea); WebNotificationPopup popup = NotificationManager.showNotification( panel, NotificationOption.accept, NotificationOption.decline, NotificationOption.cancel); popup.setClickToClose(false); popup.addNotificationListener( new NotificationListener() { @Override public void optionSelected(NotificationOption option) { switch (option) { case accept: mControl.acceptKey(contact, key); break; case decline: mControl.declineKey(contact); } } @Override public void accepted() {} @Override public void closed() {} }); }
private static String contactText(Contact contact) { return Utils.name(contact, 20) + " < " + Utils.jid(contact.getJID(), 30) + " >"; }