Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Issue185 v2 #10

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/esmska/data/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Config extends Object implements Serializable {
/** mutex whether config already loaded from disk */
private static boolean loaded = false;

private static final String LATEST_VERSION = "1.6";
private static final String LATEST_VERSION = "1.6.99.2";
private static final Logger logger = Logger.getLogger(Config.class.getName());

private String version = "";
Expand Down
19 changes: 16 additions & 3 deletions src/esmska/data/History.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public static class Record {
private String senderName;
private String gateway;
private Date date;

private String smsId;

/** Create new Record. For detailed parameters restrictions see individual setter methods.
* @param number not null nor empty
* @param text not null
Expand All @@ -158,16 +159,18 @@ public static class Record {
* @param senderNumber
* @param senderName
* @param date null for current time
* @param smsId
*/
public Record(String number, String text, String gateway,
String name, String senderNumber, String senderName, Date date) {
public Record(String number, String text, String gateway, String name,
String senderNumber, String senderName, Date date, String smsId) {
setName(name);
setNumber(number);
setText(text);
setSenderNumber(senderNumber);
setSenderName(senderName);
setGateway(gateway);
setDate(date);
setSmsId(smsId);
}

// <editor-fold defaultstate="collapsed" desc="Get Methods">
Expand Down Expand Up @@ -202,6 +205,11 @@ public String getGateway() {
return gateway;
}

/** Message smsId **/
public String getSmsId() {
return smsId;
}

/** Date of the sending. Never null. */
public Date getDate() {
return date;
Expand Down Expand Up @@ -247,6 +255,11 @@ public void setGateway(String gateway) {
this.gateway = gateway;
}

/** Message smsId */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please better document what happens if you provide a real value and if you provide null?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still applies. I imagine something like:

smsId is used for matching following fragments of the same SMS. If there already is a record in the history with the same smsId, the text of the new record is appended to the text of that previous record, and no new record is created.

public void setSmsId(String smsId) {
this.smsId = smsId;
}

/** Date of the sending. Null value is inicialized with current time. */
public void setDate(Date date) {
if (date == null) {
Expand Down
33 changes: 27 additions & 6 deletions src/esmska/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import esmska.data.Config;
import esmska.data.Gateways;
import esmska.data.History;
import esmska.data.History.Record;
import esmska.data.Icons;
import esmska.data.Log;
import esmska.data.Queue;
Expand Down Expand Up @@ -710,15 +711,35 @@ private boolean saveAll() {
}
}

/** Saves history of sent sms */
/**
* Saves history of sent sms
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's preferable if you don't reformat lines that don't need to be reformatted.

*/
private void createHistory(SMS sms) {
History.Record record = new History.Record(sms.getNumber(), sms.getText(),

boolean match = false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly do you need this variable? You can easily distinguish whether you've found something based on toConcat value, can't you?

List<Record> records = history.getRecords();
for(int i = records.size()-1; i >= 0; i--){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, come on! What about:

ListIterator<Record> li = records.listIterator(records.size());
while (li.hasPrevious()) {
    Record r = li.previous();
    ...
}

Isn't that more readable and less error prone than counting indices?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please wrap the whole searching section in

if (sms.getId() != null) {

If it is null, there's no point in wasting time searching.

Record r = records.get(i);
if (sms.getId() != null) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wrap the whole search section, this line can go away.

if (sms.getId().equals(r.getSmsId())) {
r.setText(r.getText() + sms.getText());
r.setDate(null);
match = true;
break;
}
}
}
if(!match){
Record record = new Record(sms.getNumber(), sms.getText(),
sms.getGateway(), sms.getName(), sms.getSenderNumber(),
sms.getSenderName(), null);
history.addRecord(record);
sms.getSenderName(), null, sms.getId());
history.addRecord(record);
}
}

/** save program configuration

/**
* save program configuration
*
* @return true if saved ok; false otherwise
*/
private boolean saveConfig() {
Expand Down
3 changes: 2 additions & 1 deletion src/esmska/persistence/ExportManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public static void exportHistory(Collection<History.Record> history, OutputStrea
record.getGateway(),
record.getText(),
record.getSenderName(),
record.getSenderNumber()
record.getSenderNumber(),
record.getSmsId()
});
}
writer.flush();
Expand Down
3 changes: 2 additions & 1 deletion src/esmska/persistence/ImportManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ public static ArrayList<History.Record> importHistory(File file) throws Exceptio
String text = reader.get(4);
String senderName = reader.get(5);
String senderNumber = reader.get(6);
String id = reader.get(7);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, if you have an empty history. But people already have some history, and it doesn't contain "id" yet. So you need to convert their history into the new format first. Please have a look at esmska.update.LegacyUpdater, that's used for such conversions (don't forget to git pull first, there were some new commits lately to this file).


Date date = df.parse(dateString);

History.Record record = new History.Record(number, text, gateway,
name, senderNumber, senderName, date);
name, senderNumber, senderName, date, id);
history.add(record);
} catch (Exception e) {
logger.severe("Invalid history record: " + reader.getRawRecord());
Expand Down
2 changes: 1 addition & 1 deletion src/esmska/resources/l10n.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ExportManager.export_ok=Contact export finished successfully
ExportManager.export_ok!=Contact export finished successfully!
ExportManager.contact_list=Contact list (contact name, telephone number, default gateway)
ExportManager.sms_queue=SMS queue to be sent (recipient name, recipient number, gateway, message text, message ID)
ExportManager.history=Sent messages history (date, recipient name, recipient number, gateway, message text, sender name, sender number)
ExportManager.history=Sent messages history (date, recipient name, recipient number, gateway, message text, sender name, sender number, message id)
ExportManager.login=Usernames and password to individual gateways (gateway name, user login, user password)
ExportManager.export_info=<html>You can export your contacts to the CSV or vCard file. These are<br>\ntext files with all the data clearly visible and readable.<br>\nBy using import function you can later on load this data back to Esmska<br>\nor use it other way.<br><br>\nThe file in vCard format is standardized and you can use it<br>\nin many other applications. The CSV file has very simple contents<br>\nand every program creates it a little differently. If you need to change it's<br>\nstructure to import it in other program you can use some spreadsheet,<br>\neg. freely available OpenOffice Calc (www.openoffice.org).<br><br>\nThe file will be saved in the UTF-8 encoding.</html>
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
Expand Down
50 changes: 25 additions & 25 deletions src/esmska/resources/l10n_ca.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
AboutFrame.licenseButton.text=&Llic\u00E8ncia
AboutFrame.creditsButton.text=C&r\u00E8dits
AboutFrame.licenseButton.text=&Llic\u00e8ncia
AboutFrame.creditsButton.text=C&r\u00e8dits
AboutFrame.jLabel3.text=Sending SMS over Internet.
AboutFrame.title=About Esmska
AboutFrame.jLabel5.text=2007-2011 Kamil P\u00E1ral
AboutFrame.License=Llic\u00E8ncia
AboutFrame.Thank_you=Gr\u00E0cies
AboutFrame.Credits=Cr\u00E8dits
AboutFrame.jLabel5.text=2007-2011 Kamil P\u00e1ral
AboutFrame.License=Llic\u00e8ncia
AboutFrame.Thank_you=Gr\u00e0cies
AboutFrame.Credits=Cr\u00e8dits
ClipboardPopupMenu.Cut=Talla
ClipboardPopupMenu.Copy=Copia
ClipboardPopupMenu.Paste=Enganxa
Expand All @@ -24,7 +24,7 @@ History=History
Log_=&Registre
NotificationIcon.Pause/unpause_sending=Pause/unpause sending
Pause_sms_queue=Pause sms queue
Preferences_=&Prefer\u00E8ncies
Preferences_=&Prefer\u00e8ncies
Program_start=Program start
Quit_=&Surt
Show/hide_program=Show/hide program
Expand All @@ -36,10 +36,10 @@ StatusPanel.statusMessageLabel.toolTipText=Click to show application log
Unpause_sms_queue=Unpause sms queue
AboutFrame.Acknowledge=I acknowledge that
HistoryFrame.clearButton.toolTipText=Clear search term (Alt+R, Escape)
HistoryFrame.jLabel1.text=N\u00FAmero:
HistoryFrame.jLabel1.text=N\u00famero:
HistoryFrame.jLabel2.text=Nom:
HistoryFrame.jLabel3.text=Data:
HistoryFrame.jLabel4.text=Passarel\u00B7la:
HistoryFrame.jLabel4.text=Passarel\u00b7la:
#Write it short!
HistoryFrame.jLabel5.text=Sender number:
#Write it short!
Expand All @@ -50,7 +50,7 @@ HistoryFrame.searchField.toolTipText=Enter term to search in messages history
Date=Data
Delete=Esborra
Delete_selected_messages_from_history=Delete selected messages from history
Cancel=Cancel\u00B7la
Cancel=Cancel\u00b7la
HistoryFrame.remove_selected=Really remove all selected messages from history?
Recipient=Destinatari/a
HistoryFrame.resend_message=Resend message to someone else
Expand Down Expand Up @@ -102,9 +102,9 @@ SMSPanel.singleProgressBar=<html>Chars in current message: <b>{0}/{1}</b> (<b>{2
SMSPanel.fullProgressBar=<html>Chars in whole message: <b>{0}/{1}</b> (<b>{2}</b> remaining)</html>
Send_=&Envia
Send_message=Envia missatge
Undo_=&Desf\u00E9s
Undo_=&Desf\u00e9s
SMSPanel.Undo_change_in_message_text=Undo change in message text
Redo_=&Ref\u00E9s
Redo_=&Ref\u00e9s
SMSPanel.Redo_change_in_message_text=Redo undone change in message text
Compress_=&Comprimeix
SMSPanel.compress=Compress the message or currently selected text (Ctrl+K)
Expand Down Expand Up @@ -137,7 +137,7 @@ Import_=Im&port
ImportFrame.choose_export_file=Choose the file with exported contacts
ImportFrame.invalid_file=<html><h2>There was an error while parsing file!</h2>The file probably contains invalid data.</html>
ImportFrame.infoEsmska=<html>To import contacts you need to have a CSV file prepared. You can create it by using "Export contacts" function. Select that file here.</html>
ImportFrame.infoKubik=<html>First you need to export contacts from Kub\u00EDk SMS DreamCom. Run the program, go to the contact list and by using right mouse button export all your contacts to CSV file. Select that file here.</html>
ImportFrame.infoKubik=<html>First you need to export contacts from Kub\u00edk SMS DreamCom. Run the program, go to the contact list and by using right mouse button export all your contacts to CSV file. Select that file here.</html>
ImportFrame.infoDreamComSE=<html>First you need to export contacts from DreamCom SE. Run the program, go to the contact list and by using right mouse button export all your contacts to CSV file. Select that file here.</html>
ImportFrame.infoVcard=<html>To import contacts you need to have a VCARD or VCF file prepared, which can be created by an application containing your contacts. Select that file here.</html>
ImportFrame.encodingUTF8=<html>The program expects the file to be in the UTF-8 encoding.</html>
Expand Down Expand Up @@ -222,7 +222,7 @@ CommandLineParser.invalid_option=Invalid option on the command line! (''{0}'')
CommandLineParser.path=ruta
CommandLineParser.set_user_path=Set the path to the user configuration directory. Specify an absolute pathname. Can't be used with -p.
CommandLineParser.show_this_help=Show this help.
CommandLineParser.usage=\u00DAs:
CommandLineParser.usage=\u00das:
Select=Selecciona
Main.already_running=<html><h2>Esmska is already running!</h2>Esmska is already once started. You can't run multiple program instances.<br>This one will now quit.</html>
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
Expand All @@ -245,18 +245,18 @@ ExportManager.export_ok=Contact export finished successfully
ExportManager.export_ok!=Contact export finished successfully!
ExportManager.contact_list=Contact list (contact name, telephone number, default gateway)
ExportManager.sms_queue=SMS queue to be sent (recipient name, recipient number, gateway, message text, message ID)
ExportManager.history=Sent messages history (date, recipient name, recipient number, gateway, message text, sender name, sender number)
ExportManager.history=Sent messages history (date, recipient name, recipient number, gateway, message text, sender name, sender number, sms id)
ExportManager.login=Usernames and password to individual gateways (gateway name, user login, user password)
ExportManager.export_info=<html>You can export your contacts to the CSV or vCard file. These are<br>\ntext files with all the data clearly visible and readable.<br>\nBy using import function you can later on load this data back to Esmska<br>\nor use it other way.<br><br>\nThe file in vCard format is standardized and you can use it<br>\nin many other applications. The CSV file has very simple contents<br>\nand every program creates it a little differently. If you need to change it's<br>\nstructure to import it in other program you can use some spreadsheet,<br>\neg. freely available OpenOffice Calc (www.openoffice.org).<br><br>\nThe file will be saved in the UTF-8 encoding.</html>
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
SMSSender.sending_message=Sending message to {0} ({1}) ...
SMSSender.no_gateway=no gateway
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
ConfirmingFileChooser.sure_to_replace=<html><h2>A file named ''{0}'' already exists.<br>Do you really want to replace it?</h2>This file already exists in ''{1}''.<br>By replacing it you will overwrite the whole it''s contents.</html>
Replace=Reempla\u00E7a
Replace=Reempla\u00e7a
Credits.authors=Escrit per:
Credits.contributors=Contributions from:
Credits.graphics=Gr\u00E0fics:
Credits.graphics=Gr\u00e0fics:
Credits.sponsors=Sponsors:
#Write the tip as short as possible
Tip.1=To send multiple messages select more contacts in the list using Ctrl key.
Expand Down Expand Up @@ -297,7 +297,7 @@ Tip.18=Program is open and free. Join in and help us improve it!
#Write the tip as short as possible
Tip.donation=A small donation is one of the options how to support future program development.
#Write the tip as short as possible
Tip.20=By using commandline options or the special portable version you can use program even in caf\u00E9 or school.
Tip.20=By using commandline options or the special portable version you can use program even in caf\u00e9 or school.
#Write the tip as short as possible
Tip.21=4 of 5 zoologist recommend using the operating system with a penguin logo.
#Write the tip as short as possible
Expand All @@ -317,7 +317,7 @@ MainFrame.translateMenuItem.toolTipText=Help to translate this application into
MainFrame.problemMenuItem.toolTipText=Report a broken program behavior
#Provide names and contacts to translators
Translators=Launchpad Contributions:\n el_libre - http://www.catmidia.cat XDDDDDDDDDDDDDDDDDDDDDDDDDDD https://launchpad.net/~el-libre
Credits.translators=Tradu\u00EFt per:
Credits.translators=Tradu\u00eft per:
#This string is located in the operating-system menu item
DesktopFile.name=Esmska
#This string is located in the operating-system menu item
Expand All @@ -327,13 +327,13 @@ DesktopFile.comment=Send SMS over the Internet
ConfigFrame.advancedCheckBox.text=A&dvanced settings
ConfigFrame.advancedCheckBox.toolTipText=Show items with more advanced settings
ConfigFrame.generalPanel.TabConstraints.tabTitle=&General
ConfigFrame.appearancePanel.TabConstraints.tabTitle=&Aparen\u00E7a
ConfigFrame.appearancePanel.TabConstraints.tabTitle=&Aparen\u00e7a
ConfigFrame.privacyPanel.TabConstraints.tabTitle=P&rivacitat
ConfigFrame.connectionPanel.TabConstraints.tabTitle=&Connexi\u00F3
ConfigFrame.connectionPanel.TabConstraints.tabTitle=&Connexi\u00f3
GatewayExecutor.INFO_CREDIT_REMAINING=Remaining credit:
#Write the tip as short as possible
Tip.25=Use Help menu to ask a question or report a problem.
Preferences=Prefer\u00E8ncies
Preferences=Prefer\u00e8ncies
CommandLineParser.version=Print program version and exit.
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
CommandLineParser.debug=Print debugging output. Possible modes are:\n* {0} - program debugging. Default choice when no mode specified.\n* {1} - network debugging. Prints HTTP headers, all redirects, etc.\n* {2} - {0} and {1} modes combined. Also prints webpage contents (lots of output).
Expand All @@ -356,7 +356,7 @@ GatewayComboBox.onlyCountry=Mainly usable for country: {0}
GatewayComboBox.international=Can be used internationally.
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
GatewayComboBox.gatewayTooltip=<html>\n<b>{0}</b><br>\nWebsite: <a href="{1}">{1}</a><br>\nDescription: {2}<br><br>\n{3}<br>\nDelay between messages: {4}<br>\n{5}<br>\nGateway version: {6}\n</html>
CommandLineParser.debugMode=mode de depuraci\u00F3
CommandLineParser.debugMode=mode de depuraci\u00f3
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
ContactPanel.addedContact=Added new contact: {0}
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
Expand All @@ -380,8 +380,8 @@ SMSPanel.smsCounterLabel.3={0} chars
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
ImportFrame.foundContacts=Following {0} new contacts were found:
MainFrame.donateMenuItem.text=&Support this project!
Cancel_=&Cancel\u00B7la
OK_=&B\u00E9
Cancel_=&Cancel\u00b7la
OK_=&B\u00e9
QueuePanel.replaceSms=<html>\n<h2>Replace the text?</h2>\nYou are currently composing a new message. Do you want to discard the text<br>\nand replace it with the selected message from the queue?\n</html>
#If you want to use single quotes (') in this translation, you must write them doubled ('')!
UncaughtExceptionDialog.errorLabel=<html>\n<h2>Ooops! An error has occurred!</h2>\nA program error has been detected. Please visit program homepage:<br>\n<br>\n<a href="{0}">{0}</a><br>\n<br>\nand report what you were doing when it happened. Also attach a detailed description below and this file:<br><br>\n<i>{1}</i><br>\n<br>\nThank you!\n</html>
Expand Down
Loading