From d5e1bc6cb2771c031ecfd7268a06bdeb4220d659 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Mon, 10 Mar 2014 16:45:12 +0200 Subject: [PATCH] Changes ui service to be able to start sms chats from plugins. --- resources/images/images.properties | 3 ++ .../images/impl/gui/buttons/smsButton.png | Bin 0 -> 1217 bytes .../impl/gui/buttons/smsButtonPressed.png | Bin 0 -> 1387 bytes .../impl/gui/buttons/smsButtonSelected.png | Bin 0 -> 1314 bytes .../communicator/impl/gui/UIServiceImpl.java | 14 +++++++- .../impl/gui/main/chat/ChatWindowManager.java | 34 +++++++++++++++++- .../communicator/service/gui/UIService.java | 9 +++++ 7 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 resources/images/impl/gui/buttons/smsButton.png create mode 100644 resources/images/impl/gui/buttons/smsButtonPressed.png create mode 100644 resources/images/impl/gui/buttons/smsButtonSelected.png diff --git a/resources/images/images.properties b/resources/images/images.properties index f9ea95a71..68e3ffe2f 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -174,6 +174,9 @@ service.gui.buttons.ADD_CONTACT_BUTTON_SMALL_ROLLOVER=resources/images/impl/gui/ service.gui.buttons.WEB_BUTTON=resources/images/impl/gui/buttons/webButton.png service.gui.buttons.WEB_BUTTON_PRESSED=resources/images/impl/gui/buttons/webButtonPressed.png service.gui.buttons.WEB_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/webButtonSelected.png +service.gui.buttons.SMS_BUTTON=resources/images/impl/gui/buttons/smsButton.png +service.gui.buttons.SMS_BUTTON_PRESSED=resources/images/impl/gui/buttons/smsButtonPressed.png +service.gui.buttons.SMS_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/smsButtonSelected.png service.gui.buttons.HANGUP_BUTTON_BG=resources/images/impl/gui/buttons/hangupButton.png service.gui.buttons.HANGUP_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/hangupButtonRollover.png service.gui.buttons.HANGUP_BUTTON_PRESSED=resources/images/impl/gui/buttons/hangupButtonPressed.png diff --git a/resources/images/impl/gui/buttons/smsButton.png b/resources/images/impl/gui/buttons/smsButton.png new file mode 100644 index 0000000000000000000000000000000000000000..8f6d64915ba37c1ca54d45d7fa4ccd1ddc41039a GIT binary patch literal 1217 zcmeAS@N?(olHy`uVBq!ia0vp^Qa~)t!3HFg#O7xMDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg49ppsArU1JzCKpT`MG+DAT@dwxdlMo3=B5*6$OdO*{LN8 zNvY|XdA3ULckfqH$V{%1*XSQL?vFu&J;D8jzb> zlBiITo0C^;Rbi_HHrEQs1_|pcDS(xfWZNo192Makpx~Tel&WB=XRMoSU}&gdW~OIo zVrph)sH0$HU}&Uo07PcGh9*{~W>!Y#3Q(W~w5=#5%__*n4QdyVXRDM^Qc_^0uU}qX zu2*iXmtT~wZ)j<02{OaTNEfI=x41H|B(Xv_uUHvof=g;~a#3bMNoIbY0?5R~r2Ntn zTP2`NAzsKW@b!fooL3ADC}5E3S0onb8|oS8=jMX^1y)^L5|oN?23FO@A(aKG`a!A1 z`K3k4!1zd0hG_np+{nPp!qCvt+`_`i(bC1z$jQyX(#;WO1~$Ehjt0(7rWVGI2Bt2ChOWj=X2!)eNyv)d8P=MIdV6I zCjv9pdrud~kcwMx!VYpBGT@1Qw(r3D50BJ$$bS#>mt)*LB8n zSF+Pzj%(WL7Z(e~Eq~y6W5tA-oL3Bl7IU(=GWgAQ?9yQCKe_Y5O;@hITY@gx>Sg{P zzw>PF=$Oora$h)8r6;FtX03apPN0!E=jIL#7wK!=+~59J%?&Z$|JSGDef*yGk7X_g zcj>5UK5tL7uzo&oW!1)OapJp97s*ci#mrm%Dc0$6^PhcYdl&v=4PBIw&&bB0adV37 TFQ2VXK!u8@tDnm{r-UW|eae<- literal 0 HcmV?d00001 diff --git a/resources/images/impl/gui/buttons/smsButtonPressed.png b/resources/images/impl/gui/buttons/smsButtonPressed.png new file mode 100644 index 0000000000000000000000000000000000000000..8879e72b781cc9a8b71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communicator/impl/gui/UIServiceImpl.java index 5dfa0d2c2..02771597a 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -1538,9 +1538,21 @@ public void createCall(String[] participants) * @see UIService#startChat(String[]) */ public void startChat(String[] participants) + { + startChat(participants, false); + } + + /** + * Starts a new Chat with a specific set of participants. + * + * @param participants an array of String values specifying the + * participants to be included into the newly created Chat + * @param isSmsEnabled whether sms option should be enabled if possible + */ + public void startChat(String[] participants, boolean isSmsEnabled) { if (participants.length == 1) - getChatWindowManager().startChat(participants[0]); + getChatWindowManager().startChat(participants[0], isSmsEnabled); else throw new IllegalArgumentException("participants"); } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java index df4ab8856..88a0fb10e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java @@ -921,6 +921,11 @@ public void startChat( MetaContact metaContact, } public void startChat(String contactString) + { + startChat(contactString, false); + } + + public void startChat(String contactString, boolean isSmsEnabled) { List imProviders = AccountUtils.getRegisteredProviders( @@ -965,7 +970,34 @@ public void startChat(String contactString) } } if (startChat) - startChat(metaContact, contact, false); + startChat(metaContact, contact, isSmsEnabled); + else if(isSmsEnabled) + { + // nothing found but we want to send sms, lets check and create + // the contact as it may not exist + List smsProviders + = AccountUtils.getRegisteredProviders( + OperationSetSmsMessaging.class); + + if(smsProviders == null || smsProviders.size() == 0) + return; + + OperationSetSmsMessaging smsOpSet + = smsProviders.get(0) + .getOperationSet(OperationSetSmsMessaging.class); + + contact = smsOpSet.getContact(contactString); + + if (contact != null) + { + metaContact + = metaContactListService.findMetaContactByContact(contact); + if (metaContact != null) + { + startChat(metaContact, contact, isSmsEnabled); + } + } + } } /** diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index 549941df6..d4b0b31cf 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -453,6 +453,15 @@ public SecurityAuthority getDefaultSecurityAuthority( */ public void startChat(String[] participants); + /** + * Starts a new Chat with a specific set of participants. + * + * @param participants an array of String values specifying the + * participants to be included into the newly created Chat + * @param isSmsEnabled whether sms option should be enabled if possible + */ + public void startChat(String[] participants, boolean isSmsEnabled); + /** * Creates a contact list component. *