gecko-dev/mailnews/db/msgdb/public/nsDBFolderInfo.h

150 строки
5.7 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
1999-02-01 05:55:32 +03:00
*
* 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/
1999-02-01 05:55:32 +03:00
*
* 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.
1999-02-01 05:55:32 +03:00
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
1999-02-01 05:55:32 +03:00
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
1999-02-01 05:55:32 +03:00
*/
/* This class encapsulates the global information about a folder stored in the
summary file.
*/
#ifndef _nsDBFolderInfo_H
#define _nsDBFolderInfo_H
#include "nsString.h"
#include "MailNewsTypes.h"
#include "mdb.h"
#include "nsMsgKeyArray.h"
1999-02-24 05:56:11 +03:00
#include "nsIDBFolderInfo.h"
1999-02-01 05:55:32 +03:00
class nsMsgDatabase;
// again, this could inherit from nsISupports, but I don't see the need as of yet.
// I'm not sure it needs to be ref-counted (but I think it does).
// I think these getters and setters really need to go through mdb and not rely on the object
// caching the values. If this somehow turns out to be prohibitively expensive, we can invent
// some sort of dirty mechanism, but I think it turns out that these values will be cached by
// the MSG_FolderInfo's anyway.
1999-02-24 05:56:11 +03:00
class nsDBFolderInfo : public nsIDBFolderInfo
1999-02-01 05:55:32 +03:00
{
public:
// friend class nsMsgDatabase;
1999-02-01 05:55:32 +03:00
nsDBFolderInfo(nsMsgDatabase *mdb);
virtual ~nsDBFolderInfo();
1999-02-24 05:56:11 +03:00
NS_DECL_ISUPPORTS
// interface methods.
NS_DECL_NSIDBFOLDERINFO
1999-02-01 05:55:32 +03:00
// create the appropriate table and row in a new db.
nsresult AddToNewMDB();
// accessor methods.
1999-02-01 05:55:32 +03:00
1999-07-01 01:04:29 +04:00
PRBool AddLaterKey(nsMsgKey key, PRTime until);
1999-02-01 05:55:32 +03:00
PRInt32 GetNumLatered();
1999-07-01 01:04:29 +04:00
nsMsgKey GetLateredAt(PRInt32 laterIndex, PRTime pUntil);
1999-02-01 05:55:32 +03:00
void RemoveLateredAt(PRInt32 laterIndex);
void SetViewType(PRInt32 viewType);
PRInt32 GetViewType();
// we would like to just store the property name we're sorted by
void SetSortInfo(nsMsgSortType, nsMsgSortOrder);
void GetSortInfo(nsMsgSortType *, nsMsgSortOrder *);
PRBool TestFlag(PRInt32 flags);
PRInt16 GetIMAPHierarchySeparator() ;
void SetIMAPHierarchySeparator(PRInt16 hierarchySeparator) ;
void ChangeImapTotalPendingMessages(PRInt32 delta);
void ChangeImapUnreadPendingMessages(PRInt32 delta) ;
nsresult InitFromExistingDB();
// get and set arbitrary property, aka row cell value.
1999-06-14 06:20:41 +04:00
nsresult SetPropertyWithToken(mdb_token aProperty, nsString *propertyStr);
nsresult SetUint32PropertyWithToken(mdb_token aProperty, PRUint32 propertyValue);
nsresult SetInt32PropertyWithToken(mdb_token aProperty, PRInt32 propertyValue);
1999-06-14 06:20:41 +04:00
nsresult GetPropertyWithToken(mdb_token aProperty, nsString *resultProperty);
nsresult GetUint32PropertyWithToken(mdb_token aProperty, PRUint32 &propertyValue, PRUint32 defaultValue = 0);
nsresult GetInt32PropertyWithToken(mdb_token aProperty, PRInt32 &propertyValue, PRInt32 defaultValue = 0);
1999-02-01 05:55:32 +03:00
nsMsgKeyArray m_lateredKeys; // list of latered messages
protected:
// initialize from appropriate table and row in existing db.
nsresult InitMDBInfo();
nsresult LoadMemberVariables();
PRInt32 m_folderSize;
PRInt32 m_expungedBytes; // sum of size of deleted messages in folder
time_t m_folderDate;
nsMsgKey m_highWaterMessageKey; // largest news article number or imap uid whose header we've seen
1999-02-01 05:55:32 +03:00
PRInt32 m_numVisibleMessages; // doesn't include expunged or ignored messages (but does include collapsed).
PRInt32 m_numNewMessages;
PRInt32 m_numMessages; // includes expunged and ignored messages
PRInt32 m_flags; // folder specific flags. This holds things like re-use thread pane,
// configured for off-line use, use default retrieval, purge article/header options
nsMsgKey m_lastMessageLoaded; // set by the FE's to remember the last loaded message
1999-02-01 05:55:32 +03:00
PRUint16 m_version; // for upgrading...
PRInt32 m_sortType; // the last sort type open on this db.
PRInt16 m_csid; // default csid for these messages
PRInt16 m_IMAPHierarchySeparator; // imap path separator
PRInt8 m_sortOrder; // the last sort order (up or down
// mail only (for now)
// IMAP only
PRInt32 m_ImapUidValidity;
PRInt32 m_totalPendingMessages;
PRInt32 m_unreadPendingMessages;
// news only (for now)
nsMsgKey m_expiredMark; // Highest invalid article number in group - for expiring
PRInt32 m_viewType; // for news, the last view type open on this db.
1999-02-01 05:55:32 +03:00
// the db folder info will have to know what db and row it belongs to, since it is really
// just a wrapper around the singleton folder info row in the mdb.
nsMsgDatabase *m_mdb;
nsIMdbTable *m_mdbTable; // singleton table in db
nsIMdbRow *m_mdbRow; // singleton row in table;
PRBool m_mdbTokensInitialized;
1999-02-01 05:55:32 +03:00
mdb_token m_rowScopeToken;
mdb_token m_tableKindToken;
// tokens for the pre-set columns - we cache these for speed, which may be silly
mdb_token m_mailboxNameColumnToken;
mdb_token m_numVisibleMessagesColumnToken;
mdb_token m_numMessagesColumnToken;
mdb_token m_numNewMessagesColumnToken;
mdb_token m_flagsColumnToken;
mdb_token m_lastMessageLoadedColumnToken;
mdb_token m_folderSizeColumnToken;
mdb_token m_expungedBytesColumnToken;
mdb_token m_folderDateColumnToken;
mdb_token m_highWaterMessageKeyColumnToken;
mdb_token m_imapUidValidityColumnToken;
mdb_token m_totalPendingMessagesColumnToken;
mdb_token m_unreadPendingMessagesColumnToken;
mdb_token m_expiredMarkColumnToken;
1999-03-02 02:34:30 +03:00
mdb_token m_versionColumnToken;
1999-02-01 05:55:32 +03:00
};
#endif