summaryrefslogtreecommitdiff
path: root/noncore/apps
Side-by-side diff
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp7
-rw-r--r--noncore/apps/opie-console/procctl.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp123
3 files changed, 69 insertions, 66 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
@@ -244,4 +244,5 @@ void MainWindow::slotEdit()
void MainWindow::openBook(QListViewItem *curritem)
{
+ if ( !curritem ) return;
// find book in List
QString currname=curritem->text(posName);
@@ -278,8 +279,6 @@ void MainWindow::openBook(QListViewItem *curritem)
{
// Update name if changed
- if( curritem ) {
- curritem->setText( posName, newname );
- cbList->sort();
- }
+ curritem->setText( posName, newname );
+ cbList->sort();
_cfg.setLastBook( newname );
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
@@ -50,5 +50,8 @@ void ProcCtl::remove( pid_t pi ) {
/* remove it */
if ( pi == con->pid ) {
- forw->prev = con->prev;
+ if (forw)
+ forw->prev = con->prev;
+ else
+ forw = con->prev;
delete con;
return;
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
@@ -2016,5 +2016,5 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
int z, x;
QChar ch;
- Attribute *a = 0L;
+ Attribute *attrptr = 0L;
int attr, nextAttr;
int xs;
@@ -2041,14 +2041,14 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
x += m_tabWidth - (x % m_tabWidth);
} else {
- a = &m_attribs[textLine->getAttr(z)];
-
- if (a->bold && a->italic)
- x += myFontMetricsBI.width(ch);
- else if (a->bold)
- x += myFontMetricsBold.width(ch);
- else if (a->italic)
- x += myFontMetricsItalic.width(ch);
- else
- x += myFontMetrics.width(ch);
+ attrptr = &m_attribs[textLine->getAttr(z)];
+
+ if (attrptr->bold && attrptr->italic)
+ x += myFontMetricsBI.width(ch);
+ else if (attrptr->bold)
+ x += myFontMetricsBold.width(ch);
+ else if (attrptr->italic)
+ x += myFontMetricsItalic.width(ch);
+ else
+ x += myFontMetrics.width(ch);
}
z++;
@@ -2080,11 +2080,11 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
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
@@ -2115,12 +2115,12 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
paint.drawText(x - xStart, y, s);
- if (a->bold && a->italic)
- x += myFontMetricsBI.width(s);
- else if (a->bold)
- x += myFontMetricsBold.width(s);
- else if (a->italic)
- x += myFontMetricsItalic.width(s);
- else
- x += myFontMetrics.width(s);
+ if (attrptr && attrptr->bold && attrptr->italic)
+ x += myFontMetricsBI.width(s);
+ else if (attrptr && attrptr->bold)
+ x += myFontMetricsBold.width(s);
+ else if (attrptr && attrptr->italic)
+ x += myFontMetricsItalic.width(s);
+ else
+ x += myFontMetrics.width(s);
}
zc = z +1;
@@ -2130,21 +2130,19 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
if (nextAttr != attr) {
attr = nextAttr;
- a = &m_attribs[attr & taAttrMask];
-
- if (attr & taSelected) paint.setPen(a->selCol);
- else paint.setPen(a->col);
-
- if (a->bold && a->italic)
- paint.setFont(myFontBI);
- else if (a->bold)
- paint.setFont(myFontBold);
- else if (a->italic)
- paint.setFont(myFontItalic);
- else
- paint.setFont(myFont);
+ attrptr = &m_attribs[attr & taAttrMask];
+
+ if (attr & taSelected) paint.setPen(attrptr->selCol);
+ else paint.setPen(attrptr->col);
+
+ if (attrptr->bold && attrptr->italic)
+ paint.setFont(myFontBI);
+ else if (attrptr->bold)
+ paint.setFont(myFontBold);
+ 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);
@@ -2160,28 +2158,28 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
paint.drawText(x - xStart, y, s);
- if (a->bold && a->italic)
- x += myFontMetricsBI.width(s);
- else if (a->bold)
- x += myFontMetricsBold.width(s);
- else if (a->italic)
- x += myFontMetricsItalic.width(s);
- else
- x += myFontMetrics.width(s);
+ if (attrptr->bold && attrptr->italic)
+ x += myFontMetricsBI.width(s);
+ else if (attrptr->bold)
+ x += myFontMetricsBold.width(s);
+ else if (attrptr->italic)
+ x += myFontMetricsItalic.width(s);
+ else
+ x += myFontMetrics.width(s);
zc = z;
}
attr = nextAttr;
- a = &m_attribs[attr & taAttrMask];
-
- if (attr & taSelected) paint.setPen(a->selCol);
- else paint.setPen(a->col);
-
- if (a->bold && a->italic)
- paint.setFont(myFontBI);
- else if (a->bold)
- paint.setFont(myFontBold);
- else if (a->italic)
- paint.setFont(myFontItalic);
- else
- paint.setFont(myFont);
+ attrptr = &m_attribs[attr & taAttrMask];
+
+ if (attr & taSelected) paint.setPen(attrptr->selCol);
+ else paint.setPen(attrptr->col);
+
+ if (attrptr->bold && attrptr->italic)
+ paint.setFont(myFontBI);
+ else if (attrptr->bold)
+ paint.setFont(myFontBold);
+ else if (attrptr->italic)
+ paint.setFont(myFontItalic);
+ else
+ paint.setFont(myFont);
}
}
@@ -2228,5 +2226,7 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
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) {
@@ -2289,5 +2289,6 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
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) {