示例#1
0
	QStringList entryList( QDir::Filters filters, const QStringList & nameFilters ) const
	{
		QStringList entries = QFSFileEngine::entryList( filters, nameFilters );
		
		if ( filters.testFlag( QDir::Dirs ) || filters.testFlag( QDir::AllDirs ) )
		{
			QMutexLocker lock( & overlayMutex );
			
			QString dirname = fileName( AbsoluteName );
			if ( ! caseSensitive() )
				dirname = dirname.toLower();
			
			if ( overlayDirs.contains( dirname ) )
			{
				QStringList list = overlayDirs.value( dirname );
				qDebug() << dirname << "overlay" << list;
				
				foreach ( QString x, list )
				{
					if ( ! entries.contains( x ) )
					{
						entries += x;
					}
				}
			}
void CFindDialog::saveSearchSettings() const
{
	CSettings s;
	s.setValue(_settingsRootCategory + SETTINGS_BACKWARDS, searchBackwards());
	s.setValue(_settingsRootCategory + SETTINGS_CASE_SENSITIVE, caseSensitive());
	s.setValue(_settingsRootCategory + SETTINGS_REGEX, regex());
	s.setValue(_settingsRootCategory + SETTINGS_WHOLE_WORDS, wholeWords());

}
示例#3
0
/******************************************************************************
 * Protected Methods                                                          *
 *****************************************************************************/
bool KIconViewSearchLine::itemMatches(const QIconViewItem *item, const QString &s) const
{
    if(s.isEmpty())
        return true;

    if(item == NULL)
        return false;

    return (item->text().find(s, 0, caseSensitive()) >= 0);
}
/******************************************************************************
 * Protected Methods                                                          *
 *****************************************************************************/
bool K3IconViewSearchLine::itemMatches( const Q3IconViewItem *item,
				       const QString &s ) const
{
  if ( s.isEmpty() )
    return true;

  if ( item == NULL )
    return false;

  return ( item->text().indexOf( s, 0,
	       caseSensitive()?Qt::CaseSensitive:Qt::CaseInsensitive ) >= 0 );
}
示例#5
0
QDebug operator<<(QDebug debug, const HighlightingRule &c)
{
   QDebugStateSaver saver(debug);
   QString caseSensitive(c.caseSensitivity() == Qt::CaseSensitive ? "true" : "false");
   debug.nospace() << "HighlightingRule(" << c.text() <<
                      ", bg-color: " << c.backgroundColor() <<
                      ", fg-color: " << c.foregroundColor() <<
                      ", font: " << c.font() <<
                      ", casesensitive: " << caseSensitive <<
                      ')';

   return debug;
}
示例#6
0
QTextDocument::FindFlags SearchWidget::findFlags() const
{
    QTextDocument::FindFlags flags = 0;
    if (wholeWordsOnly())
    {
        flags |= QTextDocument::FindWholeWords;
    }
    if (caseSensitive())
    {
        flags |= QTextDocument::FindCaseSensitively;
    }
    return flags;
}
示例#7
0
/*!
    \reimp
 */
void TextEditFindWidget::find(const QString &ttf, bool skipCurrent, bool backward, bool *found, bool *wrapped)
{
    if (!m_textEdit)
        return;

    QTextCursor cursor = m_textEdit->textCursor();
    QTextDocument *doc = m_textEdit->document();

    if (!doc || cursor.isNull())
        return;

    if (cursor.hasSelection())
        cursor.setPosition((skipCurrent && !backward) ? cursor.position() : cursor.anchor());

    *found = true;
    QTextCursor newCursor = cursor;

    if (!ttf.isEmpty()) {
        QTextDocument::FindFlags options;

        if (backward)
            options |= QTextDocument::FindBackward;

        if (caseSensitive())
            options |= QTextDocument::FindCaseSensitively;

        if (wholeWords())
            options |= QTextDocument::FindWholeWords;

        newCursor = doc->find(ttf, cursor, options);
        if (newCursor.isNull()) {
            QTextCursor ac(doc);
            ac.movePosition(options & QTextDocument::FindBackward
                    ? QTextCursor::End : QTextCursor::Start);
            newCursor = doc->find(ttf, ac, options);
            if (newCursor.isNull()) {
                *found = false;
                newCursor = cursor;
            } else {
                *wrapped = true;
            }
        }
    }

    if (!isVisible())
        show();

    m_textEdit->setTextCursor(newCursor);
}
示例#8
0
QTextCursor FindDialog::find(const QTextCursor &start, const QTextDocument *doc) {
   if (start.isNull())
      return start;

   const QString &searchString = getSearchString();
   
   QTextDocument::FindFlags findFlags = 0;
   if (findBackwards())
      findFlags |= QTextDocument::FindBackward;
   if (caseSensitive())
      findFlags |= QTextDocument::FindCaseSensitively;
   if (wholeWordsOnly())
      findFlags |= QTextDocument::FindWholeWords;
   
   if (regularExpression())
      return doc->find(QRegExp(searchString), start, findFlags);

   // plain-text search
   return doc->find(searchString, start, findFlags);
}
void DefaultValidator::applyUpper(NAString &value) const
{
  switch (caseSensitive()) {
    case CASE_SENSITIVE:	return;
    case CASE_INSENSITIVE:	value.toUpper(); return;
    case CASE_SENSITIVE_ANSI:	{
				  // Make copy of value so we can own its data()
				  // for casting away const-ness.
				  NAString tmp(value);
				  char *s = (char *)tmp.data();
				  for (NABoolean quoted = FALSE; *s; s++) {
				    if (*s == '"')
				      quoted = !quoted;
				    else if (!quoted)
#pragma nowarn(1506)   // warning elimination 
				      *s = toupper(*s);
#pragma warn(1506)  // warning elimination 
				  }
				  value = tmp;
				  return;
    				}
    default:			CMPASSERT(FALSE);
  }
}