示例#1
0
void NamedAreaDialog::slotEdit()
{
    QListWidgetItem* item = m_list->currentItem();
    if (item->text().isEmpty())
        return;

    QPointer<EditNamedAreaDialog> dialog = new EditNamedAreaDialog(this, m_selection);
    dialog->setCaption(i18n("Edit Named Area"));
    dialog->setAreaName(item->text());
    dialog->exec();
    if (dialog->result() == Rejected)
        return;

    item->setText(dialog->areaName());
    displayAreaValues(dialog->areaName());
    delete dialog;
}
示例#2
0
void NamedAreaDialog::slotNew()
{
    QPointer<EditNamedAreaDialog> dialog = new EditNamedAreaDialog(this, m_selection);
    dialog->setCaption(i18n("New Named Area"));
    dialog->setRegion(*m_selection);
    dialog->exec();
    if (dialog->result() == Rejected)
        return;
    if (dialog->areaName().isEmpty())
        return;

    m_list->addItem(dialog->areaName());
    QList<QListWidgetItem*> items = m_list->findItems(dialog->areaName(),
                                    Qt::MatchExactly | Qt::MatchCaseSensitive);
    m_list->setCurrentItem(items.first());
    displayAreaValues(dialog->areaName());
    delete dialog;

    enableButtonOk(true);
    enableButton(KDialog::User1, true);
    enableButton(KDialog::User2, true);
}