diff --git a/mailnews/addrbook/src/nsAddrDatabase.cpp b/mailnews/addrbook/src/nsAddrDatabase.cpp index 648a8fd21535..d651667f3563 100644 --- a/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -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) diff --git a/mailnews/base/build/nsMsgBaseCID.h b/mailnews/base/build/nsMsgBaseCID.h index d7182034270f..4cfa094b4664 100644 --- a/mailnews/base/build/nsMsgBaseCID.h +++ b/mailnews/base/build/nsMsgBaseCID.h @@ -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__ diff --git a/mailnews/base/build/nsMsgFactory.cpp b/mailnews/base/build/nsMsgFactory.cpp index e4a76c45a61c..5c0e4fe26888 100644 --- a/mailnews/base/build/nsMsgFactory.cpp +++ b/mailnews/base/build/nsMsgFactory.cpp @@ -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) diff --git a/mailnews/base/public/MANIFEST_IDL b/mailnews/base/public/MANIFEST_IDL index 2f8e82f33c36..5ffda790d3a1 100644 --- a/mailnews/base/public/MANIFEST_IDL +++ b/mailnews/base/public/MANIFEST_IDL @@ -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 - diff --git a/mailnews/base/public/Makefile.in b/mailnews/base/public/Makefile.in index 77c4e55b9f12..a3e572e5ebd9 100644 --- a/mailnews/base/public/Makefile.in +++ b/mailnews/base/public/Makefile.in @@ -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 diff --git a/mailnews/base/public/makefile.win b/mailnews/base/public/makefile.win index 3788c488b567..f0756e97d210 100644 --- a/mailnews/base/public/makefile.win +++ b/mailnews/base/public/makefile.win @@ -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) ################################################################################ diff --git a/mailnews/base/public/msgCore.h b/mailnews/base/public/msgCore.h index 7bd5673f5ba7..1242463ebad6 100644 --- a/mailnews/base/public/msgCore.h +++ b/mailnews/base/public/msgCore.h @@ -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. diff --git a/mailnews/base/public/nsICopyMessageListener.idl b/mailnews/base/public/nsICopyMessageListener.idl index 6dc1070d90f3..0d02c4cab9e5 100644 --- a/mailnews/base/public/nsICopyMessageListener.idl +++ b/mailnews/base/public/nsICopyMessageListener.idl @@ -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); diff --git a/mailnews/base/public/nsIMessenger.idl b/mailnews/base/public/nsIMessenger.idl index a138e63f0032..7cb450b02e71 100644 --- a/mailnews/base/public/nsIMessenger.idl +++ b/mailnews/base/public/nsIMessenger.idl @@ -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); }; diff --git a/mailnews/base/public/nsIMsgCopyService.idl b/mailnews/base/public/nsIMsgCopyService.idl index c17d1729e404..e906926a5e8e 100644 --- a/mailnews/base/public/nsIMsgCopyService.idl +++ b/mailnews/base/public/nsIMsgCopyService.idl @@ -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); diff --git a/mailnews/base/public/nsIMsgDBView.idl b/mailnews/base/public/nsIMsgDBView.idl index a230b35d1dd6..059891e94184 100644 --- a/mailnews/base/public/nsIMsgDBView.idl +++ b/mailnews/base/public/nsIMsgDBView.idl @@ -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); }; diff --git a/mailnews/base/public/nsIMsgFolder.idl b/mailnews/base/public/nsIMsgFolder.idl index fabf8d84609f..22b57367b904 100644 --- a/mailnews/base/public/nsIMsgFolder.idl +++ b/mailnews/base/public/nsIMsgFolder.idl @@ -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; }; diff --git a/mailnews/base/public/nsIMsgHdr.idl b/mailnews/base/public/nsIMsgHdr.idl index 38482918949f..eee94b0dba8c 100644 --- a/mailnews/base/public/nsIMsgHdr.idl +++ b/mailnews/base/public/nsIMsgHdr.idl @@ -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)] diff --git a/mailnews/base/public/nsIMsgIncomingServer.idl b/mailnews/base/public/nsIMsgIncomingServer.idl index df6ab8a1eea8..c13bd9c89200 100644 --- a/mailnews/base/public/nsIMsgIncomingServer.idl +++ b/mailnews/base/public/nsIMsgIncomingServer.idl @@ -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++ diff --git a/mailnews/base/public/nsIMsgMessageService.idl b/mailnews/base/public/nsIMsgMessageService.idl index 26311cfbe38a..8e45b31361ea 100644 --- a/mailnews/base/public/nsIMsgMessageService.idl +++ b/mailnews/base/public/nsIMsgMessageService.idl @@ -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); -}; \ No newline at end of file +}; diff --git a/mailnews/base/public/nsIMsgThread.idl b/mailnews/base/public/nsIMsgThread.idl index 168b6e099fdd..b30c530676bd 100644 --- a/mailnews/base/public/nsIMsgThread.idl +++ b/mailnews/base/public/nsIMsgThread.idl @@ -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); }; diff --git a/mailnews/base/public/nsIMsgWindow.idl b/mailnews/base/public/nsIMsgWindow.idl index e4b8b2331fff..d7777c062870 100644 --- a/mailnews/base/public/nsIMsgWindow.idl +++ b/mailnews/base/public/nsIMsgWindow.idl @@ -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); diff --git a/mailnews/base/public/nsMsgHeaderMasks.h b/mailnews/base/public/nsMsgHeaderMasks.h index 1155bb17b290..2ee016d209dd 100644 --- a/mailnews/base/public/nsMsgHeaderMasks.h +++ b/mailnews/base/public/nsMsgHeaderMasks.h @@ -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 diff --git a/mailnews/base/public/nsMsgMessageFlags.h b/mailnews/base/public/nsMsgMessageFlags.h index ff765f8c617c..c4a92b4c2872 100644 --- a/mailnews/base/public/nsMsgMessageFlags.h +++ b/mailnews/base/public/nsMsgMessageFlags.h @@ -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) diff --git a/mailnews/base/resources/content/MANIFEST b/mailnews/base/resources/content/MANIFEST index 3db28dea63c3..e64eae55a3c5 100644 --- a/mailnews/base/resources/content/MANIFEST +++ b/mailnews/base/resources/content/MANIFEST @@ -42,8 +42,6 @@ subscribe.xul sidebar-messenger.rdf folderProps.js imapFolderProps.xul -newFolderNameDialog.xul -newFolderNameDialog.js renameFolderNameDialog.xul msgViewNavigation.js msgMail3PaneWindow.js diff --git a/mailnews/base/resources/content/commandglue.js b/mailnews/base/resources/content/commandglue.js index 22ca927896ef..804e58bda55e 100644 --- a/mailnews/base/resources/content/commandglue.js +++ b/mailnews/base/resources/content/commandglue.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 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 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); + } +} diff --git a/mailnews/base/resources/content/folderPane.xul b/mailnews/base/resources/content/folderPane.xul index 8f0955e9e284..8a7aac07071c 100644 --- a/mailnews/base/resources/content/folderPane.xul +++ b/mailnews/base/resources/content/folderPane.xul @@ -34,7 +34,7 @@ + persist="open viewType viewFlags sortOrder sortType"> 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'); } diff --git a/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul b/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul index 3c36c551eacf..5ba02f5f1968 100644 --- a/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul +++ b/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul @@ -73,23 +73,21 @@ Rights Reserved. - - + + + + + + + + + + + - - - - - + oncommandupdate="FocusRingUpdate_Mail()"/> @@ -134,35 +132,21 @@ Rights Reserved. - - - - - - - - - -