void StudentEditDlg::OnClass( wxListEvent& event ) { long item = event.GetIndex(); wxListCtrl *pLc = m_lClass; wxDateTime classDate; classDate.ParseISODate(pLc->GetItemText(item, 0)); int classNumber = GetClassNumberByStr(pLc->GetItemText(item, 1)); wxString teacherName = pLc->GetItemText(item, 2); CalendarClassDataObj c; if (OP_SUCCESS == c.loadByPrimaryKey(classDate, classNumber, teacherName)) { ClassDlg d(this, ClassDlg::CALENDAR); d.SetClassValue(c); // Prevent crazy input! d.m_classDate->Disable(); d.m_classNumber->Disable(); d.m_teacherName->SetEditable(false); if (classDate >= wxDateTime::Today()) d.m_deleteClass->Enable(c.m_oneShot > 0); if (d.ShowModal() == wxID_OK) { if (d.m_deleteClass->GetValue()) { CalendarClassDataObj::deleteByPrimaryKey(classDate, classNumber, teacherName); showClass(); if (item>=pLc->GetItemCount()) --item; pLc->EnsureVisible(item); } else { d.GetClassValue(&c); c.updateByPrimaryKey(classDate, classNumber, teacherName); showClass(); pLc->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); pLc->SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); pLc->EnsureVisible(item); pLc->SetFocus(); } } } }
int main() { CMCIClient *cc; CMPIObjectPath * objectpath; CMPIEnumeration * enumeration; CMPIStatus status; char *cim_host, *cim_host_passwd, *cim_host_userid; /* Setup a connection to the CIMOM */ cim_host = getenv("CIM_HOST"); if (cim_host == NULL) cim_host = "localhost"; cim_host_userid = getenv("CIM_HOST_USERID"); if (cim_host_userid == NULL) cim_host_userid = "root"; cim_host_passwd = getenv("CIM_HOST_PASSWD"); if (cim_host_passwd == NULL) cim_host_passwd = "password"; cc = cmciConnect(cim_host, NULL, "5988", cim_host_userid, cim_host_passwd, NULL); /* Test enumClasses() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClasses() ...\n"); objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); enumeration = cc->ft->enumClasses(cc, objectpath, CMPI_FLAG_DeepInheritance|CMPI_FLAG_IncludeQualifiers, &status); /* Print the results */ printf( "enumClasses() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { printf("result(s):\n"); while (enumeration->ft->hasNext(enumeration, NULL)) { CMPIData data = enumeration->ft->getNext(enumeration, NULL); showClass(data.value.cls); } } if (enumeration) CMRelease(enumeration); if (objectpath) CMRelease(objectpath); if (status.msg) CMRelease(status.msg); if (cc) CMRelease(cc); return 0; }
void studentPasswords::create() { Wt::WPanel * panel = new Wt::WPanel(this); panel->setStyleClass("panel panel-primary"); panel->setTitle("<h3>Wachtwoorden Administratie</h3>"); panel->setMinimumSize(800, 800); panel->setMaximumSize(800, Wt::WLength::Auto); panel->setMargin("0 auto"); Wt::WContainerWidget * content = new Wt::WContainerWidget(); panel->setCentralWidget(content); content->setPadding("1%"); buttons = new Wt::WContainerWidget(content); Wt::WHBoxLayout * buttonLayout = new Wt::WHBoxLayout(); buttons->setLayout(buttonLayout); Wt::WPopupMenu * popup = new Wt::WPopupMenu(); Wt::WPushButton * button = new Wt::WPushButton(); button->setMenu(popup); button->setText("Selecteer een klas"); buttonLayout->addWidget(button); Wt::WPushButton * button2 = new Wt::WPushButton(); button2->setText("Selectie Aanpassen"); button2->setStyleClass("btn btn-success"); buttonLayout->addWidget(button2); button2->clicked().connect(this, &studentPasswords::changePasswords); Wt::WContainerWidget * tableContent = new Wt::WContainerWidget(content); table = new Wt::WTable(tableContent); // add classes Wt::WPopupMenu * subMenu[7]; for(int i = 0; i < 7; i++) { subMenu[i] = new Wt::WPopupMenu(); if(i == 0) { popup->addMenu("1ste jaar", subMenu[i]); } else { string s = string(i+1) + "de jaar"; popup->addMenu(s.wt(), subMenu[i]); } } CLASSES & classes = server->getClasses(); for(int i = 0; i < classes.elms(); i++) { string name = classes[i].cn().get(); if(name.empty()) continue; int year = -1; switch(name[0]) { case '1': year = 0; break; case '2': year = 1; break; case '3': year = 2; break; case '4': year = 3; break; case '5': year = 4; break; case '6': year = 5; break; case '7': year = 6; break; } if(year < 0) continue; subMenu[year]->addItem(name.wt())->triggered().connect(std::bind([=] () { showClass(name); })); } progress = new Wt::WProgressBar(content); progress->hide(); anchor = new Wt::WAnchor(Wt::WLink(&pfile), "Download passwords", content); anchor->setTarget(Wt::TargetNewWindow); anchor->clicked().connect(this, &studentPasswords::reset); anchor->hide(); }
int main(int argc, char** argv) { QCoreApplication app(argc, argv); QStringList arguments = app.arguments(); showClassNamesOnly = false; showParents = false; caseInsensitive = false; matchPattern = false; if (argc == 1) { PRINT_USAGE(); return 0; } int i = 1; while (i < arguments.length()) { if (arguments[i] == QLatin1String("-h") || arguments[i] == QLatin1String("--help")) { PRINT_USAGE(); return 0; } else if (arguments[i] == QLatin1String("-r") || arguments[i] == QLatin1String("--require")) { i++; if (i < arguments.length()) { smokeModules << loadSmokeModule(arguments[i]); } i++; } else if (arguments[i] == QLatin1String("-c") || arguments[i] == QLatin1String("--classes")) { showClassNamesOnly = true; i++; } else if (arguments[i] == QLatin1String("-p") || arguments[i] == QLatin1String("--parents")) { showParents = true; i++; } else if (arguments[i] == QLatin1String("-i") || arguments[i] == QLatin1String("--insensitive")) { caseInsensitive = true; i++; } else if (arguments[i] == QLatin1String("-m") || arguments[i] == QLatin1String("--match")) { i++; if (i < arguments.length()) { targetPattern = QRegExp(arguments[i]); matchPattern = true; } i++; } else { break; } } if (caseInsensitive) { targetPattern.setCaseSensitivity(Qt::CaseInsensitive); } smokeModules << loadSmokeModule("qtcore"); if (i >= arguments.length()) { if (targetPattern.isEmpty()) { PRINT_USAGE(); return 0; } else { foreach (Smoke * smoke, smokeModules) { for (int i = 1; i <= smoke->numClasses; i++) { if (!smoke->classes[i].external) { showClass(Smoke::ModuleIndex(smoke, i), 0); } } } return 0; } } while (i < arguments.length()) { QString className = arguments[i]; className.replace(".", "::"); Smoke::ModuleIndex classId = Smoke::findClass(className.toLatin1()); if (classId == Smoke::NullModuleIndex) { qFatal("Error: class '%s' not found", className.toLatin1().constData()); } if (showParents) { QList<ClassEntry> parents = getAllParents(classId, 0); foreach (ClassEntry parent, parents) { showClass(parent.first, parent.second); } } else {