void PhotoLayoutsEditor::changeCanvasSize()
{
    if (!m_canvas)
        return;

    CanvasSizeDialog* ccd = new CanvasSizeDialog(m_canvas->canvasSize(), this);
    int result            = ccd->exec();
    CanvasSize size       = ccd->canvasSize();

    if (result == KDialog::Accepted)
    {
        if (size.isValid())
        {
            if (m_canvas->canvasSize() != size)
            {
                CanvasSizeChangeCommand * command = new CanvasSizeChangeCommand(size, m_canvas);
                PLE_PostUndoCommand(command);
            }
        }
        else
            KMessageBox::error(this, i18n("Invalid image size."));
    }

    delete ccd;
}
void PhotoLayoutsEditor::open()
{
    NewCanvasDialog * dialog = new NewCanvasDialog(this);
    dialog->setModal(true);

    int result = dialog->exec();
    if (result != KDialog::Accepted)
        return;

    QString tmp;
    if (dialog->hasTemplateSelected() && !(tmp = dialog->templateSelected()).isEmpty())
    {
        open(KUrl(dialog->templateSelected()));
    }
    else
    {
        CanvasSize size = dialog->canvasSize();
        if (size.isValid())
        {
            closeDocument();
            createCanvas(size);
            refreshActions();
        }
    }
    delete dialog;
}
CanvasSizeDialog::CanvasSizeDialog(const CanvasSize & canvasSize, QWidget * parent) :
    KDialog(parent),
    d(new CanvasSizeDialogPrivate)
{
    setupDialog(canvasSize.size(),
                CanvasSize::sizeUnitName(canvasSize.sizeUnit()),
                canvasSize.resolution(),
                CanvasSize::resolutionUnitName(canvasSize.resolutionUnit()));
}
void PhotoLayoutsEditor::open()
{
    closeDocument();

    CanvasSizeDialog * canvasSizeDialog = new CanvasSizeDialog(this);
    canvasSizeDialog->setModal(true);
    int result = canvasSizeDialog->exec();

    CanvasSize size = canvasSizeDialog->canvasSize();
    if (result == KDialog::Accepted && size.isValid())
        createCanvas(size);

    refreshActions();
}