Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
nsMsgFilterService Class Reference

#include <nsMsgFilterService.h>

Inheritance diagram for nsMsgFilterService:
Inheritance graph
[legend]
Collaboration diagram for nsMsgFilterService:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsMsgFilterService ()
virtual ~nsMsgFilterService ()
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGFILTERSERVICE
nsresult 
BackUpFilterFile (nsIFileSpec *aFilterFile, nsIMsgWindow *aMsgWindow)
nsresult AlertBackingUpFilterFile (nsIMsgWindow *aMsgWindow)
nsresult ThrowAlertMsg (const char *aMsgName, nsIMsgWindow *aMsgWindow)
nsresult GetStringFromBundle (const char *aMsgName, PRUnichar **aResult)
nsresult GetFilterStringBundle (nsIStringBundle **aBundle)
NS_IMETHOD OpenFilterList (nsFileSpec *filterFile, nsIMsgFilterList **filterList)=0
nsIMsgFilterList OpenFilterList (in nsIFileSpec filterFile, in nsIMsgFolder rootFolder, in nsIMsgWindow msgWindow)
NS_IMETHOD CloseFilterList (nsIMsgFilterList *filterList)=0
void CloseFilterList (in nsIMsgFilterList filterList)
NS_IMETHOD SaveFilterList (nsIMsgFilterList *filterList, nsFileSpec *filterFile)=0
void SaveFilterList (in nsIMsgFilterList filterList, in nsIFileSpec filterFile)
NS_IMETHOD CancelFilterList (nsIMsgFilterList *filterList)=0
void CancelFilterList (in nsIMsgFilterList filterList)
nsIMsgFilterList getTempFilterList (in nsIMsgFolder aFolder)
void applyFiltersToFolders (in nsIMsgFilterList aFilterList, in nsISupportsArray aFolders, in nsIMsgWindow aMsgWindow)

Detailed Description

Definition at line 50 of file nsMsgFilterService.h.


Constructor & Destructor Documentation

Definition at line 69 of file nsMsgFilterService.cpp.

{
}

Definition at line 73 of file nsMsgFilterService.cpp.

{
}

Member Function Documentation

Definition at line 252 of file nsMsgFilterService.cpp.

{
  return ThrowAlertMsg("filterListBackUpMsg", aMsgWindow);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgFilterService::applyFiltersToFolders ( in nsIMsgFilterList  aFilterList,
in nsISupportsArray  aFolders,
in nsIMsgWindow  aMsgWindow 
) [inherited]

Definition at line 216 of file nsMsgFilterService.cpp.

{
  nsresult rv;
  AlertBackingUpFilterFile(aMsgWindow);
  aFilterFile->CloseStream();

  nsCOMPtr<nsILocalFile> localFilterFile;
  nsFileSpec filterFileSpec;
  aFilterFile->GetFileSpec(&filterFileSpec);
  rv = NS_FileSpecToIFile(&filterFileSpec, getter_AddRefs(localFilterFile));
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsILocalFile> localParentDir;
  nsCOMPtr <nsIFileSpec> parentDir;
  rv = aFilterFile->GetParent(getter_AddRefs(parentDir));
  NS_ENSURE_SUCCESS(rv,rv);

  nsFileSpec parentDirSpec;
  parentDir->GetFileSpec(&parentDirSpec);

  rv = NS_FileSpecToIFile(&parentDirSpec, getter_AddRefs(localParentDir));
  NS_ENSURE_SUCCESS(rv,rv);

  //if back-up file exists delete the back up file otherwise copy fails. 
  nsCOMPtr <nsILocalFile> backupFile;
  rv = NS_FileSpecToIFile(&parentDirSpec, getter_AddRefs(backupFile));
  NS_ENSURE_SUCCESS(rv,rv);
  backupFile->AppendNative(NS_LITERAL_CSTRING("rulesbackup.dat"));
  PRBool exists;
  backupFile->Exists(&exists);
  if (exists)
    backupFile->Remove(PR_FALSE);

  return localFilterFile->CopyToNative(localParentDir, NS_LITERAL_CSTRING("rulesbackup.dat"));
}

Here is the call graph for this function:

NS_IMETHOD nsIMsgFilterService::CancelFilterList ( nsIMsgFilterList filterList) [pure virtual, inherited]
NS_IMETHOD nsIMsgFilterService::CloseFilterList ( nsIMsgFilterList filterList) [pure virtual, inherited]

Definition at line 271 of file nsMsgFilterService.cpp.

{
  nsresult rv=NS_OK;
  NS_ENSURE_ARG_POINTER(aBundle);
  nsCOMPtr<nsIStringBundleService> bundleService =
         do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
  nsCOMPtr<nsIStringBundle> bundle;
  if (bundleService && NS_SUCCEEDED(rv))
    bundleService->CreateBundle("chrome://messenger/locale/filter.properties",
                                 getter_AddRefs(bundle));
  NS_IF_ADDREF(*aBundle = bundle);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgFilterService::GetStringFromBundle ( const char *  aMsgName,
PRUnichar **  aResult 
)

Definition at line 258 of file nsMsgFilterService.cpp.

{ 
  nsresult rv=NS_OK;
  NS_ENSURE_ARG_POINTER(aResult);
  nsCOMPtr <nsIStringBundle> bundle;
  rv = GetFilterStringBundle(getter_AddRefs(bundle));
  if (NS_SUCCEEDED(rv) && bundle)
    rv=bundle->GetStringFromName(NS_ConvertASCIItoUCS2(aMsgName).get(), aResult);
  return rv;
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMsgFilterList nsIMsgFilterService::OpenFilterList ( in nsIFileSpec  filterFile,
in nsIMsgFolder  rootFolder,
in nsIMsgWindow  msgWindow 
) [inherited]
NS_IMETHOD nsIMsgFilterService::OpenFilterList ( nsFileSpec filterFile,
nsIMsgFilterList **  filterList 
) [pure virtual, inherited]
void nsIMsgFilterService::SaveFilterList ( in nsIMsgFilterList  filterList,
in nsIFileSpec  filterFile 
) [inherited]
NS_IMETHOD nsIMsgFilterService::SaveFilterList ( nsIMsgFilterList filterList,
nsFileSpec filterFile 
) [pure virtual, inherited]
nsresult nsMsgFilterService::ThrowAlertMsg ( const char *  aMsgName,
nsIMsgWindow aMsgWindow 
)

Definition at line 286 of file nsMsgFilterService.cpp.

{
  nsXPIDLString alertString;
  nsresult rv = GetStringFromBundle(aMsgName, getter_Copies(alertString));
  if (NS_SUCCEEDED(rv) && alertString && aMsgWindow)
  {
    nsCOMPtr <nsIDocShell> docShell;
    aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
    if (docShell)
    {
      nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
      if (dialog && alertString)
        dialog->Alert(nsnull, alertString);
    }
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: