-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 2 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 10 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/procctl.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 123 | ||||
-rw-r--r-- | noncore/settings/sysinfo/devicesinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/todayplugins/stockticker/libstocks/http.c | 2 |
8 files changed, 83 insertions, 74 deletions
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index 78e919a..5d1e2cf 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -206,49 +206,49 @@ void OSplitter::removeWidget( OSplitter* split) | |||
206 | * @param label The label of the possible Tab | 206 | * @param label The label of the possible Tab |
207 | */ | 207 | */ |
208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) | 208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) |
209 | { | 209 | { |
210 | #ifdef DEBUG | 210 | #ifdef DEBUG |
211 | if (!wid ) | 211 | if (!wid ) |
212 | return; | 212 | return; |
213 | #endif | 213 | #endif |
214 | OSplitterContainer cont; | 214 | OSplitterContainer cont; |
215 | cont.widget = wid; | 215 | cont.widget = wid; |
216 | cont.icon =icon; | 216 | cont.icon =icon; |
217 | cont.name = label; | 217 | cont.name = label; |
218 | 218 | ||
219 | m_container.append( cont ); | 219 | m_container.append( cont ); |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * | 222 | * |
223 | */ | 223 | */ |
224 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 224 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
225 | setTabWidget( m_parentTab ); | 225 | setTabWidget( m_parentTab ); |
226 | else | 226 | else |
227 | { | 227 | { |
228 | if (m_hbox ) | 228 | if (m_hbox ) |
229 | addToBox( cont ); | 229 | addToBox( cont ); |
230 | else | 230 | else if (m_tabWidget) |
231 | addToTab( cont ); | 231 | addToTab( cont ); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Removes the widget from the tab widgets if necessary. | 237 | * Removes the widget from the tab widgets if necessary. |
238 | * OSplitter drops ownership of this widget and the widget | 238 | * OSplitter drops ownership of this widget and the widget |
239 | * will be reparented i tto 0. | 239 | * will be reparented i tto 0. |
240 | * The widget will not be deleted. | 240 | * The widget will not be deleted. |
241 | * | 241 | * |
242 | * @param w The widget to be removed | 242 | * @param w The widget to be removed |
243 | */ | 243 | */ |
244 | void OSplitter::removeWidget( QWidget* w) | 244 | void OSplitter::removeWidget( QWidget* w) |
245 | { | 245 | { |
246 | ContainerList::Iterator it; | 246 | ContainerList::Iterator it; |
247 | for ( it = m_container.begin(); it != m_container.end(); ++it ) | 247 | for ( it = m_container.begin(); it != m_container.end(); ++it ) |
248 | if ( (*it).widget == w ) | 248 | if ( (*it).widget == w ) |
249 | break; | 249 | break; |
250 | 250 | ||
251 | if (it == m_container.end() ) | 251 | if (it == m_container.end() ) |
252 | return; | 252 | return; |
253 | 253 | ||
254 | 254 | ||
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 34f5e6a..d959c7a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1748,54 +1748,54 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | |||
1748 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1748 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1749 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1749 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1750 | 1750 | ||
1751 | \sa showMainDocumentWidget() | 1751 | \sa showMainDocumentWidget() |
1752 | */ | 1752 | */ |
1753 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1753 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1754 | { | 1754 | { |
1755 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit | 1755 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit |
1756 | d->show(mw, nomaximize ); | 1756 | d->show(mw, nomaximize ); |
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | /*! | 1759 | /*! |
1760 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1760 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1761 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1761 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1762 | 1762 | ||
1763 | This calls designates the application as | 1763 | This calls designates the application as |
1764 | a \link docwidget.html document-oriented\endlink application. | 1764 | a \link docwidget.html document-oriented\endlink application. |
1765 | 1765 | ||
1766 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1766 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1767 | 1767 | ||
1768 | \sa showMainWidget() | 1768 | \sa showMainWidget() |
1769 | */ | 1769 | */ |
1770 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1770 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1771 | { | 1771 | { |
1772 | if ( mw && argc() == 2 ) | 1772 | if ( mw ) { |
1773 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1773 | if ( argc() == 2 ) |
1774 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | ||
1774 | 1775 | ||
1775 | 1776 | d->show(mw, nomaximize ); | |
1776 | // setMainWidget(mw); see above | 1777 | } |
1777 | d->show(mw, nomaximize ); | ||
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | 1780 | ||
1781 | /*! | 1781 | /*! |
1782 | If an application is started via a \link qcop.html QCop\endlink | 1782 | If an application is started via a \link qcop.html QCop\endlink |
1783 | message, the application will process the \link qcop.html | 1783 | message, the application will process the \link qcop.html |
1784 | QCop\endlink message and then quit. If the application calls this | 1784 | QCop\endlink message and then quit. If the application calls this |
1785 | function while processing a \link qcop.html QCop\endlink message, | 1785 | function while processing a \link qcop.html QCop\endlink message, |
1786 | after processing its outstanding \link qcop.html QCop\endlink | 1786 | after processing its outstanding \link qcop.html QCop\endlink |
1787 | messages the application will start 'properly' and show itself. | 1787 | messages the application will start 'properly' and show itself. |
1788 | 1788 | ||
1789 | \sa keepRunning() | 1789 | \sa keepRunning() |
1790 | */ | 1790 | */ |
1791 | void QPEApplication::setKeepRunning() | 1791 | void QPEApplication::setKeepRunning() |
1792 | { | 1792 | { |
1793 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1793 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1794 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1794 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1795 | qpeApp->d->keep_running = TRUE; | 1795 | qpeApp->d->keep_running = TRUE; |
1796 | } | 1796 | } |
1797 | } | 1797 | } |
1798 | 1798 | ||
1799 | /*! | 1799 | /*! |
1800 | Returns TRUE if the application will quit after processing the | 1800 | Returns TRUE if the application will quit after processing the |
1801 | current list of qcop messages; otherwise returns FALSE. | 1801 | current list of qcop messages; otherwise returns FALSE. |
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index 187adc6..c639002 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp | |||
@@ -215,48 +215,54 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
215 | ++it; | 215 | ++it; |
216 | continue; | 216 | continue; |
217 | } | 217 | } |
218 | else | 218 | else |
219 | { | 219 | { |
220 | theCard = it.current(); | 220 | theCard = it.current(); |
221 | QString cardName = theCard->productIdentity(); | 221 | QString cardName = theCard->productIdentity(); |
222 | for ( int i = 0; i < nCards; ++i ) | 222 | for ( int i = 0; i < nCards; ++i ) |
223 | { | 223 | { |
224 | QString cardSection = QString( "Card_%1" ).arg( i ); | 224 | QString cardSection = QString( "Card_%1" ).arg( i ); |
225 | cfg.setGroup( cardSection ); | 225 | cfg.setGroup( cardSection ); |
226 | QString name = cfg.readEntry( "name" ); | 226 | QString name = cfg.readEntry( "name" ); |
227 | odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | 227 | odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl; |
228 | if ( cardName == name ) | 228 | if ( cardName == name ) |
229 | { | 229 | { |
230 | newCard = false; | 230 | newCard = false; |
231 | odebug << "pcmcia: we have seen this card before" << oendl; | 231 | odebug << "pcmcia: we have seen this card before" << oendl; |
232 | executeAction( theCard, "insert" ); | 232 | executeAction( theCard, "insert" ); |
233 | break; | 233 | break; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | if ( !newCard ) ++it; else break; | 236 | if ( !newCard ) ++it; else break; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | |||
240 | if ( !theCard ) { | ||
241 | owarn << "pcmcia: Finished working through cards in PCMCIA system but I do not have a valid card handle" << oendl; | ||
242 | return; | ||
243 | } | ||
244 | |||
239 | if ( newCard ) | 245 | if ( newCard ) |
240 | { | 246 | { |
241 | odebug << "pcmcia: unconfigured card detected" << oendl; | 247 | odebug << "pcmcia: unconfigured card detected" << oendl; |
242 | QString newCardName = theCard->productIdentity(); | 248 | QString newCardName = theCard->productIdentity(); |
243 | int result = QMessageBox::information( qApp->desktop(), | 249 | int result = QMessageBox::information( qApp->desktop(), |
244 | tr( "PCMCIA/CF Subsystem" ), | 250 | tr( "PCMCIA/CF Subsystem" ), |
245 | tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), | 251 | tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), |
246 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); | 252 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); |
247 | odebug << "pcmcia: result = " << result << oendl; | 253 | odebug << "pcmcia: result = " << result << oendl; |
248 | if ( result == 0 ) | 254 | if ( result == 0 ) |
249 | { | 255 | { |
250 | configure( theCard ); | 256 | configure( theCard ); |
251 | } | 257 | } |
252 | else | 258 | else |
253 | { | 259 | { |
254 | odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; | 260 | odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; |
255 | } | 261 | } |
256 | } | 262 | } |
257 | else // it's an already configured card | 263 | else // it's an already configured card |
258 | { | 264 | { |
259 | odebug << "pcmcia: doing nothing... why do we come here?" << oendl; | 265 | odebug << "pcmcia: doing nothing... why do we come here?" << oendl; |
260 | } | 266 | } |
261 | } | 267 | } |
262 | 268 | ||
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 | |||
@@ -222,86 +222,85 @@ void MainWindow::slotNew() | |||
222 | cb->setFilename( tempFilename ); | 222 | cb->setFilename( tempFilename ); |
223 | cb->write(); | 223 | cb->write(); |
224 | 224 | ||
225 | // Add to listbox | 225 | // Add to listbox |
226 | checkbooks->inSort( cb ); | 226 | checkbooks->inSort( cb ); |
227 | addCheckbook( cb ); | 227 | addCheckbook( cb ); |
228 | } | 228 | } |
229 | delete currcb; | 229 | delete currcb; |
230 | } | 230 | } |
231 | 231 | ||
232 | // --- slotEdit --------------------------------------------------------------- | 232 | // --- slotEdit --------------------------------------------------------------- |
233 | void MainWindow::slotEdit() | 233 | void MainWindow::slotEdit() |
234 | { | 234 | { |
235 | // get name and open it | 235 | // get name and open it |
236 | QListViewItem *curritem = cbList->currentItem(); | 236 | QListViewItem *curritem = cbList->currentItem(); |
237 | if ( !curritem ) | 237 | if ( !curritem ) |
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 | } |
254 | if ( !cb ) return; | 255 | if ( !cb ) return; |
255 | 256 | ||
256 | // | 257 | // |
257 | buildFilename( currname ); | 258 | buildFilename( currname ); |
258 | float currbalance = cb->balance(); | 259 | float currbalance = cb->balance(); |
259 | bool currlock = !cb->password().isNull(); | 260 | bool currlock = !cb->password().isNull(); |
260 | 261 | ||
261 | if ( currlock ) | 262 | if ( currlock ) |
262 | { | 263 | { |
263 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 264 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
264 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 265 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
265 | { | 266 | { |
266 | delete pw; | 267 | delete pw; |
267 | return; | 268 | return; |
268 | } | 269 | } |
269 | delete pw; | 270 | delete pw; |
270 | } | 271 | } |
271 | 272 | ||
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 |
292 | buildFilename( newname ); | 291 | buildFilename( newname ); |
293 | cb->setFilename( tempFilename ); | 292 | cb->setFilename( tempFilename ); |
294 | } | 293 | } |
295 | 294 | ||
296 | cb->write(); | 295 | cb->write(); |
297 | 296 | ||
298 | // Update lock if changed | 297 | // Update lock if changed |
299 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) | 298 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) |
300 | { | 299 | { |
301 | if ( !cb->password().isNull() ) | 300 | if ( !cb->password().isNull() ) |
302 | curritem->setPixmap( 0, lockIcon ); | 301 | curritem->setPixmap( 0, lockIcon ); |
303 | else | 302 | else |
304 | curritem->setPixmap( 0, nullIcon ); | 303 | curritem->setPixmap( 0, nullIcon ); |
305 | } | 304 | } |
306 | 305 | ||
307 | // Update balance if changed | 306 | // Update balance if changed |
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 | |||
@@ -28,49 +28,52 @@ void ProcCtl::add(pid_t pi, int fd ) { | |||
28 | con->prev = m_last; | 28 | con->prev = m_last; |
29 | 29 | ||
30 | m_last = con; | 30 | m_last = con; |
31 | 31 | ||
32 | } | 32 | } |
33 | void ProcCtl::remove( pid_t pi ) { | 33 | void ProcCtl::remove( pid_t pi ) { |
34 | /* | 34 | /* |
35 | * We first check if the last item | 35 | * We first check if the last item |
36 | * is equal to pi the we | 36 | * is equal to pi the we |
37 | * | 37 | * |
38 | */ | 38 | */ |
39 | ProcContainer* con; | 39 | ProcContainer* con; |
40 | if (m_last->pid == pi ) { | 40 | if (m_last->pid == pi ) { |
41 | con = m_last; | 41 | con = m_last; |
42 | m_last = con->prev; | 42 | m_last = con->prev; |
43 | delete con; | 43 | delete con; |
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 | forw->prev = con->prev; | 52 | if (forw) |
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 | ||
61 | } | 64 | } |
62 | void ProcCtl::remove( ProcContainer con ) { | 65 | void ProcCtl::remove( ProcContainer con ) { |
63 | remove( con.pid ); | 66 | remove( con.pid ); |
64 | } | 67 | } |
65 | int ProcCtl::status(pid_t pid )const{ | 68 | int ProcCtl::status(pid_t pid )const{ |
66 | ProcContainer *con = m_last; | 69 | ProcContainer *con = m_last; |
67 | while (con) { | 70 | while (con) { |
68 | if (con->pid == pid ) | 71 | if (con->pid == pid ) |
69 | return con->status; | 72 | return con->status; |
70 | con = con->prev; | 73 | con = con->prev; |
71 | } | 74 | } |
72 | return -1; | 75 | return -1; |
73 | } | 76 | } |
74 | void ProcCtl::signal_handler(int) { | 77 | void ProcCtl::signal_handler(int) { |
75 | int status; | 78 | int status; |
76 | signal( SIGCHLD, signal_handler ); | 79 | signal( SIGCHLD, signal_handler ); |
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 | |||
@@ -1994,261 +1994,261 @@ void KateDocument::updateViews(KateView *exclude) { | |||
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | QColor &KateDocument::cursorCol(int x, int y) { | 1996 | QColor &KateDocument::cursorCol(int x, int y) { |
1997 | int attr; | 1997 | int attr; |
1998 | Attribute *a; | 1998 | Attribute *a; |
1999 | 1999 | ||
2000 | TextLine::Ptr textLine = getTextLine(y); | 2000 | TextLine::Ptr textLine = getTextLine(y); |
2001 | attr = textLine->getRawAttr(x); | 2001 | attr = textLine->getRawAttr(x); |
2002 | a = &m_attribs[attr & taAttrMask]; | 2002 | a = &m_attribs[attr & taAttrMask]; |
2003 | if (attr & taSelected) return a->selCol; else return a->col; | 2003 | if (attr & taSelected) return a->selCol; else return a->col; |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | void KateDocument::paintTextLine(QPainter &paint, int line, int xStart, int xEnd, bool showTabs) | 2006 | void KateDocument::paintTextLine(QPainter &paint, int line, int xStart, int xEnd, bool showTabs) |
2007 | { | 2007 | { |
2008 | paintTextLine (paint, line, 0, xStart, xEnd, showTabs); | 2008 | paintTextLine (paint, line, 0, xStart, xEnd, showTabs); |
2009 | } | 2009 | } |
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 | } |
2027 | 2027 | ||
2028 | textLine = getTextLine(line); | 2028 | textLine = getTextLine(line); |
2029 | len = textLine->length(); | 2029 | len = textLine->length(); |
2030 | s = textLine->getText(); | 2030 | s = textLine->getText(); |
2031 | 2031 | ||
2032 | // skip to first visible character | 2032 | // skip to first visible character |
2033 | x = 0; | 2033 | x = 0; |
2034 | z = 0; | 2034 | z = 0; |
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 |
2058 | xs = xStart; | 2058 | xs = xStart; |
2059 | attr = textLine->getRawAttr(zc); | 2059 | attr = textLine->getRawAttr(zc); |
2060 | while (x < xEnd) | 2060 | while (x < xEnd) |
2061 | { | 2061 | { |
2062 | nextAttr = textLine->getRawAttr(z); | 2062 | nextAttr = textLine->getRawAttr(z); |
2063 | if ((nextAttr ^ attr) & taSelected) | 2063 | if ((nextAttr ^ attr) & taSelected) |
2064 | { | 2064 | { |
2065 | if (attr & taSelected) | 2065 | if (attr & taSelected) |
2066 | paint.fillRect(xs - xStart, y, x - xs, fontHeight, colors[1]); | 2066 | paint.fillRect(xs - xStart, y, x - xs, fontHeight, colors[1]); |
2067 | else | 2067 | else |
2068 | paint.fillRect(xs - xStart, y, x - xs, fontHeight, colors[0]); | 2068 | paint.fillRect(xs - xStart, y, x - xs, fontHeight, colors[0]); |
2069 | 2069 | ||
2070 | xs = x; | 2070 | xs = x; |
2071 | attr = nextAttr; | 2071 | attr = nextAttr; |
2072 | } | 2072 | } |
2073 | 2073 | ||
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) |
2097 | paint.fillRect(xs - xStart, y, xEnd - xs, fontHeight, colors[1]); | 2097 | paint.fillRect(xs - xStart, y, xEnd - xs, fontHeight, colors[1]); |
2098 | else | 2098 | else |
2099 | paint.fillRect(xs - xStart, y, xEnd - xs, fontHeight, colors[0]); | 2099 | paint.fillRect(xs - xStart, y, xEnd - xs, fontHeight, colors[0]); |
2100 | 2100 | ||
2101 | len = z; //reduce length to visible length | 2101 | len = z; //reduce length to visible length |
2102 | 2102 | ||
2103 | // draw text | 2103 | // draw text |
2104 | x = xc; | 2104 | x = xc; |
2105 | z = zc; | 2105 | z = zc; |
2106 | y += fontAscent;// -1; | 2106 | y += fontAscent;// -1; |
2107 | attr = -1; | 2107 | attr = -1; |
2108 | while (z < len) { | 2108 | while (z < len) { |
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) { |
2191 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); | 2189 | QConstString str((QChar *) &s[zc], z - zc /*+1*/); |
2192 | paint.drawText(x - xStart, y, str.string()); | 2190 | paint.drawText(x - xStart, y, str.string()); |
2193 | } | 2191 | } |
2194 | } | 2192 | } |
2195 | 2193 | ||
2196 | // Applies the search context, and returns whether a match was found. If one is, | 2194 | // Applies the search context, and returns whether a match was found. If one is, |
2197 | // the length of the string matched is also returned. | 2195 | // the length of the string matched is also returned. |
2198 | bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { | 2196 | bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { |
2199 | int line, col; | 2197 | int line, col; |
2200 | int searchEnd; | 2198 | int searchEnd; |
2201 | int bufLen, tlen; | 2199 | int bufLen, tlen; |
2202 | QChar *t; | 2200 | QChar *t; |
2203 | TextLine::Ptr textLine; | 2201 | TextLine::Ptr textLine; |
2204 | int pos, newPos; | 2202 | int pos, newPos; |
2205 | 2203 | ||
2206 | if (searchFor.isEmpty()) return false; | 2204 | if (searchFor.isEmpty()) return false; |
2207 | 2205 | ||
2208 | bufLen = 0; | 2206 | bufLen = 0; |
2209 | t = 0L; | 2207 | t = 0L; |
2210 | 2208 | ||
2211 | line = sc.cursor.y; | 2209 | line = sc.cursor.y; |
2212 | col = sc.cursor.x; | 2210 | col = sc.cursor.x; |
2213 | if (!(sc.flags & KateView::sfBackward)) { | 2211 | if (!(sc.flags & KateView::sfBackward)) { |
2214 | //forward search | 2212 | //forward search |
2215 | if (sc.flags & KateView::sfSelected) { | 2213 | if (sc.flags & KateView::sfSelected) { |
2216 | if (line < selectStart) { | 2214 | if (line < selectStart) { |
2217 | line = selectStart; | 2215 | line = selectStart; |
2218 | col = 0; | 2216 | col = 0; |
2219 | } | 2217 | } |
2220 | searchEnd = selectEnd; | 2218 | searchEnd = selectEnd; |
2221 | } else searchEnd = lastLine(); | 2219 | } else searchEnd = lastLine(); |
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; |
2239 | } while (pos < tlen); | 2239 | } while (pos < tlen); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | QString text(t, tlen); | 2242 | QString text(t, tlen); |
2243 | if (sc.flags & KateView::sfWholeWords) { | 2243 | if (sc.flags & KateView::sfWholeWords) { |
2244 | // Until the end of the line... | 2244 | // Until the end of the line... |
2245 | while (col < tlen) { | 2245 | while (col < tlen) { |
2246 | // ...find the next match. | 2246 | // ...find the next match. |
2247 | col = sc.search(text, col); | 2247 | col = sc.search(text, col); |
2248 | if (col != -1) { | 2248 | if (col != -1) { |
2249 | // Is the match delimited correctly? | 2249 | // Is the match delimited correctly? |
2250 | if (((col == 0) || (!m_highlight->isInWord(t[col]))) && | 2250 | if (((col == 0) || (!m_highlight->isInWord(t[col]))) && |
2251 | ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { | 2251 | ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { |
2252 | goto found; | 2252 | goto found; |
2253 | } | 2253 | } |
2254 | else { | 2254 | else { |
@@ -2267,49 +2267,50 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { | |||
2267 | col = sc.search(text, col); | 2267 | col = sc.search(text, col); |
2268 | if (col != -1) | 2268 | if (col != -1) |
2269 | goto found; | 2269 | goto found; |
2270 | } | 2270 | } |
2271 | col = 0; | 2271 | col = 0; |
2272 | line++; | 2272 | line++; |
2273 | } | 2273 | } |
2274 | } else { | 2274 | } else { |
2275 | // backward search | 2275 | // backward search |
2276 | if (sc.flags & KateView::sfSelected) { | 2276 | if (sc.flags & KateView::sfSelected) { |
2277 | if (line > selectEnd) { | 2277 | if (line > selectEnd) { |
2278 | line = selectEnd; | 2278 | line = selectEnd; |
2279 | col = -1; | 2279 | col = -1; |
2280 | } | 2280 | } |
2281 | searchEnd = selectStart; | 2281 | searchEnd = selectStart; |
2282 | } else searchEnd = 0; | 2282 | } else searchEnd = 0; |
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; |
2300 | } while (pos < tlen); | 2301 | } while (pos < tlen); |
2301 | } | 2302 | } |
2302 | 2303 | ||
2303 | if (col < 0 || col > tlen) col = tlen; | 2304 | if (col < 0 || col > tlen) col = tlen; |
2304 | 2305 | ||
2305 | QString text(t, tlen); | 2306 | QString text(t, tlen); |
2306 | if (sc.flags & KateView::sfWholeWords) { | 2307 | if (sc.flags & KateView::sfWholeWords) { |
2307 | // Until the beginning of the line... | 2308 | // Until the beginning of the line... |
2308 | while (col >= 0) { | 2309 | while (col >= 0) { |
2309 | // ...find the next match. | 2310 | // ...find the next match. |
2310 | col = sc.search(text, col); | 2311 | col = sc.search(text, col); |
2311 | if (col != -1) { | 2312 | if (col != -1) { |
2312 | // Is the match delimited correctly? | 2313 | // Is the match delimited correctly? |
2313 | if (((col == 0) || (!m_highlight->isInWord(t[col]))) && | 2314 | if (((col == 0) || (!m_highlight->isInWord(t[col]))) && |
2314 | ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { | 2315 | ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { |
2315 | goto found; | 2316 | goto found; |
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp index 164d608..428cfd4 100644 --- a/noncore/settings/sysinfo/devicesinfo.cpp +++ b/noncore/settings/sysinfo/devicesinfo.cpp | |||
@@ -244,49 +244,49 @@ void UsbCategory::populate() | |||
244 | int usbcount = 0; | 244 | int usbcount = 0; |
245 | UsbDevice* lastDev = 0; | 245 | UsbDevice* lastDev = 0; |
246 | UsbDevice* dev = 0; | 246 | UsbDevice* dev = 0; |
247 | while ( !usbinfo.atEnd() ) | 247 | while ( !usbinfo.atEnd() ) |
248 | { | 248 | { |
249 | QString line = usbinfo.readLine(); | 249 | QString line = usbinfo.readLine(); |
250 | odebug << "got line '" << line << "'" << oendl; | 250 | odebug << "got line '" << line << "'" << oendl; |
251 | if ( line.startsWith( "T:" ) ) | 251 | if ( line.startsWith( "T:" ) ) |
252 | { | 252 | { |
253 | sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); | 253 | sscanf(line.local8Bit().data(), "T: Bus=%2d Lev=%2d Prnt=%2d Port=%d Cnt=%2d Dev#=%3d Spd=%3f MxCh=%2d", &_bus, &_level, &_parent, &_port, &_count, &_device, &_speed, &_channels); |
254 | 254 | ||
255 | if ( !_level ) | 255 | if ( !_level ) |
256 | { | 256 | { |
257 | odebug << "adding new bus" << oendl; | 257 | odebug << "adding new bus" << oendl; |
258 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); | 258 | dev = new UsbDevice( this, QString( "Generic USB Hub Device" ) ); |
259 | lastDev = dev; | 259 | lastDev = dev; |
260 | } | 260 | } |
261 | else | 261 | else |
262 | { | 262 | { |
263 | odebug << "adding new dev" << oendl; | 263 | odebug << "adding new dev" << oendl; |
264 | dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); | 264 | dev = new UsbDevice( lastDev, QString( "Generic USB Hub Device" ) ); |
265 | lastDev = dev; | 265 | lastDev = dev; |
266 | } | 266 | } |
267 | } | 267 | } |
268 | else if ( line.startsWith( "S: Product" ) ) | 268 | else if ( dev && line.startsWith( "S: Product" ) ) |
269 | { | 269 | { |
270 | int dp = line.find( '=' ); | 270 | int dp = line.find( '=' ); |
271 | dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); | 271 | dev->setText( 0, dp != -1 ? line.right( line.length()-1-dp ) : "<unknown>" ); |
272 | } | 272 | } |
273 | else | 273 | else |
274 | { | 274 | { |
275 | continue; | 275 | continue; |
276 | } | 276 | } |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | //================================================================================================= | 281 | //================================================================================================= |
282 | Device::Device( Category* parent, const QString& name ) | 282 | Device::Device( Category* parent, const QString& name ) |
283 | :OListViewItem( parent, name ) | 283 | :OListViewItem( parent, name ) |
284 | { | 284 | { |
285 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 285 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
286 | } | 286 | } |
287 | 287 | ||
288 | Device::Device( Device* parent, const QString& name ) | 288 | Device::Device( Device* parent, const QString& name ) |
289 | :OListViewItem( parent, name ) | 289 | :OListViewItem( parent, name ) |
290 | { | 290 | { |
291 | devinfo = static_cast<QWidget*>( listView()->parent() ); | 291 | devinfo = static_cast<QWidget*>( listView()->parent() ); |
292 | } | 292 | } |
diff --git a/noncore/todayplugins/stockticker/libstocks/http.c b/noncore/todayplugins/stockticker/libstocks/http.c index 2f38f8a..cc78ab7 100644 --- a/noncore/todayplugins/stockticker/libstocks/http.c +++ b/noncore/todayplugins/stockticker/libstocks/http.c | |||
@@ -189,49 +189,49 @@ libstocks_return_code http_get(char *http_file, char *http_server, char **pdata) | |||
189 | free(data); | 189 | free(data); |
190 | data = temp; | 190 | data = temp; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | /* close socket */ | 195 | /* close socket */ |
196 | #ifdef __UNIX__ | 196 | #ifdef __UNIX__ |
197 | close(s); | 197 | close(s); |
198 | #elif __WINDOWS__ | 198 | #elif __WINDOWS__ |
199 | closesocket(s); | 199 | closesocket(s); |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | #ifdef DEBUG | 202 | #ifdef DEBUG |
203 | printf("%s\n", data); | 203 | printf("%s\n", data); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | /* get headers to test status line */ | 206 | /* get headers to test status line */ |
207 | /* and to split headers and content */ | 207 | /* and to split headers and content */ |
208 | 208 | ||
209 | temp = data; | 209 | temp = data; |
210 | header_founded = 0; | 210 | header_founded = 0; |
211 | while( !header_founded ) | 211 | while( !header_founded ) |
212 | { | 212 | { |
213 | if (*temp==0) return ERRRHEA; | 213 | if (!temp || *temp==0) return ERRRHEA; |
214 | 214 | ||
215 | if( *temp==0x0A ) | 215 | if( *temp==0x0A ) |
216 | { | 216 | { |
217 | /* test if it is the header end */ | 217 | /* test if it is the header end */ |
218 | temp ++; | 218 | temp ++; |
219 | if (*temp == 0x0D) temp++; | 219 | if (*temp == 0x0D) temp++; |
220 | if (*temp == 0x0A) header_founded = 1; | 220 | if (*temp == 0x0A) header_founded = 1; |
221 | } | 221 | } |
222 | else | 222 | else |
223 | temp++; | 223 | temp++; |
224 | } | 224 | } |
225 | 225 | ||
226 | *temp = 0; | 226 | *temp = 0; |
227 | temp++; | 227 | temp++; |
228 | 228 | ||
229 | sscanf(data,"HTTP/1.%*d %03d",&error_code); | 229 | sscanf(data,"HTTP/1.%*d %03d",&error_code); |
230 | 230 | ||
231 | if (error_code != 200) | 231 | if (error_code != 200) |
232 | { | 232 | { |
233 | #ifdef DEBUG | 233 | #ifdef DEBUG |
234 | printf(" HTTP error code : %d\n", error_code); | 234 | printf(" HTTP error code : %d\n", error_code); |
235 | #endif | 235 | #endif |
236 | free(data); | 236 | free(data); |
237 | return ERRPAHD; | 237 | return ERRPAHD; |