//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryCase::updateTreeItemName() { if (caseName() != shortName()) this->setUiName(caseName() + " (" + shortName() +")"); else this->setUiName(caseName()); }
void ChangeLogForm::setInfo(UserCore::Item::ItemInfoI* item) { if (!item) return; if (item->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(item->getIcon()))) setIcon(item->getIcon()); m_uiItemId = item->getId(); gcWString title(Managers::GetString(L"#CL_TITLE"), item->getName()); SetTitle(title); gcWString type = gcWString(m_uiItemId.getTypeString()); gcWString shortName(item->getShortName()); gcWString url(L"{0}/{1}/{2}/changelog", GetWebCore()->getUrl(WebCore::Root), type, shortName); if (item->getCurrentBranch()) url += gcWString(L"/{0}", item->getCurrentBranch()->getBranchId()); m_ieBrowser->loadUrl(url); #ifdef NIX Refresh(false); #endif }
bool AttentionPlugin::enable() { QFile file(":/attentionplugin/attention.png"); if ( file.open(QIODevice::ReadOnly) ) { QByteArray image = file.readAll(); icoHost->addIcon("attentionplugin/attention",image); file.close(); } else { enabled = false; return enabled; } if(psiOptions) { blockedJids_.clear(); enabled = true; soundFile = psiOptions->getPluginOption(constSoundFile, QVariant(soundFile)).toString(); timeout_ = psiOptions->getPluginOption(constTimeout, QVariant(timeout_)).toInt(); infPopup = psiOptions->getPluginOption(constInfPopup, QVariant(infPopup)).toBool(); disableDnd = psiOptions->getPluginOption(constDisableDnd, QVariant(disableDnd)).toBool(); popupId = popup->registerOption(POPUP_OPTION, psiOptions->getPluginOption(constInterval, QVariant(4000)).toInt()/1000, "plugins.options."+shortName()+"."+constInterval); QWidgetList wl = qApp->allWidgets(); foreach(QWidget *w, wl) { if(w->objectName() == "MainWin") { nudgeWindow_ = w; break; } } nudgeTimer_ = new QTimer(this); nudgeTimer_->setInterval(50); connect(nudgeTimer_, SIGNAL(timeout()), SLOT(nudgeTimerTimeout())); } return enabled; }
void SDRDialog::updateFromSettings() { SpotTimeoutLineEdit->setText(settings.value(s_sdr_spottime,s_sdr_spottime_def).toString()); lineEditUDP->setText(settings.value(s_sdr_udp,s_sdr_udp_def).toString()); for (int i = 0; i < NRIG; i++) { #ifdef Q_OS_LINUX pathLabel[i]->setText(settings.value(s_sdr_path[i],QCoreApplication::applicationDirPath()+"so2sdr-bandmap").toString()); #endif #ifdef Q_OS_WIN pathLabel[i]->setText(settings.value(s_sdr_path[i],QCoreApplication::applicationDirPath()+"so2sdr-bandmap.exe").toString()); #endif configLabel[i]->setText(shortName(settings.value(s_sdr_config[i],s_sdr_config_def[i]).toString())); ipPtr[i]->setText(settings.value(s_sdr_ip[i],s_sdr_ip_def[i]).toString()); portPtr[i]->setText(settings.value(s_sdr_port[i],s_sdr_port_def[i]).toString()); } ChangeRadioClickCheckBox->setChecked(settings.value(s_sdr_changeclick,s_sdr_changeclick_def).toBool()); lineEdit160low->setText(settings.value(s_sdr_cqlimit_low[0],cqlimit_default_low[0]).toString()); lineEdit160high->setText(settings.value(s_sdr_cqlimit_high[0],cqlimit_default_high[0]).toString()); lineEdit80low->setText(settings.value(s_sdr_cqlimit_low[1],cqlimit_default_low[1]).toString()); lineEdit80high->setText(settings.value(s_sdr_cqlimit_high[1],cqlimit_default_high[1]).toString()); lineEdit40low->setText(settings.value(s_sdr_cqlimit_low[2],cqlimit_default_low[2]).toString()); lineEdit40high->setText(settings.value(s_sdr_cqlimit_high[2],cqlimit_default_high[2]).toString()); lineEdit20low->setText(settings.value(s_sdr_cqlimit_low[3],cqlimit_default_low[3]).toString()); lineEdit20high->setText(settings.value(s_sdr_cqlimit_high[3],cqlimit_default_high[3]).toString()); lineEdit15low->setText(settings.value(s_sdr_cqlimit_low[4],cqlimit_default_low[4]).toString()); lineEdit15high->setText(settings.value(s_sdr_cqlimit_high[4],cqlimit_default_high[4]).toString()); lineEdit10low->setText(settings.value(s_sdr_cqlimit_low[5],cqlimit_default_low[5]).toString()); lineEdit10high->setText(settings.value(s_sdr_cqlimit_high[5],cqlimit_default_high[5]).toString()); }
QString HistoryItem::inDialogsText(DrawInDialog way) const { auto getText = [this]() { if (_media) { return _media->chatListText(); } else if (!emptyText()) { return TextUtilities::Clean(_text.originalText()); } return QString(); }; const auto plainText = getText(); const auto sender = [&]() -> PeerData* { if (isPost() || isEmpty() || (way == DrawInDialog::WithoutSender)) { return nullptr; } else if (!_history->peer->isUser() || out()) { return author(); } else if (_history->peer->isSelf() && !Has<HistoryMessageForwarded>()) { return senderOriginal(); } return nullptr; }(); if (sender) { auto fromText = sender->isSelf() ? lang(lng_from_you) : sender->shortName(); auto fromWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, TextUtilities::Clean(fromText))); return lng_dialogs_text_with_from(lt_from_part, fromWrapped, lt_message, plainText); } return plainText; }
void ABundleAttribute::getNumericAttrib(ANumericAttribute * & dst) const { switch (numericType() ) { case TByteNumeric: dst = new AByteNumericAttribute; break; case TShortNumeric: dst = new AShortNumericAttribute; break; case TIntNumeric: dst = new AIntNumericAttribute; break; case TFloatNumeric: dst = new AFloatNumericAttribute; break; case TDoubleNumeric: dst = new ADoubleNumericAttribute; break; case TBooleanNumeric: dst = new ABooleanNumericAttribute; break; default: break; } if(!dst) return; dst->setShortName(shortName() ); dst->setLongName(longName() ); }
string AstScope::nameDotless() const { string out = shortName(); string::size_type pos; while ((pos=out.find(".")) != string::npos) { out.replace(pos, 1, "__"); } return out; }
void CueSplitter::run() { m_bSuccess = false; m_bAborted = false; m_abortFlag = false; m_nTracksSuccess = 0; m_nTracksSkipped = 0; m_decompressedFiles.clear(); m_activeFile.clear(); if(!QDir(m_outputDir).exists()) { qWarning("Output directory \"%s\" does not exist!", QUTF8(m_outputDir)); return; } QStringList inputFileList = m_inputFilesInfo.keys(); int nInputFiles = inputFileList.count(); emit progressMaxChanged(nInputFiles); emit progressValChanged(0); //Decompress all input files for(int i = 0; i < nInputFiles; i++) { const AudioFileModel_TechInfo &inputFileInfo = m_inputFilesInfo[inputFileList.at(i)].techInfo(); if(inputFileInfo.containerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.audioType().compare("PCM", Qt::CaseInsensitive)) { AbstractDecoder *decoder = DecoderRegistry::lookup(inputFileInfo.containerType(), inputFileInfo.containerProfile(), inputFileInfo.audioType(), inputFileInfo.audioProfile(), inputFileInfo.audioVersion()); if(decoder) { m_activeFile = shortName(QFileInfo(inputFileList.at(i)).fileName()); emit fileSelected(m_activeFile); emit progressValChanged(i+1); QString tempFile = QString("%1/~%2.wav").arg(m_outputDir, lamexp_rand_str()); connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection); if(decoder->decode(inputFileList.at(i), tempFile, &m_abortFlag)) { m_decompressedFiles.insert(inputFileList.at(i), tempFile); m_tempFiles.append(tempFile); } else { qWarning("Failed to decompress file: <%s>", inputFileList.at(i).toLatin1().constData()); lamexp_remove_file(tempFile); } m_activeFile.clear(); LAMEXP_DELETE(decoder); } else { qWarning("Unsupported input file: <%s>", inputFileList.at(i).toLatin1().constData()); } }
void DirDef::writePathFragment(OutputList &ol) const { if (m_parent) { m_parent->writePathFragment(ol); ol.writeString(" / "); } ol.writeObjectLink(getReference(),getOutputFileBase(),0,shortName()); }
void SDRDialog::fileGetter(QString msg,QString path,QString files,QString key,QLabel *label) { // QString fileName = QFileDialog::getOpenFileName(this,msg, path,files); QString fileName = QFileDialog::getSaveFileName(this,msg, path,files,0,QFileDialog::DontConfirmOverwrite); if (fileName.isNull()) { return; } settings.setValue(key,fileName); label->setText(shortName(fileName)); }
QString NamedObject::lengthLimitedName(int length) const { QString name = Name(); if (name.length()<=length) { return name; } length -= shortName().length() + 3; if (length <= 5) { // not enough room for "a...z (V2)" return '(' + shortName() + ')'; } int dnl = descriptiveName().length(); int d = dnl - length + 3; int s = (length-3)/2; return descriptiveName().replace(s, d, QString("...")) + " (" + shortName()+')'; }
void ModelProperties::saveMD(std::ostream &os) { os << "## Model \n"; os << " - Name **" << name()<< "**\n"; os << " - shortName **" << shortName()<< "**\n"; os << " - description **" << description()<< "**\n"; os << " - model **" << model()<< "**\n\n"; M_params.saveMD(os); M_mat.saveMD(os); M_bc.saveMD(os); M_postproc.saveMD(os); }
bool GmailNotifyPlugin::enable() { enabled = true; optionsApplingInProgress_ = false; id_.clear(); accounts.clear(); mailItems_.clear(); actions_ = new ActionsList(this); connect(actions_, SIGNAL(changeNoSaveState(int,QString,bool)), this, SLOT(changeNoSaveState(int,QString,bool))); QFile f(":/icons/gmailnotify.png"); if(f.open(QIODevice::ReadOnly)) iconHost->addIcon("gmailnotify/menu", f.readAll()); f.close(); f.setFileName(":/icons/nohistory.png"); if(f.open(QIODevice::ReadOnly)) iconHost->addIcon("gmailnotify/nohistory", f.readAll()); f.close(); soundFile = psiOptions->getPluginOption(OPTION_SOUND, soundFile).toString(); loadLists(); int interval = psiOptions->getPluginOption(OPTION_INTERVAL, QVariant(4000)).toInt()/1000; popupId = popup->registerOption(POPUP_OPTION, interval, "plugins.options."+shortName()+"."+OPTION_INTERVAL); program_ = psiOptions->getPluginOption(OPTION_PROG).toString(); //Update features bool end = false; int acc = 0; while(!end) { QString jid = accInfo->getJid(acc); if(jid == "-1") { end = true; continue; } QStringList l = jid.split("@"); QString domain = l.last().split("/").first(); QString id = stanzaSender->uniqueId(acc); id_.append(id); if(accInfo->getStatus(acc) != "offline") stanzaSender->sendStanza(acc, QString("<iq type='get' to='%1' id='%2' ><query xmlns='http://jabber.org/protocol/disco#info'/></iq>") .arg(domain) .arg(id)); acc++; } return true; }
bool StopSpam::enable() { if (psiOptions) { enabled = true; BlockedJids.clear(); mucUsers_.clear(); Question = psiOptions->getPluginOption(constQuestion, QVariant(Question)).toString(); Answer = psiOptions->getPluginOption(constAnswer, QVariant(Answer)).toString(); Congratulation = psiOptions->getPluginOption(constCongratulation, QVariant(Congratulation)).toString(); Unblocked = psiOptions->getPluginOption(constUnblocked, QVariant(Unblocked)).toString(); DefaultAct = psiOptions->getPluginOption(constDefaultAct, QVariant(DefaultAct)).toBool(); Height = psiOptions->getPluginOption(constHeight, QVariant(Height)).toInt(); Width = psiOptions->getPluginOption(constWidth, QVariant(Width)).toInt(); Times = psiOptions->getPluginOption(constTimes, QVariant(Times)).toInt(); ResetTime = psiOptions->getPluginOption(constResetTime, QVariant(ResetTime)).toInt(); LogHistory = psiOptions->getPluginOption(constLogHistory, QVariant(LogHistory)).toBool(); Counter = psiOptions->getPluginOption(constCounter, QVariant(Counter)).toInt(); UseMuc = psiOptions->getPluginOption(constUseMuc, QVariant(UseMuc)).toBool(); BlockAll = psiOptions->getPluginOption(constBlockAll, QVariant(BlockAll)).toBool(); Admin = psiOptions->getPluginOption(constAdmin, QVariant(Admin)).toBool(); Owner = psiOptions->getPluginOption(constOwner, QVariant(Owner)).toBool(); None = psiOptions->getPluginOption(constNone, QVariant(None)).toBool(); Member = psiOptions->getPluginOption(constMember, QVariant(Member)).toBool(); Moder = psiOptions->getPluginOption(constModer, QVariant(Moder)).toBool(); Participant = psiOptions->getPluginOption(constParticipant, QVariant(Participant)).toBool(); Visitor = psiOptions->getPluginOption(constVisitor, QVariant(Visitor)).toBool(); BlockAllMes = psiOptions->getPluginOption(constBlockAllMes, QVariant(BlockAllMes)).toString(); EnableBlockAllMes = psiOptions->getPluginOption(constEnableBlockAllMes, QVariant(EnableBlockAllMes)).toBool(); QDate luTime = QDate::fromString(psiOptions->getPluginOption( constLastUnblock, QVariant(QDate::currentDate().toString("yyyyMMdd")) ).toString(), "yyyyMMdd"); if(!Unblocked.isEmpty() && luTime.daysTo(QDate::currentDate()) > 3) { Unblocked.clear(); psiOptions->setPluginOption(constUnblocked, QVariant(Unblocked)); } Jids = psiOptions->getPluginOption(constJids, QVariant(Jids)).toStringList(); selected = psiOptions->getPluginOption(constselected, QVariant(selected)).value<QVariantList>(); model_ = new Model(Jids, selected, this); connect(model_, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(hack())); //register popup option int interval = psiOptions->getPluginOption(constInterval, QVariant(5000)).toInt()/1000; popupId = popup->registerOption(POPUP_OPTION, interval, "plugins.options."+shortName()+"."+constInterval); } return enabled; }
bool Watcher::enable() { if(psiOptions) { enabled = true; soundFile = psiOptions->getPluginOption(constSoundFile, QVariant(soundFile)).toString(); disableSnd = psiOptions->getPluginOption(constDisableSnd, QVariant(disableSnd)).toBool(); disablePopupDnd = psiOptions->getPluginOption(constDisablePopupDnd, QVariant(disablePopupDnd)).toBool(); int interval = psiOptions->getPluginOption(constInterval, QVariant(3000)).toInt()/1000; popupId = popup->registerOption(POPUP_OPTION_NAME, interval, "plugins.options."+shortName()+"."+constInterval); QStringList jids = psiOptions->getPluginOption(constJids, QVariant(QStringList())).toStringList(); QStringList soundFiles = psiOptions->getPluginOption(constSndFiles, QVariant(QStringList())).toStringList(); QStringList enabledJids = psiOptions->getPluginOption(constEnabledJids, QVariant(QStringList())).toStringList(); if (enabledJids.isEmpty()) { for (int i = 0; i < jids.size(); i++) { enabledJids << "true"; } } if(!model_) { model_ = new Model(jids, soundFiles, enabledJids, this); connect(model_, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(Hack())); } items_.clear(); QStringList list = psiOptions->getPluginOption(constWatchedItems).toStringList(); foreach(const QString& settings, list) { WatchedItem* wi = new WatchedItem(); wi->setSettings(settings); items_.push_back(wi); if(!wi->jid().isEmpty()) wi->setText(wi->jid()); else if(!wi->watchedText().isEmpty()) wi->setText(wi->watchedText()); else wi->setText(tr("Empty item")); } QStringList files; files << "watcher_on" << "watcher"; foreach (QString filename, files) { QFile file(":/icons/" + filename + ".png"); file.open(QIODevice::ReadOnly); QByteArray image = file.readAll(); icoHost->addIcon("watcher/" + filename, image); file.close(); }
int ArgumentScanner::scanShortOptions(const QStringList& args, int startIndex) { const auto& arg = args[startIndex]; if (arg.length() < 2 || '-' != arg[0] || '-' == arg[1]) return 0; for (int i = 1; i < arg.length(); i++) { auto& name = arg[i]; Token shortName(Token::SHORTNAME, name); m_tokens.push_back(shortName); } return 1; }
void CategoryFilterModel::categoryAdded(const QString &categoryName) { CategoryModelItem *parent = m_rootItem; if (m_isSubcategoriesEnabled) { QStringList expanded = BitTorrent::Session::expandCategory(categoryName); if (expanded.count() > 1) parent = findItem(expanded[expanded.count() - 2]); } auto item = new CategoryModelItem( parent, m_isSubcategoriesEnabled ? shortName(categoryName) : categoryName); QModelIndex i = index(item); beginInsertRows(i.parent(), i.row(), i.row()); endInsertRows(); }
void CategoryFilterModel::populate() { m_rootItem->clear(); auto session = BitTorrent::Session::instance(); auto torrents = session->torrents(); m_isSubcategoriesEnabled = session->isSubcategoriesEnabled(); const QString UID_ALL; const QString UID_UNCATEGORIZED(QChar(1)); // All torrents m_rootItem->addChild(UID_ALL, new CategoryModelItem(nullptr, tr("All"), torrents.count())); // Uncategorized torrents using Torrent = BitTorrent::TorrentHandle; m_rootItem->addChild( UID_UNCATEGORIZED , new CategoryModelItem( nullptr, tr("Uncategorized") , std::count_if(torrents.begin(), torrents.end() , [](Torrent *torrent) { return torrent->category().isEmpty(); }))); using Torrent = BitTorrent::TorrentHandle; foreach (const QString &category, session->categories()) { if (m_isSubcategoriesEnabled) { CategoryModelItem *parent = m_rootItem; foreach (const QString &subcat, session->expandCategory(category)) { const QString subcatName = shortName(subcat); if (!parent->hasChild(subcatName)) { new CategoryModelItem( parent, subcatName , std::count_if(torrents.begin(), torrents.end() , [subcat](Torrent *torrent) { return torrent->category() == subcat; })); } parent = parent->child(subcatName); } } else { new CategoryModelItem( m_rootItem, category , std::count_if(torrents.begin(), torrents.end() , [category](Torrent *torrent) { return torrent->belongsToCategory(category); })); } }
void DirDef::writeDirectoryGraph(OutputList &ol) { // write graph dependency graph if (Config_getBool(DIRECTORY_GRAPH) && Config_getBool(HAVE_DOT)) { DotDirDeps dirDep(this); if (!dirDep.isTrivial()) { msg("Generating dependency graph for directory %s\n",displayName().data()); ol.disable(OutputGenerator::Man); //ol.startParagraph(); ol.startDirDepGraph(); ol.parseText(theTranslator->trDirDepGraph(shortName())); ol.endDirDepGraph(dirDep); //ol.endParagraph(); ol.enableAll(); } } }
bool Arguments::evaluate(int argc, char* argv[]) { // parse program arguments vector<string> args(argv + 1, argv + argc); bool is_valid = true; errors_.clear(); for (auto i = options_.begin(); i != options_.end(); ++i) { // configured options auto option = i->second; bool found = false; for (auto j = args.begin(); j != args.end(); ++j) { // given arguments string arg_name = *j; stringstream aux; aux << "-" << option->shortName(); string opt_short = aux.str(); string opt_long = "--" + option->longName(); if ((option->hasShortName() && arg_name == opt_short) || (arg_name == opt_long)) { if (!option->isFlag()) { option->value(*++j); } found = true; } } if (!found && option->required()) { stringstream ss; ss << "Option \"" << option->longName() << "\" is required!" << endl; errors_ = ss.str(); is_valid = false; break; } } return is_valid; }
void COwnedLostItem::SetHandleMethodViaFileClass(const CString& fileClass, const CString& netscapeName, const CString& directoryName) { // We have a place to look in the registry char lpszOpenCommand[_MAX_PATH+1]; CString theString = fileClass + "\\shell\\open\\command"; LONG size = _MAX_PATH; if (::RegQueryValue(HKEY_CLASSES_ROOT, theString, lpszOpenCommand, &size) != ERROR_SUCCESS) { m_nHandleMethod = OL_OTHER_APP; return; } CString openCommand(lpszOpenCommand); openCommand.MakeUpper(); if (openCommand.Find(netscapeName) != -1) { // Handled by a version of Netscape. char shortBuffer[_MAX_PATH]; GetShortPathName(directoryName, shortBuffer, _MAX_PATH); CString shortName(shortBuffer); shortName.MakeUpper(); if (openCommand.Find(directoryName) != -1 || openCommand.Find(shortName) != -1) { // Handled by current version. m_nHandleMethod = OL_CURRENT_NETSCAPE; } else m_nHandleMethod = OL_OLD_NETSCAPE; } else m_nHandleMethod = OL_OTHER_APP; }
CoaSettingsWidgetChangeDebug::CoaSettingsWidgetChangeDebug(QWidget * const parent , Qt::WFlags f ) : CoaSettingsWidget (parent, f) ,actionModel(0) { BEGIN; //Create the central form Q_INIT_RESOURCE(tools); CoaFormFactory factory(this); factory.formBuild(":/tools/settings/coachangedebug.ui"); setIcon(":/tools/settings/icons/debug.png"); initMainButtons(); initDefaultModeButtons(); loadModel(); assert(actionModel); initTableView(); setShortName( tr("Debug") ); setGroupName( shortName() ); }
bool yandexnarodPlugin::enable() { enabled = true; QFile file(":/icons/yandexnarodplugin.png"); file.open(QIODevice::ReadOnly); QByteArray image = file.readAll(); psiIcons->addIcon("yandexnarod/logo",image); file.close(); Options::instance()->setApplicationInfoAccessingHost(appInfo); Options::instance()->setOptionAccessingHost(psiOptions); //remove old password option QString oldPass = Options::instance()->getOption(CONST_PASS_OLD).toString(); if(!oldPass.isEmpty()) { Options::instance()->setOption(CONST_PASS_OLD, QVariant("")); Options::instance()->setOption(CONST_PASS, Options::encodePassword(oldPass)); } popupId = popup->registerOption(name(), 3, "plugins.options." + shortName() + POPUP_OPTION_NAME); return enabled; }
// FreeTextAnnot void AnnotWriter::AssignShortFontNames() { // scan all fonts std::list<int> fontIDs; { std::list<PDFFont*>* fonts = mBePDFAcroForm->GetFonts(); std::list<PDFFont*>::iterator it; for (it = fonts->begin(); it != fonts->end(); it ++) { int d; PDFFont* font = *it; if (sscanf(font->GetShortName(), "F%d", &d) != 0 && d >= 0) { fontIDs.push_back(d); } } } // assign short names to standard fonts PDFStandardFonts* stdFonts = BePDFAcroForm::GetStandardFonts(); int id = 0; std::list<int>::iterator it; fontIDs.sort(); it = fontIDs.begin(); for (int i = 0; i < stdFonts->CountFonts(); i ++) { PDFFont* font = stdFonts->FontAt(i); if (strcmp(font->GetShortName(), "") == 0) { GString shortName("F"); char number[80]; while (it != fontIDs.end() && id == *it) { id ++; it ++; } sprintf(number, "%d", id); shortName.append(number); font->SetShortName(shortName.getCString()); mTemporaryFonts.push_back(font); id ++; } } }
QString BitcoinUnits::formatWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators) { return format(unit, amount, plussign, separators) + QString(" ") + shortName(unit); }
void TextTestResult::startTest(Test* test) { TestResult::startTest(test); _ostr << "\n" << shortName(test->toString()) << ": "; }
HRESULT UiTreeWalk::AppendUiAttributes(long left, long top, IUIAutomationElement* pCurUia, long nPos, std::wstring& wstr) { SAFEARRAY *rid; REQUIRE_SUCCESS_HR(pCurUia->GetRuntimeId(&rid)); LONG lbound; REQUIRE_SUCCESS_HR(SafeArrayGetLBound(rid, 1, &lbound)); LONG ubound; REQUIRE_SUCCESS_HR(SafeArrayGetUBound(rid, 1, &ubound)); CComBSTR bstrRuntimeId; LONG runtimeId = 0; WCHAR temp[16]; for (LONG i = lbound; i <= ubound; i++) { REQUIRE_SUCCESS_HR(SafeArrayGetElement(rid, &i, &runtimeId)); _ltow_s(runtimeId, temp, 10); REQUIRE_SUCCESS_HR(bstrRuntimeId.Append(temp)); if (i < ubound) { REQUIRE_SUCCESS_HR(bstrRuntimeId.Append(L".")); } } REQUIRE_SUCCESS_HR(SafeArrayDestroy(rid)); if (bstrRuntimeId == NULL) { wsprintf(temp, L"%lu", reinterpret_cast<std::uintptr_t>(pCurUia)); bstrRuntimeId = temp; } CComPtr<IUIAutomationElement> spUia(pCurUia); auto it = cachedAutoElements.find(bstrRuntimeId); if (it == cachedAutoElements.end()) { cachedAutoElements.insert(std::make_pair(bstrRuntimeId, spUia)); } else { it->second = spUia; } CComBSTR bstrClass; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentClassName(&bstrClass)); bstrClass = bstrClass == NULL ? L"" : bstrClass; std::wstring shortClass(bstrClass, SysStringLen(bstrClass)); bool bStartWith = XmlEncode(shortClass, MaxNameLength); if (bStartWith == true || shortClass.length() >= MaxNameLength) { shortClass.insert(0, L"starts-with:"); } CComBSTR bstrName; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentName(&bstrName)); bstrName = bstrName == NULL ? L"" : bstrName; std::wstring shortName(bstrName, SysStringLen(bstrName)); bStartWith = XmlEncode(shortName, MaxNameLength); if (bStartWith == true || shortName.length() >= MaxNameLength) { shortName.insert(0, L"starts-with:"); } CComBSTR bstrCtrlType; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentLocalizedControlType(&bstrCtrlType)); bstrCtrlType = bstrCtrlType == NULL ? L"" : bstrCtrlType; CONTROLTYPEID cid; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentControlType(&cid)); CComBSTR bstrProgrammaticName; if (cid >= UIA_ButtonControlTypeId && UIA_ButtonControlTypeId <= UIA_AppBarControlTypeId) { REQUIRE_SUCCESS_HR(bstrProgrammaticName.Append(gc_controlTypesTable[cid - UIA_ButtonControlTypeId].pszName)); } // CurrentLocalizedControlType can be empty: Cortana set reminder Time button's parent if (bstrProgrammaticName.Length() == 0) { bstrProgrammaticName = L"Unknown"; } CComBSTR bstrAutoId; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentAutomationId(&bstrAutoId)); bstrAutoId = bstrAutoId == NULL ? L"" : bstrAutoId; std::wstring shortAutoId(bstrAutoId, SysStringLen(bstrAutoId)); bStartWith = XmlEncode(shortAutoId, MaxNameLength); if (bStartWith == true || shortAutoId.length() >= MaxNameLength) { shortAutoId.insert(0, L"starts-with:"); } RECT rect; REQUIRE_SUCCESS_HR(pCurUia->get_CurrentBoundingRectangle(&rect)); WCHAR chPos[16]; if (nPos <= 0) { wsprintf(chPos, L""); } else { wsprintf(chPos, L"%d", nPos + 1); // xpath index starts at 1 } wsprintf(UiTreeWalk::s_chBuffer, c_chNodeFormat, bstrProgrammaticName.m_str, bstrCtrlType.m_str, shortClass.c_str(), shortName.c_str(), shortAutoId.c_str(), rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, left - rect.left, top - rect.top, chPos, bstrRuntimeId.m_str); if (wcslen(UiTreeWalk::s_chBuffer) > 0) { wstr.append(UiTreeWalk::s_chBuffer); } return S_OK; }
const char* EMethodGroup::shortName() const { return shortName(value()); }
GLDEF_C void FindL() { CContactItemFieldDef* fieldDef=new(ELeave) CContactItemFieldDef; CleanupStack::PushL(fieldDef); fieldDef->AppendL(KUidContactFieldAddress); fieldDef->AppendL(KUidContactFieldFamilyName); fieldDef->AppendL(KUidContactFieldGivenName); fieldDef->AppendL(KUidContactFieldCompanyName); fieldDef->AppendL(KUidContactFieldBirthday); fieldDef->AppendL(KUidContactFieldTemplateLabel); // test.Next(_L("Search for full given name")); TBuf<16> name; name.Format(KTestName,7); CContactIdArray* ids=CntTest->Db()->FindLC(name,fieldDef); test(ids->Count()==1); CleanupStack::PopAndDestroy(); // ids test.Next(_L("Search for full given name in only contact groups")); // same test but only looking in groups so shouldn't find anything name.Format(KTestName,7); CntTest->Db()->SetDbViewContactType(KUidContactGroup); ids=CntTest->Db()->FindLC(name,fieldDef); test(ids->Count()==0); // nothing found. CleanupStack::PopAndDestroy(); // ids CntTest->Db()->SetDbViewContactType(KUidContactItem); //reset view test.Next(_L("Search for partial name")); TBuf<8> shortName(name.Left(8)); ids=CntTest->Db()->FindLC(shortName,fieldDef); test(ids->Count()==KTotalNumRecords); CleanupStack::PopAndDestroy(); // ids shortName=name.Right(8); ids=CntTest->Db()->FindLC(shortName,fieldDef); test(ids->Count()==1); CleanupStack::PopAndDestroy(); // ids shortName=name.Mid(3,8); ids=CntTest->Db()->FindLC(shortName,fieldDef); test(ids->Count()>1); CleanupStack::PopAndDestroy(); // ids test.Next(_L("Search for full address")); TBuf<16> address; address.Format(KTestAddress,11); ids=CntTest->Db()->FindLC(address,fieldDef); test(ids->Count()==1); CleanupStack::PopAndDestroy(); // ids test.Next(_L("NULL search string")); ids=CntTest->Db()->FindLC(_L(""),fieldDef); test(ids->Count()==KTotalNumRecords + 3); // 2 groups + 1 owncard CleanupStack::PopAndDestroy(); // ids // look in just the groups test.Next(_L("NULL search string in GROUPS")); TInt groupCount = CntTest->Db()->GroupCount(); CntTest->Db()->SetDbViewContactType(KUidContactGroup); ids=CntTest->Db()->FindLC(_L(""),fieldDef); test(ids->Count()==groupCount); CleanupStack::PopAndDestroy(); // ids // ids=CntTest->Db()->FindLC(_L("New Group"),fieldDef); test(ids->Count()==groupCount); CleanupStack::PopAndDestroy(); // ids // CntTest->Db()->SetDbViewContactType(KUidContactItem); // look in just the OWN CARD test.Next(_L("NULL search string in OWN CARD")); CntTest->Db()->SetDbViewContactType(KUidContactOwnCard); ids=CntTest->Db()->FindLC(_L(""),fieldDef); test(ids->Count()==1); CleanupStack::PopAndDestroy(); // ids // CntTest->Db()->SetDbViewContactType(KUidContactItem); test.Next(_L("Search for partial address")); TBuf<8> shortAddress(address.Left(6)); ids=CntTest->Db()->FindLC(shortAddress,fieldDef); test(ids->Count()==KTotalNumRecords/2); CleanupStack::PopAndDestroy(); // ids shortAddress=address.Right(6); ids=CntTest->Db()->FindLC(shortAddress,fieldDef); test(ids->Count()==1); CleanupStack::PopAndDestroy(); // ids shortAddress=address.Mid(3,6); ids=CntTest->Db()->FindLC(shortAddress,fieldDef); test(ids->Count()>1); TContactItemId deleteItem=(*ids)[0]; CleanupStack::PopAndDestroy(); // ids // CntTest->AdjustContactAccessCountL(deleteItem,1); CntTest->Db()->DeleteContactL(deleteItem); // ids=CntTest->Db()->FindLC(shortAddress,NULL); test(ids->Count()>1); CleanupStack::PopAndDestroy(); // ids // CntTest->AdjustContactAccessCountL(deleteItem,-1); ids=CntTest->Db()->FindLC(shortAddress,NULL); test(ids->Count()>1); CleanupStack::PopAndDestroy(); // ids // ids=CntTest->Db()->FindLC(_L("*"),NULL); test(ids->Count()==0); // literal matching now and no asterisks in this file! CleanupStack::PopAndDestroy(); // ids // ids=CntTest->Db()->FindLC(shortAddress,fieldDef); test(ids->Count()>1); CleanupStack::PopAndDestroy(); // ids // CleanupStack::PopAndDestroy(); // fieldDef }
void Part::setShortName(const QString& name) { if (d->shortName == name) return; d->shortName = name; emit shortNameChanged(shortName()); }