📄 inboxmessagelist.java
字号:
/*
* Funambol is a mobile platform developed by Funambol, Inc.
* Copyright (C) 2003 - 2007 Funambol, Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addition of the following permission
* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*
* You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
* 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Powered by Funambol" logo. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Powered by Funambol".
*
*
*/
package com.funambol.mailclient.ui.view;
import com.funambol.mail.Folder;
import com.funambol.mail.MailException;
import com.funambol.mail.Message;
import com.funambol.mail.MessageFlags;
import com.funambol.mailclient.Funambol;
import com.funambol.mailclient.mm.MessageManager;
import com.funambol.mailclient.sm.SyncClient;
import com.funambol.mailclient.ui.controller.Theme;
import com.funambol.mailclient.ui.controller.UIController;
import com.funambol.mailclient.ui.utils.UserNotificationManager;
import com.funambol.mailclient.loc.Localization;
import com.funambol.mailclient.ui.controller.AppProperties;
import com.funambol.push.CTPService;
//#ifdef isBlackberry
//# import com.funambol.util.BlackberryHelper;
//#endif
import com.funambol.util.Log;
import java.util.Vector;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.rms.RecordStoreException;
public class InboxMessageList extends MessageList implements Runnable {
private Command openCommand;
private Command composeCommand;
private Command flagCommand;
private Command unflagCommand;
private Command foldersCommand;
private Command settingsCommand;
private Command helpCommand;
private Command exitCommand;
private Command syncCommand;
private Command deleteCommand;
private Command photoCommand;
private boolean activatedFlagCommand;
private Command backgroundCommand;
private boolean isLoadingMessages = false;
/** Creates a new instance of InboxMessageList */
public InboxMessageList(Vector msgInfo) {
super(msgInfo);
try {
Folder folder = MessageManager.getInstance().getFolder(MessageManager.INBOX);
setMinimumDisplayedMessageCount(folder.getMessageCount());
} catch (MailException ex) {
Log.error(this, "unable to open inbox for message count");
ex.printStackTrace();
}
if (UIController.isSyncPermitted()) {
enableSyncCommand(true);
}
}
public String getDefaultTitle() {
StringBuffer title = new StringBuffer(Localization.getMessages().INBOX_DEFAULT_TITLE);
// If there are unread messages, then we show their number
int unread = UIController.getInboxUnreadCounter();
if (unread > 0) {
title.append(" (").append(unread).append(")");
}
return title.toString();
}
protected void addCommands() {
super.addCommands();
addCommand(composeCommand);
addCommand(foldersCommand);
addCommand(settingsCommand);
addCommand(helpCommand);
//#ifndef noPhoto
// managing sendPhoto feature for releases at runtime
String rel = UIController.appProperties.get(AppProperties.REL);
if (rel != null && !rel.equals("")) {
if (rel.equals("cared")) {
addCommand(photoCommand);
}
}
//#endif
//#ifndef JVMExitCommand
//nokia 6630 adds an exit command by default, so we don't need to add our
addCommand(exitCommand);
//#endif
//#ifdef backgroundCommand
//# addCommand(backgroundCommand);
//#endif
}
// remove the commands e.g. when we need to go in ad mode
protected void removeCommands() {
removeCommand(composeCommand);
removeCommand(foldersCommand);
removeCommand(settingsCommand);
removeCommand(helpCommand);
//#ifndef JVMExitCommand
//nokia 6630 adds an exit command by default, so we don't need to add our
removeCommand(exitCommand);
//#endif
}
/**
* add the ads command
*/
/**
* called by implementation when a list of elements with lenght >0 is set
*/
protected void addItemCommands() {
addCommand(openCommand);
addCommand(deleteCommand);
setFireCommand(openCommand);
}
/**
* called by implementation when a list of elements with lenght = 0 is set
*/
protected void removeItemCommands() {
removeCommand(flagCommand);
removeCommand(unflagCommand);
removeCommand(openCommand);
removeCommand(deleteCommand);
setFireCommand(null);
}
public void commandAction(Command command, Displayable displayable) {
if (command == composeCommand) {
UIController.composeNewMessage(UIController.display.getCurrent());
} else if (command == foldersCommand) {
UIController.showFolderList(this);
} else if (command == settingsCommand) {
UIController.showSettings(this);
} else if (command == helpCommand) {
UIController.showHelp(this);
} else if (command == exitCommand) {
UIController.midlet.destroyApp(false);
} else if (command == syncCommand) {
UIController.setSyncCaller(UIController.USER);
//#ifdef isBlackberry
// even if we have refused the config we may try again, just to let
// the user know what's going on.
//# if (BlackberryHelper.getSavedConfigID() == BlackberryHelper.CONFIG_REFUSED) {
//# BlackberryHelper.removeSavedConfig();
//# }
//#endif
UIController.sync(UIController.isFirstSync);
} // ---- item commands --- //
else if (command == openCommand) {
// Use method getFunTitle instead of getTitle
// for double titlebar in Nokia S40
String origTitle = getFunTitle();
setTitle(Localization.getMessages().OPENING_MESSAGE);
this.repaint();
this.serviceRepaints();
UIController.showViewMessageScreen(this, getSelectedMessage());
setTitle(origTitle);
} else if (command == flagCommand || command == unflagCommand) {
if (getSelectedMessage() != null) {
UIController.changeFollowUpFlag(getSelectedMessage());
activate(getActiveElementId());
}
} else if (command == deleteCommand) {
deleteMessage();
//#ifndef noPhoto
} else if (command == photoCommand) {
UIController.showTakePhotoScreen(this);
//#endif
} else if (command == backgroundCommand) {
UIController.background();
} //Moved to the end so this would fall through properly
else {
super.commandAction(command, displayable);
}
}
/*private void deleteMessage() {
Message msg = getSelectedMessage();
if (msg!=null) {
if (UIController.getConfig().getDeleteConfirmation()) {
FunModalPopup popup =
new FunModalPopup(Localization.getMessages().POPUP_DELETE_MESSAGE_TITLE,
Localization.getMessages().POPUP_DELETE_MESSAGE_TEXT,
new DeletePopupAction(msg));
UIController.showModalPopup(popup, this);
} else {
UIController.deleteMessage(msg);
}
}
}*/
protected void initCommands() {
int syncCmdType = Command.BACK;
//#ifdef UseOKCmd
//# syncCmdType = UIController.COMMAND_TYPE;
//#endif
//#ifdef isBlackberry
//# openCommand =
//# new Command(Localization.getMessages().OPEN_COMMAND_LABEL,
//# UIController.COMMAND_TYPE,-1);
//#else
openCommand =
new Command(Localization.getMessages().OPEN_COMMAND_LABEL,
UIController.COMMAND_TYPE, 8);
//#endif
composeCommand =
new Command(Localization.getMessages().COMPOSE_COMMAND_LABEL,
UIController.COMMAND_TYPE, 10);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -