Skip to content

Commit

Permalink
handle cell phone number. close #2593
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Sep 30, 2024
1 parent 23240a5 commit c5e1cc9
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ public class AddressFromClipboardDialog extends javax.swing.JDialog {

/**
* Creates new form AddressFromClipboardDialog
* @param parent
* @param modal
*/
public AddressFromClipboardDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
Expand All @@ -692,9 +694,6 @@ public AddressFromClipboardDialog(java.awt.Frame parent, boolean modal) {
int mark = e.getMark();

if (dot != mark) {
System.out.println("Selection Start: " + Math.min(dot, mark));
System.out.println("Selection End: " + Math.max(dot, mark));

try {
String text = this.taBody.getText(Math.min(dot, mark), Math.max(dot, mark) - Math.min(dot, mark));
text = text.replace(", ", "\n");
Expand All @@ -703,8 +702,6 @@ public AddressFromClipboardDialog(java.awt.Frame parent, boolean modal) {
log.error("Unable to extract attributes", ex);
}

} else {
System.out.println("Caret Position: " + dot);
}
});

Expand All @@ -720,8 +717,6 @@ private void extractAttributes(String text) {
DefaultTableModel tm = (DefaultTableModel) this.tblAttributes.getModel();
tm.setRowCount(0);

boolean addressProvided=false;

String[] lines = text.split("\n");
for (String line : lines) {
line=line.trim();
Expand All @@ -739,7 +734,6 @@ private void extractAttributes(String text) {
line=line.replace("(dot)", ".");
line=line.replace(":", "");
line=line.trim();
addressProvided=true;
} else if (line.toLowerCase().contains("telefon") || line.toLowerCase().contains("tel:") || line.toLowerCase().contains("tel.")) {
field=AttributeCellEditor.ATTRIBUTE_TEL;
line=line.replace("Telefonnummer", "");
Expand All @@ -753,6 +747,15 @@ private void extractAttributes(String text) {
line=line.replace(":", "");
line=line.replace(".", "");
line=line.trim();
} else if (line.toLowerCase().contains("mobil")) {
field=AttributeCellEditor.ATTRIBUTE_MOBIL;
line=line.replace("Mobil", "");
line=line.replace("Mobilnummer", "");
line=line.replace("Handy", "");
line=line.replace("handy", "");
line=line.replace(":", "");
line=line.replace(".", "");
line=line.trim();
} else if (line.toLowerCase().contains("fax") || line.toLowerCase().contains("fax:") || line.toLowerCase().contains("telefax") || line.toLowerCase().contains("telefax:")) {
field=AttributeCellEditor.ATTRIBUTE_FAX;
line=line.replace("Telefax", "");
Expand Down

0 comments on commit c5e1cc9

Please sign in to comment.