remove the possibility to create a group during the add contact process

cusax-fix
Yana Stamcheva 20 years ago
parent 4dc217ac3c
commit 5bb8efeaab

@ -52,6 +52,7 @@ continue=&Continue
copy=&Copy
copyLink=Copy &link
create=C&reate
createGroup=&Create group
createGroupName=In the field below enter the name of the group you would like to create.
cut=C&ut
date=Date
@ -156,8 +157,8 @@ selectAccount=Select account
selectAccountRegistration=From the list below select the account registration wizard to use for creating a new account.
selectAccountRegWizardTitle=Select account registration
selectGroup=Select group
selectGroupWizard=The list below contains all groups in your Contact List. Select the one, where you would like to add the new contact. To add it in a new group simply write the name of the group in the field.
selectGroupWizardTitle=Select group(s)
selectGroupWizard=The list below contains all groups in your Contact List. Select the one, where you would like to add the new contact.
selectGroupWizardTitle=Select group
selectProvidersWizard=The list below contains all registered accounts. Select these one you would like to use to communicate with the new contact.
selectProvidersWizardTitle=Select account(s)
send=&Send

@ -6,24 +6,19 @@
*/
package net.java.sip.communicator.impl.gui.main.contactlist.addcontact;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.customcontrols.wizard.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.contactlist.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
public class AddContactWizard
extends Wizard
implements MetaContactListListener,
WizardListener
implements WizardListener
{
private Logger logger = Logger.getLogger(AddContactWizard.class.getName());
@ -61,9 +56,7 @@ public AddContactWizard(MainFrame mainFrame)
this.registerWizardPage(AddContactWizardPage3.IDENTIFIER, page3);
this.setCurrentPage(AddContactWizardPage1.IDENTIFIER);
this.mainFrame.getContactList().addMetaContactListListener(this);
this.setCurrentPage(AddContactWizardPage1.IDENTIFIER);
}
/**
@ -80,13 +73,15 @@ private class CreateContact extends Thread {
ProtocolProviderService pps;
MetaContactGroup group;
NewContact newContact;
CreateContact(ProtocolProviderService pps,
MetaContactGroup group,
NewContact newContact) {
NewContact newContact)
{
this.pps = pps;
this.group = group;
this.group = newContact.getGroup();
this.newContact = newContact;
}
public void run() {
try {
mainFrame.getContactList()
@ -96,7 +91,7 @@ public void run() {
catch (MetaContactListException ex) {
logger.error(ex);
ex.printStackTrace();
int errorCode = ex.getErrorCode();
int errorCode = ex.getErrorCode();
if (errorCode
== MetaContactListException
@ -145,146 +140,18 @@ else if (errorCode
}
}
}
/**
* Creates a new meta contact group in a separate thread.
*/
private class CreateGroup extends Thread {
MetaContactListService mcl;
NewContact newContact;
CreateGroup(MetaContactListService mcl,
NewContact newContact) {
this.mcl = mcl;
this.newContact = newContact;
}
public void run() {
new Thread() {
public void run() {
String groupName = newContact.getNewGroup();
try {
mcl.createMetaContactGroup(
mcl.getRoot(), groupName);
}
catch (MetaContactListException ex) {
logger.error(ex);
int errorCode = ex.getErrorCode();
if (errorCode
== MetaContactListException
.CODE_CONTACT_ALREADY_EXISTS_ERROR) {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupExistError",
groupName).getText(),
Messages.getI18NString(
"addGroupErrorTitle").getText())
.showDialog();
}
else if (errorCode
== MetaContactListException.CODE_LOCAL_IO_ERROR) {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupLocalError",
groupName).getText(),
Messages.getI18NString(
"addGroupErrorTitle").getText())
.showDialog();
}
else if (errorCode
== MetaContactListException.CODE_NETWORK_ERROR) {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupNetError",
groupName).getText(),
Messages.getI18NString(
"addGroupErrorTitle").getText())
.showDialog();
}
else {
new ErrorDialog(mainFrame,
Messages.getI18NString(
"addGroupError",
groupName).getText(),
Messages.getI18NString(
"addGroupErrorTitle").getText())
.showDialog();
}
}
}
}.start();
}
}
public void metaContactAdded(MetaContactEvent evt)
{}
public void metaContactRenamed(MetaContactRenamedEvent evt)
{}
public void protoContactAdded(ProtoContactEvent evt)
{}
public void protoContactRemoved(ProtoContactEvent evt)
{}
public void protoContactMoved(ProtoContactEvent evt)
{}
public void metaContactRemoved(MetaContactEvent evt)
{}
public void metaContactMoved(MetaContactMovedEvent evt)
{}
public void metaContactGroupAdded(MetaContactGroupEvent evt)
{
MetaContactGroup group
= (MetaContactGroup)evt.getSourceMetaContactGroup();
if(group.getGroupName().equals(newContact.getNewGroup())) {
ArrayList ppList = newContact.getProtocolProviders();
for(int i = 0; i < ppList.size(); i ++) {
ProtocolProviderService pps
= (ProtocolProviderService)ppList.get(i);
new CreateContact(pps, group, newContact).start();
}
}
}
public void metaContactGroupModified(MetaContactGroupEvent evt)
{}
public void metaContactGroupRemoved(MetaContactGroupEvent evt)
{}
public void childContactsReordered(MetaContactGroupEvent evt)
{}
public void wizardFinished(WizardEvent e)
{
if(e.getEventCode() == WizardEvent.SUCCESS) {
if(newContact.getNewGroup() != null
&& !newContact.getNewGroup().equals("")) {
new CreateGroup(mainFrame.getContactList(),
newContact).start();
}
ArrayList ppList = newContact.getProtocolProviders();
MetaContactGroup group = newContact.getGroup();
for(int i = 0; i < ppList.size(); i ++) {
ProtocolProviderService pps
= (ProtocolProviderService)ppList.get(i);
new CreateContact(pps, group, newContact).start();
new CreateContact(pps, newContact).start();
}
}
}

@ -103,7 +103,7 @@ public void pageShown() {
}
public void pageNext() {
this.selectGroupPanel.addNewContactGroup();
this.selectGroupPanel.setGroup();
}
public void pageBack() {

@ -26,8 +26,6 @@ public class NewContact {
private String uin;
private String newGroup;
/**
* Adds a protocol provider to the list of protocol providers, where this
* contact will be added.
@ -85,14 +83,4 @@ public MetaContactGroup getGroup() {
public ArrayList getProtocolProviders() {
return protocolProviders;
}
public String getNewGroup()
{
return newGroup;
}
public void setNewGroup(String newGroup)
{
this.newGroup = newGroup;
}
}

@ -76,7 +76,6 @@ public SelectGroupPanel(WizardContainer wizard, NewContact newContact,
this.newContact = newContact;
this.groupCombo.setPreferredSize(new Dimension(300, 22));
this.groupCombo.setEditable(true);
this.groupCombo.addItemListener(this);
while(groupsList.hasNext())
@ -115,14 +114,11 @@ public SelectGroupPanel(WizardContainer wizard, NewContact newContact,
/**
* Adds all selected from user contact groups in the new contact.
*/
public void addNewContactGroup()
public void setGroup()
{
Object group = groupCombo.getSelectedItem();
if (group instanceof GroupWrapper)
newContact.setGroup(((GroupWrapper)group).getMetaGroup());
else
newContact.setNewGroup(group.toString());
newContact.setGroup(((GroupWrapper)group).getMetaGroup());
}
/**

Loading…
Cancel
Save