-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/procctl.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 63 |
3 files changed, 36 insertions, 33 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index d9e2047..8e2e2e3 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -240,12 +240,13 @@ void MainWindow::slotEdit() } // --- openBook --------------------------------------------------------------- void MainWindow::openBook(QListViewItem *curritem) { + if ( !curritem ) return; // find book in List QString currname=curritem->text(posName); CBInfo *cb = checkbooks->first(); while ( cb ) { if ( cb->name() == currname ) break; @@ -274,16 +275,14 @@ void MainWindow::openBook(QListViewItem *curritem) if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) { QString newname = cb->name(); if ( currname != newname ) { // Update name if changed - if( curritem ) { curritem->setText( posName, newname ); cbList->sort(); - } _cfg.setLastBook( newname ); // Remove old file QFile f( tempFilename ); if ( f.exists() ) f.remove(); diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp index a44529b..5239e26 100644 --- a/noncore/apps/opie-console/procctl.cpp +++ b/noncore/apps/opie-console/procctl.cpp @@ -46,13 +46,16 @@ void ProcCtl::remove( pid_t pi ) { con = m_last; ProcContainer* forw = 0l; while (con ) { /* remove it */ if ( pi == con->pid ) { + if (forw) forw->prev = con->prev; + else + forw = con->prev; delete con; return; } forw = con; con = con->prev; diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index b82a86a..692fd46 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -2012,13 +2012,13 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i { TextLine::Ptr textLine; int len; const QChar *s; int z, x; QChar ch; - Attribute *a = 0L; + Attribute *attrptr = 0L; int attr, nextAttr; int xs; int xc, zc; if (line > lastLine()) { paint.fillRect(0, y, xEnd - xStart,fontHeight, colors[0]); @@ -2037,19 +2037,19 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i zc = z; if (z == len) break; ch = s[z];//textLine->getChar(z); if (ch == '\t') { x += m_tabWidth - (x % m_tabWidth); } else { - a = &m_attribs[textLine->getAttr(z)]; + attrptr = &m_attribs[textLine->getAttr(z)]; - if (a->bold && a->italic) + if (attrptr->bold && attrptr->italic) x += myFontMetricsBI.width(ch); - else if (a->bold) + else if (attrptr->bold) x += myFontMetricsBold.width(ch); - else if (a->italic) + else if (attrptr->italic) x += myFontMetricsItalic.width(ch); else x += myFontMetrics.width(ch); } z++; } while (x <= xStart); @@ -2076,19 +2076,19 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i ch = s[z];//textLine->getChar(z); if (ch == '\t') x += m_tabWidth - (x % m_tabWidth); else { - a = &m_attribs[textLine->getAttr(z)]; + attrptr = &m_attribs[textLine->getAttr(z)]; - if (a->bold && a->italic) + if (attrptr->bold && attrptr->italic) x += myFontMetricsBI.width(ch); - else if (a->bold) + else if (attrptr->bold) x += myFontMetricsBold.width(ch); - else if (a->italic) + else if (attrptr->italic) x += myFontMetricsItalic.width(ch); else x += myFontMetrics.width(ch); } z++; } @@ -2111,44 +2111,42 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i if (z > zc) { //this should cause no copy at all QConstString str((QChar *) &s[zc], z - zc /*+1*/); QString s = str.string(); paint.drawText(x - xStart, y, s); - if (a->bold && a->italic) + if (attrptr && attrptr->bold && attrptr->italic) x += myFontMetricsBI.width(s); - else if (a->bold) + else if (attrptr && attrptr->bold) x += myFontMetricsBold.width(s); - else if (a->italic) + else if (attrptr && attrptr->italic) x += myFontMetricsItalic.width(s); else x += myFontMetrics.width(s); } zc = z +1; if (showTabs) { nextAttr = textLine->getRawAttr(z); if (nextAttr != attr) { attr = nextAttr; - a = &m_attribs[attr & taAttrMask]; + attrptr = &m_attribs[attr & taAttrMask]; - if (attr & taSelected) paint.setPen(a->selCol); - else paint.setPen(a->col); + if (attr & taSelected) paint.setPen(attrptr->selCol); + else paint.setPen(attrptr->col); - if (a->bold && a->italic) + if (attrptr->bold && attrptr->italic) paint.setFont(myFontBI); - else if (a->bold) + else if (attrptr->bold) paint.setFont(myFontBold); - else if (a->italic) + else if (attrptr->italic) paint.setFont(myFontItalic); else paint.setFont(myFont); } -// paint.drawLine(x - xStart, y -2, x - xStart, y); -// paint.drawLine(x - xStart, y, x - xStart + 2, y); paint.drawPoint(x - xStart, y); paint.drawPoint(x - xStart +1, y); paint.drawPoint(x - xStart, y -1); } x += m_tabWidth - (x % m_tabWidth); } else { @@ -2156,33 +2154,33 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i if (nextAttr != attr) { if (z > zc) { QConstString str((QChar *) &s[zc], z - zc /*+1*/); QString s = str.string(); paint.drawText(x - xStart, y, s); - if (a->bold && a->italic) + if (attrptr->bold && attrptr->italic) x += myFontMetricsBI.width(s); - else if (a->bold) + else if (attrptr->bold) x += myFontMetricsBold.width(s); - else if (a->italic) + else if (attrptr->italic) x += myFontMetricsItalic.width(s); else x += myFontMetrics.width(s); zc = z; } attr = nextAttr; - a = &m_attribs[attr & taAttrMask]; + attrptr = &m_attribs[attr & taAttrMask]; - if (attr & taSelected) paint.setPen(a->selCol); - else paint.setPen(a->col); + if (attr & taSelected) paint.setPen(attrptr->selCol); + else paint.setPen(attrptr->col); - if (a->bold && a->italic) + if (attrptr->bold && attrptr->italic) paint.setFont(myFontBI); - else if (a->bold) + else if (attrptr->bold) paint.setFont(myFontBold); - else if (a->italic) + else if (attrptr->italic) paint.setFont(myFontItalic); else paint.setFont(myFont); } } z++; @@ -2224,13 +2222,15 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { textLine = getTextLine(line); tlen = textLine->length(); if (tlen > bufLen) { delete [] t; bufLen = (tlen + 255) & (~255); t = new QChar[bufLen]; - } + } else if (!t) + t = new QChar[bufLen]; + memcpy(t, textLine->getText(), tlen*sizeof(QChar)); if (sc.flags & KateView::sfSelected) { pos = 0; do { pos = textLine->findSelected(pos); newPos = textLine->findUnselected(pos); @@ -2285,13 +2285,14 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { textLine = getTextLine(line); tlen = textLine->length(); if (tlen > bufLen) { delete [] t; bufLen = (tlen + 255) & (~255); t = new QChar[bufLen]; - } + } else if (!t) + t = new QChar[bufLen]; memcpy(t, textLine->getText(), tlen*sizeof(QChar)); if (sc.flags & KateView::sfSelected) { pos = 0; do { pos = textLine->findSelected(pos); newPos = textLine->findUnselected(pos); |