diff options
author | Damian Minkov <damencho@jitsi.org> | 2008-01-17 15:37:44 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2008-01-17 15:37:44 +0000 |
commit | fd8d790d9d4a3cbfb1be3d1dc768eeef1cd94641 (patch) | |
tree | 5cc7b5bf4965007d1449a565ace142a4143f1349 | |
parent | e506093830821ad1ec71c3d45853ecea24961463 (diff) | |
download | jitsi-fd8d790d9d4a3cbfb1be3d1dc768eeef1cd94641.zip jitsi-fd8d790d9d4a3cbfb1be3d1dc768eeef1cd94641.tar.gz jitsi-fd8d790d9d4a3cbfb1be3d1dc768eeef1cd94641.tar.bz2 |
1. Fix including resources in swing and branding bundles
9 files changed, 230 insertions, 93 deletions
@@ -1354,7 +1354,15 @@ javax.swing.event, javax.swing.border"/> prefix="net/java/sip/communicator/service/gui"/> <zipfileset dir="${dest}/net/java/sip/communicator/impl/gui" prefix="net/java/sip/communicator/impl/gui"/> - <zipfileset dir="${resources}" + <zipfileset dir="${resources}/images/logo" + prefix="resources/images/logo"/> + <zipfileset dir="${resources}/images/impl/gui" + prefix="resources/images/impl/gui"/> + <zipfileset dir="${resources}/styles" + prefix="resources/styles"/> + <zipfileset dir="${resources}/colors" + prefix="resources/colors"/> + <zipfileset dir="${resources}" includes="application.properties" prefix="resources"/> </jar> </target> @@ -1555,7 +1563,13 @@ javax.swing.event, javax.swing.border"/> manifest="${src}/net/java/sip/communicator/plugin/branding/branding.manifest.mf"> <zipfileset dir="${dest}/net/java/sip/communicator/plugin/branding" prefix="net/java/sip/communicator/plugin/branding"/> - <zipfileset dir="${resources}" + <zipfileset dir="${resources}/images/plugin/branding" + prefix="resources/images/plugin/branding"/> + <zipfileset dir="${resources}/styles" + prefix="resources/styles"/> + <zipfileset dir="${resources}/colors" + prefix="resources/colors"/> + <zipfileset dir="${resources}" includes="application.properties" prefix="resources"/> </jar> </target> diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java index 6f58bc8..cffcf05 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java @@ -962,30 +962,46 @@ public class MetaContactListServiceImpl ( (MetaContactGroupImpl) newMetaGroup).addMetaContact( (MetaContactImpl) metaContact); - //first make sure that the new meta contact group path is resolved - //against all protocols that the MetaContact requires. then move - //the meta contact in there and move all prot contacts inside it. - Iterator contacts = metaContact.getContacts(); - - while (contacts.hasNext()) + try { - Contact protoContact = (Contact) contacts.next(); + //first make sure that the new meta contact group path is resolved + //against all protocols that the MetaContact requires. then move + //the meta contact in there and move all prot contacts inside it. + Iterator contacts = metaContact.getContacts(); - ContactGroup protoGroup = resolveProtoPath(protoContact - .getProtocolProvider(), (MetaContactGroupImpl) newMetaGroup); + while (contacts.hasNext()) + { + Contact protoContact = (Contact) contacts.next(); - //get a persistent or non persistent presence operation set - OperationSetPersistentPresence opSetPresence - = (OperationSetPersistentPresence) protoContact - .getProtocolProvider().getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + ContactGroup protoGroup = resolveProtoPath(protoContact + .getProtocolProvider(), (MetaContactGroupImpl) newMetaGroup); - if (opSetPresence == null) - { - /** @todo handle non persistent presence operation sets */ + //get a persistent or non persistent presence operation set + OperationSetPersistentPresence opSetPresence + = (OperationSetPersistentPresence) protoContact + .getProtocolProvider().getSupportedOperationSets() + .get(OperationSetPersistentPresence.class.getName()); + + if (opSetPresence == null) + { + /** @todo handle non persistent presence operation sets */ + } + + opSetPresence.moveContactToGroup(protoContact, protoGroup); } + } + catch (Exception ex) + { + logger.error("Cannot move contact", ex); + + // now move the contact to prevoius parent + ((MetaContactGroupImpl)newMetaGroup). + removeMetaContact( (MetaContactImpl) metaContact); - opSetPresence.moveContactToGroup(protoContact, protoGroup); + currentParent.addMetaContact((MetaContactImpl) metaContact); + + throw new MetaContactListException(ex.getMessage(), + MetaContactListException.CODE_MOVE_CONTACT_ERROR); } //fire the mved event. @@ -1105,27 +1121,35 @@ public class MetaContactListServiceImpl " is not an instance of MetaContactGroupImpl"); } - //remove all proto groups and then remove the meta group as well. - Iterator protoGroups - = ( (MetaContactGroupImpl) groupToRemove).getContactGroups(); - - while (protoGroups.hasNext()) + try { - ContactGroup protoGroup = (ContactGroup) protoGroups.next(); + //remove all proto groups and then remove the meta group as well. + Iterator protoGroups + = ( (MetaContactGroupImpl) groupToRemove).getContactGroups(); - OperationSetPersistentPresence opSetPersPresence - = (OperationSetPersistentPresence) protoGroup - .getProtocolProvider().getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); - - if (opSetPersPresence == null) + while (protoGroups.hasNext()) { - /** @todo handle removal of non persistent proto groups */ - return; - } + ContactGroup protoGroup = (ContactGroup) protoGroups.next(); + + OperationSetPersistentPresence opSetPersPresence + = (OperationSetPersistentPresence) protoGroup + .getProtocolProvider().getSupportedOperationSets().get( + OperationSetPersistentPresence.class.getName()); - opSetPersPresence.removeServerStoredContactGroup(protoGroup); + if (opSetPersPresence == null) + { + /** @todo handle removal of non persistent proto groups */ + return; + } + + opSetPersPresence.removeServerStoredContactGroup(protoGroup); + } + }catch(Exception ex) + { + throw new MetaContactListException(ex.getMessage(), + MetaContactListException.CODE_REMOVE_GROUP_ERROR); } + MetaContactGroupImpl parentMetaGroup = (MetaContactGroupImpl) findParentMetaContactGroup( (MetaContactGroupImpl) groupToRemove); diff --git a/src/net/java/sip/communicator/impl/gui/i18n/messages.properties b/src/net/java/sip/communicator/impl/gui/i18n/messages.properties index 223b05e..79d13a2 100644 --- a/src/net/java/sip/communicator/impl/gui/i18n/messages.properties +++ b/src/net/java/sip/communicator/impl/gui/i18n/messages.properties @@ -189,6 +189,7 @@ moveSubcontactMsg=Select the contact, where you would like to move. moveSubcontact=M&ove Subcontact moveSubcontactInSameContact=The contact you have choosen is the same as \n the source one. Please choose another contact! moveToGroup=&Move to group +moveContactError=&Contact cannot be moved msgDeliveryFailure=The above message could not be delivered msgDeliveryOfflineNotSupported=The protocol you are using doesn't support offline messages. You could try to reach this contact through another protocol or wait until he/she becomes online. msgDeliveryInternalError=An internal error occured. This is most probably a bug. Please report it here: http://www.sip-communicator.org/index.php/Development/BugsAndIssues diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java index 2cd75b1..57503de 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java @@ -18,6 +18,8 @@ import javax.swing.text.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.impl.gui.i18n.*; +import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.event.*; import net.java.sip.communicator.service.protocol.*; @@ -871,8 +873,21 @@ public class ContactList } else if (!contactDest.contains(draggedElement.getMetaContact())) { - mainFrame.getContactList().moveMetaContact( - draggedElement.getMetaContact(), contactDest); + try + { + mainFrame.getContactList().moveMetaContact( + draggedElement.getMetaContact(), contactDest); + } + catch (Exception ex) + { + new ErrorDialog( + mainFrame, + Messages.getI18NString( + "moveToGroup").getText(), + Messages.getI18NString( + "moveContactError").getText(), + ex).showDialog(); + } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java index 55665b3..adfd2e5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java @@ -497,9 +497,23 @@ public class ContactRightButtonMenu MetaContactGroup group = mainFrame.getGroupByID( itemName.substring(moveToPrefix.length())); - - if(group != null) { - mainFrame.getContactList().moveMetaContact(contactItem, group); + + try + { + if(group != null) { + mainFrame.getContactList(). + moveMetaContact(contactItem, group); + } + } + catch (Exception ex) + { + new ErrorDialog( + mainFrame, + Messages.getI18NString( + "moveToGroup").getText(), + Messages.getI18NString( + "moveContactError").getText(), + ex).showDialog(); } } else if (itemName.startsWith(removeContactPrefix)) { @@ -569,30 +583,42 @@ public class ContactRightButtonMenu this.contact = contact; } public void run() { - if(Constants.REMOVE_CONTACT_ASK) { - String message = "<HTML>Are you sure you want to remove <B>" - + contact.getDisplayName() - + "</B><BR>from your contact list?</html>"; - - MessageDialog dialog = new MessageDialog( - mainFrame, - Messages.getI18NString("removeContact").getText(), - message, - Messages.getI18NString("remove").getText()); - - int returnCode = dialog.showDialog(); - - if (returnCode == MessageDialog.OK_RETURN_CODE) { - mainFrame.getContactList().removeContact(contact); + try + { + if(Constants.REMOVE_CONTACT_ASK) { + String message = "<HTML>Are you sure you want to remove <B>" + + contact.getDisplayName() + + "</B><BR>from your contact list?</html>"; + + MessageDialog dialog = new MessageDialog( + mainFrame, + Messages.getI18NString("removeContact").getText(), + message, + Messages.getI18NString("remove").getText()); + + int returnCode = dialog.showDialog(); + + if (returnCode == MessageDialog.OK_RETURN_CODE) { + mainFrame.getContactList().removeContact(contact); + } + else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { + mainFrame.getContactList().removeContact(contact); + + Constants.REMOVE_CONTACT_ASK = false; + } } - else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { + else { mainFrame.getContactList().removeContact(contact); - - Constants.REMOVE_CONTACT_ASK = false; } } - else { - mainFrame.getContactList().removeContact(contact); + catch (Exception ex) + { + new ErrorDialog(mainFrame, + Messages.getI18NString( + "removeContact").getText(), + ex.getMessage(), + ex) + .showDialog(); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java index d2c08e6..91b549e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java @@ -198,32 +198,44 @@ public class GroupRightButtonMenu } public void run() { - if(Constants.REMOVE_CONTACT_ASK) { + try + { + if(Constants.REMOVE_CONTACT_ASK) { String message = "<HTML>Are you sure you want to remove <B>" - + this.group.getGroupName() + + this.group.getGroupName() + "</B><BR>from your contact list?</html>"; - MessageDialog dialog = new MessageDialog( - mainFrame, - Messages.getI18NString("removeGroup").getText(), - message, - Messages.getI18NString("remove").getText()); + MessageDialog dialog = new MessageDialog( + mainFrame, + Messages.getI18NString("removeGroup").getText(), + message, + Messages.getI18NString("remove").getText()); - int returnCode = dialog.showDialog(); - - if (returnCode == MessageDialog.OK_RETURN_CODE) { - mainFrame.getContactList() + int returnCode = dialog.showDialog(); + + if (returnCode == MessageDialog.OK_RETURN_CODE) { + mainFrame.getContactList() + .removeMetaContactGroup(group); + } + else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { + mainFrame.getContactList() .removeMetaContactGroup(group); + + Constants.REMOVE_CONTACT_ASK = false; + } } - else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) { - mainFrame.getContactList() - .removeMetaContactGroup(group); - - Constants.REMOVE_CONTACT_ASK = false; + else { + mainFrame.getContactList().removeMetaContactGroup(group); } } - else { - mainFrame.getContactList().removeMetaContactGroup(group); + catch (Exception ex) + { + new ErrorDialog(mainFrame, + Messages.getI18NString( + "removeGroup").getText(), + ex.getMessage(), + ex) + .showDialog(); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java b/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java index a6f2fe9..3685ba0 100644 --- a/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java @@ -152,9 +152,13 @@ public class LoginManager for (int i = 0; i < accountsList.size(); i++) { - hasRegisteredAccounts = true; - accountID = (AccountID) accountsList.get(i); + + boolean isHidden = + accountID.getAccountProperties().get("HIDDEN_PROTOCOL") != null; + + if(!isHidden) + hasRegisteredAccounts = true; serRef = providerFactory.getProviderForAccount(accountID); diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/StatusPanel.java b/src/net/java/sip/communicator/impl/gui/main/presence/StatusPanel.java index d6ea1f2..aa8d457 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/StatusPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/StatusPanel.java @@ -35,6 +35,8 @@ public class StatusPanel private GlobalStatusSelectorBox globalStatusBox; private MainFrame mainFrame; + + private int hiddenProviders = 0; /** * Creates an instance of <tt>StatusPanel</tt>. @@ -74,8 +76,15 @@ public class StatusPanel } protocolStatusCombo.addComponentListener(this); - - if (protocolStatusCombos.size() == 1) + + boolean isHidden = + protocolProvider.getAccountID(). + getAccountProperties().get("HIDDEN_PROTOCOL") != null; + + if(isHidden) + hiddenProviders++; + + if (protocolStatusCombos.size() - hiddenProviders == 1) { this.globalStatusBox = new GlobalStatusSelectorBox(mainFrame); @@ -88,9 +97,13 @@ public class StatusPanel this.protocolStatusCombos.put(protocolProvider, protocolStatusCombo); - this.add(protocolStatusCombo); + if(!isHidden) + { + this.add(protocolStatusCombo); - this.getParent().validate(); + this.getParent().validate(); + } + } /** @@ -104,13 +117,24 @@ public class StatusPanel StatusSelectorBox protocolStatusCombo = (StatusSelectorBox) this.protocolStatusCombos.get(pps); + boolean isHidden = + pps.getAccountID().getAccountProperties(). + get("HIDDEN_PROTOCOL") != null; + + if(isHidden) + hiddenProviders--; + this.protocolStatusCombos.remove(pps); - if (protocolStatusCombos.size() == 1 && globalStatusBox != null) + if (protocolStatusCombos.size() - hiddenProviders == 1 && + globalStatusBox != null) { this.remove(globalStatusBox); } + if(protocolStatusCombo == null) + return; + this.remove(protocolStatusCombo); this.revalidate(); @@ -127,6 +151,9 @@ public class StatusPanel StatusSelectorBox protocolStatusCombo = (StatusSelectorBox) this.protocolStatusCombos.get(protocolProvider); + if(protocolStatusCombo == null) + return; + protocolStatusCombo.setAccountIndex(mainFrame .getProviderIndex(protocolProvider)); @@ -142,10 +169,12 @@ public class StatusPanel */ public void startConnecting(ProtocolProviderService protocolProvider) { - StatusSelectorBox selectorBox = (StatusSelectorBox) protocolStatusCombos.get(protocolProvider); - + + if(selectorBox == null) + return; + BufferedImage[] animatedImage = ImageLoader.getAnimatedImage(protocolProvider.getProtocolIcon() .getConnectingIcon()); @@ -333,7 +362,7 @@ public class StatusPanel * in the <tt>StatusPanel</tt>. * * @param pps The protocol provider to check. - * @return True if the protcol has already its StatusSelectorBox in the + * @return True if the protocol has already its StatusSelectorBox in the * StatusPanel, False otherwise. */ public boolean containsAccount(ProtocolProviderService pps) @@ -400,4 +429,4 @@ public class StatusPanel public void componentShown(ComponentEvent e) { } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/service/contactlist/MetaContactListException.java b/src/net/java/sip/communicator/service/contactlist/MetaContactListException.java index 33a8a1a..2572d2a 100644 --- a/src/net/java/sip/communicator/service/contactlist/MetaContactListException.java +++ b/src/net/java/sip/communicator/service/contactlist/MetaContactListException.java @@ -49,16 +49,28 @@ public class MetaContactListException public static final int CODE_UNKNOWN_ERROR = 5; /** - * An error code indicating the nature of this excepiton. + * An error code indicating the nature of this exception. */ private int errCode = CODE_UNKNOWN_ERROR; + + /** + * Indicates that the exception was caused by the fact that we tried to + * remove a group that cannot be removed or an error occur during remove. + */ + public static final int CODE_REMOVE_GROUP_ERROR = 6; + + /** + * Indicates that the exception was caused by the fact that we tried to + * move a contact that cannot be moved or an error occur during move. + */ + public static final int CODE_MOVE_CONTACT_ERROR = 7; /** * Creates a MetaContactListException with the specified message cause and * code. * @param message a human readable message describing the exception. * @param cause the Exception/Error (if any) that caused this Exception. - * @param code one of the statuc CODE_XXX variable, describing the nature + * @param code one of the status CODE_XXX variable, describing the nature * of the exception. */ public MetaContactListException(String message, Exception cause, int code) @@ -71,7 +83,7 @@ public class MetaContactListException * Creates a MetaContactListException with the specified message error code. * * @param message a human readable message describing the exception. - * @param code one of the statuc CODE_XXX variable, describing the nature + * @param code one of the status CODE_XXX variable, describing the nature * of the exception. */ public MetaContactListException(String message, int code) |