Creates a new instance of VCardView @param contact
(Contact contact)
| 87 | * @param contact |
| 88 | */ |
| 89 | public VCardView(Contact contact) { |
| 90 | super(contact.getNickJid(), false); |
| 91 | this.vcard = contact.vcard; |
| 92 | this.c = contact; |
| 93 | |
| 94 | refresh=new LinkString(SR.MS_REFRESH) { |
| 95 | public void doAction() { |
| 96 | VCard.request(vcard.getJid(), vcard.getId().substring(5)); |
| 97 | destroyView(); |
| 98 | } |
| 99 | }; |
| 100 | |
| 101 | if (vcard == null || vcard.isEmpty()) { |
| 102 | itemsList.addElement(noVCard); |
| 103 | itemsList.addElement(refresh); |
| 104 | } else { |
| 105 | setPhoto(); |
| 106 | for (int index=0; index<vcard.getCount(); index++) { |
| 107 | String data=vcard.getVCardData(index); |
| 108 | String name=(String)VCard.vCardLabels.elementAt(index); |
| 109 | if (data!=null && name!=null) { |
| 110 | if (!VCard.vCardFields.elementAt(index).equals("URL")) { |
| 111 | MultiLine nData=new MultiLine(name, data); |
| 112 | nData.selectable=true; |
| 113 | itemsList.addElement(nData); |
| 114 | //#ifdef CLIPBOARD |
| 115 | VCardData.append(name).append(":\n").append(data).append("\n"); |
| 116 | //#endif |
| 117 | } else { |
| 118 | url=data; |
| 119 | LinkString nData = new LinkString(url) { |
| 120 | public void doAction() { |
| 121 | BombusMod.getInstance().platformRequest(url); |
| 122 | } |
| 123 | }; |
| 124 | itemsList.addElement(nData); |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | itemsList.addElement(endVCard); |
| 129 | itemsList.addElement(new SpacerItem(10)); |
| 130 | itemsList.addElement(refresh); |
| 131 | //#ifdef CLIPBOARD |
| 132 | copy = new LinkString(SR.MS_COPY + " " + SR.MS_VCARD) { |
| 133 | |
| 134 | public void doAction() { |
| 135 | ClipBoardIO.getInstance().setClipBoard(VCardData.toString()); |
| 136 | destroyView(); |
| 137 | } |
| 138 | }; |
| 139 | itemsList.addElement(copy); |
| 140 | |
| 141 | //#endif |
| 142 | //#ifdef FILE_IO |
| 143 | if (vcard.hasPhoto) { |
| 144 | save = new LinkString(SR.MS_SAVE_PHOTO) { |
| 145 | |
| 146 | public void doAction() { |
nothing calls this directly
no test coverage detected