RetroZilla/browser/components/bookmarks/public/nsIBookmarkTransactionManager.idl
2015-10-20 23:03:22 -04:00

132 lines
4.8 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Bookmarks transaction code.
*
* The Initial Developer of the Original Code is
* Joey Minta <jminta@gmail.com>
*
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIRDFResource;
interface nsIRDFNode;
interface nsIRDFLiteral;
interface nsITransactionManager;
/**
* nsIBookmarkTransactionService is a service designed to handle
* nsITransactions that correspond to changes in bookmarks. It is here as a
* service so that we can keep the transactions around without holding onto
* the whole global js scope+window.
*/
[scriptable, uuid(f6305e79-1760-4991-ab4d-a42db60f0e67)]
interface nsIBookmarkTransactionManager : nsISupports
{
/**
* Performs a new transaction according to the specified parameters
*
* @param aType the type of transaction being performed. Must be one
* of the three constants defined below
* @param aAction the action to be performed. Expected values are:
* import, insert, move, and remove (see bookmarks.js)
* @param aItem the rdf node the transaction is being performed on
* @param aIndex the index of the item in its RDF Container
* @param aParent the rdf-parent of aItem, that is, the folder it
* should be inserted into.
* @param aRemovedProps properties removed from the item in question
*
*/
void createAndCommitTxn(in unsigned long aType,
in aString aAction,
in nsIRDFNode aItem,
in long aIndex,
in nsIRDFResource aParent,
in unsigned long aPropCount,
[array, size_is(aPropCount)] in nsIRDFLiteral aRemovedProps);
/**
* Constants corresponding to the 3 different types of transactions possible
* Note that moving bookmarks is a combination of REMOVE+INSERT
*/
const unsigned long IMPORT = 0;
const unsigned long INSERT = 1;
const unsigned long REMOVE = 2;
/**
* Signals the transaction manager that a series of transactions are going to
* be performed, but that, for the purposes of undo and redo, they should all
* be regarded as a single transaction. That is, a single undo() call will
* undo all of the transactions created and committed between startBatch() and
* endBatch(). See also nsITransactionManager::beginBatch
*
* @note if startBatch() is called multiple times. The batch will not end
* endBatch() has been called the same number of times.
*/
void startBatch();
/**
* Ends the batch transaction in process, subject to the note above about
* multiple, successive calls of startBatch(). See also
* nsITransactionManager::endBatch
*/
void endBatch();
/**
* Undo the last transaction in the transaction manager's stack
*/
void undo();
/**
* Returns true if it is possible to undo a transaction at this time
*/
boolean canUndo();
/**
* Redo the last transaction
*/
void redo();
/**
* Returns true if it is possible to redo a transaction at this time
*/
boolean canRedo();
/**
* A reference to the transaction manager for bookmarks
*/
readonly attribute nsITransactionManager transactionManager;
};