Public Member Functions

TemplateSaveDialog Class Reference

Dialog for saving a tempalte. More...

#include <templatesmodel.h>

Inheritance diagram for TemplateSaveDialog:
Inheritance graph
[legend]
Collaboration diagram for TemplateSaveDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TemplateSaveDialog (TemplatesModel *spModel, const QString &defaultName, QWidget *parent=0)
QString templateName () const
bool templateExists ()

Detailed Description

Dialog for saving a tempalte.


Constructor & Destructor Documentation

TemplateSaveDialog::TemplateSaveDialog ( TemplatesModel spModel,
const QString defaultName,
QWidget parent = 0 
)

                                                                                                                     : QDialog(parent)
{
    setObjectName("SaveSPDialog");
    this->spModel = spModel;
    greenText = QString("Info: Template will be saved as \"%1\"");
    redText = QString("Info: There is allready a template named \"%1\"");

    inputEditor = new QLineEdit;
    inputEditor->setText(defaultName);
    inputDesc = new QLabel("Save as:");
    inputDesc->setBuddy(inputEditor);
    info = new QLabel;
    info->setWordWrap(true);
    buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Save);

    QHBoxLayout *editLayout = new QHBoxLayout;
    editLayout->addWidget(inputDesc);
    editLayout->addWidget(inputEditor);

    QGridLayout *layout = new QGridLayout;
    layout->addLayout(editLayout, 0, 0, 1, 2);
    layout->addWidget(info, 1, 0, 1, 1);
    layout->addWidget(buttonBox, 1, 1, 1 ,1);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    setLayout(layout);

    connect(inputEditor, SIGNAL(textChanged(QString)), this, SLOT(slot_inputTextChanged(QString)));
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    slot_inputTextChanged(inputEditor->text()); //to update the dialog if defaultName was set
}


Member Function Documentation

bool TemplateSaveDialog::templateExists (  ) 

{
    QModelIndex start = spModel->index(0, 0);
    return !spModel->match(start, TemplatesModel::TemplateName, QVariant(saveName), 1, Qt::MatchFlags(Qt::MatchExactly)).isEmpty();
}

QString TemplateSaveDialog::templateName (  )  const

{return saveName;}


The documentation for this class was generated from the following files: