mailclientconfig.java
来自「moblie syncml mail javame」· Java 代码 · 共 561 行 · 第 1/2 页
JAVA
561 行
}
/** Gets the time of the next wakeup for the daily scheduler */
public long getNextTimeAlarm() {
return nextTimeAlarm;
}
/** Sets the time of the next wakeup for the daily scheduler */
public void setNextTimeAlarm(long nextTimeAlarm) {
this.nextTimeAlarm = nextTimeAlarm;
}
/** Gets the RMS store size for the midlet. */
public int getRmsStoreSize() {
return rmsStoreSize;
}
/** Sets the RMS store size for the midlet. */
public void setRmsStoreSize(int rmsStoreSize) {
this.rmsStoreSize = rmsStoreSize;
}
public void setTimeZone(String timeZoneToSet){
this.timeZone = timeZoneToSet;
MailDateFormatter.setTimeZone(timeZone);
this.timeZoneUpdated = true;
}
public String getTimeZone(){
return timeZone;
}
public boolean getTimeZoneUpdated(){
return timeZoneUpdated;
}
//-------------------------------- getters and setters for sound and vibrate
//-------------------------------- notifications added in version 103
/**
* @return true if sound notification is enabled
*/
public boolean isSoundNotificationEnabled() {
return soundNotification;
}
/**
* @return true if vibrate notification is enabled
*/
public boolean isVibrateNotificationEnabled() {
return vibrateNotification;
}
/**
* enable or disable sound notifications on a new email
*/
public void setSoundNotification(boolean enabled) {
this.soundNotification = enabled;
}
/**
* enable or disable vibrate notifications on a new email
*/
public void setVibrateNotification(boolean enabled) {
this.vibrateNotification= enabled;
}
/**
* @return store version (format). @see Store for more details.
*/
public int getStoreVersion() {
return storeVersion;
}
/**
* @return store version (format). @see Store for more details.
*/
public void setStoreVersion(int version) {
storeVersion = version;
}
public boolean isSyncOnStartupEnabled() {
return syncOnStartup;
}
public void setSyncOnStartup(boolean enabled) {
syncOnStartup = enabled;
}
// getters and setters for sound and vibrate
// added in version 104
public boolean getDeleteConfirmation() {
return deleteConfirmation;
}
public void setDeleteConfirmation(boolean deleteConfirmation) {
this.deleteConfirmation = deleteConfirmation;
}
//getters and setters for push status
// added in version 105
public int getCtpPushStatus() {
return ctpPushStatus;
}
public void setCtpPushStatus(int ctpPushStatus) {
this.ctpPushStatus = ctpPushStatus;
}
/**
* @return current configuartion as string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Configuration version: ").append(this.version);
sb.append("\nMailAccount: \n").append(this.mailAccount);
sb.append("\nMailFilter: ").append(this.mailFilter);
sb.append("\nEnableScheduler: ").append(this.enableScheduler);
sb.append("\nEnableSmsListener: ").append(this.enableSmsListener);
sb.append("\nLogLevel: ").append(this.logLevel);
sb.append("\nPollInterval: ").append(this.pollInterval);
sb.append("\nNextTimeAlarm: "
+
((nextTimeAlarm!=0L) ?
MailDateFormatter.dateToUTC(new Date(nextTimeAlarm)): "null")
);
sb.append("\nEnableDeletePropagation: ")
.append(this.enableDeletePropagation);
sb.append("\nCompress: ").append(this.compress);
// Ver.101
sb.append("\nStartFilter: ").append(MailDateFormatter.dateToUTC(new Date(startFilter)));
sb.append("\nRmsSize: ").append(rmsStoreSize);
sb.append("\nSoundNotification: ").append(soundNotification);
sb.append("\nVibrateNotification: ").append(vibrateNotification);
sb.append("\nSyncOnStartup: ").append(syncOnStartup);
sb.append("\nStore version: ").append(storeVersion);
sb.append("\nCTPStatus: ").append(ctpPushStatus == 0 ? "enabled" : "disabled");
return sb.toString();
}
//---------------------------------------------- Serializable implementation
/**
* Write object fields to the output stream.
* @param out Output stream
* @throws IOException
*/
public void serialize(DataOutputStream out) throws IOException {
out.writeInt(VERSION);
out.writeUTF(mailAccount.getUrl());
out.writeUTF(mailAccount.getUser());
out.writeUTF(mailAccount.getPassword());
out.writeUTF(mailAccount.getName());
out.writeUTF(mailAccount.getAddress());
out.writeUTF(mailAccount.getRemoteURI());
out.writeUTF(mailAccount.getPimRemoteURI());
out.writeBoolean(enableScheduler);
out.writeInt(pollInterval);
out.writeBoolean(enableSmsListener);
out.writeBoolean(enableDeletePropagation);
out.writeInt(logLevel);
out.writeLong(nextTimeAlarm);
out.writeInt(mailFilter.getSize());
// Handle the case of null date
Date d = mailFilter.getDate();
out.writeLong((d != null) ? d.getTime() : 0L);
out.writeBoolean(mailFilter.downloadAttachments());
out.writeBoolean(mailFilter.isHeadersOnly());
// Ver.101
out.writeLong(startFilter);
out.writeInt(rmsStoreSize);
//Ver.103
out.writeBoolean(soundNotification);
out.writeBoolean(vibrateNotification);
out.writeInt(storeVersion);
out.writeBoolean(syncOnStartup);
//Ver.104
out.writeBoolean(deleteConfirmation);
//Ver.105
out.writeInt(getCtpPushStatus());
}
/**
* Read object field from the input stream.
* @param in Input stream
* @throws IOException
*/
public void deserialize(DataInputStream in) throws IOException {
boolean enableFirstInstall = true;
int savedVer = in.readInt();
// If the config stored belongs to a newer version than the
// current one (the user went back to an older version, use
// the defaults.
if (savedVer > VERSION) {
Log.error("This app is older then the config stored.");
Log.error("Can't handle forward compatibility, using defaults.");
return;
}
version = savedVer;
mailAccount.setUrl(in.readUTF());
mailAccount.setUser(in.readUTF());
mailAccount.setPassword(in.readUTF());
mailAccount.setName(in.readUTF());
mailAccount.setAddress(in.readUTF());
mailAccount.setRemoteURI(in.readUTF());
mailAccount.setPimRemoteURI(in.readUTF());
enableScheduler = in.readBoolean();
pollInterval = in.readInt();
enableSmsListener = in.readBoolean();
enableDeletePropagation = in.readBoolean();
logLevel = in.readInt();
nextTimeAlarm = in.readLong();
mailFilter.setSize(in.readInt());
// Handle the case of null date
long d = in.readLong();
mailFilter.setDate((d != 0L) ? new Date(d) : null);
mailFilter.enableAttachmentsDownload(in.readBoolean());
mailFilter.enableHeadersOnly(in.readBoolean());
// Handle backward compatibilty
if (savedVer >= VERSION_101) {
startFilter = in.readLong();
rmsStoreSize = in.readInt();
}
// Before version 103 we had no store version,
// but the store format (version) was 101
if (savedVer <= VERSION_102) {
storeVersion = Store.VERSION_101;
StoreFactory.getStore().setVersion(storeVersion);
}
// if version is at least 103 we can read
// the values, otherwise we use the default
// values (true)
if (savedVer >= VERSION_103) {
soundNotification = in.readBoolean();
vibrateNotification = in.readBoolean();
storeVersion = in.readInt();
StoreFactory.getStore().setVersion(storeVersion);
syncOnStartup = in.readBoolean();
}
// Properties introduced in version 104
if (savedVer >= VERSION_104) {
deleteConfirmation = in.readBoolean();
}
// Properties introduced in version 105
if (savedVer >= VERSION_105) {
setCtpPushStatus(in.readInt());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?