mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 19:52:21 -05:00
Drop icon activity switches under 250ms to avoid fast flickering on OSX, add new switch icon in IMAP fetch iterations
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@750 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
3f742edce9
commit
6eb3da9916
@ -230,6 +230,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
sendClient(commandId + " NO No message found");
|
sendClient(commandId + " NO No message found");
|
||||||
} else {
|
} else {
|
||||||
while (uidRangeIterator.hasNext()) {
|
while (uidRangeIterator.hasNext()) {
|
||||||
|
DavGatewayTray.switchIcon();
|
||||||
ExchangeSession.Message message = uidRangeIterator.next();
|
ExchangeSession.Message message = uidRangeIterator.next();
|
||||||
handleFetch(message, uidRangeIterator.currentIndex, parameters);
|
handleFetch(message, uidRangeIterator.currentIndex, parameters);
|
||||||
}
|
}
|
||||||
@ -287,6 +288,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
String action = tokens.nextToken();
|
String action = tokens.nextToken();
|
||||||
String flags = tokens.nextToken();
|
String flags = tokens.nextToken();
|
||||||
while (uidRangeIterator.hasNext()) {
|
while (uidRangeIterator.hasNext()) {
|
||||||
|
DavGatewayTray.switchIcon();
|
||||||
ExchangeSession.Message message = uidRangeIterator.next();
|
ExchangeSession.Message message = uidRangeIterator.next();
|
||||||
updateFlags(message, action, flags);
|
updateFlags(message, action, flags);
|
||||||
sendClient("* " + (uidRangeIterator.currentIndex) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
|
sendClient("* " + (uidRangeIterator.currentIndex) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
|
||||||
@ -297,6 +299,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(tokens.nextToken());
|
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(tokens.nextToken());
|
||||||
String targetName = BASE64MailboxDecoder.decode(tokens.nextToken());
|
String targetName = BASE64MailboxDecoder.decode(tokens.nextToken());
|
||||||
while (uidRangeIterator.hasNext()) {
|
while (uidRangeIterator.hasNext()) {
|
||||||
|
DavGatewayTray.switchIcon();
|
||||||
ExchangeSession.Message message = uidRangeIterator.next();
|
ExchangeSession.Message message = uidRangeIterator.next();
|
||||||
session.copyMessage(message, targetName);
|
session.copyMessage(message, targetName);
|
||||||
}
|
}
|
||||||
@ -318,6 +321,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
parameters = tokens.nextToken();
|
parameters = tokens.nextToken();
|
||||||
}
|
}
|
||||||
while (rangeIterator.hasNext()) {
|
while (rangeIterator.hasNext()) {
|
||||||
|
DavGatewayTray.switchIcon();
|
||||||
ExchangeSession.Message message = rangeIterator.next();
|
ExchangeSession.Message message = rangeIterator.next();
|
||||||
handleFetch(message, rangeIterator.currentIndex, parameters);
|
handleFetch(message, rangeIterator.currentIndex, parameters);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,9 @@ import java.net.URL;
|
|||||||
* Tray icon handler
|
* Tray icon handler
|
||||||
*/
|
*/
|
||||||
public final class DavGatewayTray {
|
public final class DavGatewayTray {
|
||||||
protected static final Logger LOGGER = Logger.getLogger("davmail");
|
private static final Logger LOGGER = Logger.getLogger("davmail");
|
||||||
|
private static final long ICON_SWITCH_MINIMUM_DELAY = 250;
|
||||||
|
private static long lastIconSwitch;
|
||||||
|
|
||||||
private DavGatewayTray() {
|
private DavGatewayTray() {
|
||||||
}
|
}
|
||||||
@ -59,7 +61,10 @@ public final class DavGatewayTray {
|
|||||||
*/
|
*/
|
||||||
public static void switchIcon() {
|
public static void switchIcon() {
|
||||||
if (davGatewayTray != null) {
|
if (davGatewayTray != null) {
|
||||||
davGatewayTray.switchIcon();
|
if (System.currentTimeMillis() - lastIconSwitch > ICON_SWITCH_MINIMUM_DELAY) {
|
||||||
|
davGatewayTray.switchIcon();
|
||||||
|
lastIconSwitch = System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +92,7 @@ public final class DavGatewayTray {
|
|||||||
* @param message text message
|
* @param message text message
|
||||||
* @param level log level
|
* @param level log level
|
||||||
*/
|
*/
|
||||||
protected static void displayMessage(BundleMessage message, Level level) {
|
private static void displayMessage(BundleMessage message, Level level) {
|
||||||
LOGGER.log(level, message.formatLog());
|
LOGGER.log(level, message.formatLog());
|
||||||
if (davGatewayTray != null) {
|
if (davGatewayTray != null) {
|
||||||
davGatewayTray.displayMessage(message.format(), level);
|
davGatewayTray.displayMessage(message.format(), level);
|
||||||
@ -101,7 +106,7 @@ public final class DavGatewayTray {
|
|||||||
* @param e exception
|
* @param e exception
|
||||||
* @param level log level
|
* @param level log level
|
||||||
*/
|
*/
|
||||||
protected static void displayMessage(BundleMessage message, Exception e, Level level) {
|
private static void displayMessage(BundleMessage message, Exception e, Level level) {
|
||||||
if (e instanceof NetworkDownException) {
|
if (e instanceof NetworkDownException) {
|
||||||
LOGGER.log(level, BundleMessage.getExceptionLogMessage(message, e));
|
LOGGER.log(level, BundleMessage.getExceptionLogMessage(message, e));
|
||||||
} else {
|
} else {
|
||||||
@ -263,7 +268,7 @@ public final class DavGatewayTray {
|
|||||||
*
|
*
|
||||||
* @return true on Mac OS X
|
* @return true on Mac OS X
|
||||||
*/
|
*/
|
||||||
protected static boolean isOSX() {
|
private static boolean isOSX() {
|
||||||
return System.getProperty("os.name").toLowerCase().startsWith("mac os x");
|
return System.getProperty("os.name").toLowerCase().startsWith("mac os x");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user