示例#1
0
/*
Main menu interface
*/
void run(FILE *file) {
    int choice = 0;
    
    while (1) {
        displayMenu();
        choice = getChoice();
        if (choice == -2) {
            exit(0);
        } else if (choice == -1) {
            append(file);
        } else if (choice == 0) {
            displayAll(file);
        } else if (choice > 0) {
            modifyRecord(choice, file);
        } else {
            printf("\n%s\n", "Invalid choice, try again!");
        }
    } 
}
示例#2
0
void ProductWidget::createActions()
{
    m_addAct    = new QAction(QIcon(":/add"), tr("Add"), this);
    m_deleteAct = new QAction(QIcon(":/delete"), tr("Delete"), this);
    m_modifyAct = new QAction(QIcon(":/edit"), tr("Modify"), this);
    m_saveAct   = new QAction(QIcon(":/ok"), tr("Save"), this);
    m_cancelAct = new QAction(QIcon(":/cancel"), tr("Cancel"), this);

    m_deleteAct->setDisabled(true);
    m_modifyAct->setDisabled(true);
    m_saveAct->setDisabled(true);
    m_cancelAct->setDisabled(true);

    connect(m_addAct, SIGNAL(triggered()), this, SLOT(addRecord()));
    connect(m_deleteAct, SIGNAL(triggered()), this, SLOT(deleteRecord()));
    connect(m_modifyAct, SIGNAL(triggered()), this, SLOT(modifyRecord()));
    connect(m_saveAct, SIGNAL(triggered()), this, SLOT(saveRecord()));
    connect(m_cancelAct, SIGNAL(triggered()), this, SLOT(cancelModifiedRecord()));
}