/*! \reimp */ bool QFSContentEngine::execute( const QStringList &arguments ) const { #ifndef QTOPIA_CONTENT_INSTALLER if( role() == QContent::Application ) { qLog(DocAPI) << "QFSContentEngine::execute" << Qtopia::dehyphenate(name()) << fileName() << arguments; Qtopia::execute( fileName(), arguments.count() ? arguments[0] : QString() ); return true; } else { QContent app = mimeType().application(); if ( app.isValid() ) { app.execute( QStringList() << arguments << fileName() ); return true; } } #else Q_UNUSED(arguments) #endif return false; }
/// get the given color QColor ColorCache::get(Color const & color, bool syscolors) const { if (!initialized_) const_cast<ColorCache *>(this)->init(); if (color <= Color_ignore && color.mergeColor == Color_ignore) { QPalette::ColorRole const cr = role(color.baseColor); if (syscolors && cr != NoRole) { static QColor const white = Qt::white; QColor const c = pal_.brush(QPalette::Active, cr).color(); if (cr == QPalette::Base && c == white) return lcolors_[color.baseColor]; else return c; } else return lcolors_[color.baseColor]; } if (color.mergeColor != Color_ignore) { // FIXME: This would ideally be done in the Color class, but // that means that we'd have to use the Qt code in the core. QColor base_color = get(color.baseColor, syscolors).toRgb(); QColor merge_color = get(color.mergeColor, syscolors).toRgb(); return QColor( (base_color.red() + merge_color.red()) / 2, (base_color.green() + merge_color.green()) / 2, (base_color.blue() + merge_color.blue()) / 2); } // used by branches return QColor(lcolor.getX11Name(color.baseColor).c_str()); }
virtual void construct(std::shared_ptr<library::XML> xml) override { //-------- // CONSTRUCT ROLES //-------- // CLEAR ORDINARY ROLES process_map_.clear(); // CREATE ROLES if (xml->has("processes") == true && xml->get("processes")->front()->has("process") == true) { std::shared_ptr<library::XMLList> &role_xml_list = xml->get("processes")->front()->get("process"); for (size_t i = 0; i < role_xml_list->size(); i++) { std::shared_ptr<library::XML> &role_xml = role_xml_list->at(i); // CONSTRUCT ROLE FROM XML std::shared_ptr<DistributedProcess> role(createProcess(role_xml)); role->construct(role_xml); // AND INSERT TO ROLE_MAP insertProcess(role); } } //-------- // CONSTRUCT SYSTEMS //-------- super::construct(xml); };
void wamp_hello_details::unmarshal(const msgpack::object& object) { std::unordered_map<std::string, msgpack::object> details; object.convert(&details); auto details_itr = details.find("roles"); if (details_itr == details.end()) { return; } std::unordered_map<std::string, msgpack::object> roles; details_itr->second.convert(roles); for (const auto& roles_itr : roles) { std::unordered_map<std::string, msgpack::object> properties; roles_itr.second.convert(properties); wamp_role_features features; auto properties_itr = properties.find("features"); if (properties_itr != properties.end()) { std::unordered_map<std::string, bool> attributes; properties_itr->second.convert(attributes); features.set_attributes(std::move(attributes)); } wamp_role_type role_type = role_type_from_string(roles_itr.first); wamp_role role(role_type); role.set_features(std::move(features)); add_role(std::move(role)); } }
/** * Extract all segments from all ways that make up this * multipolygon relation and add them to the list. */ void extract_segments_from_ways(const osmium::Relation& relation, const std::vector<size_t>& members, const osmium::memory::Buffer& in_buffer) { auto member_it = relation.members().begin(); for (size_t offset : members) { const osmium::Way& way = in_buffer.get<const osmium::Way>(offset); extract_segments_from_way(way, member_it->role()); ++member_it; } }
int QAccessibleInterfaceEx_QtDShell::__override_role(int child0, bool static_call) const { if (static_call) { return QAccessible::Role(0); } else { return role((int )child0); } }
int QAccessibleWidgetEx_QtDShell::__override_role(int child0, bool static_call) const { if (static_call) { return QAccessibleWidgetEx::role((int )child0); } else { return role((int )child0); } }
void UniAssociationDialog::accept() { Member::Visibility visibility = ui->visiPublicRadio->isChecked() ? Member::Public : (ui->visiProtectedRadio->isChecked() ? Member::Protected : Member::Private); Association::Role role(ui->roleNameEdit->text(), ui->roleMultiplicity->text(), visibility); asc->setRole(role); QDialog::accept(); }
bool ColorCache::isSystem(ColorCode const color) const { QPalette::ColorRole const cr = role(color); if (cr == QPalette::Base) { static QColor const white = Qt::white; return pal_.brush(QPalette::Active, cr).color() != white; } else return cr != NoRole; }
int QAccessibleTableCell::rowIndex() const { if (role() == QAccessible::TreeItem) { const QTreeView *treeView = qobject_cast<const QTreeView*>(view); Q_ASSERT(treeView); int row = treeView->d_func()->viewIndex(m_index); return row; } return m_index.row(); }
QVariant Accidental::getProperty(P_ID propertyId) const { switch (propertyId) { case P_ID::SMALL: return _small; case P_ID::ACCIDENTAL_BRACKET: return _hasBracket; case P_ID::ROLE: return int(role()); default: return Element::getProperty(propertyId); } }
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const { Q_ASSERT(role() != QAccessible::Tree); QModelIndex index = view->model()->index(row, column); if (!index.isValid()) { qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view; return 0; } return cell(index); }
void Windowdef_simple::cfg_write( KConfigGroup& cfg_P ) const { base::cfg_write( cfg_P ); cfg_P.writeEntry( "Title", title()); cfg_P.writeEntry( "TitleType", int(_title_match_type) ); cfg_P.writeEntry( "Class", wclass()); cfg_P.writeEntry( "ClassType", int(_wclass_match_type) ); cfg_P.writeEntry( "Role", role()); cfg_P.writeEntry( "RoleType", int(_role_match_type) ); cfg_P.writeEntry( "WindowTypes", window_types()); cfg_P.writeEntry( "Type", "SIMPLE" ); // overwrites value set in base::cfg_write() }
QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const { if (!view()->model()) return 0; Q_ASSERT(role() != QAccessible::Tree); QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); if (!index.isValid()) { qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view(); return 0; } return child(logicalIndex(index)); }
bool Windowdef_simple::match( const Window_data& window_P ) { if( !type_match( window_P.type )) return false; if( !is_substr_match( window_P.title, title(), _title_match_type )) return false; if( !is_substr_match( window_P.wclass, wclass(), _wclass_match_type )) return false; if( !is_substr_match( window_P.role, role(), _role_match_type )) return false; kDebug() << "window match:" << window_P.title << ":OK"; return true; }
/*! Returns the name of the name of the application that will be launched if the QContent is executed. If the QContent is an application this is the name of the binary, if it is a document it is the executable name of the application associated with the document MIME type. If the content is not an application and there is no associated application associated with its MIME type then a null string will be returned. \sa execute() */ QString QContent::executableName() const { if( role() == Application ) { return d->fileName(); } else { QContent app = d->mimeType().application(); if ( app.id() != InvalidId ) return app.executableName(); else return QString(); } }
QAccessible::State QQmlAccessible::state() const { QAccessible::State state; //QRect viewRect(QPoint(0, 0), m_implementation->size()); //QRect itemRect(m_item->scenePos().toPoint(), m_item->boundingRect().size().toSize()); QRect viewRect_ = viewRect(); QRect itemRect = rect(); // qDebug() << "viewRect" << viewRect << "itemRect" << itemRect; // error case: if (viewRect_.isNull() || itemRect.isNull()) { state.invisible = true; } if (!viewRect_.intersects(itemRect)) { state.offscreen = true; // state.invisible = true; // no set at this point to ease development } if (!object()->property("visible").toBool() || qFuzzyIsNull(object()->property("opacity").toDouble())) { state.invisible = true; } if ((role() == QAccessible::CheckBox || role() == QAccessible::RadioButton) && object()->property("checked").toBool()) { state.checked = true; } if (role() == QAccessible::EditableText) state.focusable = true; //qDebug() << "state?" << m_item->property("state").toString() << m_item->property("status").toString() << m_item->property("visible").toString(); return state; }
void AddAuto::setAuto() { int id = project->getId(); // Being checked causes a wild card. Empty string is wildcard //BUG you can't match an empty string! QString host(checkBox_host->isChecked() ? "" : Host->text()); QString class_name(checkBox_class->isChecked() ? "" : Class->text()); QString name(checkBox_name->isChecked() ? "" : Name->text()); QString role(checkBox_role->isChecked() ? "" : Role->text()); QString title(checkBox_title->isChecked() ? "" : Title->text()); QString desktop(checkBox_desktop->isChecked() ? "" : Desktop->currentText()); ttcp->addauto( id, host, class_name, name, role, title, desktop ); }
QList<QQuickItem *> QAccessibleQuickItem::childItems() const { if ( role() == QAccessible::Button || role() == QAccessible::CheckBox || role() == QAccessible::RadioButton || role() == QAccessible::SpinBox || role() == QAccessible::EditableText || role() == QAccessible::Slider || role() == QAccessible::PageTab || role() == QAccessible::ProgressBar) return QList<QQuickItem *>(); QList<QQuickItem *> items; Q_FOREACH (QQuickItem *child, item()->childItems()) { QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(child); if (itemPrivate->isAccessible) items.append(child); }
int main() { static bool quit = false; Role role("saozi"); //Timer fps; //Background bg; init_sdl_lib(); load_files(); role.set_screen(person, screen); role.set_clips(); role.set_event(&event); SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF)); SDL_Flip(screen); while (quit != true) { role.start(); while (SDL_PollEvent(&event)) { //if (SDL_PollEvent(role.role_get_event())) { role.handle_event(); if (event.type == SDL_QUIT) { quit = true; } } role.move(); SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF)); role.show(); SDL_Flip(screen); //bg.show(); if (role.get_ticks() < 1000 / 20) { SDL_Delay((1000/20) - role.get_ticks()); } } clean_up(); return 0; }
void role_perms_edit_dialog::set_checkboxes() { db_ctxt dbc(true); try { if (m_role_oid > 0) { db_role role(m_role_oid); QList<db_obj_privilege> privs_for_read = db_obj_privilege::ability_privileges("read", &dbc); m_initial_privs[priv_read] = role.has_multiple_privileges(privs_for_read, &dbc); QList<db_obj_privilege> privs_for_update = db_obj_privilege::ability_privileges("update", &dbc); m_initial_privs[priv_update] = role.has_multiple_privileges(privs_for_update, &dbc); QList<db_obj_privilege> privs_for_trash = db_obj_privilege::ability_privileges("trash", &dbc); m_initial_privs[priv_trash] = role.has_multiple_privileges(privs_for_trash, &dbc); QList<db_obj_privilege> privs_for_delete = db_obj_privilege::ability_privileges("delete", &dbc); m_initial_privs[priv_delete] = role.has_multiple_privileges(privs_for_delete, &dbc); QList<db_obj_privilege> privs_for_compose = db_obj_privilege::ability_privileges("compose", &dbc); m_initial_privs[priv_compose] = role.has_multiple_privileges(privs_for_compose, &dbc); QList<db_obj_privilege> privs_for_basic_management = db_obj_privilege::ability_privileges("admin-level1", &dbc); m_initial_privs[priv_basic_management] = role.has_multiple_privileges(privs_for_basic_management, &dbc); } else { memset((void*)m_initial_privs, 0, sizeof(m_initial_privs)); } m_perm_read->setChecked(m_initial_privs[priv_read]); m_perm_update->setChecked(m_initial_privs[priv_update]); m_perm_trash->setChecked(m_initial_privs[priv_trash]); m_perm_delete->setChecked(m_initial_privs[priv_delete]); m_perm_compose->setChecked(m_initial_privs[priv_compose]); m_perm_basic_management->setChecked(m_initial_privs[priv_basic_management]); } catch(db_excpt& p) { DBEXCPT (p); } }
void MusicDownloadTableWidget::createItem(const MusicObject::MusicSongAttribute &attr, const QString &type, const QString &icon) { int index = rowCount(); setRowCount(index + 1); setRowHeight(index, ROW_HEIGHT); QTableWidgetItem *it = new QTableWidgetItem; MusicDownloadTableItemRole role(attr.m_bitrate, attr.m_format, attr.m_size); it->setData(TABLE_ITEM_ROLE, QVariant::fromValue<MusicDownloadTableItemRole>(role)); setItem(index, 0, it); MusicDownloadTableItem *item = new MusicDownloadTableItem(this); item->setIcon(icon); item->setInformation(QString("%1/%2KBPS/%3").arg(attr.m_size).arg(attr.m_bitrate).arg(attr.m_format.toUpper())); item->setText(type); m_items << item; setCellWidget(index, 0, item); }
QVariant IncidencePointGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value) { if(change == QGraphicsItem::ItemPositionHasChanged) { if(isUnderMouse()) { if(mParent->isAcceptable(objectAtPoint(), role())) mColor = Qt::green; else mColor = Qt::red; } else if(isSelected()) mColor = QColor(255, 128, 64); else mColor = QColor(170, 170, 170); } return PointGraphicsItem::itemChange(change, value); }
/** process an xml element * @param cur current xmlNodePtr * @return true, if successful. * * Creating MCWalkerConfiguration for all the ParticleSet * objects. */ bool ParticleSetPool::put(xmlNodePtr cur) { ReportEngine PRE("ParticleSetPool","put"); //const ParticleSet::ParticleLayout_t* sc=DistanceTable::getSimulationCell(); //ParticleSet::ParticleLayout_t* sc=0; string id("e"), role("none"); OhmmsAttributeSet pAttrib; pAttrib.add(id,"id"); pAttrib.add(id,"name"); pAttrib.add(role,"role"); pAttrib.put(cur); //backward compatibility if(id == "e" && role=="none") role="MC"; ParticleSet* pTemp = getParticleSet(id); if(pTemp == 0) { app_log() << " Creating " << id << " particleset" << endl; pTemp = new MCWalkerConfiguration; //if(role == "MC") // pTemp = new MCWalkerConfiguration; //else // pTemp = new ParticleSet; if(SimulationCell) { app_log() << " Initializing the lattice of " << id << " by the global supercell" << endl; pTemp->Lattice.copy(*SimulationCell); } myPool[id] = pTemp; XMLParticleParser pread(*pTemp,TileMatrix); bool success = pread.put(cur); pTemp->setName(id); app_log() << pTemp->getName() <<endl; return success; } else { app_warning() << "particleset " << id << " is already created. Ignore this" << endl; } return true; }
nsRoleMapEntry* nsAccUtils::GetRoleMapEntry(nsIDOMNode *aNode) { nsIContent *content = nsCoreUtils::GetRoleContent(aNode); nsAutoString roleString; if (!content || !content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::role, roleString) || roleString.IsEmpty()) { // We treat role="" as if the role attribute is absent (per aria spec:8.1.1) return nsnull; } nsWhitespaceTokenizer tokenizer(roleString); while (tokenizer.hasMoreTokens()) { // Do a binary search through table for the next role in role list NS_LossyConvertUTF16toASCII role(tokenizer.nextToken()); PRUint32 low = 0; PRUint32 high = nsARIAMap::gWAIRoleMapLength; while (low < high) { PRUint32 index = (low + high) / 2; PRInt32 compare = PL_strcmp(role.get(), nsARIAMap::gWAIRoleMap[index].roleString); if (compare == 0) { // The role attribute maps to an entry in the role table return &nsARIAMap::gWAIRoleMap[index]; } if (compare < 0) { high = index; } else { low = index + 1; } } } // Always use some entry if there is a non-empty role string // To ensure an accessible object is created return &nsARIAMap::gLandmarkRoleMap; }
bool HamiltonianPool::put(xmlNodePtr cur) { ReportEngine PRE("HamiltonianPool","put"); string id("h0"), target("e"),role("extra"); OhmmsAttributeSet hAttrib; hAttrib.add(id,"id"); hAttrib.add(id,"name"); hAttrib.add(role,"role"); hAttrib.add(target,"target"); hAttrib.put(cur); ParticleSet* qp=ptclPool->getParticleSet(target); if(qp == 0) {//never a good thing PRE.error("No target particle "+ target+ " exists."); return false; } bool set2Primary=false; //first Hamiltonian is set to the primary Hamiltonian if(myPool.empty() || role == "primary" ) set2Primary=true; HamiltonianFactory *curH=0; PoolType::iterator hit(myPool.find(id)); if(hit == myPool.end()) { curH= new HamiltonianFactory(qp, ptclPool->getPool(), psiPool->getPool(),myComm); curH->setName(id); myPool[id]=curH; } else curH=(*hit).second; bool success= curH->put(cur); if(set2Primary) primaryH=curH->targetH; return success; }
QStringList QAccessibleButton::actionNames() const { QStringList names; if (widget()->isEnabled()) { switch (role()) { case QAccessible::ButtonMenu: names << showMenuAction(); break; case QAccessible::RadioButton: names << toggleAction(); break; default: if (button()->isCheckable()) { names << toggleAction(); } else { names << pressAction(); } break; } } names << QAccessibleWidget::actionNames(); return names; }
QStringList QQmlAccessible::actionNames() const { QStringList actions; switch (role()) { case QAccessible::PushButton: actions << QAccessibleActionInterface::pressAction(); break; case QAccessible::RadioButton: case QAccessible::CheckBox: actions << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::pressAction(); break; case QAccessible::Slider: case QAccessible::SpinBox: case QAccessible::ScrollBar: actions << QAccessibleActionInterface::increaseAction() << QAccessibleActionInterface::decreaseAction(); break; default: break; } return actions; }
static JSValueRef getRoleCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { JSRetainPtr<JSStringRef> role(Adopt, toAXElement(thisObject)->role()); return JSValueMakeString(context, role.get()); }
bool checkCreateDatabaseGrant(const MetaName& userName, const MetaName& trustedRole, const MetaName& sqlRole, const char* securityDb) { if (userName == SYSDBA_USER_NAME) return true; RefPtr<IAttachment> att; RefPtr<ITransaction> tra; if (!openDb(securityDb, att, tra)) return false; FbLocalStatus st; MetaName role(sqlRole); if (role.hasData()) { const UCHAR info[] = { isc_info_db_sql_dialect, isc_info_end }; UCHAR buffer[BUFFER_TINY]; att->getInfo(&st, sizeof(info), info, sizeof(buffer), buffer); check("IAttachment::getInfo", &st); int dialect = SQL_DIALECT_V5; // reasonable default const UCHAR* p = buffer; while (*p != isc_info_end && *p != isc_info_truncated && p < buffer + sizeof(buffer)) { const UCHAR item = (UCHAR) *p++; const USHORT length = gds__vax_integer(p, sizeof(USHORT)); p += sizeof(USHORT); switch (item) { case isc_info_db_sql_dialect: dialect = gds__vax_integer(p, length); break; } p += length; } JRD_make_role_name(role, dialect); // We need to check is admin role granted to userName in security DB const char* sql = "select count(*) from RDB$USER_PRIVILEGES " "where RDB$USER = ? and RDB$RELATION_NAME = ? and RDB$PRIVILEGE = 'M'"; Message prm; Field<Varying> u(prm, MAX_SQL_IDENTIFIER_LEN); Field<Varying> r(prm, MAX_SQL_IDENTIFIER_LEN); u = userName.c_str(); r = role.c_str(); Message result; Field<ISC_INT64> cnt(result); att->execute(&st, tra, 0, sql, SQL_DIALECT_V6, prm.getMetadata(), prm.getBuffer(), result.getMetadata(), result.getBuffer()); if (st->getState() & IStatus::STATE_ERRORS) { // isc_dsql_relation_err when exec SQL - i.e. table RDB$USER_PRIVILEGES // is missing due to non-FB security DB if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err)) check("IAttachment::execute", &st); role = ""; } else if (cnt == 0) role = ""; } else role = trustedRole; if (role == ADMIN_ROLE) return true; Message gr; Field<ISC_SHORT> uType(gr); Field<Varying> u(gr, MAX_SQL_IDENTIFIER_LEN); Field<ISC_SHORT> rType(gr); Field<Varying> r(gr, MAX_SQL_IDENTIFIER_LEN); uType = obj_user; u = userName.c_str(); rType = role.hasData() ? obj_sql_role : 255; r = role.c_str(); Message result; Field<ISC_INT64> cnt(result); att->execute(&st, tra, 0, "select count(*) from RDB$DB_CREATORS" " where (RDB$USER_TYPE = ? and RDB$USER = ?) or (RDB$USER_TYPE = ? and RDB$USER = ?)", SQL_DIALECT_V6, gr.getMetadata(), gr.getBuffer(), result.getMetadata(), result.getBuffer()); if (st->getState() & IStatus::STATE_ERRORS) { if (fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err)) { // isc_dsql_relation_err when exec SQL - i.e. table RDB$DB_CREATORS // is missing due to non-FB3 security DB return false; } check("IAttachment::execute", &st); } return cnt > 0; }