Revision control

Copy as Markdown

Other Tools

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIFolder;
interface mozIStorageConnection;
[scriptable, uuid(2842d879-e52f-4812-926c-dfde62b77881)]
interface nsIFolderDatabase : nsISupports {
/**
* Open a connection to the database and load in the folders from it.
* Returns a promise that resolves (with no value) when loading is complete.
*/
[implicit_jscontext]
Promise loadFolders();
/**
* Get a folder identified by its database row ID.
*/
nsIFolder getFolderById(in unsigned long long id);
/**
* Get a folder identified by its path.
*/
nsIFolder getFolderByPath(in AUTF8String path);
/**
* Move a folder to a different position among its siblings. Yes, passing in
* the parent folder is redundant here, but it makes reading the code easier.
*
* This function should be called by the UI, nothing else is affected.
*/
void moveFolderWithin(in nsIFolder parent,
in nsIFolder child,
[optional] in nsIFolder before);
/**
* Move a folder from one parent to another. Folders cannot be moved from
* one folder to another, or be made descendants of themselves.
*
* This function should be called by the protocol code after the folder is
* moved on the server.
*/
void moveFolderTo(in nsIFolder newParent, in nsIFolder child);
/**
* Update a folder's flags to match `newFlags`.
*/
void updateFlags(in nsIFolder folder, in unsigned long long newFlags);
/**
* Access to the database for testing purposes only. If you are not a test,
* you'll get NS_ERROR_NOT_AVAILABLE instead.
*/
readonly attribute mozIStorageConnection connection;
};