calendar/base/public/calITransactionManager.idl
author Edmund Wong <ewong@pw-wspx.org>
Mon, 12 Mar 2012 15:27:17 +0800
changeset 11058 2af54b6c02f22005cb8d0a70c2766e32d06cafa9
parent 372 7c0bfdcda6731e77303f3c47b01736aaa93d5534
child 12286 84ac3c71109811da751f0ef2d72108075938f094
permissions -rw-r--r--
Bug 731223 - Update help from changes from bug #694514 and bug #733258. r=InvisibleSmiley

/* ***** 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 Calendar Transaction Manager code. 
 *
 * The Initial Developer of the Original Code is
 *   Philipp Kewisch (mozilla@kewis.ch)
 * 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 nsITransactionManager;
interface calICalendar;
interface calIItemBase;
interface calIOperationListener;

/**
 * calITransactionManager is a service designed to handle nsITransactions
 * regarding the calendar.  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(40a1ccf4-5f54-4815-b842-abf06f84dbfd)]
interface calITransactionManager : nsISupports
{
    /**
     * @param aAction       The Action to execute. This can be one of:
     *                        add     Adds an item
     *                        modify  Modfifies an item
     *                        delete  Deletes an item
     *                        move    Move an item from one calendar to the
     *                                next. With this operation, aCalendar is
     *                                the calendar that the event should be
     *                                moved to.
     * @param aCalendar     The Calendar to execute the transaction on
     * @param aItem         The changed item for this transaction. This item 
     *                      should be immutable
     * @param aOldItem      The Item in its original form. Only needed for 
     *                      modify.
     * @param aListener     The listener to call when the transaction has
     *                      completed. This parameter can be null.
     */
    void createAndCommitTxn(in AUTF8String aAction,
                            in calIItemBase aItem,
                            in calICalendar aCalendar,
                            in calIItemBase aOldItem,
                            in calIOperationListener aListener);

    /**
     * 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. See also
     * nsITransactionManager::beginBatch
     */
    void beginBatch();

    /**
     * Ends the batch transaction in process. 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 calendar operations
     */
    readonly attribute nsITransactionManager transactionManager;
};