author | erik <erik> | 2007-02-08 01:46:35 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-08 01:46:35 (UTC) |
commit | 41dce553a418765d5075fc249c636104a2a82329 (patch) (side-by-side diff) | |
tree | ca9b39611b17355cf2cb1c890d68f3a008e38866 /noncore/apps | |
parent | 2e497f7cae45184184e2416114887095735958f5 (diff) | |
download | opie-41dce553a418765d5075fc249c636104a2a82329.zip opie-41dce553a418765d5075fc249c636104a2a82329.tar.gz opie-41dce553a418765d5075fc249c636104a2a82329.tar.bz2 |
Removal of useless code based on a conditional that is never set to anything
but false.
-rw-r--r-- | noncore/apps/opie-write/qrichtext.cpp | 72 |
1 files changed, 23 insertions, 49 deletions
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index 768da44..b457cd6 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp @@ -190,10 +190,7 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c ) { QTextParagraph *s = doc ? doc->paragAt( id ) : parag; - if ( !s && doc ) { + if ( !s ) { owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; - } else if ( !doc ) { - owarn << "No valid doc" << oendl; - return 0; } @@ -221,10 +218,7 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) { QTextParagraph *s = doc ? doc->paragAt( id ) : parag; - if ( !s && doc ) { + if ( !s ) { owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; return 0; - } else if ( !doc ) { - owarn << "No valid doc" << oendl; - return 0; } @@ -240,7 +234,4 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c ) for ( int i = 0; i < (int)text.size(); ++i ) c->gotoNextLetter(); - } else { - owarn << "No valid cursor" << oendl; - return 0; } @@ -1402,33 +1393,22 @@ struct Q_EXPORT QTextDocumentTag { -#define NEWPAR do { \ - if ( !hasNewPar) { \ - if ( !curpar ) { \ - owarn << "no current paragraph" << oendl; \ - return; \ - } \ - if ( !textEditMode && curpar && curpar->length()>1 && curpar->at( curpar->length()-2)->c == QChar_linesep ) \ - curpar->remove( curpar->length()-2, 1 ); \ - curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); \ - if ( !curpar ) { \ - owarn << "failed in creating a new paragraph" << oendl; \ - return; \ - } \ - vec = 0; \ - } \ - hasNewPar = TRUE; \ - curpar->rtext = TRUE; \ - curpar->align = curtag.alignment; \ - curpar->lstyle = curtag.liststyle; \ - curpar->litem = ( curtag.style->displayMode() == QStyleSheetItem::DisplayListItem ); \ - curpar->str->setDirection( (QChar::Direction)curtag.direction ); \ - space = TRUE; \ - delete vec; \ - vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \ - int i = 0; \ - for ( QValueStack<QTextDocumentTag>::Iterator it = tags.begin(); it != tags.end(); ++it ) \ - vec->insert( i++, (*it).style ); \ - vec->insert( i, curtag.style ); \ - } while ( FALSE ) +#define NEWPAR do{ if ( !hasNewPar) { \ + if ( !textEditMode && curpar && curpar->length()>1 && curpar->at( curpar->length()-2)->c == QChar_linesep ) \ + curpar->remove( curpar->length()-2, 1 ); \ + curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); vec = 0;} \ + hasNewPar = TRUE; \ + curpar->rtext = TRUE; \ + curpar->align = curtag.alignment; \ + curpar->lstyle = curtag.liststyle; \ + curpar->litem = ( curtag.style->displayMode() == QStyleSheetItem::DisplayListItem ); \ + curpar->str->setDirection( (QChar::Direction)curtag.direction ); \ + space = TRUE; \ + delete vec; vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \ + int i = 0; \ + for ( QValueStack<QTextDocumentTag>::Iterator it = tags.begin(); it != tags.end(); ++it ) \ + vec->insert( i++, (*it).style ); \ + vec->insert( i, curtag.style ); \ + }while(FALSE) + void QTextDocument::setRichText( const QString &text, const QString &context ) @@ -1916,9 +1896,6 @@ void QTextDocument::setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheet int i, mar; - QStyleSheetItem* mainStyle = (*curStyle)[curStyle->size()-1]; - if ( !mainStyle ) - return; - - if ( mainStyle->displayMode() == QStyleSheetItem::DisplayListItem ) + QStyleSheetItem* mainStyle = curStyle->size() ? (*curStyle)[curStyle->size()-1] : 0; + if ( mainStyle && mainStyle->displayMode() == QStyleSheetItem::DisplayListItem ) stylesPar->setListItem( TRUE ); int numLists = 0; @@ -3071,5 +3048,4 @@ QTextParagraph *QTextDocument::draw( QPainter *p, int cx, int cy, int cw, int ch QPainter painter; - bool fullWidthSelection = FALSE; while ( parag ) { lastFormatted = parag; @@ -3078,6 +3054,4 @@ QTextParagraph *QTextDocument::draw( QPainter *p, int cx, int cy, int cw, int ch QRect pr = parag->rect(); - if ( fullWidthSelection ) - pr.setWidth( parag->document()->width() ); if ( pr.y() > cy + ch ) goto floating; @@ -5365,5 +5339,5 @@ int QTextFormatterBreakWords::format( QTextDocument *doc, QTextParagraph *parag, lastChr = c->c; // ### next line should not be needed - if ( c && painter ) + if ( painter ) c->format()->setPainter( painter ); c = &string->at( i ); |