/// class PD.Manage.Modules.MailQueueDeleteAllCommand

PD.Manage.Modules.MailQueueDeleteAllCommand =
PD.Commands.Command.extend({

    //===================================
    // PUBLIC METHODS
    //===================================

    setDefaults: function () {
        this.props("id", "mail-queue-item/delete-all");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("delete.png"));
        this.props("label", "Delete All");
        this.props("tooltip", "Delete all messages in the queue.");
    },

    execute: function (e) {
        this._super(e);

        var service = new PD.Manage.Services.MailQueueService();

        PD.Web.UI.MessageDialog.warn({
            title: "Delete Queued Messages",
            message: "Delete all the queued messages in the queue?",
            ok: function (e) {

                e.close();

                service.deleteAll(function () {
                    PD.context.get_default().get_events().publish("mail-queue-item/delete-all");
                });

            }
        });

    }

});