void SpellHighlighter::tag_start(const QString &tag, const list<QString> &opt) { if ((tag == "img") || (tag == "br")){ flush(); m_pos++; } if (tag == "span"){ m_fonts.push(m_bError); QString key; QString val; list<QString>::const_iterator it; for (it = opt.begin(); it != opt.end(); ++it){ key = (*it); ++it; val = (*it); if (key == "style") break; } if (it != opt.end()){ list<QString> styles = parseStyle(val); for (it = styles.begin(); it != styles.end(); ++it){ key = (*it); ++it; val = (*it); if ((key == "color") && (val.lower() == "#ff0101")){ m_bError = true; break; } } } } }
WPContact::WPContact(Kopete::Account *account, const QString &newHostName, const QString &nickName, Kopete::MetaContact *metaContact) : Kopete::Contact(account, newHostName, metaContact) { // kdDebug(14170) << "WPContact::WPContact(<account>, " << newHostName << ", " << nickName << ", <parent>)" << endl; kdDebug(14170) << "WPContact::WPContact: " << this << endl; QString theNickName = nickName; if (theNickName.isEmpty()) { // Construct nickname from hostname with first letter to upper. GF theNickName = newHostName.lower(); theNickName = theNickName.replace(0, 1, theNickName[0].upper()); } setNickName(theNickName); myWasConnected = false; m_manager = 0; m_infoDialog = 0; // Initialise and start the periodical checking for contact's status setOnlineStatus(static_cast<WPProtocol *>(protocol())->WPOffline); connect(&checkStatus, SIGNAL(timeout()), this, SLOT(slotCheckStatus())); checkStatus.start(1000, false); }
QString KAddrBookExternal::expandDistributionList(const QString &listName) { if(listName.isEmpty()) return QString::null; const QString lowerListName = listName.lower(); KABC::AddressBook *addressBook = KABC::StdAddressBook::self(true); #ifdef KDEPIM_NEW_DISTRLISTS KPIM::DistributionList distrList = KPIM::DistributionList::findByName(addressBook, lowerListName, false); if(!distrList.isEmpty()) { return distrList.emails(addressBook).join(", "); } #else KABC::DistributionListManager manager(addressBook); manager.load(); const QStringList listNames = manager.listNames(); for(QStringList::ConstIterator it = listNames.begin(); it != listNames.end(); ++it) { if((*it).lower() == lowerListName) { const QStringList addressList = manager.list(*it)->emails(); return addressList.join(", "); } } #endif return QString::null; }
bool LFIIOSource::getColNumber( const QString& field, int* piColNumber ) const { QString strName; bool bOk = false; bool bRetVal = false; int iCount; int iCol; int i; iCol = field.toUInt(&bOk); if (bOk) { if (iCol >= 0 && iCol < _numCols) { *piColNumber = iCol; bRetVal = true; } } else { iCount = _fieldList.count(); // start at 1, because the first entry is INDEX... for (i=1; i<iCount; i++) { strName = _fieldList[i].lower(); if (strName.compare(field.lower()) == 0) { bRetVal = true; // subtract 1 to be consistent with the value returned from the previous branch... *piColNumber = i-1; break; } } } return bRetVal; }
int lookupColor(const QString colorname) { // this must be kept in sync with list in map painting class static const char* colornames[] = { "grey", "darkblue", "darkgreen", "darkcyan", "darkred", "darkmagenta", "darkyellow", "darkgray", "white", "blue", "green", "cyan", "red", "magenta", "yellow", "gray" }; QString lcolorname = colorname.lower(); for (uint32_t i = 0; i < sizeof(colornames)/sizeof(const char*); i++) { if (lcolorname == colornames[i]) return i; } return 0; }
void Mesh2MainWindow::dumpImage() { static int counter = 0; if (!dataWidget) return; QString name; name = QString("dump_") + QString::number(counter++) + "."; if (filetype_ == "PS_GZ") name += "ps.gz"; else if (filetype_ == "EPS_GZ") name += "eps.gz"; else name += filetype_; #if QT_VERSION < 0x040000 IO::save(dataWidget, name.lower(), filetype_); #else VectorWriter* vw = (VectorWriter*)IO::outputHandler("PDF"); if (vw) vw->setSortMode(VectorWriter::BSPSORT); IO::save(dataWidget, name.toLower(), filetype_); #endif }
int QZDir::getType(QString sub) { if (updateZ()==QZF_NONE) return QZF_NONE; if (sub=="." || sub=="..") return QZF_DIR; if (m_type&QZF_ZIP) { QCString str; toMB(str, sub, "euc-kr"); ZEntry *entry = m_dir.z->findByName(str); if (!entry) return QZF_NONE; if (entry->isDir()) return QZF_DIR; else return QZF_FILE; } else { QFileInfo finfo(m_dir.q->absPath()+"/"+sub); if (finfo.isFile()) { QString ext = finfo.extension(false); //printf("EXT:%s\n", (const char*)ext); if (ext.lower()=="zip") return QZF_DIR; return QZF_FILE; } if (finfo.isDir()) return QZF_DIR; return QZF_NONE; } }
void SlaveConfigPrivate::readConfigProtocolHost(const QString &, SlaveConfigProtocol *scp, const QString &host) { MetaData *metaData = new MetaData; scp->host.replace(host, metaData); // Read stuff // Break host into domains QString domain = host; if (!domain.contains('.')) { // Host without domain. if (scp->configFile->hasGroup("<local>")) readConfig(scp->configFile, "<local>", metaData); } int pos = 0; do { pos = host.findRev('.', pos-1); if (pos < 0) domain = host; else domain = host.mid(pos+1); if (scp->configFile->hasGroup(domain)) readConfig(scp->configFile, domain.lower(), metaData); } while (pos > 0); }
void AntProjectPart::openProject(const QString &dirName, const QString &projectName) { m_projectDirectory = dirName; m_projectName = projectName; QDomDocument &dom = *projectDom(); // Set the default directory radio to "executable" /// \FIXME there is no kdevantproject so this will not work ! if (DomUtil::readEntry(dom, "/kdevantproject/run/directoryradio") == "" ) { DomUtil::writeEntry(dom, "/kdevantproject/run/directoryradio", "executable"); } /// @todo read alternative build file from properties m_antOptions.m_buildXML = "build.xml"; parseBuildXML(); fillMenu(); QFile f(dirName + "/" + projectName.lower() + ".kdevelop" + ".filelist"); if (f.open(IO_ReadOnly)) { QTextStream stream(&f); while (!stream.atEnd()) { QString s = stream.readLine(); if (!s.startsWith("#")) m_sourceFiles << s; } } else populateProject(); KDevProject::openProject( dirName, projectName ); }
PluginManagerPrivate::PluginManagerPrivate(int argc, char **argv) : EventReceiver(LowPriority) { m_argc = argc; m_argv = argv; app_name = *argv; for (argv++, argc--; argc > 0; argv++, argc--){ args.push_back(string(*argv)); } m_base = 0; m_bLoaded = false; m_bInInit = true; QStringList pluginsList; QDir pluginDir(app_file("plugins").c_str()); #ifdef WIN32 pluginsList = pluginDir.entryList("*.dll"); #else pluginsList = pluginDir.entryList("*.so"); #endif m_bAbort = false; for (QStringList::Iterator it = pluginsList.begin(); it != pluginsList.end(); ++it){ QString f = *it; int p = f.findRev('.'); if (p > 0) f = f.left(p); pluginInfo info; info.plugin = NULL; #ifdef WIN32 info.name = strdup(QFile::encodeName(f.lower())); #else info.name = strdup(QFile::encodeName(f()); #endif info.config = NULL; info.bDisabled = false; info.bNoCreate = false; info.bFromCfg = false; info.module = NULL; info.info = NULL; info.base = 0; plugins.push_back(info); } sort(plugins.begin(), plugins.end(), cmp_plugin); for (vector<pluginInfo>::iterator itp = plugins.begin(); itp != plugins.end(); ++itp){ create((*itp)); if (m_bAbort) return; } m_bInInit = false; Event eStart(EventInit); eStart.process(); for (list<string>::iterator it_args = args.begin(); it_args != args.end(); ++it_args){ if ((*it_args).length()){ usage((*it_args).c_str()); break; } } }
LiveJournalUserData *LiveJournalClient::findContact(const char *user, Contact *&contact, bool bCreate) { ContactList::ContactIterator it; while ((contact = ++it) != NULL){ LiveJournalUserData *data; ClientDataIterator itc(contact->clientData, this); while ((data = (LiveJournalUserData*)(++itc)) != NULL){ if (!strcmp(data->User.ptr, user)) return data; } } QString sname = QString::fromUtf8(user); it.reset(); while ((contact = ++it) != NULL){ if (contact->getName().lower() == sname.lower()) break;; } if (contact == NULL){ if (!bCreate) return NULL; contact = getContacts()->contact(0, true); contact->setName(sname); } LiveJournalUserData *data = (LiveJournalUserData*)(contact->clientData.createData(this)); set_str(&data->User.ptr, user); Event e(EventContactChanged, contact); e.process(); return data; }
int FLCodBar::nameToType( const QString & name ) { QString n = name.lower(); if ( n == "any" ) return BARCODE_ANY; else if ( n == "ean" ) return BARCODE_EAN; else if ( n == "upc" ) return BARCODE_UPC; else if ( n == "isbn" ) return BARCODE_ISBN; else if ( n == "code39" ) return BARCODE_39; else if ( n == "code128" ) return BARCODE_128; else if ( n == "code128c" ) return BARCODE_128C; else if ( n == "code128b" ) return BARCODE_128B; else if ( n == "codei25" ) return BARCODE_I25; else if ( n == "code128r" ) return BARCODE_128RAW; else if ( n == "cbr" ) return BARCODE_CBR; else if ( n == "msi" ) return BARCODE_MSI; else if ( n == "pls" ) return BARCODE_PLS; else if ( n == "code93" ) return BARCODE_93; else return BARCODE_ANY; }
QMap<QString, QString> TypeMapper::headerDec( const Schema::Element *element ) const { QString typeName = element->typeName(); QMap<QString, QString> headers; // check basic types QMap<QString, TypeInfo>::ConstIterator it = mMap.find( typeName ); if ( it != mMap.end() ) { if ( !it.data().header.isEmpty() ) { if ( it.data().type == "QByteArray" ) headers.insert( it.data().header, QString() ); else headers.insert( it.data().header, it.data().type ); } } else { typeName[ 0 ] = typeName[ 0 ].upper(); headers.insert( typeName.lower() + ".h", typeName ); } if ( element->maxOccurs() > 1 ) headers.insert( "qptrlist.h", QString() ); return headers; }
// Main Command processing function void cCommands::process( cUOSocket *socket, const QString &command ) { if( !socket->player() ) return; P_PLAYER pChar = socket->player(); QStringList pArgs = QStringList::split( " ", command, true ); // No Command? No Processing if( pArgs.isEmpty() ) return; QString pCommand = pArgs[0].upper(); // First element should be the command // Remove it from the argument list pArgs.erase( pArgs.begin() ); // Check if the priviledges are ok if( !pChar->account()->authorized("command", pCommand )) { socket->sysMessage( tr( "Access to command '%1' was denied" ).arg( pCommand.lower() ) ); return; } // Dispatch the command dispatch( socket, pCommand, pArgs ); }
bool ResampleInfo::setResampleCode( const QString &codeName ) { QString str( codeName.lower() ); str.stripWhiteSpace(); str.remove(' '); strncpy( rn, str.ascii(), RN_MAXLENGTH ); if( str == "nearestneighbor" ) rc = ResampleInfo::NearestNeighbor; else if( str == "sum" ) rc = ResampleInfo::Sum; else if( str == "mean" ) rc = ResampleInfo::Mean; else if( str == "median" ) rc = ResampleInfo::Median; else if( str == "mode" ) rc = ResampleInfo::Mode; else if( str == "min" ) rc = ResampleInfo::Min; else if( str == "max" ) rc = ResampleInfo::Max; else return false; return true; }
/*! Returns TRUE if the string \a text is likely to be rich text; otherwise returns FALSE. Note: The function uses a fast and therefore simple heuristic. It mainly checks whether there is something that looks like a tag before the first line break. Although the result may be correct for most common cases, there is no guarantee. */ bool QStyleSheet::mightBeRichText( const QString& text) { if ( text.isEmpty() ) return FALSE; if ( text.left(5).lower() == "<!doc" ) return TRUE; int open = 0; while ( open < int(text.length()) && text[open] != '<' && text[open] != '\n' && text[open] != '&') ++open; if ( text[open] == '&' ) { if ( text.mid(open+1,3) == "lt;" ) return TRUE; // support desperate attempt of user to see <...> } else if ( text[open] == '<' ) { int close = text.find('>', open); if ( close > -1 ) { QString tag; for (int i = open+1; i < close; ++i) { if ( text[i].isDigit() || text[i].isLetter() ) tag += text[i]; else if ( !tag.isEmpty() && text[i].isSpace() ) break; else if ( !text[i].isSpace() && (!tag.isEmpty() || text[i] != '!' ) ) return FALSE; // that's not a tag } return defaultSheet()->item( tag.lower() ) != 0; } } return FALSE; }
FLTableMetaDataPrivate::FLTableMetaDataPrivate(const QString &n, const QString &a, const QString &q) : name_(n.lower()), alias_(a), compoundKey_(0), query_(q), concurWarn_(true), detectLocks_(false) { fieldList_ = new FLTableMetaData::FLFieldMetaDataList(71); fieldList_->setAutoDelete(true); }
FLFieldMetaDataPrivate::FLFieldMetaDataPrivate( const QString & n, const QString & a, bool aN, bool iPK, int t, int l, bool c, bool v, bool ed, int pI, int pD, bool iNX, bool uNI, bool coun, const QVariant & defValue, bool oT, const QString & rX, bool vG, bool gen, bool iCK ) : name_( n.lower() ), alias_( a ), allowNull_(( !c ) ? aN : true ), isPrimaryKey_( iPK ), type_( t ), length_( l ), calculated_( c ), visible_( v ), editable_( ed ), partInteger_( pI ), partDecimal_( pD ), isIndex_( iNX ), isUnique_( uNI ), contador_( coun ), relationList_( 0 ), relationM1_( 0 ), associatedField_( 0 ), defaultValue_( defValue ), outTransaction_( oT ), regExpValidator_( rX ), visibleGrid_( vG ), generated_( gen ), isCompoundKey_( iCK ), hasOptionsList_( false ), mtd_( 0 ) { if ( l < 0 ) length_ = 0; if ( pI < 0 ) partInteger_ = 0; if ( pD < 0 ) partDecimal_ = 0; if ( t != QVariant::String && l != 0 ) length_ = 0; if ( t != QVariant::Int && t != QVariant::UInt && t != QVariant::Double && pI != 0 ) partInteger_ = 0; if ( t != QVariant::Double && pD != 0 ) partDecimal_ = 0; alias_ = FLUtil::translate( "MetaData", alias_ ); }
void FLTableMetaData::removeFieldMD(const QString &fN) { if (fN.isEmpty()) return; d->fieldList_->remove(fN.lower()); d->removeFieldName(fN); }
void BgParser::tag_start(const QString &tag, const list<QString> &attrs) { if (tag == "body"){ m_bBody = true; res = ""; for (list<QString>::const_iterator it = attrs.begin(); it != attrs.end(); ++it){ QString name = *it; ++it; QString value = *it; if (name.lower() == "bgcolor"){ QColor c(value); bgColor = c.rgb(); } } return; } if (!m_bBody) return; res += "<"; res += tag; for (list<QString>::const_iterator it = attrs.begin(); it != attrs.end(); ++it){ QString name = *it; ++it; QString value = *it; res += " "; res += name; if (!value.isEmpty()){ res += "=\""; res += quoteString(value); res += "\""; } } res += ">"; }
QSqlIndex SqliteDriver::primaryIndex(const QString &tablename) const { QSqlIndex idx(tablename); if (!isOpen() || !dataBase_) return idx; QDomDocument doc(tablename); QDomElement docElem; QString stream = db_->managerModules()->contentCached(tablename + ".mtd"); if (!FLUtil::domDocumentSetContent(doc, stream)) { #ifdef FL_DEBUG qWarning("FLManager : " + QApplication::tr("Error al cargar los metadatos para la tabla %1").arg(tablename)); #endif return primaryIndex2(tablename); } docElem = doc.documentElement(); FLTableMetaData *mtd = db_->manager()->metadata(&docElem, true); if (!mtd) return primaryIndex2(tablename); idx.append(QSqlField(mtd->primaryKey(), FLFieldMetaData::flDecodeType(mtd->fieldType(mtd->primaryKey())))); idx.setName(tablename.lower() + "_pkey"); delete mtd; return idx; }
Options::MouseCommand Options::mouseCommand(const QString &name, bool restricted) { QString lowerName = name.lower(); if(lowerName == "raise") return MouseRaise; if(lowerName == "lower") return MouseLower; if(lowerName == "operations menu") return MouseOperationsMenu; if(lowerName == "toggle raise and lower") return MouseToggleRaiseAndLower; if(lowerName == "activate and raise") return MouseActivateAndRaise; if(lowerName == "activate and lower") return MouseActivateAndLower; if(lowerName == "activate") return MouseActivate; if(lowerName == "activate, raise and pass click") return MouseActivateRaiseAndPassClick; if(lowerName == "activate and pass click") return MouseActivateAndPassClick; if(lowerName == "activate, raise and move") return restricted ? MouseActivateRaiseAndMove : MouseActivateRaiseAndUnrestrictedMove; if(lowerName == "move") return restricted ? MouseMove : MouseUnrestrictedMove; if(lowerName == "resize") return restricted ? MouseResize : MouseUnrestrictedResize; if(lowerName == "shade") return MouseShade; if(lowerName == "minimize") return MouseMinimize; if(lowerName == "nothing") return MouseNothing; return MouseNothing; }
void RecOptDialog::LoadWindow(QDomElement &element) { QString name; int context; QRect area; for (QDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) { QDomElement e = child.toElement(); if (!e.isNull()) { if (e.tagName() == "font") theme->parseFont(e); else if (e.tagName() == "container") { theme->parseContainer(e, name, context, area); if (name.lower() == "program_info") infoRect = area; else if (name == "selector") listRect = area; } else { MythPopupBox::showOkPopup(gContext->GetMainWindow(), tr("Unknown Element"), QString(tr("The theme you are using contains an " "unknown element ('%1'). It will be ignored")).arg(e.tagName())); } } } }
void SyncAccessManager::freeAppAccess( const QString &app ) { QString appid = app.lower(); if( appid == "addressbook" ) { if( m_contactAccess ) { delete m_contactAccess; m_contactAccess = NULL; } } else if( appid == "datebook" ) { if( m_dateBookAccess ) { delete m_dateBookAccess; m_dateBookAccess = NULL; } } else if( appid == "todolist" ) { if( m_todoAccess ) { delete m_todoAccess; m_todoAccess = NULL; } } else if( appid == "notes" ) { if( m_memoAccess ) { delete m_memoAccess; m_memoAccess = NULL; } } }
QString KFileView::sortingKey( const QString& value, bool isDir, int sortSpec ) { bool reverse = sortSpec & QDir::Reversed; bool dirsFirst = sortSpec & QDir::DirsFirst; char start = (isDir && dirsFirst) ? (reverse ? '2' : '0') : '1'; QString result = (sortSpec & QDir::IgnoreCase) ? value.lower() : value; return result.prepend( start ); }
/* capitalize() returns a string where the first letter is a capital letter and everything else is lower case. */ QString capitalize(const QString &s) { if (s.isEmpty()) return s; QString t = s.lower(); t[0] = t[0].upper(); return t; }
QString ada_spec_filename (const QString& comp_unit_name) { QString fn (comp_unit_name.lower ()); fn.replace (QRegExp("."), "-"); fn += ".ads"; return fn; }
void FLTableMetaDataPrivate::removeFieldName(const QString &n) { if (!fieldsNames_.isEmpty()) { QStringList list(QStringList::split(',', fieldsNames_)); list.remove(n.lower()); fieldsNames_ = list.join(","); } }
int FirebirdStmt::findColumn(const QString& name) { for (int i = 1; i <= columnCount(); ++i) if (columnName(i).lower() == name.lower()) return i; return -1; }
void Reader::songListFinished( int /*id*/, bool error ) { ContentFetcher* http = (ContentFetcher*) sender(); disconnect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( songListFinished( int, bool ) ) ); if( error ) { http->deleteLater(); return; } Map songResults = parse( http->results(), 0, true ); SongList result; QValueList<QVariant> songList; songList = songResults["adbs"].asList()[0].asMap()["mlcl"].asList()[0].asMap()["mlit"].asList(); debug() << "songList.count() = " << songList.count() << endl; QValueList<QVariant>::iterator it; for( it = songList.begin(); it != songList.end(); ++it ) { MetaBundle* bundle = new MetaBundle(); bundle->setTitle( (*it).asMap()["minm"].asList()[0].toString() ); //input url: daap://host:port/databaseId/music.ext bundle->setUrl( Amarok::QStringx("daap://%1:%2/%3/%4.%5").args( QStringList() << m_host << QString::number( m_port ) << m_databaseId << QString::number( (*it).asMap()["miid"].asList()[0].asInt() ) << (*it).asMap()["asfm"].asList()[0].asString() ) ); bundle->setLength( (*it).asMap()["astm"].asList()[0].toInt()/1000 ); bundle->setTrack( (*it).asMap()["astn"].asList()[0].toInt() ); QString album = (*it).asMap()["asal"].asList()[0].toString(); bundle->setAlbum( album ); QString artist = (*it).asMap()["asar"].asList()[0].toString(); bundle->setArtist( artist ); result[ artist.lower() ][ album.lower() ].append(bundle); bundle->setYear( (*it).asMap()["asyr"].asList()[0].toInt() ); bundle->setGenre( (*it).asMap()["asgn"].asList()[0].toString() ); } emit daapBundles( m_host , result ); http->deleteLater(); }