mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-791 added refresh button to user information to manually force a reload. spark checks for vcard changes on startup.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12346 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
holger.bergunde
parent
c94eb8b5c1
commit
c7b4f26d6d
@ -64,6 +64,7 @@ public class VCardEditor {
|
||||
private HomePanel homePanel;
|
||||
private AvatarPanel avatarPanel;
|
||||
private JLabel avatarLabel;
|
||||
private VCard _vcard;
|
||||
|
||||
/**
|
||||
* Displays the VCard for an individual.
|
||||
@ -184,6 +185,7 @@ public class VCardEditor {
|
||||
tabbedPane.addTab(Res.getString("tab.avatar"), avatarPanel);
|
||||
|
||||
// Build the UI
|
||||
_vcard = vCard;
|
||||
buildUI(vCard);
|
||||
|
||||
final JOptionPane pane;
|
||||
@ -206,7 +208,7 @@ public class VCardEditor {
|
||||
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
||||
|
||||
// The user should only be able to close this dialog.
|
||||
Object[] options = { Res.getString("close") };
|
||||
Object[] options = { Res.getString("close"), Res.getString("refresh") };
|
||||
pane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
||||
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
||||
|
||||
@ -221,7 +223,6 @@ public class VCardEditor {
|
||||
dlg.setResizable(true);
|
||||
dlg.setContentPane(mainPanel);
|
||||
dlg.setLocationRelativeTo(parent);
|
||||
|
||||
PropertyChangeListener changeListener = new PropertyChangeListener() {
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
Object o = pane.getValue();
|
||||
@ -236,6 +237,14 @@ public class VCardEditor {
|
||||
pane.removePropertyChangeListener(this);
|
||||
dlg.dispose();
|
||||
}
|
||||
|
||||
if (Res.getString("refresh").equals(value)) {
|
||||
VCardManager manager = SparkManager.getVCardManager();
|
||||
VCard card = manager.reloadVCard(vCard.getJabberId());
|
||||
fillUI(card);
|
||||
saveVCard();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@ -329,6 +338,24 @@ public class VCardEditor {
|
||||
* the vcard used to build the UI.
|
||||
*/
|
||||
private void buildUI(VCard vcard) {
|
||||
|
||||
fillUI(vcard);
|
||||
|
||||
// Set avatar
|
||||
byte[] bytes = vcard.getAvatar();
|
||||
if (bytes != null && bytes.length > 0) {
|
||||
ImageIcon icon = new ImageIcon(bytes);
|
||||
avatarPanel.setAvatar(icon);
|
||||
avatarPanel.setAvatarBytes(bytes);
|
||||
if (avatarLabel != null) {
|
||||
icon = GraphicUtils.scaleImageIcon(icon, 48, 48);
|
||||
|
||||
avatarLabel.setIcon(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillUI(VCard vcard){
|
||||
personalPanel.setFirstName(vcard.getFirstName());
|
||||
personalPanel.setMiddleName(vcard.getMiddleName());
|
||||
personalPanel.setLastName(vcard.getLastName());
|
||||
@ -360,20 +387,8 @@ public class VCardEditor {
|
||||
homePanel.setFax(vcard.getPhoneHome("FAX"));
|
||||
homePanel.setPager(vcard.getPhoneHome("PAGER"));
|
||||
homePanel.setMobile(vcard.getPhoneHome("CELL"));
|
||||
}
|
||||
|
||||
// Set avatar
|
||||
byte[] bytes = vcard.getAvatar();
|
||||
if (bytes != null && bytes.length > 0) {
|
||||
ImageIcon icon = new ImageIcon(bytes);
|
||||
avatarPanel.setAvatar(icon);
|
||||
avatarPanel.setAvatarBytes(bytes);
|
||||
if (avatarLabel != null) {
|
||||
icon = GraphicUtils.scaleImageIcon(icon, 48, 48);
|
||||
|
||||
avatarLabel.setIcon(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the VCard.
|
||||
|
||||
@ -248,6 +248,7 @@ reject = Reject
|
||||
retry = Retry
|
||||
room.name = Room Name
|
||||
save = Save
|
||||
refresh = Refresh
|
||||
subject = Subject
|
||||
unfiled = Unfiled
|
||||
use.default = Use Default
|
||||
|
||||
@ -148,6 +148,7 @@ retry = Wiederholen
|
||||
active = Aktiv
|
||||
not.registered = Nicht registriert
|
||||
save = Speichern
|
||||
refresh = Aktualisieren
|
||||
yes = Ja
|
||||
no = Nein
|
||||
broadcast = Rundnachricht
|
||||
|
||||
Reference in New Issue
Block a user