-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 | |||
@@ -238,16 +238,17 @@ void MainWindow::slotEdit() | |||
238 | return; | 238 | return; |
239 | openBook( curritem ); | 239 | openBook( curritem ); |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | // --- openBook --------------------------------------------------------------- | 243 | // --- openBook --------------------------------------------------------------- |
244 | void MainWindow::openBook(QListViewItem *curritem) | 244 | void MainWindow::openBook(QListViewItem *curritem) |
245 | { | 245 | { |
246 | if ( !curritem ) return; | ||
246 | // find book in List | 247 | // find book in List |
247 | QString currname=curritem->text(posName); | 248 | QString currname=curritem->text(posName); |
248 | CBInfo *cb = checkbooks->first(); | 249 | CBInfo *cb = checkbooks->first(); |
249 | while ( cb ) { | 250 | while ( cb ) { |
250 | if ( cb->name() == currname ) | 251 | if ( cb->name() == currname ) |
251 | break; | 252 | break; |
252 | cb = checkbooks->next(); | 253 | cb = checkbooks->next(); |
253 | } | 254 | } |
@@ -272,20 +273,18 @@ void MainWindow::openBook(QListViewItem *curritem) | |||
272 | _cfg.setLastBook( currname ); | 273 | _cfg.setLastBook( currname ); |
273 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 274 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
274 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) | 275 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
275 | { | 276 | { |
276 | QString newname = cb->name(); | 277 | QString newname = cb->name(); |
277 | if ( currname != newname ) | 278 | if ( currname != newname ) |
278 | { | 279 | { |
279 | // Update name if changed | 280 | // Update name if changed |
280 | if( curritem ) { | ||
281 | curritem->setText( posName, newname ); | 281 | curritem->setText( posName, newname ); |
282 | cbList->sort(); | 282 | cbList->sort(); |
283 | } | ||
284 | _cfg.setLastBook( newname ); | 283 | _cfg.setLastBook( newname ); |
285 | 284 | ||
286 | // Remove old file | 285 | // Remove old file |
287 | QFile f( tempFilename ); | 286 | QFile f( tempFilename ); |
288 | if ( f.exists() ) | 287 | if ( f.exists() ) |
289 | f.remove(); | 288 | f.remove(); |
290 | 289 | ||
291 | // Get new filename | 290 | // Get new filename |
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 | |||
@@ -44,17 +44,20 @@ void ProcCtl::remove( pid_t pi ) { | |||
44 | return; | 44 | return; |
45 | } | 45 | } |
46 | 46 | ||
47 | con = m_last; | 47 | con = m_last; |
48 | ProcContainer* forw = 0l; | 48 | ProcContainer* forw = 0l; |
49 | while (con ) { | 49 | while (con ) { |
50 | /* remove it */ | 50 | /* remove it */ |
51 | if ( pi == con->pid ) { | 51 | if ( pi == con->pid ) { |
52 | if (forw) | ||
52 | forw->prev = con->prev; | 53 | forw->prev = con->prev; |
54 | else | ||
55 | forw = con->prev; | ||
53 | delete con; | 56 | delete con; |
54 | return; | 57 | return; |
55 | } | 58 | } |
56 | 59 | ||
57 | forw = con; | 60 | forw = con; |
58 | con = con->prev; | 61 | con = con->prev; |
59 | } | 62 | } |
60 | 63 | ||
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 | |||
@@ -2010,17 +2010,17 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int xStart, int xEnd | |||
2010 | 2010 | ||
2011 | void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, int xEnd, bool showTabs) | 2011 | void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, int xEnd, bool showTabs) |
2012 | { | 2012 | { |
2013 | TextLine::Ptr textLine; | 2013 | TextLine::Ptr textLine; |
2014 | int len; | 2014 | int len; |
2015 | const QChar *s; | 2015 | const QChar *s; |
2016 | int z, x; | 2016 | int z, x; |
2017 | QChar ch; | 2017 | QChar ch; |
2018 | Attribute *a = 0L; | 2018 | Attribute *attrptr = 0L; |
2019 | int attr, nextAttr; | 2019 | int attr, nextAttr; |
2020 | int xs; | 2020 | int xs; |
2021 | int xc, zc; | 2021 | int xc, zc; |
2022 | 2022 | ||
2023 | if (line > lastLine()) { | 2023 | if (line > lastLine()) { |
2024 | paint.fillRect(0, y, xEnd - xStart,fontHeight, colors[0]); | 2024 | paint.fillRect(0, y, xEnd - xStart,fontHeight, colors[0]); |
2025 | return; | 2025 | return; |
2026 | } | 2026 | } |
@@ -2035,23 +2035,23 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i | |||
2035 | do { | 2035 | do { |
2036 | xc = x; | 2036 | xc = x; |
2037 | zc = z; | 2037 | zc = z; |
2038 | if (z == len) break; | 2038 | if (z == len) break; |
2039 | ch = s[z];//textLine->getChar(z); | 2039 | ch = s[z];//textLine->getChar(z); |
2040 | if (ch == '\t') { | 2040 | if (ch == '\t') { |
2041 | x += m_tabWidth - (x % m_tabWidth); | 2041 | x += m_tabWidth - (x % m_tabWidth); |
2042 | } else { | 2042 | } else { |
2043 | a = &m_attribs[textLine->getAttr(z)]; | 2043 | attrptr = &m_attribs[textLine->getAttr(z)]; |
2044 | 2044 | ||
2045 | if (a->bold && a->italic) | 2045 | if (attrptr->bold && attrptr->italic) |
2046 | x += myFontMetricsBI.width(ch); | 2046 | x += myFontMetricsBI.width(ch); |
2047 | else if (a->bold) | 2047 | else if (attrptr->bold) |
2048 | x += myFontMetricsBold.width(ch); | 2048 | x += myFontMetricsBold.width(ch); |
2049 | else if (a->italic) | 2049 | else if (attrptr->italic) |
2050 | x += myFontMetricsItalic.width(ch); | 2050 | x += myFontMetricsItalic.width(ch); |
2051 | else | 2051 | else |
2052 | x += myFontMetrics.width(ch); | 2052 | x += myFontMetrics.width(ch); |
2053 | } | 2053 | } |
2054 | z++; | 2054 | z++; |
2055 | } while (x <= xStart); | 2055 | } while (x <= xStart); |
2056 | 2056 | ||
2057 | // draw background | 2057 | // draw background |
@@ -2074,23 +2074,23 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i | |||
2074 | if (z == len) break; | 2074 | if (z == len) break; |
2075 | 2075 | ||
2076 | ch = s[z];//textLine->getChar(z); | 2076 | ch = s[z];//textLine->getChar(z); |
2077 | 2077 | ||
2078 | if (ch == '\t') | 2078 | if (ch == '\t') |
2079 | x += m_tabWidth - (x % m_tabWidth); | 2079 | x += m_tabWidth - (x % m_tabWidth); |
2080 | else | 2080 | else |
2081 | { | 2081 | { |
2082 | a = &m_attribs[textLine->getAttr(z)]; | 2082 | attrptr = &m_attribs[textLine->getAttr(z)]; |
2083 | 2083 | ||
2084 | if (a->bold && a->italic) | 2084 | if (attrptr->bold && attrptr->italic) |
2085 | x += myFontMetricsBI.width(ch); | 2085 | x += myFontMetricsBI.width(ch); |
2086 | else if (a->bold) | 2086 | else if (attrptr->bold) |
2087 | x += myFontMetricsBold.width(ch); | 2087 | x += myFontMetricsBold.width(ch); |
2088 | else if (a->italic) | 2088 | else if (attrptr->italic) |
2089 | x += myFontMetricsItalic.width(ch); | 2089 | x += myFontMetricsItalic.width(ch); |
2090 | else | 2090 | else |
2091 | x += myFontMetrics.width(ch); | 2091 | x += myFontMetrics.width(ch); |
2092 | } | 2092 | } |
2093 | z++; | 2093 | z++; |
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | if (attr & taSelected) | 2096 | if (attr & taSelected) |
@@ -2109,82 +2109,80 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i | |||
2109 | ch = s[z];//textLine->getChar(z); | 2109 | ch = s[z];//textLine->getChar(z); |
2110 | if (ch == '\t') { | 2110 | if (ch == '\t') { |
2111 | if (z > zc) { | 2111 | if (z > zc) { |
2112 | //this should cause no copy at all | 2112 | //this should cause no copy at all |
2113 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); | 2113 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); |
2114 | QString s = str.string(); | 2114 | QString s = str.string(); |
2115 | paint.drawText(x - xStart, y, s); | 2115 | paint.drawText(x - xStart, y, s); |
2116 | 2116 | ||
2117 | if (a->bold && a->italic) | 2117 | if (attrptr && attrptr->bold && attrptr->italic) |
2118 | x += myFontMetricsBI.width(s); | 2118 | x += myFontMetricsBI.width(s); |
2119 | else if (a->bold) | 2119 | else if (attrptr && attrptr->bold) |
2120 | x += myFontMetricsBold.width(s); | 2120 | x += myFontMetricsBold.width(s); |
2121 | else if (a->italic) | 2121 | else if (attrptr && attrptr->italic) |
2122 | x += myFontMetricsItalic.width(s); | 2122 | x += myFontMetricsItalic.width(s); |
2123 | else | 2123 | else |
2124 | x += myFontMetrics.width(s); | 2124 | x += myFontMetrics.width(s); |
2125 | } | 2125 | } |
2126 | zc = z +1; | 2126 | zc = z +1; |
2127 | 2127 | ||
2128 | if (showTabs) { | 2128 | if (showTabs) { |
2129 | nextAttr = textLine->getRawAttr(z); | 2129 | nextAttr = textLine->getRawAttr(z); |
2130 | if (nextAttr != attr) { | 2130 | if (nextAttr != attr) { |
2131 | attr = nextAttr; | 2131 | attr = nextAttr; |
2132 | a = &m_attribs[attr & taAttrMask]; | 2132 | attrptr = &m_attribs[attr & taAttrMask]; |
2133 | 2133 | ||
2134 | if (attr & taSelected) paint.setPen(a->selCol); | 2134 | if (attr & taSelected) paint.setPen(attrptr->selCol); |
2135 | else paint.setPen(a->col); | 2135 | else paint.setPen(attrptr->col); |
2136 | 2136 | ||
2137 | if (a->bold && a->italic) | 2137 | if (attrptr->bold && attrptr->italic) |
2138 | paint.setFont(myFontBI); | 2138 | paint.setFont(myFontBI); |
2139 | else if (a->bold) | 2139 | else if (attrptr->bold) |
2140 | paint.setFont(myFontBold); | 2140 | paint.setFont(myFontBold); |
2141 | else if (a->italic) | 2141 | else if (attrptr->italic) |
2142 | paint.setFont(myFontItalic); | 2142 | paint.setFont(myFontItalic); |
2143 | else | 2143 | else |
2144 | paint.setFont(myFont); | 2144 | paint.setFont(myFont); |
2145 | } | 2145 | } |
2146 | 2146 | ||
2147 | // paint.drawLine(x - xStart, y -2, x - xStart, y); | ||
2148 | // paint.drawLine(x - xStart, y, x - xStart + 2, y); | ||
2149 | paint.drawPoint(x - xStart, y); | 2147 | paint.drawPoint(x - xStart, y); |
2150 | paint.drawPoint(x - xStart +1, y); | 2148 | paint.drawPoint(x - xStart +1, y); |
2151 | paint.drawPoint(x - xStart, y -1); | 2149 | paint.drawPoint(x - xStart, y -1); |
2152 | } | 2150 | } |
2153 | x += m_tabWidth - (x % m_tabWidth); | 2151 | x += m_tabWidth - (x % m_tabWidth); |
2154 | } else { | 2152 | } else { |
2155 | nextAttr = textLine->getRawAttr(z); | 2153 | nextAttr = textLine->getRawAttr(z); |
2156 | if (nextAttr != attr) { | 2154 | if (nextAttr != attr) { |
2157 | if (z > zc) { | 2155 | if (z > zc) { |
2158 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); | 2156 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); |
2159 | QString s = str.string(); | 2157 | QString s = str.string(); |
2160 | paint.drawText(x - xStart, y, s); | 2158 | paint.drawText(x - xStart, y, s); |
2161 | 2159 | ||
2162 | if (a->bold && a->italic) | 2160 | if (attrptr->bold && attrptr->italic) |
2163 | x += myFontMetricsBI.width(s); | 2161 | x += myFontMetricsBI.width(s); |
2164 | else if (a->bold) | 2162 | else if (attrptr->bold) |
2165 | x += myFontMetricsBold.width(s); | 2163 | x += myFontMetricsBold.width(s); |
2166 | else if (a->italic) | 2164 | else if (attrptr->italic) |
2167 | x += myFontMetricsItalic.width(s); | 2165 | x += myFontMetricsItalic.width(s); |
2168 | else | 2166 | else |
2169 | x += myFontMetrics.width(s); | 2167 | x += myFontMetrics.width(s); |
2170 | zc = z; | 2168 | zc = z; |
2171 | } | 2169 | } |
2172 | attr = nextAttr; | 2170 | attr = nextAttr; |
2173 | a = &m_attribs[attr & taAttrMask]; | 2171 | attrptr = &m_attribs[attr & taAttrMask]; |
2174 | 2172 | ||
2175 | if (attr & taSelected) paint.setPen(a->selCol); | 2173 | if (attr & taSelected) paint.setPen(attrptr->selCol); |
2176 | else paint.setPen(a->col); | 2174 | else paint.setPen(attrptr->col); |
2177 | 2175 | ||
2178 | if (a->bold && a->italic) | 2176 | if (attrptr->bold && attrptr->italic) |
2179 | paint.setFont(myFontBI); | 2177 | paint.setFont(myFontBI); |
2180 | else if (a->bold) | 2178 | else if (attrptr->bold) |
2181 | paint.setFont(myFontBold); | 2179 | paint.setFont(myFontBold); |
2182 | else if (a->italic) | 2180 | else if (attrptr->italic) |
2183 | paint.setFont(myFontItalic); | 2181 | paint.setFont(myFontItalic); |
2184 | else | 2182 | else |
2185 | paint.setFont(myFont); | 2183 | paint.setFont(myFont); |
2186 | } | 2184 | } |
2187 | } | 2185 | } |
2188 | z++; | 2186 | z++; |
2189 | } | 2187 | } |
2190 | if (z > zc) { | 2188 | if (z > zc) { |
@@ -2222,17 +2220,19 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { | |||
2222 | 2220 | ||
2223 | while (line <= searchEnd) { | 2221 | while (line <= searchEnd) { |
2224 | textLine = getTextLine(line); | 2222 | textLine = getTextLine(line); |
2225 | tlen = textLine->length(); | 2223 | tlen = textLine->length(); |
2226 | if (tlen > bufLen) { | 2224 | if (tlen > bufLen) { |
2227 | delete [] t; | 2225 | delete [] t; |
2228 | bufLen = (tlen + 255) & (~255); | 2226 | bufLen = (tlen + 255) & (~255); |
2229 | t = new QChar[bufLen]; | 2227 | t = new QChar[bufLen]; |
2230 | } | 2228 | } else if (!t) |
2229 | t = new QChar[bufLen]; | ||
2230 | |||
2231 | memcpy(t, textLine->getText(), tlen*sizeof(QChar)); | 2231 | memcpy(t, textLine->getText(), tlen*sizeof(QChar)); |
2232 | if (sc.flags & KateView::sfSelected) { | 2232 | if (sc.flags & KateView::sfSelected) { |
2233 | pos = 0; | 2233 | pos = 0; |
2234 | do { | 2234 | do { |
2235 | pos = textLine->findSelected(pos); | 2235 | pos = textLine->findSelected(pos); |
2236 | newPos = textLine->findUnselected(pos); | 2236 | newPos = textLine->findUnselected(pos); |
2237 | memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); | 2237 | memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); |
2238 | pos = newPos; | 2238 | pos = newPos; |
@@ -2283,17 +2283,18 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { | |||
2283 | 2283 | ||
2284 | while (line >= searchEnd) { | 2284 | while (line >= searchEnd) { |
2285 | textLine = getTextLine(line); | 2285 | textLine = getTextLine(line); |
2286 | tlen = textLine->length(); | 2286 | tlen = textLine->length(); |
2287 | if (tlen > bufLen) { | 2287 | if (tlen > bufLen) { |
2288 | delete [] t; | 2288 | delete [] t; |
2289 | bufLen = (tlen + 255) & (~255); | 2289 | bufLen = (tlen + 255) & (~255); |
2290 | t = new QChar[bufLen]; | 2290 | t = new QChar[bufLen]; |
2291 | } | 2291 | } else if (!t) |
2292 | t = new QChar[bufLen]; | ||
2292 | memcpy(t, textLine->getText(), tlen*sizeof(QChar)); | 2293 | memcpy(t, textLine->getText(), tlen*sizeof(QChar)); |
2293 | if (sc.flags & KateView::sfSelected) { | 2294 | if (sc.flags & KateView::sfSelected) { |
2294 | pos = 0; | 2295 | pos = 0; |
2295 | do { | 2296 | do { |
2296 | pos = textLine->findSelected(pos); | 2297 | pos = textLine->findSelected(pos); |
2297 | newPos = textLine->findUnselected(pos); | 2298 | newPos = textLine->findUnselected(pos); |
2298 | memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); | 2299 | memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); |
2299 | pos = newPos; | 2300 | pos = newPos; |