QString KMyMoneyAccountCombo::Private::fullAccountName(const QAbstractItemModel* model, const QModelIndex& _index, bool includeMainCategory) const { QString rc; if(_index.isValid()) { QModelIndex index = _index; QString sep; do { rc = QString("%1%2%3").arg(model->data(index).toString()).arg(sep).arg(rc); sep = QLatin1String(":"); index = index.parent(); } while(index.isValid()); if(!includeMainCategory) { QRegExp mainCategory(QString("[^%1]+%2(.*)").arg(sep).arg(sep)); if(mainCategory.exactMatch(rc)) { rc = mainCategory.cap(1); } } } return rc; }
// // Save // ==== // // Save the information for this object to the AuditDataFile // bool CServicesScanner::SaveData (CAuditDataFile* pAuditDataFile) { CLogFile log; log.Write("CServicesScanner::SaveData Start" ,true); CString serviceName; // that however we do need to add our own Hardware-item section if we are going to write anything if (_listServices.GetCount() != 0) { // Write a placeholder item for the hardware class itself as this will ensure that the category can be displayed CAuditDataFileCategory mainCategory(HARDWARE_CLASS); pAuditDataFile->AddAuditDataFileItem(mainCategory); for (int isub=0; isub<(int)_listServices.GetCount(); isub++) { // Format the hardware class name for this drive CSystemService* pService = &_listServices[isub]; serviceName.Format("%s|%s" ,HARDWARE_CLASS ,pService->Name()); // Each process has its own category CAuditDataFileCategory category(serviceName ,TRUE ,TRUE); // Each audited item gets added an a CAuditDataFileItem to the category CAuditDataFileItem p1(V_SERVICE_NAME ,pService->Name()); CAuditDataFileItem p2(V_SERVICE_STATE ,pService->State()); CAuditDataFileItem p3(V_SERVICE_STARTUP ,pService->StartMode()); // Add the items to the category category.AddItem(p1); category.AddItem(p2); category.AddItem(p3); // ...and add the category to the AuditDataFile pAuditDataFile->AddAuditDataFileItem(category); } } log.Write("CServicesScanner::SaveData End" ,true); return true; }