TBool CDummyCalendarApp::CheckEntryNumL(TEntryType aType, TInt aNumEntry) { CCalIter& iter = GetIterL(); TPtrC8 Uid(iter.FirstL()); TInt ii=0; while (Uid!=KNullDesC8()) { ++ii; RPointerArray<CCalEntry> entryList; CleanupResetAndDestroyPushL(entryList); iLocalEntryView->FetchL(Uid, entryList); CCalEntry* entry = entryList[0]; if(aType==EApp) { test(entry->EntryTypeL()==CCalEntry::EAppt); } else if (aType==ETodo) { test(entry->EntryTypeL()==CCalEntry::ETodo); } else if(aType == EReminder) { test(entry->EntryTypeL()==CCalEntry::EReminder); } CleanupStack::PopAndDestroy(&entryList); Uid.Set(iter.NextL()); } return (ii==aNumEntry); }
// --------------------------------------------------------- // CMMKeyBearer::ConstructL() // 2nd-phase construction. // --------------------------------------------------------- // void CMMKeyBearer::ConstructL() { FUNC_LOG; // throw an indication up to RemCon. TRemConAddress addr; addr.BearerUid() = Uid(); TInt err = Observer().ConnectIndicate(addr); iKeyguardAccess = CKeyguardAccessApi::NewL(); // Start Active object for listening key events from P&S TRAP_AND_LEAVE( iMMKeyBearerObserver = CMMKeyBearerObserver::NewL(*this, ESideVolumeKeys), "Volume key observer init failed" ); TRAP_AND_LEAVE( iMediaKeyObserver = CMMKeyBearerObserver::NewL(*this, EMediaKeys), "Media key observer init failed" ); TRAP_AND_LEAVE( iAccessoryVolKeyObserver = CMMKeyBearerObserver::NewL(*this, EAccessoryVolumeKeys), "Accessory key observer init failed" ); TRAP_AND_LEAVE( iUSBFileTransferObserver = CMMKeyBearerObserver::NewL(*this, EFileTransferStatus), "USB observer init failed" ); }
/* ----> Create an alarm <---- */ dbref create_alarm(CONTEXT) { dbref alarm,owner = (!in_command && (Uid(player) != player)) ? Uid(player):Owner(player); setreturn(ERROR,COMMAND_FAIL); if(Level3(Owner(player))) { if(!Blank(arg1)) { if(strlen(arg1) <= 128) { if(ok_name(arg1)) { if(adjustquota(player,owner,ALARM_QUOTA)) { /* ----> Create and initialise alarm <---- */ alarm = new_object(); db[alarm].destination = NOTHING; db[alarm].location = player; db[alarm].flags = OBJECT; db[alarm].owner = owner; db[alarm].type = TYPE_ALARM; if(!in_command && (Uid(player) == owner) && friendflags_set(owner,player,NOTHING,FRIEND_SHARABLE)) db[alarm].flags |= SHARABLE; ansi_code_filter((char *) arg1,arg1,1); initialise_data(alarm); setfield(alarm,NAME,arg1,1); setfield(alarm,DESC,arg2,0); stats_tcz_update_record(0,0,0,1,0,0,0); PUSH(alarm,db[player].fuses); if(!in_command) output(getdsc(player),player,0,1,0,ANSI_LGREEN"Alarm "ANSI_LWHITE"%s"ANSI_LGREEN" created with ID "ANSI_LYELLOW"#%d"ANSI_LGREEN".",getfield(alarm,NAME),alarm); else writelog(HACK_LOG,1,"HACK","Alarm %s(%d) created within compound command %s(%d) owned by %s(%d).",getname(alarm),alarm,getname(current_command),current_command,getname(Owner(current_command)),Owner(current_command)); setreturn(getnameid(player,alarm,NULL),COMMAND_SUCC); return(alarm); } else warnquota(player,owner,"to build an alarm"); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, an alarm can't have that name."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, the maximum length of an alarm's name is 128 characters."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Please specify a name for the new alarm."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, only Wizards/Druids and above can create an alarm."); return(NOTHING); }
void DiagramView::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasFormat(QLatin1String(MIME_TYPE_MODEL_ELEMENTS))) { bool accept = false; QDataStream dataStream(event->mimeData()->data(QLatin1String(MIME_TYPE_MODEL_ELEMENTS))); while (dataStream.status() == QDataStream::Ok) { QString key; dataStream >> key; if (!key.isEmpty()) { if (m_diagramSceneModel->diagramSceneController()->isAddingAllowed(Uid(key), m_diagramSceneModel->diagram())) accept = true; } } event->setAccepted(accept); } else if (event->mimeData()->hasFormat(QLatin1String(MIME_TYPE_NEW_MODEL_ELEMENTS))) {
// --------------------------------------------------------- // CMMKeyBearer::GetCommand() // // --------------------------------------------------------- // TInt CMMKeyBearer::GetCommand(TUid& aInterfaceUid , TUint& aTransactionId, TUint& aOperationId, RBuf8& aData, TRemConAddress& aAddr) { FUNC_LOG; aInterfaceUid = iInterfaceUid; aOperationId = iOperationId; // Pass ownership of this to RemCon. TRAPD_ERR( err, aData.CreateL(iData) ); ERROR( err, "Remcon ownership change failed" ); aAddr.BearerUid() = Uid(); aAddr.Addr() = KNullDesC8(); aTransactionId = iTransactionId; return KErrNone; }
// --------------------------------------------------------- // RFavouritesSrvTable::ReadItemDataL // --------------------------------------------------------- // void RFavouritesSrvTable::ReadItemDataL( CFavouritesItemImpl& aItem ) const { // Fill standard attributes. aItem.SetUid( Uid() ); // No bookmark can exist with the Null Uid. __ASSERT_DEBUG( aItem.Uid() != KFavouritesNullUid, FavouritesPanic( EFavouritesNullUidInDatabase ) ); aItem.SetParentFolder( ParentFolder() ); aItem.SetType( Type() ); aItem.SetNameL( Name() ); HBufC* url = UrlLC(); aItem.SetUrlL( *url ); CleanupStack::PopAndDestroy(); // url aItem.SetUserNameL( Username() ); aItem.SetPasswordL( Password() ); aItem.SetWapAp( WapAp() ); aItem.SetFactoryItem( FactoryItem() ); aItem.SetReadOnly( ReadOnly() ); aItem.SetContextId( ContextId() ); aItem.SetModified( Modified() ); aItem.SetHidden( Hidden() ); }
/*virtual*/ Dictionary Variable::Serialize() const { if (IsOutput()) { LogicError("Output variables cannot be saved"); } Dictionary dict; dict[versionKey] = CurrentVersion(); dict[typeKey] = s_variableTypeValue; dict[uidKey] = Uid(); dict[kindKey] = static_cast<size_t>(Kind()); dict[dataTypeKey] = static_cast<size_t>(GetDataType()); const auto& dynamicAxes = DynamicAxes(); vector<DictionaryValue> dictionaryValueVector; dictionaryValueVector.reserve(dynamicAxes.size()); for (const auto& axis : dynamicAxes) dictionaryValueVector.push_back(axis); dict[dynamicAxisKey] = dictionaryValueVector; dict[isSparseKey] = IsSparse(); if (!Name().empty()) dict[nameKey] = Name(); dict[needsGradientKey] = NeedsGradient(); dict[shapeKey] = Shape(); if (IsParameter() || IsConstant()) { NDArrayView* value = Value().get(); if (value == nullptr) { LogicError("Uninitialized Parameter variable cannot be saved"); } // TODO: add a dictionary value constructor with an rvalue parameter. dict[valueKey] = DictionaryValue(*value); } return dict; }
// --------------------------------------------------------- // CMMKeyBearer::ReceivedKeyEvent() // // --------------------------------------------------------- // void CMMKeyBearer::ReceivedKeyEvent(TInt aEnumValue, TInt aKeyType) { FUNC_LOG; INFO_3( "Received key: enumValue = %d, keyType = %d, usbFileTransfer = %d", aEnumValue, aKeyType, iUSBFileTransfer ); // Mediakeys must be disabled when MTP (Music Transfer) is happening. if (aKeyType == EFileTransferStatus) { iUSBFileTransferObserver->Start(); // Ensure first that no status change gets missed iUSBFileTransfer = iUSBFileTransferObserver->GetValue(); // Read the MTP status return; } if ((aKeyType == EMediaKeys) && (iUSBFileTransfer == KUsbPersonalityIdMTP || iUSBFileTransfer == KUsbPersonalityIdPCSuiteMTP)) { iMediaKeyObserver->Start(); return; } // Check for keypadlock if the events are from device keypad // If events are from accessory device,then do not check for keypadlock if (aKeyType != EAccessoryVolumeKeys && aKeyType != ESideVolumeKeys ) { TInt err=iKeyguardAccess->ShowKeysLockedNote(); if (err==KErrNone) { // Device is locked , Discard the key event //Start the listener once again if (aKeyType == EMediaKeys) { iMediaKeyObserver->Start(); } return; } } /* To keep the background light on */ User::ResetInactivityTime(); // 1. Interface ID is required when Getcommand is called iInterfaceUid = TUid::Uid(KRemConCoreApiUid); // from Remconcoreapi.h // 2. Transaction ID iTransactionId = Observer().NewTransactionId(); // 3. Addr TRemConAddress addr; addr.BearerUid() = Uid(); addr.Addr() = KNullDesC8(); // 4 & 5. Operation ID and Data if ((aKeyType == ESideVolumeKeys) || (aKeyType == EAccessoryVolumeKeys)) { SetSVKOperationIdAndData(aEnumValue); } else { SetMediaKeyOperationIdAndData(aEnumValue); } // Msgtype is ERemConCommand TInt aError = Observer().NewCommand(addr); //Start the listener once again if (aKeyType == ESideVolumeKeys) { iMMKeyBearerObserver->Start(); } else if (aKeyType == EMediaKeys) { iMediaKeyObserver->Start(); } else if (aKeyType == EAccessoryVolumeKeys) { iAccessoryVolKeyObserver->Start(); } }
void UndoDeleteEntity::loadData(const QJsonObject & json) { m_uid = Uid(json["uid"].toString(), document()); m_entityType = toEntityType(json["type"].toString()); m_data = json["data"].toObject(); }
if(!in_command) output(getdsc(player),player,0,1,0,ANSI_LGREEN"Alarm "ANSI_LWHITE"%s"ANSI_LGREEN" created with ID "ANSI_LYELLOW"#%d"ANSI_LGREEN".",getfield(alarm,NAME),alarm); else writelog(HACK_LOG,1,"HACK","Alarm %s(%d) created within compound command %s(%d) owned by %s(%d).",getname(alarm),alarm,getname(current_command),current_command,getname(Owner(current_command)),Owner(current_command)); setreturn(getnameid(player,alarm,NULL),COMMAND_SUCC); return(alarm); } else warnquota(player,owner,"to build an alarm"); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, an alarm can't have that name."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, the maximum length of an alarm's name is 128 characters."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Please specify a name for the new alarm."); } else output(getdsc(player),player,0,1,0,ANSI_LGREEN"Sorry, only Wizards/Druids and above can create an alarm."); return(NOTHING); } /* ----> Create a dynamic array <---- */ dbref create_array(CONTEXT) { dbref array,elements,count,new,owner = (!in_command && (Uid(player) != player)) ? Uid(player):Owner(player); setreturn(ERROR,COMMAND_FAIL); if(Builder(Owner(player))) { if(!Blank(arg1)) { if(strlen(arg1) <= 128) { if(!strchr(arg1,'[')) { if(ok_name(arg1)) { if(adjustquota(player,owner,ARRAY_QUOTA)) { if((elements = Blank(arg2) ? 0:atol(arg2)) >= 0) { /* ----> Create and initialise dynamic array <---- */ array = new_object(); db[array].destination = NOTHING; db[array].location = player; db[array].flags = OBJECT;
QJsonObject Style::saveData() const { QJsonObject json = Entity::saveData(); json["parentStyle"] = parentStyle().isValid() ? parentStyle().entity<Style>()->uid().toString() : Uid().toString(); if (penColorSet()) { json["penColor"] = penColor().name(); } if (fillColorSet()) { json["fillColor"] = fillColor().name(); } if (penOpacitySet()) { json["penOpacity"] = penOpacity(); } if (fillOpacitySet()) { json["fillOpacity"] = fillOpacity(); } if (penStyleSet()) { json["penStyle"] = toString(penStyle()); } if (lineWidthSet()) { json["lineWidth"] = lineWidth().toString(); } // FIXME line type if (doubleLineSet()) { json["doubleLine"] = doubleLine(); } if (innerLineWidthSet()) { json["innerLineWidth"] = innerLineWidth().toString(); } if (innerLineColorSet()) { json["innerLineColor"] = innerLineColor().name(); } if (rotationSet()) { json["rotation"] = rotation(); } if (radiusXSet()) { json["radiusX"] = radiusX().toString(); } if (radiusYSet()) { json["radiusY"] = radiusY().toString(); } if (bendAngleSet()) { json["bendAngle"] = bendAngle(); } if (loosenessSet()) { json["looseness"] = looseness(); } if (outAngleSet()) { json["outAngle"] = outAngle(); } if (inAngleSet()) { json["inAngle"] = inAngle(); } if (arrowTailSet()) { json["arrowTail"] = toString(arrowTail()); } if (arrowHeadSet()) { json["arrowHead"] = toString(arrowHead()); } if (shortenStartSet()) { json["shortenStart"] = shortenStart().toString(); } if (shortenEndSet()) { json["shortenEnd"] = shortenEnd().toString(); } if (textAlignSet()) { json["textAlign"] = toString(textAlign()); } if (shapeSet()) { json["shape"] = toString(shape()); } if (minimumWidthSet()) { json["minimumWidth"] = minimumWidth().toString(); } if (minimumHeightSet()) { json["minimumHeight"] = minimumHeight().toString(); } if (innerSepSet()) { json["innerSep"] = innerSep().toString(); } if (outerSepSet()) { json["outerSep"] = outerSep().toString(); } return json; }