forked from I2P_Developers/i2p.i2p
SusiMail: Add tooltips for icon-only buttons
- Fix NPE sorting by sender - Make subject bold - Minor prep for folders
This commit is contained in:
@ -83,6 +83,7 @@ class Mail {
|
||||
formattedSubject = unknown;
|
||||
formattedDate = unknown;
|
||||
localFormattedDate = unknown;
|
||||
sender = unknown;
|
||||
shortSender = unknown;
|
||||
shortSubject = unknown;
|
||||
quotedDate = unknown;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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++) {
|
||||
|
@ -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>" +
|
||||
|
Reference in New Issue
Block a user