QString FLManagerModules::content( const QString & n ) { if ( n.isEmpty() || n.length() <= 3 ) return QString::null; QString retFS; bool notSysTable = db_->dbAux() && n.left( 3 ) != "sys" && !db_->manager()->isSystemTable( n ); if ( !staticDirFiles_.isEmpty() && notSysTable ) { retFS = contentStaticDir( n ); if ( !retFS.isEmpty() ) return retFS; } if ( n.endsWith( ".xml" ) ) retFS = contentFS( FLDATA "/" + n ); else if ( n.endsWith( ".qs" ) ) retFS = contentFS( FLDATA "/scripts/" + n ); else if ( n.endsWith( ".mtd" ) ) retFS = contentFS( FLDATA "/tables/" + n ); else if ( n.endsWith( ".ui" ) ) retFS = contentFS( FLDATA "/forms/" + n ); else if ( n.endsWith( ".kut" ) ) retFS = contentFS( FLDATA "/reports/" + n ); else if ( n.endsWith( ".qry" ) ) retFS = contentFS( FLDATA "/queries/" + n ); else if ( n.endsWith( ".ts" ) ) retFS = contentFS( FLDATA "/translations/" + n ); if ( !retFS.isEmpty() ) return retFS; if ( notSysTable ) { QSqlQuery q( QString::null, db_->dbAux() ); q.setForwardOnly( true ); q.exec( "SELECT contenido,sha FROM flfiles WHERE upper(nombre) = '" + n.upper() + "'" ); if ( q.next() ) { QString ret = q.value( 0 ).toString(); if ( q.value( 1 ).toString().isEmpty() ) { FLSqlCursor cursor( "flfiles", true, db_->dbAux() ); cursor.select( "upper(nombre) = '" + n.upper() + "'" ); if ( cursor.lastError().type() != QSqlError::None ) { QMessageBox::critical( 0, "Error", QString( cursor.lastError().driverText().utf8() ) + "\n" + QString( cursor.lastError().databaseText().utf8() ), QMessageBox::Ok, 0, 0 ); return QString::null; } cursor.setModeAccess( FLSqlCursor::EDIT ); cursor.first(); QString s = FLUtil::sha1( ret ); cursor.setValueBuffer( "sha", s ); cursor.commitBuffer(); } return ret; } } return QString::null; }
int TimezoneToInt (QString timezone) { // we signal an error by setting it invalid (> 840min = 14hr) int result = 841; if (timezone.upper() == "UTC" || timezone.upper() == "GMT") return 0; if (timezone.length() == 5) { bool ok; result = timezone.mid(1,2).toInt(&ok, 10); if (!ok) result = 841; else { result *= 60; int min = timezone.right(2).toInt(&ok, 10); if (!ok) result = 841; else { result += min; if (timezone.left(1) == "-") result *= -1; } } } return result; }
QString KTNEFPropertySet::findNamedProp(const QString& name, const QString& fallback, bool upper) { for ( QMap<int,KTNEFProperty*>::Iterator it = properties_.begin(); it != properties_.end(); ++it ){ if ( (*it)->name().isValid() ){ QString s; if ( (*it)->name().type() == QVariant::String ) s = (*it)->name().asString(); else s = QString().sprintf( "0X%04X", (*it)->name().asUInt() ); if( s.upper() == name.upper() ){ QVariant value = ( *it )->value(); if( value.type() == QVariant::List ){ s = ""; for ( QValueList<QVariant>::ConstIterator lit = value.listBegin(); lit != value.listEnd(); ++lit ){ if( !s.isEmpty() ) s += ','; s += KTNEFProperty::formatValue( *lit, false ); } }else{ s = KTNEFProperty::formatValue( value, false ); } return upper ? s.upper() : s; } } } return fallback; }
int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) { QString bd = Option::fixPathToLocalOS(d, TRUE); if(!QFile::exists(bd)) return -1; if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); QDir dir(bd); int biggest=-1; QStringList entries = dir.entryList(); QString dllStem = stem + QTDLL_POSTFIX; QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { if(regx.exactMatch((*it))) biggest = QMAX(biggest, (regx.cap(1) == dllStem || regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); } QMakeMetaInfo libinfo; if(libinfo.readLib(bd + dllStem)) { if(!libinfo.isEmpty("QMAKE_PRL_VERSION")) biggest = QMAX(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); } return biggest; }
JumpButton::JumpButton( const QString &firstChar, const QString &lastChar, QWidget *parent ) : QPushButton( "", parent ), mChar( firstChar ) { setToggleButton( true ); if ( !lastChar.isEmpty() ) setText( QString( "%1 - %2" ).arg( firstChar.upper() ).arg( lastChar.upper() ) ); else setText( firstChar.upper() ); }
void FLReportViewer::exportFileCSVData() { if (slotsExportDisabled_) return; QString fileName = QFileDialog::getSaveFileName("", tr("Fichero CSV (*.csv *.txt)"), this, tr("Exportar a CSV"), tr("Exportar a CSV")); if (fileName.isEmpty()) return; if (!fileName.upper().contains(".CSV")) fileName += ".csv"; if (QFile::exists(fileName) && QMessageBox::question(this, tr("Sobreescribir %1").arg(fileName), tr("Ya existe un fichero llamado %1. ¿ Desea sobreescribirlo ?").arg(fileName), tr("&SÃ"), tr("&No"), QString::null, 0, 1)) { return; } QFile file(fileName); if (file.open(IO_WriteOnly)) { QTextStream stream(&file); stream << csvData() << "\n"; file.close(); } else { QMessageBox::critical( this, tr("Error abriendo fichero"), tr("No se pudo abrir el fichero %1 para escribir: %2").arg(fileName, qApp->translate("QFile", file.errorString()))); } }
bool Engine::isTagTextValid(TagNode* parent, QString& text, bool ignoreExifTag) const { // a maintag must not be named 'EXIF' (if ignoreExifTag is false) if (!ignoreExifTag && parent == 0 && text.upper() == "EXIF") { return false; } QPtrList<TagNode>* siblings = m_tagForest; if (parent) { siblings = parent->children(); } if (siblings) { TagNode* sibling; for ( sibling = siblings->first(); sibling; sibling = siblings->next() ) { if (*sibling->text() == text) { // sibling with the same name already exists! return false; } } } // no sibling with the same name found return true; }
/** Sets a label's layout attributes */ void MReportEngine::setLabelAttributes( MLabelObject * label, QDomNamedNodeMap * attr ) { QString tmp; label->setPaintFunction( attr->namedItem( "PaintFunction" ).nodeValue() ); label->setLabelFunction( attr->namedItem( "LabelFunction" ).nodeValue() ); label->setText( attr->namedItem( "Text" ).nodeValue().stripWhiteSpace() ); label->setGeometry( attr->namedItem( "X" ).nodeValue().toInt(), attr->namedItem( "Y" ).nodeValue().toInt(), attr->namedItem( "Width" ).nodeValue().toInt(), attr->namedItem( "Height" ).nodeValue().toInt() ); tmp = attr->namedItem( "BackgroundColor" ).nodeValue(); if ( tmp.upper() == "NOCOLOR" ) { label->setTransparent( true ); label->setBackgroundColor( 255, 255, 255 ); } else { label->setTransparent( false ); label->setBackgroundColor( tmp.left( tmp.find( "," ) ).toInt(), tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(), tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() ); } tmp = attr->namedItem( "ForegroundColor" ).nodeValue(); label->setForegroundColor( tmp.left( tmp.find( "," ) ).toInt(), tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(), tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() ); tmp = attr->namedItem( "BorderColor" ).nodeValue(); label->setBorderColor( tmp.left( tmp.find( "," ) ).toInt(), tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(), tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() ); label->setBorderWidth( attr->namedItem( "BorderWidth" ).nodeValue().toInt() ); label->setBorderStyle( attr->namedItem( "BorderStyle" ).nodeValue().toInt() ); label->setFont( attr->namedItem( "FontFamily" ).nodeValue(), attr->namedItem( "FontSize" ).nodeValue().toFloat() * relCalcDpi_, attr->namedItem( "FontWeight" ).nodeValue().toInt(), ( attr->namedItem( "FontItalic" ).nodeValue().toInt() == 0 ? false : true ) ); label->setHorizontalAlignment( attr->namedItem( "HAlignment" ).nodeValue(). toInt() ); label->setVerticalAlignment( attr->namedItem( "VAlignment" ).nodeValue(). toInt() ); label->setWordWrap( attr->namedItem( "WordWrap" ).nodeValue().toInt() == 0 ? false : true ); label->setChangeHeight( attr->namedItem( "ChangeHeight" ).nodeValue().toInt() == 0 ? false : true ); }
KPrinter::PageSize pageNameToPageSize(const QString& _name) { QString name = _name.upper(); if (name == "LETTER") return KPrinter::Letter; else if (name == "LEGAL") return KPrinter::Legal; else if (name == "A4") return KPrinter::A4; else if (name == "A3") return KPrinter::A3; else if (name == "EXECUTIVE") return KPrinter::Executive; else if (name == "LEDGER") return KPrinter::Ledger; else if (name == "TABLOID") return KPrinter::Tabloid; else if (name == "FOLIO") return KPrinter::Folio; else if (name == "A5") return KPrinter::A5; else if (name == "A6") return KPrinter::A6; else if (name == "A7") return KPrinter::A7; else if (name == "A8") return KPrinter::A8; else if (name == "A9") return KPrinter::A9; else if (name == "A2") return KPrinter::A2; else if (name == "A1") return KPrinter::A1; else if (name == "A0") return KPrinter::A0; else if (name == "B0" || name == "B0ISO") return KPrinter::B0; else if (name == "B1" || name == "B1ISO") return KPrinter::B1; else if (name == "B2" || name == "B2ISO") return KPrinter::B2; else if (name == "B3" || name == "B3ISO") return KPrinter::B3; else if (name == "B4" || name == "B4ISO") return KPrinter::B4; else if (name == "B5" || name == "B5ISO") return KPrinter::B5; else if (name == "B6" || name == "B6ISO") return KPrinter::B6; else if (name == "B7" || name == "B7ISO") return KPrinter::B7; else if (name == "B8" || name == "B8ISO") return KPrinter::B8; else if (name == "B9" || name == "B9ISO") return KPrinter::B9; else if (name == "B10" || name == "B10ISO") return KPrinter::B10; else if (name == "C5" || name == "C5E" || name == "ENVC5") return KPrinter::C5E; else if (name == "DL" || name == "DLE" || name == "ENVDL") return KPrinter::DLE; else if (name == "COMM10" || name == "COM10" || name == "ENV10") return KPrinter::Comm10E; else return KPrinter::A4; }
QString get_idl_name(const BrowserClass * cl, ShowContextMode mode) { ClassData * d = (ClassData *) cl->get_data(); if (! d->idl_is_external()) return cl->contextual_name(mode); QString name = cl->get_name(); QString s = d->get_idldecl(); int index = s.find('\n'); s = (index == -1) ? s.stripWhiteSpace() : s.left(index).stripWhiteSpace(); if ((index = s.find("${name}")) != -1) s.replace(index, 7, name); else if ((index = s.find("${Name}")) != -1) s.replace(index, 7, capitalize(name)); else if ((index = s.find("${NAME}")) != -1) s.replace(index, 7, name.upper()); else if ((index = s.find("${nAME}")) != -1) s.replace(index, 7, name.lower()); return s; }
QValidator::State MapimgValidator::validate( QString & input, int & ) const { if( input.upper() == "UNDEFINED" && m_allowUndefined ) { input = "Undefined"; return Acceptable; } QRegExp empty( QString::fromLatin1(" *-?\\.? *") ); if ( m_bottom >= 0 && input.stripWhiteSpace().startsWith(QString::fromLatin1("-")) ) return Invalid; if ( empty.exactMatch(input) ) return Intermediate; bool ok = TRUE; double entered = input.toDouble( &ok ); int nume = input.contains( 'e', FALSE ); if ( !ok ) { // explicit exponent regexp QRegExp expexpexp( QString::fromLatin1("[Ee][+-]?\\d*$") ); int eeePos = expexpexp.search( input ); if ( eeePos > 0 && nume == 1 ) { QString mantissa = input.left( eeePos ); entered = mantissa.toDouble( &ok ); if ( !ok ) return Invalid; } else if ( eeePos == 0 ) { return Intermediate; } else { return Invalid; } } QString tempInput = QString::number( entered ); int tempj = tempInput.find( '.' ); int i = input.find( '.' ); if( (i >= 0 || tempj >= 0 || input.contains("e-", FALSE)) && m_decimals == 0 ) { return Invalid; } if ( i >= 0 && nume == 0 ) { // has decimal point (but no E), now count digits after that i++; int j = i; while( input[j].isDigit() ) j++; if ( j - i > m_decimals ) return Invalid; //Intermediate; } if( entered > m_top ) return Invalid; else if ( entered < m_bottom ) return Intermediate; else return Acceptable; }
QString FLUtil::enLetra(long n) { QString buffer; if (n > 1000000000L) { buffer = QT_TR_NOOP("Sólo hay capacidad hasta mil millones"); return buffer; } if (n < 1000000L) { buffer = centenamillar(n); return buffer; } else { if (n / 1000000L == 1) buffer = QT_TR_NOOP("un millon "); else { buffer = centenas((long)(n / 1000000L)); buffer = buffer + " " + QT_TR_NOOP("millones") + " "; } } buffer = buffer + centenamillar(n % 1000000L); return buffer.upper(); }
void FLManagerModules::setActiveIdModule( const QString & id ) { #if defined (FL_QUICK_CLIENT) if ( id == "sys" ) { activeIdModule_ = QString::null; activeIdArea_ = QString::null; return; } #endif if ( id.isEmpty() || !dictInfoMods ) { activeIdArea_ = QString::null; activeIdModule_ = QString::null; return ; } FLInfoMod *iM = ( *dictInfoMods )[ id.upper()]; if ( iM ) { activeIdArea_ = iM->idArea; activeIdModule_ = id; } else { #ifdef FL_DEBUG qWarning( QApplication::tr( "FLManagerModules : Se ha intentando activar un módulo inexistente" ) ); #endif activeIdArea_ = QString::null; activeIdModule_ = QString::null; } }
void MapimgValidator::fixup( QString& input ) const { if( input.upper() == "UNDEFINED" && m_allowUndefined ) { input = "Undefined"; return; } double entered = input.toDouble(); if( entered > m_top ) { entered = m_top; } else if( entered < m_bottom ) { entered = m_bottom; } input = QString::number( entered, 'f', m_decimals ); /*fix decimal*/ if( m_decimals == 0 ) { int decimalPlace = input.find( '.' ); if( decimalPlace != -1 ) { input = input.left( decimalPlace ); } } return; }
int KDateEdit::numFromMonthName(QString name) const { name = name.upper(); if (name == "JAN") return 1; else if (name == "FEB") return 2; else if (name == "MAR") return 3; else if (name == "APR") return 4; else if (name == "MAY") return 5; else if (name == "JUN") return 6; else if (name == "JUL") return 7; else if (name == "AUG") return 8; else if (name == "SEP") return 9; else if (name == "OCT") return 10; else if (name == "NOV") return 11; else if (name == "DEC") return 12; else // should never get here! return 0; }
QString ChatSession::caseUnsensitive(const QString& msg) { QString up = msg.upper(); QString low = msg.lower(); QString res(""); for (unsigned int i = 0; i<msg.length(); i++) res += "[" + up.at(i) + low.at(i) + "]"; return res; }
QString FLManagerModules::idModuleOfFile( const QString & n ) { if ( !dictModFiles ) return QString::null; QString * ret = ( *dictModFiles )[ n.upper()]; if ( !ret ) return QString::null; return *ret; }
int Font::width(QChar *chs, int, int pos, int len, int start, int end, int toAdd) const { const QConstString cstr(chs + pos, len); int w = 0; const QString qstr = cstr.string(); if(scFont) { const QString upper = qstr.upper(); const QChar *uc = qstr.unicode(); const QFontMetrics sc_fm(*scFont); for(int i = 0; i < len; ++i) { if((uc + i)->category() == QChar::Letter_Lowercase) w += sc_fm.charWidth(upper, i); else w += fm.charWidth(qstr, i); } } else { // ### might be a little inaccurate w = fm.width(qstr); } if(letterSpacing) w += len * letterSpacing; if(wordSpacing) // add amount for(int i = 0; i < len; ++i) { if(chs[i + pos].category() == QChar::Separator_Space) w += wordSpacing; } if(toAdd) { // first gather count of spaces int numSpaces = 0; for(int i = start; i != end; ++i) if(chs[i].category() == QChar::Separator_Space) ++numSpaces; // distribute pixels evenly among spaces, but count only those within // [pos, pos+len) for(int i = start; numSpaces && i != pos + len; i++) if(chs[i].category() == QChar::Separator_Space) { const int a = toAdd / numSpaces; if(i >= pos) w += a; toAdd -= a; --numSpaces; } } return w; }
QString FLManagerModules::versionModule( const QString & idM ) { if ( !dictInfoMods ) return idM; FLInfoMod * iM = ( *dictInfoMods )[ idM.upper()]; if ( iM ) return iM->version; else return idM; }
QString FLManagerModules::idModuleToDescription( const QString & idM ) { if ( !dictInfoMods ) return idM; FLInfoMod * iM = ( *dictInfoMods )[ idM.upper()]; if ( iM ) return iM->descripcion; else return idM; }
void ImageParser::tag_start(const QString &tag, const list<QString> &attrs) { QString oTag = tag; if (tag == "html"){ res = ""; m_bBody = false; return; } if (tag == "body"){ startBody(); // We still want BODY's styles oTag = "span"; } if (!m_bBody) return; if (tag == "img"){ QString src; for (list<QString>::const_iterator it = attrs.begin(); it != attrs.end(); ++it){ QString name = *it; ++it; QString value = *it; if (name == "src"){ src = value; break; } } if (src.left(10) != "icon:smile") return; bool bOK; unsigned nIcon = src.mid(10).toUInt(&bOK, 16); if (!bOK) return; if (nIcon >= m_maxSmile){ const smile *p = smiles(nIcon); if (p){ res += p->paste; return; } } } res += "<"; res += oTag; for (list<QString>::const_iterator it = attrs.begin(); it != attrs.end(); ++it){ QString name = *it; ++it; QString value = *it; res += " "; res += name.upper(); if (!value.isEmpty()){ res += "=\""; res += quoteString(value); res += "\""; } } res += ">"; }
bool RDGroupList::isGroupValid(QString group) { for(unsigned i=0; i<list_groups.size(); i++) { if(list_groups[i].upper()==group.upper()) { return true; } } return false; }
QString Kleo::DN::operator[]( const QString & attr ) const { if ( !d ) return QString::null; const QString attrUpper = attr.upper(); for ( QValueVector<Attribute>::const_iterator it = d->attributes.begin() ; it != d->attributes.end() ; ++it ) if ( (*it).name() == attrUpper ) return (*it).value(); return QString::null; }
void TextField::setAlignment( const QString &align ) { QString a = align.upper(); if( a == "LEFT" || a.isEmpty() ) alignment = Qt::AlignLeft; if( a == "RIGHT" ) alignment = Qt::AlignRight; if( a == "CENTER" ) alignment = Qt::AlignHCenter; }
QKeySequence::QKeySequence( const QString& key ) { int k = 0; int p = key.findRev( '+', key.length() - 2 ); // -2 so that Ctrl++ works QString name; if ( p > 0 ) { name = key.mid( p + 1 ); } else { name = key; } int fnum = 0; if ( name.length() == 1 ) { if ( name.at(0).isLetterOrNumber() ) { QString uppname = name.upper(); k = uppname[0].unicode(); } else { k = name[0].unicode() | UNICODE_ACCEL; } } else if ( name[0] == 'F' && (fnum = name.mid(1).toInt()) ) { k = Key_F1 + fnum - 1; } else { for ( int tran = 0; tran < 2; tran++ ) { for ( int i = 0; keyname[i].name; i++ ) { if ( tran ? name == QAccel::tr(keyname[i].name) : name == keyname[i].name ) { k = keyname[i].key; goto done; } } } } done: if ( p > 0 ) { QString sl = key.lower(); #ifdef QMAC_CTRL if ( sl.contains(QMAC_CTRL+"+") ) k |= CTRL; #endif if ( sl.contains("ctrl+") || sl.contains(QAccel::tr("Ctrl").lower() + "+") ) k |= CTRL; #ifdef QMAC_ALT if ( sl.contains(QMAC_ALT+"+") ) k |= ALT; #endif if ( sl.contains("alt+") || sl.contains(QAccel::tr("Alt").lower() + "+") ) k |= ALT; if ( sl.contains("shift+") || sl.contains(QAccel::tr("Shift").lower() + "+") ) k |= SHIFT; } d = new QKeySequencePrivate( k ); }
bool WPAccount::checkHost(const QString &Name) { // kdDebug() << "WPAccount::checkHost: " << Name << endl; if (Name.upper() == QString::fromLatin1("LOCALHOST")) { // Assume localhost is always there, but it will not appear in the samba output. // Should never happen as localhost is now forbidden as contact, just for safety. GF return true; } else { return mProtocol->checkHost(Name); } }
// *** V I D E O *************************************************************************************************************** // Read local supported Payload Type for received VIDEO Encoding Name QString SdpBuild::readSupportedVideoPayloadType( QString receivedEncodingName ) { QString localPayloadType = "-1"; // init: Payload Type not supported int suppMediaNumber = sessionC->getTotalNumberOfPrefVideoCodecs(); // Anzahl aller Video-Codecs, die wir untersttzen for (int prio = 0; prio < suppMediaNumber; prio++) { if (receivedEncodingName.upper() == sessionC->getVidPrefCodec(prio)) { localPayloadType = sessionC->getVidPrefCodecNum(prio); break; } } return localPayloadType; }
QString FLManagerModules::shaOfFile( const QString & n ) { if ( db_->dbAux() && n.left( 3 ) != "sys" && !db_->manager()->isSystemTable( n ) ) { QSqlQuery q( QString::null, db_->dbAux() ); q.setForwardOnly( true ); q.exec( "SELECT sha FROM flfiles WHERE upper(nombre) = '" + n.upper() + "'" ); if ( q.next() ) return q.value( 0 ).toString(); return QString::null; } else return QString::null; }
QString FLManagerModules::idAreaToDescription( const QString & idA ) { if ( dictInfoMods ) { QDictIterator < FLInfoMod > it( *dictInfoMods ); while ( it.current() ) { if ( it.current() ->idArea.upper() == idA.upper() ) return it.current() ->areaDescripcion; ++it; } } return idA; }
QStringList FLManagerModules::listIdModules( const QString & idA ) { QStringList ret; if ( dictInfoMods ) { QDictIterator < FLInfoMod > it( *dictInfoMods ); while ( it.current() ) { if ( it.current() ->idArea.upper() == idA.upper() ) ret << it.current() ->idModulo; ++it; } } return ret; }