SusiMail: Add tooltips for icon-only buttons

- Fix NPE sorting by sender
- Make subject bold
- Minor prep for folders
This commit is contained in:
zzz
2017-12-08 18:59:39 +00:00
parent 5aef5e24e3
commit fe5e4a2c7a
4 changed files with 17 additions and 7 deletions

View File

@ -83,6 +83,7 @@ class Mail {
formattedSubject = unknown;
formattedDate = unknown;
localFormattedDate = unknown;
sender = unknown;
shortSender = unknown;
shortSubject = unknown;
quotedDate = unknown;

View File

@ -65,7 +65,8 @@ class MailCache {
mails = new Hashtable<String, Mail>();
PersistentMailCache pmc = null;
try {
pmc = new PersistentMailCache(host, port, user, pass);
pmc = new PersistentMailCache(host, port, user, pass, PersistentMailCache.DIR_FOLDER);
// TODO Drafts, Sent, Trash
} catch (IOException ioe) {
Debug.debug(Debug.ERROR, "Error creating disk cache: " + ioe);
}

View File

@ -61,7 +61,10 @@ class PersistentMailCache {
private static final String DIR_SUSI = "susimail";
private static final String DIR_CACHE = "cache";
private static final String CACHE_PREFIX = "cache-";
private static final String DIR_FOLDER = "cur"; // MailDir-like
public static final String DIR_FOLDER = "cur"; // MailDir-like
public static final String DIR_DRAFTS = "Drafts"; // MailDir-like
public static final String DIR_SENT = "Sent"; // MailDir-like
public static final String DIR_TRASH = "Trash"; // MailDir-like
private static final String DIR_PREFIX = "s";
private static final String FILE_PREFIX = "mail-";
private static final String HDR_SUFFIX = ".hdr.txt.gz";
@ -71,11 +74,12 @@ class PersistentMailCache {
/**
* Use the params to generate a unique directory name.
* @param pass ignored
* @param folder use DIR_FOLDER
*/
public PersistentMailCache(String host, int port, String user, String pass) throws IOException {
public PersistentMailCache(String host, int port, String user, String pass, String folder) throws IOException {
_lock = getLock(host, port, user, pass);
synchronized(_lock) {
_cacheDir = makeCacheDirs(host, port, user, pass);
_cacheDir = makeCacheDirs(host, port, user, pass, folder);
}
}
@ -202,7 +206,7 @@ class PersistentMailCache {
* ~/.i2p/susimail/cache/cache-xxxxx/cur/s[b64char]/mail-xxxxx.full.txt.gz
* folder1 is the base.
*/
private static File makeCacheDirs(String host, int port, String user, String pass) throws IOException {
private static File makeCacheDirs(String host, int port, String user, String pass, String folder) throws IOException {
File f = new SecureDirectory(I2PAppContext.getGlobalContext().getConfigDir(), DIR_SUSI);
if (!f.exists() && !f.mkdir())
throw new IOException("Cannot create " + f);
@ -212,7 +216,7 @@ class PersistentMailCache {
f = new SecureDirectory(f, CACHE_PREFIX + Base64.encode(user + host + port));
if (!f.exists() && !f.mkdir())
throw new IOException("Cannot create " + f);
File base = new SecureDirectory(f, DIR_FOLDER);
File base = new SecureDirectory(f, folder);
if (!base.exists() && !base.mkdir())
throw new IOException("Cannot create " + base);
for (int i = 0; i < B64.length(); i++) {

View File

@ -509,6 +509,10 @@ public class WebMail extends HttpServlet
.append(name).append("\" value=\"").append(label).append('"');
if (name.equals(SEND) || name.equals(CANCEL) || name.equals(DELETE_ATTACHMENT) || name.equals(NEW_UPLOAD))
buf.append(" onclick=\"cancelPopup()\"");
// These are icons only now, via the CSS, so add a tooltip
if (name.equals(FIRSTPAGE) || name.equals(PREVPAGE) || name.equals(NEXTPAGE) || name.equals(LASTPAGE) ||
name.equals(PREV) || name.equals(LIST) || name.equals(NEXT))
buf.append(" title=\"").append(label).append('"');
buf.append('>');
return buf.toString();
}
@ -2463,7 +2467,7 @@ public class WebMail extends HttpServlet
"<tr><td align=\"right\">" + _t("From") +
":</td><td align=\"left\">" + quoteHTML( mail.sender ) + "</td></tr>\n" +
"<tr><td align=\"right\">" + _t("Subject") +
":</td><td align=\"left\">" + quoteHTML( mail.formattedSubject ) + "</td></tr>\n" +
":</td><td align=\"left\"><b>" + quoteHTML( mail.formattedSubject ) + "</b></td></tr>\n" +
"<tr><td align=\"right\">" + _t("Date") +
":</td><td align=\"left\">" + mail.quotedDate + "</td></tr>\n" +
"<tr><td colspan=\"2\" align=\"center\"><hr></td></tr>" +