Land the Mailnews Performance Branch.

Includes front end re-write to use the outliner widget for the thread pane.

Improvements in scrolling, folder loading, message display, replyto time, sorting, selecting, deleting, the list goes
on and on.

enjoy =).
This commit is contained in:
mscott%netscape.com 2001-03-17 01:59:34 +00:00
Родитель 4e8eca6cab
Коммит fe4edc0bea
214 изменённых файлов: 11346 добавлений и 11807 удалений

Просмотреть файл

@ -806,8 +806,24 @@ NS_IMETHODIMP nsAddrDatabase::ForceClosed()
NS_IMETHODIMP nsAddrDatabase::Commit(PRUint32 commitType)
{
nsresult err = NS_OK;
nsIMdbThumb *commitThumb = NULL;
nsIMdbThumb *commitThumb = nsnull;
if (commitType == kLargeCommit || commitType == kSessionCommit)
{
mdb_percent outActualWaste = 0;
mdb_bool outShould;
if (m_mdbStore)
{
// check how much space would be saved by doing a compress commit.
// If it's more than 30%, go for it.
// N.B. - I'm not sure this calls works in Mork for all cases.
err = m_mdbStore->ShouldCompress(GetEnv(), 30, &outActualWaste, &outShould);
if (NS_SUCCEEDED(err) && outShould)
{
commitType = kCompressCommit;
}
}
}
if (m_mdbStore)
{
switch (commitType)

Просмотреть файл

@ -41,20 +41,6 @@
{0x8a, 0x5d, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2} \
}
//
// nsMsgMessageDataSource
//
#define NS_MAILNEWSMESSAGEDATASOURCE_CONTRACTID \
NS_RDF_DATASOURCE_CONTRACTID_PREFIX "mailnewsmessages"
#define NS_MAILNEWSMESSAGEDATASOURCE_CID \
{ /* 2B8ED4A5-F684-11d2-8A5D-0060B0FC04D2 */ \
0x2b8ed4a5, \
0xf684, \
0x11d2, \
{0x8a, 0x5d, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2} \
}
//
// nsMsgAccountManager
//
@ -265,17 +251,6 @@
{ 0xbd85a417, 0x5433, 0x11d3, \
{0x8a, 0xc5, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2} }
//
//nsMessageView
//
#define NS_MESSAGEVIEW_CONTRACTID \
"@mozilla.org/messenger/messageview;1"
/* 4E03B3A6-624A-11d3-8AD4-0060B0FC04D2*/
#define NS_MESSAGEVIEW_CID \
{ 0x4e03b3a6, 0x624a, 0x11d3, \
{ 0x8a, 0xd4, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2}}
//
//nsMsgWindow
//
@ -287,38 +262,6 @@
{ 0xbb460dff, 0x8bf0, 0x11d3, \
{ 0x8a, 0xfe, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2}}
//
// nsMessage
//
/* {44C0D336-796D-42ee-B8B7-6FA3DE372E7E} */
#define NS_MESSAGE_CID \
{ 0x44c0d336, 0x796d, 0x42ee, \
{ 0xb8, 0xb7, 0x6f, 0xa3, 0xde, 0x37, 0x2e, 0x7e } }
#define NS_MESSAGE_MAILBOX_CONTRACTID \
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "mailbox_message"
#define NS_MESSAGE_NEWS_CONTRACTID \
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "news_message"
#define NS_MESSAGE_IMAP_CONTRACTID \
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "imap_message"
//
//nsMsgViewNavigationService
//
#define NS_MSGVIEWNAVIGATIONSERVICE_CONTRACTID \
"@mozilla.org/messenger/msgviewnavigationservice;1"
/* 60D34FB4-D031-11d3-8B2E-0060B0FC04D2*/
#define NS_MSGVIEWNAVIGATIONSERVICE_CID \
{ 0x60d34fb4, 0xd031, 0x11d3, \
{ 0x8b, 0x2e, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2}}
//
// Print Engine...
//
@ -395,18 +338,6 @@
NS_MSGFILTERDELEGATEFACTORY_CONTRACTID_PREFIX "imap"
//
// nsMsgSearchDataSource
//
#define NS_MSGSEARCHDATASOURCE_CONTRACTID \
NS_RDF_DATASOURCE_CONTRACTID_PREFIX "msgsearch"
/* f713896e-3a48-44a8-a7e0-8dde5b4b6461 */
#define NS_MSGSEARCHDATASOURCE_CID \
{ 0xf713896e, 0x3a48, 0x44a8, \
{0xa7, 0xe0, 0x8d, 0xde, 0x5b, 0x4b, 0x64, 0x61}}
//
// nsMsgFilterDataSource
//
@ -434,4 +365,54 @@
{0x2db43d16, 0xe5c8, 0x11d4, \
{0xa5, 0xb7, 0x00,0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
//
// nsMsgDBView
//
#define NS_MSGDBVIEW_CONTRACTID_PREFIX \
"@mozilla.org/messenger/msgdbview;1?type="
#define NS_MSGTHREADEDDBVIEW_CONTRACTID \
NS_MSGDBVIEW_CONTRACTID_PREFIX "threaded"
#define NS_MSGTHREADSWITHUNREADDBVIEW_CONTRACTID \
NS_MSGDBVIEW_CONTRACTID_PREFIX "threadswithunread"
#define NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CONTRACTID \
NS_MSGDBVIEW_CONTRACTID_PREFIX "watchedthreadswithunread"
#define NS_MSGSEARCHDBVIEW_CONTRACTID \
NS_MSGDBVIEW_CONTRACTID_PREFIX "search"
/* 52f860e0-1dd2-11b2-aa72-bb751981bd00 */
#define NS_MSGTHREADEDDBVIEW_CID \
{0x52f860e0, 0x1dd2, 0x11b2, \
{0xaa, 0x72, 0xbb, 0x75, 0x19, 0x81, 0xbd, 0x00 }}
/* ca79a00e-010d-11d5-a5be-0060b0fc04b7 */
#define NS_MSGTHREADSWITHUNREADDBVIEW_CID \
{0xca79a00e, 0x010d, 0x11d5, \
{0xa5, 0xbe, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
/* 597e1ffe-0123-11d5-a5be-0060b0fc04b7 */
#define NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CID \
{0x597e1ffe, 0x0123, 0x11d5, \
{0xa5, 0xbe, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
/* aeac118c-0823-11d5-a5bf-0060b0fc04b7 */
#define NS_MSGSEARCHDBVIEW_CID \
{0xaeac118c, 0x0823, 0x11d5, \
{0xa5, 0xbf, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7}}
//
// nsMsgAccountManager
//
#define NS_MSGOFFLINEMANAGER_CONTRACTID \
"@mozilla.org/messenger/offline-manager;1"
#define NS_MSGOFFLINEMANAGER_CID \
{ /* ac6c518a-09b2-11d5-a5bf-0060b0fc04b7 */ \
0xac6c518a, 0x09b2, 0x11d5, \
{0xa5, 0xbf, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
#endif // nsMessageBaseCID_h__

Просмотреть файл

@ -52,7 +52,6 @@
#include "nsMsgIdentity.h"
#include "nsMsgIncomingServer.h"
#include "nsMsgFolderDataSource.h"
#include "nsMsgMessageDataSource.h"
#include "nsMsgAccountManagerDS.h"
@ -70,10 +69,7 @@
#include "nsMsgFilterService.h"
#include "nsMsgFilterDataSource.h"
#include "nsMsgFilterDelegateFactory.h"
#include "nsMessageView.h"
#include "nsMsgWindow.h"
#include "nsMessage.h"
#include "nsMsgViewNavigationService.h"
#include "nsMsgServiceProvider.h"
#include "nsSubscribeDataSource.h"
@ -82,9 +78,12 @@
#include "nsMsgPrintEngine.h"
#include "nsMsgSearchSession.h"
#include "nsMsgSearchAdapter.h"
#include "nsMsgSearchDataSource.h"
#include "nsMsgFolderCompactor.h"
#include "nsMsgThreadedDBView.h"
#include "nsMsgSpecialViews.h"
#include "nsMsgSearchDBView.h"
#include "nsMsgOfflineManager.h"
// private factory declarations for each component we know how to produce
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerBootstrap)
@ -96,11 +95,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerMigrator, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccount)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgIdentity)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgFolderDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMessageDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgAccountManagerDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSearchSession)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSearchValidityManager)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgSearchDataSource,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterDataSource)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFilterDelegateFactory)
@ -111,16 +108,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsCopyMessageStreamListener)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgCopyService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgFolderCache)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgStatusFeedback)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessageView,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgWindow,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessage)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgViewNavigationService,Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgServiceProviderService, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribeDataSource, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribableServer, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgPrintEngine, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFolderCompactState)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineStoreCompactState)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgThreadedDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgThreadsWithUnreadDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgWatchedThreadsWithUnreadDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSearchDBView);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgOfflineManager);
// The list of components we register
static nsModuleComponentInfo gComponents[] = {
@ -170,10 +169,6 @@ static nsModuleComponentInfo gComponents[] = {
NS_MAILNEWSFOLDERDATASOURCE_CONTRACTID,
nsMsgFolderDataSourceConstructor,
},
{ "Mail/News Message Data Source", NS_MAILNEWSMESSAGEDATASOURCE_CID,
NS_MAILNEWSMESSAGEDATASOURCE_CONTRACTID,
nsMsgMessageDataSourceConstructor,
},
{ "Mail/News Account Manager Data Source", NS_MSGACCOUNTMANAGERDATASOURCE_CID,
NS_RDF_DATASOURCE_CONTRACTID_PREFIX "msgaccountmanager",
nsMsgAccountManagerDataSourceConstructor,
@ -190,10 +185,6 @@ static nsModuleComponentInfo gComponents[] = {
NS_MSGSEARCHVALIDITYMANAGER_CONTRACTID,
nsMsgSearchValidityManagerConstructor,
},
{ "Search Datasource", NS_MSGSEARCHDATASOURCE_CID,
NS_MSGSEARCHDATASOURCE_CONTRACTID,
nsMsgSearchDataSourceConstructor,
},
{ "Message Filter Service", NS_MSGFILTERSERVICE_CID,
NS_MSGFILTERSERVICE_CONTRACTID,
nsMsgFilterServiceConstructor,
@ -245,30 +236,10 @@ static nsModuleComponentInfo gComponents[] = {
NS_MSGSTATUSFEEDBACK_CONTRACTID,
nsMsgStatusFeedbackConstructor,
},
{ "Mail/News MessageView", NS_MESSAGEVIEW_CID,
NS_MESSAGEVIEW_CONTRACTID,
nsMessageViewConstructor,
},
{ "Mail/News MsgWindow", NS_MSGWINDOW_CID,
NS_MSGWINDOW_CONTRACTID,
nsMsgWindowConstructor,
},
{ "Message Resource", NS_MESSAGE_CID,
NS_MESSAGE_MAILBOX_CONTRACTID,
nsMessageConstructor,
},
{ "Message Resource", NS_MESSAGE_CID,
NS_MESSAGE_IMAP_CONTRACTID,
nsMessageConstructor,
},
{ "Message Resource", NS_MESSAGE_CID,
NS_MESSAGE_NEWS_CONTRACTID,
nsMessageConstructor,
},
{ "Mail/News Message Navigation Service", NS_MSGVIEWNAVIGATIONSERVICE_CID,
NS_MSGVIEWNAVIGATIONSERVICE_CONTRACTID,
nsMsgViewNavigationServiceConstructor,
},
{ "Mail/News Print Engine", NS_MSG_PRINTENGINE_CID,
NS_MSGPRINTENGINE_CONTRACTID,
nsMsgPrintEngineConstructor,
@ -292,7 +263,28 @@ static nsModuleComponentInfo gComponents[] = {
{ "offline store compactor", NS_MSG_OFFLINESTORECOMPACTOR_CID,
NS_MSGOFFLINESTORECOMPACTOR_CONTRACTID,
nsOfflineStoreCompactStateConstructor,
}
},
{ "threaded db view", NS_MSGTHREADEDDBVIEW_CID,
NS_MSGTHREADEDDBVIEW_CONTRACTID,
nsMsgThreadedDBViewConstructor,
},
{ "threads with unread db view", NS_MSGTHREADSWITHUNREADDBVIEW_CID,
NS_MSGTHREADSWITHUNREADDBVIEW_CONTRACTID,
nsMsgThreadsWithUnreadDBViewConstructor,
},
{ "watched threads with unread db view", NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CID,
NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CONTRACTID,
nsMsgWatchedThreadsWithUnreadDBViewConstructor,
},
{ "search db view", NS_MSGSEARCHDBVIEW_CID,
NS_MSGSEARCHDBVIEW_CONTRACTID,
nsMsgSearchDBViewConstructor,
},
{ "Messenger Offline Manager", NS_MSGOFFLINEMANAGER_CID,
NS_MSGOFFLINEMANAGER_CONTRACTID,
nsMsgOfflineManagerConstructor,
},
};
NS_IMPL_NSGETMODULE("nsMsgBaseModule", gComponents)

Просмотреть файл

@ -8,7 +8,6 @@ nsICopyMsgStreamListener.idl
nsIFolder.idl
nsIFolderListener.idl
nsIMessage.idl
nsIMessageView.idl
nsIMsgAccount.idl
nsIMsgAccountManager.idl
nsIMsgFolder.idl
@ -37,6 +36,4 @@ nsIMsgRDFDataSource.idl
nsIIncomingServerListener.idl
nsIMsgHdr.idl
nsIMsgStringService.idl
nsIMsgViewNavigationService.idl
nsIMsgPrintEngine.idl

Просмотреть файл

@ -43,8 +43,6 @@ XPIDLSRCS = \
nsIMessenger.idl \
nsIFolder.idl \
nsIFolderListener.idl \
nsIMessage.idl \
nsIMessageView.idl \
nsIMsgAccount.idl \
nsIMsgAccountManager.idl \
nsIMsgFolder.idl \
@ -75,9 +73,10 @@ XPIDLSRCS = \
nsIMessengerMigrator.idl \
nsIMessengerWindowService.idl \
nsIMsgStringService.idl \
nsIMsgViewNavigationService.idl \
nsIMsgPrintEngine.idl \
nsISubscribableServer.idl \
nsIMsgDBView.idl \
nsIMsgOfflineManager.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -28,8 +28,6 @@ XPIDLSRCS = \
.\nsICopyMessageListener.idl \
.\nsIFolder.idl \
.\nsIFolderListener.idl \
.\nsIMessage.idl \
.\nsIMessageView.idl \
.\nsIMsgAccount.idl \
.\nsIMsgAccountManager.idl \
.\nsIMessengerMigrator.idl \
@ -60,9 +58,10 @@ XPIDLSRCS = \
.\nsIIncomingServerListener.idl \
.\nsIMsgHdr.idl \
.\nsIMsgStringService.idl \
.\nsIMsgViewNavigationService.idl \
.\nsIMsgPrintEngine.idl \
.\nsISubscribableServer.idl \
.\nsIMsgDBView.idl \
.\nsIMsgOfflineManager.idl \
$(NULL)
################################################################################

Просмотреть файл

@ -42,7 +42,7 @@
#include "nsTime.h"
class nsIMessage;
class nsIMsgDBHdr;
class nsIMsgFolder;
// include common interfaces such as the service manager and the repository....
@ -137,6 +137,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
#define NS_MSG_SERVER_USERNAME_MISSING NS_MSG_GENERATE_FAILURE(23)
#define NS_MSG_INVALID_DBVIEW_INDEX NS_MSG_GENERATE_FAILURE(24)
/* ducarroz: error codes for message compose are defined into compose\src\nsMsgComposeStringBundle.h.
Message compose use the same error code space than other mailnews modules. To avoid any
conflict, I reserve values between 12500 and 12999 for it.

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsISupports.idl"
#include "MailNewsTypes2.idl"
interface nsIMessage;
interface nsIMsgDBHdr;
interface nsIInputStream;
%{C++
@ -36,7 +36,7 @@ interface nsIInputStream;
interface nsICopyMessageListener : nsISupports
{
void BeginCopy(in nsIMessage message);
void BeginCopy(in nsIMsgDBHdr message);
void StartMessage();
void CopyData(in nsIInputStream aIStream, in long aLength);
void EndMessage(in nsMsgKey key);

Просмотреть файл

@ -35,6 +35,7 @@
%}
interface nsITransactionManager;
interface nsIMsgMessageService;
[scriptable, uuid(4f7966d0-c14f-11d2-b7f2-00805f05ffa5)]
interface nsIMessenger : nsISupports {
@ -56,10 +57,9 @@ interface nsIMessenger : nsISupports {
void DeleteFolders(in nsIRDFCompositeDataSource db,
in nsIRDFResource parentFolder,
in nsIRDFResource folder);
void CopyMessages(in nsIRDFCompositeDataSource database,
in nsIRDFResource srcFolder,
in nsIRDFResource dstFolder,
in nsISupportsArray messages,
void CopyMessages(in nsIMsgFolder srcFolder,
in nsIMsgFolder destFolder,
in nsISupportsArray messageArray,
in boolean isMove);
void CopyFolders(in nsIRDFCompositeDataSource database,
in nsIRDFResource dstFolder,
@ -89,5 +89,7 @@ interface nsIMessenger : nsISupports {
void saveAllAttachments(in unsigned long count, [array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray, [array, size_is(count)] in string messageUriArray);
void find();
void findAgain();
nsIMsgMessageService messageServiceFromURI(in string uri);
};

Просмотреть файл

@ -27,7 +27,7 @@
#include "nsIMsgCopyServiceListener.idl"
#include "nsISupportsArray.idl"
interface nsIMessage;
interface nsIMsgDBHdr;
%{C++
#include "nsITransactionManager.h"
%}
@ -59,7 +59,7 @@ interface nsIMsgCopyService : nsISupports {
void CopyFileMessage(in nsIFileSpec fileSpec,
in nsIMsgFolder dstFolder,
in nsIMessage msgToReplace,
in nsIMsgDBHdr msgToReplace,
in boolean isDraftOrTemplate,
in nsIMsgCopyServiceListener listener,
in nsIMsgWindow msgWindow);

Просмотреть файл

@ -23,12 +23,21 @@
#include "nsISupports.idl"
#include "MailNewsTypes2.idl"
interface nsIMsgDatabase;
interface nsIMsgFolder;
interface nsIMsgWindow;
interface nsIDOMElement;
interface nsIMessenger;
interface nsIMsgDBHdr;
interface nsIMsgDBViewCommandUpdater;
typedef long nsMsgViewSortOrderValue;
typedef long nsMsgViewSortTypeValue;
typedef long nsMsgDBViewTypeValue;
typedef long nsMsgViewTypeValue;
typedef long nsMsgViewNotificationCodeValue;
typedef long nsMsgViewCommandCheckStateValue;
typedef long nsMsgViewCommandTypeValue;
typedef long nsMsgViewFlagsTypeValue;
typedef long nsMsgNavigationTypeValue;
[scriptable, uuid(682a18be-fd18-11d4-a5be-0060b0fc04b7)]
interface nsMsgViewSortOrder
@ -38,6 +47,25 @@ interface nsMsgViewSortOrder
const nsMsgViewSortOrderValue descending = 2;
};
[scriptable, uuid(dac950b0-1dd1-11b2-be06-d4c2003a6927)]
interface nsMsgViewType {
const nsMsgViewTypeValue eShowAllThreads = 0;
const nsMsgViewTypeValue eShowThreadsWithUnread = 2;
const nsMsgViewTypeValue eShowWatchedThreadsWithUnread = 3;
};
[scriptable, uuid(64852276-1dd2-11b2-8103-afe12002c053)]
interface nsMsgViewFlagsType
{
/**
* flags for GetViewFlags
*/
const nsMsgViewFlagsTypeValue kNone = 0x0;
const nsMsgViewFlagsTypeValue kThreadedDisplay = 0x1;
const nsMsgViewFlagsTypeValue kShowIgnored = 0x8;
const nsMsgViewFlagsTypeValue kUnreadOnly = 0x10;
};
[scriptable, uuid(b2f31bca-fd18-11d4-a5be-0060b0fc04b7)]
interface nsMsgViewSortType
{
@ -108,46 +136,148 @@ interface nsMsgViewNotificationCode
};
[scriptable, uuid(4063bcf8-fd19-11d4-a5be-0060b0fc04b7)]
interface nsMsgDBViewType
[scriptable, uuid(4ec9248e-0108-11d5-a5be-0060b0fc04b7)]
interface nsMsgViewCommandCheckState
{
/**
* this view type matches any other view type,
* for the purpose of matching cached views.
* Else, it's equivalent to allThreads
*/
const nsMsgDBViewTypeValue anyView = 0;
const nsMsgViewCommandCheckStateValue notUsed = 0;
const nsMsgViewCommandCheckStateValue checked = 1;
const nsMsgViewCommandCheckStateValue unchecked = 2;
};
/**
* default view, no killed threads
*/
const nsMsgDBViewTypeValue allThreads = 1;
[scriptable, uuid(ad36e6cc-0109-11d5-a5be-0060b0fc04b7)]
interface nsMsgViewCommandType
{
const nsMsgViewCommandTypeValue markMessagesRead = 0;
const nsMsgViewCommandTypeValue markMessagesUnread = 1;
const nsMsgViewCommandTypeValue toggleMessageRead = 2;
const nsMsgViewCommandTypeValue flagMessages = 3;
const nsMsgViewCommandTypeValue unflagMessages = 4;
const nsMsgDBViewTypeValue onlyThreadsWithUnread = 2;
const nsMsgDBViewTypeValue onlyUnreadHeaders = 3;
const nsMsgDBViewTypeValue watchedThreadsWithNew = 4;
const nsMsgViewCommandTypeValue toggleThreadWatched = 6;
/**
* view built up on demand
*/
const nsMsgDBViewTypeValue cacheless = 5;
const nsMsgViewCommandTypeValue deleteMsg = 7;
const nsMsgViewCommandTypeValue deleteNoTrash = 8;
const nsMsgViewCommandTypeValue markThreadRead = 9;
const nsMsgViewCommandTypeValue markAllRead = 10;
const nsMsgViewCommandTypeValue expandAll = 11;
const nsMsgViewCommandTypeValue collapseAll = 12;
const nsMsgViewCommandTypeValue copyMessages = 13;
const nsMsgViewCommandTypeValue moveMessages = 14;
const nsMsgViewCommandTypeValue selectAll = 15;
const nsMsgViewCommandTypeValue downloadSelectedForOffline = 16;
const nsMsgViewCommandTypeValue downloadFlaggedForOffline = 17;
};
[scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)]
interface nsMsgNavigationType
{
const nsMsgNavigationTypeValue firstMessage = 1;
const nsMsgNavigationTypeValue nextMessage = 2;
const nsMsgNavigationTypeValue previousMessage = 3;
const nsMsgNavigationTypeValue lastMessage = 4;
/**
* must match nsMsgViewCommandTypeValue toggleThreadKilled
*/
const nsMsgNavigationTypeValue toggleThreadKilled = 5;
const nsMsgNavigationTypeValue firstUnreadMessage = 6;
const nsMsgNavigationTypeValue nextUnreadMessage = 7;
const nsMsgNavigationTypeValue previousUnreadMessage = 8;
const nsMsgNavigationTypeValue lastUnreadMessage = 9;
const nsMsgNavigationTypeValue nextUnreadThread = 10;
const nsMsgNavigationTypeValue nextUnreadFolder = 11;
const nsMsgNavigationTypeValue nextFolder = 12;
const nsMsgNavigationTypeValue readMore = 13;
const nsMsgNavigationTypeValue laterMessage = 14;
/**
* Go back to the previous visited message
*/
const nsMsgNavigationTypeValue back = 15;
/**
* Go forward to the previous visited message
*/
const nsMsgNavigationTypeValue forward = 16;
const nsMsgNavigationTypeValue firstFlagged = 17;
const nsMsgNavigationTypeValue nextFlagged = 18;
const nsMsgNavigationTypeValue previousFlagged = 19;
const nsMsgNavigationTypeValue firstNew = 20;
const nsMsgNavigationTypeValue editUndo = 21;
const nsMsgNavigationTypeValue editRedo = 22;
};
[scriptable, uuid(704c7d28-fd1a-11d4-a5be-0060b0fc04b7)]
interface nsIMsgDBView : nsISupports
{
void open(in nsIMsgDatabase msgDB, in nsMsgViewSortTypeValue viewType, out long count);
void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count);
void close();
void init(out long pCount);
void addKeys(out nsMsgKey pKeys, out long pFlags, in string pLevels, in nsMsgViewSortTypeValue sortType, in long numKeysToAdd);
void init(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater);
void sort(in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder);
void doCommand(in nsMsgViewCommandTypeValue command);
void doCommandWithFolder(in nsMsgViewCommandTypeValue command, in nsIMsgFolder destFolder);
void getCommandStatus(in nsMsgViewCommandTypeValue command,
out boolean selectable_p, out nsMsgViewCommandCheckStateValue selected_p);
readonly attribute nsMsgViewTypeValue viewType;
attribute nsMsgViewFlagsTypeValue viewFlags;
readonly attribute nsMsgViewSortTypeValue sortType;
readonly attribute nsMsgViewSortOrderValue sortOrder;
/**
* temporary, so I can test from my js
* this method will automatically expand the destination thread,
* if needs be.
*/
void populateView();
void dumpView();
void viewNavigate(in nsMsgNavigationTypeValue motion, out nsMsgKey resultId, out nsMsgViewIndex resultIndex, out nsMsgViewIndex threadIndex, in boolean wrap);
/**
* Indicates if navigation of the passed motion type is valid.
*/
boolean navigateStatus(in nsMsgNavigationTypeValue motion);
attribute nsIDOMElement sortedColumn;
readonly attribute nsIMsgFolder msgFolder;
nsMsgKey getKeyAt(in nsMsgViewIndex index);
nsIMsgFolder getFolderForViewIndex(in nsMsgViewIndex index); // mainly for search
string getURIForViewIndex(in nsMsgViewIndex index);
void getURIsForSelection([array, size_is(count)] out string uris, out unsigned long count);
void getIndicesForSelection([array, size_is(count)] out nsMsgViewIndex indices, out unsigned long count);
readonly attribute string URIForFirstSelectedMessage;
readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage;
void loadMessageByMsgKey (in nsMsgKey aMsgKey);
void reloadMessage();
readonly attribute unsigned long numSelected;
readonly attribute nsMsgViewIndex firstSelected; // the lowest view index selected.
// we'll suppress displaying messages if the message pane is collapsed
attribute boolean supressMsgDisplay;
};
/* this interface is rapidly morphing from a command updater interface into a more generic
FE updater interface to handle changes in the view
*/
[scriptable, uuid(65FC9AD5-0912-11d5-9901-001083010E9B)]
interface nsIMsgDBViewCommandUpdater : nsISupports
{
/* Eventually we'll flush this out into some kind of rich interface
which may take specifc selection changed type notifications like
no selections, single selection, multi-selection, etc. For starters,
we are going to keep it generic. The back end will only push an update
command status when the # of selected items changes.
*/
void updateCommandStatus();
/* displayed message has changed */
void displayMessageChanged(in nsIMsgFolder aFolder, in wstring aSubject);
};

Просмотреть файл

@ -35,7 +35,7 @@
#include "nsMsgKeyArray.h"
%}
interface nsIMessage;
interface nsIMsgDBHdr;
interface nsIMsgWindow;
interface nsIMsgDatabase;
interface nsIDBFolderInfo;
@ -68,9 +68,6 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
void ReplaceElement(in nsISupports element, in nsISupports newElement);
nsISimpleEnumerator getMessages(in nsIMsgWindow aMsgWindow);
nsISimpleEnumerator getThreadsOfType(in nsIMsgWindow aMsgWindow, in unsigned long viewType);
boolean hasThreads(in nsIMsgWindow aMsgWindow);
boolean hasMessagesOfType(in nsIMsgWindow aMsgWindow, in unsigned long viewType);
void startFolderLoading();
void endFolderLoading();
@ -78,9 +75,6 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
/* get new headers for db */
void updateFolder(in nsIMsgWindow aWindow);
nsIMsgThread getThreadForMessage(in nsIMessage message);
boolean hasMessage(in nsIMessage message);
nsIEnumerator getVisibleSubFolders();
readonly attribute wstring prettiestName;
@ -204,7 +198,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
* return the first new message in the folder
*
*/
readonly attribute nsIMessage firstNewMessage;
readonly attribute nsIMsgDBHdr firstNewMessage;
/**
* clear new status flag of all of the new messages
@ -281,6 +275,8 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
void getExpansionArray(in nsISupportsArray expansionArray);
string getUriForMsg(in nsIMsgDBHdr msgHdr);
void deleteMessages(in nsISupportsArray message,
in nsIMsgWindow msgWindow,
in boolean deleteStorage, in boolean isMove);
@ -292,7 +288,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
void copyFolder(in nsIMsgFolder srcFolder, in boolean isMoveFolder,
in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
void copyFileMessage(in nsIFileSpec fileSpec, in nsIMessage msgToReplace,
void copyFileMessage(in nsIFileSpec fileSpec, in nsIMsgDBHdr msgToReplace,
in boolean isDraft, in nsIMsgWindow msgWindow,
in nsIMsgCopyServiceListener listener);
@ -301,7 +297,6 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
boolean testSemaphore (in nsISupports semHolder);
readonly attribute boolean locked;
nsIMessage createMessageFromMsgDBHdr(in nsIMsgDBHdr msgDBHdr);
void getNewMessages(in nsIMsgWindow aWindow);
/**
@ -338,29 +333,29 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
const nsMsgDispositionState nsMsgDispositionState_Replied = 0;
const nsMsgDispositionState nsMsgDispositionState_Forwarded = 1;
void addMessageDispositionState(in nsIMessage aMessage, in nsMsgDispositionState aDispositionFlag);
void addMessageDispositionState(in nsIMsgDBHdr aMessage, in nsMsgDispositionState aDispositionFlag);
void markMessagesRead(in nsISupportsArray messages, in boolean markRead);
void markAllMessagesRead();
void markMessagesFlagged(in nsISupportsArray messages, in boolean markFlagged);
void markThreadRead(in nsIMsgThread thread);
nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);
nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);
boolean shouldStoreMsgOffline(in nsMsgKey msgKey);
boolean hasMsgOffline(in nsMsgKey msgKey);
nsITransport getOfflineFileTransport(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size);
void DownloadMessagesForOffline(in nsISupportsArray messages);
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);
void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window);
/**
* Turn notifications on/off for various notification types. Currently only supporting
* allMessageCountNotifications which refers to both total and unread message counts.
*/
const unsigned long allMessageCountNotifications = 0;
void enableNotifications(in long notificationType, in boolean enable);
nsITransport getOfflineFileTransport(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size);
void DownloadMessagesForOffline(in nsISupportsArray messages, in nsIMsgWindow window);
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);
void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window);
/**
* Turn notifications on/off for various notification types. Currently only supporting
* allMessageCountNotifications which refers to both total and unread message counts.
*/
const unsigned long allMessageCountNotifications = 0;
void enableNotifications(in long notificationType, in boolean enable);
attribute nsIMsgRetentionSettings retentionSettings;
attribute nsIMsgDownloadSettings downloadSettings;
};

Просмотреть файл

@ -32,6 +32,9 @@
[ptr] native nsCString(nsCString);
[ref] native nsStringRef(nsString);
[ref] native nsCStringRef(nsCString);
[ptr] native octetPtr(PRUint8);
interface nsIMsgFolder;
[scriptable, uuid(4e994f60-c317-11d2-8cc9-0060b0fc14a3)]
interface nsIMsgHdr : nsISupports
@ -44,10 +47,12 @@ interface nsIMsgHdr : nsISupports
unsigned long getUint32Property(in string propertyName);
void setUint32Property(in string propertyName,
in unsigned long propertyVal);
// accessors, to make our JS cleaner
readonly attribute boolean isRead;
readonly attribute boolean isFlagged;
// Mark message routines
// attribute boolean read;
//attribute boolean flagged;
void markRead(in boolean read);
void markFlagged(in boolean flagged);
@ -93,11 +98,12 @@ interface nsIMsgHdr : nsISupports
readonly attribute wstring mime2DecodedSubject;
readonly attribute wstring mime2DecodedRecipients;
readonly attribute wstring authorCollationKey;
readonly attribute wstring subjectCollationKey;
readonly attribute wstring recipientsCollationKey;
[noscript] void getAuthorCollationKey(out octetPtr key, out unsigned long len);
[noscript] void getSubjectCollationKey(out octetPtr key, out unsigned long len);
[noscript] void getRecipientsCollationKey(out octetPtr key, out unsigned long len);
attribute string Charset;
readonly attribute nsIMsgFolder folder;
};
[scriptable, uuid(B5212A60-F93F-11d2-951C-006097222B83)]

Просмотреть файл

@ -28,6 +28,7 @@ interface nsIMsgFolderCache;
interface nsIMsgWindow;
interface nsIMsgFilterList;
interface nsIMsgRetentionSettings;
interface nsIMsgDownloadSettings;
/*
* Interface for incoming mail/news host
@ -213,6 +214,7 @@ interface nsIMsgIncomingServer : nsISupports {
/* display startup page once per account per session */
attribute boolean displayStartupPage;
attribute nsIMsgDownloadSettings downloadSettings;
};
%{C++

Просмотреть файл

@ -29,6 +29,7 @@ interface nsIMsgWindow;
interface nsIFileSpec;
interface nsIMsgFolder;
interface nsIMsgSearchSession;
interface nsIMsgDBHdr;
%{C++
#include "nsMsgKeyArray.h"
@ -135,6 +136,12 @@ interface nsIMsgMessageService : nsISupports {
out nsIURI aURL);
void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aMsgFolder, in string aSearchUri);
/**
* now the the message datasource is going away
* we need away to go from message uri to go nsIMsgDBHdr
*/
nsIMsgDBHdr messageURIToMsgHdr(in string uri);
};
// Some mail protocols (like imap) allow you to fetch individual mime parts. We use this interface
@ -149,4 +156,4 @@ interface nsIMsgMessageFetchPartService : nsISupports
nsIURI fetchMimePart(in nsIURI aURI, in string aMessageUri, in nsISupports aDisplayConsumer,
in nsIMsgWindow aMsgWindow,
in nsIUrlListener aUrlListener);
};
};

Просмотреть файл

@ -39,6 +39,7 @@ interface nsIMsgThread : nsISupports {
void AddChild(in nsIMsgDBHdr child, in nsIMsgDBHdr inReplyTo, in boolean threadInThread, in nsIDBChangeAnnouncer announcer);
nsIMsgDBHdr GetChildAt(in long index);
nsMsgKey GetChildKeyAt(in long index);
nsIMsgDBHdr GetChild(in nsMsgKey msgKey);
nsIMsgDBHdr GetChildHdrAt(in long index);
nsIMsgDBHdr GetRootHdr(out long index);
@ -47,8 +48,9 @@ interface nsIMsgThread : nsISupports {
void MarkChildRead(in boolean bRead);
nsIMsgDBHdr GetFirstUnreadChild();
nsISimpleEnumerator EnumerateMessages(in nsMsgKey parent);
nsISimpleEnumerator EnumerateUnreadMessages(in nsMsgKey parent);
boolean hasMessagesOfType(in nsMsgKey parent, in unsigned long viewType);
};

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsISupports.idl"
#include "nsIMsgStatusFeedback.idl"
#include "nsIMsgFolder.idl"
#include "nsIMessageView.idl"
interface nsITransactionManager;
interface nsIDocShell;
@ -41,7 +40,6 @@ interface nsIMsgWindow : nsISupports {
attribute nsIMsgStatusFeedback statusFeedback;
attribute nsIMsgHeaderSink msgHeaderSink;
attribute nsITransactionManager transactionManager;
attribute nsIMessageView messageView;
attribute nsIMsgFolder openFolder;
attribute nsIDocShell rootDocShell;
void displayHTMLInMessagePane(in wstring title, in wstring body);

Просмотреть файл

@ -23,47 +23,48 @@
#ifndef _msgHeaderMasks_h_
#define _msgHeaderMasks_h_
DO NOT USE ANYMORE!!!
/* This set enumerates the header fields which may be displayed in the
message composition window.
*/
#define MSG_FROM_HEADER_MASK 0x00000001
#define MSG_REPLY_TO_HEADER_MASK 0x00000002
#define MSG_TO_HEADER_MASK 0x00000004
#define MSG_CC_HEADER_MASK 0x00000008
#define MSG_BCC_HEADER_MASK 0x00000010
#define MSG_FCC_HEADER_MASK 0x00000020
#define MSG_NEWSGROUPS_HEADER_MASK 0x00000040
#define MSG_FOLLOWUP_TO_HEADER_MASK 0x00000080
#define MSG_SUBJECT_HEADER_MASK 0x00000100
#define MSG_ATTACHMENTS_HEADER_MASK 0x00000200
#define MSG_FROM_HEADER_MASK 0x00000001
#define MSG_REPLY_TO_HEADER_MASK 0x00000002
#define MSG_TO_HEADER_MASK 0x00000004
#define MSG_CC_HEADER_MASK 0x00000008
#define MSG_BCC_HEADER_MASK 0x00000010
#define MSG_FCC_HEADER_MASK 0x00000020
#define MSG_NEWSGROUPS_HEADER_MASK 0x00000040
#define MSG_FOLLOWUP_TO_HEADER_MASK 0x00000080
#define MSG_SUBJECT_HEADER_MASK 0x00000100
#define MSG_ATTACHMENTS_HEADER_MASK 0x00000200
/* These next four are typically not ever displayed in the UI, but are still
stored and used internally. */
#define MSG_ORGANIZATION_HEADER_MASK 0x00000400
#define MSG_REFERENCES_HEADER_MASK 0x00000800
#define MSG_OTHERRANDOMHEADERS_HEADER_MASK 0x00001000
#define MSG_NEWSPOSTURL_HEADER_MASK 0x00002000
#define MSG_ORGANIZATION_HEADER_MASK 0x00000400
#define MSG_REFERENCES_HEADER_MASK 0x00000800
#define MSG_OTHERRANDOMHEADERS_HEADER_MASK 0x00001000
#define MSG_NEWSPOSTURL_HEADER_MASK 0x00002000
#define MSG_PRIORITY_HEADER_MASK 0x00004000
#define MSG_NEWS_FCC_HEADER_MASK 0x00008000
#define MSG_MESSAGE_ENCODING_HEADER_MASK 0x00010000
#define MSG_CHARACTER_SET_HEADER_MASK 0x00020000
#define MSG_MESSAGE_ID_HEADER_MASK 0x00040000
#define MSG_NEWS_BCC_HEADER_MASK 0x00080000
#define MSG_PRIORITY_HEADER_MASK 0x00004000
//#define MSG_NEWS_FCC_HEADER_MASK 0x00008000
//#define MSG_MESSAGE_ENCODING_HEADER_MASK 0x00010000
#define MSG_CHARACTER_SET_HEADER_MASK 0x00008000
#define MSG_MESSAGE_ID_HEADER_MASK 0x00010000
//#define MSG_NEWS_BCC_HEADER_MASK 0x00080000
/* This is also not exposed to the UI; it's used internally to help remember
whether the original message had an HTML portion that we can quote. */
#define MSG_HTML_PART_HEADER_MASK 0x00100000
//#define MSG_HTML_PART_HEADER_MASK 0x00100000
/* The "body=" pseudo-header (as in "mailto:me?body=hi+there") */
#define MSG_DEFAULTBODY_HEADER_MASK 0x00200000
//#define MSG_DEFAULTBODY_HEADER_MASK 0x00200000
#define MSG_X_TEMPLATE_HEADER_MASK 0x00400000
#define MSG_X_TEMPLATE_HEADER_MASK 0x00020000
#define MSG_FCC2_HEADER_MASK 0x00800000
#define MSG_FCC2_HEADER_MASK 0x00400000
/* IMAP folders for posting */
#define MSG_IMAP_FOLDER_HEADER_MASK 0x02000000
//#define MSG_IMAP_FOLDER_HEADER_MASK 0x02000000
#endif

Просмотреть файл

@ -60,10 +60,6 @@ typedef PRInt32 MsgFlags;
#define MSG_FLAG_ELIDED 0x0020 /* Whether the children of this
sub-thread are folded in the
display. */
#define MSG_FLAG_EXPIRED 0x0040 /* If this flag is set, then this
is not a "real" message, but is
a dummy container representing
an expired parent in a thread. */
#define MSG_FLAG_OFFLINE 0x0080 /* db has offline news or imap article
*/
#define MSG_FLAG_WATCHED 0x0100 /* If set, then this thread is watched (in
@ -99,7 +95,6 @@ typedef PRInt32 MsgFlags;
*/
#define MSG_FLAG_IGNORED 0x40000 /* the thread is ignored */
#define MSG_FLAG_IMAP_DELETED 0x200000 /* message is marked deleted on the server */
#define MSG_FLAG_MDN_REPORT_NEEDED 0x400000 /* This msg required to send an MDN
@ -113,6 +108,9 @@ typedef PRInt32 MsgFlags;
#define MSG_FLAG_TEMPLATE 0x1000000 /* this message is a template */
#define MSG_FLAG_ATTACHMENT 0x10000000 /* this message has files attached to it */
// we're trying to reserve the high byte of the flags for view flags,
// so, don't add flags to the high byte if possible.
/* The list of all message flags to not write to disk. */
#define MSG_FLAG_RUNTIME_ONLY (MSG_FLAG_ELIDED)

Просмотреть файл

@ -42,8 +42,6 @@ subscribe.xul
sidebar-messenger.rdf
folderProps.js
imapFolderProps.xul
newFolderNameDialog.xul
newFolderNameDialog.js
renameFolderNameDialog.xul
msgViewNavigation.js
msgMail3PaneWindow.js

Просмотреть файл

@ -23,9 +23,6 @@
* Command-specific code. This stuff should be called by the widgets
*/
//The eventual goal is for this file to go away and for the functions to either be brought into
//mailCommands.js or into 3pane specific code.
//NOTE: gMessengerBundle and gBrandBundle must be defined and set
// for this Overlay to work properly
@ -56,8 +53,6 @@ function GetMsgFolderFromURI(folderURI)
}
return null;
}
function GetServer(uri)
@ -73,24 +68,22 @@ function GetServer(uri)
return null;
}
function LoadMessage(messageNode)
{
var uri = messageNode.getAttribute('id');
LoadMessageByUri(uri);
}
function LoadMessageByUri(uri)
{
dump("XXX LoadMessageByUri " + uri + " vs " + gCurrentDisplayedMessage + "\n");
if(uri != gCurrentDisplayedMessage)
{
dump("fix this, get the nsIMsgDBHdr and the nsIMsgFolder from the uri...\n");
/*
var resource = RDF.GetResource(uri);
var message = resource.QueryInterface(Components.interfaces.nsIMessage);
if (message)
setTitleFromFolder(message.msgFolder, message.mime2DecodedSubject);
setTitleFromFolder(message.msgFolder, message.mimef2DecodedSubject);
var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
if (message.msgFolder.server.downloadOnBiff)
message.msgFolder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
*/
gCurrentDisplayedMessage = uri;
gHaveLoadedMessage = true;
@ -103,23 +96,14 @@ function ChangeFolderByDOMNode(folderNode)
{
var uri = folderNode.getAttribute('id');
dump(uri + "\n");
if (!uri) return;
var isThreaded = folderNode.getAttribute('threaded');
if ((isThreaded == "") && isNewsURI(uri)) {
isThreaded = "true";
}
var sortResource = folderNode.getAttribute('sortResource');
if(!sortResource)
sortResource = "";
var sortDirection = folderNode.getAttribute('sortDirection');
var sortType = folderNode.getAttribute('sortType');
var sortOrder = folderNode.getAttribute('sortOrder');
var viewFlags = folderNode.getAttribute('viewFlags');
var viewType = folderNode.getAttribute('viewType');
if (uri)
ChangeFolderByURI(uri, isThreaded == "true", sortResource, sortDirection, viewType);
ChangeFolderByURI(uri, viewType, viewFlags, sortType, sortOrder);
}
function setTitleFromFolder(msgfolder, subject)
@ -168,7 +152,7 @@ function setTitleFromFolder(msgfolder, subject)
window.title = title;
}
function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection, viewType)
function ChangeFolderByURI(uri, viewType, viewFlags, sortType, sortOrder)
{
dump('In ChangeFolderByURI uri = ' + uri + "\n");
if (uri == gCurrentLoadingFolderURI)
@ -185,12 +169,11 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection, viewType)
//if it's a server, clear the threadpane and don't bother trying to load.
if(msgfolder.isServer)
{
ClearThreadPane();
if(msgfolder.isServer) {
ClearThreadPane();
// Load AccountCentral page here.
ShowAccountCentral();
// Load AccountCentral page here.
ShowAccountCentral();
return;
}
else
@ -222,10 +205,10 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection, viewType)
{
SetBusyCursor(window, true);
gCurrentFolderToReroot = uri;
gCurrentLoadingFolderIsThreaded = isThreaded;
gCurrentLoadingFolderSortID = sortID;
gCurrentLoadingFolderSortDirection = sortDirection;
gCurrentLoadingFolderViewType = viewType;
gCurrentLoadingFolderViewFlags = viewFlags;
gCurrentLoadingFolderViewType = viewType;
gCurrentLoadingFolderSortType = sortType;
gCurrentLoadingFolderSortOrder = sortOrder;
msgfolder.startFolderLoading();
msgfolder.updateFolder(msgWindow);
}
@ -239,15 +222,18 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection, viewType)
{
SetBusyCursor(window, true);
gCurrentFolderToReroot = "";
gCurrentLoadingFolderIsThreaded = false;
gCurrentLoadingFolderSortID = "";
gCurrentLoadingFolderViewType = "";
RerootFolder(uri, msgfolder, isThreaded, sortID, sortDirection, viewType);
gCurrentLoadingFolderViewFlags = 0; // is this correct?
gCurrentLoadingFolderSortType = 0; // is this correct?
gCurrentLoadingFolderSortOrder = 0; // is this correct?
gCurrentLoadingFolderViewType = 0; // is this correct?
RerootFolder(uri, msgfolder, viewType, viewFlags, sortType, sortOrder);
//Need to do this after rerooting folder. Otherwise possibility of receiving folder loaded
//notification before folder has actually changed.
msgfolder.updateFolder(msgWindow);
}
document.commandDispatcher.updateCommands('mail-toolbar');
}
function isNewsURI(uri)
@ -260,26 +246,23 @@ function isNewsURI(uri)
}
}
function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection, viewType)
function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
{
dump('In reroot folder\n');
// workaround for #39655
gFolderJustSwitched = true;
var folder = GetThreadTreeFolder();
ClearThreadTreeSelection();
//Set the window's new open folder.
msgWindow.openFolder = newFolder;
//Set threaded state
ShowThreads(isThreaded);
//Set the view type
SetViewType(viewType);
SetViewFlags(viewFlags);
//Clear the new messages of the old folder
dump("some work needed here\n");
/*
var oldFolderURI = folder.getAttribute("ref");
if(oldFolderURI && (oldFolderURI != "null") && (oldFolderURI !=""))
{
@ -290,7 +273,7 @@ function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection, viewTyp
oldFolder.clearNewMessages();
}
}
*/
//the new folder being selected should have its biff state get cleared.
if(newFolder)
{
@ -299,83 +282,108 @@ function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection, viewTyp
}
//Clear out the thread pane so that we can sort it with the new sort id without taking any time.
folder.setAttribute('ref', "");
// folder.setAttribute('ref', "");
if (isNewsURI(uri))
SetNewsFolderColumns(true);
else
SetNewsFolderColumns(false);
var column = FindThreadPaneColumnBySortResource(sortID);
if(column)
SortThreadPane(column, sortID, "http://home.netscape.com/NC-rdf#Date", false, sortDirection, false);
else
SortThreadPane("DateColumn", "http://home.netscape.com/NC-rdf#Date", "", false, null, false);
// null this out, so we don't try sort.
gDBView = null;
SetSentFolderColumns(IsSpecialFolder(newFolder, [ "Sent", "Drafts", "Unsent Messages" ]));
// now create the db view, which will sort it.
// Since SetSentFolderColumns() may alter the template's structure,
// we need to explicitly force the builder to recompile its rules.
//when switching folders, switch back to closing threads
SetTemplateTreeItemOpen(false);
folder.builder.rebuild();
CreateDBView(newFolder, viewType, viewFlags, sortType, sortOrder);
// that should have initialized gDBView, now re-root the thread pane
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
if (outlinerView)
{
var outliner = GetThreadOutliner();
outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).view = outlinerView;
}
SetUpToolbarButtons(uri);
folder.setAttribute('ref', uri);
msgNavigationService.EnsureDocumentIsLoaded(document);
UpdateStatusMessageCounts(newFolder);
}
function SwitchView(command)
{
gDBView = null; // close existing view.
var viewFlags = gCurViewFlags;
switch(command)
{
case "cmd_viewUnreadMsgs":
viewFlags = viewFlags | nsMsgViewFlagsType.kUnreadOnly;
CreateDBView(msgWindow.openFolder, nsMsgViewType.eShowAllThreads, viewFlags,
nsMsgViewSortType.byThread, nsMsgViewSortOrder.ascending);
break;
case "cmd_viewAllMsgs":
viewFlags = viewFlags & ~nsMsgViewFlagsType.kUnreadOnly;
CreateDBView(msgWindow.openFolder, nsMsgViewType.eShowAllThreads, viewFlags,
nsMsgViewSortType.byThread, nsMsgViewSortOrder.ascending);
break;
case "cmd_viewThreadsWithUnread":
CreateDBView(msgWindow.openFolder, nsMsgViewType.eShowThreadsWithUnread, nsMsgViewFlagsType.kThreadedDisplay,
nsMsgViewSortType.byThread, nsMsgViewSortOrder.ascending);
break;
case "cmd_viewWatchedThreadsWithUnread":
CreateDBView(msgWindow.openFolder, nsMsgViewType.eShowWatchedThreadsWithUnread, nsMsgViewFlagsType.kThreadedDisplay,
nsMsgViewSortType.byThread, nsMsgViewSortOrder.ascending);
break;
case "cmd_viewKilledThreads":
break;
}
// that should have initialized gDBView, now re-root the thread pane
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
if (outlinerView)
{
var outliner = GetThreadOutliner();
outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).view = outlinerView;
dump('set outliner view\n');
}
}
function SetSentFolderColumns(isSentFolder)
{
var senderColumn = document.getElementById("SenderColumnHeader");
var senderColumnTemplate = document.getElementById("SenderColumnTemplate");
var authorColumnHeader = document.getElementById("AuthorColumn");
var senderColumn = document.getElementById("senderCol");
if(isSentFolder)
{
senderColumn.setAttribute("value", gMessengerBundle.getString("recipientColumnHeader"));
senderColumn.setAttribute("onclick", "return top.MsgSortByRecipient();");
senderColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Recipient");
authorColumnHeader.setAttribute("resource", "http://home.netscape.com/NC-rdf#Recipient");
}
else
{
senderColumn.setAttribute("value", gMessengerBundle.getString("senderColumnHeader"));
senderColumn.setAttribute("onclick", "return top.MsgSortBySender();");
senderColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Sender");
authorColumnHeader.setAttribute("resource", "http://home.netscape.com/NC-rdf#Sender");
}
}
function SetNewsFolderColumns(isNewsFolder)
{
dump("fix me, I need to show lines or size depending on if the folder is news or not\n");
/*
var sizeColumn = document.getElementById("SizeColumnHeader");
var sizeColumnTemplate = document.getElementById("SizeColumnTemplate");
var sizeColumnTemplate = document.getElementById("SizeColumnTemplate");
var memoryColumnHeader = document.getElementById("MemoryColumn");
if (isNewsFolder)
{
sizeColumn.setAttribute("value", gMessengerBundle.getString("linesColumnHeader"));
sizeColumn.setAttribute("onclick", "return top.MsgSortByLines();");
sizeColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Lines");
memoryColumnHeader.setAttribute("resource","http://home.netscape.com/NC-rdf#Lines");
}
else
{
sizeColumn.setAttribute("value", gMessengerBundle.getString("sizeColumnHeader"));
sizeColumn.setAttribute("onclick", "return top.MsgSortBySize();");
sizeColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Size");
memoryColumnHeader.setAttribute("resource","http://home.netscape.com/NC-rdf#Size");
}
var memoryColumnHeader = document.getElementById("MemoryColumn");
if (isNewsFolder)
{
sizeColumn.setAttribute("value",gMessengerBundle.getString("linesColumnHeader"));
sizeColumn.setAttribute("onclick", "return top.MsgSortByLines();");
sizeColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Lines");
memoryColumnHeader.setAttribute("resource","http://home.netscape.com/NC-rdf#Lines");
}
else
{
sizeColumn.setAttribute("value", gMessengerBundle.getString("sizeColumnHeader"));
sizeColumn.setAttribute("onclick", "return top.MsgSortBySize();");
sizeColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Size");
memoryColumnHeader.setAttribute("resource","http://home.netscape.com/NC-rdf#Size");
}
*/
}
@ -416,141 +424,200 @@ function SaveThreadPaneSelection()
return selectionArray;
}
function RestoreThreadPaneSelection(selectionArray)
function ConvertColumnIDToSortType(columnID)
{
var tree = GetThreadTree();
var numSelected = selectionArray.length;
msgNavigationService.EnsureDocumentIsLoaded(document);
var messageElement;
for(var i = 0 ; i < numSelected; i++)
{
messageElement = document.getElementById(selectionArray[i]);
if(!messageElement && messageView.showThreads)
{
var treeFolder = GetThreadTreeFolder();
var folderURI = treeFolder.getAttribute('ref');
var folderResource = RDF.GetResource(folderURI);
var folder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var messageResource = RDF.GetResource(selectionArray[i]);
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
var topLevelMessage = GetTopLevelMessageForMessage(message, folder);
var topLevelResource = topLevelMessage.QueryInterface(Components.interfaces.nsIRDFResource);
var topLevelURI = topLevelResource.Value;
var topElement = document.getElementById(topLevelURI);
if(topElement)
{
msgNavigationService.OpenTreeitemAndDescendants(topElement);
}
messageElement = document.getElementById(selectionArray[i]);
}
if(messageElement)
{
//dump("We have a messageElement\n");
tree.addItemToSelection(messageElement);
if(i==0)
tree.ensureElementIsVisible(messageElement);
}
}
var sortKey;
switch (columnID) {
case "dateCol":
sortKey = nsMsgViewSortType.byDate;
break;
case "senderCol":
sortKey = nsMsgViewSortType.byAuthor;
break;
case "subjectCol":
sortKey = nsMsgViewSortType.bySubject;
break;
case "unreadButtonColHeader":
sortKey = nsMsgViewSortType.byUnread;
break;
case "statusCol":
sortKey = nsMsgViewSortType.byStatus;
break;
case "sizeCol":
sortKey = nsMsgViewSortType.bySize;
break;
case "priorityCol":
sortKey = nsMsgViewSortType.byPriority;
break;
case "flaggedCol":
sortKey = nsMsgViewSortType.byFlagged;
break;
case "threadCol":
sortKey = nsMsgViewSortType.byThread;
break;
default:
dump("unsupported sort: " + columnID + "\n");
sortKey = 0;
break;
}
return sortKey;
}
function FindThreadPaneColumnBySortResource(sortID)
function ConvertSortTypeToColumnID(sortKey)
{
var columnID;
if(sortID == "http://home.netscape.com/NC-rdf#Date")
return "DateColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Sender")
return "AuthorColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Recipient")
return "AuthorColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Status")
return "StatusColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Subject")
return "SubjectColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Flagged")
return "FlaggedButtonColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Priority")
return "PriorityColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Size")
return "MemoryColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Lines")
return "MemoryColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#IsUnread")
return "UnreadButtonColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#TotalUnreadMessages")
return "UnreadColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#TotalMessages")
return "TotalColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#OrderReceived")
return "OrderReceivedColumn";
return null;
// hack to turn this into an integer, if it was a string;
sortKey = sortKey - 0;
switch (sortKey) {
case nsMsgViewSortType.byDate:
columnID = "dateCol";
break;
case nsMsgViewSortType.byAuthor:
columnID = "senderCol";
break;
case nsMsgViewSortType.bySubject:
columnID = "subjectCol";
break;
case nsMsgViewSortType.byUnread:
columnID = "unreadButtonColHeader";
break;
case nsMsgViewSortType.byStatus:
columnID = "statusCol";
break;
case nsMsgViewSortType.bySize:
columnID = "sizeCol";
break;
case nsMsgViewSortType.byPriority:
columnID = "priorityCol";
break;
case nsMsgViewSortType.byFlagged:
columnID = "flaggedCol";
break;
case nsMsgViewSortType.byThread:
columnID = "threadCol";
break;
default:
dump("unsupported sort: " + sortKey + "\n");
columnID = null;
break;
}
return columnID;
}
//If toggleCurrentDirection is true, then get current direction and flip to opposite.
//If it's not true then use the direction passed in.
function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirection, direction, changeCursor)
var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
var nsMsgViewType = Components.interfaces.nsMsgViewType;
var nsMsgNavigationType = Components.interfaces.nsMsgNavigationType;
var gDBView = null;
var gCurViewFlags;
// CreateDBView is called when we have a thread pane. CreateBareDBView is called when there is no
// outliner associated with the view. CreateDBView will call into CreateBareDBView...
function CreateBareDBView(msgFolder, viewType, viewFlags, sortType, sortOrder)
{
//dump("In SortThreadPane, toggleCurrentDirection = " + toggleCurrentDirection + "\n");
var node = document.getElementById(column);
if(!node)
return false;
dump("XXX CreateDBView(" + msgFolder + "," + viewType + "," + viewFlags + "," + sortType + "," + sortOrder + ")\n");
if(!direction)
{
direction = "ascending";
//If we just clicked on the same column, then change the direction
if(toggleCurrentDirection)
{
var currentDirection = node.getAttribute('sortDirection');
if (currentDirection == "ascending")
direction = "descending";
else if (currentDirection == "descending")
direction = "ascending";
}
}
var dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=";
UpdateSortIndicator(column, direction);
UpdateSortMenu(column);
switch (viewType) {
case nsMsgViewType.eShowThreadsWithUnread:
dbviewContractId += "threadswithunread";
break;
case nsMsgViewType.eShowWatchedThreadsWithUnread:
dbviewContractId += "watchedthreadswithunread";
break;
case nsMsgViewType.eShowAllThreads:
default:
dbviewContractId += "threaded";
break;
}
var folder = GetSelectedFolder();
if(folder)
{
folder.setAttribute("sortResource", sortKey);
folder.setAttribute("sortDirection", direction);
}
dump("XXX creating " + dbviewContractId + " with: " + viewType + "," + sortType + "," + sortOrder + "\n");
gDBView = Components.classes[dbviewContractId].createInstance(Components.interfaces.nsIMsgDBView);
SetActiveThreadPaneSortColumn(column);
var selection = SaveThreadPaneSelection();
var beforeSortTime;
if(showPerformance) {
beforeSortTime = new Date();
var isNews = isNewsURI(msgFolder.URI);
if (!viewFlags) {
if (isNews) {
// news defaults to threaded mode
viewFlags = nsMsgViewFlagsType.kThreadedDisplay;
}
if(changeCursor)
SetBusyCursor(window, true);
var result = SortColumn(node, sortKey, secondarySortKey, direction);
if(changeCursor)
SetBusyCursor(window, false);
if(showPerformance) {
var afterSortTime = new Date();
var timeToSort = (afterSortTime.getTime() - beforeSortTime.getTime())/1000;
dump("timeToSort is " + timeToSort + " seconds\n");
else {
viewFlags &= nsMsgViewFlagsType.kThreadedDisplay;
}
}
RestoreThreadPaneSelection(selection);
return result;
if (!sortType) {
if (isNews) {
// news defaults to threaded mode
sortType = nsMsgViewSortType.byThread;
}
else {
sortType = nsMsgViewSortType.byDate;
}
}
if (!sortOrder) {
sortOrder = nsMsgViewSortOrder.ascending;
}
gCurViewFlags = viewFlags;
var count = new Object;
if (!gThreadPaneCommandUpdater)
gThreadPaneCommandUpdater = new nsMsgDBViewCommandUpdater();
gDBView.init(messenger, msgWindow, gThreadPaneCommandUpdater);
gDBView.open(msgFolder, sortType, sortOrder, viewFlags, count);
}
function CreateDBView(msgFolder, viewType, viewFlags, sortType, sortOrder)
{
// call the inner create method
CreateBareDBView(msgFolder, viewType, viewFlags, sortType, sortOrder);
// now do outliner specific work
// based on the collapsed state of the thread pane/message pane splitter,
// supress message display if appropriate.
var collapsed = IsThreadAndMessagePaneSplitterCollapsed();
if (collapsed)
gDBView.supressMsgDisplay = true;
else
gDBView.supressMsgDisplay = false;
var colID = ConvertSortTypeToColumnID(sortType);
if (colID) {
var column = document.getElementById(colID);
gDBView.sortedColumn = column;
}
ShowAppropriateColumns();
PersistViewAttributesOnFolder();
}
function ShowAppropriateColumns()
{
if (gDBView.sortType == nsMsgViewSortType.byThread) {
// don't hide them when sorted by thread
SetHiddenAttributeOnThreadOnlyColumns("");
}
else {
// hide them when not sorted by thread
SetHiddenAttributeOnThreadOnlyColumns("true");
}
}
function SetViewFlags(viewFlags)
{
if (!gDBView) return;
dump("XXX SetViewFlags(" + viewFlags + ")\n");
gDBView.viewFlags = viewFlags;
}
//------------------------------------------------------------
@ -567,53 +634,12 @@ function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirectio
//------------------------------------------------------------
function UpdateSortIndicator(column,sortDirection)
{
// Find the <treerow> element
var treerow = document.getElementById("headRow");
//The SortThreadPane function calls the Sender/Recipient column 'AuthorColumn'
//but it's treecell header id is actually 'SenderColumnHeader', so we need to flip
//it here so that the css can handle changing it's style correctly.
if(column == "AuthorColumn"){
column = "SenderColumn";
}
//Similary for the Size/Lines column
if(column == "MemoryColumn"){
column = "SizeColumn";
}
var id = column + "Header";
if (treerow)
{
// Grab all of the <treecell> elements
var treecell = treerow.getElementsByTagName("treecell");
if (treecell)
{
// Loop through each treecell...
var node_count = treecell.length;
for (var i=0; i < node_count; i++)
{
// Is this the requested column ?
if (id == treecell[i].getAttribute("id"))
{
// Set the sortDirection so the class (CSS) will add the
// appropriate icon to the header cell
treecell[i].setAttribute('sortDirection',sortDirection);
}
else
{
// This is not the sorted row
treecell[i].removeAttribute('sortDirection');
}
}
}
}
// this is obsolete
}
function UpdateSortMenu(currentSortColumn)
{
/*
UpdateSortMenuitem(currentSortColumn, "sortByDateMenuitem", "DateColumn");
UpdateSortMenuitem(currentSortColumn, "sortByFlagMenuitem", "FlaggedButtonColumn");
UpdateSortMenuitem(currentSortColumn, "sortByOrderReceivedMenuitem", "OrderReceivedColumn");
@ -623,7 +649,7 @@ function UpdateSortMenu(currentSortColumn)
UpdateSortMenuitem(currentSortColumn, "sortByStatusMenuitem", "StatusColumn");
UpdateSortMenuitem(currentSortColumn, "sortBySubjectMenuitem", "SubjectColumn");
UpdateSortMenuitem(currentSortColumn, "sortByUnreadMenuitem", "UnreadButtonColumn");
*/
}
function UpdateSortMenuitem(currentSortColumnID, menuItemID, columnID)
@ -704,60 +730,36 @@ function GetSelectedFolderResource()
function ToggleMessageRead(treeItem)
{
var tree = GetThreadTree();
var messageResource = RDF.GetResource(treeItem.getAttribute('id'));
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#IsUnread');
var result = tree.database.GetTarget(messageResource, property , true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
var isUnread = (result.Value == "true")
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
var messageArray = new Array(1);
messageArray[0] = message;
MarkMessagesRead(tree.database, messageArray, isUnread);
}
function ToggleMessageFlagged(treeItem)
{
var tree = GetThreadTree();
var messageResource = RDF.GetResource(treeItem.getAttribute('id'));
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#Flagged');
var result = tree.database.GetTarget(messageResource, property , true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
var flagged = (result.Value == "flagged")
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
var messageArray = new Array(1);
messageArray[0] = message;
MarkMessagesFlagged(tree.database, messageArray, !flagged);
}
//Called when the splitter in between the thread and message panes is clicked.
function OnClickThreadAndMessagePaneSplitter()
{
var collapsed = IsThreadAndMessagePaneSplitterCollapsed();
// collapsed is the previous state, so we must be expanding
// the splitter if collapsed is true
if (gDBView)
{
if (collapsed)
gDBView.supressMsgDisplay = false;
else
gDBView.supressMsgDisplay = true;
}
/*
dump("We are in OnClickThreadAndMessagePaneSplitter()\n");
var collapsed = IsThreadAndMessagePaneSplitterCollapsed();
//collapsed is the previous state so we know we are opening.
if(collapsed){
if(collapsed)
{
LoadSelectionIntoMessagePane();
setTimeout("PositionThreadPane();",0);
}
setTimeout("PositionThreadPane();",0);
}
*/
}
function PositionThreadPane()
{
dump("need for cross folder navigation. fix me: PositionThreadPane()\n");
/*
var tree = GetThreadTree();
var selArray = tree.selectedItems;
@ -767,26 +769,7 @@ function PositionThreadPane()
tree.ensureElementIsVisible(selArray[0]);
}
catch(e) { }
}
//takes the selection from the thread pane and loads it into the message pane
function LoadSelectionIntoMessagePane()
{
var tree = GetThreadTree();
var selArray = tree.selectedItems;
if (!gNextMessageAfterDelete && selArray && (selArray.length == 1) ) {
LoadMessage(selArray[0]);
}
else
{
// don't necessarily clear the message pane...if you uncomment this,
// you'll be introducing a large inefficiency when deleting messages...as deleting
// a msg brings us here twice...so we end up clearing the message pane twice for no
// good reason...
// ClearMessagePane();
}
*/
}
function FolderPaneSelectionChange()
@ -796,29 +779,26 @@ function FolderPaneSelectionChange()
{
var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) )
{
ChangeFolderByDOMNode(selArray[0]);
}
{
ChangeFolderByDOMNode(selArray[0]);
}
else
{
ClearThreadPane();
}
}
if (!gAccountCentralLoaded)
ClearMessagePane();
if (gDisplayStartupPage)
{
loadStartPage();
gDisplayStartupPage = false;
}
if (!gAccountCentralLoaded)
ClearMessagePane();
if (gDisplayStartupPage)
{
loadStartPage();
gDisplayStartupPage = false;
}
}
function ClearThreadPane()
{
var threadTree = GetThreadTree();
ClearThreadTreeSelection();
threadTree.setAttribute('ref', null);
}
function OpenFolderTreeToFolder(folderURI)
@ -892,94 +872,12 @@ function IsSpecialFolder(msgFolder, specialFolderNames)
return false;
}
function SetViewType(viewType)
{
//dump("in SetViewType with " + viewType + "\n");
if (!viewType || (viewType == "")) {
viewType = nsMsgViewType.eShowAll;
}
if(messageView)
{
messageView.viewType = viewType;
}
}
function ShowThreads(showThreads)
{
//dump('in showthreads\n');
if(messageView)
{
messageView.showThreads = showThreads;
var threadColumn = document.getElementById('ThreadColumnHeader');
if(threadColumn)
{
if(showThreads)
{
threadColumn.setAttribute('currentView', 'threaded');
}
else
{
threadColumn.setAttribute('currentView', 'unthreaded');
}
}
}
}
function GetNextMessageAfterDelete(messages)
{
var count = messages.length;
var curMessage = messages[0];
var nextMessage = null;
var tree = GetThreadTree();
//search forward
while(curMessage)
{
nextMessage = msgNavigationService.FindNextMessage(navigateAny, tree, curMessage, RDF, document, false, messageView.showThreads);
if(nextMessage)
{
if(nextMessage.getAttribute("selected") != "true")
{
break;
}
}
curMessage = nextMessage;
}
//if no nextmessage then search backwards
if(!nextMessage)
{
curMessage = messages[0];
nextMessage = null;
//search forward
while(curMessage)
{
nextMessage = msgNavigationService.FindPreviousMessage(navigateAny, tree, curMessage, RDF, document, false, messageView.showThreads);
if(nextMessage)
{
if(nextMessage.getAttribute("selected") != "true")
{
break;
}
}
curMessage = nextMessage;
}
}
return nextMessage;
}
function SelectNextMessage(nextMessage)
{
/*
var tree = GetThreadTree();
ChangeSelection(tree, nextMessage);
*/
}
function GetSelectTrashUri(folder)
@ -1017,3 +915,26 @@ function Redo()
{
messenger.Redo(msgWindow);
}
function MsgToggleWorkOffline()
{
var ioService = nsJSComponentManager.getServiceByID("{9ac9e770-18bc-11d3-9337-00104ba0fd40}", "nsIIOService");
var broadcaster = document.getElementById("Communicator:WorkMode");
// this is just code for my testing purposes, and doesn't have the proper UI, as in the offline spec.
// we could use the account manager, or add a new service, the offline manager.
// what the heck, might as well bite the bullet and add a new service.
offlineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"].getService(Components.interfaces.nsIMsgOfflineManager);
if (ioService.offline)
{
ioService.offline = false;
// really want to use a progress window here
offlineManager.goOnline(true, true, msgWindow);
// if we were offline, then we're going online and should playback offline operations
}
else // we were online, so we're going offline and should download everything for offline use
{
// should use progress window here. params are:
// download news, download mail, send unsent messages, go offline when done, msg window
offlineManager.synchronizeForOffline(true, true, true, true, msgWindow);
}
}

Просмотреть файл

@ -34,7 +34,7 @@
<tree datasources="rdf:null"
id="folderTree" class="mail-folders"
onselect="top.FolderPaneSelectionChange(); document.commandDispatcher.updateCommands('folderTree-select');"
onselect="top.FolderPaneSelectionChange();"
onblur="goOnEvent(this,'blur')" dd-nodropbetweenrows="true"
ondragover="return DragOverTree(event);"
ondraggesture="return BeginDragFolderTree(event);"
@ -59,7 +59,7 @@
CanSubscribe="rdf:http://home.netscape.com/NC-rdf#CanSubscribe"
CanFileMessages="rdf:http://home.netscape.com/NC-rdf#CanFileMessages"
NoSelect="rdf:http://home.netscape.com/NC-rdf#NoSelect"
persist="threaded open sortResource sortDirection viewType">
persist="open viewType viewFlags sortOrder sortType">
<treerow class="tree-folder-row"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
HasUnreadMessages="rdf:http://home.netscape.com/NC-rdf#HasUnreadMessages"

Просмотреть файл

@ -88,6 +88,10 @@ var FolderPaneController =
doCommand: function(command)
{
// if the user invoked a key short cut then it is possible that we got here for a command which is
// really disabled. kick out if the command should be disabled.
if (!this.isCommandEnabled(command)) return;
switch ( command )
{
case "cmd_delete":
@ -145,20 +149,23 @@ var ThreadPaneController =
doCommand: function(command)
{
// if the user invoked a key short cut then it is possible that we got here for a command which is
// really disabled. kick out if the command should be disabled.
if (!this.isCommandEnabled(command)) return;
switch ( command )
{
case "cmd_selectAll":
var threadTree = GetThreadTree();
if ( threadTree )
{
//if we're threaded we need to expand everything before selecting all
if(messageView.showThreads)
ExpandOrCollapseThreads(true);
threadTree.selectAll();
if ( threadTree.selectedItems && threadTree.selectedItems.length != 1 )
ClearMessagePane();
}
break;
if (gDBView)
{
// if in threaded mode, the view will expand all before selecting all
gDBView.doCommand(nsMsgViewCommandType.selectAll)
if (gDBView.numSelected != 1)
{
ClearMessagePane();
}
}
break;
}
},
@ -191,6 +198,7 @@ var DefaultController =
case "cmd_shiftDelete":
case "cmd_editDraft":
case "cmd_nextMsg":
case "button_next":
case "cmd_nextUnreadMsg":
case "cmd_nextFlaggedMsg":
case "cmd_nextUnreadThread":
@ -199,33 +207,43 @@ var DefaultController =
case "cmd_previousFlaggedMsg":
case "cmd_viewAllMsgs":
case "cmd_viewUnreadMsgs":
case "cmd_undo":
case "cmd_redo":
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
case "cmd_undo":
case "cmd_redo":
case "cmd_expandAllThreads":
case "cmd_collapseAllThreads":
case "cmd_renameFolder":
case "cmd_openMessage":
case "button_print":
case "cmd_print":
case "cmd_saveAsFile":
case "cmd_saveAsTemplate":
case "cmd_viewPageSource":
case "cmd_setFolderCharset":
case "cmd_reload":
case "button_getNewMessages":
case "cmd_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
case "cmd_getMsgsForAuthAccounts":
case "cmd_getNextNMessages":
case "cmd_find":
case "cmd_findAgain":
case "button_mark":
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markAsFlagged":
case "button_file":
case "cmd_file":
case "cmd_emptyTrash":
case "cmd_compactFolder":
case "cmd_sortByThread":
case "cmd_downloadFlagged":
case "cmd_downloadSelected":
case "cmd_watchThread":
case "cmd_killThread":
case "cmd_toggleWorkOffline":
case "cmd_close":
return true;
default:
return false;
@ -234,8 +252,42 @@ var DefaultController =
isCommandEnabled: function(command)
{
var enabled = new Object();
enabled.value = false;
var checkStatus = new Object();
// dump('entering is command enabled for: ' + command + '\n');
switch ( command )
{
case "button_delete":
case "cmd_delete":
var uri = GetFirstSelectedMessage();
if ( GetNumSelectedMessages() < 2 )
{
if (IsNewsMessage(uri))
goSetMenuValue(command, 'valueNewsMessage');
else
goSetMenuValue(command, 'valueMessage');
}
else
{
if (IsNewsMessage(uri))
goSetMenuValue(command, 'valueNewsMessage');
else
goSetMenuValue(command, 'valueMessages');
}
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.deleteMsg, enabled, checkStatus);
return enabled.value;
case "cmd_shiftDelete":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.deleteNoTrash, enabled, checkStatus);
return enabled.value;
case "cmd_killThread":
return MailAreaHasFocus() && IsViewNavigationItemEnabled();
case "cmd_watchThread":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.toggleThreadWatched, enabled, checkStatus);
return enabled.value;
case "cmd_reply":
case "button_reply":
case "cmd_replySender":
@ -247,10 +299,8 @@ var DefaultController =
case "cmd_forwardInline":
case "cmd_forwardAttachment":
case "cmd_editAsNew":
case "cmd_delete":
case "button_delete":
case "cmd_shiftDelete":
case "cmd_openMessage":
case "button_print":
case "cmd_print":
case "cmd_saveAsFile":
case "cmd_saveAsTemplate":
@ -258,44 +308,20 @@ var DefaultController =
case "cmd_reload":
case "cmd_markThreadAsRead":
case "cmd_markAsFlagged":
case "button_file":
case "cmd_file":
return ( GetNumSelectedMessages() > 0 );
case "cmd_editDraft":
var numSelected = GetNumSelectedMessages();
if ( command == "cmd_delete")
{
var uri = GetUriForFirstSelectedMessage();
if ( numSelected < 2 ) {
if (isNewsURI(uri)) {
goSetMenuValue(command, 'valueNewsMessage');
}
else {
goSetMenuValue(command, 'valueMessage');
}
}
else {
if (isNewsURI(uri)) {
goSetMenuValue(command, 'valueNewsMessage');
return false;
}
else {
goSetMenuValue(command, 'valueMessages');
}
}
}
else if (command == "cmd_editDraft")
{
return (gIsEditableMsgFolder && numSelected > 0);
}
return ( numSelected > 0 );
return (gIsEditableMsgFolder && (GetNumSelectedMessages() > 0));
case "cmd_nextMsg":
case "button_next":
case "cmd_nextUnreadMsg":
case "cmd_nextUnreadThread":
case "cmd_previousMsg":
case "cmd_previousUnreadMsg":
return MailAreaHasFocus() && IsViewNavigationItemEnabled();
case "cmd_downloadSelected":
case "button_mark":
case "cmd_markAsRead":
if(!MailAreaHasFocus())
return false;
@ -309,25 +335,33 @@ var DefaultController =
return IsFindEnabled();
break;
case "cmd_expandAllThreads":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.expandAll, enabled, checkStatus);
return enabled.value;
break;
case "cmd_collapseAllThreads":
return messageView.showThreads;
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.collapseAll, enabled, checkStatus);
return enabled.value;
break;
case "cmd_nextFlaggedMsg":
case "cmd_previousFlaggedMsg":
return IsViewNavigationItemEnabled();
case "cmd_viewAllMsgs":
case "cmd_sortByThread":
case "cmd_viewUnreadMsgs":
return true;
break;
case "cmd_undo":
case "cmd_redo":
return SetupUndoRedoCommand(command);
case "cmd_viewUnreadMsgs":
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
return true;
case "cmd_undo":
case "cmd_redo":
return SetupUndoRedoCommand(command);
case "cmd_renameFolder":
return IsRenameFolderEnabled();
case "button_getNewMessages":
case "cmd_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
return IsGetNewMessagesEnabled();
case "cmd_getMsgsForAuthAccounts":
return IsGetNewMessagesEnabled();
case "cmd_getNextNMessages":
return IsGetNextNMessagesEnabled();
case "cmd_emptyTrash":
@ -336,6 +370,9 @@ var DefaultController =
return IsCompactFolderEnabled();
case "cmd_setFolderCharset":
return IsFolderCharsetEnabled();
case "cmd_close":
case "cmd_toggleWorkOffline":
return true;
default:
return false;
}
@ -344,17 +381,20 @@ var DefaultController =
doCommand: function(command)
{
//dump("ThreadPaneController.doCommand(" + command + ")\n");
// if the user invoked a key short cut then it is possible that we got here for a command which is
// really disabled. kick out if the command should be disabled.
if (!this.isCommandEnabled(command)) return;
switch ( command )
{
case "button_getNewMessages":
case "cmd_getNewMessages":
MsgGetMessage();
break;
case "cmd_getMsgsForAuthAccounts":
MsgGetMessage();
MsgGetMessagesForAllAuthenticatedAccounts();
break;
case "cmd_getMsgsForAuthAccounts":
MsgGetMessage();
MsgGetMessagesForAllAuthenticatedAccounts();
break;
case "cmd_getNextNMessages":
MsgGetNextNMessages();
break;
@ -382,19 +422,25 @@ var DefaultController =
case "cmd_editAsNew":
MsgEditMessageAsNew();
break;
case "button_delete":
case "cmd_delete":
MsgDeleteMessage(false, false);
SetNextMessageAfterDelete();
gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
break;
case "cmd_shiftDelete":
MsgDeleteMessage(true, false);
break;
case "button_delete":
MsgDeleteMessage(false, true);
SetNextMessageAfterDelete();
gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
break;
case "cmd_killThread":
/* kill thread kills the thread and then does a next unread */
GoNextMessage(nsMsgNavigationType.toggleThreadKilled, true);
break;
case "cmd_watchThread":
gDBView.doCommand(nsMsgViewCommandType.toggleThreadWatched);
break;
case "cmd_editDraft":
var threadTree = GetThreadTree();
if (threadTree && threadTree.selectedItems)
MsgComposeDraftMessage();
if (gDBView.numSelected >= 0)
MsgComposeDraftMessage();
break;
case "cmd_nextUnreadMsg":
MsgNextUnreadMessage();
@ -421,10 +467,10 @@ var DefaultController =
MsgSortByThread();
break;
case "cmd_viewAllMsgs":
MsgViewAllMsgs();
break;
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
case "cmd_viewUnreadMsgs":
MsgViewUnreadMsg();
SwitchView(command);
break;
case "cmd_undo":
messenger.Undo(msgWindow);
@ -433,10 +479,10 @@ var DefaultController =
messenger.Redo(msgWindow);
break;
case "cmd_expandAllThreads":
ExpandOrCollapseThreads(true);
gDBView.doCommand(nsMsgViewCommandType.expandAll);
break;
case "cmd_collapseAllThreads":
ExpandOrCollapseThreads(false);
gDBView.doCommand(nsMsgViewCommandType.collapseAll);
break;
case "cmd_renameFolder":
MsgRenameFolder();
@ -468,6 +514,7 @@ var DefaultController =
case "cmd_findAgain":
MsgFindAgain();
return;
case "button_mark":
case "cmd_markAsRead":
MsgMarkMsgAsRead(null);
return;
@ -475,7 +522,7 @@ var DefaultController =
MsgMarkThreadAsRead();
return;
case "cmd_markAllRead":
MsgMarkAllRead();
gDBView.doCommand(nsMsgViewCommandType.markAllRead);
return;
case "cmd_markAsFlagged":
MsgMarkAsFlagged(null);
@ -492,6 +539,9 @@ var DefaultController =
case "cmd_compactFolder":
MsgCompactFolder(true);
return;
case "cmd_toggleWorkOffline":
MsgToggleWorkOffline();
return;
}
},
@ -522,114 +572,58 @@ function MailAreaHasFocus()
return true;
}
function GetUriForFirstSelectedMessage()
{
try {
var threadTree = GetThreadTree();
return threadTree.selectedItems[0].getAttribute('id');
}
catch (ex) {
return null;
}
}
function GetNumSelectedMessages()
{
var threadTree = GetThreadTree();
var numSelected = 0;
if ( threadTree && threadTree.selectedItems )
numSelected = threadTree.selectedItems.length;
return numSelected;
try {
return gDBView.numSelected;
}
catch (ex) {
return 0;
}
}
function CommandUpdate_Mail()
{
goUpdateCommand('button_delete');
goUpdateCommand('cmd_delete');
goUpdateCommand('cmd_editDraft');
goUpdateCommand('cmd_nextMsg');
goUpdateCommand('cmd_nextUnreadMsg');
goUpdateCommand('cmd_nextUnreadThread');
goUpdateCommand('cmd_nextFlaggedMsg');
goUpdateCommand('cmd_previousMsg');
goUpdateCommand('cmd_previousUnreadMsg');
goUpdateCommand('cmd_previousFlaggedMsg');
goUpdateCommand('cmd_sortByThread');
goUpdateCommand('cmd_viewAllMsgs');
goUpdateCommand('cmd_viewUnreadMsgs');
goUpdateCommand('cmd_expandAllThreads');
goUpdateCommand('cmd_collapseAllThreads');
goUpdateCommand('cmd_renameFolder');
goUpdateCommand('cmd_setFolderCharset');
goUpdateCommand('cmd_getNewMessages');
goUpdateCommand('cmd_getMsgsForAuthAccounts');
goUpdateCommand('cmd_getNextNMessages');
goUpdateCommand('cmd_find');
goUpdateCommand('cmd_findAgain');
goUpdateCommand('cmd_markAllRead');
goUpdateCommand('cmd_emptyTrash');
goUpdateCommand('cmd_compactFolder');
}
var lastFocusedElement=null;
function FocusRingUpdate_Mail(){
var currentFocusedElement = WhichPaneHasFocus();
if (!currentFocusedElement)
currentFocusedElement = GetMessagePane();
function FocusRingUpdate_Mail()
{
//dump ('entering focus ring update\n');
var currentFocusedElement = WhichPaneHasFocus();
if (!currentFocusedElement)
{
// dump ('setting default focus to message pane');
currentFocusedElement = GetMessagePane();
}
if(currentFocusedElement != lastFocusedElement) {
if( currentFocusedElement == GetThreadTree()) {
GetThreadTree().setAttribute("focusring","true");
if( currentFocusedElement == GetThreadOutliner()) {
// XXX fix me
GetThreadOutliner().setAttribute("focusring","true");
GetMessagePane().setAttribute("focusring","false");
}
else if(currentFocusedElement==GetFolderTree()) {
GetThreadTree().setAttribute("focusring","false");
// XXX fix me
GetThreadOutliner().setAttribute("focusring","false");
GetMessagePane().setAttribute("focusring","false");
}
else if(currentFocusedElement==GetMessagePane()){
GetThreadTree().setAttribute("focusring","false");
// mscott --> fix me!!
GetThreadOutliner().setAttribute("focusring","false");
GetMessagePane().setAttribute("focusring","true");
}
else {
GetThreadTree().setAttribute("focusring","false");
// XXX fix me
GetThreadOutliner().setAttribute("focusring","false");
GetMessagePane().setAttribute("focusring","false");
}
lastFocusedElement=currentFocusedElement;
}
}
function ThreadTreeUpdate_Mail(command)
{
goUpdateCommand('button_reply');
goUpdateCommand('button_replyall');
goUpdateCommand('button_forward');
goUpdateCommand('cmd_shiftDelete');
goUpdateCommand('cmd_reply');
goUpdateCommand('cmd_replySender');
goUpdateCommand('cmd_replyGroup');
goUpdateCommand('cmd_replyall');
goUpdateCommand('cmd_forward');
goUpdateCommand('cmd_forwardInline');
goUpdateCommand('cmd_forwardAttachment');
goUpdateCommand('cmd_editAsNew');
goUpdateCommand('cmd_openMessage');
goUpdateCommand('cmd_print');
goUpdateCommand('cmd_saveAsFile');
goUpdateCommand('cmd_saveAsTemplate');
goUpdateCommand('cmd_viewPageSource');
goUpdateCommand('cmd_reload');
goUpdateCommand('cmd_markAsRead');
goUpdateCommand('cmd_markThreadAsRead');
goUpdateCommand('cmd_markAsFlagged');
goUpdateCommand('cmd_downloadSelected');
goUpdateCommand('cmd_downloadFlagged');
goUpdateCommand('cmd_file');
// since we just changed the pane with focus we need to update the toolbar to reflect this
document.commandDispatcher.updateCommands('mail-toolbar');
}
// else
// dump('current focused element matched last focused element\n');
}
function SetupUndoRedoCommand(command)
@ -688,14 +682,22 @@ function CommandUpdate_UndoRedo()
function MessagePaneHasFocus()
{
// message pane has focus if the iframe has focus OR if the message pane box
// has focus....
// first, check to see if the message pane box has focus...if it does, return true
var messagePane = GetMessagePane();
if (WhichPaneHasFocus() == messagePane)
return true;
// second, check to see if the iframe has focus...if it does, return true....
// check to see if the iframe has focus...
var focusedWindow = top.document.commandDispatcher.focusedWindow;
var messagePaneWindow = top.frames['messagepane'];
if ( focusedWindow && messagePaneWindow && (focusedWindow != top) )
{
{
var hasFocus = IsSubWindowOf(focusedWindow, messagePaneWindow);
return hasFocus;
}
@ -721,9 +723,9 @@ function WhichPaneHasFocus(){
var whichPane= null;
var currentNode = top.document.commandDispatcher.focusedElement;
var threadTree = GetThreadTree();
var folderTree = GetFolderTree();
var messagePane = GetMessagePane();
var threadTree = GetThreadOutliner();
var folderTree = GetFolderTree();
var messagePane = GetMessagePane();
while (currentNode) {
if (currentNode === threadTree ||
@ -737,10 +739,6 @@ function WhichPaneHasFocus(){
return null;
}
function SetupCommandUpdateHandlers()
{
//dump("SetupCommandUpdateHandlers\n");
@ -753,9 +751,9 @@ function SetupCommandUpdateHandlers()
widget.controllers.appendController(FolderPaneController);
// thread pane
widget = GetThreadTree();
widget = GetThreadOutliner();
if ( widget )
widget.controllers.appendController(ThreadPaneController);
widget.controllers.appendController(ThreadPaneController);
top.controllers.insertControllerAt(0, DefaultController);
}
@ -801,8 +799,7 @@ function IsFolderSelected()
function IsFindEnabled()
{
return (!IsThreadAndMessagePaneSplitterCollapsed() && (gCurrentDisplayedMessage != null));
return (!IsThreadAndMessagePaneSplitterCollapsed() && (GetNumSelectedMessages() > 0));
}
function MsgDeleteFolder()
@ -839,77 +836,55 @@ function MsgDeleteFolder()
}
//3pane related commands. Need to go in own file. Putting here for the moment.
// 3pane related commands. Need to go in own file. Putting here for the moment.
function MsgNextMessage()
{
GoNextMessage(navigateAny, false );
GoNextMessage(nsMsgNavigationType.nextMessage, false );
}
function MsgNextUnreadMessage()
{
GoNextMessage(navigateUnread, true);
GoNextMessage(nsMsgNavigationType.nextUnreadMessage, true);
}
function MsgNextFlaggedMessage()
{
GoNextMessage(navigateFlagged, true);
GoNextMessage(nsMsgNavigationType.nextFlagged, true);
}
function MsgNextUnreadThread()
{
//First mark the current thread as read. Then go to the next one.
MsgMarkThreadAsRead();
GoNextThread(navigateUnread, true, true);
GoNextMessage(nsMsgNavigationType.nextUnreadThread, true);
}
function MsgPreviousMessage()
{
GoPreviousMessage(navigateAny, false);
GoNextMessage(nsMsgNavigationType.previousMessage, false);
}
function MsgPreviousUnreadMessage()
{
GoPreviousMessage(navigateUnread, true);
GoNextMessage(nsMsgNavigationType.previousUnreadMessage, true);
}
function MsgPreviousFlaggedMessage()
{
GoPreviousMessage(navigateFlagged, true);
GoNextMessage(nsMsgNavigationType.previousFlagged, true);
}
var nsMsgViewType = Components.interfaces.nsMsgViewType;
function MsgViewAllMsgs()
{
//dump("MsgViewAllMsgs\n");
if(messageView)
if(gDBView)
{
messageView.viewType = nsMsgViewType.eShowAll;
gDBView.viewType = nsMsgViewType.eShowAllThreads;
var folder = GetSelectedFolder();
if(folder) {
folder.setAttribute("viewType", messageView.viewType);
folder.setAttribute("viewType", nsMsgViewType.eShowAllThreads);
}
}
RefreshThreadTreeView();
}
function MsgViewUnreadMsg()
{
//dump("MsgViewUnreadMsgs\n");
if(messageView)
{
messageView.viewType = nsMsgViewType.eShowUnread;
var folder = GetSelectedFolder();
if(folder) {
folder.setAttribute("viewType", messageView.viewType);
}
}
RefreshThreadTreeView();
}
@ -961,34 +936,13 @@ function GetFolderNameFromUri(uri, tree)
return nameResult.Value;
}
//Sets the thread tree's template's treeitem to be open so that all threads are expanded.
function ExpandOrCollapseThreads(expand)
{
SetTemplateTreeItemOpen(expand);
RefreshThreadTreeView();
}
function SetTemplateTreeItemOpen(open)
{
var templateTreeItem = document.getElementById("threadTreeTemplateTreeItem");
if(templateTreeItem)
{
if(open)
templateTreeItem.setAttribute("open", "true");
else
templateTreeItem.removeAttribute("open");
}
}
function SwitchPaneFocus(direction)
{
var gray_vertical_splitter = document.getElementById("gray_vertical_splitter");
var focusedElement = document.commandDispatcher.focusedElement;
var focusedElementId;
if (direction == "counter-clockwise")
var gray_vertical_splitter = document.getElementById("gray_vertical_splitter");
var focusedElement = document.commandDispatcher.focusedElement;
var focusedElementId;
if (direction == "counter-clockwise")
{
if ( MessagePaneHasFocus() )
SetFocusThreadPane();
else
@ -996,21 +950,21 @@ function SwitchPaneFocus(direction)
try
{
focusedElementId = focusedElement.getAttribute('id');
if(focusedElementId == "threadTree")
if(focusedElementId == "threadOutliner")
{
if (gray_vertical_splitter)
{
if (!(is_collapsed(gray_vertical_splitter)))
SetFocusFolderPane();
SetFocusFolderPane();
else if(!(IsThreadAndMessagePaneSplitterCollapsed()))
SetFocusMessagePane();
SetFocusMessagePane();
}
else
{
if (!(sidebar_is_collapsed()))
SetFocusFolderPane();
SetFocusFolderPane();
else if(!(IsThreadAndMessagePaneSplitterCollapsed()))
SetFocusMessagePane();
SetFocusMessagePane();
}
}
else if(focusedElementId == "folderTree")
@ -1042,9 +996,9 @@ function SwitchPaneFocus(direction)
else
{
if (!(sidebar_is_collapsed()))
SetFocusFolderPane();
SetFocusFolderPane();
else
SetFocusThreadPane();
SetFocusThreadPane();
}
}
else
@ -1052,7 +1006,7 @@ function SwitchPaneFocus(direction)
try
{
focusedElementId = focusedElement.getAttribute('id');
if(focusedElementId == "threadTree")
if(focusedElementId == "threadOutliner")
{
if (!(IsThreadAndMessagePaneSplitterCollapsed()))
SetFocusMessagePane();
@ -1079,27 +1033,27 @@ function SwitchPaneFocus(direction)
function SetFocusFolderPane()
{
var folderTree = GetFolderTree();
folderTree.focus();
var folderTree = GetFolderTree();
folderTree.focus();
return;
}
function SetFocusThreadPane()
{
var threadTree = GetThreadTree();
threadTree.focus();
var threadTree = GetThreadOutliner();
threadTree.focus();
return;
}
function SetFocusMessagePane()
{
var messagePaneFrame = GetMessagePaneFrame();
messagePaneFrame.focus();
var messagePaneFrame = GetMessagePane();
messagePaneFrame.focus();
return;
}
function is_collapsed(element)
{
return (element.getAttribute('state') == 'collapsed');
return (element.getAttribute('state') == 'collapsed');
}

Просмотреть файл

@ -73,23 +73,21 @@ Rights Reserved.
<commands id="commands">
<commandset id="CommandUpdate_Mail"
commandupdater="true"
events="focus,folderTree-select,threadTree-select"
oncommandupdate="CommandUpdate_Mail()"/>
<commandset id="ThreadTreeUpdate_Mail"
commandupdater="true"
events="threadTree-select"
oncommandupdate="ThreadTreeUpdate_Mail()"/>
<commandset id="mailFileMenuItems"/>
<commandset id="mailViewMenuItems"/>
<commandset id="mailEditMenuItems"/>
<commandset id="mailSearchMenuItems"/>
<commandset id="mailGoMenuItems"/>
<commandset id="mailMessageMenuItems"/>
<commandset id="mailToolbarItems"/>
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
<commandset id="FocusRingUpdate_Mail"
commandupdater="true"
events="focus"
oncommandupdate="FocusRingUpdate_Mail()"/>
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="undoEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
oncommandupdate="FocusRingUpdate_Mail()"/>
</commands>
<broadcasterset id="broadcasterset"/>
@ -134,35 +132,21 @@ Rights Reserved.
<box orient="vertical" flex="1">
<box align ="horizontal" persist="height" flex="1">
<box flex="1">
<tree id="folderTree"
style="width:0px;"
context="folderPaneContext"
persist="collapsed width"/>
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
<box id="threadpaneBox" flex="2">
<tree id="threadTree"
flex="1"
persist="width"
style="width:0px"
context="threadPaneContext"
class="window-focusborder"
focusring="false"/>
</box>
<box id="accountCentralBox" flex="2">
<iframe name="accountCentralPane"
style="width:0px;"
flex="1"
src="about:blank"/>
</box>
</box>
</box>
<box flex="1">
<tree id="folderTree" flex="1" style="width:0px;" context="folderPaneContext" persist="collapsed width" />
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
<box id="threadpaneBox" flex="2">
<outliner id="threadOutliner" flex="2" persist="width" style="width:0px" context="threadPaneContext" class="window-focusborder" focusring="false"/>
</box>
<box id="accountCentralBox" flex="2">
<iframe name="accountCentralPane" style="width:0px;" flex="1" src="about:blank"/>
</box>
</box>
</box>
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
<splitter id="threadpane-splitter" collapse="after" persist="state"
onclick="OnClickThreadAndMessagePaneSplitter()" orient="vertical" autostretch="never">
<grippy/>
onclick="OnClickThreadAndMessagePaneSplitter()" orient="vertical" autostretch="never">
<grippy/>
</splitter>
<!-- msg header view -->
<box id="messagepanebox" orient="vertical" flex="4" persist="collapsed height" class="window-focusborder" focusring="false">

Просмотреть файл

@ -44,38 +44,24 @@ function GetResourceFromUri(uri)
function DoRDFCommand(dataSource, command, srcArray, argumentArray)
{
var commandResource = RDF.GetResource(command);
if(commandResource)
try {
if(commandResource) {
try {
dataSource.DoCommand(srcArray, commandResource, argumentArray);
}
catch(e)
{
if ( command == "http://home.netscape.com/NC-rdf#ReallyDelete" || command == "http://home.netscape.com/NC-rdf#Delete" || command == "http://home.netscape.com/NC-rdf#Move" ) {
gNextMessageAfterDelete =null;
}
if (command == "http://home.netscape.com/NC-rdf#NewFolder")
throw(e); //so that the dialog does not automatically close.
dump (" Exception : In mail commands\n");
}
}
catch(e) {
if (command == "http://home.netscape.com/NC-rdf#NewFolder") {
throw(e); // so that the dialog does not automatically close.
}
dump("Exception : In mail commands\n");
}
}
}
//Converts an array of messages into an nsISupportsArray of resources.
//messages: array of messages that needs to be converted
//resourceArray: nsISupportsArray in which the resources should be put. If it's null a new one will be created.
//returns the resource array
function ConvertMessagesToResourceArray(messages, resourceArray)
{
if(!resourceArray)
resourceArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
for (var i=0; i<messages.length; i++) {
var messageResource = messages[i].QueryInterface(Components.interfaces.nsIRDFResource);
resourceArray.AppendElement(messageResource);
}
return resourceArray;
dump("fix or remove this\n");
// going away...
}
function GetNewMessages(selectedFolders, compositeDataSource)
@ -111,47 +97,14 @@ function GetNewMessages(selectedFolders, compositeDataSource)
function DeleteMessages(compositeDataSource, srcFolder, messages, reallyDelete)
{
var srcFolderResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
folderArray.AppendElement(srcFolderResource);
var argumentArray = ConvertMessagesToResourceArray(messages, null);
var command;
if(reallyDelete)
command = "http://home.netscape.com/NC-rdf#ReallyDelete"
else
command = "http://home.netscape.com/NC-rdf#Delete"
DoRDFCommand(compositeDataSource, command, folderArray, argumentArray);
dump("fix or remove this\n");
// going away...
}
function CopyMessages(compositeDataSource, srcFolder, destFolder, messages, isMove)
{
if(compositeDataSource)
{
var destFolderResource = destFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
folderArray.AppendElement(destFolderResource);
var argumentArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
var srcFolderResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
argumentArray.AppendElement(srcFolderResource);
ConvertMessagesToResourceArray(messages, argumentArray);
var command;
if(isMove)
command = "http://home.netscape.com/NC-rdf#Move"
else
command = "http://home.netscape.com/NC-rdf#Copy";
DoRDFCommand(compositeDataSource, command, folderArray, argumentArray);
}
dump("fix or remove this\n");
// going away...
}
function getIdentityForServer(server)
@ -172,12 +125,10 @@ function getIdentityForServer(server)
function SendUnsentMessages(folder)
{
if(folder)
{
if(folder) {
var identity = getIdentityForServer(folder.server);
messenger.SendUnsentMessages(identity);
}
}
function GetNextNMessages(folder)
@ -190,14 +141,15 @@ function GetNextNMessages(folder)
}
}
function ComposeMessage(type, format, folder, messageArray) //type is a nsIMsgCompType and format is a nsIMsgCompFormat
// type is a nsIMsgCompType and format is a nsIMsgCompFormat
function ComposeMessage(type, format, folder, messageArray)
{
var msgComposeType = Components.interfaces.nsIMsgCompType;
var identity = null;
var newsgroup = null;
var server;
dump("ComposeMessage folder="+folder+"\n");
//dump("ComposeMessage folder="+folder+"\n");
try
{
if(folder)
@ -220,17 +172,14 @@ function GetNextNMessages(folder)
}
identity = getIdentityForServer(server);
// dump("identity = " + identity + "\n");
}
}
catch (ex)
{
dump("failed to get an identity to pre-select: " + ex + "\n");
}
dump("\nComposeMessage from XUL: " + identity + "\n");
//dump("\nComposeMessage from XUL: " + identity + "\n");
var uri = null;
if (! msgComposeService)
@ -245,9 +194,9 @@ function GetNextNMessages(folder)
msgComposeService.OpenComposeWindow(null, null, type, format, identity);
return;
}
else if (type == msgComposeType.NewsPost)
else if (type == msgComposeType.NewsPost)
{
dump("OpenComposeWindow with " + identity + " and " + newsgroup + "\n");
//dump("OpenComposeWindow with " + identity + " and " + newsgroup + "\n");
msgComposeService.OpenComposeWindow(null, newsgroup, type, format, identity);
return;
}
@ -261,11 +210,10 @@ function GetNextNMessages(folder)
uri = "";
for (var i = 0; i < messageArray.length && i < 8; i ++)
{
var messageResource = messageArray[i].QueryInterface(Components.interfaces.nsIRDFResource);
var messageUri = messageResource.Value;
dump('i = '+ i);
dump('\n');
var messageUri = messageArray[i];
//dump("XXX messageUri in ComposeMessage = " + messageUri + "\n");
//dump('i = '+ i);
//dump('\n');
if (type == msgComposeType.Reply || type == msgComposeType.ReplyAll || type == msgComposeType.ForwardInline ||
type == msgComposeType.ReplyToGroup || type == msgComposeType.ReplyToSender ||
type == msgComposeType.ReplyToSenderAndGroup ||
@ -397,111 +345,59 @@ function SubscribeOKCallback(changeTable)
}
}
function SaveAsFile(message)
function SaveAsFile(uri)
{
var messageResource = message.QueryInterface(Components.interfaces.nsIRDFResource);
var uri = messageResource.Value;
//dump (uri);
if (uri)
messenger.saveAs(uri, true, null, msgWindow);
if (uri) messenger.saveAs(uri, true, null, msgWindow);
}
function SaveAsTemplate(message, folder)
function SaveAsTemplate(uri, folder)
{
var messageResource = message.QueryInterface(Components.interfaces.nsIRDFResource);
var uri = messageResource.Value;
// dump (uri);
if (uri)
{
if (uri) {
var identity = getIdentityForServer(folder.server);
messenger.saveAs(uri, false, identity, msgWindow);
}
}
function MarkMessagesRead(compositeDataSource, messages, markRead)
function MarkSelectedMessagesRead(markRead)
{
var messageResourceArray = ConvertMessagesToResourceArray(messages, null);
var command;
if(markRead)
command = "http://home.netscape.com/NC-rdf#MarkRead";
else
command = "http://home.netscape.com/NC-rdf#MarkUnread";
DoRDFCommand(compositeDataSource, command, messageResourceArray, null);
if (markRead) {
gDBView.doCommand(nsMsgViewCommandType.markMessagesRead);
}
else {
gDBView.doCommand(nsMsgViewCommandType.markMessagesUnread);
}
}
function MarkMessagesFlagged(compositeDataSource, messages, markFlagged)
function MarkSelectedMessagesFlagged(markFlagged)
{
var messageResourceArray = ConvertMessagesToResourceArray(messages, null);
var command;
if(markFlagged)
command = "http://home.netscape.com/NC-rdf#MarkFlagged";
else
command = "http://home.netscape.com/NC-rdf#MarkUnflagged";
DoRDFCommand(compositeDataSource, command, messageResourceArray, null);
if (markFlagged) {
gDBView.doCommand(nsMsgViewCommandType.flagMessages);
}
else {
gDBView.doCommand(nsMsgViewCommandType.unflagMessages);
}
}
function MarkAllMessagesRead(compositeDataSource, folder)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderResourceArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
folderResourceArray.AppendElement(folderResource);
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#MarkAllMessagesRead", folderResourceArray, null);
dump("fix MarkAllMessagesRead()\n");
}
function DownloadFlaggedMessages(compositeDataSource, folder)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderResourceArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
folderResourceArray.AppendElement(folderResource);
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#DownloadFlaggedMessages", folderResourceArray, null);
dump("fix DownloadFlaggedMessages()\n");
}
function DownloadSelectedMessages(compositeDataSource, messages, markFlagged)
{
var messageResourceArray = ConvertMessagesToResourceArray(messages, null);
var command = "http://home.netscape.com/NC-rdf#DownloadSelectedMessages";
DoRDFCommand(compositeDataSource, command, messageResourceArray, null);
dump("fix DownloadSelectedMessages()\n");
}
function MarkThreadAsRead(compositeDataSource, message)
{
if(message)
{
var folder = message.msgFolder
if(folder)
{
var thread = folder.getThreadForMessage(message);
if(thread)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderResourceArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
folderResourceArray.AppendElement(folderResource);
var argumentArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
argumentArray.AppendElement(thread);
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#MarkThreadRead", folderResourceArray, argumentArray);
}
}
}
gDBView.doCommand(nsMsgViewCommandType.markThreadRead);
}
function ViewPageSource(messages)
{
var url;
@ -527,14 +423,16 @@ function ViewPageSource(messages)
for(var i = 0; i < numMessages; i++)
{
var messageResource = messages[i].QueryInterface(Components.interfaces.nsIRDFResource);
uri = messageResource.Value;
uri = messages[i];
// Now, we need to get a URL from a URI
url = mailSession.ConvertMsgURIToMsgURL(uri, msgWindow);
if (url)
if (url) {
// XXX what if there already is a "?", like "?part=0"
// XXX shouldn't this be "&header=src" in that case?
url += "?header=src";
}
// Use a browser window to view source
window.openDialog( getBrowserURL(),
"_blank",

Просмотреть файл

@ -24,17 +24,14 @@
function fillThreadPaneContextMenu()
{
var selectedMessages = GetSelectedMessages();
var numSelected = selectedMessages ? selectedMessages.length : 0;
var numSelected = GetNumSelectedMessages();
var isNewsgroup = false;
var selectedMessage = null;
if(numSelected >= 0)
{
selectedMessage = selectedMessages[0];
if (selectedMessage) {
isNewsgroup = GetMessageType(selectedMessage) == "news";
}
if(numSelected >= 0) {
selectedMessage = GetFirstSelectedMessage();
isNewsgroup = IsNewsMessage(selectedMessage);
}
@ -331,8 +328,9 @@ function fillMessagePaneContextMenu(contextMenu)
var isNewsgroup = false;
if ((numSelected == 1) && message)
isNewsgroup = GetMessageType(message) == "news";
if (numSelected == 1) {
isNewsgroup = IsNewsMessage(message);
}
var hideMailItems = AreBrowserItemsShowing();

Просмотреть файл

@ -280,8 +280,8 @@
</xul:menulist>
<xul:menulist flex="1" class="search-value-menulist">
<xul:menupopup class="search-value-popup">
<xul:menuitem data="1" stringTag="replied" class="search-value-menuitem"/>
<xul:menuitem data ="2" stringTag="read" class="search-value-menuitem"/>
<xul:menuitem data="2" stringTag="replied" class="search-value-menuitem"/>
<xul:menuitem data ="1" stringTag="read" class="search-value-menuitem"/>
<xul:menuitem data ="1048576" stringTag="new" class="search-value-menuitem"/>
<xul:menuitem data ="65536" stringTag="forwarded" class="search-value-menuitem"/>
</xul:menupopup>

Просмотреть файл

@ -21,7 +21,6 @@
//This file stores variables common to mail windows
var messengerContractID = "@mozilla.org/messenger;1";
var statusFeedbackContractID = "@mozilla.org/messenger/statusfeedback;1";
var messageViewContractID = "@mozilla.org/messenger/messageview;1";
var mailSessionContractID = "@mozilla.org/messenger/services/session;1";
var secureUIContractID = "@mozilla.org/secure_browser_ui;1";
@ -32,7 +31,6 @@ var msgWindowContractID = "@mozilla.org/messenger/msgwindow;1";
var messenger;
var pref;
var statusFeedback;
var messageView;
var msgWindow;
var msgComposeService;
@ -53,7 +51,6 @@ var messageDSContractID = datasourceContractIDPrefix + "mailnewsmessages"
var accountManagerDataSource;
var folderDataSource;
var messageDataSource;
var messagesBox = null;
var accountCentralBox = null;
@ -83,14 +80,11 @@ function OnMailWindowUnload()
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = null;
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = null;
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = null;
msgWindow.closeWindow();
msgWindow.closeWindow();
}
@ -131,9 +125,6 @@ function CreateMailWindowGlobals()
}
window.MsgWindowCommands = new nsMsgWindowCommands();
//Create message view object
messageView = Components.classes[messageViewContractID].createInstance();
messageView = messageView.QueryInterface(Components.interfaces.nsIMessageView);
//Create message window object
msgWindow = Components.classes[msgWindowContractID].createInstance();
@ -158,17 +149,15 @@ function CreateMailWindowGlobals()
//Create datasources
accountManagerDataSource = Components.classes[accountManagerDSContractID].createInstance();
folderDataSource = Components.classes[folderDSContractID].createInstance();
messageDataSource = Components.classes[messageDSContractID].createInstance();
messagesBox = document.getElementById("messagesBox");
accountCentralBox = document.getElementById("accountCentralBox");
gPaneConfig = pref.GetIntPref("mail.pane_config");
messagesBox = document.getElementById("messagesBox");
accountCentralBox = document.getElementById("accountCentralBox");
gPaneConfig = pref.GetIntPref("mail.pane_config");
}
function InitMsgWindow()
{
msgWindow.statusFeedback = statusFeedback;
msgWindow.messageView = messageView;
msgWindow.msgHeaderSink = messageHeaderSink;
msgWindow.SetDOMWindow(window);
mailSession.AddMsgWindow(msgWindow);
@ -198,9 +187,6 @@ function AddDataSources()
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = msgWindow;
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = msgWindow;
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
msgDS.window = msgWindow;
@ -250,8 +236,8 @@ nsMsgStatusFeedback.prototype =
if (!this.statusTextFld ) this.statusTextFld = document.getElementById("statusText");
if (!this.statusBar) this.statusBar = document.getElementById("statusbar-icon");
if(!this.throbber) this.throbber = document.getElementById("navigator-throbber");
if(!this.stopButton) this.stopButton = document.getElementById("button-stop");
if(!this.stopMenu) this.stopMenu = document.getElementById("stopMenuitem");
if(!this.stopButton) this.stopButton = document.getElementById("button-stop");
if(!this.stopMenu) this.stopMenu = document.getElementById("stopMenuitem");
},
// nsIXULBrowserWindow implementation
@ -453,20 +439,20 @@ function ShowAccountCentral()
switch (gPaneConfig)
{
case 0:
messagesBox.setAttribute("hidden", "true");
accountCentralBox.removeAttribute("hidden");
messagesBox.setAttribute("collapsed", "true");
accountCentralBox.removeAttribute("collapsed");
window.frames["accountCentralPane"].location = acctCentralPage;
gAccountCentralLoaded = true;
break;
case 1:
var messagePaneBox = document.getElementById("messagepanebox");
messagePaneBox.setAttribute("hidden", "true");
messagePaneBox.setAttribute("collapsed", "true");
var threadPaneBox = document.getElementById("threadpaneBox");
threadPaneBox.setAttribute("hidden", "true");
threadPaneBox.setAttribute("collapsed", "true");
var threadPaneSplitter = document.getElementById("threadpane-splitter");
threadPaneSplitter.setAttribute("hidden", "true");
accountCentralBox.removeAttribute("hidden");
threadPaneSplitter.setAttribute("collapsed", "true");
accountCentralBox.removeAttribute("collapsed");
window.frames["accountCentralPane"].location = acctCentralPage;
gAccountCentralLoaded = true;
break;
@ -489,19 +475,19 @@ function HideAccountCentral()
switch (gPaneConfig)
{
case 0:
accountCentralBox.setAttribute("hidden", "true");
messagesBox.removeAttribute("hidden");
accountCentralBox.setAttribute("collapsed", "true");
messagesBox.removeAttribute("collapsed");
gAccountCentralLoaded = false;
break;
case 1:
accountCentralBox.setAttribute("hidden", "true");
accountCentralBox.setAttribute("collapsed", "true");
var messagePaneBox = document.getElementById("messagepanebox");
messagePaneBox.removeAttribute("hidden");
messagePaneBox.removeAttribute("collapsed");
var threadPaneBox = document.getElementById("threadpaneBox");
threadPaneBox.removeAttribute("hidden");
threadPaneBox.removeAttribute("collapsed");
var threadPaneSplitter = document.getElementById("threadpane-splitter");
threadPaneSplitter.removeAttribute("hidden");
threadPaneSplitter.removeAttribute("collapsed");
gAccountCentralLoaded = false;
break;
}

Просмотреть файл

@ -23,6 +23,20 @@
var gMessengerBundle;
function goUpdateMailMenuItems(commandset)
{
// dump("Updating commands for " + commandset.id + "\n");
for (var i = 0; i < commandset.childNodes.length; i++)
{
var commandID = commandset.childNodes[i].getAttribute("id");
if (commandID)
{
goUpdateCommand(commandID);
}
}
}
function file_init()
{
if (!gMessengerBundle)
@ -32,6 +46,8 @@ function file_init()
but if you return false to oncreate then
the popup menu will not display which is not a good thing.
*/
document.commandDispatcher.updateCommands('create-menu-file');
}
function file_attachments()
@ -55,86 +71,126 @@ function file_attachments()
return true;
}
function InitEditMessagesMenu()
{
document.commandDispatcher.updateCommands('create-menu-edit');
}
function InitSearchMessagesMenu()
{
document.commandDispatcher.updateCommands('create-menu-search');
}
function InitGoMessagesMenu()
{
document.commandDispatcher.updateCommands('create-menu-go');
}
function view_init()
{
if (!gMessengerBundle)
gMessengerBundle = document.getElementById("bundle_messenger");
var message_menuitem=document.getElementById('menu_showMessage');
if (!gMessengerBundle)
gMessengerBundle = document.getElementById("bundle_messenger");
var message_menuitem=document.getElementById('menu_showMessage');
if (message_menuitem)
{
var message_menuitem_hidden = message_menuitem.getAttribute("hidden");
if(message_menuitem_hidden != "true"){
message_menuitem.setAttribute('checked',!IsThreadAndMessagePaneSplitterCollapsed());
}
}
var threadColumn = document.getElementById('ThreadColumnHeader');
var thread_menuitem=document.getElementById('menu_showThreads');
if (threadColumn && thread_menuitem){
thread_menuitem.setAttribute('checked',threadColumn.getAttribute('currentView')=='threaded');
}
if (message_menuitem)
{
var message_menuitem_hidden = message_menuitem.getAttribute("hidden");
if(message_menuitem_hidden != "true"){
message_menuitem.setAttribute('checked',!IsThreadAndMessagePaneSplitterCollapsed());
}
}
var threadColumn = document.getElementById('ThreadColumnHeader');
var thread_menuitem=document.getElementById('menu_showThreads');
if (threadColumn && thread_menuitem){
thread_menuitem.setAttribute('checked',threadColumn.getAttribute('currentView')=='threaded');
}
document.commandDispatcher.updateCommands('create-menu-view');
}
function InitViewMessagesMenu()
{
var allMenuItem = document.getElementById("viewAllMessagesMenuItem");
var hidden = allMenuItem.getAttribute("hidden") == "true";
if(allMenuItem && !hidden)
allMenuItem.setAttribute("checked", messageView.viewType == nsMsgViewType.eShowAll);
dump("init view messages\n");
var unreadMenuItem = document.getElementById("viewUnreadMessagesMenuItem");
hidden = unreadMenuItem.getAttribute("hidden") == "true";
if(unreadMenuItem && !hidden)
unreadMenuItem.setAttribute("checked", messageView.viewType == nsMsgViewType.eShowUnread);
var allMenuItem = document.getElementById("viewAllMessagesMenuItem");
var viewFlags = gDBView.viewFlags;
var viewType = gDBView.viewType;
if(allMenuItem)
allMenuItem.setAttribute("checked", (viewFlags & nsMsgViewFlagsType.kUnreadOnly) == 0 && (viewType == nsMsgViewType.eShowAllThreads));
var unreadMenuItem = document.getElementById("viewUnreadMessagesMenuItem");
if(unreadMenuItem)
unreadMenuItem.setAttribute("checked", (viewFlags & nsMsgViewFlagsType.kUnreadOnly) != 0);
var theadedMenuItem = document.getElementById("menu_showThreads");
if (theadedMenuItem)
theadedMenuItem.setAttribute("checked", (viewFlags & nsMsgViewFlagsType.kThreadedDisplay) != 0);
document.commandDispatcher.updateCommands('create-menu-view');
var theadsWithUnreadMenuItem = document.getElementById("viewThreadsWithUnreadMenuItem");
if(theadsWithUnreadMenuItem)
theadsWithUnreadMenuItem.setAttribute("checked", viewType == nsMsgViewType.eShowThreadsWithUnread);
var watchedTheadsWithUnreadMenuItem = document.getElementById("viewWatchedThreadsWithUnreadMenuItem");
if(watchedTheadsWithUnreadMenuItem)
watchedTheadsWithUnreadMenuItem.setAttribute("checked", viewType == nsMsgViewType.eShowWatchedThreadsWithUnread);
}
function InitMessageMenu()
{
var aMessage = GetSelectedMessage(0);
var isNews = false;
if(aMessage)
{
isNews = GetMessageType(aMessage) == "news";
}
var aMessage = GetFirstSelectedMessage();
var isNews = false;
if(aMessage) {
isNews = IsNewsMessage(aMessage);
}
//We show reply to Newsgroups only for news messages.
var replyNewsgroupMenuItem = document.getElementById("replyNewsgroupMainMenu");
if(replyNewsgroupMenuItem)
{
replyNewsgroupMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
//We show reply to Newsgroups only for news messages.
var replyNewsgroupMenuItem = document.getElementById("replyNewsgroupMainMenu");
if(replyNewsgroupMenuItem)
{
replyNewsgroupMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
//For mail messages we say reply. For news we say ReplyToSender.
var replyMenuItem = document.getElementById("replyMainMenu");
if(replyMenuItem)
{
replyMenuItem.setAttribute("hidden", !isNews ? "" : "true");
}
//For mail messages we say reply. For news we say ReplyToSender.
var replyMenuItem = document.getElementById("replyMainMenu");
if(replyMenuItem)
{
replyMenuItem.setAttribute("hidden", !isNews ? "" : "true");
}
var replySenderMenuItem = document.getElementById("replySenderMainMenu");
if(replySenderMenuItem)
{
replySenderMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
var replySenderMenuItem = document.getElementById("replySenderMainMenu");
if(replySenderMenuItem)
{
replySenderMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
//disable the move and copy menus only if there are no messages selected.
var moveMenu = document.getElementById("moveMenu");
if(moveMenu)
moveMenu.setAttribute("disabled", !aMessage);
// we only kill and watch threads for news
var killThreadMenuItem = document.getElementById("killThread");
if (killThreadMenuItem) {
killThreadMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
var watchThreadMenuItem = document.getElementById("watchThread");
if (watchThreadMenuItem) {
watchThreadMenuItem.setAttribute("hidden", isNews ? "" : "true");
}
var copyMenu = document.getElementById("copyMenu");
if(copyMenu)
copyMenu.setAttribute("disabled", !aMessage);
//disable the move and copy menus only if there are no messages selected.
var moveMenu = document.getElementById("moveMenu");
if(moveMenu)
moveMenu.setAttribute("disabled", !aMessage);
var copyMenu = document.getElementById("copyMenu");
if(copyMenu)
copyMenu.setAttribute("disabled", !aMessage);
document.commandDispatcher.updateCommands('create-menu-message');
}
function GetMessageType(message)
function IsNewsMessage(messageUri)
{
var compositeDS = GetCompositeDataSource("MessageProperty");
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#MessageType');
var result = compositeDS.GetTarget(message, property, true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
return result.Value;
if (!messageUri) return false;
return (messageUri.substring(0,14) == "news_message:/")
}
function InitMessageMark()
@ -163,43 +219,26 @@ function InitMarkFlaggedItem(id)
function SelectedMessagesAreRead()
{
var aMessage = GetSelectedMessage(0);
var compositeDS = GetCompositeDataSource("MarkMessageRead");
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#IsUnread');
var areMessagesRead =false;
if(!aMessage)
areMessagesRead = false;
else
{
var result = compositeDS.GetTarget(aMessage, property, true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
areMessagesRead = result.Value != "true"
var isRead;
try {
isRead = gDBView.hdrForFirstSelectedMessage.isRead;
}
return areMessagesRead;
catch (ex) {
isRead = false;
}
return isRead;
}
function SelectedMessagesAreFlagged()
{
var aMessage = GetSelectedMessage(0);
var compositeDS = GetCompositeDataSource("MarkMessageFlagged");
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#Flagged');
var areMessagesFlagged = false;
if(!aMessage)
areMessagesFlagged = false;
else
{
var result = compositeDS.GetTarget(aMessage, property, true);
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
areMessagesFlagged = (result.Value == "flagged");
var isFlagged;
try {
isFlagged = gDBView.hdrForFirstSelectedMessage.isFlagged;
}
return areMessagesFlagged;
catch (ex) {
isFlagged = false;
}
return isFlagged;
}
function GetFirstSelectedMsgFolder()
@ -335,9 +374,6 @@ function MsgGetNextNMessages()
function MsgDeleteMessage(reallyDelete, fromToolbar)
{
if(reallyDelete)
dump("reallyDelete\n");
var srcFolder = GetLoadedMsgFolder();
// if from the toolbar, return right away if this is a news message
// only allow cancel from the menu: "Edit | Cancel / Delete Message"
@ -345,64 +381,58 @@ function MsgDeleteMessage(reallyDelete, fromToolbar)
{
var folderResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var uri = folderResource.Value;
if (isNewsURI(uri))
{
//dump("delete ignored!\n");
if (isNewsURI(uri)) {
// if news, don't delete
return;
}
}
//dump("tree is valid\n");
//get the selected elements
var compositeDataSource = GetCompositeDataSource("DeleteMessages");
var messages = GetSelectedMessages();
SetNextMessageAfterDelete();
DeleteMessages(compositeDataSource, srcFolder, messages, reallyDelete);
if (reallyDelete) {
gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
}
else {
gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
}
}
function MsgCopyMessage(destFolder)
{
// Get the id for the folder we're copying into
var destUri = destFolder.getAttribute('id');
var destResource = RDF.GetResource(destUri);
var destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var srcFolder = GetLoadedMsgFolder();
if(srcFolder)
{
var compositeDataSource = GetCompositeDataSource("Copy");
var messages = GetSelectedMessages();
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, false);
}
try {
// get the msg folder we're copying messages into
destUri = destFolder.getAttribute('id');
destResource = RDF.GetResource(destUri);
destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
}
catch (ex) {
dump("MsgCopyMessage failed: " + ex + "\n");
}
}
function MsgMoveMessage(destFolder)
{
// Get the id for the folder we're copying into
var destUri = destFolder.getAttribute('id');
var destResource = RDF.GetResource(destUri);
var destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
try {
// get the msg folder we're moving messages into
destUri = destFolder.getAttribute('id');
destResource = RDF.GetResource(destUri);
destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var srcFolder = GetLoadedMsgFolder();
if(srcFolder)
{
var compositeDataSource = GetCompositeDataSource("Move");
var messages = GetSelectedMessages();
var srcResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var srcUri = srcResource.Value;
if (isNewsURI(srcUri))
{
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, false);
}
else
{
SetNextMessageAfterDelete();
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, true);
}
}
// we don't move news messages, we copy them
if (isNewsURI(gDBView.msgFolder.URI)) {
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
}
else {
SetNextMessageAfterDelete();
gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages, destMsgFolder);
}
}
catch (ex) {
dump("MsgMoveMessage failed: " + ex + "\n");
}
}
function MsgNewMessage(event)
@ -419,14 +449,12 @@ function MsgNewMessage(event)
function MsgReplyMessage(event)
{
var loadedFolder = GetLoadedMsgFolder();
var server = loadedFolder.server;
if(server && server.type == "nntp")
MsgReplyGroup(event);
else
MsgReplySender(event);
}
function MsgReplySender(event)
@ -438,7 +466,6 @@ function MsgReplySender(event)
ComposeMessage(msgComposeType.ReplyToSender, msgComposeFormat.OppositeOfDefault, loadedFolder, messageArray);
else
ComposeMessage(msgComposeType.ReplyToSender, msgComposeFormat.Default, loadedFolder, messageArray);
}
function MsgReplyGroup(event)
@ -457,7 +484,6 @@ function MsgReplyToAllMessage(event)
var loadedFolder = GetLoadedMsgFolder();
var messageArray = GetSelectedMessages();
dump("\nMsgReplyToAllMessage from XUL\n");
if (event && event.shiftKey)
ComposeMessage(msgComposeType.ReplyAll, msgComposeFormat.OppositeOfDefault, loadedFolder, messageArray);
else
@ -466,8 +492,6 @@ function MsgReplyToAllMessage(event)
function MsgForwardMessage(event)
{
dump("\nMsgForwardMessage from XUL\n");
var forwardType = 0;
try {
forwardType = pref.GetIntPref("mail.forward_message_mode");
@ -484,7 +508,7 @@ function MsgForwardAsAttachment(event)
var loadedFolder = GetLoadedMsgFolder();
var messageArray = GetSelectedMessages();
dump("\nMsgForwardAsAttachment from XUL\n");
//dump("\nMsgForwardAsAttachment from XUL\n");
if (event && event.shiftKey)
ComposeMessage(msgComposeType.ForwardAsAttachment,
msgComposeFormat.OppositeOfDefault, loadedFolder, messageArray);
@ -497,7 +521,7 @@ function MsgForwardAsInline(event)
var loadedFolder = GetLoadedMsgFolder();
var messageArray = GetSelectedMessages();
dump("\nMsgForwardAsInline from XUL\n");
//dump("\nMsgForwardAsInline from XUL\n");
if (event && event.shiftKey)
ComposeMessage(msgComposeType.ForwardInline,
msgComposeFormat.OppositeOfDefault, loadedFolder, messageArray);
@ -599,9 +623,10 @@ function MsgSubscribe()
function ConfirmUnsubscribe(folder)
{
var titleMsg = gMessengerBundle.getString("confirmUnsubscribeTitle");
var sBundle = srGetStrBundle("chrome://messenger/locale/messenger.properties");
var titleMsg = gMessengerBundle.GetStringFromName("confirmUnsubscribeTitle");
var dialogMsg = gMessengerBundle.getFormattedString("confirmUnsubscribeText",
[ folder.name]);
[folder.name], 1);
var commonDialogService = nsJSComponentManager.getService("@mozilla.org/appshell/commonDialogs;1",
"nsICommonDialogs");
@ -618,23 +643,17 @@ function MsgUnsubscribe()
function MsgSaveAsFile()
{
dump("\MsgSaveAsFile from XUL\n");
var messages = GetSelectedMessages();
if (messages && messages.length == 1)
{
SaveAsFile(messages[0]);
if (gDBView.numSelected == 1) {
SaveAsFile(gDBView.URIForFirstSelectedMessage);
}
}
function MsgSaveAsTemplate()
{
dump("\MsgSaveAsTemplate from XUL\n");
var folder = GetLoadedMsgFolder();
var messages = GetSelectedMessages();
if (messages && messages.length == 1)
{
SaveAsTemplate(messages[0], folder);
if (gDBView.numSelected == 1) {
SaveAsTemplate(gDBView.URIForFirstSelectedMessage, folder);
}
}
@ -656,81 +675,66 @@ function MsgOpenNewWindowForFolder(folderUri)
else
window.openDialog("chrome://messenger/content/mail3PaneWindowVertLayout.xul", "_blank", "chrome,all,dialog=no", folderUri );
}
}
// passing in the view, so this will work for search and the thread pane
function MsgOpenSelectedMessages()
{
var threadTree = GetThreadTree();
var selectedMessages = threadTree.selectedItems;
var numMessages = selectedMessages.length;
var dbView = GetDBView();
for(var i = 0; i < numMessages; i++) {
var messageNode = selectedMessages[i];
messageUri = messageNode.getAttribute("id");
if(messageUri) {
MsgOpenNewWindowForMessage(messageUri, null);
}
dump("XXX dbView " + dbView + "\n");
var indices = GetSelectedIndices(dbView);
var numMessages = indices.length;
for (var i = 0; i < numMessages; i++) {
MsgOpenNewWindowForMessage(dbView.getURIForViewIndex(indices[i]),dbView.getFolderForViewIndex(indices[i]).URI);
}
}
function MsgOpenNewWindowForMessage(messageUri, folderUri)
{
var message;
var currentIndex;
if(!messageUri)
{
message = GetSelectedMessage(0);
var messageResource = message.QueryInterface(Components.interfaces.nsIRDFResource);
messageUri = messageResource.Value;
if (!messageUri || !folderUri) {
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
var outlinerSelection = outlinerView.selection;
currentIndex = outlinerSelection.currentIndex;
}
if(!folderUri)
{
message = RDF.GetResource(messageUri);
message = message.QueryInterface(Components.interfaces.nsIMessage);
var folder = message.msgFolder;
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
folderUri = folderResource.Value;
if (!messageUri) {
messageUri = gDBView.getURIForViewIndex(currentIndex);
}
if(messageUri && folderUri)
{
window.openDialog( "chrome://messenger/content/messageWindow.xul", "_blank", "chrome,all,dialog=no", messageUri, folderUri );
if (!folderUri) {
folderUri = gDBView.getFolderForViewIndex(currentIndex).URI;
}
// be sure to pass in the current view....
if (messageUri && folderUri) {
window.openDialog( "chrome://messenger/content/messageWindow.xul", "_blank", "chrome,all,dialog=no", messageUri, folderUri, gDBView );
}
}
function CloseMailWindow()
{
dump("\nClose from XUL\nDo something...\n");
//dump("\nClose from XUL\nDo something...\n");
window.close();
}
function MsgMarkMsgAsRead(markRead)
{
if(markRead == null)
{
markRead= !SelectedMessagesAreRead();
if (!markRead) {
markRead = !SelectedMessagesAreRead();
}
var selectedMessages = GetSelectedMessages();
var compositeDataSource = GetCompositeDataSource("MarkMessageRead");
MarkMessagesRead(compositeDataSource, selectedMessages, markRead);
MarkSelectedMessagesRead(markRead);
}
function MsgMarkAsFlagged(markFlagged)
{
if(markFlagged == null)
{
markFlagged= !SelectedMessagesAreFlagged();
if (!markFlagged) {
markFlagged = !SelectedMessagesAreFlagged();
}
var selectedMessages = GetSelectedMessages();
var compositeDataSource = GetCompositeDataSource("MarkMessageFlagged");
MarkMessagesFlagged(compositeDataSource, selectedMessages, markFlagged);
MarkSelectedMessagesFlagged(markFlagged);
}
function MsgMarkAllRead()
@ -744,23 +748,17 @@ function MsgMarkAllRead()
function MsgDownloadFlagged()
{
var compositeDataSource = GetCompositeDataSource("DownloadFlagged");
var folder = GetLoadedMsgFolder();
if(folder)
DownloadFlaggedMessages(compositeDataSource, folder);
gDBView.doCommand(nsMsgViewCommandType.downloadFlaggedForOffline);
}
function MsgDownloadSelected()
{
var selectedMessages = GetSelectedMessages();
var compositeDataSource = GetCompositeDataSource("DownloadSelected");
DownloadSelectedMessages(compositeDataSource, selectedMessages);
gDBView.doCommand(nsMsgViewCommandType.downloadSelectedForOffline);
}
function MsgMarkThreadAsRead()
{
dump("XXX fix MsgMarkThreadAsRead(), this won't work anymore\n");
var messageList = GetSelectedMessages();
if(messageList.length == 1)
{
@ -773,7 +771,6 @@ function MsgMarkThreadAsRead()
function MsgViewPageSource()
{
//dump("MsgViewPageSource(); \n ");
var messages = GetSelectedMessages();
ViewPageSource(messages);
}
@ -834,8 +831,7 @@ function MsgStop()
function MsgSendUnsentMsg()
{
var folder = GetFirstSelectedMsgFolder();
if(folder)
{
if(folder) {
SendUnsentMessages(folder);
}
}
@ -845,25 +841,15 @@ function PrintEnginePrint()
var messageList = GetSelectedMessages();
numMessages = messageList.length;
if (numMessages == 0)
{
if (numMessages == 0) {
dump("PrintEnginePrint(): No messages selected.\n");
return false;
}
var selectionArray = new Array(numMessages);
for(var i = 0; i < numMessages; i++)
{
var messageResource = messageList[i].QueryInterface(Components.interfaces.nsIRDFResource);
selectionArray[i] = messageResource.Value;
}
printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
"",
"chrome,dialog=no,all",
numMessages, selectionArray, statusFeedback);
numMessages, messageList, statusFeedback);
return true;
}
@ -1033,5 +1019,3 @@ function MsgGoBack() {}
function MsgGoForward() {}
function MsgAddSenderToAddressBook() {}
function MsgAddAllToAddressBook() {}
function MsgIgnoreThread() {}
function MsgWatchThread() {}

Просмотреть файл

@ -36,7 +36,7 @@ Rights Reserved.
<!-- Context menu -->
<script language="javascript">
// Global variable that holds the nsContextMenu instance.
var contextMenu = null;
var gMessagePaneContextMenu = null;
</script>
<script src="chrome://messenger/content/mailCommands.js"/>
@ -45,91 +45,150 @@ Rights Reserved.
<stringbundleset id="stringbundleset"/>
<commandset id="mailFileMenuItems"
commandupdater="true"
events="create-menu-file"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_getNewMessages" oncommand="goDoCommand('cmd_getNewMessages')" disabled="true"/>
<command id="cmd_close" oncommand="CloseMailWindow()"/>
<command id="cmd_open" oncommand="goDoCommand('cmd_open')"/>
<command id="cmd_file" disabled="true"/>
<command id="cmd_emptyTrash" oncommand="goDoCommand('cmd_emptyTrash')" disabled="true"/>
<command id="cmd_compactFolder" oncommand="goDoCommand('cmd_compactFolder')" disabled="true"/>
<command id="cmd_toggleWorkOffline" oncommand="goDoCommand('cmd_toggleWorkOffline')" />
<command id="cmd_synchronizeOffline" oncommand="goDoCommand('cmd_synchronizeOffline')" disabled="true"/>
<command id="cmd_downloadFlagged" oncommand="goDoCommand('cmd_downloadFlagged')" disabled="true"/>
<command id="cmd_downloadSelected" oncommand="goDoCommand('cmd_downloadSelected')" disabled="true"/>
<command id="cmd_getMsgsForAuthAccounts"
oncommand="goDoCommand('cmd_getMsgsForAuthAccounts'); event.preventBubble()"
disabled="true"/>
<command id="cmd_openMessage" oncommand="goDoCommand('cmd_openMessage')" disabled="true"/>
<command id="cmd_print" oncommand="goDoCommand('cmd_print')" disabled="true"/>
<command id="cmd_saveAsFile" oncommand="goDoCommand('cmd_saveAsFile')" disabled="true"/>
<command id="cmd_saveAsTemplate" oncommand="goDoCommand('cmd_saveAsTemplate')" disabled="true"/>
<command id="cmd_getNextNMessages" oncommand="goDoCommand('cmd_getNextNMessages')" disabled="true"/>
<command id="cmd_renameFolder" oncommand="goDoCommand('cmd_renameFolder')" />
</commandset>
<commandset id="mailViewMenuItems"
commandupdater="true"
events="create-menu-view"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_viewPageSource" oncommand="goDoCommand('cmd_viewPageSource')" disabled="true"/>
<command id="cmd_setFolderCharset" oncommand="goDoCommand('cmd_setFolderCharset')" />
<command id="cmd_reload" oncommand="goDoCommand('cmd_reload')" disabled="true"/>
<command id="cmd_expandAllThreads" oncommand="goDoCommand('cmd_expandAllThreads')" disabled="true"/>
<command id="cmd_collapseAllThreads" oncommand="goDoCommand('cmd_collapseAllThreads')" disabled="true"/>
<command id="cmd_viewAllMsgs" oncommand="goDoCommand('cmd_viewAllMsgs')" disabled="true"/>
<command id="cmd_viewUnreadMsgs" oncommand="goDoCommand('cmd_viewUnreadMsgs')" disabled="true"/>
<command id="cmd_viewThreadsWithUnread" oncommand="goDoCommand('cmd_viewThreadsWithUnread')" disabled="true"/>
<command id="cmd_viewWatchedThreadsWithUnread" oncommand="goDoCommand('cmd_viewWatchedThreadsWithUnread')" disabled="true"/>
<command id="cmd_sortByThread" oncommand="goDoCommand('cmd_sortByThread')" disabled="true"/>
</commandset>
<commandset id="mailEditMenuItems"
commandupdater="true"
events="create-menu-edit"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_undo"
valueDeleteMsg="&undoDeleteMsgCmd.label;"
valueMoveMsg="&undoMoveMsgCmd.label;"
valueCopyMsg="&undoCopyMsgCmd.label;"
valueDefault="&undoDefaultCmd.label;"/>
<command id="cmd_redo"
valueDeleteMsg="&redoDeleteMsgCmd.label;"
valueMoveMsg="&redoMoveMsgCmd.label;"
valueCopyMsg="&redoCopyMsgCmd.label;"
valueDefault="&redoDefaultCmd.label;"/>
<command id="cmd_cut"/>
<command id="cmd_copy"/>
<command id="cmd_paste"/>
<command id="cmd_delete"
valueFolder="&deleteFolderCmd.label;"
valueNewsgroup="&unsubscribeNewsgroupCmd.label;"
valueMessage="&deleteMsgCmd.label;"
valueNewsMessage="&cancelNewsMsgCmd.label;"
valueMessages="&deleteMsgsCmd.label;"/>
<command id="cmd_editDraft" oncommand="goDoCommand('cmd_editDraft')" disabled="true"/>
<command id="cmd_selectAll"/>
</commandset>
<commandset id="mailSearchMenuItems"
commandupdater="true"
events="create-menu-search"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_find" oncommand="goDoCommand('cmd_find')" disabled="true"/>
<command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
</commandset>
<commandset id="mailGoMenuItems"
commandupdater="true"
events="create-menu-go"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_nextMsg" oncommand="goDoCommand('cmd_nextMsg')" disabled="true"/>
<command id="cmd_nextUnreadMsg" oncommand="goDoCommand('cmd_nextUnreadMsg')" disabled="true"/>
<command id="cmd_nextFlaggedMsg" oncommand="goDoCommand('cmd_nextFlaggedMsg')" disabled="true"/>
<command id="cmd_nextUnreadThread" oncommand="goDoCommand('cmd_nextUnreadThread')" disabled="true"/>
<command id="cmd_previousMsg" oncommand="goDoCommand('cmd_previousMsg')" disabled="true"/>
<command id="cmd_previousUnreadMsg" oncommand="goDoCommand('cmd_previousUnreadMsg')" disabled="true"/>
<command id="cmd_previousFlaggedMsg" oncommand="goDoCommand('cmd_previousFlaggedMsg')" disabled="true"/>
</commandset>
<commandset id="mailMessageMenuItems"
commandupdater="true"
events="create-menu-message"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="cmd_reply" oncommand="goDoCommand('cmd_reply')"/>
<command id="cmd_replySender" oncommand="goDoCommand('cmd_replySender')"/>
<command id="cmd_replyGroup" oncommand="goDoCommand('cmd_replyGroup')"/>
<command id="cmd_replyall" oncommand="goDoCommand('cmd_replyall')"/>
<command id="cmd_forward" oncommand="goDoCommand('cmd_forward')"/>
<command id="cmd_forwardInline" oncommand="goDoCommand('cmd_forwardInline')"/>
<command id="cmd_forwardAttachment" oncommand="goDoCommand('cmd_forwardAttachment')"/>
<command id="cmd_editAsNew" oncommand="goDoCommand('cmd_editAsNew')"/>
<command id="cmd_markAsRead" oncommand="goDoCommand('cmd_markAsRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markAllRead" oncommand="goDoCommand('cmd_markAllRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markThreadAsRead" oncommand="goDoCommand('cmd_markThreadAsRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markAsFlagged" oncommand="goDoCommand('cmd_markAsFlagged'); event.preventBubble()" disabled="true"/>
<command id="cmd_killThread" oncommand="goDoCommand('cmd_killThread')"/>
<command id="cmd_watchThread" oncommand="goDoCommand('cmd_watchThread')"/>
</commandset>
<commandset id="mailToolbarItems"
commandupdater="true"
events="mail-toolbar"
oncommandupdate="goUpdateMailMenuItems(this)">
<command id="button_reply"/>
<command id="button_replyall"/>
<command id="button_forward"/>
<command id="button_delete"/>
<command id="button_mark"/>
<command id="button_getNewMessages"/>
<command id="button_print"/>
<command id="button_next"/>
<command id="button_file"/>
</commandset>
<broadcasterset id="broadcasterset">
<!-- File Menu -->
<broadcaster id="cmd_newNavigator"/>
<broadcaster id="cmd_newEditor"/>
<broadcaster id="cmd_close" oncommand="CloseMailWindow()"/>
<broadcaster id="cmd_quit"/>
<broadcaster id="cmd_pageSetup"/>
<!-- Edit Menu -->
<broadcaster id="cmd_undo"
valueDeleteMsg="&undoDeleteMsgCmd.label;"
valueMoveMsg="&undoMoveMsgCmd.label;"
valueCopyMsg="&undoCopyMsgCmd.label;"
valueDefault="&undoDefaultCmd.label;"/>
<broadcaster id="cmd_redo"
valueDeleteMsg="&redoDeleteMsgCmd.label;"
valueMoveMsg="&redoMoveMsgCmd.label;"
valueCopyMsg="&redoCopyMsgCmd.label;"
valueDefault="&redoDefaultCmd.label;"/>
<broadcaster id="cmd_cut"/>
<broadcaster id="cmd_copy"/>
<broadcaster id="cmd_paste"/>
<broadcaster id="cmd_delete"
valueFolder="&deleteFolderCmd.label;"
valueNewsgroup="&unsubscribeNewsgroupCmd.label;"
valueMessage="&deleteMsgCmd.label;"
valueNewsMessage="&cancelNewsMsgCmd.label;"
valueMessages="&deleteMsgsCmd.label;"/>
<broadcaster id="button_delete"/>
<broadcaster id="cmd_editDraft" oncommand="goDoCommand('cmd_editDraft')" disabled="true"/>
<broadcaster id="cmd_selectAll"/>
<broadcaster id="cmd_preferences"/>
<broadcaster id="cmd_nextMsg" oncommand="goDoCommand('cmd_nextMsg')" disabled="true"/>
<broadcaster id="cmd_nextUnreadMsg" oncommand="goDoCommand('cmd_nextUnreadMsg')" disabled="true"/>
<broadcaster id="cmd_nextFlaggedMsg" oncommand="goDoCommand('cmd_nextFlaggedMsg')" disabled="true"/>
<broadcaster id="cmd_nextUnreadThread" oncommand="goDoCommand('cmd_nextUnreadThread')" disabled="true"/>
<broadcaster id="cmd_previousMsg" oncommand="goDoCommand('cmd_previousMsg')" disabled="true"/>
<broadcaster id="cmd_previousUnreadMsg" oncommand="goDoCommand('cmd_previousUnreadMsg')" disabled="true"/>
<broadcaster id="cmd_previousFlaggedMsg" oncommand="goDoCommand('cmd_previousFlaggedMsg')" disabled="true"/>
<broadcaster id="cmd_viewAllMsgs" oncommand="goDoCommand('cmd_viewAllMsgs')" disabled="true"/>
<broadcaster id="cmd_viewUnreadMsgs" oncommand="goDoCommand('cmd_viewUnreadMsgs')" disabled="true"/>
<broadcaster id="cmd_sortByThread" oncommand="goDoCommand('cmd_sortByThread')" disabled="true"/>
<broadcaster id="cmd_reply" oncommand="goDoCommand('cmd_reply')"/>
<broadcaster id="cmd_replySender" oncommand="goDoCommand('cmd_replySender')"/>
<broadcaster id="cmd_replyGroup" oncommand="goDoCommand('cmd_replyGroup')"/>
<broadcaster id="cmd_replyall" oncommand="goDoCommand('cmd_replyall')"/>
<broadcaster id="cmd_forward" oncommand="goDoCommand('cmd_forward')"/>
<broadcaster id="cmd_forwardInline" oncommand="goDoCommand('cmd_forwardInline')"/>
<broadcaster id="cmd_forwardAttachment" oncommand="goDoCommand('cmd_forwardAttachment')"/>
<broadcaster id="cmd_editAsNew" oncommand="goDoCommand('cmd_editAsNew')"/>
<broadcaster id="button_reply"/>
<broadcaster id="button_replyall"/>
<broadcaster id="button_forward"/>
<broadcaster id="cmd_renameFolder" oncommand="goDoCommand('cmd_renameFolder')" />
<broadcaster id="cmd_expandAllThreads" oncommand="goDoCommand('cmd_expandAllThreads')" disabled="true"/>
<broadcaster id="cmd_collapseAllThreads" oncommand="goDoCommand('cmd_collapseAllThreads')" disabled="true"/>
<broadcaster id="cmd_openMessage" oncommand="goDoCommand('cmd_openMessage')" disabled="true"/>
<broadcaster id="cmd_print" oncommand="goDoCommand('cmd_print')" disabled="true"/>
<broadcaster id="cmd_saveAsFile" oncommand="goDoCommand('cmd_saveAsFile')" disabled="true"/>
<broadcaster id="cmd_saveAsTemplate" oncommand="goDoCommand('cmd_saveAsTemplate')" disabled="true"/>
<broadcaster id="cmd_viewPageSource" oncommand="goDoCommand('cmd_viewPageSource')" disabled="true"/>
<broadcaster id="cmd_setFolderCharset" oncommand="goDoCommand('cmd_setFolderCharset')" />
<broadcaster id="cmd_reload" oncommand="goDoCommand('cmd_reload')" disabled="true"/>
<broadcaster id="cmd_getNewMessages" oncommand="goDoCommand('cmd_getNewMessages')" disabled="true"/>
<broadcaster id="cmd_getNextNMessages" oncommand="goDoCommand('cmd_getNextNMessages')" disabled="true"/>
<broadcaster id="cmd_find" oncommand="goDoCommand('cmd_find')" disabled="true"/>
<broadcaster id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
<broadcaster id="cmd_markAsRead" oncommand="goDoCommand('cmd_markAsRead'); event.preventBubble()" disabled="true"/>
<broadcaster id="cmd_markAllRead" oncommand="goDoCommand('cmd_markAllRead'); event.preventBubble()" disabled="true"/>
<broadcaster id="cmd_markThreadAsRead" oncommand="goDoCommand('cmd_markThreadAsRead'); event.preventBubble()" disabled="true"/>
<broadcaster id="cmd_markAsFlagged" oncommand="goDoCommand('cmd_markAsFlagged'); event.preventBubble()" disabled="true"/>
<broadcaster id="cmd_file" disabled="true"/>
<broadcaster id="cmd_emptyTrash" oncommand="goDoCommand('cmd_emptyTrash')" disabled="true"/>
<broadcaster id="cmd_compactFolder" oncommand="goDoCommand('cmd_compactFolder')" disabled="true"/>
<broadcaster id="cmd_workOffline" oncommand="goDoCommand('cmd_workOffline')" disabled="true"/>
<broadcaster id="cmd_synchronizeOffline" oncommand="goDoCommand('cmd_synchronizeOffline')" disabled="true"/>
<broadcaster id="cmd_downloadFlagged" oncommand="goDoCommand('cmd_downloadFlagged')" disabled="true"/>
<broadcaster id="cmd_downloadSelected" oncommand="goDoCommand('cmd_downloadSelected')" disabled="true"/>
<broadcaster id="cmd_getMsgsForAuthAccounts"
oncommand="goDoCommand('cmd_getMsgsForAuthAccounts'); event.preventBubble()"
disabled="true"/>
</broadcasterset>
<keyset id="keyset">
@ -143,32 +202,34 @@ Rights Reserved.
<key id="key_cut"/>
<key id="key_copy"/>
<key id="key_paste"/>
<key id="key_delete" shift="false"/>
<key id="key_delete" oncommand="goDoCommand('cmd_delete');" shift="false"/>
<key id="cmd_shiftDelete" oncommand="goDoCommand('cmd_shiftDelete')"/>
<key id="key_selectAll"/>
<key id="key_toggleRead" key="&markAsReadCmd.key;" observes="cmd_markAsRead"/>
<key id="key_markAllRead" key="&markAllReadCmd.key;" observes="cmd_markAllRead" modifiers="accel, shift"/>
<key id="key_nextMsg" key="&nextMsgCmd.key;" observes="cmd_nextMsg"/>
<key id="key_nextUnreadMsg" key="&nextUnreadMsgCmd.key;" observes="cmd_nextUnreadMsg"/>
<key id="key_nextUnreadThread" key="&nextUnreadThreadCmd.key;" observes="cmd_nextUnreadThread"/>
<key id="key_previousMsg" key="&previousMsgCmd.key;" observes="cmd_previousMsg"/>
<key id="key_previousUnreadMsg" key="&previousUnreadMsgCmd.key;" observes="cmd_previousUnreadMsg"/>
<key id="key_reply" key="&replyMsgCmd.key;" observes="cmd_reply" modifiers="accel"/>
<key id="key_replyall" key="&replyToAllMsgCmd.key;" observes="cmd_replyall" modifiers="accel, shift"/>
<key id="key_forward" key="&forwardMsgCmd.key;" observes="cmd_forward" modifiers="accel"/>
<key id="key_editAsNew" key="&editMsgAsNewCmd.key;" observes="cmd_editAsNew" modifiers="accel"/>
<key id="key_openMessage" key="&openMessageWindowCmd.key;" observes="cmd_openMessage" modifiers="accel"/>
<key id="key_print" key="&printCmd.key;" observes="cmd_print" modifiers="accel"/>
<key id="key_saveAsFile" key="&saveAsFileCmd.key;" observes="cmd_saveAsFile" modifiers="accel"/>
<key id="key_viewPageSource" key="&pageSourceCmd.key;" observes="cmd_viewPageSource" modifiers="accel"/>
<key id="key_getNewMessages" key="&getNewMsgCmd.key;" observes="cmd_getNewMessages" modifiers="accel"/>
<key id="key_toggleRead" key="&markAsReadCmd.key;" oncommand="goDoCommand('cmd_markAsRead');"/>
<key id="key_markAllRead" key="&markAllReadCmd.key;" oncommand="goDoCommand('cmd_markAllRead');" modifiers="accel, shift"/>
<key id="key_nextMsg" key="&nextMsgCmd.key;" oncommand="goDoCommand('cmd_nextMsg')"/>
<key id="key_nextUnreadMsg" key="&nextUnreadMsgCmd.key;" oncommand="goDoCommand('cmd_nextUnreadMsg')"/>
<key id="key_nextUnreadThread" key="&nextUnreadThreadCmd.key;" oncommand="goDoCommand('cmd_nextUnreadThread')"/>
<key id="key_previousMsg" key="&previousMsgCmd.key;" oncommand="goDoCommand('cmd_previousMsg')"/>
<key id="key_previousUnreadMsg" key="&previousUnreadMsgCmd.key;" oncommand="goDoCommand('cmd_previousUnreadMsg')"/>
<key id="key_reply" key="&replyMsgCmd.key;" oncommand="goDoCommand('cmd_reply')" modifiers="accel"/>
<key id="key_replyall" key="&replyToAllMsgCmd.key;" oncommand="goDoCommand('cmd_replyall')" modifiers="accel, shift"/>
<key id="key_forward" key="&forwardMsgCmd.key;" oncommand="goDoCommand('cmd_forward')" modifiers="accel"/>
<key id="key_editAsNew" key="&editMsgAsNewCmd.key;" oncommand="goDoCommand('cmd_editAsNew')" modifiers="accel"/>
<key id="key_watchThread" key="&watchThreadMenu.key;" oncommand="goDoCommand('cmd_watchThread')" modifiers="accel"/>
<key id="key_killThread" key="&killThreadMenu.key;" oncommand="goDoCommand('cmd_killThread')" />
<key id="key_openMessage" key="&openMessageWindowCmd.key;" oncommand="goDoCommand('cmd_openMessage')" modifiers="accel"/>
<key id="key_print" key="&printCmd.key;" oncommand="goDoCommand('cmd_print')" modifiers="accel"/>
<key id="key_saveAsFile" key="&saveAsFileCmd.key;" oncommand="goDoCommand('cmd_saveAsFile')" modifiers="accel"/>
<key id="key_viewPageSource" key="&pageSourceCmd.key;" oncommand="goDoCommand('cmd_viewPageSource')" modifiers="accel"/>
<key id="key_getNewMessages" key="&getNewMsgCmd.key;" oncommand="goDoCommand('cmd_getNewMessages')" modifiers="accel"/>
<key id="key_getAllNewMessages"
key="&getAllNewMsgCmd.key;"
observes="cmd_getMsgsForAuthAccounts"
oncommand="goDoCommand('cmd_getMsgsForAuthAccounts');"
modifiers="accel, shift"/>
<key id="key_find" key="&findCmd.key;" observes="cmd_find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.key;" observes="cmd_findAgain" modifiers="accel"/>
<key id="key_find" key="&findCmd.key;" oncommand="goDoCommand('cmd_find')" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.key;" oncommand="goDoCommand('cmd_findAgain')" modifiers="accel"/>
<!-- Tab Keys -->
<key id="tabpaneCounterClockwise" keycode="VK_TAB" oncommand="SwitchPaneFocus('counter-clockwise');"
@ -415,16 +476,16 @@ Rights Reserved.
</popup>
<popup id="messagePaneContext"
oncreate="contextMenu = new nsContextMenu(this); return fillMessagePaneContextMenu(contextMenu);"
ondestroy="contextMenu.onDestroy(); contextMenu = null;">
oncreate="gMessagePaneContextMenu = new nsContextMenu(this); return fillMessagePaneContextMenu(gMessagePaneContextMenu);"
ondestroy="contextMenu.onDestroy(); contextMenu = null;">
<menuitem id="context-openlink"
value="&openLinkCmd.label;"
accesskey="&openLinkCmd.accesskey;"
oncommand="contextMenu.openLink();"/>
oncommand="gMessagePaneContextMenu.openLink();"/>
<menuitem id="context-editlink"
value="&editLinkCmd.label;"
accesskey="&editLinkCmd.accesskey;"
oncommand="contextMenu.editLink();"/>
oncommand="gMessagePaneContextMenu.editLink();"/>
<menuseparator id="messagePaneContext-sep-link"/>
<menuitem id="context-selectall"
value="&selectAllCmd.label;"
@ -605,35 +666,35 @@ Rights Reserved.
<menuitem id="context-viewimage"
value="&viewImageCmd.label;"
accesskey="&viewImageCmd.accesskey;"
oncommand="contextMenu.viewImage();"/>
oncommand="gMessagePaneContextMenu.viewImage();"/>
<menuseparator id="messagePaneContext-sep-image"/>
<menuitem id="context-copylink"
value="&copyLinkCmd.label;"
accesskey="&copyLinkCmd.accesskey;"
oncommand="contextMenu.copyLink();"/>
oncommand="gMessagePaneContextMenu.copyLink();"/>
<menuitem id="context-copyimage"
value="&copyImageCmd.label;"
accesskey="&copyImageCmd.accesskey;"
oncommand="contextMenu.copyImage();"/>
oncommand="gMessagePaneContextMenu.copyImage();"/>
<menuseparator id="messagePaneContext-sep-copy"/>
<menuitem id="context-savelink"
value="&saveLinkCmd.label;"
accesskey="&saveLinkCmd.accesskey;"
oncommand="contextMenu.saveLink();"/>
oncommand="gMessagePaneContextMenu.saveLink();"/>
<menuitem id="context-saveimage"
accesskey="&saveImageCmd.accesskey;"
oncommand="contextMenu.saveImage();"/>
oncommand="gMessagePaneContextMenu.saveImage();"/>
<menuitem id="context-bookmarklink"
value="&bookmarkLinkCmd.label;"
accesskey="&bookmarkLinkCmd.accesskey;"
oncommand="addBookmark(contextMenu.linkURL(),
contextMenu.linkText());"/>
oncommand="addBookmark(gMessagePaneContextMenu.linkURL(),
gMessagePaneContextMenu.linkText());"/>
</popup>
<menubar id="mailMenubar">
<menu id="menu_File">
<menupopup id="menu_FilePopup" oncreate="file_init();">
<menu id="menu_File" >
<menupopup id="menu_FilePopup" oncreate="file_init();">
<menuitem value="&newMsgCmd.label;"
accesskey="&newMsgCmd.accesskey;"
key="key_newMessage"
@ -721,7 +782,7 @@ Rights Reserved.
<menupopup>
<menuitem value="&workOfflineCmd.label;"
accesskey="&workOfflineCmd.accesskey;"
observes="cmd_workOffline"/>
observes="cmd_toggleWorkOffline"/>
<menuitem value="&synchronizeOfflineCmd.label;"
accesskey="&synchronizeOfflineCmd.accesskey;"
observes="cmd_synchronizeOffline"/>
@ -740,9 +801,9 @@ Rights Reserved.
</menu>
<menu id="menu_Edit" oncommand="CommandUpdate_UndoRedo();">
<menupopup>
<menuitem id="menu_undo" value="&undoDefaultCmd.label;" accesskey="&undoDefaultCmd.accesskey;" key="key_undo" oncommand="Undo()"/>
<menuitem id="menu_redo" value="&redoDefaultCmd.label;" accesskey="&redoDefaultCmd.accesskey;" key="key_redo" oncommand="Redo()"/>
<menupopup oncreate="InitEditMessagesMenu()">
<menuitem id="menu_undo" value="&undoDefaultCmd.label;" accesskey="&undoDefaultCmd.accesskey;" key="key_undo" observes="cmd_undo" oncommand="Undo()"/>
<menuitem id="menu_redo" value="&redoDefaultCmd.label;" accesskey="&redoDefaultCmd.accesskey;" key="key_redo" observes="cmd_redo" oncommand="Redo()"/>
<menuseparator/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
@ -795,13 +856,15 @@ Rights Reserved.
<menuitem id="sortBySizeMenuitem" type="checkbox" value="&sortBySizeCmd.label;" accesskey="&sortBySizeCmd.accesskey;" oncommand="MsgSortBySize()"/>
<menuitem id="sortByStatusMenuitem" type="checkbox" value="&sortByStatusCmd.label;" accesskey="&sortByStatusCmd.accesskey;" oncommand="MsgSortByStatus()"/>
<menuitem id="sortBySubjectMenuitem" type="checkbox" value="&sortBySubjectCmd.label;" accesskey="&sortBySubjectCmd.accesskey;" oncommand="MsgSortBySubject()"/>
<menuitem id="sortByUnreadMenuitem" type="checkbox" value="&sortByUnreadCmd.label;" accesskey="&sortByUnreadCmd.accesskey;" oncommand="MsgSortByRead()"/>
<menuitem id="sortByUnreadMenuitem" type="checkbox" value="&sortByUnreadCmd.label;" accesskey="&sortByUnreadCmd.accesskey;" oncommand="MsgSortByUnread()"/>
</menupopup>
</menu>
<menu value="&msgsMenu.label;" id="viewMessagesMenu" accesskey="&msgsMenu.accesskey;" oncreate="InitViewMessagesMenu();">
<menupopup>
<menu value="&msgsMenu.label;" id="viewMessagesMenu" accesskey="&msgsMenu.accesskey;">
<menupopup oncreate="InitViewMessagesMenu()">
<menuitem id="viewAllMessagesMenuItem" type="checkbox" value="&allMsgsCmd.label;" accesskey="&allMsgsCmd.accesskey;" disabled="true" observes="cmd_viewAllMsgs"/>
<menuitem id="viewUnreadMessagesMenuItem" type="checkbox" value="&unreadMsgsCmd.label;" accesskey="&unreadMsgsCmd.accesskey;" disabled="true" observes="cmd_viewUnreadMsgs"/>
<menuitem id="viewThreadsWithUnreadMenuItem" type="checkbox" value="&threadsWithUnreadCmd.label;" accesskey="&threadsWithUnreadCmd.accesskey;" disabled="true" observes="cmd_viewThreadsWithUnread"/>
<menuitem id="viewWatchedThreadsWithUnreadMenuItem" type="checkbox" value="&watchedThreadsWithUnreadCmd.label;" accesskey="&watchedThreadsWithUnreadCmd.accesskey;" disabled="true" observes="cmd_viewWatchedThreadsWithUnread"/>
<menuseparator/>
<menuitem id="menu_showThreads"
type="checkbox"
@ -844,7 +907,7 @@ Rights Reserved.
</menupopup>
</menu>
<menu value="&searchMenu.label;" accesskey="&searchMenu.accesskey;">
<menupopup>
<menupopup oncreate="InitSearchMessagesMenu();">
<menuitem value="&findCmd.label;" key="key_find" accesskey="&findCmd.accesskey;" observes="cmd_find"/>
<menuitem value="&findAgainCmd.label;" key="key_findAgain" accesskey="&findAgainCmd.accesskey;" observes="cmd_findAgain"/>
<menuseparator/>
@ -855,7 +918,7 @@ Rights Reserved.
</menupopup>
</menu>
<menu value="&goMenu.label;" accesskey="&goMenu.accesskey;">
<menupopup>
<menupopup oncreate="InitGoMessagesMenu();">
<menu id="goNextMenu" value="&nextMenu.label;" accesskey="&nextMenu.accesskey;">
<menupopup>
<menuitem value="&nextMsgCmd.label;" key="key_nextMsg" accesskey="&nextMsgCmd.accesskey;" observes="cmd_nextMsg"/>
@ -876,8 +939,9 @@ Rights Reserved.
<menuitem value="&startPageCmd.label;" accesskey="&startPageCmd.accesskey;" oncommand="HideMessageHeaderPane();loadStartPage();"/>
</menupopup>
</menu>
<menu value="&msgMenu.label;" accesskey="&msgMenu.accesskey;" oncreate="InitMessageMenu()">
<menupopup>
<menu value="&msgMenu.label;" accesskey="&msgMenu.accesskey;" >
<menupopup oncreate="InitMessageMenu();">
<menuitem value="&newMsgCmd.label;"
accesskey="&newMsgCmd.accesskey;"
key="key_newMessage"
@ -1051,6 +1115,16 @@ Rights Reserved.
<menuitem type="checkbox" id="markFlaggedMenuItem" value="&markFlaggedCmd.label;" accesskey="&markFlaggedCmd.accesskey;" observes="cmd_markAsFlagged"/>
</menupopup>
</menu>
<menuitem value="&killThreadMenu.label;"
accesskey="&killThreadMenu.accesskey;"
key="key_killThread"
id="killThread"
observes="cmd_killThread"/>
<menuitem value="&watchThreadMenu.label;"
accesskey="&watchThreadMenu.accesskey;"
key="key_watchThread"
id="watchThread"
observes="cmd_watchThread"/>
</menupopup>
</menu>
@ -1065,7 +1139,8 @@ Rights Reserved.
<menubutton class="menubutton-dual toolbar top" id="button-getmsg"
value="&getMsgButton.label;" crop="right" tooltip="aTooltip"
tooltiptext="&getMsgButton.tooltip;"
observes="cmd_getNewMessages" datasources="rdf:msgaccountmanager"
observes="button_getNewMessages" datasources="rdf:msgaccountmanager"
oncommand="goDoCommand('cmd_getNewMessages')"
containment="http://home.netscape.com/NC-rdf#child"
ref="msgaccounts:/">
<menupopup>
@ -1091,7 +1166,7 @@ Rights Reserved.
<button class="button-toolbar-2 top" id="button-replyall" value="&replyAllButton.label;" tooltip="aTooltip" tooltiptext="&replyAllButton.tooltip;" observes="button_replyall" oncommand="MsgReplyToAllMessage(event)"/>
<button class="button-toolbar-2 top" id="button-forward" value="&forwardButton.label;" tooltip="aTooltip" tooltiptext="&forwardButton.tooltip;" observes="button_forward" oncommand="MsgForwardMessage(event)"/>
<toolbarseparator class="toolbarseparator-primary"/>
<menubutton class="button-toolbar-2 top" id="button-file" observes="cmd_file" datasources="rdf:null" ignore="http://home.netscape.com/NC-rdf#MessageChild" value="&fileButton.label;" tooltip="aTooltip" tooltiptext="&fileButton.tooltip;">
<menubutton class="button-toolbar-2 top" id="button-file" observes="button_file" datasources="rdf:null" ignore="http://home.netscape.com/NC-rdf#MessageChild" value="&fileButton.label;" tooltip="aTooltip" tooltiptext="&fileButton.tooltip;">
<template>
<rule nc:NoSelect="true" iscontainer="true" isempty="false">
<menupopup>
@ -1154,10 +1229,10 @@ Rights Reserved.
</template>
<menupopup/>
</menubutton>
<button class="button-toolbar-2 top" id="button-next" value="&nextButton.label;" tooltip="aTooltip" tooltiptext="&nextButton.tooltip;" observes="cmd_nextUnreadMsg"/>
<button class="button-toolbar-2 top" id="button-next" value="&nextButton.label;" oncommand="goDoCommand('cmd_nextUnreadMsg')" tooltip="aTooltip" tooltiptext="&nextButton.tooltip;" observes="button_next"/>
<button class="button-toolbar-2 top" id="button-delete" value="&deleteButton.label;" tooltip="aTooltip" tooltiptext="&deleteButton.tooltip;" observes="button_delete" oncommand="goDoCommand('button_delete')"/>
<menubutton class="menubutton-dual toolbar top" id="button-mark" value="&markButton.label;" hidden="true"
crop="right" observes="cmd_markAsRead" tooltip="aTooltip" tooltiptext="&markButton.tooltip;">
<menubutton class="menubutton-dual toolbar top" id="button-mark" value="&markButton.label;" hidden="true" oncommand="goDoCommand('button_mark')"
crop="right" observes="button_mark" tooltip="aTooltip" tooltiptext="&markButton.tooltip;">
<menupopup oncreate="InitMessageMark()">
<menuitem type="checkbox" key="key_toggleRead" id="markReadToolbarItem" value="&markAsReadCmd.label;" accesskey="&markAsReadCmd.accesskey;" observes="cmd_markAsRead" default="true" />
<menuitem value="&markThreadAsReadCmd.label;" accesskey="&markThreadAsReadCmd.accesskey;" observes="cmd_markThreadAsRead"/>
@ -1167,10 +1242,10 @@ Rights Reserved.
</menupopup>
</menubutton>
<menubutton class="menubutton-dual toolbar top" id="button-print" value="&printButton.label;"
crop="right" observes="cmd_print" tooltip="aTooltip" tooltiptext="&printButton.tooltip;">
crop="right" observes="button_print" oncommand="goDoCommand('cmd_print')" tooltip="aTooltip" tooltiptext="&printButton.tooltip;">
<menupopup id="printMenu">
<menuitem value="&printCmd.label;" accesskey="&printCmd.accesskey;" default="true"/>
</menupopup>
</menupopup>
</menubutton>
<button class="button-toolbar-2 top" id="button-stop" value="&stopButton.label;" tooltip="aTooltip" tooltiptext="&stopButton.tooltip;" oncommand="MsgStop();"/>
<spring flex="1"/>

Просмотреть файл

@ -53,8 +53,6 @@ CHROME_CONTENT = \
.\subscribe.xul \
.\subscribe.js \
.\sidebar-messenger.rdf \
.\newFolderNameDialog.xul \
.\newFolderNameDialog.js \
.\msgViewNavigation.js \
.\msgMail3PaneWindow.js \
.\mail3PaneWindowCommands.js \

Просмотреть файл

@ -27,12 +27,12 @@ var compositeDataSourceContractID = datasourceContractIDPrefix + "composi
var gCompositeDataSource;
var gCurrentMessageUri;
var gCurrentFolderUri;
var gThreadPaneCommandUpdater = null;
var gCurrentMessageIsDeleted = false;
// the folderListener object
var folderListener = {
OnItemAdded: function(parentItem, item, view) {},
OnItemAdded: function(parentItem, item, view) {},
OnItemRemoved: function(parentItem, item, view)
{
@ -44,15 +44,9 @@ var folderListener = {
if(parentURI != gCurrentFolderUri)
return;
var deletedMessageResource = item.QueryInterface(Components.interfaces.nsIRDFResource);
var deletedUri = deletedMessageResource.Value;
//If the deleted message is our message then we know we're about to be deleted.
if(deletedUri == gCurrentMessageUri)
{
var deletedMessageHdr = item.QueryInterface(Components.interfaces.nsIMsgDBHdr);
if (extractMsgKeyFromURI() == deletedMessageHdr.messageKey)
gCurrentMessageIsDeleted = true;
}
},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
@ -63,19 +57,47 @@ var folderListener = {
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
OnItemEvent: function(folder, event) {
if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") {
HandleDeleteOrMoveMsgCompleted(folder);
}
else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") {
HandleDeleteOrMoveMsgFailed(folder);
}
OnItemEvent: function(folder, event) {
if (event.GetUnicode() == "DeleteOrMoveMsgCompleted") {
HandleDeleteOrMoveMsgCompleted(folder);
}
else if (event.GetUnicode() == "DeleteOrMoveMsgFailed") {
HandleDeleteOrMoveMsgFailed(folder);
}
}
}
function nsMsgDBViewCommandUpdater()
{}
nsMsgDBViewCommandUpdater.prototype =
{
updateCommandStatus : function()
{
// the back end is smart and is only telling us to update command status
// when the # of items in the selection has actually changed.
document.commandDispatcher.updateCommands('mail-toolbar');
},
displayMessageChanged : function(aFolder, aSubject)
{
setTitleFromFolder(aFolder, aSubject);
gCurrentMessageUri = gDBView.URIForFirstSelectedMessage;
},
QueryInterface : function(iid)
{
if(iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater))
return this;
throw Components.results.NS_NOINTERFACE;
return null;
}
}
function HandleDeleteOrMoveMsgCompleted(folder)
{
dump("In HandleDeleteOrMoveMsgCompleted\n");
@ -86,32 +108,37 @@ function HandleDeleteOrMoveMsgCompleted(folder)
var folderUri = folderResource.Value;
if((folderUri == gCurrentFolderUri) && gCurrentMessageIsDeleted)
{
//If we knew we were going to be deleted and the deletion has finished, close the window.
gCurrentMessageIsDeleted = false;
//Use timeout to make sure all folder listeners get event before removing them. Messes up
//folder listener iterator if we don't do this.
setTimeout("window.close();",0);
gCurrentMessageIsDeleted = false;
if (gNextMessageViewIndexAfterDelete != -1)
{
var nextMstKey = gDBView.getKeyAt(gNextMessageViewIndexAfterDelete);
gDBView.loadMessageByMsgKey(nextMstKey);
}
else
{
// close the stand alone window because there are no more messages in the folder
window.close();
}
}
}
function HandleDeleteOrMoveMsgFailed(folder)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
if(!folderResource)
return;
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
if(!folderResource)
return;
var folderUri = folderResource.Value;
if((folderUri == gCurrentFolderUri) && gCurrentMessageIsDeleted)
{
gCurrentMessageIsDeleted = false;
}
var folderUri = folderResource.Value;
if((folderUri == gCurrentFolderUri) && gCurrentMessageIsDeleted)
{
gCurrentMessageIsDeleted = false;
}
}
function OnLoadMessageWindow()
{
HideMenus();
HideToolbarButtons();
CreateMailWindowGlobals();
CreateMessageWindowGlobals();
verifyAccounts();
@ -123,13 +150,15 @@ function OnLoadMessageWindow()
// FIX ME - later we will be able to use onload from the overlay
OnLoadMsgHeaderPane();
try {
mailSession.AddFolderListener(folderListener);
try {
mailSession.AddFolderListener(folderListener);
} catch (ex) {
dump("Error adding to session\n");
}
dump("Error adding to session\n");
}
if(window.arguments && window.arguments.length == 2)
var originalView = null;
if(window.arguments)
{
if(window.arguments[0])
{
@ -148,8 +177,28 @@ function OnLoadMessageWindow()
{
gCurrentFolderUri = null;
}
if (window.arguments[2])
originalView = window.arguments[2];
}
// extract the sort type, the sort order,
var sortType;
var sortOrder;
var viewFlags;
var viewType;
if (originalView)
{
viewType = originalView.viewType;
viewFlags = originalView.viewFlags;
sortType = originalView.sortType;
sortOrder = originalView.sortOrder;
}
var msgFolder = GetLoadedMsgFolder();
CreateBareDBView(msgFolder,viewType, viewFlags, sortType, sortOrder); // create a db view for
if (gCurrentMessageUri) {
SetUpToolbarButtons(gCurrentMessageUri);
}
@ -157,11 +206,25 @@ function OnLoadMessageWindow()
SetUpToolbarButtons(gCurrentFolderUri);
}
setTimeout("OpenURL(gCurrentMessageUri);", 0);
setTimeout("var msgKey = extractMsgKeyFromURI(gCurrentMessageUri); gDBView.loadMessageByMsgKey(msgKey); gNextMessageViewIndexAfterDelete = gDBView.firstSelected;", 0);
SetupCommandUpdateHandlers();
}
function extractMsgKeyFromURI()
{
var msgKey = -1;
var msgService = messenger.messageServiceFromURI(gCurrentMessageUri);
if (msgService)
{
var msgHdr = msgService.messageURIToMsgHdr(gCurrentMessageUri);
if (msgHdr)
msgKey = msgHdr.messageKey;
}
return msgKey;
}
function HideMenus()
{
var message_menuitem=document.getElementById('menu_showMessage');
@ -192,18 +255,6 @@ function HideMenus()
if(viewThreadedMenu)
viewThreadedMenu.setAttribute("hidden", "true");
var goNextMenu = document.getElementById('goNextMenu');
if(goNextMenu)
goNextMenu.setAttribute("hidden", "true");
var goPreviousMenu = document.getElementById('goPreviousMenu');
if(goPreviousMenu)
goPreviousMenu.setAttribute("hidden", "true");
var goNextSeparator = document.getElementById('goNextSeparator');
if(goNextSeparator)
goNextSeparator.setAttribute("hidden", "true");
var emptryTrashMenu = document.getElementById('menu_emptyTrash');
if(emptryTrashMenu)
emptryTrashMenu.setAttribute("hidden", "true");
@ -218,14 +269,6 @@ function HideMenus()
}
function HideToolbarButtons()
{
var nextButton = document.getElementById('button-next');
if(nextButton)
nextButton.setAttribute("hidden", "true");
}
function OnUnloadMessageWindow()
{
OnMailWindowUnload();
@ -235,16 +278,14 @@ function CreateMessageWindowGlobals()
{
gCompositeDataSource = Components.classes[compositeDataSourceContractID].createInstance();
gCompositeDataSource = gCompositeDataSource.QueryInterface(Components.interfaces.nsIRDFCompositeDataSource);
}
function InitializeDataSources()
{
AddDataSources();
//Now add datasources to composite datasource
gCompositeDataSource.AddDataSource(accountManagerDataSource);
gCompositeDataSource.AddDataSource(folderDataSource);
gCompositeDataSource.AddDataSource(messageDataSource);
AddDataSources();
//Now add datasources to composite datasource
gCompositeDataSource.AddDataSource(accountManagerDataSource);
gCompositeDataSource.AddDataSource(folderDataSource);
}
function GetSelectedMsgFolders()
@ -258,7 +299,7 @@ function GetSelectedMsgFolders()
return folderArray;
}
function GetSelectedMessage(index)
function GetFirstSelectedMessage()
{
return GetLoadedMessage();
}
@ -275,8 +316,7 @@ function GetSelectedMessages()
{
var messageArray = new Array(1);
var message = GetLoadedMessage();
if(message)
{
if(message) {
messageArray[0] = message;
}
return messageArray;
@ -298,17 +338,7 @@ function GetLoadedMsgFolder()
function GetLoadedMessage()
{
if(gCurrentMessageUri)
{
var messageResource = RDF.GetResource(gCurrentMessageUri);
if(messageResource)
{
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
return message;
}
}
return null;
return gCurrentMessageUri;
}
//Clear everything related to the current message. called after load start page.
@ -316,7 +346,7 @@ function ClearMessageSelection()
{
gCurrentMessageUri = null;
gCurrentFolderUri = null;
CommandUpdate_Mail();
document.commandDispatcher.updateCommands('mail-toolbar');
}
function GetCompositeDataSource(command)
@ -326,7 +356,7 @@ function GetCompositeDataSource(command)
function SetNextMessageAfterDelete()
{
gCurrentMessageIsDeleted = true;
gNextMessageViewIndexAfterDelete = gDBView.firstSelected;
}
function SelectFolder(folderUri)
@ -334,15 +364,31 @@ function SelectFolder(folderUri)
gCurrentFolderUri = folderUri;
}
function SelectMessage(messageUri)
{
gCurrentMessageUri = messageUri;
OpenURL(gCurrentMessageUri);
}
function ReloadMessage()
{
OpenURL(gCurrentMessageUri);
gDBView.reloadMessage();
}
function MsgDeleteMessageFromMessageWindow(reallyDelete, fromToolbar)
{
// if from the toolbar, return right away if this is a news message
// only allow cancel from the menu: "Edit | Cancel / Delete Message"
if (fromToolbar)
{
if (isNewsURI(gCurrentFolderUri))
{
// if news, don't delete
return;
}
}
// before we delete
SetNextMessageAfterDelete();
if (reallyDelete)
gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
else
gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
}
// MessageWindowController object (handles commands when one of the trees does not have focus)
@ -365,24 +411,39 @@ var MessageWindowController =
case "cmd_forwardAttachment":
case "cmd_editAsNew":
case "cmd_delete":
case "cmd_killThread":
case "cmd_watchThread":
case "button_delete":
case "cmd_shiftDelete":
case "button_print":
case "cmd_print":
case "cmd_saveAsFile":
case "cmd_saveAsTemplate":
case "cmd_viewPageSource":
case "cmd_reload":
case "cmd_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
case "button_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
case "cmd_getNextNMessages":
case "cmd_find":
case "cmd_findAgain":
case "button_mark":
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markAsFlagged":
case "button_file":
case "cmd_file":
case "cmd_downloadFlagged":
case "cmd_toggleWorkOffline":
case "cmd_nextMsg":
case "button_next":
case "cmd_nextUnreadMsg":
case "cmd_nextFlaggedMsg":
case "cmd_nextUnreadThread":
case "cmd_previousMsg":
case "cmd_previousUnreadMsg":
case "cmd_previousFlaggedMsg":
return true;
default:
return false;
@ -391,8 +452,16 @@ var MessageWindowController =
isCommandEnabled: function(command)
{
var enabled = new Object();
var checkStatus = new Object();
switch ( command )
{
case "cmd_delete":
if (gDBView)
{
gDBView.getCommandStatus(nsMsgViewCommandType.deleteMsg, enabled, checkStatus);
return enabled.value;
}
case "cmd_reply":
case "button_reply":
case "cmd_replySender":
@ -404,36 +473,48 @@ var MessageWindowController =
case "cmd_forwardInline":
case "cmd_forwardAttachment":
case "cmd_editAsNew":
case "cmd_delete":
case "button_delete":
case "cmd_shiftDelete":
case "cmd_print":
case "button_print":
case "cmd_saveAsFile":
case "cmd_saveAsTemplate":
case "cmd_viewPageSource":
case "cmd_reload":
case "cmd_find":
case "cmd_findAgain":
case "button_mark":
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markAsFlagged":
case "button_file":
case "cmd_file":
if ( command == "cmd_delete")
{
if (isNewsURI(gCurrentMessageUri)) {
goSetMenuValue(command, 'valueNewsMessage');
}
else {
goSetMenuValue(command, 'valueMessage');
}
if (isNewsURI(gCurrentMessageUri))
goSetMenuValue(command, 'valueNewsMessage');
else
goSetMenuValue(command, 'valueMessage');
}
return ( gCurrentMessageUri != null);
case "cmd_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
case "button_getNewMessages":
case "cmd_getMsgsForAuthAccounts":
return IsGetNewMessagesEnabled();
case "cmd_getNextNMessages":
return IsGetNextNMessagesEnabled();
case "cmd_toggleWorkOffline":
return true;
case "cmd_nextMsg":
case "button_next":
case "cmd_nextUnreadMsg":
case "cmd_nextUnreadThread":
case "cmd_previousMsg":
case "cmd_previousUnreadMsg":
return true;
default:
return false;
}
@ -441,16 +522,20 @@ var MessageWindowController =
doCommand: function(command)
{
//dump("MessageWindowController.doCommand(" + command + ")\n");
// if the user invoked a key short cut then it is possible that we got here for a command which is
// really disabled. kick out if the command should be disabled.
if (!this.isCommandEnabled(command)) return;
var navigationType = nsMsgNavigationType.nextUnreadMessage;
switch ( command )
{
case "cmd_getNewMessages":
MsgGetMessage();
break;
case "cmd_getMsgsForAuthAccounts":
MsgGetMessagesForAllAuthenticatedAccounts();
break;
case "cmd_getMsgsForAuthAccounts":
MsgGetMessagesForAllAuthenticatedAccounts();
break;
case "cmd_getNextNMessages":
MsgGetNextNMessages();
break;
@ -479,13 +564,13 @@ var MessageWindowController =
MsgEditMessageAsNew();
break;
case "cmd_delete":
MsgDeleteMessage(false, false);
MsgDeleteMessageFromMessageWindow(false, false);
break;
case "cmd_shiftDelete":
MsgDeleteMessage(true, false);
MsgDeleteMessageFromMessageWindow(true, false);
break;
case "button_delete":
MsgDeleteMessage(false, true);
MsgDeleteMessageFromMessageWindow(false, true);
break;
case "cmd_print":
PrintEnginePrint();
@ -508,6 +593,7 @@ var MessageWindowController =
case "cmd_findAgain":
MsgFindAgain();
break;
case "button_mark":
case "cmd_markAsRead":
MsgMarkMsgAsRead(null);
return;
@ -526,6 +612,31 @@ var MessageWindowController =
case "cmd_downloadSelected":
MsgDownloadSelected();
return;
case "cmd_toggleWorkOffline":
MsgToggleWorkOffline();
return;
case "cmd_nextUnreadMsg":
performNavigation(nsMsgNavigationType.nextUnreadMessage);
break;
case "cmd_nextUnreadThread":
performNavigation(nsMsgNavigationType.nextUnreadThread);
break;
case "cmd_nextMsg":
performNavigation(nsMsgNavigationType.nextMessage);
break;
case "cmd_nextFlaggedMsg":
performNavigation(nsMsgNavigationType.nextFlagged);
break;
case "cmd_previousMsg":
performNavigation(nsMsgNavigationType.previousMessage);
break;
case "cmd_previousUnreadMsg":
performNavigation(nsMsgNavigationType.previousUnreadMessage);
break;
case "cmd_previousFlaggedMsg":
performNavigation(nsMsgNavigationType.previousFlagged);
break;
}
},
@ -534,41 +645,24 @@ var MessageWindowController =
}
};
function CommandUpdate_Mail()
function performNavigation(type)
{
goUpdateCommand('cmd_reply');
goUpdateCommand('cmd_replySender');
goUpdateCommand('cmd_replyGroup');
goUpdateCommand('cmd_replyall');
goUpdateCommand('cmd_forward');
goUpdateCommand('cmd_forwardInline');
goUpdateCommand('cmd_forwardAttachment');
goUpdateCommand('button_reply');
goUpdateCommand('button_replyall');
goUpdateCommand('button_forward');
goUpdateCommand('cmd_editAsNew');
goUpdateCommand('cmd_delete');
goUpdateCommand('button_delete');
goUpdateCommand('cmd_shiftDelete');
goUpdateCommand('cmd_print');
goUpdateCommand('cmd_saveAsFile');
goUpdateCommand('cmd_saveAsTemplate');
goUpdateCommand('cmd_viewPageSource');
goUpdateCommand('cmd_reload');
goUpdateCommand('cmd_getNewMessages');
goUpdateCommand('cmd_getMsgsForAuthAccounts');
goUpdateCommand('cmd_getNextNMessages');
goUpdateCommand('cmd_find');
goUpdateCommand('cmd_findAgain');
goUpdateCommand('cmd_markAsRead');
goUpdateCommand('cmd_markThreadAsRead');
goUpdateCommand('cmd_markAllRead');
goUpdateCommand('cmd_markAsFlagged');
goUpdateCommand('cmd_downloadFlagged');
goUpdateCommand('cmd_downloadSelected');
goUpdateCommand('cmd_file');
var resultId = new Object;
var resultIndex = new Object;
var threadIndex = new Object;
gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true /* wrap */);
// if we found something....display it.
if ((resultId.value != -1) && (resultIndex.value != -1))
{
// load the message key
gDBView.loadMessageByMsgKey(resultId.value);
return;
}
// we need to span another folder
CrossFolderNavigation(type, false);
}
function SetupCommandUpdateHandlers()

Просмотреть файл

@ -34,16 +34,16 @@ Rights Reserved.
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:nc="http://home.netscape.com/NC-rdf#"
title="&messengerWindow.title;"
title="&messengerWindow.title;"
titlemodifier="&titleModifier.label;"
titlemenuseparator="&titleSeperator.label;"
onload="OnLoadMessageWindow()"
onunload="OnUnloadMessageWindow()"
align="vertical"
onload="OnLoadMessageWindow()"
onunload="OnUnloadMessageWindow()"
align="vertical"
width="750"
height="500"
persist="width height screenX screenY sizemode"
windowtype="mail:messageWindow">
windowtype="mail:messageWindow">
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
@ -66,14 +66,19 @@ Rights Reserved.
<script type="text/javascript" src="chrome://global/content/nsJSComponentManager.js"/>
<script type="text/javascript" src="chrome://global/content/nsTransferable.js"/>
<script type="text/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<commands id="commands">
<commandset id="CommandUpdate_Mail"
commandupdater="true"
events="focus,tree-select"
oncommandupdate="CommandUpdate_Mail()"/>
</commands>
<commands id="commands">
<commandset id="mailFileMenuItems"/>
<commandset id="mailViewMenuItems"/>
<commandset id="mailEditMenuItems"/>
<commandset id="mailSearchMenuItems"/>
<commandset id="mailGoMenuItems"/>
<commandset id="mailMessageMenuItems"/>
<commandset id="mailToolbarItems"/>
</commands>
<stringbundleset id="stringbundleset"/>
<broadcasterset id="broadcasterset"/>
<keyset id="keyset"/>

Просмотреть файл

@ -72,25 +72,24 @@ Rights Reserved.
<script type="text/javascript" src="chrome://global/content/nsTransferable.js"/>
<script type="text/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<commands id="commands">
<commandset id="CommandUpdate_Mail"
commandupdater="true"
events="focus,folderTree-select,threadTree-select"
oncommandupdate="CommandUpdate_Mail()"/>
<commandset id="ThreadTreeUpdate_Mail"
commandupdater="true"
events="threadTree-select"
oncommandupdate="ThreadTreeUpdate_Mail()"/>
<commandset id="mailFileMenuItems"/>
<commandset id="mailViewMenuItems"/>
<commandset id="mailEditMenuItems"/>
<commandset id="mailSearchMenuItems"/>
<commandset id="mailGoMenuItems"/>
<commandset id="mailMessageMenuItems"/>
<commandset id="mailToolbarItems"/>
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
<commandset id="FocusRingUpdate_Mail"
commandupdater="true"
events="focus"
oncommandupdate="FocusRingUpdate_Mail()"/>
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="undoEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
oncommandupdate="FocusRingUpdate_Mail()"/>
</commands>
<broadcasterset id="broadcasterset"/>
@ -144,7 +143,7 @@ Rights Reserved.
<box id="messagesBox" orient="vertical" flex="1">
<tree id="threadTree" flex="2" persist="height" style="height:0px" context="threadPaneContext" focusring="false"/>
<outliner id="threadOutliner" flex="2" persist="height" style="height:0px" context="threadPaneContext"/>
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
<splitter collapse="after" persist="state" onclick="OnClickThreadAndMessagePaneSplitter()"

Просмотреть файл

@ -22,6 +22,10 @@
* jarrod.k.gray@rose-hulman.edu
*/
// cache these services
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService().QueryInterface(Components.interfaces.nsIRDFService);
var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService().QueryInterface(Components.interfaces.nsIDragService);
var ctrlKeydown = false;
var gSrcCanRename;
@ -31,24 +35,6 @@ function debugDump(msg)
// dump(msg+"\n");
}
function GetDragService()
{
var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService();
if (dragService)
dragService = dragService.QueryInterface(Components.interfaces.nsIDragService);
return dragService;
}
function GetRDFService()
{
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
if (rdf)
rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
return rdf;
}
function DragOverTree(event)
{
if (event.target.localName != "treecell" &&
@ -61,9 +47,6 @@ function DragOverTree(event)
var dragFolder = false;
var flavor =false;
var dragService = GetDragService();
if ( !dragService ) return(false);
dragSession = dragService.getCurrentSession();
if ( !dragSession ) return(false);
@ -78,8 +61,8 @@ function DragOverTree(event)
var targetID = treeItem.getAttribute("id");
var targetNode = RDF.GetResource(targetID, true);
if (!targetNode) return(false);
var targetfolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);
var targetServer = targetfolder.server;
var targetFolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);
var targetServer = targetFolder.server;
trans.addDataFlavor("text/nsmessageOrfolder");
@ -131,15 +114,16 @@ function DragOverTree(event)
debugDump("***NoSelect == true\n");
return(false);
}
var message = sourceNode.QueryInterface(Components.interfaces.nsIMessage);
var sourceFolder = message.msgFolder;
if (sourceFolder == targetfolder)
var hdr = messenger.messageServiceFromURI(sourceID).messageURIToMsgHdr(sourceID);
if (hdr.folder == targetFolder)
return (false);
break;
}
// we should only get here if we are dragging and dropping folders
var sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
var sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var sourceServer = sourcefolder.server;
var sourceFolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var sourceServer = sourceFolder.server;
if (sourceNode == targetNode)
return (false);
@ -147,14 +131,14 @@ function DragOverTree(event)
if (sourceServer != targetServer && targetServer.type == "imap") //don't allow drop on different imap servers.
return (false);
if (targetfolder.URI == sourcefolder.parent.URI) //don't allow immediate child to be dropped to it's parent
if (targetFolder.URI == sourceFolder.parent.URI) //don't allow immediate child to be dropped to it's parent
{
debugDump(targetfolder.URI + "\n");
debugDump(sourcefolder.parent.URI + "\n");
debugDump(targetFolder.URI + "\n");
debugDump(sourceFolder.parent.URI + "\n");
return (false);
}
var isAncestor = sourcefolder.isAncestorOf(targetfolder);
var isAncestor = sourceFolder.isAncestorOf(targetFolder);
if (isAncestor) // don't allow parent to be dropped on its ancestors
return (false);
@ -210,14 +194,10 @@ function BeginDragTree(event, tree, flavor)
return(false);
var database = childWithDatabase.database;
var rdf = GetRDFService();
if ((!rdf) || (!database)) { debugDump("CAN'T GET DATABASE\n"); return(false); }
if ((!RDF) || (!database)) { debugDump("CAN'T GET DATABASE\n"); return(false); }
var dragStarted = false;
var dragService = GetDragService();
if ( !dragService ) return(false);
var transArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
if ( !transArray ) return(false);
@ -281,29 +261,9 @@ function BeginDragFolderTree(event)
}
function BeginDragThreadTree(event)
{
debugDump("BeginDragThreadTree\n");
if (event.target.localName != "treecell" &&
event.target.localName != "treeitem")
return false;
//XXX we rely on a capturer to already have determined which item the mouse was over
//XXX and have set an attribute.
// if the click is on the tree proper, ignore it. We only care about clicks on items.
var tree = GetThreadTree();
return BeginDragTree(event, tree, "text/nsmessageOrfolder");
}
function DropOnFolderTree(event)
{
debugDump("DropOnTree\n");
var RDF = GetRDFService();
if (!RDF) return(false);
var treeRoot = GetFolderTree();
if (!treeRoot) return(false);
@ -335,10 +295,6 @@ function DropOnFolderTree(event)
debugDump("***targetID = " + targetID + "\n");
//make sure target is a folder
var dragService = GetDragService();
if ( !dragService ) return(false);
var dragSession = dragService.getCurrentSession();
if ( !dragSession ) return(false);
@ -347,12 +303,13 @@ function DropOnFolderTree(event)
var list = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
var dropMessage = false;
var dropFolder = false;
var dropMessage = true;
var sourceNode;
var sourceFolder;
var sourceServer;
trans.addDataFlavor("text/nsmessageOrfolder");
var listCount =0;
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
@ -367,32 +324,46 @@ function DropOnFolderTree(event)
var sourceID = dataObj.data.substring(0, len.value);
if (!sourceID) continue;
debugDump(" Node #" + i + ": drop '" + sourceID + "' " + dropAction + " '" + targetID + "'");
debugDump("\n");
debugDump(" Node #" + i + ": drop '" + sourceID + "' " + dropAction + " '" + targetID + "'\n");
var sourceNode = RDF.GetResource(sourceID, true);
if (!sourceNode)
continue;
try
{
var folder = sourceNode.QueryInterface(Components.interfaces.nsIFolder);
if (folder)
dropFolder = true;
sourceNode = RDF.GetResource(sourceID, true);
// only do this for the first object, either they are all messages or they are all folders
if (i == 0) {
try {
sourceFolder = sourceNode.QueryInterface(Components.interfaces.nsIMsgFolder);
if (sourceFolder) {
// we are dropping a folder
dropMessage = false;
}
else {
dropMessage = true;
}
}
catch (ex) {
dropMessage = true;
}
}
catch (ex)
{
dropMessage = true;
else {
if (!dropMessage) {
dump("drag and drop of multiple folders isn't supported\n");
}
}
// Prevent dropping of a node before, after, or on itself
if (sourceNode == targetNode)
if (dropMessage) {
// from the message uri, get the appropriate messenger service
// and then from that service, get the msgDbHdr
list.AppendElement(messenger.messageServiceFromURI(sourceID).messageURIToMsgHdr(sourceID));
}
else {
// Prevent dropping of a node before, after, or on itself
if (sourceNode == targetNode)
continue;
else
listCount ++;
list.AppendElement(sourceNode);
list.AppendElement(sourceNode);
}
}
if (listCount < 1)
if (list.Count() < 1)
return false;
var isSourceNews = false;
@ -400,90 +371,108 @@ function DropOnFolderTree(event)
var targetNode = RDF.GetResource(targetID, true);
if (!targetNode) return(false);
var targetfolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);
var targetServer = targetfolder.server;
var targetFolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);
var targetServer = targetFolder.server;
if (dropMessage)
{
var message = sourceNode.QueryInterface(Components.interfaces.nsIMessage);
var folder = message.msgFolder;
var sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
var sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var sourceServer = sourcefolder.server;
var nextMessage;
var messageTree;
if (dropMessage) {
// fix this, to get the folder from the sourceID. this won't work with multiple 3 panes
sourceFolder = GetThreadPaneFolder();
sourceServer = sourceFolder.server;
if (isSourceNews) //news to pop or imap is always a copy
{
try
{
messenger.CopyMessages(treeDatabase,
sourceResource,
targetNode, list, false);
}
catch(e)
{
dump ( "Exception : CopyMessages \n");
}
try {
if (isSourceNews) {
// news to pop or imap is always a copy
messenger.CopyMessages(sourceFolder, targetFolder, list, false);
}
else {
// fix this, will not work for multiple 3 panes
if (!ctrlKeydown) {
SetNextMessageAfterDelete();
}
messenger.CopyMessages(sourceFolder, targetFolder, list, !ctrlKeydown);
}
}
else
{
//temperary for single mail window, not working when supporting multiple mail windows
if (!ctrlKeydown)
{
messageTree = GetThreadTree();
nextMessage = GetNextMessageAfterDelete(messageTree.selectedItems);
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
}
try
{
messenger.CopyMessages(treeDatabase,
sourceResource,
targetNode, list, !ctrlKeydown);
}
catch(e)
{
gNextMessageAfterDelete = null;
dump ( "Exception : CopyMessages \n");
}
catch (ex) {
dump("failed to copy messages: " + ex + "\n");
}
}
else if (dropFolder)
{
sourceNode = RDF.GetResource(sourceID, true);
folder = sourceNode.QueryInterface(Components.interfaces.nsIFolder);
sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);
sourceServer = sourcefolder.server;
var moveFolder = false;
if (sourceServer == targetServer)
moveFolder = true;
else {
sourceServer = sourceFolder.server;
try
{
messenger.CopyFolders(treeDatabase,targetNode,list,moveFolder);
messenger.CopyFolders(treeDatabase,targetNode,list,(sourceServer == targetServer));
}
catch(e)
catch(ex)
{
dump ("Exception : CopyFolder \n");
dump ("Exception : CopyFolder " + ex + "\n");
}
}
return(false);
}
function DropOnThreadTree(event)
function DropOnThreadPane(event)
{
debugDump("DropOnThreadTree\n");
if (event.target.localName != "treecell" &&
event.target.localName != "treeitem")
return false;
/* you can't drop on the thread pane */
return false;
}
function BeginDragThreadPane(event)
{
debugDump("BeginDragThreadPane\n");
debugDump("event.target.localName = " + event.target.localName + "\n");
if (event.target.localName != "outlinerbody") return false;
var outliner = GetThreadOutliner();
return BeginDragOutliner(event, outliner, "text/nsmessageOrfolder");
}
function BeginDragOutliner(event, outliner, flavor)
{
if (event.target == outliner) {
return(true); // continue propagating the event
}
if (!outliner) {
return(false);
}
var dragStarted = false;
var transArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
if ( !transArray ) return(false);
var selArray = GetSelectedMessages();
var count = selArray.length;
debugDump("selArray.length = " + count + "\n");
for ( var i = 0; i < count; ++i ) {
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if (!trans) return(false);
var genTextData = Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
if (!genTextData) return(false);
trans.addDataFlavor(flavor);
// get id (url)
var id = selArray[i];
genTextData.data = id;
debugDump(" ID #" + i + " = " + id + "\n");
trans.setTransferData ( flavor, genTextData, id.length * 2 ); // doublebyte byte data
// put it into the transferable as an |nsISupports|
var genTrans = trans.QueryInterface(Components.interfaces.nsISupports);
transArray.AppendElement(genTrans);
}
var nsIDragService = Components.interfaces.nsIDragService;
dragService.invokeDragSession ( event.target, transArray, null, nsIDragService.DRAGDROP_ACTION_COPY +
nsIDragService.DRAGDROP_ACTION_MOVE );
dragStarted = true;
return(!dragStarted); // don't propagate the event if a drag has begun
}

Просмотреть файл

@ -22,10 +22,10 @@
var showPerformance = false;
var msgNavigationService;
var gFolderTree;
var gThreadTree;
var gThreadOutliner;
var gMessagePane;
var gMessagePaneFrame;
@ -35,14 +35,15 @@ var gTotalCount = null;
var gCurrentLoadingFolderURI;
var gCurrentFolderToReroot;
var gCurrentLoadingFolderIsThreaded = false;
var gCurrentLoadingFolderSortID ="";
var gCurrentLoadingFolderSortDirection = null;
var gCurrentLoadingFolderViewType = "";
var gCurrentLoadingFolderSortType = 0;
var gCurrentLoadingFolderSortOrder = 0;
var gCurrentLoadingFolderViewType = 0;
var gCurrentLoadingFolderViewFlags = 0;
var gCurrentDisplayedMessage = null;
var gNextMessageAfterDelete = null;
var gNextMessageAfterLoad = false;
var gNextMessageViewIndexAfterDelete = -1;
var gActiveThreadPaneSortColumn = "";
@ -55,7 +56,6 @@ var gBatching = false;
var gDisplayStartupPage = false;
// the folderListener object
var folderListener = {
OnItemAdded: function(parentItem, item, view) {},
@ -66,8 +66,11 @@ var folderListener = {
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
{
var currentLoadedFolder = GetThreadTreeFolder();
var currentURI = currentLoadedFolder.getAttribute('ref');
// fix me!!!
/*
var currentLoadedFolder = GetThreadPaneFolder();
var currentURI = currentLoadedFolder.URI;
//if we don't have a folder loaded, don't bother.
if(currentURI)
@ -87,8 +90,9 @@ var folderListener = {
}
}
}
}
}
}
*/
},
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
@ -100,7 +104,6 @@ var folderListener = {
var eventType = event.GetUnicode();
if (eventType == "FolderLoaded") {
if(folder)
{
var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
@ -116,35 +119,32 @@ var folderListener = {
if(msgFolder)
{
msgFolder.endFolderLoading();
RerootFolder(uri, msgFolder, gCurrentLoadingFolderIsThreaded, gCurrentLoadingFolderSortID, gCurrentLoadingFolderSortDirection, gCurrentLoadingFolderViewType);
RerootFolder(uri, msgFolder, gCurrentLoadingFolderViewType, gCurrentLoadingFolderViewFlags, gCurrentLoadingFolderSortType, gCurrentLoadingFolderSortOrder);
gIsEditableMsgFolder = IsSpecialFolder(msgFolder, [ "Drafts" ]);
gCurrentLoadingFolderIsThreaded = false;
gCurrentLoadingFolderSortID = "";
gCurrentLoadingFolderSortDirection = null;
gCurrentLoadingFolderViewType = "";
gCurrentLoadingFolderSortType = 0;
gCurrentLoadingFolderSortOrder = 0;
gCurrentLoadingFolderViewType = 0;
gCurrentLoadingFolderViewFlags = 0;
SetFocusThreadPane();
if (gNextMessageAfterLoad) {
gNextMessageAfterLoad = false;
SetFocusThreadPane();
if (gNextMessageAfterLoad)
{
gNextMessageAfterLoad = false;
GoNextMessage(navigateUnread, true);
msgNavigationService.EnsureDocumentIsLoaded(document);
PositionThreadPane();
}
// should scroll to new here.
PositionThreadPane();
}
}
}
if(uri == gCurrentLoadingFolderURI)
{
gCurrentLoadingFolderURI = "";
//Now let's select the first new message if there is one
var beforeScrollToNew;
var beforeScrollToNew;
if(showPerformance) {
beforeScrollToNew = new Date();
}
msgNavigationService.EnsureDocumentIsLoaded(document);
ScrollToFirstNewMessage();
if(showPerformance) {
@ -176,53 +176,77 @@ function HandleDeleteOrMoveMsgFailed(folder)
if(IsCurrentLoadedFolder(folder)) {
if(gNextMessageAfterDelete) {
gNextMessageAfterDelete = null;
gNextMessageViewIndexAfterDelete = -1;
}
}
if (gBatching) {
gBatching = false;
var threadTree = GetThreadTree();
//threadTree.treeBoxObject.endBatch();
//dump("XXX end tree batch (delete or move failed)\n");
}
ThreadPaneSelectionChange(true);
// fix me???
// ThreadPaneSelectionChange(true);
}
function HandleDeleteOrMoveMsgCompleted(folder)
{
var threadTree = GetThreadTree();
if(IsCurrentLoadedFolder(folder))
{
msgNavigationService.EnsureDocumentIsLoaded(document);
if(gNextMessageAfterDelete)
// if(IsCurrentLoadedFolder(folder)) ### rewrite/implement this
// {
if(gNextMessageViewIndexAfterDelete != -1)
{
var nextMessage = document.getElementById(gNextMessageAfterDelete);
gNextMessageAfterDelete = null;
SelectNextMessage(nextMessage);
if(threadTree)
threadTree.ensureElementIsVisible(nextMessage);
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
var outlinerSelection = outlinerView.selection;
viewSize = outlinerView.rowCount;
dump("view size = " + viewSize + "\n");
if (gNextMessageViewIndexAfterDelete >= viewSize)
{
if (viewSize > 0)
gNextMessageViewIndexAfterDelete = viewSize - 1;
else
gNextMessageViewIndexAfterDelete = -1;
}
// if we are about to set the selection with a new element then DON'T clear
// the selection then add the next message to select. This just generates
// an extra round of command updating notifications that we are trying to
// optimize away.
if (gNextMessageViewIndexAfterDelete != -1) {
outlinerSelection.select(gNextMessageViewIndexAfterDelete);
// since gNextMessageViewIndexAfterDelete probably has the same value
// as the last index we had selected, the outliner isn't generating a new
// selectionChanged notification for the outliner view. So we aren't loading the
// next message. to fix this, force the selection changed update.
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
if (outlinerView)
outlinerView.selectionChanged();
EnsureRowInThreadOutlinerIsVisible(gNextMessageViewIndexAfterDelete);
}
else
outlinerSelection.clearSelection(); /* clear selection in either case */
gNextMessageViewIndexAfterDelete = -1;
}
/*
//if there's nothing to select then see if the tree has any messages.
//if not, then clear the message pane.
else
{
var tree = GetThreadTree();
var topmost = msgNavigationService.FindFirstMessage(tree);
// var topmost = msgNavigationService.FindFirstMessage(tree);
if(!topmost)
ClearMessagePane()
}
}
// }
if (gBatching) {
gBatching = false;
//threadTree.treeBoxObject.endBatch();
//dump("XXX end tree batch (delete or move succeeded)\n");
}
ThreadPaneSelectionChange(true);
*/
}
@ -235,8 +259,8 @@ function IsCurrentLoadedFolder(folder)
if(folderResource)
{
var folderURI = folderResource.Value;
var currentLoadedFolder = GetThreadTreeFolder();
var currentURI = currentLoadedFolder.getAttribute('ref');
var currentLoadedFolder = GetThreadPaneFolder();
var currentURI = currentLoadedFolder.URI;
return(currentURI == folderURI);
}
}
@ -343,8 +367,6 @@ function OnUnloadMessenger()
function Create3PaneGlobals()
{
msgNavigationService = Components.classes['@mozilla.org/messenger/msgviewnavigationservice;1'].getService();
msgNavigationService= msgNavigationService.QueryInterface(Components.interfaces.nsIMsgViewNavigationService);
}
@ -436,7 +458,6 @@ function loadStartFolder(initialUri)
startFolderUri = resource.Value;
}
}
msgNavigationService.EnsureDocumentIsLoaded(document);
var startFolder = document.getElementById(startFolderUri);
@ -534,9 +555,9 @@ function AddToSession()
function InitPanes()
{
var threadTree = GetThreadTree();
if(threadTree);
OnLoadThreadPane(threadTree);
// var threadTree = GetThreadTree();
// if(threadTree);
// OnLoadThreadPane(threadTree);
var folderTree = GetFolderTree();
if(folderTree)
@ -582,15 +603,6 @@ function GetFolderDatasource()
function OnLoadThreadPane(threadTree)
{
gThreadTree = threadTree;
//Sort by date by default
//Add message data source
messageDataSource = messageDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
threadTree.database.AddDataSource(messageDataSource);
//FIX ME: Tempory patch for bug 24182
//ShowThreads(false);
setTimeout("ShowThreads(false);", 0);
}
@ -673,36 +685,16 @@ function FindMessenger()
return messenger;
}
function RefreshThreadTreeView()
{
SetBusyCursor(window, true);
var selection = SaveThreadPaneSelection();
var currentFolder = GetThreadTreeFolder();
var currentFolderID = currentFolder.getAttribute('ref');
ClearThreadTreeSelection();
currentFolder.setAttribute('ref', currentFolderID);
RestoreThreadPaneSelection(selection);
SetBusyCursor(window, false);
}
function ClearThreadTreeSelection()
{
var tree = GetThreadTree();
if(tree)
{
tree.clearItemSelection();
}
// mscott --> implement me
}
function ClearMessagePane()
{
if(gHaveLoadedMessage)
{
gHaveLoadedMessage = false;
gCurrentDisplayedMessage = null;
if (window.frames["messagepane"].location != "about:blank")
window.frames["messagepane"].location = "about:blank";
@ -760,7 +752,7 @@ function FolderPaneOnClick(event)
if (folder) {
var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
if (imapFolder) {
imapFolder.PerformExpand(msgWindow);
imapFolder.performExpand(msgWindow);
}
}
}
@ -859,87 +851,58 @@ function GetSelectedMsgFolders()
return folderArray;
}
function GetSelectedMessage(index)
function GetFirstSelectedMessage()
{
var threadTree = GetThreadTree();
var selectedMessages = threadTree.selectedItems;
var numMessages = selectedMessages.length;
if(index <0 || index > (numMessages - 1))
return null;
var messageNode = selectedMessages[index];
var messageUri = messageNode.getAttribute("id");
var messageResource = RDF.GetResource(messageUri);
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
return message;
try {
return gDBView.URIForFirstSelectedMessage;
}
catch (ex) {
return null;
}
}
function GetNumSelectedMessages()
function GetSelectedIndices(dbView)
{
var threadTree = GetThreadTree();
var selectedMessages = threadTree.selectedItems;
var numMessages = selectedMessages.length;
return numMessages;
try {
var indicesArray = {};
var length = {};
dbView.getIndicesForSelection(indicesArray,length);
return indicesArray.value;
}
catch (ex) {
dump("ex = " + ex + "\n");
return null;
}
}
function GetSelectedMessages()
{
var threadTree = GetThreadTree();
var selectedMessages = threadTree.selectedItems;
var numMessages = selectedMessages.length;
var messageArray = new Array(numMessages);
for(var i = 0; i < numMessages; i++)
{
var messageNode = selectedMessages[i];
var messageUri = messageNode.getAttribute("id");
var messageResource = RDF.GetResource(messageUri);
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
if(message)
{
messageArray[i] = message;
}
}
return messageArray;
try {
var messageArray = {};
var length = {};
gDBView.getURIsForSelection(messageArray,length);
return messageArray.value;
}
catch (ex) {
dump("ex = " + ex + "\n");
return null;
}
}
function GetLoadedMsgFolder()
{
var loadedFolder = GetThreadTreeFolder();
var folderUri = loadedFolder.getAttribute("ref");
if(folderUri && folderUri != "" && folderUri !="null")
{
var folderResource = RDF.GetResource(folderUri);
if(folderResource)
{
try {
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
return msgFolder;
}
catch (ex) {
dump(ex + "\n");
dump("we know about this. see bug #35591\n");
}
}
}
return null;
if (!gDBView) return null;
return gDBView.msgFolder;
}
function GetLoadedMessage()
{
if(gCurrentDisplayedMessage)
{
var messageResource = RDF.GetResource(gCurrentDisplayedMessage);
if(messageResource)
{
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
return message;
}
}
return null;
try {
return gDBView.URIForFirstSelectedMessage;
}
catch (ex) {
return null;
}
}
//Clear everything related to the current message. called after load start page.
@ -950,19 +913,10 @@ function ClearMessageSelection()
function GetCompositeDataSource(command)
{
if(command == "GetNewMessages" || command == "DeleteMessages" || command == "Copy" ||
command == "Move" || command == "NewFolder" || command == "MarkAllMessagesRead" ||
command == "DownloadFlagged")
if (command == "GetNewMessages" || command == "NewFolder" || command == "MarkAllMessagesRead")
{
return GetFolderDatasource();
}
else if(command == "MarkMessageRead" ||
command == "MarkMessageFlagged" || command == "MarkThreadAsRead" ||
command == "DownloadSelected" || command == "MessageProperty")
{
var threadTree = GetThreadTree();
return threadTree.database;
}
return null;
@ -970,20 +924,8 @@ function GetCompositeDataSource(command)
function SetNextMessageAfterDelete()
{
var tree = GetThreadTree();
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
// use the magic number of 3 to determine if we want to batch or not.
if (!gBatching && (GetNumSelectedMessages() > 3)) {
gBatching = true;
//tree.treeBoxObject.beginBatch();
//dump("XXX begin tree batch\n");
}
dump("setting next msg view index after delete to " + gDBView.firstSelected + "\n");
gNextMessageViewIndexAfterDelete = gDBView.firstSelected;
}
function SelectFolder(folderUri)
@ -996,22 +938,15 @@ function SelectFolder(folderUri)
function SelectMessage(messageUri)
{
var tree = GetThreadTree();
var treeitem = document.getElementById(messageUri);
if(tree && treeitem)
ChangeSelection(tree, treeitem);
dump("fix this or remove this\n");
// this isn't going to work anymore
}
function ReloadMessage()
{
var msgToLoad = gCurrentDisplayedMessage;
//null it out so it will work.
gCurrentDisplayedMessage = null;
LoadMessageByUri(msgToLoad);
gDBView.reloadMessage();
}
function SetBusyCursor(window, enable)
{
if(enable)
@ -1025,3 +960,8 @@ function SetBusyCursor(window, enable)
SetBusyCursor(window.frames[i], enable);
}
}
function GetDBView()
{
return gDBView;
}

Просмотреть файл

@ -22,12 +22,6 @@
//NOTE: gMessengerBundle must be defined and set or this Overlay won't work
// These are the types of navigation you can do
var navigateAny=0;
var navigateUnread = 1;
var navigateFlagged = 2;
var navigateNew = 3;
var commonDialogs = Components.classes["@mozilla.org/appshell/commonDialogs;1"].getService();
commonDialogs = commonDialogs.QueryInterface(Components.interfaces.nsICommonDialogs);
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
@ -80,216 +74,10 @@ function FindNextFolder(originalFolderURI)
return null;
}
/*GoNextMessage finds the message that matches criteria and selects it.
nextFunction is the function that will be used to detertime if a message matches criteria.
It must take a node and return a boolean.
nextResourceFunction is the function that will be used to determine if a message in the form of a resource
matches criteria. Takes a resource and returns a boolean
nextThreadFunction is an optional function that can be used to optimize whether or not a thread will have a
message that matches the criteria. Takes the top level message in the form of a node and returns a boolean.
startFromBeginning is a boolean that states whether or not we should start looking at the beginning
if we reach the end
*/
function GoNextMessage(type, startFromBeginning )
{
var beforeGoNextMessage;
if (showPerformance) {
beforeGoNextMessage = new Date();
}
var tree = GetThreadTree();
var selArray = tree.selectedItems;
var length = selArray.length;
if ( selArray && ((length == 0) || (length == 1)) )
{
var currentMessage;
if(length == 0)
currentMessage = null;
else
currentMessage = selArray[0];
var nextMessage = msgNavigationService.FindNextMessage(type, tree, currentMessage, RDF, document, startFromBeginning, messageView.showThreads);
//Only change the selection if there's a valid nextMessage
if(nextMessage && (nextMessage != currentMessage)) {
ChangeSelection(tree, nextMessage);
}
else if (type == navigateUnread) {
var treeFolder = GetThreadTreeFolder();
var originalFolderURI = treeFolder.getAttribute('ref');
var nextFolderURI = null;
var done = false;
var startAtURI = originalFolderURI;
var i = 0;
var allServers = accountManager.allServers;
var numServers = allServers.Count();
var nextMode = pref.GetIntPref("mailnews.nav_crosses_folders");
// 0: "next" goes to the next folder, without prompting
// 1: "next" goes to the next folder, and prompts (the default)
// 2: "next" does nothing when there are no unread messages
// not crossing folders, don't find next
if (nextMode == 2)
done=true;
// todo:
// this will search the originalFolderURI server twice
// prevent that.
while (!done) {
dump("start looking at " + startAtURI + "\n");
nextFolderURI = FindNextFolder(startAtURI);
if (!nextFolderURI) {
if (i == numServers) {
// no more servers, we're done
done = true;
}
else {
// get the uri for the next server and start there
startAtURI = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer).serverURI;
i++;
}
}
else {
// got a folder with unread messages, start with it
done = true;
}
}
if (nextFolderURI && (originalFolderURI != nextFolderURI)) {
var nextFolderResource = RDF.GetResource(nextFolderURI);
var nextFolder = nextFolderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
switch (nextMode) {
case 0:
// do this unconditionally
gNextMessageAfterLoad = true;
SelectFolder(nextFolderURI);
break;
case 1:
var promptText = gMessengerBundle.getFormattedString("advanceNextPrompt",
[ nextFolder.name ]);
if (commonDialogs.Confirm(window, promptText, promptText)) {
gNextMessageAfterLoad = true;
SelectFolder(nextFolderURI);
}
break;
default:
dump("huh?");
}
}
}
}
if (showPerformance) {
var afterGoNextMessage = new Date();
var timeToGetNext = (afterGoNextMessage.getTime() - beforeGoNextMessage.getTime())/1000;
dump("time to GoNextMessage is " + timeToGetNext + "seconds\n");
}
}
/*GoPreviousMessage finds the message that matches criteria and selects it.
previousFunction is the function that will be used to detertime if a message matches criteria.
It must take a node and return a boolean.
startFromEnd is a boolean that states whether or not we should start looking at the end
if we reach the beginning
*/
function GoPreviousMessage(type, startFromEnd)
{
var tree = GetThreadTree();
var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) )
{
var currentMessage = selArray[0];
var previousMessage = msgNavigationService.FindPreviousMessage(type, tree, currentMessage, RDF, document, startFromEnd, messageView.showThreads);
//Only change selection if there's a valid previous message.
if(previousMessage && (previousMessage != currentMessage))
ChangeSelection(tree, previousMessage);
}
}
// type is the the type of the next thread we are looking for.
// startFromBeginning is true if we should start looking from the beginning after we get to the end of the thread pane.
// gotoNextInThread is true if once we find an unrad thread we should select the first message in that thread that fits criteria
function GoNextThread(type, startFromBeginning, gotoNextInThread)
{
if(messageView.showThreads)
{
var tree = GetThreadTree();
var selArray = tree.selectedItems;
var length = selArray.length;
if ( selArray && ((length == 0) || (length == 1)) )
{
var currentMessage;
if(length == 0)
currentMessage = null;
else
currentMessage = selArray[0];
var nextMessage;
var currentTopMessage;
var checkCurrentTopMessage;
//Need to get the parent message for the current selection to begin to find thread
if(currentMessage)
{
//need to find its top level message and we don't want it to be checked for criteria
currentTopMessage = FindTopLevelMessage(currentMessage);
checkCurrentTopMessage = false;
}
else
{
//currentTopmessage is the first one in the tree and we want it to be checked for criteria.
currentTopMessage = msgNavigationService.FindFirstMessage(tree);
checkCurrentTopMessage = true;
}
var nextTopMessage = msgNavigationService.FindNextThread(type, tree, currentTopMessage, RDF, document, startFromBeginning, checkCurrentTopMessage);
var changeSelection = (nextTopMessage != null && ((currentTopMessage != nextTopMessage) || checkCurrentTopMessage));
if(changeSelection)
{
if(gotoNextInThread)
{
nextMessage = msgNavigationService.FindNextInThread(type, tree, nextTopMessage, RDF, document);
ChangeSelection(tree, nextMessage);
}
else
ChangeSelection(tree, nextTopMessage);
}
}
}
}
function FindTopLevelMessage(startMessage)
{
var currentTop = startMessage;
var parent = startMessage.parentNode.parentNode;
while(parent.localName == 'treeitem')
{
currentTop = parent;
parent = parent.parentNode.parentNode;
}
return currentTop;
}
function ScrollToFirstNewMessage()
{
dump("XXX ScrollToFirstNewMessage needs to be rewritten.\n");
/*
var tree = GetThreadTree();
var treeFolder = GetThreadTreeFolder();
@ -310,7 +98,7 @@ function ScrollToFirstNewMessage()
var topElement = document.getElementById(topLevelURI);
if(topElement)
{
msgNavigationService.OpenTreeitemAndDescendants(topElement);
// msgNavigationService.OpenTreeitemAndDescendants(topElement);
}
}
@ -324,6 +112,7 @@ function ScrollToFirstNewMessage()
tree.ensureElementIsVisible(messageElement);
}
}
*/
}
function GetTopLevelMessageForMessage(message, folder)
@ -342,3 +131,123 @@ function GetTopLevelMessageForMessage(message, folder)
}
function CrossFolderNavigation (type, supportsFolderPane )
{
if (type != nsMsgNavigationType.nextUnreadMessage)
{
// only do cross folder navigation for "next unread message"
return nsnull;
}
var nextMode = pref.GetIntPref("mailnews.nav_crosses_folders");
// 0: "next" goes to the next folder, without prompting
// 1: "next" goes to the next folder, and prompts (the default)
// 2: "next" does nothing when there are no unread messages
// not crossing folders, don't find next
if (nextMode == 2) return;
var originalFolderURI = gDBView.msgFolder.URI;
var nextFolderURI = null;
var done = false;
var startAtURI = originalFolderURI;
var i = 0;
var allServers = accountManager.allServers;
var numServers = allServers.Count();
// XXX fix this
// this will search the originalFolderURI server twice
while (!done)
{
dump("start looking at " + startAtURI + "\n");
nextFolderURI = FindNextFolder(startAtURI);
if (!nextFolderURI)
{
if (i == numServers)
{
// no more servers, we're done
done = true;
}
else
{
// get the uri for the next server and start there
startAtURI = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer).serverURI;
i++;
}
}
else
{
// got a folder with unread messages, start with it
done = true;
}
}
if (nextFolderURI && (originalFolderURI != nextFolderURI))
{
var nextFolderResource = RDF.GetResource(nextFolderURI);
var nextFolder = nextFolderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
switch (nextMode)
{
case 0:
// do this unconditionally
gNextMessageAfterLoad = true;
if (supportsFolderPane)
SelectFolder(nextFolderURI);
dump("XXX we need code to select the correct type of message, after we load the folder\n");
break;
case 1:
var promptText = gMessengerBundle.formatStringFromName("advanceNextPrompt", [ nextFolder.name ], 1);
if (commonDialogs.Confirm(window, promptText, promptText)) {
gNextMessageAfterLoad = true;
if (supportsFolderPane)
SelectFolder(nextFolderURI);
dump("XXX we need code to select the correct type of message, after we load the folder\n");
}
break;
default:
dump("huh?");
break;
}
}
return nextFolderURI;
}
function GoNextMessage(type, startFromBeginning)
{
try {
dump("XXX GoNextMessage(" + type + "," + startFromBeginning + ")\n");
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
var outlinerSelection = outlinerView.selection;
var currentIndex = outlinerSelection.currentIndex;
dump("XXX outliner selection = " + outlinerSelection + "\n");
dump("XXX current Index = " + currentIndex + "\n");
var status = gDBView.navigateStatus(type);
dump("XXX status = " + status + "\n");
var resultId = new Object;
var resultIndex = new Object;
var threadIndex = new Object;
gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true /* wrap */);
dump("XXX resultId = " + resultId.value + "\n");
dump("XXX resultIndex = " + resultIndex.value + "\n");
// only scroll and select if we found something
if ((resultId.value != -1) && (resultIndex.value != -1)) {
outlinerSelection.select(resultIndex.value);
EnsureRowInThreadOutlinerIsVisible(resultIndex.value);
return;
}
CrossFolderNavigation(type, true);
}
catch (ex) {
dump("XXX ex = " + ex + "\n");
}
}

Просмотреть файл

@ -19,59 +19,100 @@
*/
var gLastMessageUriToLoad = null;
var gThreadPaneCommandUpdater = null;
function ThreadPaneOnClick(event)
{
// we are already handling marking as read and flagging
// in nsMsgDBView.cpp
// so all we need to worry about here is double clicks
// and column header.
//
// we get in here for clicks on the "outlinercol" (headers)
// and the "scrollbarbutton" (scrollbar buttons)
// we don't want those events to cause a "double click"
var t = event.originalTarget;
if (t.localName != "treecell" &&
t.localName != "treeitem" &&
t.localName != "image")
return;
// fix for #48424. bail out of here when the user is
// clicking on the column headers
if (t.localName == "treecell") {
if (t.parentNode && (t.parentNode.getAttribute("id") == "headRow")) {
return;
}
if (t.localName == "outlinercol") {
HandleColumnClick(t.id);
}
var targetclass = "";
if (t.localName == "image" && (t.getAttribute('twisty') != 'true'))
targetclass = t.parentNode.getAttribute('class');
//dump('targetclass = ' + targetclass + '\n');
if(targetclass.indexOf('unreadcol') != -1)
{
ToggleMessageRead(t.parentNode.parentNode.parentNode);
}
if(targetclass.indexOf('flagcol') != -1)
{
ToggleMessageFlagged(t.parentNode.parentNode.parentNode);
}
else if (t.getAttribute('twisty') == 'true') {
// The twisty is nested three below the treeitem:
// <treeitem>
// <treerow>
// <treecell>
// <button class="tree-cell-twisty"> <!-- anonymous -->
var treeitem = t.parentNode.parentNode.parentNode;
var open = treeitem.getAttribute('open');
if(open == "true")
{
//open all of the children of the treeitem
msgNavigationService.OpenTreeitemAndDescendants(treeitem);
}
else if (event.detail == 2 && t.localName == "outlinerbody") {
ThreadPaneDoubleClick();
}
else if(event.detail == 2)
{
ThreadPaneDoubleClick();
}
}
function SetHiddenAttributeOnThreadOnlyColumns(value)
{
// todo, cache these?
var totalCol = document.getElementById("totalCol");
var unreadCol = document.getElementById("unreadCol");
totalCol.setAttribute("hidden",value);
unreadCol.setAttribute("hidden",value);
}
function nsMsgDBViewCommandUpdater()
{}
nsMsgDBViewCommandUpdater.prototype =
{
updateCommandStatus : function()
{
// the back end is smart and is only telling us to update command status
// when the # of items in the selection has actually changed.
document.commandDispatcher.updateCommands('mail-toolbar');
},
displayMessageChanged : function(aFolder, aSubject)
{
setTitleFromFolder(aFolder, aSubject);
gHaveLoadedMessage = true;
},
QueryInterface : function(iid)
{
if(iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater))
return this;
throw Components.results.NS_NOINTERFACE;
return null;
}
}
function HandleColumnClick(columnID)
{
dump("XXX HandleColumnClick()\n");
// if they click on the "threadCol", we need to show the threaded-only columns
if ((columnID[0] == 't') && (columnID[1] == 'h')) {
SetHiddenAttributeOnThreadOnlyColumns(""); // this will show them
}
else {
SetHiddenAttributeOnThreadOnlyColumns("true"); // this will hide them
}
dump("fix UpdateSortMenu()\n");
//UpdateSortMenu(columnID);
ShowAppropriateColumns();
PersistViewAttributesOnFolder();
}
function PersistViewAttributesOnFolder()
{
var folder = GetSelectedFolder();
if (folder) {
dump("XXX persist: " + gDBView.viewType + "," + gDBView.viewFlags + "," + gDBView.sortType + "," + gDBView.sortOrder + "\n");
folder.setAttribute("viewType", gDBView.viewType);
folder.setAttribute("viewFlags", gDBView.viewFlags);
folder.setAttribute("sortType", gDBView.sortType);
folder.setAttribute("sortOrder", gDBView.sortOrder);
}
}
function MsgComposeDraftMessage()
{
@ -81,213 +122,153 @@ function MsgComposeDraftMessage()
ComposeMessage(msgComposeType.Draft, msgComposeFormat.Default, loadedFolder, messageArray);
}
/* keep in sync with nsMsgFolderFlags.h */
var MSG_FOLDER_FLAG_TRASH = 0x0100;
var MSG_FOLDER_FLAG_DRAFTS = 0x0400;
var MSG_FOLDER_FLAG_TEMPLATES = 0x400000;
function ThreadPaneDoubleClick()
{
var loadedFolder;
var messageArray;
var messageUri;
if(IsSpecialFolderSelected("Drafts"))
{
if (IsSpecialFolderSelected(MSG_FOLDER_FLAG_DRAFTS)) {
MsgComposeDraftMessage();
}
else if(IsSpecialFolderSelected("Templates"))
{
else if(IsSpecialFolderSelected(MSG_FOLDER_FLAG_TEMPLATES)) {
loadedFolder = GetLoadedMsgFolder();
messageArray = GetSelectedMessages();
ComposeMessage(msgComposeType.Template, msgComposeFormat.Default, loadedFolder, messageArray);
}
else
{
else {
MsgOpenSelectedMessages();
}
}
function ThreadPaneKeyPress(event)
{
if (event.keyCode == 13)
ThreadPaneDoubleClick();
return;
}
function MsgSortByDate()
{
SortThreadPane('DateColumn', 'http://home.netscape.com/NC-rdf#Date', null, true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byDate);
}
function MsgSortBySender()
{
SortThreadPane('AuthorColumn', 'http://home.netscape.com/NC-rdf#Sender', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byAuthor);
}
function MsgSortByRecipient()
{
SortThreadPane('AuthorColumn', 'http://home.netscape.com/NC-rdf#Recipient', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byRecipient);
}
function MsgSortByStatus()
{
SortThreadPane('StatusColumn', 'http://home.netscape.com/NC-rdf#Status', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byStatus);
}
function MsgSortBySubject()
{
SortThreadPane('SubjectColumn', 'http://home.netscape.com/NC-rdf#Subject', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.bySubject);
}
function MsgSortByFlagged()
{
SortThreadPane('FlaggedButtonColumn', 'http://home.netscape.com/NC-rdf#Flagged', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byFlagged);
}
function MsgSortByPriority()
{
SortThreadPane('PriorityColumn', 'http://home.netscape.com/NC-rdf#Priority', 'http://home.netscape.com/NC-rdf#Date',true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byPriority);
}
function MsgSortBySize()
{
SortThreadPane('MemoryColumn', 'http://home.netscape.com/NC-rdf#Size', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.bySize);
}
function MsgSortByLines()
{
SortThreadPane('MemoryColumn', 'http://home.netscape.com/NC-rdf#Lines', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
dump("XXX fix this\n");
//MsgSortThreadPane(nsMsgViewSortType.byLines);
}
function MsgSortByUnread()
{
SortThreadPane('UnreadColumn', 'http://home.netscape.com/NC-rdf#TotalUnreadMessages','http://home.netscape.com/NC-rdf#Date', true, null, true);
MsgSortThreadPane(nsMsgViewSortType.byUnread);
}
function MsgSortByOrderReceived()
{
SortThreadPane('OrderReceivedColumn', 'http://home.netscape.com/NC-rdf#OrderReceived','http://home.netscape.com/NC-rdf#Date', true, null, true);
}
function MsgSortByRead()
{
SortThreadPane('UnreadButtonColumn', 'http://home.netscape.com/NC-rdf#IsUnread','http://home.netscape.com/NC-rdf#Date', true, null,true);
MsgSortThreadPane(nsMsgViewSortType.byId);
}
function MsgSortByTotal()
{
SortThreadPane('TotalColumn', 'http://home.netscape.com/NC-rdf#TotalMessages', 'http://home.netscape.com/NC-rdf#Date', true, null, true);
dump("XXX fix this\n");
//MsgSortThreadPane(nsMsgViewSortType.byTotal);
}
function MsgSortByThread()
{
ChangeThreadView()
MsgSortThreadPane(nsMsgViewSortType.byThread);
}
function ChangeThreadView()
function MsgSortThreadPane(sortType)
{
var folder = GetSelectedFolder();
gDBView.sort(sortType, nsMsgViewSortOrder.ascending);
var threadColumn = document.getElementById('ThreadColumnHeader');
if(threadColumn)
{
var currentView = threadColumn.getAttribute('currentView');
if(currentView== 'threaded')
{
ShowThreads(false);
if(folder)
folder.setAttribute('threaded', "false");
SetTemplateTreeItemOpen(false);
}
else if(currentView == 'unthreaded')
{
ShowThreads(true);
if(folder)
folder.setAttribute('threaded', "true");
}
RefreshThreadTreeView();
}
ShowAppropriateColumns();
PersistViewAttributesOnFolder();
}
function IsSpecialFolderSelected(folderName)
function IsSpecialFolderSelected(flags)
{
var selectedFolder = GetThreadTreeFolder();
var id = selectedFolder.getAttribute('ref');
var folderResource = RDF.GetResource(id);
if(!folderResource)
return false;
var selectedFolder = GetThreadPaneFolder();
if (!selectedFolder) return false;
var db = GetFolderDatasource();
var property =
RDF.GetResource('http://home.netscape.com/NC-rdf#SpecialFolder');
if (!property) return false;
var result = db.GetTarget(folderResource, property , true);
if (!result) return false;
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (!result) return false;
if(result.Value == folderName)
return true;
return false;
}
//Called when selection changes in the thread pane.
function ThreadPaneSelectionChange(fromDeleteOrMoveHandler)
{
// we are batching. bail out, we'll be back when the batch is over
if (gBatching) return;
var collapsed = IsThreadAndMessagePaneSplitterCollapsed();
var tree = GetThreadTree();
var selectedMessages = tree.selectedItems;
var numSelected = selectedMessages.length;
var messageUriToLoad = null;
if (!gNextMessageAfterDelete && selectedMessages && (numSelected == 1) ) {
messageUriToLoad = selectedMessages[0].getAttribute('id');
if ((selectedFolder.flags & flags) == 0) {
return false;
}
else {
return true;
}
}
// if the message pane isn't collapsed, and we have a message to load
// go ahead and load the message
if (!collapsed && messageUriToLoad) {
LoadMessageByUri(messageUriToLoad);
}
function GetThreadOutliner()
{
if (gThreadOutliner) return gThreadOutliner;
gThreadOutliner = document.getElementById('threadOutliner');
return gThreadOutliner;
}
// if gNextMessageAfterDelete is true, we can skip updating the commands because
// we'll be coming back to load that message, and we'll update the commands then
//
// if fromDeleteOrMoveHandler is true, we are calling ThreadPaneSelectionChange after handling
// a message delete or message move, so we might need to update the commands. (see below)
//
// if gCurrentLoadingFolderURI is non null, we are loading a folder, so we need to update the commands
//
// if messageUriToLoad is non null, we are loading a message, so we might need to update commmands. (see below)
if (!gNextMessageAfterDelete && (gCurrentLoadingFolderURI || fromDeleteOrMoveHandler || messageUriToLoad)) {
// if we are moving or deleting, we'll come in here twice. once to load the message and once when
// we are done moving or deleting. when we loaded the message the first time, we called updateCommands().
// there is no need to do it again.
if (fromDeleteOrMoveHandler && messageUriToLoad && (messageUriToLoad == gLastMessageUriToLoad)) {
// skip the call to updateCommands()
}
else {
document.commandDispatcher.updateCommands('threadTree-select');
}
}
function GetThreadPaneFolder()
{
try {
return gDBView.msgFolder;
}
catch (ex) {
return null;
}
}
//remember the last message we loaded
gLastMessageUriToLoad = messageUriToLoad;
function EnsureRowInThreadOutlinerIsVisible(index)
{
var outliner = GetThreadOutliner();
outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).ensureRowIsVisible(index);
}
function GetThreadTree()
{
if (gThreadTree) return gThreadTree;
var threadTree = document.getElementById('threadTree');
gThreadTree = threadTree;
return threadTree;
dump("GetThreadTree, fix (or remove?) this\n");
}
function GetThreadTreeFolder()
function GetThreadTreeFolder()
{
var tree = GetThreadTree();
return tree;
dump("GetThreadTreeFolder, fix (or remove?) this\n");
}

Просмотреть файл

@ -31,99 +31,31 @@ Rights Reserved.
<script src="chrome://global/content/treePopups.js"/>
<script src="chrome://messenger/content/threadPane.js"/>
<tree datasources="rdf:null" id="threadTree"
class="window-focusborder"
onclick="ThreadPaneOnClick(event);"
ondraggesture="return BeginDragThreadTree(event);"
ondragdrop="return DropOnThreadTree(event);"
onselect="top.ThreadPaneSelectionChange(false);"
onkeypress="ThreadPaneKeyPress(event);"
onblur="goOnEvent(this,'blur')"
containment="http://home.netscape.com/NC-rdf#MessageChild"
allownegativeassertions="false"
coalesceduplicatearcs="false"
multiple="true">
<template>
<rule>
<treechildren flex="1">
<treeitem uri="..." id="threadTreeTemplateTreeItem">
<outliner id="threadOutliner" flex="1"
ondraggesture="return BeginDragThreadPane(event);"
ondragdrop="return DropOnThreadPane(event);"
onclick="ThreadPaneOnClick(event);">
<outlinercol id="threadCol" display="&threadColumn.label;" class="outlinercol-header outlinercol-image outlinercol-inset-header threadColumnHeader" currentView="unthreaded" cycler="true" />
<outlinercol id="subjectCol" class="outlinercol-header outlinercell-inset-header sortDirectionIndicator" persist="hidden width" flex="7" value="&subjectColumn.label;" primary="true"/>
<splitter class="tree-splitter"/>
<outlinercol id="senderCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden width" flex="4" value="&senderColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="unreadButtonColHeader" fixed="true" class="outlinercol-header outlinercol-image outlinercol-inset-header readColumnHeader" display="&readColumn.label;" cycler="true"/>
<splitter class="tree-splitter"/>
<outlinercol id="dateCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden width" flex="2" value="&dateColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="statusCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden width" flex="1" value="&statusColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="sizeCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden width" flex="1" value="&sizeColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="flaggedCol" fixed="true" class="outlinercol-header outlinercol-image outlinercol-inset-header flagColumnHeader" display="&flagColumn.label;" cycler="true"/>
<splitter class="tree-splitter"/>
<outlinercol id="priorityCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden witdth" flex="1" value="&priorityColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="unreadCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden witdth" flex="1" value="&unreadColumn.label;"/>
<splitter class="tree-splitter"/>
<outlinercol id="totalCol" class="outlinercol-header outlinercol-inset-header sortDirectionIndicator" persist="hidden witdth" flex="1" value="&totalColumn.label;"/>
<outlinerbody flex="1" onselect="this.parentNode.outlinerBoxObject.view.selectionChanged();"/>
</outliner>
<treerow class="tree-thread-row unread-rdf:http://home.netscape.com/NC-rdf#IsUnread" >
<treecell class="treecell-image threadcol-rdf:http://home.netscape.com/NC-rdf#ThreadState"/>
<treecell class="treecell-indent tree-cell-threadpane-icon status-rdf:http://home.netscape.com/NC-rdf#Status message-type-rdf:http://home.netscape.com/NC-rdf#MessageType has-attachment-rdf:http://home.netscape.com/NC-rdf#HasAttachment is-imap-deleted-rdf:http://home.netscape.com/NC-rdf#IsImapDeleted"
value="rdf:http://home.netscape.com/NC-rdf#Subject" />
<treecell class="treecell-text" value="rdf:http://home.netscape.com/NC-rdf#Sender" id ="SenderColumnTemplate"/>
<treecell class="treecell-image unreadcol-rdf:http://home.netscape.com/NC-rdf#IsUnread"
allowevents="true" />
<treecell class="treecell-text" value="rdf:http://home.netscape.com/NC-rdf#Date"/>
<treecell class="tree-cell-image prioritycol-rdf:http://home.netscape.com/NC-rdf#Priority"
value="rdf:http://home.netscape.com/NC-rdf#PriorityString"/>
<treecell class="treecell-image flagcol-rdf:http://home.netscape.com/NC-rdf#Flagged"
allowevents="true" />
<treecell class="treecell-text" value="rdf:http://home.netscape.com/NC-rdf#StatusString"/>
<treecell class="treecell-align-right" value="rdf:http://home.netscape.com/NC-rdf#Size" id ="SizeColumnTemplate"/>
<treecell class="treecell-align-right" value="rdf:http://home.netscape.com/NC-rdf#TotalUnreadMessages"/>
<treecell class="treecell-align-right" value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
<treecell class="treecell-text" value="rdf:http://home.netscape.com/NC-rdf#OrderReceived"/>
<treecell/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecolgroup id="theThreadColumns">
<treecol persist="hidden" id="ThreadColumn" resource="http://home.netscape.com/NC-rdf#Thread"/>
<treecol persist="hidden width" width="0" flex="7" id="SubjectColumn" resource="http://home.netscape.com/NC-rdf#Subject"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="4" id="AuthorColumn" resource="http://home.netscape.com/NC-rdf#Sender"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden" fixed="true" id="UnreadButtonColumn" resource="http://home.netscape.com/NC-rdf#IsUnread"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="2" id="DateColumn" resource="http://home.netscape.com/NC-rdf#Date"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="PriorityColumn" resource="http://home.netscape.com/NC-rdf#Priority"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden" fixed="true" id="FlaggedButtonColumn" resource="http://home.netscape.com/NC-rdf#Flagged"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="StatusColumn" resource="http://home.netscape.com/NC-rdf#Status"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="MemoryColumn" resource="http://home.netscape.com/NC-rdf#Size"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="UnreadColumn" resource="http://home.netscape.com/NC-rdf#TotalUnreadMessages"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="TotalColumn" resource="http://home.netscape.com/NC-rdf#TotalMessages"/>
<splitter class="tree-splitter"/>
<treecol persist="hidden width" width="0" flex="1" id="OrderReceivedColumn" resource="http://home.netscape.com/NC-rdf#OrderReceived"/>
<treecol id="PopupColumn"/>
</treecolgroup>
<treehead>
<treerow id="headRow">
<treecell display="&threadColumn.label;" onclick="return top.ChangeThreadView();" class="treecell-header treecell-inset-header treecell-header-image threadColumnHeader" tooltip="aTooltip" tooltiptext="&threadColumnHeader.tooltip;" id="ThreadColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&subjectColumn.label;" onclick="return top.MsgSortBySubject();" id="SubjectColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" onclick="return top.MsgSortBySender();" value="&senderColumn.label;" id="SenderColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header readColumnHeader" display="&readColumn.label;" onclick="return top.MsgSortByRead();" id="UnreadButtonColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&dateColumn.label;" onclick="return top.MsgSortByDate();" id="DateColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&priorityColumn.label;" onclick="return top.MsgSortByPriority();" id="PriorityColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header flagColumnHeader" display="&flagColumn.label;" onclick="return top.MsgSortByFlagged();" id="FlaggedButtonColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&statusColumn.label;" onclick="return top.MsgSortByStatus();" id="StatusColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&sizeColumn.label;" onclick="return top.MsgSortBySize();" id="SizeColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&unreadColumn.label;" onclick="return top.MsgSortByUnread();" id="UnreadColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&totalColumn.label;" onclick="return top.MsgSortByTotal();" id="TotalColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&orderReceivedColumn.label;" onclick="return top.MsgSortByOrderReceived();" id="OrderReceivedColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header" allowevents="true" id="popupCell" tooltip="aTooltip" tooltiptext="&columnChooser.tooltip;" autostretch="never">
<menu>
<image class="treecell-popup-icon"/>
<menupopup popupanchor="bottomright"
popupalign="topright"
oncreate="BuildTreePopup(document.getElementById('theThreadColumns'), document.getElementById('headRow'), this,
document.getElementById('popupCell'))"/>
</menu>
</treecell>
</treerow>
</treehead>
</tree>
</overlay>

Просмотреть файл

@ -143,11 +143,10 @@ function MsgEmptyTrash()
dump ('found trash folder\n');
trashElement.setAttribute('open','');
}
var trashSelected = IsSpecialFolderSelected('Trash');
var trashSelected = IsSpecialFolderSelected(MSG_FOLDER_FLAG_TRASH);
if(trashSelected)
{
tree.clearItemSelection();
//RefreshThreadTreeView(); un-neccessary
}
try {
messenger.EmptyTrash(tree.database, folder.resource);
@ -257,7 +256,7 @@ function MsgToggleMessagePane()
{
//OnClickThreadAndMessagePaneSplitter is based on the value before the splitter is toggled.
OnClickThreadAndMessagePaneSplitter();
MsgToggleSplitter("threadpane-splitter");
MsgToggleSplitter("threadpane-splitter");
}
function MsgToggleFolderPane()

Просмотреть файл

@ -158,6 +158,10 @@ Rights Reserved.
<!ENTITY collapseAllThreadsCmd.accesskey "c">
<!ENTITY unreadMsgsCmd.label "Unread">
<!ENTITY unreadMsgsCmd.accesskey "u">
<!ENTITY threadsWithUnreadCmd.label "Threads With Unread">
<!ENTITY threadsWithUnreadCmd.accesskey "t">
<!ENTITY watchedThreadsWithUnreadCmd.label "Watched Threads With Unread">
<!ENTITY watchedThreadsWithUnreadCmd.accesskey "w">
<!ENTITY headersMenu.label "Headers">
<!ENTITY headersMenu.accesskey "h">
<!ENTITY headersAllCmd.label "All">
@ -329,6 +333,12 @@ Rights Reserved.
<!ENTITY moveMsgMenu.accesskey "m">
<!ENTITY copyMsgMenu.label "Copy Message">
<!ENTITY copyMsgMenu.accesskey "c">
<!ENTITY killThreadMenu.label "Kill Thread">
<!ENTITY killThreadMenu.accesskey "k">
<!ENTITY killThreadMenu.key "k">
<!ENTITY watchThreadMenu.label "Watch Thread">
<!ENTITY watchThreadMenu.accesskey "w">
<!ENTITY watchThreadMenu.key "w">
<!ENTITY fileHereMenu.label "File Here">
<!ENTITY fileHereMenu.accesskey "File Here">
<!ENTITY addSenderToAddressBookCmd.label ".Add Sender to Address Book">

Просмотреть файл

@ -30,8 +30,9 @@
#include "nsIMsgSearchValidityManager.h"
#include "nsIMsgSearchTerm.h"
#include "nsMsgSearchArray.h"
#include "nsINntpIncomingServer.h"
class nsIMsgSearchScopeTerm;
class nsINNTPHost;
//-----------------------------------------------------------------------------
// These Adapter classes contain the smarts to convert search criteria from
@ -175,7 +176,7 @@ public:
nsresult GetTable (int, nsMsgSearchValidityTable**);
nsresult PostProcessValidityTable (nsINNTPHost*);
nsresult PostProcessValidityTable (nsINntpIncomingServer *);
protected:
@ -197,7 +198,7 @@ protected:
nsresult InitOnlineMailFilterTable ();
nsresult InitNewsTable ();
nsresult InitLocalNewsTable();
nsresult InitNewsExTable (nsINNTPHost *host = nsnull);
nsresult InitNewsExTable (nsINntpIncomingServer *host = nsnull);
void EnableLdapAttribute (nsMsgSearchAttribValue, PRBool enabled = PR_TRUE);
};

Просмотреть файл

@ -51,7 +51,7 @@ public:
void StripQuotedPrintable (unsigned char*);
PRInt32 GetNextIMAPOfflineMsgLine (char * buf, int bufferSize, int msgOffset, nsIMessage * msg, nsIMsgDatabase * db);
PRInt32 GetNextIMAPOfflineMsgLine (char * buf, int bufferSize, int msgOffset, nsIMsgDBHdr * msg, nsIMsgDatabase * db);
// nsresult MatchBody (nsIMsgSearchScopeTerm*, PRUint32 offset, PRUint32 length, const char *charset,

Просмотреть файл

@ -22,7 +22,7 @@ var rdfDatasourcePrefix = "@mozilla.org/rdf/datasource;1?name=";
var rdfServiceContractID = "@mozilla.org/rdf/rdf-service;1";
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var folderDSContractID = rdfDatasourcePrefix + "mailnewsfolders";
var gSearchDatasource;
var gSearchView;
var gSearchSession;
var gCurrentFolder;
@ -43,6 +43,8 @@ var gSearchBundle;
// Datasource search listener -- made global as it has to be registered
// and unregistered in different functions.
var gDataSourceSearchListener;
var gViewSearchListener;
var gIsSearchHit = false;
var gButton;
@ -65,8 +67,8 @@ var nsSearchResultsController =
isCommandEnabled: function(command)
{
var enabled = true;
if (gThreadTree.selectedItems.length <= 0)
enabled = false;
if (GetNumSelectedMessages() <= 0)
enabled = false;
return enabled;
},
@ -75,7 +77,7 @@ var nsSearchResultsController =
{
switch(command) {
case "cmd_open":
MsgOpenSelectedMessages();
MsgOpenSelectedMessages(gSearchView);
return true;
default:
@ -103,16 +105,13 @@ var gSearchNotificationListener =
var statusMsg;
// if there are no hits, it means no matches were found in the search.
if (gNumOfSearchHits == 0) {
statusMsg = gSearchBundle.getString("searchFailureMessage");
if (!gIsSearchHit) {
gStatusFeedback.showStatusString(gSearchBundle.getString("searchFailureMessage"));
}
else if (gNumOfSearchHits == 1) {
statusMsg = gSearchBundle.getString("searchSuccessMessage");
}
else
{
statusMsg = gSearchBundle.getFormattedString("searchSuccessMessages", [gNumOfSearchHits]);
gNumOfSearchHits = 0;
gStatusFeedback.showStatusString(gSearchBundle.getString("searchSuccessMessage"));
gIsSearchHit = false;
}
gStatusFeedback.showProgress(100);
@ -122,39 +121,39 @@ var gSearchNotificationListener =
onNewSearch: function()
{
gButton.setAttribute("value", gSearchBundle.getString("labelForStopButton"));
if (gThreadTree)
gThreadTree.clearItemSelection();
ThreadTreeUpdate_Search();
gButton.setAttribute("value", gSearchBundle.getString("labelForStopButton"));
// if (gThreadTree)
// gThreadTree.clearItemSelection();
gStatusFeedback.showProgress(0);
gStatusFeedback.showStatusString(gSearchBundle.getString("searchingMessage"));
gStatusBar.setAttribute("mode","undetermined");
document.commandDispatcher.updateCommands('mail-search');
gStatusFeedback.showProgress(0);
gStatusFeedback.showStatusString(gSearchBundle.getString("searchingMessage"));
gStatusBar.setAttribute("mode","undetermined");
}
}
function searchOnLoad()
{
initializeSearchWidgets();
initializeSearchWindowWidgets();
initializeSearchWidgets();
initializeSearchWindowWidgets();
gSearchBundle = document.getElementById("bundle_search");
setupDatasource();
setupSearchListener();
if (window.arguments && window.arguments[0])
selectFolder(window.arguments[0].folder);
onMore(null);
moveToAlertPosition();
gSearchBundle = document.getElementById("bundle_search");
setupDatasource();
setupSearchListener();
if (window.arguments && window.arguments[0])
selectFolder(window.arguments[0].folder);
onMore(null);
document.commandDispatcher.updateCommands('mail-search');
moveToAlertPosition();
}
function searchOnUnload()
{
// unregister listeners
gSearchSession.unregisterListener(gDataSourceSearchListener);
gSearchSession.unregisterListener(gViewSearchListener);
gSearchSession.unregisterListener(gSearchNotificationListener);
// release this early because msgWindow holds a weak reference
@ -164,7 +163,7 @@ function searchOnUnload()
function initializeSearchWindowWidgets()
{
gFolderPicker = document.getElementById("searchableFolders");
gThreadTree = document.getElementById("threadTree");
// gThreadTree = document.getElementById("threadTree");
gButton = document.getElementById("search-button");
gStatusBar = document.getElementById('statusbar-icon');
@ -174,9 +173,8 @@ function initializeSearchWindowWidgets()
// functionality to enable/disable buttons using nsSearchResultsController
// depending of whether items are selected in the search results thread pane.
gThreadTree.controllers.appendController(nsSearchResultsController);
// gThreadTree.controllers.appendController(nsSearchResultsController);
top.controllers.insertControllerAt(0, nsSearchResultsController);
ThreadTreeUpdate_Search();
}
@ -263,7 +261,8 @@ function onSearch(event)
gSearchSession.search(msgWindow);
// refresh the tree after the search starts, because initiating the
// search will cause the datasource to clear itself
gThreadTree.setAttribute("ref", gThreadTree.getAttribute("ref"));
// gThreadTree.setAttribute("ref", gThreadTree.getAttribute("ref"));
// dump("Kicking it off with " + gThreadTree.getAttribute("ref") + "\n");
}
function AddSubFolders(folder) {
@ -301,31 +300,72 @@ function GetScopeForFolder(folder) {
else
return nsMsgSearchScope.MailFolder;
}
var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
function goUpdateSearchItems(commandset)
{
for (var i = 0; i < commandset.childNodes.length; i++)
{
var commandID = commandset.childNodes[i].getAttribute("id");
if (commandID)
{
goUpdateCommand(commandID);
}
}
}
function nsMsgSearchCommandUpdater()
{}
nsMsgSearchCommandUpdater.prototype =
{
updateCommandStatus : function()
{
// the back end is smart and is only telling us to update command status
// when the # of items in the selection has actually changed.
document.commandDispatcher.updateCommands('mail-search');
},
QueryInterface : function(iid)
{
if(iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater))
return this;
throw Components.results.NS_NOINTERFACE;
return null;
}
}
function setupDatasource() {
RDF = Components.classes[rdfServiceContractID].getService(Components.interfaces.nsIRDFService);
gSearchView = Components.classes["@mozilla.org/messenger/msgdbview;1?type=search"].createInstance(Components.interfaces.nsIMsgDBView);
var count = new Object;
var cmdupdator = new nsMsgSearchCommandUpdater();
gSearchDatasource = Components.classes[rdfDatasourcePrefix + "msgsearch"].createInstance(Components.interfaces.nsIRDFDataSource);
gSearchView.init(messenger, msgWindow, cmdupdator);
gSearchView.open(null, nsMsgViewSortType.byId, nsMsgViewSortOrder.ascending, nsMsgViewFlagsType.kNone, count);
var outlinerView = gSearchView.QueryInterface(Components.interfaces.nsIOutlinerView);
if (outlinerView)
{
var outliner = GetThreadOutliner();
outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).view = outlinerView;
}
gThreadTree.setAttribute("ref", gSearchDatasource.URI);
// the thread pane needs to use the search datasource (to get the
// actual list of messages) and the message datasource (to get any
// attributes about each message)
gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
setMsgDatasourceWindow(gSearchDatasource, msgWindow);
gThreadTree.database.AddDataSource(gSearchDatasource);
var messageDatasource = Components.classes[rdfDatasourcePrefix + "mailnewsmessages"].createInstance(Components.interfaces.nsIRDFDataSource);
setMsgDatasourceWindow(messageDatasource, msgWindow);
gThreadTree.database.AddDataSource(messageDatasource);
// the datasource is a listener on the search results
gDataSourceSearchListener = gSearchDatasource.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
gSearchSession.registerListener(gDataSourceSearchListener);
gViewSearchListener = gSearchView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
gSearchSession.registerListener(gViewSearchListener);
}
@ -395,7 +435,18 @@ function onSearchButton(event)
onSearchStop(event);
}
function ThreadTreeUpdate_Search()
// threadPane.js will be needing this, too
function GetNumSelectedMessages()
{
goUpdateCommand("cmd_open");
try {
return gSearchView.numSelected;
}
catch (ex) {
return 0;
}
}
function GetDBView()
{
return gSearchView;
}

Просмотреть файл

@ -55,16 +55,13 @@ Rights Reserved.
<script src="chrome://messenger/content/SearchDialog.js"/>
<commands id="commands">
<commandset id="ThreadTreeUpdate_Search"
<commandset id="mailSearchItems"
commandupdater="true"
events="threadTree-select"
oncommandupdate="ThreadTreeUpdate_Search()"/>
events="mail-search"
oncommandupdate="goUpdateSearchItems(this)">
<command id="cmd_open" oncommand="goDoCommand('cmd_open')" disabled="true"/>
</commandset>
</commands>
<broadcasterset id="broadcasterset">
<broadcaster id="cmd_open" oncommand="goDoCommand('cmd_open')"/>
</broadcasterset>
<dummy class="usesMailWidgets"/>
<box flex="1" orient="vertical">
@ -97,7 +94,7 @@ Rights Reserved.
<titledbox value="&results.label;" orient="vertical" class="dialog box-padded" flex="1">
<box id="searchTermListBox" orient="vertical" flex="1">
<tree id="threadTree" flex="1" context="threadPaneContext"/>
<outliner id="threadOutliner" flex="1" context="threadPaneContext"/>
</box>
</titledbox>

Просмотреть файл

@ -43,14 +43,12 @@ CPPSRCS = \
nsMsgSearchSession.cpp \
nsMsgImapSearch.cpp \
nsMsgSearchNews.cpp \
nsMsgSearchDataSource.cpp \
nsMsgFilterDataSource.cpp \
nsMsgFilterDelegateFactory.cpp \
$(NULL)
EXPORTS = nsMsgFilterService.h \
nsMsgSearchSession.h \
nsMsgSearchDataSource.h \
nsMsgFilterDataSource.h \
nsMsgFilterDelegateFactory.h \
$(NULL)

Просмотреть файл

@ -40,7 +40,6 @@ CPP_OBJS= .\$(OBJDIR)\nsMsgFilterService.obj \
.\$(OBJDIR)\nsMsgSearchSession.obj\
.\$(OBJDIR)\nsMsgSearchAdapter.obj\
.\$(OBJDIR)\nsMsgSearchValue.obj \
.\$(OBJDIR)\nsMsgSearchDataSource.obj \
.\$(OBJDIR)\nsMsgFilterDataSource.obj \
.\$(OBJDIR)\nsMsgFilterDelegateFactory.obj \
$(NULL)
@ -50,7 +49,6 @@ EXPORTS= nsMsgFilterService.h \
nsMsgSearchSession.h \
nsMsgFilterDataSource.h \
nsMsgFilterDelegateFactory.h \
nsMsgSearchDataSource.h \
$(NULL)

Просмотреть файл

@ -313,8 +313,8 @@ nsMsgSearchOfflineMail::~nsMsgSearchOfflineMail ()
nsresult nsMsgSearchOfflineMail::ValidateTerms ()
{
nsresult err = NS_OK;
#ifdef HAVE_SEARCH_PORT
err = nsMsgSearchAdapter::ValidateTerms ();
#ifdef HAVE_SEARCH_PORT
if (NS_OK == err)
{
// Mail folder must exist. Don't worry about the summary file now since we may
@ -776,3 +776,102 @@ NS_IMETHODIMP nsMsgSearchOfflineMail::OnStopRunningUrl(nsIURI *url, nsresult aEx
return NS_OK;
}
nsMsgSearchOfflineNews::nsMsgSearchOfflineNews (nsIMsgSearchScopeTerm *scope, nsISupportsArray *termList) : nsMsgSearchOfflineMail (scope, termList)
{
}
nsMsgSearchOfflineNews::~nsMsgSearchOfflineNews ()
{
}
nsresult nsMsgSearchOfflineNews::OpenSummaryFile ()
{
nsresult err = NS_OK;
nsCOMPtr <nsIDBFolderInfo> folderInfo;
nsCOMPtr <nsIMsgFolder> scopeFolder;
err = m_scope->GetFolder(getter_AddRefs(scopeFolder));
if (NS_SUCCEEDED(err) && scopeFolder)
err = scopeFolder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), &m_db);
return err;
}
nsresult nsMsgSearchOfflineNews::ValidateTerms ()
{
return nsMsgSearchOfflineMail::ValidateTerms ();
}
//-----------------------------------------------------------------------------
nsresult nsMsgSearchValidityManager::InitLocalNewsTable()
{
NS_ASSERTION (nsnull == m_localNewsTable, "already have local news validty table");
nsresult err = NewTable (getter_AddRefs(m_localNewsTable));
if (NS_SUCCEEDED(err))
{
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Sender, nsMsgSearchOp::BeginsWith, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Sender, nsMsgSearchOp::EndsWith, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Subject, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Subject, nsMsgSearchOp::BeginsWith, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Subject, nsMsgSearchOp::EndsWith, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Body, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Body, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Body, nsMsgSearchOp::DoesntContain, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Body, nsMsgSearchOp::DoesntContain, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Body, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Body, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Body, nsMsgSearchOp::Isnt, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Body, nsMsgSearchOp::Isnt, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsBefore, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsAfter, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Date, nsMsgSearchOp::IsAfter, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Date, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::Date, nsMsgSearchOp::Isnt, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::Date, nsMsgSearchOp::Isnt, 1);
#ifdef DOING_ARBITRARY_HEADERS
m_localNewsTable->SetAvailable (attribOtherHeader, nsMsgSearchOp::Contains, 1); // added for arbitrary headers
m_localNewsTable->SetEnabled (attribOtherHeader, nsMsgSearchOp::Contains, 1);
m_localNewsTable->SetAvailable (attribOtherHeader, nsMsgSearchOp::DoesntContain, 1);
m_localNewsTable->SetEnabled (attribOtherHeader, nsMsgSearchOp::DoesntContain, 1);
m_localNewsTable->SetAvailable (attribOtherHeader, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (attribOtherHeader, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (attribOtherHeader, nsMsgSearchOp::Isnt, 1);
m_localNewsTable->SetEnabled (attribOtherHeader, nsMsgSearchOp::Isnt, 1);
#endif
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsGreaterThan, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsGreaterThan, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsLessThan, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::IsLessThan, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::AgeInDays, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Is, 1);
m_localNewsTable->SetAvailable (nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Isnt, 1);
m_localNewsTable->SetEnabled (nsMsgSearchAttrib::MsgStatus, nsMsgSearchOp::Isnt, 1);
}
return err;
}

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsIRDFService.h"
#include "nsMsgRDFUtils.h"
#include "nsIMessage.h"
#include "nsIMsgHdr.h"
#include "nsIMsgSearchSession.h"
#include "nsEnumeratorUtils.h"
@ -87,7 +86,7 @@ nsMsgSearchDataSource::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *folder)
#ifdef DEBUG
printf("nsMsgSearchDataSource::OnSearchHit!!\n");
#endif
#if 0
nsCOMPtr<nsIMessage> message;
folder->CreateMessageFromMsgDBHdr(aMsgHdr, getter_AddRefs(message));
@ -102,6 +101,7 @@ nsMsgSearchDataSource::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *folder)
// should probably try to cache this with an in-memory datasource
// or something
NotifyObservers(mSearchRoot, kNC_MessageChild, messageResource, PR_TRUE, PR_FALSE);
#endif
return NS_OK;
}

Просмотреть файл

@ -27,7 +27,6 @@
#include "nsMsgSearchTerm.h"
#include "nsIMsgHdr.h"
#include "nsMsgSearchNews.h"
#include "nsINNTPHost.h"
#include "nsIDBFolderInfo.h"
// Implementation of search for IMAP mail folders
@ -708,7 +707,7 @@ nsresult nsMsgSearchValidityManager::InitNewsTable ()
}
nsresult nsMsgSearchValidityManager::InitNewsExTable (nsINNTPHost *newsHost)
nsresult nsMsgSearchValidityManager::InitNewsExTable (nsINntpIncomingServer *newsHost)
{
nsresult err = NS_OK;
@ -793,7 +792,7 @@ nsresult nsMsgSearchValidityManager::InitNewsExTable (nsINNTPHost *newsHost)
}
nsresult nsMsgSearchValidityManager::PostProcessValidityTable (nsINNTPHost *host)
nsresult nsMsgSearchValidityManager::PostProcessValidityTable (nsINntpIncomingServer *host)
{
return InitNewsExTable (host);
}

Просмотреть файл

@ -1023,39 +1023,35 @@ nsresult nsMsgSearchTerm::MatchAge (PRTime msgDate, PRBool *pResult)
PRBool result = PR_FALSE;
nsresult err = NS_OK;
#ifdef DO_AGE_YET
time_t now = XP_TIME();
time_t matchDay = now - (m_value.u.age * 60 * 60 * 24);
struct tm * matchTime = localtime(&matchDay);
// localTime axes previous results so save these.
int day = matchTime->tm_mday;
int month = matchTime->tm_mon;
int year = matchTime->tm_year;
struct tm * msgTime = localtime(&msgDate);
PRTime now = PR_Now();
PRTime cutOffDay;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDays;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(secondsInDays, 60 * 60 * 24 * m_value.u.age);
LL_MUL(microSecondsInDays, secondsInDays, microSecondsPerSecond);
LL_SUB(cutOffDay, now, microSecondsInDays); // = now - term->m_value.u.age * 60 * 60 * 24;
// so now cutOffDay is the PRTime cut-off point. Any msg with a time less than that will be past the age .
switch (m_operator)
{
case nsMsgSearchOp::IsGreaterThan: // is older than
if (msgDate < matchDay)
if (LL_CMP(msgDate, <, cutOffDay))
result = PR_TRUE;
break;
case nsMsgSearchOp::IsLessThan: // is younger than
if (msgDate > matchDay)
if (LL_CMP(msgDate, >, cutOffDay))
result = PR_TRUE;
break;
case nsMsgSearchOp::Is:
if (matchTime && msgTime)
if ((day == msgTime->tm_mday)
&& (month == msgTime->tm_mon)
&& (year == msgTime->tm_year))
result = PR_TRUE;
NS_ASSERTION(PR_FALSE, "not supported yet");
break;
default:
NS_ASSERTION(PR_FALSE, "invalid compare op comparing msg age");
}
#endif // DO_AGE_YET
*pResult = result;
return err;
}
@ -1099,19 +1095,16 @@ nsresult nsMsgSearchTerm::MatchStatus (PRUint32 statusToMatch, PRBool *pResult)
switch (m_operator)
{
case nsMsgSearchOp::Is:
if (matches)
*pResult = PR_TRUE;
break;
case nsMsgSearchOp::Isnt:
if (!matches)
*pResult = PR_TRUE;
matches = !matches;
break;
default:
*pResult = PR_FALSE;
err = NS_ERROR_FAILURE;
NS_ASSERTION(PR_FALSE, "invalid comapre op for msg status");
}
*pResult = matches;
return err;
}
@ -1404,7 +1397,7 @@ nsresult nsMsgSearchScopeTerm::InitializeAdapter (nsISupportsArray *termList)
NS_ASSERTION(PR_FALSE, "not supporting LDAP yet");
break;
case nsMsgSearchScope::OfflineNewsgroup:
NS_ASSERTION(PR_FALSE, "not supporting offline news");
m_adapter = new nsMsgSearchOfflineNews (this, termList);
break;
default:
NS_ASSERTION(PR_FALSE, "invalid scope");
@ -1702,8 +1695,8 @@ int nsMsgResultElement::Compare (const void *e1, const void *e2)
// Special case for subjects, so "Re:foo" sorts under 'f' not 'r'
const char *s1 = v1->u.string;
const char *s2 = v2->u.string;
msg_StripRE (&s1, NULL);
msg_StripRE (&s2, NULL);
NS_MsgStripRE (&s1, NULL);
NS_MsgStripRE (&s2, NULL);
ret = PL_strcasecomp (s1, s2);
}
else

Просмотреть файл

@ -22,7 +22,6 @@
nsMessenger.h
nsMessengerBootstrap.h
nsMsgKeyArray.h
nsUrlListenerManager.h
nsMsgMailSession.h
nsMsgFolderCache.h

Просмотреть файл

@ -33,7 +33,6 @@ REQUIRES = xpcom string necko dom js appshell appcomps uconv intl htmlparser wid
CPPSRCS = \
nsMessenger.cpp \
nsMessengerBootstrap.cpp \
nsMsgKeyArray.cpp \
nsUrlListenerManager.cpp \
nsMsgMailSession.cpp \
nsMsgMD5.cpp \
@ -42,7 +41,6 @@ CPPSRCS = \
nsCopyMessageStreamListener.cpp \
nsMsgRDFDataSource.cpp \
nsMsgFolderDataSource.cpp \
nsMsgMessageDataSource.cpp \
nsMsgAccountManagerDS.cpp \
nsMsgRDFUtils.cpp \
nsMsgBiffManager.cpp \
@ -52,28 +50,29 @@ CPPSRCS = \
nsMsgFolderCacheElement.cpp \
nsMsgFolderCompactor.cpp \
nsMsgStatusFeedback.cpp \
nsMessageView.cpp \
nsMsgWindow.cpp \
nsMessengerMigrator.cpp \
nsMsgViewNavigationService.cpp \
nsMsgServiceProvider.cpp \
nsSubscribeDataSource.cpp \
nsSubscribableServer.cpp \
nsMsgPrintEngine.cpp \
nsStatusBarBiffManager.cpp \
nsMsgDBView.cpp \
nsMsgThreadedDBView.cpp \
nsMsgSpecialViews.cpp \
nsMsgSearchDBView.cpp \
nsMsgOfflineManager.cpp \
$(NULL)
EXPORTS = \
nsMessenger.h \
nsMessengerBootstrap.h \
nsMsgKeyArray.h \
nsUrlListenerManager.h \
nsMsgMailSession.h \
nsMsgAccountManager.h \
nsMsgAccount.h \
nsMsgFolderDataSource.h \
nsMsgFolderCache.h \
nsMsgMessageDataSource.h \
nsMsgAccountManagerDS.h \
nsMsgRDFDataSource.h \
nsMsgRDFUtils.h \
@ -82,10 +81,8 @@ EXPORTS = \
nsCopyMessageStreamListener.h \
nsMsgCopyService.h \
nsMsgStatusFeedback.h \
nsMessageView.h \
nsMsgWindow.h \
nsMessengerMigrator.h \
nsMsgViewNavigationService.h \
nsMsgServiceProvider.h \
nsSubscribeDataSource.h \
nsSubscribableServer.h \

Просмотреть файл

@ -31,12 +31,10 @@ include <$(DEPTH)\config\config.mak>
EXPORTS= \
nsMessenger.h \
nsMessengerBootstrap.h \
nsMsgKeyArray.h \
nsUrlListenerManager.h \
nsMsgMailSession.h \
nsMsgFolderDataSource.h \
nsMsgFolderCache.h \
nsMsgMessageDataSource.h \
nsMsgAccount.h \
nsMsgAccountManager.h \
nsMsgRDFDataSource.h \
@ -67,7 +65,6 @@ LIBRARY_NAME=msgbase_s
CPP_OBJS= \
.\$(OBJDIR)\nsMessenger.obj \
.\$(OBJDIR)\nsMessengerBootstrap.obj \
.\$(OBJDIR)\nsMsgKeyArray.obj \
.\$(OBJDIR)\nsUrlListenerManager.obj \
.\$(OBJDIR)\nsMsgMailSession.obj \
.\$(OBJDIR)\nsCopyMessageStreamListener.obj \
@ -77,7 +74,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsMsgFolderDataSource.obj \
.\$(OBJDIR)\nsMsgFolderCache.obj \
.\$(OBJDIR)\nsMsgFolderCacheElement.obj \
.\$(OBJDIR)\nsMsgMessageDataSource.obj \
.\$(OBJDIR)\nsMsgRDFUtils.obj \
.\$(OBJDIR)\nsMsgRDFDataSource.obj \
.\$(OBJDIR)\nsMsgAccountManagerDS.obj \
@ -85,15 +81,18 @@ CPP_OBJS= \
.\$(OBJDIR)\nsMsgNotificationManager.obj \
.\$(OBJDIR)\nsMsgCopyService.obj \
.\$(OBJDIR)\nsMsgStatusFeedback.obj \
.\$(OBJDIR)\nsMessageView.obj \
.\$(OBJDIR)\nsMsgWindow.obj \
.\$(OBJDIR)\nsMessengerMigrator.obj \
.\$(OBJDIR)\nsMsgViewNavigationService.obj \
.\$(OBJDIR)\nsMsgServiceProvider.obj \
.\$(OBJDIR)\nsSubscribeDataSource.obj \
.\$(OBJDIR)\nsSubscribableServer.obj \
.\$(OBJDIR)\nsMsgPrintEngine.obj \
.\$(OBJDIR)\nsStatusBarBiffManager.obj \
.\$(OBJDIR)\nsMsgDBView.obj \
.\$(OBJDIR)\nsMsgThreadedDBView.obj \
.\$(OBJDIR)\nsMsgSpecialViews.obj \
.\$(OBJDIR)\nsMsgSearchDBView.obj \
.\$(OBJDIR)\nsMsgOfflineManager.obj \
$(NULL)

Просмотреть файл

@ -25,11 +25,13 @@
#include "nsIMsgMailNewsUrl.h"
#include "nsIMailboxUrl.h"
#include "nsIMsgHdr.h"
#include "nsIMessage.h"
#include "nsIRDFService.h"
#include "nsIRDFNode.h"
#include "nsRDFCID.h"
#include "nsIMsgImapMailFolder.h"
#include "nsXPIDLString.h"
#include "nsIMsgMessageService.h"
#include "nsMsgUtils.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -44,10 +46,10 @@ NS_INTERFACE_MAP_BEGIN(nsCopyMessageStreamListener)
NS_INTERFACE_MAP_ENTRY(nsICopyMessageStreamListener)
NS_INTERFACE_MAP_END_THREADSAFE
static nsresult GetMessage(nsIURI *aURL, nsIMessage **message)
static nsresult GetMessage(nsIURI *aURL, nsIMsgDBHdr **message)
{
nsCOMPtr<nsIMsgMessageUrl> uriURL;
char* uri;
nsXPIDLCString uri;
nsresult rv;
if(!message)
@ -58,28 +60,22 @@ static nsresult GetMessage(nsIURI *aURL, nsIMessage **message)
if(NS_FAILED(rv))
return rv;
rv = uriURL->GetUri(&uri);
rv = uriURL->GetUri(getter_Copies(uri));
if(NS_FAILED(rv))
return rv;
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIRDFResource> messageResource;
if(NS_SUCCEEDED(rdfService->GetResource(uri, getter_AddRefs(messageResource))))
{
messageResource->QueryInterface(NS_GET_IID(nsIMessage), (void**)message);
}
}
nsMemory::Free(uri);
nsCOMPtr <nsIMsgMessageService> msgMessageService;
rv = GetMessageServiceFromURI(uri, getter_AddRefs(msgMessageService));
NS_ENSURE_SUCCESS(rv,rv);
if (!msgMessageService) return NS_ERROR_FAILURE;
return rv;
return msgMessageService->MessageURIToMsgHdr(uri, message);
}
static nsresult DeleteMessage(nsIURI *aURL, nsIMsgFolder *srcFolder)
{
nsCOMPtr<nsIMessage> message;
nsCOMPtr<nsIMsgDBHdr> message;
nsresult rv;
rv = GetMessage(aURL, getter_AddRefs(message));
@ -140,7 +136,7 @@ NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIRequest * /* reque
NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request, nsISupports *ctxt)
{
nsCOMPtr<nsIMessage> message;
nsCOMPtr<nsIMsgDBHdr> message;
nsresult rv = NS_OK;
nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt, &rv);

Просмотреть файл

@ -71,7 +71,6 @@
#include "nsIMsgIncomingServer.h"
#include "nsIMsgMessageService.h"
#include "nsIMessage.h"
#include "nsIMsgStatusFeedback.h"
#include "nsMsgRDFUtils.h"
@ -1076,42 +1075,33 @@ NS_IMETHODIMP nsMessenger::DeleteFolders(nsIRDFCompositeDataSource *db,
}
NS_IMETHODIMP
nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database,
nsIRDFResource *srcResource, // folder
nsIRDFResource *dstResource,
nsISupportsArray *argumentArray, // nsIMessages
nsMessenger::CopyMessages(nsIMsgFolder *srcFolder, nsIMsgFolder *destFolder,
nsISupportsArray *messageArray,
PRBool isMove)
{
nsresult rv;
NS_ENSURE_ARG_POINTER(srcFolder);
NS_ENSURE_ARG_POINTER(destFolder);
NS_ENSURE_ARG_POINTER(messageArray);
if(!srcResource || !dstResource || !argumentArray)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIMsgFolder> srcFolder;
nsCOMPtr<nsISupportsArray> folderArray;
srcFolder = do_QueryInterface(srcResource);
if(!srcFolder)
return NS_ERROR_NO_INTERFACE;
nsCOMPtr<nsISupports> srcFolderSupports(do_QueryInterface(srcFolder));
if(srcFolderSupports)
argumentArray->InsertElementAt(srcFolderSupports, 0);
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
if(NS_FAILED(rv))
{
return NS_ERROR_OUT_OF_MEMORY;
}
folderArray->AppendElement(dstResource);
rv = DoCommand(database, isMove ? (char *)NC_RDF_MOVE : (char *)NC_RDF_COPY, folderArray, argumentArray);
return rv;
rv = destFolder->CopyMessages(srcFolder, messageArray, isMove, nsnull /* nsIMsgWindow */, nsnull /* listener */, PR_FALSE /* isFolder */);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
NS_IMETHODIMP
nsMessenger::MessageServiceFromURI(const char *uri, nsIMsgMessageService **msgService)
{
nsresult rv;
NS_ENSURE_ARG_POINTER(uri);
NS_ENSURE_ARG_POINTER(msgService);
rv = GetMessageServiceFromURI(uri, msgService);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
NS_IMETHODIMP
nsMessenger::CopyFolders(nsIRDFCompositeDataSource *database,
nsIRDFResource *dstResource,
@ -1425,7 +1415,7 @@ nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity)
NS_ADDREF(sendLaterListener);
pMsgSendLater->AddListener(sendLaterListener);
pMsgSendLater->SendUnsentMessages(aIdentity, nsnull);
pMsgSendLater->SendUnsentMessages(aIdentity);
NS_RELEASE(sendLaterListener);
}
return NS_OK;

Просмотреть файл

@ -52,7 +52,7 @@ nsCopySource::~nsCopySource()
MOZ_COUNT_DTOR(nsCopySource);
}
void nsCopySource::AddMessage(nsIMessage* aMsg)
void nsCopySource::AddMessage(nsIMsgDBHdr* aMsg)
{
nsCOMPtr<nsISupports> supports(do_QueryInterface(aMsg));
if(supports)
@ -237,7 +237,7 @@ nsMsgCopyService::DoNextCopy()
// ** in case of saving draft/template; the very first
// time we may not have the original message to replace
// with; if we do we shall have an instance of copySource
nsCOMPtr<nsIMessage> aMessage;
nsCOMPtr<nsIMsgDBHdr> aMessage;
if (copySource)
{
nsCOMPtr<nsISupports> aSupport;
@ -297,7 +297,7 @@ nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
nsresult rv = NS_ERROR_NULL_POINTER;
nsCOMPtr<nsISupportsArray> msgArray;
PRUint32 i, cnt;
nsCOMPtr<nsIMessage> msg;
nsCOMPtr<nsIMsgDBHdr> msg;
nsCOMPtr<nsIMsgFolder> curFolder;
nsCOMPtr<nsISupports> aSupport;
@ -333,7 +333,7 @@ nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
msg = do_QueryInterface(aSupport, &rv);
if (NS_FAILED(rv)) goto done;
rv = msg->GetMsgFolder(getter_AddRefs(curFolder));
rv = msg->GetFolder(getter_AddRefs(curFolder));
if (NS_FAILED(rv)) goto done;
if (!copySource)
{
@ -431,7 +431,7 @@ nsMsgCopyService::CopyFolders( nsISupportsArray* folders,
NS_IMETHODIMP
nsMsgCopyService::CopyFileMessage(nsIFileSpec* fileSpec,
nsIMsgFolder* dstFolder,
nsIMessage* msgToReplace,
nsIMsgDBHdr* msgToReplace,
PRBool isDraft,
nsIMsgCopyServiceListener* listener,
nsIMsgWindow* window)

Просмотреть файл

@ -27,7 +27,7 @@
#include "nsIMsgCopyService.h"
#include "nsCOMPtr.h"
#include "nsIMsgFolder.h"
#include "nsIMessage.h"
#include "nsIMsgHdr.h"
#include "nsIMsgWindow.h"
typedef enum _nsCopyRequestType
@ -45,7 +45,7 @@ public:
nsCopySource();
nsCopySource(nsIMsgFolder* srcFolder);
~nsCopySource();
void AddMessage(nsIMessage* aMsg);
void AddMessage(nsIMsgDBHdr* aMsg);
nsCOMPtr<nsIMsgFolder> m_msgFolder;
nsCOMPtr<nsISupportsArray> m_messageArray;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,14 +24,43 @@
#define _nsMsgDBView_H_
#include "nsIMsgDBView.h"
#include "nsIMsgWindow.h"
#include "nsIMessenger.h"
#include "nsIMsgDatabase.h"
#include "nsIMsgHdr.h"
#include "nsMsgLineBuffer.h" // for nsByteArray
#include "nsMsgKeyArray.h"
#include "nsUint8Array.h"
#include "nsIDBChangeListener.h"
#include "nsIOutlinerView.h"
#include "nsIOutlinerBoxObject.h"
#include "nsIOutlinerSelection.h"
#include "nsVoidArray.h"
#include "nsIMsgFolder.h"
#include "nsIDateTimeFormat.h"
#include "nsIMsgHeaderParser.h"
#include "nsIDOMElement.h"
#include "nsIAtom.h"
#include "nsIStringBundle.h"
#define MESSENGER_STRING_URL "chrome://messenger/locale/messenger.properties"
enum eFieldType {
kCollationKey,
kU32,
kPRTime
};
// reserve the top 8 bits in the msg flags for the view-only flags.
#define MSG_VIEW_FLAGS 0xFE000000
#define MSG_VIEW_FLAG_HASCHILDREN 0x40000000
#define MSG_VIEW_FLAG_ISTHREAD 0x8000000
// I think this will be an abstract implementation class.
// The classes that implement the outliner support will probably
// inherit from this class.
class nsMsgDBView : public nsIMsgDBView
class nsMsgDBView : public nsIMsgDBView, public nsIDBChangeListener, public nsIOutlinerView
{
public:
nsMsgDBView();
@ -39,13 +68,102 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGDBVIEW
NS_DECL_NSIDBCHANGELISTENER
NS_DECL_NSIOUTLINERVIEW
protected:
static nsrefcnt gInstanceCount;
// atoms used for styling the view. we're going to have a lot of
// these so i'm going to make them static.
static nsIAtom* kUnreadMsgAtom;
static nsIAtom* kOfflineMsgAtom;
static nsIAtom* kHighestPriorityAtom;
static nsIAtom* kHighPriorityAtom;
static nsIAtom* kLowestPriorityAtom;
static nsIAtom* kLowPriorityAtom;
static PRUnichar* kHighestPriorityString;
static PRUnichar* kHighPriorityString;
static PRUnichar* kLowestPriorityString;
static PRUnichar* kLowPriorityString;
static PRUnichar* kNormalPriorityString;
static PRUnichar* kReadString;
static PRUnichar* kRepliedString;
static PRUnichar* kForwardedString;
static PRUnichar* kNewString;
nsCOMPtr<nsIOutlinerBoxObject> mOutliner;
nsCOMPtr<nsIOutlinerSelection> mOutlinerSelection;
PRUint32 mNumSelectedRows; // we cache this to determine when to push command status notifications.
PRBool mSupressMsgDisplay; // set when the message pane is collapsed
virtual const char * GetViewName(void) {return "MsgDBView"; }
nsresult FetchAuthor(nsIMsgHdr * aHdr, PRUnichar ** aAuthorString);
nsresult FetchSubject(nsIMsgHdr * aMsgHdr, PRUint32 aFlags, PRUnichar ** aValue);
nsresult FetchDate(nsIMsgHdr * aHdr, PRUnichar ** aDateString);
nsresult FetchStatus(PRUint32 aFlags, PRUnichar ** aStatusString);
nsresult FetchSize(nsIMsgHdr * aHdr, PRUnichar ** aSizeString);
nsresult FetchPriority(nsIMsgHdr *aHdr, PRUnichar ** aPriorityString);
nsresult CycleThreadedColumn(nsIDOMElement * aElement);
// toggles ascending/descending or adds the sort attribute
// also cleans up the attributes on the previously sorted column.
nsresult UpdateSortUI(nsIDOMElement * aNewSortColumn);
// Save and Restore Selection are a pair of routines you should
// use when performing an operation which is going to change the view
// and you want to remember the selection. (i.e. for sorting).
// Call SaveSelection and we'll give you an array of msg keys for
// the current selection. We also freeze selection. When you are done
// changing the view, call RestoreSelection passing in the same array
// and we'll restore the selection AND unfreeze selection in the UI.
nsresult SaveSelection(nsMsgKeyArray * aMsgKeyArray);
nsresult RestoreSelection(nsMsgKeyArray * aMsgKeyArray);
nsresult GetSelectedIndices(nsUInt32Array *selection);
nsresult GenerateURIForMsgKey(nsMsgKey aMsgKey, nsIMsgFolder *folder, char ** aURI);
// routines used in building up view
virtual nsresult AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd);
virtual PRBool WantsThisThread(nsIMsgThread * thread);
virtual nsresult AddHdr(nsIMsgDBHdr *msgHdr);
PRBool GetShowingIgnored() {return (m_viewFlags & nsMsgViewFlagsType::kShowIgnored) != 0;}
virtual nsresult OnNewHeader(nsMsgKey newKey, nsMsgKey parentKey, PRBool ensureListed);
virtual nsMsgViewIndex GetInsertIndex(nsIMsgDBHdr *msgHdr);
nsMsgViewIndex GetIndexForThread(nsIMsgDBHdr *hdr);
virtual nsresult GetThreadContainingIndex(nsMsgViewIndex index, nsIMsgThread **thread);
virtual nsresult GetMsgHdrForViewIndex(nsMsgViewIndex index, nsIMsgDBHdr **msgHdr);
virtual nsresult InsertHdrAt(nsIMsgDBHdr *msgHdr, nsMsgViewIndex insertIndex);
nsresult ToggleExpansion(nsMsgViewIndex index, PRUint32 *numChanged);
nsresult ExpandByIndex(nsMsgViewIndex index, PRUint32 *pNumExpanded);
nsresult CollapseByIndex(nsMsgViewIndex index, PRUint32 *pNumCollapsed);
nsresult ExpandAll();
nsresult CollapseAll();
// helper routines for thread expanding and collapsing.
nsresult GetThreadCount(nsMsgKey messageKey, PRUint32 *pThreadCount);
nsMsgViewIndex GetIndexOfFirstDisplayedKeyInThread(nsIMsgThread *threadHdr);
nsresult GetFirstMessageHdrToDisplayInThread(nsIMsgThread *threadHdr, nsIMsgDBHdr **result);
nsMsgViewIndex ThreadIndexOfMsg(nsMsgKey msgKey,
nsMsgViewIndex msgIndex = nsMsgViewIndex_None,
PRInt32 *pThreadCount = nsnull,
PRUint32 *pFlags = nsnull);
nsMsgKey GetKeyOfFirstMsgInThread(nsMsgKey key);
PRInt32 CountExpandedThread(nsMsgViewIndex index);
nsresult ExpansionDelta(nsMsgViewIndex index, PRInt32 *expansionDelta);
nsresult ReverseSort();
nsresult ReverseThreads();
nsMsgKey GetAt(nsMsgViewIndex index) ;
nsMsgViewIndex FindViewIndex(nsMsgKey key)
{return (nsMsgViewIndex) (m_keys.FindIndex(key));}
virtual nsMsgViewIndex FindKey(nsMsgKey key, PRBool expand);
virtual nsresult GetDBForViewIndex(nsMsgViewIndex index, nsIMsgDatabase **db);
nsresult ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex viewIndex, PRUint32 *pNumListed);
nsresult ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex startOfThreadViewIndex, PRUint32 *pNumListed);
PRInt32 FindLevelInThread(nsIMsgDBHdr *msgHdr, nsMsgKey msgKey, nsMsgViewIndex startOfThreadViewIndex);
PRInt32 GetSize(void) {return(m_keys.GetSize());}
// notification api's
@ -58,16 +176,91 @@ protected:
void NoteEndChange(nsMsgViewIndex firstlineChanged, PRInt32 numChanged,
nsMsgViewNotificationCodeValue changeType);
// for commands
nsresult ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewIndex* indices,
PRInt32 numIndices);
nsresult ApplyCommandToIndicesWithFolder(nsMsgViewCommandTypeValue command, nsMsgViewIndex* indices,
PRInt32 numIndices, nsIMsgFolder *destFolder);
nsresult CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool isMove, nsIMsgFolder *destFolder);
nsresult DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool deleteStorage);
nsresult ToggleReadByIndex(nsMsgViewIndex index);
nsresult SetReadByIndex(nsMsgViewIndex index, PRBool read);
nsresult SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool read);
nsresult SetFlaggedByIndex(nsMsgViewIndex index, PRBool mark);
nsresult OrExtraFlag(nsMsgViewIndex index, PRUint32 orflag);
nsresult AndExtraFlag(nsMsgViewIndex index, PRUint32 andflag);
nsresult SetExtraFlag(nsMsgViewIndex index, PRUint32 extraflag);
virtual nsresult RemoveByIndex(nsMsgViewIndex index);
virtual void OnExtraFlagChanged(nsMsgViewIndex /*index*/, PRUint32 /*extraFlag*/) {}
virtual void OnHeaderAddedOrDeleted() {}
nsresult ToggleThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex);
nsresult ToggleThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index);
nsresult ToggleWatched( nsMsgViewIndex* indices, PRInt32 numIndices);
nsresult SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched);
nsresult SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored);
nsresult DownloadForOffline(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices);
nsresult DownloadFlaggedForOffline(nsIMsgWindow *window);
nsMsgViewIndex GetThreadFromMsgIndex(nsMsgViewIndex index,
nsIMsgThread **threadHdr);
// for sorting
nsresult GetFieldTypeAndLenForSort(nsMsgViewSortTypeValue sortType, PRUint16 *pMaxLen, eFieldType *pFieldType);
nsresult GetCollationKey(nsIMsgHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint8 **result, PRUint32 *len);
nsresult GetLongField(nsIMsgHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint32 *result);
nsresult GetPRTimeField(nsIMsgHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRTime *result);
// for view navigation
nsresult NavigateFromPos(nsMsgNavigationTypeValue motion, nsMsgViewIndex startIndex, nsMsgKey *pResultKey,
nsMsgViewIndex *pResultIndex, nsMsgViewIndex *pThreadIndex, PRBool wrap);
nsresult FindNextFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex);
nsresult FindFirstNew(nsMsgViewIndex *pResultIndex);
nsresult FindNextUnread(nsMsgKey startId, nsMsgKey *pResultKey, nsMsgKey *resultThreadId);
nsresult FindPrevUnread(nsMsgKey startKey, nsMsgKey *pResultKey, nsMsgKey *resultThreadId);
nsresult FindFirstFlagged(nsMsgViewIndex *pResultIndex);
nsresult FindPrevFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex);
nsresult MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
nsresult MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
PRBool IsValidIndex(nsMsgViewIndex index);
nsresult ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices, PRBool *resultToggleState);
nsresult GetKeyForFirstSelectedMessage(nsMsgKey *key);
PRUnichar * GetString(const PRUnichar *aStringName);
void InitializeAtomsAndLiterals();
PRInt32 GetLevelInUnreadView(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThread, nsMsgViewIndex viewIndex);
void FreeAll(nsVoidArray *ptrs);
void ClearHdrCache();
nsMsgKeyArray m_keys;
nsUInt32Array m_flags;
nsByteArray m_levels;
nsUint8Array m_levels;
// cache the most recently asked for header and corresponding msgKey.
nsCOMPtr <nsIMsgDBHdr> m_cachedHdr;
nsMsgKey m_cachedMsgKey;
// we need to store the message key for the message we are currenty displaying to ensure we
// don't try to redisplay the same message just because the selection changed (i.e. after a sort)
nsMsgKey m_currentlyDisplayedMsgKey;
nsCOMPtr <nsIMsgFolder> m_folder;
PRBool mSpecialFolder; // for special folders, the Sender column really shows recipients.
nsCOMPtr <nsIMsgDatabase> m_db;
PRBool m_sortValid;
nsMsgViewSortTypeValue m_sortType;
nsMsgViewSortOrderValue m_sortOrder;
nsMsgDBViewTypeValue m_viewType;
nsMsgViewFlagsTypeValue m_viewFlags;
nsCOMPtr<nsIDOMElement> mCurrentSortColumn;
// I18N date formater service which we'll want to cache locally.
nsCOMPtr<nsIDateTimeFormat> mDateFormater;
nsCOMPtr<nsIMsgHeaderParser> mHeaderParser;
// i'm not sure if we are going to permamently need a nsIMessenger instance or if we'll be able
// to phase it out eventually....for now we need it though.
nsCOMPtr<nsIMessenger> mMessengerInstance;
nsCOMPtr<nsIMsgWindow> mMsgWindow;
nsCOMPtr<nsIMsgDBViewCommandUpdater> mCommandUpdater; // we push command update notifications to the UI from this.
nsCOMPtr<nsIStringBundle> mMessengerStringBundle;
};
#endif

Просмотреть файл

@ -23,6 +23,7 @@
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIMsgFolder.h"
#include "nsIMsgHdr.h"
#include "nsIFileSpec.h"
#include "nsIStreamListener.h"
#include "nsIMsgMessageService.h"
@ -32,7 +33,6 @@
#include "nsMsgUtils.h"
#include "nsIRDFService.h"
#include "nsIDBFolderInfo.h"
#include "nsIMessage.h"
#include "nsRDFCID.h"
#include "nsMsgFolderCompactor.h"
@ -336,22 +336,9 @@ nsFolderCompactState::FinishCompact()
}
nsresult
nsFolderCompactState::GetMessage(nsIMessage **message)
nsFolderCompactState::GetMessage(nsIMsgDBHdr **message)
{
nsresult rv = NS_ERROR_NULL_POINTER;
if (!message) return rv;
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIRDFResource> msgResource;
if(NS_SUCCEEDED(rdfService->GetResource(m_messageUri,
getter_AddRefs(msgResource))))
rv = msgResource->QueryInterface(NS_GET_IID(nsIMessage),
(void**)message);
}
return rv;
return GetMsgDBHdrFromURI(m_messageUri, message);
}
@ -376,8 +363,6 @@ nsFolderCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
const PRUnichar *errorMsg)
{
nsresult rv = status;
nsCOMPtr<nsIMessage> message;
nsCOMPtr<nsIDBMessage> dbMessage;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIMsgDBHdr> msgHdr;
nsCOMPtr<nsIMsgDBHdr> newMsgHdr;
@ -385,13 +370,8 @@ nsFolderCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
if (NS_FAILED(rv)) goto done;
uri = do_QueryInterface(ctxt, &rv);
if (NS_FAILED(rv)) goto done;
rv = GetMessage(getter_AddRefs(message));
rv = GetMessage(getter_AddRefs(msgHdr));
if (NS_FAILED(rv)) goto done;
dbMessage = do_QueryInterface(message, &rv);
if (NS_FAILED(rv)) goto done;
rv = dbMessage->GetMsgDBHdr(getter_AddRefs(msgHdr));
if (NS_FAILED(rv)) goto done;
// okay done with the current message; copying the existing message header
// to the new database
m_db->CopyHdrFromExistingHdr(m_startOfNewMsg, msgHdr, PR_TRUE,
@ -477,8 +457,6 @@ nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt
const PRUnichar *errorMsg)
{
nsresult rv = status;
nsCOMPtr<nsIMessage> message;
nsCOMPtr<nsIDBMessage> dbMessage;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIMsgDBHdr> msgHdr;
nsCOMPtr<nsIMsgDBHdr> newMsgHdr;
@ -486,11 +464,7 @@ nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt
if (NS_FAILED(rv)) goto done;
uri = do_QueryInterface(ctxt, &rv);
if (NS_FAILED(rv)) goto done;
rv = GetMessage(getter_AddRefs(message));
if (NS_FAILED(rv)) goto done;
dbMessage = do_QueryInterface(message, &rv);
if (NS_FAILED(rv)) goto done;
rv = dbMessage->GetMsgDBHdr(getter_AddRefs(msgHdr));
rv = GetMessage(getter_AddRefs(msgHdr));
if (NS_FAILED(rv)) goto done;
msgHdr->SetMessageOffset(m_startOfNewMsg);

Просмотреть файл

@ -47,7 +47,7 @@ public:
virtual nsresult InitDB(nsIMsgDatabase *db);
nsresult CompactHelper(nsIMsgFolder *folder);
nsresult GetMessage(nsIMessage **message);
nsresult GetMessage(nsIMsgDBHdr **message);
nsresult BuildMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
char *m_baseMessageUri; // base message uri
nsCString m_messageUri; // current message uri being copy

Просмотреть файл

@ -28,7 +28,6 @@
#include "nsMsgFolderFlags.h"
#include "nsMsgRDFUtils.h"
#include "nsIMessage.h"
#include "rdf.h"
#include "nsIRDFService.h"
@ -44,7 +43,7 @@
#include "nsIMsgCopyService.h"
#include "nsMsgBaseCID.h"
#include "nsIInputStream.h"
#include "nsIMsgHdr.h"
#include "nsTraceRefcnt.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
@ -1573,7 +1572,7 @@ nsresult nsMsgFolderDataSource::DoCopyToFolder(nsIMsgFolder *dstFolder, nsISuppo
{
nsCOMPtr<nsISupports> supports = getter_AddRefs(arguments->ElementAt(i));
nsCOMPtr<nsIMessage> message(do_QueryInterface(supports));
nsCOMPtr<nsIMsgDBHdr> message(do_QueryInterface(supports));
if (message)
{
messageArray->AppendElement(supports);
@ -1654,7 +1653,7 @@ nsresult nsMsgFolderDataSource::DoDeleteFromFolder(
for(PRUint32 item = 0; item < itemCount; item++)
{
nsCOMPtr<nsISupports> supports = getter_AddRefs(arguments->ElementAt(item));
nsCOMPtr<nsIMessage> deletedMessage(do_QueryInterface(supports));
nsCOMPtr<nsIMsgDBHdr> deletedMessage(do_QueryInterface(supports));
nsCOMPtr<nsIMsgFolder> deletedFolder(do_QueryInterface(supports));
if (deletedMessage)
{

Просмотреть файл

@ -37,7 +37,6 @@
#include "nsIMsgMailSession.h"
#include "nsDateTimeFormatCID.h"
#include "nsMsgBaseCID.h"
#include "nsIMessageView.h"
#include "nsMsgUtils.h"
#include "nsTextFormatter.h"
@ -98,6 +97,8 @@ nsIAtom * nsMsgMessageDataSource::kStatusAtom = nsnull;
nsMsgMessageDataSource::nsMsgMessageDataSource()
{
NS_ASSERTION(0, "heh, this data source isn't supposed to be here anymore...investigate whose trying to load it");
mStringBundle = nsnull;
mHeaderParser = do_CreateInstance(kMsgHeaderParserCID);
@ -458,6 +459,7 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
*targets = nsnull;
if(kNC_MessageChild == property)
{
#if 0 // this should all go away
nsCOMPtr<nsIMessageView> messageView;
rv = GetMessageView(getter_AddRefs(messageView));
if (NS_SUCCEEDED(rv) && messageView) {
@ -469,6 +471,7 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
if(NS_SUCCEEDED(rv) && *targets)
return rv;
}
#endif
}
nsCOMPtr<nsIMessage> message(do_QueryInterface(source, &rv));
@ -539,7 +542,9 @@ nsMsgMessageDataSource::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc,
nsCOMPtr<nsIMessage> message(do_QueryInterface(source, &rv));
if (NS_SUCCEEDED(rv)) {
PRBool showThreads;
#if 0 // this should all go away.
rv = GetIsThreaded(&showThreads);
#endif
// handle this failure gracefully - not all datasources have views.
if (NS_SUCCEEDED(rv) && showThreads) {
@ -587,9 +592,10 @@ NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsOut(nsIRDFResource* source,
nsCOMPtr<nsIMessage> message(do_QueryInterface(source, &rv));
if (NS_SUCCEEDED(rv))
{
PRBool showThreads;
#if 0
rv = GetIsThreaded(&showThreads);
#endif
// handle this failure gracefully - not all datasources have views.
if(NS_SUCCEEDED(rv) && showThreads)
@ -801,7 +807,9 @@ nsresult nsMsgMessageDataSource::OnItemAddedOrRemovedFromMessage(nsIMessage *par
//We only handle threaded views
PRBool isThreaded, isThreadNotification;
#if 0
GetIsThreaded(&isThreaded);
#endif
isThreadNotification = PL_strcmp(viewString, "threadMessageView") == 0;
if((isThreaded && isThreadNotification))
@ -849,7 +857,9 @@ nsresult nsMsgMessageDataSource::OnItemAddedOrRemovedFromFolder(nsIMsgFolder *pa
//a non threaded view only do this if the view passed in is the flat view.
PRBool isThreaded, isThreadNotification;
#if 0
GetIsThreaded(&isThreaded);
#endif
isThreadNotification = PL_strcmp(viewString, "threadMessageView") == 0;
if((isThreaded && isThreadNotification) ||
@ -954,7 +964,9 @@ nsresult nsMsgMessageDataSource::OnChangeStatus(nsIRDFResource *resource, PRUint
{
OnChangeIsUnread(resource, oldFlag, newFlag);
PRBool showThreads;
#if 0
GetIsThreaded(&showThreads);
#endif
if(showThreads)
{
nsCOMPtr<nsIMessage> message = do_QueryInterface(resource);
@ -1237,7 +1249,12 @@ nsMsgMessageDataSource::createMessageNameNode(nsIMessage *message,
nsXPIDLString subject;
if(sort)
{
#if 0
rv = message->GetSubjectCollationKey(getter_Copies(subject));
#else
printf("I'm breaking this for now, this datasource will be going away\n");
rv = NS_ERROR_FAILURE;
#endif
}
else
{
@ -1275,9 +1292,14 @@ nsMsgMessageDataSource::createMessageSenderNode(nsIMessage *message,
nsAutoString senderUserName;
if(sort)
{
#if 0
rv = message->GetAuthorCollationKey(getter_Copies(sender));
if(NS_SUCCEEDED(rv))
rv = createNode(sender, target, getRDFService());
#else
printf("I'm breaking this for now, this datasource will be going away\n");
rv = NS_ERROR_FAILURE;
#endif
}
else
{
@ -1300,9 +1322,14 @@ nsMsgMessageDataSource::createMessageRecipientNode(nsIMessage *message,
nsAutoString recipientUserName;
if(sort)
{
#if 0
rv = message->GetRecipientsCollationKey(getter_Copies(recipients));
if(NS_SUCCEEDED(rv))
rv = createNode(recipients, target, getRDFService());
#else
printf("I'm breaking this for now, this datasource will be going away\n");
rv = NS_ERROR_FAILURE;
#endif
}
else
{
@ -1479,9 +1506,9 @@ nsMsgMessageDataSource::createMessageThreadStateNode(nsIMessage *message, nsIRDF
nsresult rv = NS_OK;
PRBool showThreads;
#if 0
GetIsThreaded(&showThreads);
#endif
if(showThreads)
{
@ -1741,8 +1768,9 @@ nsresult nsMsgMessageDataSource::createMessageTotalNode(nsIMessage *message, nsI
nsAutoString emptyString;
PRBool showThreads;
#if 0
GetIsThreaded(&showThreads);
#endif
if(!showThreads)
rv = createNode(emptyString, target, getRDFService());
else
@ -1776,7 +1804,9 @@ nsresult nsMsgMessageDataSource::createMessageUnreadNode(nsIMessage *message, ns
nsAutoString emptyString;
PRBool showThreads;
#if 0
rv = GetIsThreaded(&showThreads);
#endif
if(NS_FAILED(rv)) return rv;
if(!showThreads)
@ -1857,11 +1887,9 @@ nsresult
nsMsgMessageDataSource::createMessageChildNode(nsIRDFResource *resource, nsIRDFNode** target)
{
nsresult rv;
nsCOMPtr<nsIMessageView> messageView;
#if 0
rv = GetMessageView(getter_AddRefs(messageView));
NS_ENSURE_SUCCESS(rv,rv);
PRBool hasMessages = PR_FALSE;
rv = messageView->HasMessages(resource, mWindow, &hasMessages);
NS_ENSURE_SUCCESS(rv,rv);
@ -1869,6 +1897,7 @@ nsMsgMessageDataSource::createMessageChildNode(nsIRDFResource *resource, nsIRDFN
if (hasMessages) {
return createNode("has messages", target, getRDFService());
}
#endif
return NS_RDF_NO_VALUE;
@ -2060,8 +2089,9 @@ nsresult nsMsgMessageDataSource::DoMessageHasAssertion(nsIMessage *message, nsIR
if(kNC_MessageChild == property)
{
PRBool isThreaded;
#if 0
GetIsThreaded(&isThreaded);
#endif
//We only care if we're in the threaded view. Otherwise just say we don't have the assertion.
if(isThreaded)
{

Просмотреть файл

@ -332,47 +332,6 @@ NS_IMETHODIMP nsMsgRDFDataSource::SetWindow(nsIMsgWindow * aWindow)
return NS_OK;
}
nsresult
nsMsgRDFDataSource::GetIsThreaded(PRBool *threaded)
{
nsresult rv;
nsCOMPtr<nsIMessageView> messageView;
rv = GetMessageView(getter_AddRefs(messageView));
if (NS_FAILED(rv)) return rv;
if (messageView)
return messageView->GetShowThreads(threaded);
else
*threaded = PR_FALSE;
return NS_OK;
}
nsresult
nsMsgRDFDataSource::GetViewType(PRUint32 *viewType)
{
nsresult rv;
nsCOMPtr<nsIMessageView> messageView;
rv = GetMessageView(getter_AddRefs(messageView));
if(NS_FAILED(rv)) return rv;
rv = messageView->GetViewType(viewType);
return rv;
}
nsresult
nsMsgRDFDataSource::GetMessageView(nsIMessageView **messageView)
{
if(!mWindow)
return NS_ERROR_NULL_POINTER;
return mWindow->GetMessageView(messageView);
}
nsIRDFService *
nsMsgRDFDataSource::getRDFService()

Просмотреть файл

@ -73,9 +73,6 @@ class nsMsgRDFDataSource : public nsIRDFDataSource,
PRBool m_shuttingDown;
PRBool mInitialized;
nsresult GetIsThreaded(PRBool *threaded);
nsresult GetViewType(PRUint32 *viewType);
nsresult GetMessageView(nsIMessageView **messageView);
private:
nsCOMPtr<nsIRDFService> mRDFService;

Просмотреть файл

@ -106,19 +106,12 @@ typedef struct _nsMsgRDFNotification {
#define NC_RDF_COPYFOLDER NC_NAMESPACE_URI "CopyFolder"
#define NC_RDF_MOVEFOLDER NC_NAMESPACE_URI "MoveFolder"
#define NC_RDF_MARKALLMESSAGESREAD NC_NAMESPACE_URI "MarkAllMessagesRead"
#define NC_RDF_MARKTHREADREAD NC_NAMESPACE_URI "MarkThreadRead"
#define NC_RDF_COMPACT NC_NAMESPACE_URI "Compact"
#define NC_RDF_COMPACTALL NC_NAMESPACE_URI "CompactAll"
#define NC_RDF_RENAME NC_NAMESPACE_URI "Rename"
#define NC_RDF_EMPTYTRASH NC_NAMESPACE_URI "EmptyTrash"
#define NC_RDF_DOWNLOADFLAGGED NC_NAMESPACE_URI "DownloadFlaggedMessages"
#define NC_RDF_DOWNLOADSELECTED NC_NAMESPACE_URI "DownloadSelectedMessages"
//Message Commands
#define NC_RDF_MARKREAD NC_NAMESPACE_URI "MarkRead"
#define NC_RDF_MARKUNREAD NC_NAMESPACE_URI "MarkUnread"
#define NC_RDF_TOGGLEREAD NC_NAMESPACE_URI "ToggleRead"
#define NC_RDF_MARKFLAGGED NC_NAMESPACE_URI "MarkFlagged"
#define NC_RDF_MARKUNFLAGGED NC_NAMESPACE_URI "MarkUnflagged"
//Returns PR_TRUE if r1 is equal to r2 and r2 is the sort property.

Просмотреть файл

@ -36,15 +36,15 @@ nsMsgThreadedDBView::~nsMsgThreadedDBView()
/* destructor code */
}
NS_IMETHODIMP nsMsgThreadedDBView::Open(nsIMsgDatabase *msgDB, nsMsgViewSortTypeValue viewType, PRInt32 *pCount)
NS_IMETHODIMP nsMsgThreadedDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, nsMsgViewFlagsTypeValue viewFlags, PRInt32 *pCount)
{
nsresult rv;;
rv = nsMsgDBView::Open(msgDB, viewType, pCount);
NS_ENSURE_SUCCESS(rv, rv);
nsresult rv;
rv = nsMsgDBView::Open(folder, sortType, sortOrder, viewFlags, pCount);
NS_ENSURE_SUCCESS(rv, rv);
if (pCount)
*pCount = 0;
return Init(pCount);
return InitThreadedView(pCount);
}
NS_IMETHODIMP nsMsgThreadedDBView::Close()
@ -52,40 +52,34 @@ NS_IMETHODIMP nsMsgThreadedDBView::Close()
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgThreadedDBView::Init(PRInt32 *pCount)
nsresult nsMsgThreadedDBView::InitThreadedView(PRInt32 *pCount)
{
#ifndef DEBUG_seth
nsresult rv;
nsMsgViewSortOrderValue sortOrder;
nsMsgViewSortTypeValue sortType;
m_keys.RemoveAll();
m_keys.RemoveAll();
m_flags.RemoveAll();
// m_levels.RemoveAll(); // ### need to add this method to nsByteArray
m_prevIdArray.RemoveAll();
m_levels.RemoveAll();
m_prevKeys.RemoveAll();
m_prevFlags.RemoveAll();
// m_prevLevels.RemoveAll();
m_prevLevels.RemoveAll();
m_havePrevView = PR_FALSE;
m_sortType = nsMsgViewSortType::byThread; // this sorts by thread, which we will resort.
sortType = m_sortType;
nsresult getSortrv = NS_OK; // ### TODO m_db->GetSortInfo(&sortType, &sortOrder);
#ifdef HAVE_BRANCH_YET
// list all the ids into m_idArray.
// list all the ids into m_keys.
nsMsgKey startMsg = 0;
do
{
const int kIdChunkSize = 200;
const PRInt32 kIdChunkSize = 200;
PRInt32 numListed = 0;
nsMsgKey idArray[kIdChunkSize];
PRInt32 flagArray[kIdChunkSize];
char levelArray[kIdChunkSize];
rv = ListThreadIds(&startMsg, m_viewType == nsMsgDBViewType::onlyUnreadHeaders, idArray, flagArray,
rv = ListThreadIds(&startMsg, (m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) != 0, idArray, flagArray,
levelArray, kIdChunkSize, &numListed, nsnull);
if (NS_SUCCEEDED(rv))
{
PRInt32 numAdded = AddKeys(idArray, flagArray, levelArray, sortType, numListed);
PRInt32 numAdded = AddKeys(idArray, flagArray, levelArray, m_sortType, numListed);
if (pCount)
*pCount += numAdded;
}
@ -94,27 +88,92 @@ NS_IMETHODIMP nsMsgThreadedDBView::Init(PRInt32 *pCount)
if (NS_SUCCEEDED(getSortrv))
{
InitSort(sortType, sortOrder);
rv = InitSort(m_sortType, m_sortOrder);
}
#endif
return rv;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP nsMsgThreadedDBView::AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd)
nsresult nsMsgThreadedDBView::AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd)
{
return NS_ERROR_NOT_IMPLEMENTED;
PRInt32 numAdded = 0;
for (PRInt32 i = 0; i < numKeysToAdd; i++)
{
PRInt32 threadFlag = pFlags[i];
PRInt32 flag = threadFlag;
// skip ignored threads.
if ((threadFlag & MSG_FLAG_IGNORED) && !(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
continue;
// by default, make threads collapsed, unless we're in only viewing new msgs
if (flag & MSG_VIEW_FLAG_HASCHILDREN)
flag |= MSG_FLAG_ELIDED;
// should this be persistent? Doesn't seem to need to be.
flag |= MSG_VIEW_FLAG_ISTHREAD;
m_keys.Add(pKeys[i]);
m_flags.Add(flag);
m_levels.Add(pLevels[i]);
numAdded++;
if ((/*m_viewFlags & nsMsgViewFlagsType::kUnreadOnly || */(sortType != nsMsgViewSortType::byThread)) && flag & MSG_FLAG_ELIDED)
{
ExpandByIndex(m_keys.GetSize() - 1, NULL);
}
}
return numAdded;
}
NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
{
nsresult rv;
rv = nsMsgDBView::Sort(sortType,sortOrder);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
// if the client wants us to forget our cached id arrays, they
// should build a new view. If this isn't good enough, we
// need a method to do that.
if (sortType != m_sortType || !m_sortValid)
{
if (sortType == nsMsgViewSortType::byThread)
{
m_sortType = sortType;
m_viewFlags |= nsMsgViewFlagsType::kThreadedDisplay;
if ( m_havePrevView)
{
// restore saved id array and flags array
m_keys.RemoveAll();
m_keys.InsertAt(0, &m_prevKeys);
m_flags.RemoveAll();
m_flags.InsertAt(0, &m_prevFlags);
m_levels.RemoveAll();
m_levels.InsertAt(0, &m_prevLevels);
// m_messageDB->SetSortInfo(sortType, sortOrder);
m_sortValid = PR_TRUE;
return NS_OK;
}
else
{
// set sort info in anticipation of what Init will do.
InitThreadedView(nsnull); // build up thread list.
if (sortOrder != nsMsgViewSortOrder::ascending)
Sort(sortType, sortOrder);
return NS_OK;
}
}
else if (sortType != nsMsgViewSortType::byThread && m_sortType == nsMsgViewSortType::byThread /* && !m_havePrevView*/)
{
// going from SortByThread to non-thread sort - must build new key, level,and flags arrays
m_prevKeys.RemoveAll();
m_prevKeys.InsertAt(0, &m_keys);
m_prevFlags.RemoveAll();
m_prevFlags.InsertAt(0, &m_flags);
m_prevLevels.RemoveAll();
m_prevLevels.InsertAt(0, &m_levels);
ExpandAll();
// m_idArray.RemoveAll();
// m_flags.RemoveAll();
m_havePrevView = PR_TRUE;
m_viewFlags &= ~nsMsgViewFlagsType::kThreadedDisplay;
}
}
// call the base class in case we're not sorting by thread
return nsMsgDBView::Sort(sortType, sortOrder);
}
@ -124,10 +183,9 @@ NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgVi
nsresult nsMsgThreadedDBView::ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnly, nsMsgKey *pOutput, PRInt32 *pFlags, char *pLevels,
PRInt32 numToList, PRInt32 *pNumListed, PRInt32 *pTotalHeaders)
{
#ifndef DEBUG_seth
nsresult rv = NS_OK;
// N.B..don't ret before assigning numListed to *pNumListed
PRInt32 numListed = 0;
PRInt32 numListed = 0;
if (*startMsg > 0)
{
@ -136,62 +194,63 @@ nsresult nsMsgThreadedDBView::ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnl
}
else
{
PRUint32 viewType;
if (m_viewType == nsMsgDBViewType::allThreads)
viewType = nsMsgViewType::eShowAll;
else
viewType = nsMsgViewType::eShowUnread;
rv = m_db->EnumerateThreads(viewType, getter_AddRefs(m_threadEnumerator));
rv = m_db->EnumerateThreads(getter_AddRefs(m_threadEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
}
PRBool hasMore = PR_FALSE;
#ifdef HAVE_BRANCH_YET
nsCOMPtr <nsIMsgThread> threadHdr ;
while (NS_SUCCEEDED(rv = m_threadEnumerator->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE))
{
nsCOMPtr <nsISupports> supports;
rv = m_threadEnumerator->GetNext(getter_AddRefs(supports));
nsCOMPtr <nsIMsgThread> threadHdr = do_QueryInterface(supports);
NS_ENSURE_SUCCESS(rv,rv);
threadHdr = do_QueryInterface(supports);
PRInt32 threadCount;
PRInt32 threadsRemoved = 0;
for (PRInt32 i = 0; i < numToList && threadHdr != nsnull; i++)
for (numListed = 0; numListed < numToList && threadHdr != nsnull;)
{
nsCOMPtr <nsIMsgDBHdr> msgHdr;
PRUint32 numChildren;
threadHdr->GetNumChildren(&numChildren);
if (unreadOnly)
threadHdr->GetNumUnreadChildren(&numChildren);
else
threadHdr->GetNumChildren(&numChildren);
PRUint32 threadFlags;
threadHdr->GetFlags(&threadFlags);
if (numChildren != 0) // not empty thread
{
if (pTotalHeaders)
*pTotalHeaders += numChildren;
// ### do this on branch if (unreadOnly)
// msgHdr = threadHdr->GetFirstUnreadChild(this);
// else
if (unreadOnly)
rv = threadHdr->GetFirstUnreadChild(getter_AddRefs(msgHdr));
else
rv = threadHdr->GetChildAt(0, getter_AddRefs(msgHdr));
if (msgHdr != NULL && WantsThisThread(threadHdr))
if (NS_SUCCEEDED(rv) && msgHdr != nsnull && WantsThisThread(threadHdr))
{
PRUint32 msgFlags;
PRUint32 newMsgFlags;
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
msgHdr->GetFlags(&msgFlags);
// turn off high byte of msg flags - used for view flags.
msgFlags &= ~MSG_VIEW_FLAGS;
pOutput[numListed] = msgKey;
pLevels[numListed] = 0;
// DMB TODO - This will do for now...Until we decide how to
// handle thread flags vs. message flags, if we do decide
// to make them different.
msgHdr->OrFlags(threadFlags & (kWatched | kIgnored));
msgHdr->OrFlags(threadFlags & (MSG_FLAG_WATCHED | MSG_FLAG_IGNORED), &newMsgFlags);
PRBool isRead = PR_FALSE;
// make sure DB agrees with newsrc, if we're news.
IsRead(msgKey, &isRead);
MarkHdrRead(msgHdr, isRead, nsnull);
// try adding in kIsThread flag for unreadonly view.
pFlags[numListed] = msgHdr->m_flags | kIsThread | threadFlags;
if (NS_SUCCEEDED(GetThreadCount(threadHdr, &threadCount)) && threadCount > 1)
pFlags[numListed] |= kHasChildren;
m_db->IsRead(msgKey, &isRead);
m_db->MarkHdrRead(msgHdr, isRead, nsnull);
// try adding in MSG_VIEW_FLAG_ISTHREAD flag for unreadonly view.
pFlags[numListed] = msgFlags | MSG_VIEW_FLAG_ISTHREAD | threadFlags;
if (numChildren > 1)
pFlags[numListed] |= MSG_VIEW_FLAG_HASCHILDREN;
numListed++;
}
@ -205,25 +264,24 @@ nsresult nsMsgThreadedDBView::ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnl
printf("removing empty non-ignored non-watched thread\n");
#endif
}
threadHdr = nextThreadHdr;
rv = m_threadEnumerator->GetNext(getter_AddRefs(supports));
threadHdr = do_QueryInterface(supports);
}
if (numListed >= numToList)
break;
}
if (threadHdr != NULL)
if (threadHdr)
{
*startMsg = threadHdr->fID;
threadHdr->GetThreadKey(startMsg);
}
else
{
*startMsg = nsMsgKey_None;
m_threadEnumerator = nsnull;
}
#endif // HAVE_BRANCH_YET
*pNumListed = numListed;
return rv;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
nsresult nsMsgThreadedDBView::ExpandAll()
@ -232,37 +290,304 @@ nsresult nsMsgThreadedDBView::ExpandAll()
// go through expanding in place
for (PRUint32 i = 0; i < m_keys.GetSize(); i++)
{
#ifdef HAVE_BRANCH_YET
PRUint32 numExpanded;
PRUint32 flags = m_flags[i];
if (flags & kHasChildren && (flags & MSG_FLAG_ELIDED))
if (flags & MSG_VIEW_FLAG_HASCHILDREN && (flags & MSG_FLAG_ELIDED))
{
rv = ExpandByIndex(i, &numExpanded);
i += numExpanded;
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
}
return rv;
}
void nsMsgThreadedDBView::OnExtraFlagChanged(nsMsgViewIndex index, PRUint32 extraFlag)
{
if (IsValidIndex(index) && m_havePrevView)
{
nsMsgKey keyChanged = m_keys[index];
nsMsgViewIndex prevViewIndex = m_prevKeys.FindIndex(keyChanged);
if (prevViewIndex != nsMsgViewIndex_None)
{
PRUint32 prevFlag = m_prevFlags.GetAt(prevViewIndex);
// don't want to change the elided bit, or has children or is thread
if (prevFlag & MSG_FLAG_ELIDED)
extraFlag |= MSG_FLAG_ELIDED;
else
extraFlag &= ~MSG_FLAG_ELIDED;
if (prevFlag & MSG_VIEW_FLAG_ISTHREAD)
extraFlag |= MSG_VIEW_FLAG_ISTHREAD;
else
extraFlag &= ~MSG_VIEW_FLAG_ISTHREAD;
if (prevFlag & MSG_VIEW_FLAG_HASCHILDREN)
extraFlag |= MSG_VIEW_FLAG_HASCHILDREN;
else
extraFlag &= ~MSG_VIEW_FLAG_HASCHILDREN;
m_prevFlags.SetAt(prevViewIndex, extraFlag); // will this be right?
}
}
// we don't really know what's changed, but to be on the safe side, set the sort invalid
// so that reverse sort will pick it up.
if (m_sortType == nsMsgViewSortType::byStatus || m_sortType == nsMsgViewSortType::byFlagged ||
m_sortType == nsMsgViewSortType::byUnread || m_sortType == nsMsgViewSortType::byPriority)
m_sortValid = PR_FALSE;
}
void nsMsgThreadedDBView::OnHeaderAddedOrDeleted()
{
ClearPrevIdArray();
}
void nsMsgThreadedDBView::ClearPrevIdArray()
{
m_prevKeys.RemoveAll();
m_prevFlags.RemoveAll();
m_havePrevView = PR_FALSE;
}
nsresult nsMsgThreadedDBView::InitSort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder)
{
#ifdef HAVE_BRANCH_YET
if (sortType == nsMsgViewSortType::byThread)
{
SortInternal(nsMsgViewSortType::byId, sortOrder); // sort top level threads by id.
nsMsgDBView::Sort(nsMsgViewSortType::byId, sortOrder); // sort top level threads by id.
m_sortType = nsMsgViewSortType::byThread;
m_db->SetSortInfo(m_sortType, sortOrder);
m_viewFlags |= nsMsgViewFlagsType::kThreadedDisplay;
// m_db->SetSortInfo(m_sortType, sortOrder);
}
if ((m_viewFlags & kUnreadOnly) && m_sortType == nsMsgViewSortType::byThread)
else
m_viewFlags &= ~nsMsgViewFlagsType::kThreadedDisplay;
// by default, the unread only view should have all threads expanded.
if ((m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) && m_sortType == nsMsgViewSortType::byThread)
ExpandAll();
m_sortValid = PR_TRUE;
if (sortType != nsMsgViewSortType::byThread)
ExpandAll(); // for now, expand all and do a flat sort.
Sort(sortType, sortOrder);
if (sortType != SortByThread) // forget prev view, since it has everything expanded.
if (sortType != nsMsgViewSortType::byThread) // forget prev view, since it has everything expanded.
ClearPrevIdArray();
#endif
return NS_OK;
}
nsresult nsMsgThreadedDBView::OnNewHeader(nsMsgKey newKey, nsMsgKey aParentKey, PRBool ensureListed)
{
nsresult rv = NS_OK;
// views can override this behaviour, which is to append to view.
// This is the mail behaviour, but threaded views want
// to insert in order...
nsCOMPtr <nsIMsgDBHdr> msgHdr;
rv = m_db->GetMsgHdrForKey(newKey, getter_AddRefs(msgHdr));
if (NS_SUCCEEDED(rv) && msgHdr != nsnull)
{
PRUint32 msgFlags;
msgHdr->GetFlags(&msgFlags);
if ((m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) && !ensureListed && (msgFlags & MSG_FLAG_READ))
return NS_OK;
// Currently, we only add the header in a threaded view if it's a thread.
// We used to check if this was the first header in the thread, but that's
// a bit harder in the unreadOnly view. But we'll catch it below.
if (! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))// || msgHdr->GetMessageKey() == m_messageDB->GetKeyOfFirstMsgInThread(msgHdr->GetMessageKey()))
rv = AddHdr(msgHdr);
else // need to find the thread we added this to so we can change the hasnew flag
// added message to existing thread, but not to view
{ // Fix flags on thread header.
PRInt32 threadCount;
PRUint32 threadFlags;
nsMsgViewIndex threadIndex = ThreadIndexOfMsg(newKey, nsMsgViewIndex_None, &threadCount, &threadFlags);
if (threadIndex != nsMsgViewIndex_None)
{
// check if this is now the new thread hdr
PRUint32 flags = m_flags[threadIndex];
// if we have a collapsed thread which just got a new
// top of thread, change the keys array.
char level = 0; // ### TODO
if ((flags & MSG_FLAG_ELIDED) && level == 0
&& (!(m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) || !(msgFlags & MSG_FLAG_READ)))
{
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
m_keys.SetAt(threadIndex, msgKey);
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
}
if (! (flags & MSG_VIEW_FLAG_HASCHILDREN))
{
flags |= MSG_VIEW_FLAG_HASCHILDREN | MSG_VIEW_FLAG_ISTHREAD;
if (!(m_viewFlags & nsMsgViewFlagsType::kUnreadOnly))
flags |= MSG_FLAG_ELIDED;
m_flags[threadIndex] = flags;
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
}
if (! (flags & MSG_FLAG_ELIDED)) // thread is expanded
{ // insert child into thread
PRUint8 level = 0; // levels of other hdrs may have changed!
PRUint32 newFlags = msgFlags;
nsMsgViewIndex insertIndex = 0;
#if 0
insertIndex = GetInsertInfoForNewHdr(newKey, threadIndex, &level);
#endif
// this header is the new king! try collapsing the existing thread,
// removing it, installing this header as king, and expanding it.
if (level == 0)
{
CollapseByIndex(threadIndex, nsnull);
// call base class, so child won't get promoted.
nsMsgDBView::RemoveByIndex(threadIndex);
newFlags |= MSG_VIEW_FLAG_ISTHREAD | MSG_VIEW_FLAG_HASCHILDREN | MSG_FLAG_ELIDED;
}
m_keys.InsertAt(insertIndex, newKey);
m_flags.InsertAt(insertIndex, newFlags, 1);
m_levels.InsertAt(insertIndex, level);
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
if (level == 0)
ExpandByIndex(threadIndex, nsnull);
}
}
else // adding msg to thread that's not in view.
{
nsCOMPtr <nsIMsgThread> threadHdr;
m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(threadHdr));
if (threadHdr)
{
AddMsgToThreadNotInView(threadHdr, msgHdr, ensureListed);
}
}
}
}
else
rv = NS_MSG_MESSAGE_NOT_FOUND;
return rv;
}
nsresult nsMsgThreadedDBView::AddMsgToThreadNotInView(nsIMsgThread *threadHdr, nsIMsgDBHdr *msgHdr, PRBool ensureListed)
{
nsresult rv = NS_OK;
PRUint32 threadFlags;
threadHdr->GetFlags(&threadFlags);
if (!(threadFlags & MSG_FLAG_IGNORED))
rv = AddHdr(msgHdr);
return rv;
}
// This method just removes the specified line from the view. It does
// NOT delete it from the database.
nsresult nsMsgThreadedDBView::RemoveByIndex(nsMsgViewIndex index)
{
nsresult rv = NS_OK;
PRInt32 flags;
if (!IsValidIndex(index))
return NS_MSG_INVALID_DBVIEW_INDEX;
flags = m_flags[index];
if (! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))
return nsMsgDBView::RemoveByIndex(index);
nsCOMPtr <nsIMsgThread> threadHdr;
GetThreadContainingIndex(index, getter_AddRefs(threadHdr));
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 numThreadChildren;
threadHdr->GetNumChildren(&numThreadChildren);
// check if we're the top level msg in the thread, and we're not collapsed.
if ((flags & MSG_VIEW_FLAG_ISTHREAD) && !(flags & MSG_FLAG_ELIDED) && (flags & MSG_VIEW_FLAG_HASCHILDREN))
{
// fix flags on thread header...Newly promoted message
// should have flags set correctly
if (threadHdr)
{
nsMsgDBView::RemoveByIndex(index);
nsCOMPtr <nsIMsgThread> nextThreadHdr;
if (numThreadChildren > 0)
{
// unreadOnly
nsCOMPtr <nsIMsgDBHdr> msgHdr;
rv = threadHdr->GetChildHdrAt(0, getter_AddRefs(msgHdr));
if (msgHdr != nsnull)
{
PRUint32 flag = 0;
msgHdr->GetFlags(&flag);
if (numThreadChildren > 1)
flag |= MSG_VIEW_FLAG_ISTHREAD | MSG_VIEW_FLAG_HASCHILDREN;
m_flags.SetAtGrow(index, flag);
m_levels.SetAtGrow(index, 0);
}
}
}
return rv;
}
else if (!(flags & MSG_VIEW_FLAG_ISTHREAD))
{
// we're not deleting the top level msg, but top level msg might be only msg in thread now
if (threadHdr && numThreadChildren == 1)
{
nsMsgKey msgKey;
rv = threadHdr->GetChildKeyAt(0, &msgKey);
if (NS_SUCCEEDED(rv))
{
nsMsgViewIndex threadIndex = FindViewIndex(msgKey);
if (threadIndex != nsMsgViewIndex_None)
{
PRUint32 flags = m_flags[threadIndex];
flags &= ~(MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED | MSG_VIEW_FLAG_HASCHILDREN);
m_flags[threadIndex] = flags;
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
}
}
}
return nsMsgDBView::RemoveByIndex(index);
}
// deleting collapsed thread header is special case. Child will be promoted,
// so just tell FE that line changed, not that it was deleted
if (threadHdr && numThreadChildren > 0) // header has aleady been deleted from thread
{
// change the id array and flags array to reflect the child header.
// If we're not deleting the header, we want the second header,
// Otherwise, the first one (which just got promoted).
nsCOMPtr <nsIMsgDBHdr> msgHdr;
rv = threadHdr->GetChildHdrAt(0, getter_AddRefs(msgHdr));
if (msgHdr != nsnull)
{
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
m_keys.SetAt(index, msgKey);
PRUint32 flag = 0;
msgHdr->GetFlags(&flag);
// CopyDBFlagsToExtraFlags(msgHdr->GetFlags(), &flag);
// if (msgHdr->GetArticleNum() == msgHdr->GetThreadId())
flag |= MSG_VIEW_FLAG_ISTHREAD;
if (numThreadChildren == 1) // if only hdr in thread (with one about to be deleted)
// adjust flags.
{
flag &= ~MSG_VIEW_FLAG_HASCHILDREN;
flag &= ~MSG_FLAG_ELIDED;
// tell FE that thread header needs to be repainted.
NoteChange(index, 1, nsMsgViewNotificationCode::changed);
}
else
{
flag |= MSG_VIEW_FLAG_HASCHILDREN;
flag |= MSG_FLAG_ELIDED;
}
m_flags[index] = flag;
}
else
NS_ASSERTION(PR_FALSE, "couldn't find thread child");
NoteChange(index, 1, nsMsgViewNotificationCode::changed);
}
else
rv = nsMsgDBView::RemoveByIndex(index);
return rv;
}
NS_IMETHODIMP nsMsgThreadedDBView::GetViewType(nsMsgViewTypeValue *aViewType)
{
NS_ENSURE_ARG_POINTER(aViewType);
*aViewType = nsMsgViewType::eShowAllThreads;
return NS_OK;
}

Просмотреть файл

@ -34,23 +34,32 @@ public:
nsMsgThreadedDBView();
virtual ~nsMsgThreadedDBView();
NS_IMETHOD Open(nsIMsgDatabase *msgDB, nsMsgViewSortTypeValue viewType, PRInt32 *count);
NS_IMETHOD Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, nsMsgViewFlagsTypeValue viewFlags, PRInt32 *pCount);
NS_IMETHOD Close();
NS_IMETHOD Init(PRInt32 *pCount);
NS_IMETHOD AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd);
virtual nsresult AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const char *pLevels, nsMsgViewSortTypeValue sortType, PRInt32 numKeysToAdd);
NS_IMETHOD Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder);
NS_IMETHOD GetViewType(nsMsgViewTypeValue *aViewType);
protected:
virtual const char * GetViewName(void) {return "ThreadedDBView"; }
nsresult InitThreadedView(PRInt32 *pCount);
virtual nsresult OnNewHeader(nsMsgKey newKey, nsMsgKey aParentKey, PRBool ensureListed);
virtual nsresult AddMsgToThreadNotInView(nsIMsgThread *threadHdr, nsIMsgDBHdr *msgHdr, PRBool ensureListed);
nsresult ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnly, nsMsgKey *pOutput, PRInt32 *pFlags, char *pLevels,
PRInt32 numToList, PRInt32 *pNumListed, PRInt32 *pTotalHeaders);
nsresult InitSort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder);
nsresult ExpandAll();
virtual void OnExtraFlagChanged(nsMsgViewIndex index, PRUint32 extraFlag);
virtual void OnHeaderAddedOrDeleted();
void ClearPrevIdArray();
virtual nsresult RemoveByIndex(nsMsgViewIndex index);
// these are used to save off the previous view so that bopping back and forth
// between two views is quick (e.g., threaded and flat sorted by date).
PRBool m_havePrevView;
nsMsgKeyArray m_prevIdArray;
nsMsgKeyArray m_prevKeys;
nsUInt32Array m_prevFlags;
nsByteArray m_prevLevels;
nsUint8Array m_prevLevels;
nsCOMPtr <nsISimpleEnumerator> m_threadEnumerator;
};

Просмотреть файл

@ -214,22 +214,6 @@ NS_IMETHODIMP nsMsgWindow::SetTransactionManager(nsITransactionManager * aTransa
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::GetMessageView(nsIMessageView * *aMessageView)
{
if(!aMessageView)
return NS_ERROR_NULL_POINTER;
*aMessageView = mMessageView;
NS_IF_ADDREF(*aMessageView);
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::SetMessageView(nsIMessageView * aMessageView)
{
mMessageView = aMessageView;
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::GetOpenFolder(nsIMsgFolder * *aOpenFolder)
{
if(!aOpenFolder)

Просмотреть файл

@ -26,7 +26,6 @@
#include "nsIMsgWindow.h"
#include "nsIMsgStatusFeedback.h"
#include "nsITransactionManager.h"
#include "nsIMessageView.h"
#include "nsIMsgFolder.h"
#include "nsIDocShell.h"
#include "nsIURIContentListener.h"
@ -51,7 +50,6 @@ protected:
nsCOMPtr<nsIMsgHeaderSink> mMsgHeaderSink;
nsCOMPtr<nsIMsgStatusFeedback> mStatusFeedback;
nsCOMPtr<nsITransactionManager> mTransactionManager;
nsCOMPtr<nsIMessageView> mMessageView;
nsCOMPtr<nsIMsgFolder> mOpenFolder;
nsCOMPtr<nsIMsgWindowCommands> mMsgWindowCommands;

Просмотреть файл

@ -24,6 +24,7 @@ nsMsgLineBuffer.h
nsMsgGroupRecord.h
nsUInt32Array.h
nsMsgKeySet.h
nsMsgKeyArray.h
nsMsgFolder.h
nsMsgDBFolder.h
nsLocalFolderSummarySpec.h

Просмотреть файл

@ -36,14 +36,15 @@ CPPSRCS = \
nsMsgLineBuffer.cpp \
nsMsgFolder.cpp \
nsMsgDBFolder.cpp \
nsUint8Array.cpp \
nsUInt32Array.cpp \
nsMsgKeySet.cpp \
nsMsgKeyArray.cpp \
nsLocalFolderSummarySpec.cpp \
nsNewsSummarySpec.cpp \
nsMsgIdentity.cpp \
nsMsgIncomingServer.cpp \
nsMsgUtils.cpp \
nsMessage.cpp \
nsMsgProtocol.cpp \
nsMsgMailNewsUrl.cpp \
nsMsgTxn.cpp \
@ -53,8 +54,10 @@ CPPSRCS = \
EXPORTS = \
nsMsgGroupRecord.h \
nsMsgLineBuffer.h \
nsUint8Array.h \
nsUInt32Array.h \
nsMsgKeySet.h \
nsMsgKeyArray.h \
nsMsgFolder.h \
nsMsgDBFolder.h \
nsLocalFolderSummarySpec.h \

Просмотреть файл

@ -31,7 +31,9 @@ EXPORTS= \
nsMsgLineBuffer.h \
nsMsgGroupRecord.h \
nsUInt32Array.h \
nsUint8Array.h \
nsMsgKeySet.h \
nsMsgKeyArray.h \
nsMsgFolder.h \
nsMsgDBFolder.h \
nsLocalFolderSummarySpec.h \
@ -62,8 +64,10 @@ LCFLAGS = \
CPP_OBJS= \
.\$(OBJDIR)\nsMsgGroupRecord.obj \
.\$(OBJDIR)\nsMsgLineBuffer.obj \
.\$(OBJDIR)\nsUint8Array.obj \
.\$(OBJDIR)\nsUInt32Array.obj \
.\$(OBJDIR)\nsMsgKeySet.obj \
.\$(OBJDIR)\nsMsgKeyArray.obj \
.\$(OBJDIR)\nsMsgFolder.obj \
.\$(OBJDIR)\nsMsgDBFolder.obj \
.\$(OBJDIR)\nsLocalFolderSummarySpec.obj \
@ -71,7 +75,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsMsgIncomingServer.obj \
.\$(OBJDIR)\nsNewsSummarySpec.obj \
.\$(OBJDIR)\nsMsgUtils.obj \
.\$(OBJDIR)\nsMessage.obj \
.\$(OBJDIR)\nsMsgProtocol.obj \
.\$(OBJDIR)\nsMsgMailNewsUrl.obj \
.\$(OBJDIR)\nsMsgTxn.obj \

Просмотреть файл

@ -279,26 +279,26 @@ NS_IMETHODIMP nsMessage::GetMime2DecodedRecipients(PRUnichar* *resultRecipients)
}
NS_IMETHODIMP nsMessage::GetAuthorCollationKey(PRUnichar* *resultAuthor)
NS_IMETHODIMP nsMessage::GetAuthorCollationKey(PRUint8 **resultAuthor, PRUint32 *len)
{
if(mMsgHdr)
return mMsgHdr->GetAuthorCollationKey(resultAuthor);
return mMsgHdr->GetAuthorCollationKey(resultAuthor, len);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetSubjectCollationKey(PRUnichar* *resultSubject)
NS_IMETHODIMP nsMessage::GetSubjectCollationKey(PRUint8 **resultSubject, PRUint32 *len)
{
if(mMsgHdr)
return mMsgHdr->GetSubjectCollationKey(resultSubject);
return mMsgHdr->GetSubjectCollationKey(resultSubject, len);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetRecipientsCollationKey(PRUnichar* *resultRecipients)
NS_IMETHODIMP nsMessage::GetRecipientsCollationKey(PRUint8 **resultRecipients, PRUint32 *len)
{
if(mMsgHdr)
return mMsgHdr->GetRecipientsCollationKey(resultRecipients);
return mMsgHdr->GetRecipientsCollationKey(resultRecipients, len);
else
return NS_ERROR_FAILURE;
}
@ -628,3 +628,24 @@ NS_IMETHODIMP nsMessage::SetMessageType(PRUint32 aMessageType)
mMessageType = aMessageType;
return NS_OK;
}
NS_IMETHODIMP nsMessage::GetFolder(nsIMsgFolder **folder)
{
if(mMsgHdr)
return mMsgHdr->GetFolder(folder);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetIsRead(PRBool *isRead)
{
// stubbed, since nsMessage is going away
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMessage::GetIsFlagged(PRBool *isFlagged)
{
// stubbed, since nsMessage is going away
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -22,7 +22,6 @@
*/
#include "msgCore.h"
#include "nsIMessage.h"
#include "nsMsgDBFolder.h"
#include "nsMsgFolderFlags.h"
#include "nsIPref.h"
@ -172,58 +171,6 @@ NS_IMETHODIMP nsMsgDBFolder::EndFolderLoading(void)
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::HasThreads(nsIMsgWindow *aMsgWindow, PRBool *hasThreads)
{
nsresult rv = GetDatabase(aMsgWindow);
NS_ENSURE_SUCCESS(rv,rv);
rv = mDatabase->HasThreads(hasThreads);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::HasMessagesOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, PRBool *hasMessages)
{
nsresult rv = NS_OK;
rv = GetDatabase(aMsgWindow);
NS_ENSURE_SUCCESS(rv,rv);
rv = mDatabase->HasMessagesOfType(viewType, hasMessages);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::GetThreadsOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, nsISimpleEnumerator** threadEnumerator)
{
nsresult rv = GetDatabase(aMsgWindow);
if(NS_SUCCEEDED(rv))
return mDatabase->EnumerateThreads(viewType, threadEnumerator);
else
return rv;
}
NS_IMETHODIMP
nsMsgDBFolder::GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread)
{
nsresult rv = GetDatabase(nsnull);
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgDBHdr> msgDBHdr;
nsCOMPtr<nsIDBMessage> dbMessage(do_QueryInterface(message, &rv));
if(NS_SUCCEEDED(rv))
rv = dbMessage->GetMsgDBHdr(getter_AddRefs(msgDBHdr));
if(NS_SUCCEEDED(rv))
{
rv = mDatabase->GetThreadContainingMsgHdr(msgDBHdr, thread);
}
}
return rv;
}
NS_IMETHODIMP
nsMsgDBFolder::GetExpungedBytes(PRUint32 *count)
{
@ -250,31 +197,6 @@ nsMsgDBFolder::GetExpungedBytes(PRUint32 *count)
}
NS_IMETHODIMP
nsMsgDBFolder::HasMessage(nsIMessage *message, PRBool *hasMessage)
{
if(!hasMessage)
return NS_ERROR_NULL_POINTER;
nsresult rv = GetDatabase(nsnull);
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgDBHdr> msgDBHdr, msgDBHdrForKey;
nsCOMPtr<nsIDBMessage> dbMessage(do_QueryInterface(message, &rv));
nsMsgKey key;
if(NS_SUCCEEDED(rv))
rv = dbMessage->GetMsgDBHdr(getter_AddRefs(msgDBHdr));
if(NS_SUCCEEDED(rv))
rv = msgDBHdr->GetMessageKey(&key);
if(NS_SUCCEEDED(rv))
rv = mDatabase->ContainsKey(key, hasMessage);
}
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::GetCharset(PRUnichar * *aCharset)
{
nsresult rv = NS_OK;
@ -392,7 +314,7 @@ NS_IMETHODIMP nsMsgDBFolder::SetGettingNewMessages(PRBool gettingNewMessages)
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::GetFirstNewMessage(nsIMessage **firstNewMessage)
NS_IMETHODIMP nsMsgDBFolder::GetFirstNewMessage(nsIMsgDBHdr **firstNewMessage)
{
//If there's not a db then there can't be new messages. Return failure since you
//should use HasNewMessages first.
@ -410,16 +332,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetFirstNewMessage(nsIMessage **firstNewMessage)
if(NS_FAILED(rv))
return rv;
if (!hdr)
{
*firstNewMessage = nsnull;
return NS_ERROR_FAILURE;
}
rv = CreateMessageFromMsgDBHdr(hdr, firstNewMessage);
if(NS_FAILED(rv))
return rv;
return rv;
return mDatabase->GetMsgHdrForKey(key, firstNewMessage);
}
NS_IMETHODIMP nsMsgDBFolder::ClearNewMessages()
@ -563,7 +476,7 @@ nsresult nsMsgDBFolder::SendFlagNotifications(nsISupports *item, PRUint32 oldFla
return rv;
}
NS_IMETHODIMP nsMsgDBFolder:: DownloadMessagesForOffline(nsISupportsArray *messages)
NS_IMETHODIMP nsMsgDBFolder:: DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *)
{
NS_ASSERTION(PR_FALSE, "imap and news need to override this");
return NS_OK;
@ -763,17 +676,10 @@ NS_IMETHODIMP nsMsgDBFolder::OnKeyChange(nsMsgKey aKeyChanged, PRUint32 aOldFlag
nsresult rv = mDatabase->GetMsgHdrForKey(aKeyChanged, getter_AddRefs(pMsgDBHdr));
if(NS_SUCCEEDED(rv) && pMsgDBHdr)
{
nsCOMPtr<nsIMessage> message;
rv = CreateMessageFromMsgDBHdr(pMsgDBHdr, getter_AddRefs(message));
nsCOMPtr<nsISupports> msgSupports(do_QueryInterface(pMsgDBHdr, &rv));
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> msgSupports(do_QueryInterface(message, &rv));
if(NS_SUCCEEDED(rv))
{
SendFlagNotifications(msgSupports, aOldFlags, aNewFlags);
}
UpdateSummaryTotals(PR_TRUE);
}
SendFlagNotifications(msgSupports, aOldFlags, aNewFlags);
UpdateSummaryTotals(PR_TRUE);
}
// The old state was new message state
@ -853,12 +759,7 @@ nsresult nsMsgDBFolder::OnKeyAddedOrDeleted(nsMsgKey aKeyChanged, nsMsgKey aPar
if(msgDBHdr)
{
nsCOMPtr<nsIMessage> message;
rv = CreateMessageFromMsgDBHdr(msgDBHdr, getter_AddRefs(message));
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsISupports> msgSupports(do_QueryInterface(message));
nsCOMPtr<nsISupports> msgSupports(do_QueryInterface(msgDBHdr));
nsCOMPtr<nsISupports> folderSupports;
rv = QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(folderSupports));
if(msgSupports && NS_SUCCEEDED(rv) && doFlat)
@ -868,36 +769,12 @@ nsresult nsMsgDBFolder::OnKeyAddedOrDeleted(nsMsgKey aKeyChanged, nsMsgKey aPar
else
NotifyItemDeleted(folderSupports, msgSupports, "flatMessageView");
}
if(doThread)
if(msgSupports && folderSupports)
{
if(parentDBHdr)
{
nsCOMPtr<nsIMessage> parentMessage;
rv = CreateMessageFromMsgDBHdr(parentDBHdr, getter_AddRefs(parentMessage));
if(NS_FAILED(rv))
return rv;
nsCOMPtr<nsISupports> parentSupports(do_QueryInterface(parentMessage));
if(msgSupports && NS_SUCCEEDED(rv))
{
if(added)
NotifyItemAdded(parentSupports, msgSupports, "threadMessageView");
else
NotifyItemDeleted(parentSupports, msgSupports, "threadMessageView");
}
}
//if there's not a header then in threaded view the folder is the parent.
if(added)
NotifyItemAdded(folderSupports, msgSupports, "threadMessageView");
else
{
if(msgSupports && folderSupports)
{
if(added)
NotifyItemAdded(folderSupports, msgSupports, "threadMessageView");
else
NotifyItemDeleted(folderSupports, msgSupports, "threadMessageView");
}
}
NotifyItemDeleted(folderSupports, msgSupports, "threadMessageView");
}
UpdateSummaryTotals(PR_TRUE);
}
@ -1205,7 +1082,7 @@ nsMsgDBFolder::SetFlag(PRUint32 flag)
}
NS_IMETHODIMP
nsMsgDBFolder::AddMessageDispositionState(nsIMessage *aMessage, nsMsgDispositionState aDispositionFlag)
nsMsgDBFolder::AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag)
{
NS_ENSURE_ARG_POINTER(aMessage);
@ -1213,7 +1090,7 @@ nsMsgDBFolder::AddMessageDispositionState(nsIMessage *aMessage, nsMsgDisposition
NS_ENSURE_SUCCESS(rv, NS_OK);
nsMsgKey msgKey;
aMessage->GetMsgKey(&msgKey);
aMessage->GetMessageKey(&msgKey);
if (aDispositionFlag == nsIMsgFolder::nsMsgDispositionState_Replied)
mDatabase->MarkReplied(msgKey, PR_TRUE, nsnull);
@ -1298,9 +1175,10 @@ NS_IMETHODIMP nsMsgDBFolder::GetRetentionSettings(nsIMsgRetentionSettings **sett
rv = mDatabase->GetMsgRetentionSettings(getter_AddRefs(m_retentionSettings));
if (NS_SUCCEEDED(rv) && m_retentionSettings)
{
nsMsgRetainByPreference retainBy;
m_retentionSettings->GetRetainByPreference(&retainBy);
if (retainBy == nsIMsgRetentionSettings::nsMsgRetainByServerDefaults)
PRBool useServerDefaults;
m_retentionSettings->GetUseServerDefaults(&useServerDefaults);
if (useServerDefaults)
{
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
rv = GetServer(getter_AddRefs(incomingServer));
@ -1322,29 +1200,50 @@ NS_IMETHODIMP nsMsgDBFolder::SetRetentionSettings(nsIMsgRetentionSettings *setti
return NS_OK;
}
nsresult nsMsgDBFolder::NotifyStoreClosedAllHeaders()
NS_IMETHODIMP nsMsgDBFolder::GetDownloadSettings(nsIMsgDownloadSettings **settings)
{
nsCOMPtr <nsISimpleEnumerator> enumerator;
GetMessages(nsnull, getter_AddRefs(enumerator));
nsCOMPtr<nsISupports> folderSupports;
nsresult rv = QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(folderSupports));
if (enumerator)
NS_ENSURE_ARG_POINTER(settings);
nsresult rv = NS_OK;
if (!m_downloadSettings)
{
PRBool hasMoreElements;
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements)) && hasMoreElements)
{
nsCOMPtr<nsISupports> childSupports;
rv = enumerator->GetNext(getter_AddRefs(childSupports));
if(NS_FAILED(rv))
return rv;
GetDatabase(nsnull);
if (mDatabase)
{
// get the settings from the db - if the settings from the db say the folder
// is not overriding the incoming server settings, get the settings from the
// server.
rv = mDatabase->GetMsgDownloadSettings(getter_AddRefs(m_downloadSettings));
if (NS_SUCCEEDED(rv) && m_downloadSettings)
{
PRBool useServerDefaults;
m_downloadSettings->GetUseServerDefaults(&useServerDefaults);
// clear out db hdr, because it won't be valid when we get rid of the .msf file
nsCOMPtr<nsIDBMessage> dbMessage(do_QueryInterface(childSupports, &rv));
if(NS_SUCCEEDED(rv) && dbMessage)
dbMessage->SetMsgDBHdr(nsnull);
if (useServerDefaults)
{
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
rv = GetServer(getter_AddRefs(incomingServer));
if (NS_SUCCEEDED(rv) && incomingServer)
incomingServer->GetDownloadSettings(getter_AddRefs(m_downloadSettings));
}
}
}
}
*settings = m_downloadSettings;
NS_IF_ADDREF(*settings);
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::SetDownloadSettings(nsIMsgDownloadSettings *settings)
{
m_downloadSettings = settings;
return NS_OK;
}
nsresult nsMsgDBFolder::NotifyStoreClosedAllHeaders()
{
// don't need this anymore.
return NS_OK;
}

Просмотреть файл

@ -27,7 +27,6 @@
#include "nsMsgFolder.h"
#include "nsIDBFolderInfo.h"
#include "nsIMsgDatabase.h"
#include "nsIMessage.h"
#include "nsCOMPtr.h"
#include "nsIDBChangeListener.h"
#include "nsIUrlListener.h"
@ -52,17 +51,11 @@ public:
NS_IMETHOD StartFolderLoading(void);
NS_IMETHOD EndFolderLoading(void);
NS_IMETHOD GetThreadsOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, nsISimpleEnumerator** threadEnumerator);
NS_IMETHOD GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread);
NS_IMETHOD HasMessage(nsIMessage *message, PRBool *hasMessage);
NS_IMETHOD HasThreads(nsIMsgWindow *aMsgWindow, PRBool *hasThreads);
NS_IMETHOD HasMessagesOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, PRBool *hasMessages);
NS_IMETHOD GetCharset(PRUnichar * *aCharset);
NS_IMETHOD SetCharset(const PRUnichar * aCharset);
NS_IMETHOD GetCharsetOverride(PRBool *aCharsetOverride);
NS_IMETHOD SetCharsetOverride(PRBool aCharsetOverride);
//NS_IMETHOD HasNewMessages(PRBool *hasNewMessages);
NS_IMETHOD GetFirstNewMessage(nsIMessage **firstNewMessage);
NS_IMETHOD GetFirstNewMessage(nsIMsgDBHdr **firstNewMessage);
NS_IMETHOD ClearNewMessages();
NS_IMETHOD GetFlags(PRUint32 *aFlags);
NS_IMETHOD GetExpungedBytes(PRUint32 *count);
@ -79,7 +72,7 @@ public:
NS_IMETHOD ReadFromFolderCacheElem(nsIMsgFolderCacheElement *element);
NS_IMETHOD ManyHeadersToDownload(PRBool *_retval);
NS_IMETHOD AddMessageDispositionState(nsIMessage *aMessage, nsMsgDispositionState aDispositionFlag);
NS_IMETHOD AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag);
NS_IMETHOD MarkAllMessagesRead(void);
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
NS_IMETHOD SetFlag(PRUint32 flag);
@ -95,10 +88,12 @@ public:
NS_IMETHOD ShouldStoreMsgOffline(nsMsgKey msgKey, PRBool *result);
NS_IMETHOD GetOfflineFileTransport(nsMsgKey msgKey, PRUint32 *offset, PRUint32 *size, nsITransport **_retval);
NS_IMETHOD HasMsgOffline(nsMsgKey msgKey, PRBool *result);
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages);
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *msgWindow);
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
NS_IMETHOD GetRetentionSettings(nsIMsgRetentionSettings **settings);
NS_IMETHOD SetRetentionSettings(nsIMsgRetentionSettings *settings);
NS_IMETHOD GetDownloadSettings(nsIMsgDownloadSettings **settings);
NS_IMETHOD SetDownloadSettings(nsIMsgDownloadSettings *settings);
protected:
virtual nsresult ReadDBFolderInfo(PRBool force);
@ -135,6 +130,7 @@ protected:
nsCOMPtr<nsIOutputStream> m_tempMessageStream;
nsCOMPtr <nsIMsgRetentionSettings> m_retentionSettings;
nsCOMPtr <nsIMsgDownloadSettings> m_downloadSettings;
static nsIAtom* mFolderLoadedAtom;
static nsIAtom* mDeleteOrMoveMsgCompletedAtom;
static nsIAtom* mDeleteOrMoveMsgFailedAtom;

Просмотреть файл

@ -35,7 +35,6 @@
#include "nsMsgFolder.h"
#include "nsMsgFolderFlags.h"
#include "nsIMessage.h"
#include "nsMsgKeyArray.h"
#include "nsMsgDatabase.h"
#include "nsIDBFolderInfo.h"
@ -435,12 +434,6 @@ NS_IMETHODIMP nsMsgFolder::GetParent(nsIFolder **aParent)
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::HasMessagesOfType(nsIMsgWindow *aMsgWindow, PRUint32 type, PRBool *hasMessages)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsMsgFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
{
@ -464,31 +457,6 @@ nsMsgFolder::UpdateFolder(nsIMsgWindow *)
return NS_OK;
}
NS_IMETHODIMP
nsMsgFolder::HasThreads(nsIMsgWindow *aMsgWindow, PRBool *hasThreads)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsMsgFolder::GetThreadsOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, nsISimpleEnumerator ** threadEnumerator)
{
// XXX should this return an empty enumeration?
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsMsgFolder::GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsMsgFolder::HasMessage(nsIMessage *message, PRBool *hasMessage)
{
return NS_ERROR_FAILURE;
}
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP nsMsgFolder::GetFolderURL(char **url)
@ -1414,7 +1382,7 @@ NS_IMETHODIMP nsMsgFolder::SetHasNewMessages(PRBool hasNewMessages)
return NS_OK;
}
NS_IMETHODIMP nsMsgFolder::GetFirstNewMessage(nsIMessage **firstNewMessage)
NS_IMETHODIMP nsMsgFolder::GetFirstNewMessage(nsIMsgDBHdr **firstNewMessage)
{
//we don't support this
return NS_OK;
@ -2110,7 +2078,7 @@ nsMsgFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
for(PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsISupports> msgSupports = getter_AddRefs(messages->ElementAt(i));
nsCOMPtr<nsIMessage> message = do_QueryInterface(msgSupports);
nsCOMPtr<nsIMsgDBHdr> message = do_QueryInterface(msgSupports);
if(message)
rv = message->MarkRead(markRead);
@ -2135,7 +2103,7 @@ nsMsgFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged)
for(PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsISupports> msgSupports = getter_AddRefs(messages->ElementAt(i));
nsCOMPtr<nsIMessage> message = do_QueryInterface(msgSupports);
nsCOMPtr<nsIMsgDBHdr> message = do_QueryInterface(msgSupports);
if(message)
rv = message->MarkFlagged(markFlagged);
@ -2148,7 +2116,7 @@ nsMsgFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged)
}
NS_IMETHODIMP
nsMsgFolder::AddMessageDispositionState(nsIMessage *aMessage, nsMsgDispositionState aDispositionFlag)
nsMsgFolder::AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag)
{
// most folders don't do anything for this...
return NS_OK;
@ -2190,7 +2158,7 @@ nsMsgFolder::CopyFolder(nsIMsgFolder* srcFolder,
NS_IMETHODIMP
nsMsgFolder::CopyFileMessage(nsIFileSpec* fileSpec,
nsIMessage* messageToReplace,
nsIMsgDBHdr* messageToReplace,
PRBool isDraftOrTemplate,
nsIMsgWindow *window,
nsIMsgCopyServiceListener* listener)
@ -2474,7 +2442,7 @@ NS_IMETHODIMP nsMsgFolder::EnableNotifications(PRInt32 notificationType, PRBool
nsCOMPtr <nsIMsgDatabase> database;
nsresult rv = GetMsgDatabase(nsnull, getter_AddRefs(database));
GetMsgDatabase(nsnull, getter_AddRefs(database));
if(enable)
{
if (database)
@ -2511,24 +2479,24 @@ NS_IMETHODIMP nsMsgFolder::GetMessageHeader(nsMsgKey msgKey, nsIMsgDBHdr **aMsgH
NS_IMETHODIMP nsMsgFolder::ListDescendents(nsISupportsArray *descendents)
{
NS_ENSURE_ARG(descendents);
PRUint32 cnt;
PRUint32 cnt;
nsresult rv = mSubFolders->Count(&cnt);
NS_ENSURE_SUCCESS(rv,rv);
if (NS_FAILED(rv)) return rv;
for (PRUint32 index = 0; index < cnt; index++)
{
{
nsresult rv;
nsCOMPtr<nsISupports> supports = getter_AddRefs(mSubFolders->ElementAt(index));
nsCOMPtr<nsIMsgFolder> child(do_QueryInterface(supports, &rv));
nsCOMPtr<nsISupports> supports = getter_AddRefs(mSubFolders->ElementAt(index));
nsCOMPtr<nsIMsgFolder> child(do_QueryInterface(supports, &rv));
if (NS_SUCCEEDED(rv))
{
rv = descendents->AppendElement(supports);
if(NS_SUCCEEDED(rv))
{
rv = child->ListDescendents(descendents); // recurse
}
if(NS_SUCCEEDED(rv))
{
rv = child->ListDescendents(descendents); // recurse
}
}
}
}
return rv;
}
@ -2545,3 +2513,19 @@ NS_IMETHODIMP nsMsgFolder::GetBaseMessageURI(char **baseMessageURI)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMsgFolder::GetUriForMsg(nsIMsgDBHdr *msgHdr, char **aURI)
{
NS_ENSURE_ARG(msgHdr);
NS_ENSURE_ARG(aURI);
nsMsgKey msgKey;
msgHdr->GetMessageKey(&msgKey);
nsCAutoString uri;
uri.Assign(mBaseMessageURI);
// append a "#" followed by the message key.
uri.Append('#');
uri.AppendInt(msgKey);
*aURI = uri.ToNewCString();
return NS_OK;
}

Просмотреть файл

@ -67,16 +67,11 @@ public:
// begin NS_DECL_NSIMSGFOLDER
NS_IMETHOD AddUnique(nsISupports *element);
NS_IMETHOD ReplaceElement(nsISupports *element, nsISupports *newElement);
NS_IMETHOD HasMessagesOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, PRBool *
hasMessages);
NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator **_retval);
NS_IMETHOD GetThreadsOfType(nsIMsgWindow *aMsgWindow, PRUint32 viewType, nsISimpleEnumerator **_retval);
NS_IMETHOD HasThreads(nsIMsgWindow *aMsgWindow, PRBool *hasThreads);
NS_IMETHOD StartFolderLoading(void);
NS_IMETHOD EndFolderLoading(void);
NS_IMETHOD UpdateFolder(nsIMsgWindow *window);
NS_IMETHOD GetThreadForMessage(nsIMessage *message, nsIMsgThread **_retval);
NS_IMETHOD HasMessage(nsIMessage *message, PRBool *_retval);
NS_IMETHOD GetFirstNewMessage(nsIMsgDBHdr **firstNewMessage);
NS_IMETHOD GetVisibleSubFolders(nsIEnumerator **_retval);
NS_IMETHOD GetPrettiestName(PRUnichar * *aPrettiestName);
NS_IMETHOD GetFolderURL(char * *aFolderURL);
@ -113,7 +108,6 @@ hasMessages);
NS_IMETHOD GetTotalMessages(PRBool deep, PRInt32 *_retval);
NS_IMETHOD GetHasNewMessages(PRBool *hasNewMessages);
NS_IMETHOD SetHasNewMessages(PRBool hasNewMessages);
NS_IMETHOD GetFirstNewMessage(nsIMessage **firstNewMessage);
NS_IMETHOD ClearNewMessages();
NS_IMETHOD GetExpungedBytes(PRUint32 *aExpungedBytesCount);
NS_IMETHOD GetDeletable(PRBool *aDeletable);
@ -144,12 +138,11 @@ hasMessages);
// NS_IMETHOD DeleteMessages(nsISupportsArray *message, nsITransactionManager *txnMgr, PRBool deleteStorage);
NS_IMETHOD CopyMessages(nsIMsgFolder *srcFolder, nsISupportsArray *messages, PRBool isMove, nsIMsgWindow *window, nsIMsgCopyServiceListener *listener, PRBool isFolder);
NS_IMETHOD CopyFolder(nsIMsgFolder *srcFolder,PRBool isMoveFolder, nsIMsgWindow *window, nsIMsgCopyServiceListener *listener);
NS_IMETHOD CopyFileMessage(nsIFileSpec *fileSpec, nsIMessage *msgToReplace, PRBool isDraft, nsIMsgWindow *window, nsIMsgCopyServiceListener *listener);
NS_IMETHOD CopyFileMessage(nsIFileSpec *fileSpec, nsIMsgDBHdr *msgToReplace, PRBool isDraft, nsIMsgWindow *window, nsIMsgCopyServiceListener *listener);
NS_IMETHOD AcquireSemaphore(nsISupports *semHolder);
NS_IMETHOD ReleaseSemaphore(nsISupports *semHolder);
NS_IMETHOD TestSemaphore(nsISupports *semHolder, PRBool *_retval);
NS_IMETHOD GetLocked(PRBool *aLocked);
// NS_IMETHOD CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgDBHdr, nsIMessage **_retval);
NS_IMETHOD GetNewMessages(nsIMsgWindow *window);
// NS_IMETHOD WriteToFolderCache(nsIMsgFolderCache *folderCache);
// NS_IMETHOD GetCharset(PRUnichar * *aCharset);
@ -169,8 +162,10 @@ hasMessages);
NS_IMETHOD GetPath(nsIFileSpec * *aPath);
NS_IMETHOD SetPath(nsIFileSpec * aPath);
NS_IMETHOD GetBaseMessageURI (char ** baseMessageURI);
NS_IMETHOD GetUriForMsg(nsIMsgDBHdr *msgHdr, char **aResult);
NS_IMETHOD MarkMessagesRead(nsISupportsArray *messages, PRBool markRead);
NS_IMETHOD AddMessageDispositionState(nsIMessage *aMessage, nsMsgDispositionState aDispositionFlag);
NS_IMETHOD AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag);
NS_IMETHOD MarkAllMessagesRead(void);
NS_IMETHOD MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged);
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);

Просмотреть файл

@ -1181,8 +1181,23 @@ NS_IMETHODIMP nsMsgIncomingServer::GetRetentionSettings(nsIMsgRetentionSettings
NS_IMETHODIMP nsMsgIncomingServer::SetRetentionSettings(nsIMsgRetentionSettings *settings)
{
nsMsgRetainByPreference retainByPreference;
PRUint32 daysToKeepHdrs = 0;
PRUint32 numHeadersToKeep = 0;
PRBool keepUnreadMessagesOnly = PR_FALSE;
PRUint32 daysToKeepBodies = 0;
m_retentionSettings = settings;
return NS_OK;
m_retentionSettings->GetRetainByPreference(&retainByPreference);
m_retentionSettings->GetNumHeadersToKeep(&numHeadersToKeep);
m_retentionSettings->GetKeepUnreadMessagesOnly(&keepUnreadMessagesOnly);
m_retentionSettings->GetDaysToKeepBodies(&daysToKeepBodies);
m_retentionSettings->GetDaysToKeepHdrs(&daysToKeepHdrs);
nsresult rv = SetBoolValue("keepUnreadOnly", keepUnreadMessagesOnly);
rv = SetIntValue("retainBy", retainByPreference);
rv = SetIntValue("numHdrsToKeep", numHeadersToKeep);
rv = SetIntValue("daysToKeepHdrs", daysToKeepHdrs);
rv = SetIntValue("daysToKeepBodies", daysToKeepBodies);
return rv;
}
NS_IMETHODIMP
@ -1200,6 +1215,51 @@ nsMsgIncomingServer::SetDisplayStartupPage(PRBool displayStartupPage)
return NS_OK;
}
NS_IMETHODIMP nsMsgIncomingServer::GetDownloadSettings(nsIMsgDownloadSettings **settings)
{
NS_ENSURE_ARG_POINTER(settings);
PRBool downloadUnreadOnly = PR_FALSE;
PRBool downloadByDate = PR_FALSE;
PRUint32 ageLimitOfMsgsToDownload = 0;
nsresult rv = NS_OK;
if (!m_downloadSettings)
{
m_downloadSettings = do_CreateInstance(NS_MSG_DOWNLOADSETTINGS_CONTRACTID);
if (m_downloadSettings)
{
rv = GetBoolValue("downloadUnreadOnly", &downloadUnreadOnly);
rv = GetBoolValue("downloadByDate", &downloadByDate);
rv = GetIntValue("ageLimit", (PRInt32 *) &ageLimitOfMsgsToDownload);
m_downloadSettings->SetDownloadUnreadOnly(downloadUnreadOnly);
m_downloadSettings->SetDownloadByDate(downloadByDate);
m_downloadSettings->SetAgeLimitOfMsgsToDownload(ageLimitOfMsgsToDownload);
}
else
rv = NS_ERROR_OUT_OF_MEMORY;
// Create an empty download settings object,
// get the settings from the server prefs, and init the object from the prefs.
}
*settings = m_downloadSettings;
NS_IF_ADDREF(*settings); return rv;
}
NS_IMETHODIMP nsMsgIncomingServer::SetDownloadSettings(nsIMsgDownloadSettings *settings)
{
m_downloadSettings = settings;
PRBool downloadUnreadOnly = PR_FALSE;
PRBool downloadByDate = PR_FALSE;
PRUint32 ageLimitOfMsgsToDownload = 0;
m_downloadSettings->GetDownloadUnreadOnly(&downloadUnreadOnly);
m_downloadSettings->GetDownloadByDate(&downloadByDate);
m_downloadSettings->GetAgeLimitOfMsgsToDownload(&ageLimitOfMsgsToDownload);
nsresult rv = SetBoolValue("downloadUnreadOnly", downloadUnreadOnly);
rv = SetBoolValue("downloadByDate", downloadByDate);
rv = SetIntValue("ageLimit", ageLimitOfMsgsToDownload);
return rv;
}
#define BASE_MSGS_URL "chrome://messenger/locale/messenger.properties"
NS_IMETHODIMP nsMsgIncomingServer::DisplayOfflineMsg(nsIMsgWindow *aMsgWindow)

Просмотреть файл

@ -69,6 +69,7 @@ protected:
nsCOMPtr <nsIFolder> m_rootFolder;
nsCOMPtr <nsIMsgRetentionSettings> m_retentionSettings;
nsCOMPtr <nsIMsgDownloadSettings> m_downloadSettings;
nsresult getDefaultCharPref(const char *pref, char **);
nsresult getDefaultUnicharPref(const char *pref, PRUnichar **);
nsresult getDefaultBoolPref(const char *pref, PRBool *);

Просмотреть файл

@ -27,9 +27,9 @@
#include "nsMsgKeyArray.h"
nsMsgViewIndex nsMsgKeyArray::FindIndex(nsMsgKey key)
nsMsgViewIndex nsMsgKeyArray::FindIndex(nsMsgKey key, PRUint32 startIndex)
{
for (PRUint32 i = 0; i < GetSize(); i++)
for (PRUint32 i = startIndex; i < GetSize(); i++)
{
if ((nsMsgKey)(m_pData[i]) == key)
{

Просмотреть файл

@ -31,7 +31,7 @@
#include "nsUInt32Array.h"
#include "MailNewsTypes.h"
class nsMsgKeyArray : public nsUInt32Array
class NS_MSG_BASE nsMsgKeyArray : public nsUInt32Array
{
// constructors
public:
@ -70,7 +70,7 @@ public:
void CopyArray(nsMsgKeyArray &oldA) { nsUInt32Array::CopyArray(oldA); }
// new operations
public:
nsMsgViewIndex FindIndex(nsMsgKey key); // returns -1 if not found
nsMsgViewIndex FindIndex(nsMsgKey key, PRUint32 startIndex = 0); // returns -1 if not found
// use these next two carefully
nsMsgKey* GetArray(void) {

Просмотреть файл

@ -22,7 +22,6 @@
*/
#include "msgCore.h"
#include "nsIMessage.h"
#include "nsIMsgHdr.h"
#include "nsMsgUtils.h"
#include "nsString.h"
@ -37,6 +36,7 @@
#include "nsMsgBaseCID.h"
#include "nsMsgImapCID.h"
#include "nsMsgI18N.h"
#include "xp_str.h"
static NS_DEFINE_CID(kImapUrlCID, NS_IMAPURL_CID);
static NS_DEFINE_CID(kCMailboxUrl, NS_MAILBOXURL_CID);
@ -100,6 +100,15 @@ nsresult ReleaseMessageServiceFromURI(const char *uri, nsIMsgMessageService *mes
return rv;
}
nsresult GetMsgDBHdrFromURI(const char *uri, nsIMsgDBHdr **msgHdr)
{
nsCOMPtr <nsIMsgMessageService> msgMessageService;
nsresult rv = GetMessageServiceFromURI(uri, getter_AddRefs(msgMessageService));
NS_ENSURE_SUCCESS(rv,rv);
if (!msgMessageService) return NS_ERROR_FAILURE;
return msgMessageService->MessageURIToMsgHdr(uri, msgHdr);
}
nsresult CreateStartupUrl(char *uri, nsIURI** aUrl)
{
@ -142,75 +151,6 @@ nsresult CreateStartupUrl(char *uri, nsIURI** aUrl)
}
NS_IMPL_ISUPPORTS1(nsMessageFromMsgHdrEnumerator, nsISimpleEnumerator)
nsMessageFromMsgHdrEnumerator::nsMessageFromMsgHdrEnumerator(nsISimpleEnumerator *srcEnumerator,
nsIMsgFolder *folder)
{
NS_INIT_REFCNT();
mSrcEnumerator = dont_QueryInterface(srcEnumerator);
mFolder = dont_QueryInterface(folder);
}
nsMessageFromMsgHdrEnumerator::~nsMessageFromMsgHdrEnumerator()
{
//member variables are nsCOMPtr's
}
NS_IMETHODIMP nsMessageFromMsgHdrEnumerator::GetNext(nsISupports **aItem)
{
nsCOMPtr<nsISupports> currentItem;
nsCOMPtr<nsIMsgDBHdr> msgDBHdr;
nsCOMPtr<nsIMessage> message;
nsresult rv;
rv = mSrcEnumerator->GetNext(getter_AddRefs(currentItem));
if(NS_SUCCEEDED(rv))
{
msgDBHdr = do_QueryInterface(currentItem, &rv);
}
if(NS_SUCCEEDED(rv))
{
rv = mFolder->CreateMessageFromMsgDBHdr(msgDBHdr, getter_AddRefs(message));
}
if(NS_SUCCEEDED(rv))
{
currentItem = do_QueryInterface(message, &rv);
*aItem = currentItem;
NS_IF_ADDREF(*aItem);
}
NS_ASSERTION(NS_SUCCEEDED(rv),"getnext shouldn't fail");
return rv;
}
NS_IMETHODIMP nsMessageFromMsgHdrEnumerator::HasMoreElements(PRBool *aResult)
{
return mSrcEnumerator->HasMoreElements(aResult);
}
nsresult NS_NewMessageFromMsgHdrEnumerator(nsISimpleEnumerator *srcEnumerator,
nsIMsgFolder *folder,
nsMessageFromMsgHdrEnumerator **messageEnumerator)
{
if(!messageEnumerator)
return NS_ERROR_NULL_POINTER;
*messageEnumerator = new nsMessageFromMsgHdrEnumerator(srcEnumerator, folder);
if(!messageEnumerator)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*messageEnumerator);
return NS_OK;
}
// Where should this live? It's a utility used to convert a string priority, e.g., "High, Low, Normal" to an enum.
// Perhaps we should have an interface that groups together all these utilities...
nsresult NS_MsgGetPriorityFromString(const char *priority, nsMsgPriorityValue *outPriority)
@ -384,3 +324,69 @@ nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& p
return NS_OK;
}
/* Given a string and a length, removes any "Re:" strings from the front.
It also deals with that dumbass "Re[2]:" thing that some losing mailers do.
Returns PR_TRUE if it made a change, PR_FALSE otherwise.
The string is not altered: the pointer to its head is merely advanced,
and the length correspondingly decreased.
*/
PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP)
{
const char *s, *s_end;
const char *last;
PRUint32 L;
PRBool result = PR_FALSE;
NS_ASSERTION(stringP, "bad null param");
if (!stringP) return PR_FALSE;
s = *stringP;
L = lengthP ? *lengthP : nsCRT::strlen(s);
s_end = s + L;
last = s;
AGAIN:
while (s < s_end && XP_IS_SPACE(*s))
s++;
if (s < (s_end-2) &&
(s[0] == 'r' || s[0] == 'R') &&
(s[1] == 'e' || s[1] == 'E'))
{
if (s[2] == ':')
{
s = s+3; /* Skip over "Re:" */
result = PR_TRUE; /* Yes, we stripped it. */
goto AGAIN; /* Skip whitespace and try again. */
}
else if (s[2] == '[' || s[2] == '(')
{
const char *s2 = s+3; /* Skip over "Re[" */
/* Skip forward over digits after the "[". */
while (s2 < (s_end-2) && XP_IS_DIGIT(*s2))
s2++;
/* Now ensure that the following thing is "]:"
Only if it is do we alter `s'.
*/
if ((s2[0] == ']' || s2[0] == ')') && s2[1] == ':')
{
s = s2+2; /* Skip over "]:" */
result = PR_TRUE; /* Yes, we stripped it. */
goto AGAIN; /* Skip whitespace and try again. */
}
}
}
/* Decrease length by difference between current ptr and original ptr.
Then store the current ptr back into the caller. */
if (lengthP)
*lengthP -= (s - (*stringP));
*stringP = s;
return result;
}

Просмотреть файл

@ -37,30 +37,13 @@
NS_MSG_BASE nsresult GetMessageServiceContractIDForURI(const char *uri, nsString &contractID);
//Use ReleaseMessageServiceFromURI to release the service.
NS_MSG_BASE nsresult GetMessageServiceFromURI(const char *uri, nsIMsgMessageService **messageService);
NS_MSG_BASE nsresult GetMsgDBHdrFromURI(const char *uri, nsIMsgDBHdr **msgHdr);
NS_MSG_BASE nsresult ReleaseMessageServiceFromURI(const char *uri, nsIMsgMessageService *messageService);
NS_MSG_BASE nsresult CreateStartupUrl(char *uri, nsIURI** aUrl);
//An enumerator for converting nsIMsgHdrs to nsIMessages.
class NS_MSG_BASE nsMessageFromMsgHdrEnumerator: public nsISimpleEnumerator
{
protected:
nsCOMPtr<nsISimpleEnumerator> mSrcEnumerator;
nsCOMPtr<nsIMsgFolder> mFolder;
public:
NS_DECL_ISUPPORTS
nsMessageFromMsgHdrEnumerator(nsISimpleEnumerator *srcEnumerator, nsIMsgFolder *folder);
nsMessageFromMsgHdrEnumerator(){} //Default constructor that does nothing so nsComPtr will work.
virtual ~nsMessageFromMsgHdrEnumerator();
NS_DECL_NSISIMPLEENUMERATOR
};
NS_MSG_BASE nsresult NS_NewMessageFromMsgHdrEnumerator(nsISimpleEnumerator *srcEnumerator,
nsIMsgFolder *folder,
nsMessageFromMsgHdrEnumerator **messageEnumerator);
NS_MSG_BASE nsresult NS_MsgGetPriorityFromString(const char *priority, nsMsgPriorityValue *outPriority);
NS_MSG_BASE nsresult NS_MsgGetUntranslatedPriorityName (nsMsgPriorityValue p, nsString *outName);
@ -69,5 +52,7 @@ NS_MSG_BASE nsresult NS_MsgHashIfNecessary(nsCAutoString &name);
NS_MSG_BASE nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& pathString);
NS_MSG_BASE PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP);
#endif

Просмотреть файл

@ -133,13 +133,13 @@ PRBool nsUInt32Array::SetSize(PRUint32 nSize,
PRUint32 &nsUInt32Array::ElementAt(PRUint32 nIndex)
{
PR_ASSERT(nIndex < m_nSize);
NS_ASSERTION(nIndex < m_nSize, "array index out of bounds");
return m_pData[nIndex];
}
PRUint32 nsUInt32Array::GetAt(PRUint32 nIndex) const
{
PR_ASSERT(nIndex < m_nSize);
NS_ASSERTION(nIndex < m_nSize, "array index out of bounds");
return m_pData[nIndex];
}
@ -150,7 +150,7 @@ PRUint32 *nsUInt32Array::GetData()
void nsUInt32Array::SetAt(PRUint32 nIndex, PRUint32 newElement)
{
PR_ASSERT(nIndex < m_nSize);
NS_ASSERTION(nIndex < m_nSize, "array index out of bounds");
m_pData[nIndex] = newElement;
}
@ -188,7 +188,7 @@ PRUint32 *nsUInt32Array::CloneData()
void nsUInt32Array::InsertAt(PRUint32 nIndex, PRUint32 newElement, PRUint32 nCount)
{
PR_ASSERT(nCount > 0);
NS_ASSERTION(nCount > 0, "can't insert 0 elements");
if (nIndex >= m_nSize)
{
@ -207,21 +207,24 @@ void nsUInt32Array::InsertAt(PRUint32 nIndex, PRUint32 newElement, PRUint32 nCou
}
// Insert the new elements
PR_ASSERT(nIndex + nCount <= m_nSize);
NS_ASSERTION(nIndex + nCount <= m_nSize, "setting size failed");
while (nCount--)
m_pData[nIndex++] = newElement;
}
void nsUInt32Array::InsertAt(PRUint32 nStartIndex, const nsUInt32Array *pNewArray)
{
PR_ASSERT(pNewArray != NULL);
NS_ASSERTION(pNewArray, "inserting null array");
if (pNewArray->GetSize() > 0)
{
InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize());
for (PRUint32 i = 1; i < pNewArray->GetSize(); i++)
m_pData[nStartIndex + i] = pNewArray->GetAt(i);
}
if (pNewArray)
{
if (pNewArray->GetSize() > 0)
{
InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize());
for (PRUint32 i = 1; i < pNewArray->GetSize(); i++)
m_pData[nStartIndex + i] = pNewArray->GetAt(i);
}
}
}
void nsUInt32Array::RemoveAll()
@ -231,7 +234,7 @@ void nsUInt32Array::RemoveAll()
void nsUInt32Array::RemoveAt(PRUint32 nIndex, PRUint32 nCount)
{
PR_ASSERT(nIndex + nCount <= m_nSize);
NS_ASSERTION(nIndex + nCount <= m_nSize, "removing past end of array");
if (nCount > 0)
{

Просмотреть файл

@ -0,0 +1,240 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "msgCore.h"
#include "nsUint8Array.h"
MOZ_DECL_CTOR_COUNTER(nsUint8Array)
nsUint8Array::nsUint8Array()
{
m_pData = nsnull;
m_nSize = m_nMaxSize = m_nGrowBy = 0;
}
nsUint8Array::~nsUint8Array()
{
delete[] (PRUint8*)m_pData;
}
void nsUint8Array::SetSize(PRInt32 nNewSize, PRInt32 nGrowBy)
{
// AssertValid(this);
NS_ASSERTION(nNewSize >= 0, "can't set size to negative value");
if (nGrowBy != -1)
m_nGrowBy = nGrowBy; // set new size
if (nNewSize == 0)
{
// shrink to nothing
delete[] (PRUint8*)m_pData;
m_pData = nsnull;
m_nSize = m_nMaxSize = 0;
}
else if (m_pData == nsnull)
{
// create one with exact size
m_pData = (PRUint8*) new PRUint8[nNewSize * sizeof(PRUint8)];
memset(m_pData, 0, nNewSize * sizeof(PRUint8)); // zero fill
m_nSize = m_nMaxSize = nNewSize;
}
else if (nNewSize <= m_nMaxSize)
{
// it fits
if (nNewSize > m_nSize)
{
// initialize the new elements
nsCRT::memset(&m_pData[m_nSize], 0, (nNewSize-m_nSize) * sizeof(PRUint8));
}
m_nSize = nNewSize;
}
else
{
// otherwise, grow array
PRInt32 nGrowBy = m_nGrowBy;
if (nGrowBy == 0)
{
nGrowBy = PR_MIN(1024, PR_MAX(4, m_nSize / 8));
}
PRInt32 nNewMax;
if (nNewSize < m_nMaxSize + nGrowBy)
nNewMax = m_nMaxSize + nGrowBy; // granularity
else
nNewMax = nNewSize; // no slush
NS_ASSERTION(nNewMax >= m_nMaxSize, "no wraparound"); // no wrap around
PRUint8* pNewData = (PRUint8*) new PRUint8[nNewMax * sizeof(PRUint8)];
// copy new data from old
nsCRT::memcpy(pNewData, m_pData, m_nSize * sizeof(PRUint8));
NS_ASSERTION(nNewSize > m_nSize, "did't grow size");
nsCRT::memset(&pNewData[m_nSize], 0, (nNewSize-m_nSize) * sizeof(PRUint8));
delete[] (PRUint8*)m_pData;
m_pData = pNewData;
m_nSize = nNewSize;
m_nMaxSize = nNewMax;
}
}
void nsUint8Array::FreeExtra()
{
if (m_nSize != m_nMaxSize)
{
// shrink to desired size
PRUint8* pNewData = nsnull;
if (m_nSize != 0)
{
pNewData = (PRUint8*) new PRUint8[m_nSize * sizeof(PRUint8)];
// copy new data from old
memcpy(pNewData, m_pData, m_nSize * sizeof(PRUint8));
}
// get rid of old stuff (note: no destructors called)
delete[] (PRUint8*)m_pData;
m_pData = pNewData;
m_nMaxSize = m_nSize;
}
}
/////////////////////////////////////////////////////////////////////////////
void nsUint8Array::SetAtGrow(PRInt32 nIndex, PRUint8 newElement)
{
NS_ASSERTION(nIndex >= 0, "can't insert at negative index");
if (nIndex >= m_nSize)
SetSize(nIndex+1);
m_pData[nIndex] = newElement;
}
nsresult nsUint8Array::InsertAt(PRInt32 nIndex, PRUint8 newElement, PRInt32 nCount)
{
NS_ASSERTION(nIndex >= 0, "can't insert at negative index");
NS_ASSERTION(nCount > 0, "have to insert something"); // zero or negative size not allowed
if (nIndex >= m_nSize)
{
// adding after the end of the array
SetSize(nIndex + nCount); // grow so nIndex is valid
}
else
{
// inserting in the middle of the array
PRInt32 nOldSize = m_nSize;
SetSize(m_nSize + nCount); // grow it to new size
// shift old data up to fill gap
nsCRT::memmove(&m_pData[nIndex+nCount], &m_pData[nIndex],
(nOldSize-nIndex) * sizeof(PRUint8));
// re-init slots we copied from
nsCRT::memset(&m_pData[nIndex], 0, nCount * sizeof(PRUint8));
}
// insert new value in the gap
NS_ASSERTION(nIndex + nCount <= m_nSize, "overflow");
while (nCount--)
m_pData[nIndex++] = newElement;
return NS_OK;
}
void nsUint8Array::RemoveAt(PRInt32 nIndex, PRInt32 nCount)
{
if (nIndex < 0 || nCount < 0 || nIndex + nCount > m_nSize)
{
NS_ASSERTION(PR_FALSE, "bad remove index or count");
return;
}
// just remove a range
PRInt32 nMoveCount = m_nSize - (nIndex + nCount);
NS_ASSERTION(nMoveCount >= 0, "can't remove nothing");
if (nMoveCount >= 0)
nsCRT::memmove(&m_pData[nIndex], &m_pData[nIndex + nCount],
nMoveCount * sizeof(PRUint8));
m_nSize -= nCount;
}
nsresult nsUint8Array::InsertAt(PRInt32 nStartIndex, nsUint8Array* pNewArray)
{
NS_ENSURE_ARG(pNewArray);
NS_ASSERTION(nStartIndex >= 0, "start index must be positive");
if (pNewArray->GetSize() > 0)
{
InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize());
for (PRInt32 i = 0; i < pNewArray->GetSize(); i++)
SetAt(nStartIndex + i, pNewArray->GetAt(i));
}
return NS_OK;
}
PRInt32 nsUint8Array::GetSize() const
{ return m_nSize; }
PRInt32 nsUint8Array::GetUpperBound() const
{ return m_nSize-1; }
void nsUint8Array::RemoveAll()
{ SetSize(0); }
PRUint8 nsUint8Array::GetAt(PRInt32 nIndex) const
{ NS_ASSERTION(nIndex >= 0 && nIndex < m_nSize, "out of bounds");
return m_pData[nIndex]; }
void nsUint8Array::SetAt(PRInt32 nIndex, PRUint8 newElement)
{ NS_ASSERTION(nIndex >= 0 && nIndex < m_nSize, "out of bounds");
m_pData[nIndex] = newElement; }
PRUint8& nsUint8Array::ElementAt(PRInt32 nIndex)
{ NS_ASSERTION(nIndex >= 0 && nIndex < m_nSize, "out of bounds");
return m_pData[nIndex]; }
PRInt32 nsUint8Array::Add(PRUint8 newElement)
{ PRInt32 nIndex = m_nSize;
SetAtGrow(nIndex, newElement);
return nIndex; }
PRUint8 nsUint8Array::operator[](PRInt32 nIndex) const
{ return GetAt(nIndex); }
PRUint8& nsUint8Array::operator[](PRInt32 nIndex)
{ return ElementAt(nIndex); }
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef _DEBUG
void nsUint8Array::AssertValid() const
{
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -0,0 +1,66 @@
/* Insert copyright and license here 1995 */
#ifndef _nsUint8Array_H_
#define _nsUint8Array_H_
#include "nscore.h"
#include "nsCRT.h"
#include "prmem.h"
#include "msgCore.h"
class NS_MSG_BASE nsUint8Array
{
public:
// Construction
nsUint8Array();
// Attributes
PRInt32 GetSize() const;
PRInt32 GetUpperBound() const;
void SetSize(PRInt32 nNewSize, PRInt32 nGrowBy = -1);
// Operations
// Clean up
void FreeExtra();
void RemoveAll();
// Accessing elements
PRUint8 GetAt(PRInt32 nIndex) const;
void SetAt(PRInt32 nIndex, PRUint8 newElement);
PRUint8& ElementAt(PRInt32 nIndex);
// Potentially growing the array
void SetAtGrow(PRInt32 nIndex, PRUint8 newElement);
PRInt32 Add(PRUint8 newElement);
// overloaded operator helpers
PRUint8 operator[](PRInt32 nIndex) const;
PRUint8& operator[](PRInt32 nIndex);
// Operations that move elements around
nsresult InsertAt(PRInt32 nIndex, PRUint8 newElement, PRInt32 nCount = 1);
void RemoveAt(PRInt32 nIndex, PRInt32 nCount = 1);
nsresult InsertAt(PRInt32 nStartIndex, nsUint8Array* pNewArray);
// use carefully!
PRUint8* GetArray(void) {return((PRUint8*)m_pData);} // only valid until another function called on the array (like GetBuffer() in CString)
// Implementation
protected:
PRUint8* m_pData; // the actual array of data
PRInt32 m_nSize; // # of elements (upperBound - 1)
PRInt32 m_nMaxSize; // max allocated
PRInt32 m_nGrowBy; // grow amount
public:
~nsUint8Array();
#ifdef _DEBUG
void AssertValid() const;
#endif
};
#endif

Просмотреть файл

@ -33,14 +33,7 @@
#include "pratom.h"
#include "nsMsgCompCID.h"
/* Include all of the interfaces our factory can generate components for */
#include "nsMsgSendFact.h"
#include "nsMsgCompFieldsFact.h"
#include "nsMsgSendLaterFact.h"
#include "nsMsgComposeFact.h"
#include "nsMsgSendLater.h"
#include "nsSmtpUrl.h"
#include "nsISmtpService.h"

Просмотреть файл

@ -29,10 +29,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = msgcompose
EXPORTS = \
nsMsgComposeFact.h \
nsMsgCompFieldsFact.h \
nsMsgSendFact.h \
nsMsgSendLaterFact.h \
$(NULL)
XPIDLSRCS = \

Просмотреть файл

@ -43,10 +43,6 @@ XPIDLSRCS = \
## exports
EXPORTS = \
nsMsgComposeFact.h \
nsMsgCompFieldsFact.h \
nsMsgSendFact.h \
nsMsgSendLaterFact.h \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -27,113 +27,43 @@
[scriptable, uuid(3E89CAE3-BD2D-11d2-8293-000000000000)]
interface nsIMsgCompFields : nsISupports {
void Copy(in nsIMsgCompFields pMsgCompFields);
attribute wstring from;
attribute wstring replyTo;
attribute wstring to;
attribute wstring cc;
attribute wstring bcc;
attribute wstring fcc;
attribute wstring fcc2;
attribute string newsgroups;
attribute string newshost;
attribute string newspostUrl;
attribute string followupTo;
void SetHeader(in long header, in wstring value);
wstring GetHeader(in long header);
attribute wstring subject;
attribute string attachments;
attribute wstring organization;
attribute string references;
attribute string priority;
attribute string messageId;
attribute string characterSet;
void SetBoolHeader(in long header, in boolean bValue);
boolean GetBoolHeader(in long header);
attribute wstring templateName;
attribute string draftId;
/* Convenience routines to get and set header's value... */
void SetFrom(in wstring value);
wstring GetFrom();
attribute boolean returnReceipt;
attribute boolean attachVCard;
attribute boolean forcePlainText;
attribute boolean useMultipartAlternative;
attribute boolean uuEncodeAttachments;
void SetReplyTo(in wstring value);
wstring GetReplyTo();
attribute wstring otherRandomHeaders;
void SetTo(in wstring value);
wstring GetTo();
void SetCc(in wstring value);
wstring GetCc();
void SetBcc(in wstring value);
wstring GetBcc();
void SetFcc(in wstring value);
wstring GetFcc();
void SetFcc2(in wstring value);
wstring GetFcc2();
void SetNewsFcc(in wstring value);
wstring GetNewsFcc();
void SetNewsBcc(in wstring value);
wstring GetNewsBcc();
void SetNewsgroups(in wstring value);
wstring GetNewsgroups();
void SetNewshost(in wstring value);
wstring GetNewshost();
void SetFollowupTo(in wstring value);
wstring GetFollowupTo();
void SetSubject(in wstring value);
wstring GetSubject();
void SetAttachments(in wstring value);
wstring GetAttachments();
void SetOrganization(in wstring value);
wstring GetOrganization();
void SetReferences(in wstring value);
wstring GetReferences();
void SetOtherRandomHeaders(in wstring value);
wstring GetOtherRandomHeaders();
void SetNewspostUrl(in wstring value);
wstring GetNewspostUrl();
void SetDefaultBody(in wstring value);
wstring GetDefaultBody();
void SetPriority(in wstring value);
wstring GetPriority();
void SetMessageEncoding(in wstring value);
wstring GetMessageEncoding();
void SetCharacterSet(in wstring value);
wstring GetCharacterSet();
void SetMessageId(in wstring value);
wstring GetMessageId();
void SetHTMLPart(in wstring value);
wstring GetHTMLPart();
void SetTemplateName(in wstring value);
wstring GetTemplateName();
void SetDraftId(in wstring value);
wstring GetDraftId();
void SetReturnReceipt(in boolean value);
boolean GetReturnReceipt();
void SetAttachVCard(in boolean value);
boolean GetAttachVCard();
void SetBody(in wstring value);
wstring GetBody();
void SetUUEncodeAttachments(in boolean value);
boolean GetUUEncodeAttachments();
void SetUseMultipartAlternativeFlag(in boolean value);
boolean GetUseMultipartAlternativeFlag();
void SetTheForcePlainText(in boolean value);
boolean GetTheForcePlainText();
attribute wstring body;
/* some utility functions */
nsIMsgRecipientArray SplitRecipients(in wstring recipients, in boolean emailAddressOnly);
void ConvertBodyToPlainText();
nsIMsgRecipientArray SplitRecipients(in wstring recipients, in boolean emailAddressOnly);
void ConvertBodyToPlainText();
};

Просмотреть файл

@ -96,7 +96,7 @@ interface nsIMsgCompose : nsISupports {
void Initialize(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams params);
/* ... */
void SetDocumentCharset(in wstring charset);
void SetDocumentCharset(in string charset);
/* ... */
void RegisterStateListener(in nsIMsgComposeStateListener stateListener);
@ -105,8 +105,7 @@ interface nsIMsgCompose : nsISupports {
void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
/* ... */
void SendMsg(in MSG_DeliverMode deliverMode,
in nsIMsgIdentity identity);
void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity);
/* ... */
void CloseWindow();
@ -116,7 +115,7 @@ interface nsIMsgCompose : nsISupports {
It will also convert the filename to the right character set.
This UI utility function should probably go into it's own class
*/
wstring AttachmentPrettyName(in wstring url);
wstring AttachmentPrettyName(in string url);
/*
CheckAndPopulateRecipients will perform several task:
@ -129,7 +128,7 @@ interface nsIMsgCompose : nsISupports {
/* GetNoHtmlNewsgroups: if null is passed as recipient, the function will automatically
looks for newsgroups stored in compose fields
*/
wstring GetNoHtmlNewsgroups(in wstring newsgroups);
string GetNoHtmlNewsgroups(in string newsgroups);
/* bodyConvertible: The level of "convertibility" to plaintext
* @return a value from nsIMsgCompConvertible.
@ -145,7 +144,7 @@ interface nsIMsgCompose : nsISupports {
void ResetNodeEventHandlers(in nsIDOMNode node);
/* ... */
attribute nsIEditorShell editor;
attribute nsIEditorShell editor;
/* ... */
readonly attribute nsIDOMWindowInternal domWindow;
@ -156,6 +155,9 @@ interface nsIMsgCompose : nsISupports {
/* ... */
readonly attribute boolean composeHTML;
/* ... */
readonly attribute MSG_ComposeType type;
/* ... */
readonly attribute long wrapLength;

Просмотреть файл

@ -60,7 +60,7 @@ interface nsIMsgCompFormat {
interface nsIMsgComposeParams : nsISupports {
attribute MSG_ComposeType type;
attribute MSG_ComposeFormat format;
attribute wstring originalMsgURI;
attribute string originalMsgURI;
attribute nsIMsgIdentity identity;
attribute nsIMsgCompFields composeFields;

Просмотреть файл

@ -37,7 +37,7 @@ interface nsIURI;
interface nsIMsgComposeService : nsISupports {
/* ... */
void OpenComposeWindow(in wstring msgComposeWindowURL, in wstring originalMsgURI, in MSG_ComposeType type, in MSG_ComposeFormat format,
void OpenComposeWindow(in string msgComposeWindowURL, in string originalMsgURI, in MSG_ComposeType type, in MSG_ComposeFormat format,
in nsIMsgIdentity identity);
/* use this method to invoke a compose window given a mailto url.
@ -45,20 +45,19 @@ interface nsIMsgComposeService : nsISupports {
url you want to use in brining up a compose window, pass it in here.
aURI --> the mailto url you want to use as the foundation for the data inside
the compose window */
void OpenComposeWindowWithURI(in wstring msgComposeWindowURL, in nsIURI aURI);
void OpenComposeWindowWithURI(in string msgComposeWindowURL, in nsIURI aURI);
/* ... */
void OpenComposeWindowWithValues(in wstring msgComposeWindowURL, in MSG_ComposeType type, in MSG_ComposeFormat format,
in wstring to, in wstring cc, in wstring bcc, in wstring newsgroups,
in wstring subject, in wstring body, in wstring attachment, in nsIMsgIdentity identity);
void OpenComposeWindowWithValues(in string msgComposeWindowURL, in MSG_ComposeType type, in MSG_ComposeFormat format,
in wstring to, in wstring cc, in wstring bcc, in string newsgroups,
in wstring subject, in wstring body, in string attachment, in nsIMsgIdentity identity);
/* ... */
void OpenComposeWindowWithCompFields(in wstring msgComposeWindowURL, in MSG_ComposeType type, in MSG_ComposeFormat format,
void OpenComposeWindowWithCompFields(in string msgComposeWindowURL, in MSG_ComposeType type, in MSG_ComposeFormat format,
in nsIMsgCompFields compFields, in nsIMsgIdentity identity);
/* ... */
nsIMsgCompose InitCompose(in nsIDOMWindowInternal aWindow,
in nsIMsgComposeParams params);
nsIMsgCompose InitCompose(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams params);
/* ... */
void DisposeCompose(in nsIMsgCompose compose);

Просмотреть файл

@ -22,8 +22,8 @@
#include "nsISupports.idl"
#include "nsIOutputStream.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgHdr.idl"
interface nsIMessage;
[scriptable, uuid(A6237474-453B-11d3-8F0F-00A024A7D144)]
@ -33,10 +33,10 @@ interface nsIMsgDraft : nsISupports
* This is the primary interface for drafts and templates, loaded by
* a URI
*/
void OpenDraftMsg(in wstring msgURI, out nsIMessage aMsgToReplace,
void OpenDraftMsg(in string msgURI, out nsIMsgDBHdr aMsgToReplace,
in nsIMsgIdentity identity, in PRBool addInlineHeaders);
void OpenEditorTemplate(in wstring msgURI, out nsIMessage aMsgReplace,
void OpenEditorTemplate(in string msgURI, out nsIMsgDBHdr aMsgReplace,
in nsIMsgIdentity identity);
};

Просмотреть файл

@ -34,8 +34,8 @@ interface nsIMsgQuote : nsISupports {
/* aCharset is an option parameter which can be used to force the message to be
quoted using a particular charset.
*/
void QuoteMessage(in wstring msgURI, in boolean quoteHeaders, in
nsIStreamListener aStreamListener, in wstring aCharset);
void QuoteMessage(in string msgURI, in boolean quoteHeaders, in
nsIStreamListener aStreamListener, in string aCharset);
readonly attribute nsIMimeStreamConverterListener quoteListener;
readonly attribute nsIChannel quoteChannel;
readonly attribute nsIStreamListener streamListener;

Просмотреть файл

@ -42,7 +42,7 @@
%}
interface nsIURI;
interface nsIMessage;
interface nsIMsgDBHdr;
interface nsIMsgHdr;
interface nsIDocShell;
@ -160,7 +160,7 @@ interface nsIMsgSend : nsISupports
in PRBool digest_p,
in PRBool dont_deliver_p,
in nsMsgDeliverMode mode,
in nsIMessage msgToReplace,
in nsIMsgDBHdr msgToReplace,
in string attachment1_type,
in string attachment1_body,
in PRUint32 attachment1_body_length,
@ -178,19 +178,11 @@ interface nsIMsgSend : nsISupports
in PRBool deleteSendFileOnCompletion,
in PRBool digest_p,
in nsMsgDeliverMode mode,
in nsIMessage msgToReplace,
in nsIMsgDBHdr msgToReplace,
[array, size_is(listeners)]
in nsIMsgSendListener aListenerArray,
in unsigned long listeners);
void SendWebPage(in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
in nsIURI url,
in nsMsgDeliverMode mode,
[array, size_is(listeners)]
in nsIMsgSendListener aListenerArray,
in unsigned long listeners);
void AddListener(in nsIMsgSendListener aListener);
void RemoveListener(in nsIMsgSendListener aListener);
void SetGUINotificationState(in PRBool aEnableFlag);

Просмотреть файл

@ -30,14 +30,15 @@
#include "nsIMsgSendLaterListener.idl"
#include "nsIStreamListener.idl"
[ptr] native sendListenerPtr(nsIMsgSendLaterListener *);
interface nsIMsgWindow;
interface nsIMsgFolder;
[scriptable, uuid(E15C83E8-1CF4-11d3-8EF0-00A024A7D144)]
interface nsIMsgSendLater : nsIStreamListener
{
[noscript]
void SendUnsentMessages(in nsIMsgIdentity identity,
in sendListenerPtr listenerArray);
void SendUnsentMessages(in nsIMsgIdentity identity);
attribute nsIMsgWindow msgWindow;
void RemoveListener(in nsIMsgSendLaterListener aListener);
void AddListener(in nsIMsgSendLaterListener aListener);
void GetUnsentMessagesFolder(in nsIMsgIdentity userIdentity, out nsIMsgFolder folder);
};

Просмотреть файл

@ -45,7 +45,6 @@ ioService = ioService.QueryInterface(Components.interfaces.nsIIOService);
var msgCompose = null;
var MAX_RECIPIENTS = 0;
var currentAttachment = null;
var documentLoaded = false;
var windowLocked = false;
var contentChanged = false;
var currentIdentity = null;
@ -77,7 +76,7 @@ if (prefs) {
var stateListener = {
NotifyComposeFieldsReady: function() {
documentLoaded = true;
ComposeFieldsReady();
},
ComposeProcessDone: function() {
@ -611,33 +610,25 @@ function GetArgs(originalData)
return args;
}
function WaitFinishLoadingDocument(msgType)
function ComposeFieldsReady(msgType)
{
if (documentLoaded)
{
//If we are in plain text, we nee to set the wrap column
if (! msgCompose.composeHTML)
try
{
window.editorShell.wrapColumn = msgCompose.wrapLength;
}
catch (e)
{
dump("### window.editorShell.wrapColumn exception text: " + e + " - failed\n");
}
CompFields2Recipients(msgCompose.compFields, msgType);
//If we are in plain text, we nee to set the wrap column
if (! msgCompose.composeHTML)
try
{
window.editorShell.wrapColumn = msgCompose.wrapLength;
}
catch (e)
{
dump("### window.editorShell.wrapColumn exception text: " + e + " - failed\n");
}
CompFields2Recipients(msgCompose.compFields, msgCompose.type);
SetComposeWindowTitle(13);
AdjustFocus();
try {
window.updateCommands("create");
} catch(e) {}
if (msgComposeService)
msgComposeService.TimeStamp("addressing widget, windows title and focus are now set. The window is finally ready", false);
}
else
setTimeout("WaitFinishLoadingDocument(" + msgType + ");", 200);
}
function ComposeStartup()
@ -686,21 +677,21 @@ function ComposeStartup()
if (args.preselectid)
params.identity = getIdentityForKey(args.preselectid);
if (args.to)
composeFields.SetTo(args.to);
composeFields.to = args.to;
if (args.cc)
composeFields.SetCc(args.cc);
composeFields.cc = args.cc;
if (args.bcc)
composeFields.SetBcc(args.bcc);
composeFields.bcc = args.bcc;
if (args.newsgroups)
composeFields.SetNewsgroups(args.newsgroups);
composeFields.newsgroups = args.newsgroups;
if (args.subject)
composeFields.SetSubject(args.subject);
composeFields.subject = args.subject;
if (args.attachment)
composeFields.SetAttachments(args.attachment);
composeFields.attachments = args.attachment;
if (args.newshost)
composeFields.SetNewshost(args.newshost);
composeFields.newshost = args.newshost;
if (args.body)
composeFields.SetBody(args.body);
composeFields.body = args.body;
}
}
@ -777,7 +768,7 @@ function ComposeStartup()
{
if (params.bodyIsLink)
{
var body = msgCompFields.GetBody();
var body = msgCompFields.body;
if (msgCompose.composeHTML)
{
var cleanBody;
@ -785,19 +776,18 @@ function ComposeStartup()
cleanBody = unescape(body);
} catch(e) { cleanBody = body;}
msgCompFields.SetBody('<br><a href="' + body +
'">' + cleanBody + '</a><br>');
msgCompFields.body = "<BR><A HREF=\"" + body + "\">" + cleanBody + "</A><BR>";
}
else
msgCompFields.SetBody('\n<' + body + '>\n');
msgCompFields.body = "\n<" + body + ">\n";
}
var subjectValue = msgCompFields.GetSubject();
var subjectValue = msgCompFields.subject;
if (subjectValue != "") {
document.getElementById("msgSubject").value = subjectValue;
}
var attachmentValue = msgCompFields.GetAttachments();
var attachmentValue = msgCompFields.attachments;
if (attachmentValue != "") {
var atts = attachmentValue.split(",");
for (var i=0; i < atts.length; i++)
@ -814,20 +804,16 @@ function ComposeStartup()
try {
window.updateCommands("create");
} catch(e) {}
WaitFinishLoadingDocument(params.type);
}
}
}
function WizCallback(state)
{
if (state){
// dump("true");
ComposeStartup();
}
else
{
// dump("false ");
if (msgCompose)
msgCompose.CloseWindow();
else
@ -841,11 +827,11 @@ function ComposeLoad()
if (msgComposeService)
msgComposeService.TimeStamp("Start Initializing the compose window (ComposeLoad)", false);
gComposeMsgsBundle = document.getElementById("bundle_composeMsgs");
try {
SetupCommandUpdateHandlers();
var wizardcallback = true;
var state = verifyAccounts(wizardcallback); // this will do migration, or create a new account if we need to.
SetupCommandUpdateHandlers();
var wizardcallback = true;
var state = verifyAccounts(wizardcallback); // this will do migration, or create a new account if we need to.
if (other_header != "") {
var selectNode = document.getElementById('msgRecipientType#1');
@ -934,7 +920,7 @@ function SetDefaultMailSendCharacterSet()
function InitCharsetMenuCheckMark()
{
// dump("msgCompose.compFields is " + msgCompose.compFields.GetCharacterSet() + "\n");
// dump("msgCompose.compFields is " + msgCompose.compFields.characterSet + "\n");
// return if the charset is already set explitily
if (currentMailSendCharset != null) {
dump("already set to " + currentMailSendCharset + "\n");
@ -958,7 +944,7 @@ function InitCharsetMenuCheckMark()
// send_default_charset = send_default_charset.toUpperCase();
dump("send_default_charset is " + send_default_charset + "\n");
var compFieldsCharset = msgCompose.compFields.GetCharacterSet();
var compFieldsCharset = msgCompose.compFields.characterSet;
// compFieldsCharset = compFieldsCharset.toUpperCase();
dump("msgCompose.compFields is " + compFieldsCharset + "\n");
@ -983,7 +969,7 @@ function InitCharsetMenuCheckMark()
function GetCharsetUIString()
{
var charset = msgCompose.compFields.GetCharacterSet();
var charset = msgCompose.compFields.characterSet;
if (g_send_default_charset == null) {
try {
prefs = Components.classes['@mozilla.org/preferences;1'];
@ -1038,10 +1024,10 @@ function GenericSendMessage( msgType )
{
Recipients2CompFields(msgCompFields);
var subject = document.getElementById("msgSubject").value;
msgCompFields.SetSubject(subject);
msgCompFields.subject = subject;
dump("attachments = " + GenerateAttachmentsString() + "\n");
try {
msgCompFields.SetAttachments(GenerateAttachmentsString());
msgCompFields.attachments = GenerateAttachmentsString();
}
catch (ex) {
dump("failed to SetAttachments\n");
@ -1067,7 +1053,7 @@ function GenericSendMessage( msgType )
result
))
{
msgCompFields.SetSubject(result.value);
msgCompFields.subject = result.value;
var subjectInputElem = document.getElementById("msgSubject");
subjectInputElem.value = result.value;
}
@ -1097,16 +1083,16 @@ function GenericSendMessage( msgType )
switch (action)
{
case msgCompSendFormat.PlainText:
msgCompFields.SetTheForcePlainText(true);
msgCompFields.SetUseMultipartAlternativeFlag(false);
msgCompFields.forcePlainText = true;
msgCompFields.useMultipartAlternative = false;
break;
case msgCompSendFormat.HTML:
msgCompFields.SetTheForcePlainText(false);
msgCompFields.SetUseMultipartAlternativeFlag(false);
msgCompFields.forcePlainText = false;
msgCompFields.useMultipartAlternative = false;
break;
case msgCompSendFormat.Both:
msgCompFields.SetTheForcePlainText(false);
msgCompFields.SetUseMultipartAlternativeFlag(true);
msgCompFields.forcePlainText = false;
msgCompFields.useMultipartAlternative = true;
break;
default: dump("\###SendMessage Error: invalid action value\n"); return;
}
@ -1202,14 +1188,14 @@ function MessageFcc(menuItem)
var msgCompFields = msgCompose.compFields;
if (msgCompFields)
{
if (msgCompFields.GetFcc2() == destUri)
if (msgCompFields.fcc2 == destUri)
{
msgCompFields.SetFcc2("nocopy://");
msgCompFields.fcc2 = "nocopy://";
dump("FCC2: none\n");
}
else
{
msgCompFields.SetFcc2(destUri);
msgCompFields.fcc2 = destUri;
dump("FCC2: " + destUri + "\n");
}
}
@ -1223,7 +1209,7 @@ function PriorityMenuSelect(target)
{
var msgCompFields = msgCompose.compFields;
if (msgCompFields)
msgCompFields.SetPriority(target.getAttribute('id'));
msgCompFields.priority = target.getAttribute('id');
}
}
@ -1234,15 +1220,13 @@ function ReturnReceiptMenuSelect()
var msgCompFields = msgCompose.compFields;
if (msgCompFields)
{
if (msgCompFields.GetReturnReceipt())
if (msgCompFields.returnReceipt)
{
dump("Set Return Receipt to FALSE\n");
msgCompFields.SetReturnReceipt(false);
msgCompFields.returnReceipt = false;
}
else
{
dump("Set Return Receipt to TRUE\n");
msgCompFields.SetReturnReceipt(true);
msgCompFields.returnReceipt = true;
}
}
}
@ -1274,9 +1258,9 @@ function SelectAddress()
Recipients2CompFields(msgCompFields);
var toAddress = msgCompFields.GetTo();
var ccAddress = msgCompFields.GetCc();
var bccAddress = msgCompFields.GetBcc();
var toAddress = msgCompFields.to;
var ccAddress = msgCompFields.cc;
var bccAddress = msgCompFields.bcc;
dump("toAddress: " + toAddress + "\n");
window.openDialog("chrome://messenger/content/addressbook/abSelectAddressesDialog.xul",
@ -1651,7 +1635,7 @@ function DetermineHTMLAction(convertible)
} catch(ex)
{
var msgCompFields = msgCompose.compFields;
noHtmlRecipients = msgCompFields.GetTo() + "," + msgCompFields.GetCc() + "," + msgCompFields.GetBcc();
noHtmlRecipients = msgCompFields.to + "," + msgCompFields.cc + "," + msgCompFields.bcc;
preferFormat = abPreferMailFormat.unknown;
}
dump("DetermineHTMLAction: preferFormat = " + preferFormat + ", noHtmlRecipients are " + noHtmlRecipients + "\n");
@ -1661,7 +1645,7 @@ function DetermineHTMLAction(convertible)
noHtmlnewsgroups = msgCompose.GetNoHtmlNewsgroups(null);
} catch(ex)
{
noHtmlnewsgroups = msgCompose.compFields.GetNewsgroups();
noHtmlnewsgroups = msgCompose.compFields.newsgroups;
}
if (noHtmlRecipients != "" || noHtmlnewsgroups != "")

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше