void ClassWizardDlg::DoForceDirectory(const wxFileName & filename) { wxFileName parentname(filename); parentname.RemoveLastDir(); if ((filename != parentname) && (parentname.GetDirCount() >= 1) ) DoForceDirectory(parentname); if (!wxDirExists(filename.GetPath())) wxMkdir(filename.GetPath()); }
void OptionsTreeModel::optionAboutToBeInserted(const QString& option) { QString parentname(getParentName(option)); // FIXME? handle cases when parent doesn't exist either. QModelIndex parent(index(parentname)); QStringList children = tree_->getChildOptionNames(parentname,true,true); children << option; children.sort(); int row = children.indexOf(option); emit beginInsertRows(parent, row, row); }
void OptionsTreeModel::optionAboutToBeRemoved(const QString& option) { QString parentname(getParentName(option)); QModelIndex parent(index(parentname)); QStringList children = tree_->getChildOptionNames(parentname,true,true); children.sort(); int row = children.indexOf(option); if (row != -1) { realRemove.push(true); emit beginRemoveRows(parent, row, row); } else { realRemove.push(false); } }
/** * Get index of given @a option * @param option the option to retrieve the index for * @param sec Section the new index should point to * @return a QModelIndex to @a option */ QModelIndex OptionsTreeModel::index(const QString &option, Section sec) const { if (option == "") { return QModelIndex(); } if (flat_) { QStringList options = tree_->getChildOptionNames("",false,false); options.sort(); int row = options.indexOf(option); return createIndex(row, sec, nameToIndex(options.at(row))); } else { QString parentname(getParentName(option)); QStringList children = tree_->getChildOptionNames(parentname,true,true); children.sort(); int row = children.indexOf(option); return createIndex(row, sec, nameToIndex(option)); } }