-rw-r--r-- | libopie2/opiecore/device/odevice_htc.cpp | 3 | ||||
-rw-r--r-- | libopie2/opiepim/private/opimeventsortvector.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CFilter.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CRegExp.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Palm2QImage.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-reader/QTReader.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/striphtml.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 10 | ||||
-rw-r--r-- | noncore/net/ftplib/ftplib.c | 2 | ||||
-rw-r--r-- | noncore/settings/sysinfo/contrib/dhry.c | 2 |
14 files changed, 56 insertions, 56 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp index c21e10d..4e5200b 100644 --- a/libopie2/opiecore/device/odevice_htc.cpp +++ b/libopie2/opiecore/device/odevice_htc.cpp | |||
@@ -375,106 +375,105 @@ int HTC::displayBrightnessResolution() const | |||
375 | } | 375 | } |
376 | 376 | ||
377 | return res; | 377 | return res; |
378 | } | 378 | } |
379 | 379 | ||
380 | bool HTC::setDisplayBrightness( int bright ) | 380 | bool HTC::setDisplayBrightness( int bright ) |
381 | { | 381 | { |
382 | 382 | ||
383 | //qDebug( "HTC::setDisplayBrightness( %d )", bright ); | 383 | //qDebug( "HTC::setDisplayBrightness( %d )", bright ); |
384 | bool res = false; | 384 | bool res = false; |
385 | 385 | ||
386 | if ( bright > 255 ) bright = 255; | 386 | if ( bright > 255 ) bright = 255; |
387 | if ( bright < 0 ) bright = 0; | 387 | if ( bright < 0 ) bright = 0; |
388 | 388 | ||
389 | int numberOfSteps = displayBrightnessResolution(); | 389 | int numberOfSteps = displayBrightnessResolution(); |
390 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; | 390 | int val = ( bright == 1 ) ? 1 : ( bright * numberOfSteps ) / 255; |
391 | 391 | ||
392 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); | 392 | int fd = ::open( m_backlightdev + "brightness", O_WRONLY|O_NONBLOCK ); |
393 | if ( fd ) | 393 | if ( fd ) |
394 | { | 394 | { |
395 | char buf[100]; | 395 | char buf[100]; |
396 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); | 396 | int len = ::snprintf( &buf[0], sizeof buf, "%d", val ); |
397 | res = ( ::write( fd, &buf[0], len ) == 0 ); | 397 | res = ( ::write( fd, &buf[0], len ) == 0 ); |
398 | ::close( fd ); | 398 | ::close( fd ); |
399 | } | 399 | } |
400 | return res; | 400 | return res; |
401 | } | 401 | } |
402 | 402 | ||
403 | bool HTC::setDisplayStatus( bool on ) | 403 | bool HTC::setDisplayStatus( bool on ) |
404 | { | 404 | { |
405 | 405 | ||
406 | bool res = false; | 406 | bool res = false; |
407 | 407 | ||
408 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); | 408 | int fd = ::open( m_backlightdev + "power", O_WRONLY|O_NONBLOCK ); |
409 | if ( fd ) | 409 | if ( fd ) |
410 | { | 410 | { |
411 | char buf[10]; | 411 | char buf[10]; |
412 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; | 412 | buf[0] = on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; |
413 | buf[1] = '\0'; | 413 | buf[1] = '\0'; |
414 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); | 414 | res = ( ::write( fd, &buf[0], 2 ) == 0 ); |
415 | ::close( fd ); | 415 | ::close( fd ); |
416 | } | 416 | } |
417 | return res; | 417 | return res; |
418 | } | 418 | } |
419 | 419 | ||
420 | Transformation HTC::rotation() const | 420 | Transformation HTC::rotation() const |
421 | { | 421 | { |
422 | qDebug( "HTC::rotation()" ); | 422 | qDebug( "HTC::rotation()" ); |
423 | Transformation rot; | 423 | Transformation rot = Rot270; |
424 | 424 | ||
425 | switch ( d->m_model ) { | 425 | switch ( d->m_model ) { |
426 | case Model_HTC_Universal: | 426 | case Model_HTC_Universal: |
427 | { | 427 | { |
428 | OHingeStatus hs = readHingeSensor(); | 428 | OHingeStatus hs = readHingeSensor(); |
429 | qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); | 429 | qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); |
430 | if ( hs == CASE_PORTRAIT ) rot = Rot0; | 430 | if ( hs == CASE_PORTRAIT ) rot = Rot0; |
431 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; | 431 | else if ( hs == CASE_UNKNOWN ) rot = Rot270; |
432 | else rot = Rot270; | ||
433 | } | 432 | } |
434 | break; | 433 | break; |
435 | } | 434 | } |
436 | 435 | ||
437 | qDebug( "HTC::rotation() - returning '%d'", rot ); | 436 | qDebug( "HTC::rotation() - returning '%d'", rot ); |
438 | return rot; | 437 | return rot; |
439 | } | 438 | } |
440 | ODirection HTC::direction() const | 439 | ODirection HTC::direction() const |
441 | { | 440 | { |
442 | ODirection dir; | 441 | ODirection dir; |
443 | 442 | ||
444 | switch ( d->m_model ) { | 443 | switch ( d->m_model ) { |
445 | case Model_HTC_Universal: { | 444 | case Model_HTC_Universal: { |
446 | OHingeStatus hs = readHingeSensor(); | 445 | OHingeStatus hs = readHingeSensor(); |
447 | if ( hs == CASE_PORTRAIT ) dir = CCW; | 446 | if ( hs == CASE_PORTRAIT ) dir = CCW; |
448 | else if ( hs == CASE_UNKNOWN ) dir = CCW; | 447 | else if ( hs == CASE_UNKNOWN ) dir = CCW; |
449 | else dir = CW; | 448 | else dir = CW; |
450 | } | 449 | } |
451 | break; | 450 | break; |
452 | default: dir = d->m_direction; | 451 | default: dir = d->m_direction; |
453 | break; | 452 | break; |
454 | } | 453 | } |
455 | return dir; | 454 | return dir; |
456 | 455 | ||
457 | } | 456 | } |
458 | 457 | ||
459 | bool HTC::hasHingeSensor() const | 458 | bool HTC::hasHingeSensor() const |
460 | { | 459 | { |
461 | return d->m_model == Model_HTC_Universal; | 460 | return d->m_model == Model_HTC_Universal; |
462 | } | 461 | } |
463 | 462 | ||
464 | OHingeStatus HTC::readHingeSensor() const | 463 | OHingeStatus HTC::readHingeSensor() const |
465 | { | 464 | { |
466 | /* | 465 | /* |
467 | * The HTC Universal keyboard is event source 1 in kernel 2.6. | 466 | * The HTC Universal keyboard is event source 1 in kernel 2.6. |
468 | * Hinge status is reported via Input System Switchs 0 and 1 like that: | 467 | * Hinge status is reported via Input System Switchs 0 and 1 like that: |
469 | * | 468 | * |
470 | * ------------------------- | 469 | * ------------------------- |
471 | * | SW0 | SW1 | CASE | | 470 | * | SW0 | SW1 | CASE | |
472 | * |-----|-----|-----------| | 471 | * |-----|-----|-----------| |
473 | * | 0 0 Unknown | | 472 | * | 0 0 Unknown | |
474 | * | 1 0 Portrait | | 473 | * | 1 0 Portrait | |
475 | * | 0 1 Closed | | 474 | * | 0 1 Closed | |
476 | * | 1 1 Landscape | | 475 | * | 1 1 Landscape | |
477 | * ------------------------- | 476 | * ------------------------- |
478 | */ | 477 | */ |
479 | OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); | 478 | OInputDevice* keyboard = OInputSystem::instance()->device( "event1" ); |
480 | bool switch0 = true; | 479 | bool switch0 = true; |
diff --git a/libopie2/opiepim/private/opimeventsortvector.cpp b/libopie2/opiepim/private/opimeventsortvector.cpp index 4220c63..b85f848 100644 --- a/libopie2/opiepim/private/opimeventsortvector.cpp +++ b/libopie2/opiepim/private/opimeventsortvector.cpp | |||
@@ -1,124 +1,121 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2004 Stefan Eilers <stefan@eilers-online.net> | 3 | Copyright (C) 2004 Stefan Eilers <stefan@eilers-online.net> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimeventsortvector.h" | 30 | #include "opimeventsortvector.h" |
31 | #include <opie2/ocontactaccess.h> | 31 | #include <opie2/ocontactaccess.h> |
32 | #include <opie2/opimnotifymanager.h> | 32 | #include <opie2/opimnotifymanager.h> |
33 | #include <opie2/odatebookaccess.h> | 33 | #include <opie2/odatebookaccess.h> |
34 | 34 | ||
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | 36 | ||
37 | namespace Opie { | 37 | namespace Opie { |
38 | namespace Internal { | 38 | namespace Internal { |
39 | 39 | ||
40 | namespace{ | 40 | int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){ |
41 | |||
42 | inline int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){ | ||
43 | OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms(); | 41 | OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms(); |
44 | OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms(); | 42 | OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms(); |
45 | 43 | ||
46 | // Well.. How could we compare two lists of alarms? I think we should find the most early datetimes | 44 | // Well.. How could we compare two lists of alarms? I think we should find the most early datetimes |
47 | // and compare them.. (se) | 45 | // and compare them.. (se) |
48 | // Find the first alarm of the left list | 46 | // Find the first alarm of the left list |
49 | OPimNotifyManager::Alarms::Iterator it; | 47 | OPimNotifyManager::Alarms::Iterator it; |
50 | QDateTime left_earliest; // This datetime is initialized as invalid!! | 48 | QDateTime left_earliest; // This datetime is initialized as invalid!! |
51 | for ( it = left_alarms.begin(); it != left_alarms.end(); ++it ){ | 49 | for ( it = left_alarms.begin(); it != left_alarms.end(); ++it ){ |
52 | if ( !left_earliest.isValid() || left_earliest > (*it).dateTime() ){ | 50 | if ( !left_earliest.isValid() || left_earliest > (*it).dateTime() ){ |
53 | left_earliest = (*it).dateTime(); | 51 | left_earliest = (*it).dateTime(); |
54 | } | 52 | } |
55 | } | 53 | } |
56 | QDateTime right_earliest; // This datetime is initialized as invalid!! | 54 | QDateTime right_earliest; // This datetime is initialized as invalid!! |
57 | for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){ | 55 | for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){ |
58 | if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){ | 56 | if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){ |
59 | right_earliest = (*it).dateTime(); | 57 | right_earliest = (*it).dateTime(); |
60 | } | 58 | } |
61 | } | 59 | } |
62 | 60 | ||
63 | int ret; | 61 | int ret = 0; |
64 | 62 | ||
65 | // Now compare this found alarms | 63 | // Now compare this found alarms |
66 | if ( !left_earliest .isValid() ) ret++; | 64 | if ( !left_earliest .isValid() ) ret++; |
67 | if ( !right_earliest.isValid() ) ret--; | 65 | if ( !right_earliest.isValid() ) ret--; |
68 | 66 | ||
69 | if ( left_earliest.isValid() && right_earliest.isValid() ){ | 67 | if ( left_earliest.isValid() && right_earliest.isValid() ){ |
70 | ret += left_earliest < right_earliest ? -1 : 1; | 68 | left_earliest < right_earliest ? ret-- : ret++; |
71 | } | 69 | } |
72 | 70 | ||
73 | return ret; | 71 | return ret; |
74 | 72 | ||
75 | } | 73 | } |
76 | } | ||
77 | 74 | ||
78 | OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort ) | 75 | OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort ) |
79 | : OPimSortVector<OPimEvent>( size, asc, sort ) {} | 76 | : OPimSortVector<OPimEvent>( size, asc, sort ) {} |
80 | 77 | ||
81 | int OPimEventSortVector::compareItems( const OPimEvent& left, | 78 | int OPimEventSortVector::compareItems( const OPimEvent& left, |
82 | const OPimEvent& right ) { | 79 | const OPimEvent& right ) { |
83 | if ( left.uid() == right.uid() ) | 80 | if ( left.uid() == right.uid() ) |
84 | return 0; | 81 | return 0; |
85 | 82 | ||
86 | int ret = 0; | 83 | int ret = 0; |
87 | bool asc = sortAscending(); | 84 | bool asc = sortAscending(); |
88 | 85 | ||
89 | switch( sortOrder() ) { | 86 | switch( sortOrder() ) { |
90 | case ODateBookAccess::SortDescription: | 87 | case ODateBookAccess::SortDescription: |
91 | ret = testString( left.description(), right.description() ); | 88 | ret = testString( left.description(), right.description() ); |
92 | break; | 89 | break; |
93 | case ODateBookAccess::SortLocation: | 90 | case ODateBookAccess::SortLocation: |
94 | ret = testString( left.location(), right.location() ); | 91 | ret = testString( left.location(), right.location() ); |
95 | break; | 92 | break; |
96 | case ODateBookAccess::SortNote: | 93 | case ODateBookAccess::SortNote: |
97 | ret = testString( left.note(),right.note() ); | 94 | ret = testString( left.note(),right.note() ); |
98 | break; | 95 | break; |
99 | case ODateBookAccess::SortStartTime: | 96 | case ODateBookAccess::SortStartTime: |
100 | ret = testTime( left.startDateTime().time(), right.startDateTime().time() ); | 97 | ret = testTime( left.startDateTime().time(), right.startDateTime().time() ); |
101 | break; | 98 | break; |
102 | case ODateBookAccess::SortEndTime: | 99 | case ODateBookAccess::SortEndTime: |
103 | ret = testTime( left.endDateTime().time(), right.endDateTime().time() ); | 100 | ret = testTime( left.endDateTime().time(), right.endDateTime().time() ); |
104 | break; | 101 | break; |
105 | case ODateBookAccess::SortStartDate: | 102 | case ODateBookAccess::SortStartDate: |
106 | ret = testDate( left.startDateTime().date(), right.startDateTime().date() ); | 103 | ret = testDate( left.startDateTime().date(), right.startDateTime().date() ); |
107 | break; | 104 | break; |
108 | case ODateBookAccess::SortEndDate: | 105 | case ODateBookAccess::SortEndDate: |
109 | ret = testDate( left.endDateTime().date(), right.endDateTime().date() ); | 106 | ret = testDate( left.endDateTime().date(), right.endDateTime().date() ); |
110 | break; | 107 | break; |
111 | case ODateBookAccess::SortStartDateTime: | 108 | case ODateBookAccess::SortStartDateTime: |
112 | ret = testDateTime( left.startDateTime(), right.startDateTime() ); | 109 | ret = testDateTime( left.startDateTime(), right.startDateTime() ); |
113 | break; | 110 | break; |
114 | case ODateBookAccess::SortEndDateTime: | 111 | case ODateBookAccess::SortEndDateTime: |
115 | ret = testDateTime( left.endDateTime(), right.endDateTime() ); | 112 | ret = testDateTime( left.endDateTime(), right.endDateTime() ); |
116 | break; | 113 | break; |
117 | case ODateBookAccess::SortAlarmDateTime: | 114 | case ODateBookAccess::SortAlarmDateTime: |
118 | ret = testAlarmNotifiers( left.notifiers(), right.notifiers() ); | 115 | ret = testAlarmNotifiers( left.notifiers(), right.notifiers() ); |
119 | break; | 116 | break; |
120 | default: | 117 | default: |
121 | odebug << "OpimEventSortVector: Unknown sortOrder: " << sortOrder() << oendl; | 118 | odebug << "OpimEventSortVector: Unknown sortOrder: " << sortOrder() << oendl; |
122 | } | 119 | } |
123 | 120 | ||
124 | /* twist to honor ascending/descending setting as QVector only sorts ascending */ | 121 | /* twist to honor ascending/descending setting as QVector only sorts ascending */ |
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index 2958cf5..a7d6b00 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp | |||
@@ -1,133 +1,138 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
10 | 10 | ||
11 | #include "listviewitemconffile.h" | 11 | #include "listviewitemconffile.h" |
12 | #include "listviewitemconfigentry.h" | 12 | #include "listviewitemconfigentry.h" |
13 | 13 | ||
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | using namespace Opie::Core; | 16 | using namespace Opie::Core; |
17 | 17 | ||
18 | /* QT */ | 18 | /* QT */ |
19 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
20 | #include <qtextstream.h> | 20 | #include <qtextstream.h> |
21 | 21 | ||
22 | #define tr QObject::tr | 22 | #define tr QObject::tr |
23 | 23 | ||
24 | ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) | 24 | ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) |
25 | : ListViewItemConf(parent), _valid(false) | 25 | : ListViewItemConf(parent), _valid(false) |
26 | { | 26 | { |
27 | confFileInfo = file; | 27 | confFileInfo = file; |
28 | // parseFile(); | 28 | // parseFile(); |
29 | displayText(); | 29 | displayText(); |
30 | } | 30 | } |
31 | 31 | ||
32 | ListViewItemConfFile::~ListViewItemConfFile() | 32 | ListViewItemConfFile::~ListViewItemConfFile() |
33 | { | 33 | { |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | void ListViewItemConfFile::displayText() | 37 | void ListViewItemConfFile::displayText() |
38 | { | 38 | { |
39 | setText(0,(_changed?"*":"")+confFileInfo->fileName()); | 39 | setText(0,(_changed?"*":"")+confFileInfo->fileName()); |
40 | } | 40 | } |
41 | 41 | ||
42 | QString ListViewItemConfFile::fileName() | 42 | QString ListViewItemConfFile::fileName() |
43 | { | 43 | { |
44 | return confFileInfo->fileName(); | 44 | return confFileInfo->fileName(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void ListViewItemConfFile::parseFile() | 47 | void ListViewItemConfFile::parseFile() |
48 | { | 48 | { |
49 | //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; | 49 | //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; |
50 | QFile confFile(confFileInfo->absFilePath()); | 50 | QFile confFile(confFileInfo->absFilePath()); |
51 | if(! confFile.open(IO_ReadOnly)) | 51 | if(! confFile.open(IO_ReadOnly)) |
52 | QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); | 52 | QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); |
53 | QTextStream t( &confFile ); | 53 | |
54 | QString s; | 54 | QTextStream t( &confFile ); |
55 | QString s; | ||
55 | QString group; | 56 | QString group; |
56 | ListViewItemConfigEntry *groupItem; | 57 | ListViewItemConfigEntry *groupItem = 0; |
57 | ListViewItemConfigEntry *item; | 58 | ListViewItemConfigEntry *item; |
58 | while ( !t.atEnd() ) | 59 | while ( !t.atEnd() ) |
59 | { | 60 | { |
60 | s = t.readLine().stripWhiteSpace(); | 61 | s = t.readLine().stripWhiteSpace(); |
61 | //odebug << "line: >" << s.latin1() << "<\n" << oendl; | 62 | //odebug << "line: >" << s.latin1() << "<\n" << oendl; |
62 | if (s.contains("<?xml")) | 63 | if (s.contains("<?xml")) |
63 | { | 64 | { |
64 | _valid = false; | 65 | _valid = false; |
65 | break; | 66 | break; |
66 | }else | 67 | } |
67 | if ( s[0] == '[' && s[s.length()-1] == ']' ) | 68 | else if ( s[0] == '[' && s[s.length()-1] == ']' ) |
68 | { | 69 | { |
69 | // odebug << "got group"+s << oendl; | 70 | //odebug << "got group"+s << oendl; |
70 | group = s.mid(1,s.length()-2); | 71 | group = s.mid(1,s.length()-2); |
71 | if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); | 72 | if (!groupItem) |
73 | groupItem = new ListViewItemConfigEntry(this, tr("no group") ); | ||
74 | |||
72 | groupItem = new ListViewItemConfigEntry(this, group ); | 75 | groupItem = new ListViewItemConfigEntry(this, group ); |
73 | insertItem( groupItem ); | 76 | insertItem( groupItem ); |
74 | } else | 77 | } |
75 | if ( int pos = s.find('=') ) | 78 | else if ( int pos = s.find('=') ) |
76 | { | 79 | { |
77 | // odebug << "got key"+s << oendl; | 80 | //odebug << "got key"+s << oendl; |
78 | if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << oendl; | 81 | if (!groupItem) |
79 | item = new ListViewItemConfigEntry(this, group, s ); | 82 | odebug << "PANIC! no group >" << group.latin1() << "<" << oendl; |
83 | |||
84 | item = new ListViewItemConfigEntry(this, group, s ); | ||
80 | groupItem->insertItem( item ); | 85 | groupItem->insertItem( item ); |
81 | } | 86 | } |
82 | } | 87 | } |
83 | confFile.close(); | 88 | confFile.close(); |
84 | setExpandable( _valid ); | 89 | setExpandable( _valid ); |
85 | //odebug << "ListViewItemConfFile::parseFile END" << oendl; | 90 | //odebug << "ListViewItemConfFile::parseFile END" << oendl; |
86 | } | 91 | } |
87 | 92 | ||
88 | 93 | ||
89 | void ListViewItemConfFile::remove() | 94 | void ListViewItemConfFile::remove() |
90 | { | 95 | { |
91 | QFile::remove(confFileInfo->absFilePath()); | 96 | QFile::remove(confFileInfo->absFilePath()); |
92 | QFile::remove(backupFileName()); | 97 | QFile::remove(backupFileName()); |
93 | delete this; | 98 | delete this; |
94 | } | 99 | } |
95 | 100 | ||
96 | void ListViewItemConfFile::revert() | 101 | void ListViewItemConfFile::revert() |
97 | { | 102 | { |
98 | if (!_changed) | 103 | if (!_changed) |
99 | { | 104 | { |
100 | // read the backup file | 105 | // read the backup file |
101 | QFile conf(confFileInfo->absFilePath()); | 106 | QFile conf(confFileInfo->absFilePath()); |
102 | QFile back(backupFileName()); | 107 | QFile back(backupFileName()); |
103 | 108 | ||
104 | if (!back.open(IO_ReadOnly)) return; | 109 | if (!back.open(IO_ReadOnly)) return; |
105 | if (!conf.open(IO_WriteOnly)) return; | 110 | if (!conf.open(IO_WriteOnly)) return; |
106 | 111 | ||
107 | #define SIZE 124 | 112 | #define SIZE 124 |
108 | char buf[SIZE]; | 113 | char buf[SIZE]; |
109 | while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c); | 114 | while (int c = back.readBlock(buf, SIZE) ) conf.writeBlock(buf,c); |
110 | conf.close(); | 115 | conf.close(); |
111 | back.close(); | 116 | back.close(); |
112 | } | 117 | } |
113 | parseFile(); | 118 | parseFile(); |
114 | expand(); | 119 | expand(); |
115 | } | 120 | } |
116 | 121 | ||
117 | void ListViewItemConfFile::save() | 122 | void ListViewItemConfFile::save() |
118 | { | 123 | { |
119 | if (!_changed) return; | 124 | if (!_changed) return; |
120 | QFile conf(confFileInfo->absFilePath()); | 125 | QFile conf(confFileInfo->absFilePath()); |
121 | QFile back(backupFileName()); | 126 | QFile back(backupFileName()); |
122 | 127 | ||
123 | if (!conf.open(IO_ReadOnly)) return; | 128 | if (!conf.open(IO_ReadOnly)) return; |
124 | if (!back.open(IO_WriteOnly)) return; | 129 | if (!back.open(IO_WriteOnly)) return; |
125 | 130 | ||
126 | char buf[SIZE]; | 131 | char buf[SIZE]; |
127 | while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c); | 132 | while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c); |
128 | conf.close(); | 133 | conf.close(); |
129 | back.close(); | 134 | back.close(); |
130 | 135 | ||
131 | 136 | ||
132 | if (!conf.open(IO_WriteOnly)) return; | 137 | if (!conf.open(IO_WriteOnly)) return; |
133 | QTextStream *t = new QTextStream( &conf ); | 138 | QTextStream *t = new QTextStream( &conf ); |
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index 9d27c85..a0f72ae 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp | |||
@@ -1,64 +1,65 @@ | |||
1 | #include "io_irda.h" | 1 | #include "io_irda.h" |
2 | 2 | ||
3 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { | 3 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { |
4 | m_attach = 0; | 4 | m_attach = 0; |
5 | } | 5 | } |
6 | 6 | ||
7 | 7 | ||
8 | IOIrda::~IOIrda() { | 8 | IOIrda::~IOIrda() { |
9 | if ( m_attach ) { | 9 | if ( m_attach ) { |
10 | delete m_attach; | 10 | delete m_attach; |
11 | } | 11 | } |
12 | } | 12 | } |
13 | 13 | ||
14 | 14 | ||
15 | void IOIrda::close() { | 15 | void IOIrda::close() { |
16 | 16 | ||
17 | IOSerial::close(); | 17 | IOSerial::close(); |
18 | // still need error handling | 18 | // still need error handling |
19 | delete m_attach; | 19 | delete m_attach; |
20 | } | 20 | } |
21 | 21 | ||
22 | bool IOIrda::open() { | 22 | bool IOIrda::open() { |
23 | bool ret; | 23 | bool ret; |
24 | 24 | ||
25 | // irdaattach here | 25 | // irdaattach here |
26 | m_attach = new Opie::Core::OProcess(); | 26 | m_attach = new Opie::Core::OProcess(); |
27 | *m_attach << "irattach /dev/ttyS2 -s"; | 27 | *m_attach << "irattach /dev/ttyS2 -s"; |
28 | 28 | ||
29 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), | 29 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), |
30 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 30 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
31 | 31 | ||
32 | if ( m_attach->start() ) { | 32 | if ( m_attach->start() ) { |
33 | ret= IOSerial::open(); | 33 | ret= IOSerial::open(); |
34 | } else { | 34 | } else { |
35 | // emit error!!! | 35 | // emit error!!! |
36 | delete m_attach; | 36 | delete m_attach; |
37 | m_attach = 0l; | 37 | m_attach = 0l; |
38 | ret = false; | ||
38 | } | 39 | } |
39 | return ret; | 40 | return ret; |
40 | } | 41 | } |
41 | 42 | ||
42 | void IOIrda::reload( const Profile &config ) { | 43 | void IOIrda::reload( const Profile &config ) { |
43 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); | 44 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); |
44 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); | 45 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); |
45 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); | 46 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); |
46 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); | 47 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); |
47 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); | 48 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); |
48 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); | 49 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); |
49 | } | 50 | } |
50 | 51 | ||
51 | 52 | ||
52 | QString IOIrda::identifier() const { | 53 | QString IOIrda::identifier() const { |
53 | return "irda"; | 54 | return "irda"; |
54 | } | 55 | } |
55 | 56 | ||
56 | QString IOIrda::name() const { | 57 | QString IOIrda::name() const { |
57 | return "Irda IO Layer"; | 58 | return "Irda IO Layer"; |
58 | } | 59 | } |
59 | 60 | ||
60 | void IOIrda::slotExited(Opie::Core::OProcess* proc ){ | 61 | void IOIrda::slotExited(Opie::Core::OProcess* proc ){ |
61 | close(); | 62 | close(); |
62 | delete proc; | 63 | delete proc; |
63 | } | 64 | } |
64 | 65 | ||
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index aba7244..a884179 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -662,114 +662,110 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
662 | } | 662 | } |
663 | 663 | ||
664 | m_kb->load(currentSession()->profile()); | 664 | m_kb->load(currentSession()->profile()); |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | void MainWindow::slotWrap() | 668 | void MainWindow::slotWrap() |
669 | { | 669 | { |
670 | if(m_curSession) | 670 | if(m_curSession) |
671 | { | 671 | { |
672 | EmulationHandler *e = m_curSession->emulationHandler(); | 672 | EmulationHandler *e = m_curSession->emulationHandler(); |
673 | if(e) | 673 | if(e) |
674 | { | 674 | { |
675 | e->setWrap( m_isWrapped ? 80:0 ); | 675 | e->setWrap( m_isWrapped ? 80:0 ); |
676 | m_isWrapped = !m_isWrapped; | 676 | m_isWrapped = !m_isWrapped; |
677 | } | 677 | } |
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | void MainWindow::slotFullscreen() { | 681 | void MainWindow::slotFullscreen() { |
682 | 682 | ||
683 | 683 | ||
684 | 684 | ||
685 | if ( m_isFullscreen ) { | 685 | if ( m_isFullscreen ) { |
686 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 686 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
687 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 687 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
688 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 688 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
689 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 689 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
690 | 690 | ||
691 | } else { | 691 | } else { |
692 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 692 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
693 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 693 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
694 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 694 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
695 | , QPoint(0,0), false ); | 695 | , QPoint(0,0), false ); |
696 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 696 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
697 | ( m_curSession->widgetStack() )->setFocus(); | 697 | ( m_curSession->widgetStack() )->setFocus(); |
698 | ( m_curSession->widgetStack() )->show(); | 698 | ( m_curSession->widgetStack() )->show(); |
699 | 699 | ||
700 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 700 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
701 | 701 | ||
702 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 702 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
703 | } | 703 | } |
704 | 704 | ||
705 | m_isFullscreen = !m_isFullscreen; | 705 | m_isFullscreen = !m_isFullscreen; |
706 | } | 706 | } |
707 | 707 | ||
708 | void MainWindow::slotScrollbarSelected(int index) | 708 | void MainWindow::slotScrollbarSelected(int index) |
709 | { | 709 | { |
710 | int loc; | 710 | int loc = 0; |
711 | 711 | ||
712 | Config cfg( "Konsole" ); | 712 | Config cfg( "Konsole" ); |
713 | cfg.setGroup("ScrollBar"); | 713 | cfg.setGroup("ScrollBar"); |
714 | if(index == sm_none) | 714 | if(index == sm_left) |
715 | { | ||
716 | loc = 0; | ||
717 | } | ||
718 | else if(index == sm_left) | ||
719 | { | 715 | { |
720 | loc = 1; | 716 | loc = 1; |
721 | } | 717 | } |
722 | else if(index == sm_right) | 718 | else if(index == sm_right) |
723 | { | 719 | { |
724 | loc = 2; | 720 | loc = 2; |
725 | } | 721 | } |
726 | 722 | ||
727 | cfg.writeEntry("Position", loc); | 723 | cfg.writeEntry("Position", loc); |
728 | 724 | ||
729 | if (currentSession()) { | 725 | if (currentSession()) { |
730 | currentSession()->emulationHandler()->setScrollbarLocation(loc); | 726 | currentSession()->emulationHandler()->setScrollbarLocation(loc); |
731 | } | 727 | } |
732 | 728 | ||
733 | m_scrollbar->setItemChecked(sm_none, index == sm_none); | 729 | m_scrollbar->setItemChecked(sm_none, index == sm_none); |
734 | m_scrollbar->setItemChecked(sm_left, index == sm_left); | 730 | m_scrollbar->setItemChecked(sm_left, index == sm_left); |
735 | m_scrollbar->setItemChecked(sm_right, index == sm_right); | 731 | m_scrollbar->setItemChecked(sm_right, index == sm_right); |
736 | } | 732 | } |
737 | 733 | ||
738 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 734 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
739 | 735 | ||
740 | if ( m_curSession ) { | 736 | if ( m_curSession ) { |
741 | 737 | ||
742 | QEvent::Type state; | 738 | QEvent::Type state; |
743 | 739 | ||
744 | if (pressed) state = QEvent::KeyPress; | 740 | if (pressed) state = QEvent::KeyPress; |
745 | else state = QEvent::KeyRelease; | 741 | else state = QEvent::KeyRelease; |
746 | 742 | ||
747 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 743 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
748 | 744 | ||
749 | // is this the best way to do this? cant figure out any other way to work | 745 | // is this the best way to do this? cant figure out any other way to work |
750 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 746 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
751 | ke.ignore(); | 747 | ke.ignore(); |
752 | } | 748 | } |
753 | } | 749 | } |
754 | void MainWindow::slotCopy() { | 750 | void MainWindow::slotCopy() { |
755 | if (!currentSession() ) return; | 751 | if (!currentSession() ) return; |
756 | currentSession()->emulationHandler()->copy(); | 752 | currentSession()->emulationHandler()->copy(); |
757 | } | 753 | } |
758 | void MainWindow::slotPaste() { | 754 | void MainWindow::slotPaste() { |
759 | if (!currentSession() ) return; | 755 | if (!currentSession() ) return; |
760 | currentSession()->emulationHandler()->paste(); | 756 | currentSession()->emulationHandler()->paste(); |
761 | } | 757 | } |
762 | 758 | ||
763 | /* | 759 | /* |
764 | * Save the session | 760 | * Save the session |
765 | */ | 761 | */ |
766 | 762 | ||
767 | void MainWindow::slotSaveSession() { | 763 | void MainWindow::slotSaveSession() { |
768 | if (!currentSession() ) { | 764 | if (!currentSession() ) { |
769 | QMessageBox::information(this, tr("Save Connection"), | 765 | QMessageBox::information(this, tr("Save Connection"), |
770 | tr("<qt>There is no Connection.</qt>"), 1 ); | 766 | tr("<qt>There is no Connection.</qt>"), 1 ); |
771 | return; | 767 | return; |
772 | } | 768 | } |
773 | manager()->add( currentSession()->profile() ); | 769 | manager()->add( currentSession()->profile() ); |
774 | manager()->save(); | 770 | manager()->save(); |
775 | populateProfiles(); | 771 | populateProfiles(); |
diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp index 25cdfae..a4ea60a 100644 --- a/noncore/apps/opie-reader/CFilter.cpp +++ b/noncore/apps/opie-reader/CFilter.cpp | |||
@@ -456,97 +456,97 @@ void repalm::getch(tchar& ch, CStyle& sty, unsigned long& pos) | |||
456 | case 0x9f: | 456 | case 0x9f: |
457 | ch = 0x0178; | 457 | ch = 0x0178; |
458 | break; | 458 | break; |
459 | case 0x18: | 459 | case 0x18: |
460 | ch = 0x2026; | 460 | ch = 0x2026; |
461 | break; | 461 | break; |
462 | case 0x19: | 462 | case 0x19: |
463 | ch = 0x2007; | 463 | ch = 0x2007; |
464 | break; | 464 | break; |
465 | case 0x8d: | 465 | case 0x8d: |
466 | ch = 0x2662; | 466 | ch = 0x2662; |
467 | break; | 467 | break; |
468 | case 0x8e: | 468 | case 0x8e: |
469 | ch = 0x2663; | 469 | ch = 0x2663; |
470 | break; | 470 | break; |
471 | case 0x8f: | 471 | case 0x8f: |
472 | ch = 0x2661; | 472 | ch = 0x2661; |
473 | break; | 473 | break; |
474 | case 0x90: | 474 | case 0x90: |
475 | ch = 0x2660; | 475 | ch = 0x2660; |
476 | break; | 476 | break; |
477 | default: | 477 | default: |
478 | break; | 478 | break; |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | //static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; | 482 | //static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; |
483 | //static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; | 483 | //static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; |
484 | 484 | ||
485 | void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) | 485 | void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) |
486 | { | 486 | { |
487 | if (m_buffed > 0) | 487 | if (m_buffed > 0) |
488 | { | 488 | { |
489 | sty = m_laststyle; | 489 | sty = m_laststyle; |
490 | ch = nextpart[m_current++]; | 490 | ch = nextpart[m_current++]; |
491 | if (m_current == m_buffed) | 491 | if (m_current == m_buffed) |
492 | { | 492 | { |
493 | m_current = m_buffed = 0; | 493 | m_current = m_buffed = 0; |
494 | } | 494 | } |
495 | } | 495 | } |
496 | else | 496 | else |
497 | { | 497 | { |
498 | if (m_buffer != 0) | 498 | if (m_buffer != 0) |
499 | { | 499 | { |
500 | ch = m_buffer; | 500 | ch = m_buffer; |
501 | m_buffer = 0; | 501 | m_buffer = 0; |
502 | return; | 502 | return; |
503 | } | 503 | } |
504 | unsigned long lnk, lnkoff; | 504 | unsigned long lnk = 0, lnkoff = 0; |
505 | do | 505 | do |
506 | { | 506 | { |
507 | if (nextpart[m_buffed] == 0) break; | 507 | if (nextpart[m_buffed] == 0) break; |
508 | parent->getch(ch, sty, pos); | 508 | parent->getch(ch, sty, pos); |
509 | m_laststyle = sty; | 509 | m_laststyle = sty; |
510 | if (sty.getLink()) | 510 | if (sty.getLink()) |
511 | { | 511 | { |
512 | lnk = sty.getData(); | 512 | lnk = sty.getData(); |
513 | lnkoff = sty.getOffset(); | 513 | lnkoff = sty.getOffset(); |
514 | } | 514 | } |
515 | } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); | 515 | } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); |
516 | m_current = 0; | 516 | m_current = 0; |
517 | if (nextpart[m_buffed] == 0) | 517 | if (nextpart[m_buffed] == 0) |
518 | { | 518 | { |
519 | m_buffed = 0; | 519 | m_buffed = 0; |
520 | QString dmy, dmy2; | 520 | QString dmy, dmy2; |
521 | parent->hyperlink(lnk, lnkoff, dmy, dmy2); | 521 | parent->hyperlink(lnk, lnkoff, dmy, dmy2); |
522 | do | 522 | do |
523 | { | 523 | { |
524 | parent->getch(ch, sty, pos); | 524 | parent->getch(ch, sty, pos); |
525 | } | 525 | } |
526 | while (ch != 10); | 526 | while (ch != 10); |
527 | parent->getch(ch, sty, pos); | 527 | parent->getch(ch, sty, pos); |
528 | } | 528 | } |
529 | else if (m_buffed > 0) | 529 | else if (m_buffed > 0) |
530 | { | 530 | { |
531 | m_buffer = ch; | 531 | m_buffer = ch; |
532 | ch = nextpart[0]; | 532 | ch = nextpart[0]; |
533 | if (m_buffed == 1) | 533 | if (m_buffed == 1) |
534 | { | 534 | { |
535 | m_buffed = 0; | 535 | m_buffed = 0; |
536 | } | 536 | } |
537 | else m_current = 1; | 537 | else m_current = 1; |
538 | } | 538 | } |
539 | } | 539 | } |
540 | 540 | ||
541 | return; | 541 | return; |
542 | } | 542 | } |
543 | 543 | ||
544 | HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255) | 544 | HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255) |
545 | { | 545 | { |
546 | } | 546 | } |
547 | 547 | ||
548 | #include "Bkmks.h" | 548 | #include "Bkmks.h" |
549 | #include "QTReader.h" | 549 | #include "QTReader.h" |
550 | 550 | ||
551 | void HighlightFilter::refresh(unsigned long pos) | 551 | void HighlightFilter::refresh(unsigned long pos) |
552 | { | 552 | { |
diff --git a/noncore/apps/opie-reader/CRegExp.cpp b/noncore/apps/opie-reader/CRegExp.cpp index 6318d28..e3194df 100644 --- a/noncore/apps/opie-reader/CRegExp.cpp +++ b/noncore/apps/opie-reader/CRegExp.cpp | |||
@@ -64,97 +64,97 @@ void CRegExpFilt::prepreprocessing(const QString& pat, bool insens) | |||
64 | #ifdef _WINDOWS | 64 | #ifdef _WINDOWS |
65 | switch (pat.at(p).unicode()) | 65 | switch (pat.at(p).unicode()) |
66 | #else | 66 | #else |
67 | switch (pat[p].unicode()) | 67 | switch (pat[p].unicode()) |
68 | #endif | 68 | #endif |
69 | { | 69 | { |
70 | case '{': | 70 | case '{': |
71 | { | 71 | { |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | case '}': | 74 | case '}': |
75 | { | 75 | { |
76 | break; | 76 | break; |
77 | } | 77 | } |
78 | case '^': | 78 | case '^': |
79 | { | 79 | { |
80 | break; | 80 | break; |
81 | } | 81 | } |
82 | case '.' : | 82 | case '.' : |
83 | { | 83 | { |
84 | break; | 84 | break; |
85 | } | 85 | } |
86 | case '#': | 86 | case '#': |
87 | { | 87 | { |
88 | p++; | 88 | p++; |
89 | #ifdef _WINDOWS | 89 | #ifdef _WINDOWS |
90 | while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') | 90 | while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') |
91 | #else | 91 | #else |
92 | while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') | 92 | while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') |
93 | #endif | 93 | #endif |
94 | { | 94 | { |
95 | } | 95 | } |
96 | p--; | 96 | p--; |
97 | break; | 97 | break; |
98 | } | 98 | } |
99 | case '\\' : | 99 | case '\\' : |
100 | { | 100 | { |
101 | #ifdef _WINDOWS | 101 | #ifdef _WINDOWS |
102 | tchar c = escapedchar(pat.at(++p).unicode()); | 102 | tchar c = escapedchar(pat.at(++p).unicode()); |
103 | #else | 103 | #else |
104 | tchar c = escapedchar(pat[++p].unicode()); | 104 | tchar c = escapedchar(pat[++p].unicode()); |
105 | #endif | 105 | #endif |
106 | regchar(c, insens); | 106 | regchar(c, insens); |
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | 109 | ||
110 | case '[' : | 110 | case '[' : |
111 | { | 111 | { |
112 | tchar clast; | 112 | tchar clast = 0; |
113 | bool invert = false; | 113 | bool invert = false; |
114 | tchar c; | 114 | tchar c; |
115 | #ifdef _WINDOWS | 115 | #ifdef _WINDOWS |
116 | if (pat.at(p+1).unicode() == '^') | 116 | if (pat.at(p+1).unicode() == '^') |
117 | #else | 117 | #else |
118 | if (pat[p+1].unicode() == '^') | 118 | if (pat[p+1].unicode() == '^') |
119 | #endif | 119 | #endif |
120 | { | 120 | { |
121 | p++; | 121 | p++; |
122 | invert = true; | 122 | invert = true; |
123 | } | 123 | } |
124 | #ifdef _WINDOWS | 124 | #ifdef _WINDOWS |
125 | while ((c = pat.at(++p).unicode()) != ']') | 125 | while ((c = pat.at(++p).unicode()) != ']') |
126 | #else | 126 | #else |
127 | while ((c = pat[++p].unicode()) != ']') | 127 | while ((c = pat[++p].unicode()) != ']') |
128 | #endif | 128 | #endif |
129 | { | 129 | { |
130 | if (c == '\\') | 130 | if (c == '\\') |
131 | { | 131 | { |
132 | #ifdef _WINDOWS | 132 | #ifdef _WINDOWS |
133 | c = escapedchar(pat.at(++p).unicode()); | 133 | c = escapedchar(pat.at(++p).unicode()); |
134 | #else | 134 | #else |
135 | c = escapedchar(pat[++p].unicode()); | 135 | c = escapedchar(pat[++p].unicode()); |
136 | #endif | 136 | #endif |
137 | if (c == ']') break; | 137 | if (c == ']') break; |
138 | } | 138 | } |
139 | if (c == '-') | 139 | if (c == '-') |
140 | { | 140 | { |
141 | #ifdef _WINDOWS | 141 | #ifdef _WINDOWS |
142 | c = pat.at(++p).unicode(); | 142 | c = pat.at(++p).unicode(); |
143 | #else | 143 | #else |
144 | c = pat[++p].unicode(); | 144 | c = pat[++p].unicode(); |
145 | #endif | 145 | #endif |
146 | for (tchar j = clast; j <= c; j++) | 146 | for (tchar j = clast; j <= c; j++) |
147 | { | 147 | { |
148 | regchar(j, insens); | 148 | regchar(j, insens); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | else | 151 | else |
152 | { | 152 | { |
153 | regchar(c, insens); | 153 | regchar(c, insens); |
154 | } | 154 | } |
155 | clast = c; | 155 | clast = c; |
156 | } | 156 | } |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | default : | 159 | default : |
160 | { | 160 | { |
@@ -242,97 +242,97 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens) | |||
242 | #endif | 242 | #endif |
243 | } | 243 | } |
244 | p--; | 244 | p--; |
245 | count = count-1; | 245 | count = count-1; |
246 | unsigned int mask = 0; | 246 | unsigned int mask = 0; |
247 | for (unsigned int i = m; i < m+count; i++) | 247 | for (unsigned int i = m; i < m+count; i++) |
248 | { | 248 | { |
249 | mask |= bit[i]; | 249 | mask |= bit[i]; |
250 | } | 250 | } |
251 | 251 | ||
252 | for (iter it = CV.begin(); it != CV.end(); ++it) | 252 | for (iter it = CV.begin(); it != CV.end(); ++it) |
253 | { | 253 | { |
254 | if (CV[it.first()] & bit[m-1]) | 254 | if (CV[it.first()] & bit[m-1]) |
255 | { | 255 | { |
256 | CV[it.first()] |= mask; | 256 | CV[it.first()] |= mask; |
257 | } | 257 | } |
258 | } | 258 | } |
259 | if (keep & bit[m-1]) keep |= mask; | 259 | if (keep & bit[m-1]) keep |= mask; |
260 | m += count; | 260 | m += count; |
261 | } | 261 | } |
262 | else | 262 | else |
263 | { | 263 | { |
264 | p++; | 264 | p++; |
265 | } | 265 | } |
266 | break; | 266 | break; |
267 | } | 267 | } |
268 | case '\\' : | 268 | case '\\' : |
269 | { | 269 | { |
270 | #ifdef _WINDOWS | 270 | #ifdef _WINDOWS |
271 | tchar c = escapedchar(pat.at(++p).unicode()); | 271 | tchar c = escapedchar(pat.at(++p).unicode()); |
272 | #else | 272 | #else |
273 | tchar c = escapedchar(pat[++p].unicode()); | 273 | tchar c = escapedchar(pat[++p].unicode()); |
274 | #endif | 274 | #endif |
275 | if (insens) | 275 | if (insens) |
276 | { | 276 | { |
277 | CV[upper(c)] |= bit[m]; | 277 | CV[upper(c)] |= bit[m]; |
278 | CV[lower(c)] |= bit[m]; | 278 | CV[lower(c)] |= bit[m]; |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | CV[c] |= bit[m]; | 282 | CV[c] |= bit[m]; |
283 | } | 283 | } |
284 | m++; | 284 | m++; |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | 287 | ||
288 | case '[' : | 288 | case '[' : |
289 | { | 289 | { |
290 | tchar c, clast; | 290 | tchar c, clast = 0; |
291 | bool invert = false; | 291 | bool invert = false; |
292 | #ifdef _WINDOWS | 292 | #ifdef _WINDOWS |
293 | if (pat.at(p+1).unicode() == '^') | 293 | if (pat.at(p+1).unicode() == '^') |
294 | #else | 294 | #else |
295 | if (pat[p+1].unicode() == '^') | 295 | if (pat[p+1].unicode() == '^') |
296 | #endif | 296 | #endif |
297 | { | 297 | { |
298 | p++; | 298 | p++; |
299 | invert = true; | 299 | invert = true; |
300 | } | 300 | } |
301 | #ifdef _WINDOWS | 301 | #ifdef _WINDOWS |
302 | while ((c = pat.at(++p).unicode()) != ']') | 302 | while ((c = pat.at(++p).unicode()) != ']') |
303 | #else | 303 | #else |
304 | while ((c = pat[++p].unicode()) != ']') | 304 | while ((c = pat[++p].unicode()) != ']') |
305 | #endif | 305 | #endif |
306 | { | 306 | { |
307 | if (c == '\\') | 307 | if (c == '\\') |
308 | { | 308 | { |
309 | #ifdef _WINDOWS | 309 | #ifdef _WINDOWS |
310 | c = escapedchar(pat.at(++p).unicode()); | 310 | c = escapedchar(pat.at(++p).unicode()); |
311 | #else | 311 | #else |
312 | c = escapedchar(pat[++p].unicode()); | 312 | c = escapedchar(pat[++p].unicode()); |
313 | #endif | 313 | #endif |
314 | if (c == ']') break; | 314 | if (c == ']') break; |
315 | } | 315 | } |
316 | if (c == '-') | 316 | if (c == '-') |
317 | { | 317 | { |
318 | #ifdef _WINDOWS | 318 | #ifdef _WINDOWS |
319 | c = pat.at(++p).unicode(); | 319 | c = pat.at(++p).unicode(); |
320 | #else | 320 | #else |
321 | c = pat[++p].unicode(); | 321 | c = pat[++p].unicode(); |
322 | #endif | 322 | #endif |
323 | for (tchar j = clast; j <= c; j++) | 323 | for (tchar j = clast; j <= c; j++) |
324 | { | 324 | { |
325 | if (insens) | 325 | if (insens) |
326 | { | 326 | { |
327 | iter it; | 327 | iter it; |
328 | if ((it = CV.find(upper(j))) != CV.end()) | 328 | if ((it = CV.find(upper(j))) != CV.end()) |
329 | CV[it] |= bit[m]; | 329 | CV[it] |= bit[m]; |
330 | else | 330 | else |
331 | CV[0] |= bit[m]; | 331 | CV[0] |= bit[m]; |
332 | if ((it = CV.find(lower(j))) != CV.end()) | 332 | if ((it = CV.find(lower(j))) != CV.end()) |
333 | CV[it] |= bit[m]; | 333 | CV[it] |= bit[m]; |
334 | else | 334 | else |
335 | CV[0] |= bit[m]; | 335 | CV[0] |= bit[m]; |
336 | } | 336 | } |
337 | else | 337 | else |
338 | { | 338 | { |
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index 361755f..09cad1c 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp | |||
@@ -80,185 +80,185 @@ static ColorMapEntry Palm8BitColormap[] = { | |||
80 | { 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 }, | 80 | { 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 }, |
81 | { 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 }, | 81 | { 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 }, |
82 | { 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 }, | 82 | { 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 }, |
83 | { 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 }, | 83 | { 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 }, |
84 | { 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 }, | 84 | { 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 }, |
85 | { 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 }, | 85 | { 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 }, |
86 | { 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 }, | 86 | { 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 }, |
87 | { 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 }, | 87 | { 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 }, |
88 | { 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 }, | 88 | { 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 }, |
89 | { 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 }, | 89 | { 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 }, |
90 | { 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 }, | 90 | { 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 }, |
91 | { 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 }, | 91 | { 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 }, |
92 | { 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 }, | 92 | { 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 }, |
93 | { 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 }, | 93 | { 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 }, |
94 | { 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 }, | 94 | { 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 }, |
95 | { 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 }, | 95 | { 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 }, |
96 | { 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 }, | 96 | { 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 }, |
97 | { 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 }, | 97 | { 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 }, |
98 | { 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 }, | 98 | { 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 }, |
99 | { 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 }, | 99 | { 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 }, |
100 | { 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 }, | 100 | { 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 }, |
101 | { 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 }, | 101 | { 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 }, |
102 | { 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 }, | 102 | { 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 }, |
103 | { 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 }, | 103 | { 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 }, |
104 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, | 104 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, |
105 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, | 105 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, |
106 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, | 106 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, |
107 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, | 107 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, |
108 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, | 108 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, |
109 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}; | 109 | { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}; |
110 | 110 | ||
111 | static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }}; | 111 | static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }}; |
112 | 112 | ||
113 | static ColorMapEntry Palm2BitColormap[] = { | 113 | static ColorMapEntry Palm2BitColormap[] = { |
114 | { 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }}; | 114 | { 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }}; |
115 | 115 | ||
116 | static ColorMapEntry Palm4BitColormap[] = { | 116 | static ColorMapEntry Palm4BitColormap[] = { |
117 | { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, | 117 | { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, |
118 | { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, | 118 | { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, |
119 | { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 }, | 119 | { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 }, |
120 | { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; | 120 | { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; |
121 | 121 | ||
122 | QImage* Palm2QImage | 122 | QImage* Palm2QImage |
123 | (unsigned char *image_bytes_in, int byte_count_in) | 123 | (unsigned char *image_bytes_in, int byte_count_in) |
124 | { | 124 | { |
125 | unsigned int width, height, bytes_per_row, flags, next_depth_offset; | 125 | unsigned int width, height, bytes_per_row, flags, next_depth_offset; |
126 | unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; | 126 | unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; |
127 | unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; | 127 | unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; |
128 | unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow, | 128 | unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow, |
129 | *imagedatastart, *palmimage; | 129 | *imagedatastart, *palmimage; |
130 | ColorMapEntry *colormap; | 130 | ColorMapEntry *colormap; |
131 | 131 | ||
132 | palmimage = image_bytes_in; | 132 | palmimage = image_bytes_in; |
133 | width = READ_BIGENDIAN_SHORT(palmimage + 0); | 133 | width = READ_BIGENDIAN_SHORT(palmimage + 0); |
134 | height = READ_BIGENDIAN_SHORT(palmimage + 2); | 134 | height = READ_BIGENDIAN_SHORT(palmimage + 2); |
135 | bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); | 135 | bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); |
136 | flags = READ_BIGENDIAN_SHORT(palmimage + 6); | 136 | flags = READ_BIGENDIAN_SHORT(palmimage + 6); |
137 | bits_per_pixel = palmimage[8]; | 137 | bits_per_pixel = palmimage[8]; |
138 | version = palmimage[9]; | 138 | version = palmimage[9]; |
139 | next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); | 139 | next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); |
140 | transparent_index = palmimage[12]; | 140 | transparent_index = palmimage[12]; |
141 | compression_type = palmimage[13]; | 141 | compression_type = palmimage[13]; |
142 | /* bytes 14 and 15 are reserved by Palm and always 0 */ | 142 | /* bytes 14 and 15 are reserved by Palm and always 0 */ |
143 | 143 | ||
144 | #if 0 | 144 | #if 0 |
145 | // qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); | 145 | // qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | if (compression_type == PALM_COMPRESSION_PACKBITS) { | 148 | if (compression_type == PALM_COMPRESSION_PACKBITS) { |
149 | // qDebug ("Image uses packbits compression; not yet supported"); | 149 | // qDebug ("Image uses packbits compression; not yet supported"); |
150 | return NULL; | 150 | return NULL; |
151 | } else if ((compression_type != PALM_COMPRESSION_NONE) && | 151 | } else if ((compression_type != PALM_COMPRESSION_NONE) && |
152 | (compression_type != PALM_COMPRESSION_RLE) && | 152 | (compression_type != PALM_COMPRESSION_RLE) && |
153 | (compression_type != PALM_COMPRESSION_SCANLINE)) { | 153 | (compression_type != PALM_COMPRESSION_SCANLINE)) { |
154 | // qDebug ("Image uses unknown compression, code 0x%x", compression_type); | 154 | // qDebug ("Image uses unknown compression, code 0x%x", compression_type); |
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: | 158 | /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: |
159 | 159 | ||
160 | 1, 2, or 4 bit grayscale | 160 | 1, 2, or 4 bit grayscale |
161 | 8-bit StaticColor using the Palm standard colormap | 161 | 8-bit StaticColor using the Palm standard colormap |
162 | 8-bit PseudoColor using a user-specified colormap | 162 | 8-bit PseudoColor using a user-specified colormap |
163 | 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue | 163 | 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue |
164 | 164 | ||
165 | Each of these can be compressed with one of four compression schemes, | 165 | Each of these can be compressed with one of four compression schemes, |
166 | "RLE", "Scanline", "PackBits", or none. | 166 | "RLE", "Scanline", "PackBits", or none. |
167 | 167 | ||
168 | We begin by constructing the colormap. | 168 | We begin by constructing the colormap. |
169 | */ | 169 | */ |
170 | 170 | ||
171 | if (flags & PALM_HAS_COLORMAP_FLAG) { | 171 | if (flags & PALM_HAS_COLORMAP_FLAG) { |
172 | // qDebug("Palm images with custom colormaps are not currently supported.\n"); | 172 | // qDebug("Palm images with custom colormaps are not currently supported.\n"); |
173 | return NULL; | 173 | return NULL; |
174 | } else if (bits_per_pixel == 1) { | 174 | } else if (bits_per_pixel == 1) { |
175 | colormap = Palm1BitColormap; | 175 | colormap = Palm1BitColormap; |
176 | imagedatastart = palmimage + 16; | 176 | imagedatastart = palmimage + 16; |
177 | } else if (bits_per_pixel == 2) { | 177 | } else if (bits_per_pixel == 2) { |
178 | colormap = Palm2BitColormap; | 178 | colormap = Palm2BitColormap; |
179 | imagedatastart = palmimage + 16; | 179 | imagedatastart = palmimage + 16; |
180 | } else if (bits_per_pixel == 4) { | 180 | } else if (bits_per_pixel == 4) { |
181 | colormap = Palm4BitColormap; | 181 | colormap = Palm4BitColormap; |
182 | imagedatastart = palmimage + 16; | 182 | imagedatastart = palmimage + 16; |
183 | } else if (bits_per_pixel == 8) { | 183 | } else if (bits_per_pixel == 8) { |
184 | colormap = Palm8BitColormap; | 184 | colormap = Palm8BitColormap; |
185 | imagedatastart = palmimage + 16; | 185 | imagedatastart = palmimage + 16; |
186 | } else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) { | 186 | } else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) { |
187 | colormap = NULL; | 187 | colormap = NULL; |
188 | palm_red_bits = palmimage[16]; | 188 | palm_red_bits = palmimage[16]; |
189 | palm_green_bits = palmimage[17]; | 189 | palm_green_bits = palmimage[17]; |
190 | palm_blue_bits = palmimage[18]; | 190 | palm_blue_bits = palmimage[18]; |
191 | // qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); | 191 | // qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); |
192 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { | 192 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { |
193 | // qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); | 193 | // qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); |
194 | return NULL; | 194 | return NULL; |
195 | } | 195 | } |
196 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { | 196 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { |
197 | // qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); | 197 | // qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); |
198 | return NULL; | 198 | return NULL; |
199 | } | 199 | } |
200 | imagedatastart = palmimage + 24; | 200 | imagedatastart = palmimage + 24; |
201 | } else { | 201 | } else { |
202 | // qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); | 202 | // qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); |
203 | return NULL; | 203 | return NULL; |
204 | } | 204 | } |
205 | 205 | ||
206 | #ifndef USEQPE | 206 | #ifndef USEQPE |
207 | QImage* qimage = new QImage(width, height, 32); | 207 | QImage* qimage = new QImage(width, height, 32); |
208 | #else | 208 | #else |
209 | QImage* qimage = new QImage(width, height, 16); | 209 | QImage* qimage = new QImage(width, height, 16); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ | 212 | /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ |
213 | rowbuf = new unsigned char[bytes_per_row * width]; | 213 | rowbuf = new unsigned char[bytes_per_row * width]; |
214 | lastrow = new unsigned char[bytes_per_row * width]; | 214 | lastrow = new unsigned char[bytes_per_row * width]; |
215 | 215 | ||
216 | for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { | 216 | for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) { |
217 | // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); | 217 | // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); |
218 | 218 | ||
219 | /* first, uncompress the Palm image */ | 219 | /* first, uncompress the Palm image */ |
220 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { | 220 | if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { |
221 | for (j = 0; j < bytes_per_row; ) { | 221 | for (j = 0; j < bytes_per_row; ) { |
222 | incount = *palm_ptr++; | 222 | incount = *palm_ptr++; |
223 | inval = *palm_ptr++; | 223 | inval = *palm_ptr++; |
224 | memset(rowbuf + j, inval, incount); | 224 | memset(rowbuf + j, inval, incount); |
225 | j += incount; | 225 | j += incount; |
226 | } | 226 | } |
227 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { | 227 | } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { |
228 | for (j = 0; j < bytes_per_row; j += 8) { | 228 | for (j = 0; j < bytes_per_row; j += 8) { |
229 | incount = *palm_ptr++; | 229 | incount = *palm_ptr++; |
230 | inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; | 230 | inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; |
231 | for (inbit = 0; inbit < inval; inbit += 1) { | 231 | for (inbit = 0; inbit < inval; inbit += 1) { |
232 | if (incount & (1 << (7 - inbit))) | 232 | if (incount & (1 << (7 - inbit))) |
233 | rowbuf[j + inbit] = *palm_ptr++; | 233 | rowbuf[j + inbit] = *palm_ptr++; |
234 | else | 234 | else |
235 | rowbuf[j + inbit] = lastrow[j + inbit]; | 235 | rowbuf[j + inbit] = lastrow[j + inbit]; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | memcpy (lastrow, rowbuf, bytes_per_row); | 238 | memcpy (lastrow, rowbuf, bytes_per_row); |
239 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && | 239 | } else if (((flags & PALM_IS_COMPRESSED_FLAG) && |
240 | (compression_type == PALM_COMPRESSION_NONE)) || | 240 | (compression_type == PALM_COMPRESSION_NONE)) || |
241 | ((flags & PALM_IS_COMPRESSED_FLAG) == 0)) | 241 | ((flags & PALM_IS_COMPRESSED_FLAG) == 0)) |
242 | { | 242 | { |
243 | memcpy (rowbuf, palm_ptr, bytes_per_row); | 243 | memcpy (rowbuf, palm_ptr, bytes_per_row); |
244 | palm_ptr += bytes_per_row; | 244 | palm_ptr += bytes_per_row; |
245 | } | 245 | } |
246 | else { | 246 | else { |
247 | qDebug("Case 4"); | 247 | qDebug("Case 4"); |
248 | qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); | 248 | qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); |
249 | qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); | 249 | qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); |
250 | qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); | 250 | qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); |
251 | qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); | 251 | qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); |
252 | qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); | 252 | qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); |
253 | memcpy (rowbuf, palm_ptr, bytes_per_row); | 253 | memcpy (rowbuf, palm_ptr, bytes_per_row); |
254 | palm_ptr += bytes_per_row; | 254 | palm_ptr += bytes_per_row; |
255 | } | 255 | } |
256 | /* next, write it to the GDK bitmap */ | 256 | /* next, write it to the GDK bitmap */ |
257 | if (colormap) { | 257 | if (colormap) { |
258 | mask = (1 << bits_per_pixel) - 1; | 258 | mask = (1 << bits_per_pixel) - 1; |
259 | for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { | 259 | for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { |
260 | inval = ((*inbyte) & (mask << inbit)) >> inbit; | 260 | inval = ((*inbyte) & (mask << inbit)) >> inbit; |
261 | /* correct for oddity of the 8-bit color Palm pixmap... */ | 261 | /* correct for oddity of the 8-bit color Palm pixmap... */ |
262 | if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; | 262 | if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; |
263 | /* now lookup the correct color and set the pixel in the GTK bitmap */ | 263 | /* now lookup the correct color and set the pixel in the GTK bitmap */ |
264 | QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); | 264 | QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); |
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp index 0c56dd4..75da8ac 100644 --- a/noncore/apps/opie-reader/QTReader.cpp +++ b/noncore/apps/opie-reader/QTReader.cpp | |||
@@ -499,97 +499,97 @@ void QTReader::suspend() | |||
499 | */ | 499 | */ |
500 | } | 500 | } |
501 | 501 | ||
502 | void QTReader::setDoubleBuffer(bool _b) | 502 | void QTReader::setDoubleBuffer(bool _b) |
503 | { | 503 | { |
504 | m_doubleBuffered = _b; | 504 | m_doubleBuffered = _b; |
505 | if (_b || m_rotated) | 505 | if (_b || m_rotated) |
506 | { | 506 | { |
507 | if (dbuff == NULL) | 507 | if (dbuff == NULL) |
508 | { | 508 | { |
509 | dbuff = new QPixmap(); | 509 | dbuff = new QPixmap(); |
510 | dbp = new QPainter(); | 510 | dbp = new QPainter(); |
511 | } | 511 | } |
512 | if (m_rotated) | 512 | if (m_rotated) |
513 | { | 513 | { |
514 | dbuff->resize(height(), width()); | 514 | dbuff->resize(height(), width()); |
515 | } | 515 | } |
516 | else | 516 | else |
517 | { | 517 | { |
518 | dbuff->resize(width(), height()); | 518 | dbuff->resize(width(), height()); |
519 | } | 519 | } |
520 | m_outofdate = true; | 520 | m_outofdate = true; |
521 | } | 521 | } |
522 | else | 522 | else |
523 | { | 523 | { |
524 | if (dbuff != NULL) | 524 | if (dbuff != NULL) |
525 | { | 525 | { |
526 | delete dbuff; | 526 | delete dbuff; |
527 | delete dbp; | 527 | delete dbp; |
528 | } | 528 | } |
529 | dbuff = NULL; | 529 | dbuff = NULL; |
530 | dbp = NULL; | 530 | dbp = NULL; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | 533 | ||
534 | void QTReader::setTwoTouch(bool _b) | 534 | void QTReader::setTwoTouch(bool _b) |
535 | { | 535 | { |
536 | setBackgroundColor( m_bg ); | 536 | setBackgroundColor( m_bg ); |
537 | m_twotouch = m_touchone = _b; | 537 | m_twotouch = m_touchone = _b; |
538 | } | 538 | } |
539 | 539 | ||
540 | void QTReader::setContinuous(bool _b) | 540 | void QTReader::setContinuous(bool _b) |
541 | { | 541 | { |
542 | buffdoc.setContinuous(m_continuousDocument = _b); | 542 | buffdoc.setContinuous(m_continuousDocument = _b); |
543 | } | 543 | } |
544 | 544 | ||
545 | void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) | 545 | void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) |
546 | { | 546 | { |
547 | unsigned long wrdstart, wrdend; | 547 | unsigned long wrdstart = 0, wrdend = 0; |
548 | QString wrd; | 548 | QString wrd; |
549 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; | 549 | int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; |
550 | if (m_twotouch) | 550 | if (m_twotouch) |
551 | { | 551 | { |
552 | if (m_touchone) | 552 | if (m_touchone) |
553 | { | 553 | { |
554 | m_touchone = false; | 554 | m_touchone = false; |
555 | m_startpos = startpos; | 555 | m_startpos = startpos; |
556 | m_startoffset = startoffset; | 556 | m_startoffset = startoffset; |
557 | setBackgroundColor( lightGray ); | 557 | setBackgroundColor( lightGray ); |
558 | } | 558 | } |
559 | else | 559 | else |
560 | { | 560 | { |
561 | m_touchone = true; | 561 | m_touchone = true; |
562 | setBackgroundColor( m_bg ); | 562 | setBackgroundColor( m_bg ); |
563 | size_t endpos, endoffset; | 563 | size_t endpos, endoffset; |
564 | endpos = startpos; | 564 | endpos = startpos; |
565 | endoffset = startoffset; | 565 | endoffset = startoffset; |
566 | size_t currentpos = locate(); | 566 | size_t currentpos = locate(); |
567 | if (endpos >= m_startpos) | 567 | if (endpos >= m_startpos) |
568 | { | 568 | { |
569 | jumpto(m_startpos); | 569 | jumpto(m_startpos); |
570 | for (int i = 0; i < m_startoffset; i++) | 570 | for (int i = 0; i < m_startoffset; i++) |
571 | { | 571 | { |
572 | getch(); | 572 | getch(); |
573 | } | 573 | } |
574 | wrdstart = buffdoc.explocate(); | 574 | wrdstart = buffdoc.explocate(); |
575 | if (m_startpos == endpos) | 575 | if (m_startpos == endpos) |
576 | { | 576 | { |
577 | for (int i = m_startoffset; i <= endoffset; i++) | 577 | for (int i = m_startoffset; i <= endoffset; i++) |
578 | { | 578 | { |
579 | wrd += QChar(getch()); | 579 | wrd += QChar(getch()); |
580 | } | 580 | } |
581 | } | 581 | } |
582 | else | 582 | else |
583 | { | 583 | { |
584 | while (buffdoc.explocate() <= endpos) | 584 | while (buffdoc.explocate() <= endpos) |
585 | { | 585 | { |
586 | wrd += QChar(getch()); | 586 | wrd += QChar(getch()); |
587 | } | 587 | } |
588 | for (int i = 0; i < endoffset; i++) | 588 | for (int i = 0; i < endoffset; i++) |
589 | { | 589 | { |
590 | wrd += QChar(getch()); | 590 | wrd += QChar(getch()); |
591 | } | 591 | } |
592 | } | 592 | } |
593 | wrdend = buffdoc.explocate(); | 593 | wrdend = buffdoc.explocate(); |
594 | jumpto(currentpos); | 594 | jumpto(currentpos); |
595 | } | 595 | } |
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index 849edfc..302ac73 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp | |||
@@ -660,97 +660,97 @@ unsigned short CPlucker_base::finduid(unsigned short urlid) | |||
660 | { | 660 | { |
661 | return jmin; | 661 | return jmin; |
662 | } | 662 | } |
663 | gotorecordnumber(jmax); | 663 | gotorecordnumber(jmax); |
664 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | 664 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); |
665 | luid = thishdr_uid; | 665 | luid = thishdr_uid; |
666 | //qDebug("jmax at end:%u,%u", jmax, luid); | 666 | //qDebug("jmax at end:%u,%u", jmax, luid); |
667 | if (luid == urlid) | 667 | if (luid == urlid) |
668 | { | 668 | { |
669 | return jmax; | 669 | return jmax; |
670 | } | 670 | } |
671 | //qDebug("Couldn't find %u", urlid); | 671 | //qDebug("Couldn't find %u", urlid); |
672 | return 0; // Not found! | 672 | return 0; // Not found! |
673 | } | 673 | } |
674 | 674 | ||
675 | #include <qnamespace.h> | 675 | #include <qnamespace.h> |
676 | 676 | ||
677 | void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 677 | void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
678 | { | 678 | { |
679 | unsigned short sz = 0; | 679 | unsigned short sz = 0; |
680 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 680 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
681 | { | 681 | { |
682 | sz++; | 682 | sz++; |
683 | } | 683 | } |
684 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); | 684 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); |
685 | unsigned char* newdata = new unsigned char[newlen]; | 685 | unsigned char* newdata = new unsigned char[newlen]; |
686 | unsigned char* pdata = newdata; | 686 | unsigned char* pdata = newdata; |
687 | memcpy(newdata, src, srclen); | 687 | memcpy(newdata, src, srclen); |
688 | newdata += srclen; | 688 | newdata += srclen; |
689 | memcpy(newdata, &sz, sizeof(sz)); | 689 | memcpy(newdata, &sz, sizeof(sz)); |
690 | newdata += sizeof(sz); | 690 | newdata += sizeof(sz); |
691 | #ifdef _WINDOWS | 691 | #ifdef _WINDOWS |
692 | for (it = visited.begin(); it != visited.end(); it++) | 692 | for (it = visited.begin(); it != visited.end(); it++) |
693 | #else | 693 | #else |
694 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | 694 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) |
695 | #endif | 695 | #endif |
696 | { | 696 | { |
697 | unsigned long t = *it; | 697 | unsigned long t = *it; |
698 | //qDebug("[%u]", t); | 698 | //qDebug("[%u]", t); |
699 | memcpy(newdata, &t, sizeof(t)); | 699 | memcpy(newdata, &t, sizeof(t)); |
700 | newdata += sizeof(t); | 700 | newdata += sizeof(t); |
701 | } | 701 | } |
702 | m_nav.setSaveData(data, len, pdata, newlen); | 702 | m_nav.setSaveData(data, len, pdata, newlen); |
703 | delete [] pdata; | 703 | delete [] pdata; |
704 | } | 704 | } |
705 | 705 | ||
706 | void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) | 706 | void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) |
707 | { | 707 | { |
708 | unsigned short sz; | 708 | unsigned short sz = 0; |
709 | if (srclen >= sizeof(sz)) | 709 | if (srclen >= sizeof(sz)) |
710 | { | 710 | { |
711 | memcpy(&sz, src, sizeof(sz)); | 711 | memcpy(&sz, src, sizeof(sz)); |
712 | src += sizeof(sz); | 712 | src += sizeof(sz); |
713 | srclen -= sizeof(sz); | 713 | srclen -= sizeof(sz); |
714 | } | 714 | } |
715 | for (int i = 0; i < sz; i++) | 715 | for (int i = 0; i < sz; i++) |
716 | { | 716 | { |
717 | unsigned long t; | 717 | unsigned long t; |
718 | if (srclen >= sizeof(t)) | 718 | if (srclen >= sizeof(t)) |
719 | { | 719 | { |
720 | memcpy(&t, src, sizeof(t)); | 720 | memcpy(&t, src, sizeof(t)); |
721 | // qDebug("[%u]", t); | 721 | // qDebug("[%u]", t); |
722 | visited.push_front(t); | 722 | visited.push_front(t); |
723 | src += sizeof(t); | 723 | src += sizeof(t); |
724 | srclen -= sizeof(t); | 724 | srclen -= sizeof(t); |
725 | } | 725 | } |
726 | else | 726 | else |
727 | { | 727 | { |
728 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); | 728 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); |
729 | break; | 729 | break; |
730 | } | 730 | } |
731 | } | 731 | } |
732 | m_nav.putSaveData(src, srclen); | 732 | m_nav.putSaveData(src, srclen); |
733 | } | 733 | } |
734 | 734 | ||
735 | int CPlucker_base::OpenFile(const char *src) | 735 | int CPlucker_base::OpenFile(const char *src) |
736 | { | 736 | { |
737 | qDebug("plucker openfile:%s", src); | 737 | qDebug("plucker openfile:%s", src); |
738 | m_lastBreak = 0; | 738 | m_lastBreak = 0; |
739 | if (!Cpdb::openpdbfile(src)) | 739 | if (!Cpdb::openpdbfile(src)) |
740 | { | 740 | { |
741 | return -1; | 741 | return -1; |
742 | } | 742 | } |
743 | 743 | ||
744 | if (!CorrectDecoder()) return -1; | 744 | if (!CorrectDecoder()) return -1; |
745 | 745 | ||
746 | gotorecordnumber(0); | 746 | gotorecordnumber(0); |
747 | fread(&hdr0, 1, 6, fin); | 747 | fread(&hdr0, 1, 6, fin); |
748 | qDebug("Compression type:%u", ntohs(hdr0.version)); | 748 | qDebug("Compression type:%u", ntohs(hdr0.version)); |
749 | 749 | ||
750 | 750 | ||
751 | switch (ntohs(hdr0.version)) | 751 | switch (ntohs(hdr0.version)) |
752 | { | 752 | { |
753 | case 2: | 753 | case 2: |
754 | m_decompress = UnZip; | 754 | m_decompress = UnZip; |
755 | break; | 755 | break; |
756 | case 1: | 756 | case 1: |
diff --git a/noncore/apps/opie-reader/striphtml.cpp b/noncore/apps/opie-reader/striphtml.cpp index c434dbb..a2ad56b 100644 --- a/noncore/apps/opie-reader/striphtml.cpp +++ b/noncore/apps/opie-reader/striphtml.cpp | |||
@@ -428,97 +428,97 @@ QString striphtml::getattr(tchar& ch) | |||
428 | unsigned long pos; | 428 | unsigned long pos; |
429 | if (ch == ' ') ch = skip_ws(); | 429 | if (ch == ' ') ch = skip_ws(); |
430 | if (ch == '=') | 430 | if (ch == '=') |
431 | { | 431 | { |
432 | ch = skip_ws(); | 432 | ch = skip_ws(); |
433 | if (ch == '"') | 433 | if (ch == '"') |
434 | { | 434 | { |
435 | mygetch(ch, sty, pos); | 435 | mygetch(ch, sty, pos); |
436 | ref = getname(ch, "\""); | 436 | ref = getname(ch, "\""); |
437 | ch = skip_ws(); | 437 | ch = skip_ws(); |
438 | } | 438 | } |
439 | else if (ch == '\'') | 439 | else if (ch == '\'') |
440 | { | 440 | { |
441 | mygetch(ch, sty, pos); | 441 | mygetch(ch, sty, pos); |
442 | ref = getname(ch, "\'"); | 442 | ref = getname(ch, "\'"); |
443 | ch = skip_ws(); | 443 | ch = skip_ws(); |
444 | } | 444 | } |
445 | else | 445 | else |
446 | { | 446 | { |
447 | ref = getname(ch, " >"); | 447 | ref = getname(ch, " >"); |
448 | if (ch == ' ') ch = skip_ws(); | 448 | if (ch == ' ') ch = skip_ws(); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | return ref; | 451 | return ref; |
452 | } | 452 | } |
453 | 453 | ||
454 | linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm) | 454 | linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm) |
455 | { | 455 | { |
456 | #if defined(USEQPE) || defined(_WINDOWS) | 456 | #if defined(USEQPE) || defined(_WINDOWS) |
457 | QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n); | 457 | QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n); |
458 | #else | 458 | #else |
459 | QMap<unsigned long, QString>::iterator hrefit = id2href->find(n); | 459 | QMap<unsigned long, QString>::iterator hrefit = id2href->find(n); |
460 | #endif | 460 | #endif |
461 | if (hrefit == id2href->end()) | 461 | if (hrefit == id2href->end()) |
462 | { | 462 | { |
463 | return eNone; | 463 | return eNone; |
464 | } | 464 | } |
465 | QString href = *hrefit; | 465 | QString href = *hrefit; |
466 | #if defined(USEQPE) || defined(_WINDOWS) | 466 | #if defined(USEQPE) || defined(_WINDOWS) |
467 | QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); | 467 | QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); |
468 | #else | 468 | #else |
469 | QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); | 469 | QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); |
470 | #endif | 470 | #endif |
471 | if (fpit == href2filepos->end()) | 471 | if (fpit == href2filepos->end()) |
472 | { | 472 | { |
473 | if (href == "history.back()") | 473 | if (href == "history.back()") |
474 | { | 474 | { |
475 | QString fc = currentfile; | 475 | QString fc = currentfile; |
476 | unsigned long loc; | 476 | unsigned long loc = 0; |
477 | htmlmark m(fc, loc); | 477 | htmlmark m(fc, loc); |
478 | linkType ret = (m_nav.back(m)) ? eFile : eNone; | 478 | linkType ret = (m_nav.back(m)) ? eFile : eNone; |
479 | if (fc == m.filename()) | 479 | if (fc == m.filename()) |
480 | { | 480 | { |
481 | if ((ret & eFile) != 0) | 481 | if ((ret & eFile) != 0) |
482 | { | 482 | { |
483 | locate(m.posn()); | 483 | locate(m.posn()); |
484 | return eLink; | 484 | return eLink; |
485 | } | 485 | } |
486 | } | 486 | } |
487 | return eNone; | 487 | return eNone; |
488 | } | 488 | } |
489 | qDebug("Searching for %s", (const char*)href); | 489 | qDebug("Searching for %s", (const char*)href); |
490 | 490 | ||
491 | 491 | ||
492 | QString file, name; | 492 | QString file, name; |
493 | 493 | ||
494 | int colon = href.find('#'); | 494 | int colon = href.find('#'); |
495 | if (colon >= 0) | 495 | if (colon >= 0) |
496 | { | 496 | { |
497 | file = dehtml(href.left(colon)); | 497 | file = dehtml(href.left(colon)); |
498 | name = dehtml(href.right(href.length()-colon-1)); | 498 | name = dehtml(href.right(href.length()-colon-1)); |
499 | } | 499 | } |
500 | else | 500 | else |
501 | { | 501 | { |
502 | file = dehtml(href); | 502 | file = dehtml(href); |
503 | } | 503 | } |
504 | 504 | ||
505 | qDebug("File:%s", (const char*)file); | 505 | qDebug("File:%s", (const char*)file); |
506 | qDebug("Name:%s", (const char*)name); | 506 | qDebug("Name:%s", (const char*)name); |
507 | 507 | ||
508 | 508 | ||
509 | if (file.isEmpty()) | 509 | if (file.isEmpty()) |
510 | { | 510 | { |
511 | if (parent->findanchor(name)) | 511 | if (parent->findanchor(name)) |
512 | { | 512 | { |
513 | reset(); | 513 | reset(); |
514 | return eLink; | 514 | return eLink; |
515 | } | 515 | } |
516 | fpit = href2filepos->find(name); | 516 | fpit = href2filepos->find(name); |
517 | if (fpit != href2filepos->end()) | 517 | if (fpit != href2filepos->end()) |
518 | { | 518 | { |
519 | locate(*fpit); | 519 | locate(*fpit); |
520 | return eLink; | 520 | return eLink; |
521 | } | 521 | } |
522 | else | 522 | else |
523 | { | 523 | { |
524 | // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\""; | 524 | // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\""; |
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 89024f7..ee6030f 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp | |||
@@ -1271,133 +1271,135 @@ HlManager *HlManager::self() | |||
1271 | 1271 | ||
1272 | Highlight *HlManager::getHl(int n) { | 1272 | Highlight *HlManager::getHl(int n) { |
1273 | if (n < 0 || n >= (int) hlList.count()) n = 0; | 1273 | if (n < 0 || n >= (int) hlList.count()) n = 0; |
1274 | return hlList.at(n); | 1274 | return hlList.at(n); |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | int HlManager::defaultHl() { | 1277 | int HlManager::defaultHl() { |
1278 | KateConfig *config; | 1278 | KateConfig *config; |
1279 | config = KGlobal::config(); | 1279 | config = KGlobal::config(); |
1280 | config->setGroup("General Options"); | 1280 | config->setGroup("General Options"); |
1281 | 1281 | ||
1282 | #warning fixme return nameFind(config->readEntry("Highlight")); | 1282 | #warning fixme return nameFind(config->readEntry("Highlight")); |
1283 | 1283 | ||
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | 1286 | ||
1287 | int HlManager::nameFind(const QString &name) { | 1287 | int HlManager::nameFind(const QString &name) { |
1288 | int z; | 1288 | int z; |
1289 | 1289 | ||
1290 | for (z = hlList.count() - 1; z > 0; z--) { | 1290 | for (z = hlList.count() - 1; z > 0; z--) { |
1291 | if (hlList.at(z)->iName == name) break; | 1291 | if (hlList.at(z)->iName == name) break; |
1292 | } | 1292 | } |
1293 | return z; | 1293 | return z; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | int HlManager::wildcardFind(const QString &fileName) { | 1296 | int HlManager::wildcardFind(const QString &fileName) { |
1297 | Highlight *highlight; | 1297 | Highlight *highlight; |
1298 | int p1, p2; | 1298 | int p1, p2; |
1299 | QString w; | 1299 | QString w; |
1300 | for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) { | 1300 | for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) { |
1301 | p1 = 0; | 1301 | p1 = 0; |
1302 | w = highlight->getWildcards(); | 1302 | w = highlight->getWildcards(); |
1303 | while (p1 < (int) w.length()) { | 1303 | while (p1 < (int) w.length()) { |
1304 | p2 = w.find(';',p1); | 1304 | p2 = w.find(';',p1); |
1305 | if (p2 == -1) p2 = w.length(); | 1305 | if (p2 == -1) p2 = w.length(); |
1306 | if (p1 < p2) { | 1306 | if (p1 < p2) { |
1307 | QRegExp regExp(w.mid(p1,p2 - p1),true,true); | 1307 | QRegExp regExp(w.mid(p1,p2 - p1),true,true); |
1308 | if (regExp.match(fileName) == 0) return hlList.at(); | 1308 | if (regExp.match(fileName) == 0) return hlList.at(); |
1309 | } | 1309 | } |
1310 | p1 = p2 + 1; | 1310 | p1 = p2 + 1; |
1311 | } | 1311 | } |
1312 | } | 1312 | } |
1313 | return -1; | 1313 | return -1; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | 1316 | ||
1317 | int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { | 1317 | int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { |
1318 | ItemStyleList defaultStyleList; | 1318 | ItemStyleList defaultStyleList; |
1319 | ItemStyle *defaultStyle; | 1319 | ItemStyle *defaultStyle = 0; |
1320 | ItemDataList itemDataList; | 1320 | ItemDataList itemDataList; |
1321 | ItemData *itemData; | 1321 | ItemData *itemData; |
1322 | int nAttribs, z; | 1322 | int nAttribs, z; |
1323 | 1323 | ||
1324 | odebug << "HlManager::makeAttribs" << oendl; | 1324 | odebug << "HlManager::makeAttribs" << oendl; |
1325 | 1325 | ||
1326 | defaultStyleList.setAutoDelete(true); | 1326 | defaultStyleList.setAutoDelete(true); |
1327 | getDefaults(defaultStyleList); | 1327 | getDefaults(defaultStyleList); |
1328 | 1328 | ||
1329 | // itemDataList.setAutoDelete(true); | 1329 | // itemDataList.setAutoDelete(true); |
1330 | highlight->getItemDataList(itemDataList); | 1330 | highlight->getItemDataList(itemDataList); |
1331 | nAttribs = itemDataList.count(); | 1331 | nAttribs = itemDataList.count(); |
1332 | for (z = 0; z < nAttribs; z++) { | 1332 | for (z = 0; z < nAttribs; z++) { |
1333 | odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; | 1333 | odebug << "HlManager::makeAttribs: creating an attribute definition" << oendl; |
1334 | itemData = itemDataList.at(z); | 1334 | itemData = itemDataList.at(z); |
1335 | if (itemData->defStyle) { | 1335 | if (itemData->defStyle) { |
1336 | // default style | 1336 | // default style |
1337 | defaultStyle = defaultStyleList.at(itemData->defStyleNum); | 1337 | defaultStyle = defaultStyleList.at(itemData->defStyleNum); |
1338 | a[z].col = defaultStyle->col; | 1338 | a[z].col = defaultStyle->col; |
1339 | a[z].selCol = defaultStyle->selCol; | 1339 | a[z].selCol = defaultStyle->selCol; |
1340 | a[z].bold = defaultStyle->bold; | 1340 | a[z].bold = defaultStyle->bold; |
1341 | a[z].italic = defaultStyle->italic; | 1341 | a[z].italic = defaultStyle->italic; |
1342 | } else { | 1342 | } else { |
1343 | // custom style | 1343 | // custom style |
1344 | a[z].col = itemData->col; | 1344 | a[z].col = itemData->col; |
1345 | a[z].selCol = itemData->selCol; | 1345 | a[z].selCol = itemData->selCol; |
1346 | a[z].bold = itemData->bold; | 1346 | a[z].bold = itemData->bold; |
1347 | a[z].italic = itemData->italic; | 1347 | a[z].italic = itemData->italic; |
1348 | } | 1348 | } |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | for (; z < maxAttribs; z++) { | 1351 | for (; z < maxAttribs; z++) { |
1352 | a[z].col = black; | 1352 | a[z].col = black; |
1353 | a[z].selCol = black; | 1353 | a[z].selCol = black; |
1354 | a[z].bold = defaultStyle->bold; | 1354 | if (defaultStyle) { |
1355 | a[z].italic = defaultStyle->italic; | 1355 | a[z].bold = defaultStyle->bold; |
1356 | a[z].italic = defaultStyle->italic; | ||
1357 | } | ||
1356 | } | 1358 | } |
1357 | return nAttribs; | 1359 | return nAttribs; |
1358 | } | 1360 | } |
1359 | 1361 | ||
1360 | int HlManager::defaultStyles() { | 1362 | int HlManager::defaultStyles() { |
1361 | return 10; | 1363 | return 10; |
1362 | } | 1364 | } |
1363 | 1365 | ||
1364 | QString HlManager::defaultStyleName(int n) | 1366 | QString HlManager::defaultStyleName(int n) |
1365 | { | 1367 | { |
1366 | static QStringList names; | 1368 | static QStringList names; |
1367 | 1369 | ||
1368 | if (names.isEmpty()) | 1370 | if (names.isEmpty()) |
1369 | { | 1371 | { |
1370 | names << i18n("Normal"); | 1372 | names << i18n("Normal"); |
1371 | names << i18n("Keyword"); | 1373 | names << i18n("Keyword"); |
1372 | names << i18n("Data Type"); | 1374 | names << i18n("Data Type"); |
1373 | names << i18n("Decimal/Value"); | 1375 | names << i18n("Decimal/Value"); |
1374 | names << i18n("Base-N Integer"); | 1376 | names << i18n("Base-N Integer"); |
1375 | names << i18n("Floating Point"); | 1377 | names << i18n("Floating Point"); |
1376 | names << i18n("Character"); | 1378 | names << i18n("Character"); |
1377 | names << i18n("String"); | 1379 | names << i18n("String"); |
1378 | names << i18n("Comment"); | 1380 | names << i18n("Comment"); |
1379 | names << i18n("Others"); | 1381 | names << i18n("Others"); |
1380 | } | 1382 | } |
1381 | 1383 | ||
1382 | return names[n]; | 1384 | return names[n]; |
1383 | } | 1385 | } |
1384 | 1386 | ||
1385 | void HlManager::getDefaults(ItemStyleList &list) { | 1387 | void HlManager::getDefaults(ItemStyleList &list) { |
1386 | KateConfig *config; | 1388 | KateConfig *config; |
1387 | int z; | 1389 | int z; |
1388 | ItemStyle *i; | 1390 | ItemStyle *i; |
1389 | QString s; | 1391 | QString s; |
1390 | QRgb col, selCol; | 1392 | QRgb col, selCol; |
1391 | 1393 | ||
1392 | list.setAutoDelete(true); | 1394 | list.setAutoDelete(true); |
1393 | //ItemStyle(color, selected color, bold, italic) | 1395 | //ItemStyle(color, selected color, bold, italic) |
1394 | list.append(new ItemStyle(black,white,false,false)); //normal | 1396 | list.append(new ItemStyle(black,white,false,false)); //normal |
1395 | list.append(new ItemStyle(black,white,true,false)); //keyword | 1397 | list.append(new ItemStyle(black,white,true,false)); //keyword |
1396 | list.append(new ItemStyle(darkRed,white,false,false)); //datatype | 1398 | list.append(new ItemStyle(darkRed,white,false,false)); //datatype |
1397 | list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value | 1399 | list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value |
1398 | list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n | 1400 | list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n |
1399 | list.append(new ItemStyle(darkMagenta,cyan,false,false));//float | 1401 | list.append(new ItemStyle(darkMagenta,cyan,false,false));//float |
1400 | list.append(new ItemStyle(magenta,magenta,false,false)); //char | 1402 | list.append(new ItemStyle(magenta,magenta,false,false)); //char |
1401 | list.append(new ItemStyle(red,red,false,false)); //string | 1403 | list.append(new ItemStyle(red,red,false,false)); //string |
1402 | list.append(new ItemStyle(darkGray,gray,false,true)); //comment | 1404 | list.append(new ItemStyle(darkGray,gray,false,true)); //comment |
1403 | list.append(new ItemStyle(darkGreen,green,false,false)); //others | 1405 | list.append(new ItemStyle(darkGreen,green,false,false)); //others |
diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c index addf9d2..ce4c05f 100644 --- a/noncore/net/ftplib/ftplib.c +++ b/noncore/net/ftplib/ftplib.c | |||
@@ -736,97 +736,97 @@ static int FtpOpenPort(netbuf *nControl, netbuf **nData, int mode, int dir) | |||
736 | if (!FtpSendCmd(buf,'2',nControl)) | 736 | if (!FtpSendCmd(buf,'2',nControl)) |
737 | { | 737 | { |
738 | net_close(sData); | 738 | net_close(sData); |
739 | return 0; | 739 | return 0; |
740 | } | 740 | } |
741 | } | 741 | } |
742 | ctrl = calloc(1,sizeof(netbuf)); | 742 | ctrl = calloc(1,sizeof(netbuf)); |
743 | if (ctrl == NULL) | 743 | if (ctrl == NULL) |
744 | { | 744 | { |
745 | perror("calloc"); | 745 | perror("calloc"); |
746 | net_close(sData); | 746 | net_close(sData); |
747 | return -1; | 747 | return -1; |
748 | } | 748 | } |
749 | if ((mode == 'A') && ((ctrl->buf = malloc(FTPLIB_BUFSIZ)) == NULL)) | 749 | if ((mode == 'A') && ((ctrl->buf = malloc(FTPLIB_BUFSIZ)) == NULL)) |
750 | { | 750 | { |
751 | perror("calloc"); | 751 | perror("calloc"); |
752 | net_close(sData); | 752 | net_close(sData); |
753 | free(ctrl); | 753 | free(ctrl); |
754 | return -1; | 754 | return -1; |
755 | } | 755 | } |
756 | ctrl->handle = sData; | 756 | ctrl->handle = sData; |
757 | ctrl->dir = dir; | 757 | ctrl->dir = dir; |
758 | ctrl->idletime = nControl->idletime; | 758 | ctrl->idletime = nControl->idletime; |
759 | ctrl->idlearg = nControl->idlearg; | 759 | ctrl->idlearg = nControl->idlearg; |
760 | ctrl->xfered = 0; | 760 | ctrl->xfered = 0; |
761 | ctrl->xfered1 = 0; | 761 | ctrl->xfered1 = 0; |
762 | ctrl->cbbytes = nControl->cbbytes; | 762 | ctrl->cbbytes = nControl->cbbytes; |
763 | if (ctrl->idletime.tv_sec || ctrl->idletime.tv_usec || ctrl->cbbytes) | 763 | if (ctrl->idletime.tv_sec || ctrl->idletime.tv_usec || ctrl->cbbytes) |
764 | ctrl->idlecb = nControl->idlecb; | 764 | ctrl->idlecb = nControl->idlecb; |
765 | else | 765 | else |
766 | ctrl->idlecb = NULL; | 766 | ctrl->idlecb = NULL; |
767 | *nData = ctrl; | 767 | *nData = ctrl; |
768 | return 1; | 768 | return 1; |
769 | } | 769 | } |
770 | 770 | ||
771 | /* | 771 | /* |
772 | * FtpAcceptConnection - accept connection from server | 772 | * FtpAcceptConnection - accept connection from server |
773 | * | 773 | * |
774 | * return 1 if successful, 0 otherwise | 774 | * return 1 if successful, 0 otherwise |
775 | */ | 775 | */ |
776 | static int FtpAcceptConnection(netbuf *nData, netbuf *nControl) | 776 | static int FtpAcceptConnection(netbuf *nData, netbuf *nControl) |
777 | { | 777 | { |
778 | int sData; | 778 | int sData; |
779 | struct sockaddr addr; | 779 | struct sockaddr addr; |
780 | unsigned int l; | 780 | unsigned int l; |
781 | int i; | 781 | int i; |
782 | struct timeval tv; | 782 | struct timeval tv; |
783 | fd_set mask; | 783 | fd_set mask; |
784 | int rv; | 784 | int rv = 1; |
785 | 785 | ||
786 | FD_ZERO(&mask); | 786 | FD_ZERO(&mask); |
787 | FD_SET(nControl->handle, &mask); | 787 | FD_SET(nControl->handle, &mask); |
788 | FD_SET(nData->handle, &mask); | 788 | FD_SET(nData->handle, &mask); |
789 | tv.tv_usec = 0; | 789 | tv.tv_usec = 0; |
790 | tv.tv_sec = ACCEPT_TIMEOUT; | 790 | tv.tv_sec = ACCEPT_TIMEOUT; |
791 | printf("<<<<<<<<<<<<<<<<%d\n",ACCEPT_TIMEOUT); | 791 | printf("<<<<<<<<<<<<<<<<%d\n",ACCEPT_TIMEOUT); |
792 | i = nControl->handle; | 792 | i = nControl->handle; |
793 | if (i < nData->handle) | 793 | if (i < nData->handle) |
794 | i = nData->handle; | 794 | i = nData->handle; |
795 | i = select(i+1, &mask, NULL, NULL, &tv); | 795 | i = select(i+1, &mask, NULL, NULL, &tv); |
796 | if (i == -1) | 796 | if (i == -1) |
797 | { | 797 | { |
798 | strncpy(nControl->response, strerror(errno), | 798 | strncpy(nControl->response, strerror(errno), |
799 | sizeof(nControl->response)); | 799 | sizeof(nControl->response)); |
800 | net_close(nData->handle); | 800 | net_close(nData->handle); |
801 | nData->handle = 0; | 801 | nData->handle = 0; |
802 | rv = 0; | 802 | rv = 0; |
803 | } | 803 | } |
804 | else if (i == 0) | 804 | else if (i == 0) |
805 | { | 805 | { |
806 | strcpy(nControl->response, "timed out waiting for connection"); | 806 | strcpy(nControl->response, "timed out waiting for connection"); |
807 | net_close(nData->handle); | 807 | net_close(nData->handle); |
808 | nData->handle = 0; | 808 | nData->handle = 0; |
809 | rv = 0; | 809 | rv = 0; |
810 | } | 810 | } |
811 | else | 811 | else |
812 | { | 812 | { |
813 | if (FD_ISSET(nData->handle, &mask)) | 813 | if (FD_ISSET(nData->handle, &mask)) |
814 | { | 814 | { |
815 | l = sizeof(addr); | 815 | l = sizeof(addr); |
816 | sData = accept(nData->handle, &addr, &l); | 816 | sData = accept(nData->handle, &addr, &l); |
817 | i = errno; | 817 | i = errno; |
818 | net_close(nData->handle); | 818 | net_close(nData->handle); |
819 | if (sData > 0) | 819 | if (sData > 0) |
820 | { | 820 | { |
821 | rv = 1; | 821 | rv = 1; |
822 | nData->handle = sData; | 822 | nData->handle = sData; |
823 | } | 823 | } |
824 | else | 824 | else |
825 | { | 825 | { |
826 | strncpy(nControl->response, strerror(i), | 826 | strncpy(nControl->response, strerror(i), |
827 | sizeof(nControl->response)); | 827 | sizeof(nControl->response)); |
828 | nData->handle = 0; | 828 | nData->handle = 0; |
829 | rv = 0; | 829 | rv = 0; |
830 | } | 830 | } |
831 | } | 831 | } |
832 | else if (FD_ISSET(nControl->handle, &mask)) | 832 | else if (FD_ISSET(nControl->handle, &mask)) |
diff --git a/noncore/settings/sysinfo/contrib/dhry.c b/noncore/settings/sysinfo/contrib/dhry.c index 07fd1c0..5426157 100644 --- a/noncore/settings/sysinfo/contrib/dhry.c +++ b/noncore/settings/sysinfo/contrib/dhry.c | |||
@@ -527,97 +527,97 @@ double Microseconds, | |||
527 | 527 | ||
528 | /* end of variables for time measurement */ | 528 | /* end of variables for time measurement */ |
529 | 529 | ||
530 | /**********************************************************************************************/ | 530 | /**********************************************************************************************/ |
531 | 531 | ||
532 | 532 | ||
533 | Proc_1 (Ptr_Val_Par) | 533 | Proc_1 (Ptr_Val_Par) |
534 | /******************/ | 534 | /******************/ |
535 | 535 | ||
536 | REG Rec_Pointer Ptr_Val_Par; | 536 | REG Rec_Pointer Ptr_Val_Par; |
537 | /* executed once */ | 537 | /* executed once */ |
538 | { | 538 | { |
539 | REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; | 539 | REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; |
540 | /* == Ptr_Glob_Next */ | 540 | /* == Ptr_Glob_Next */ |
541 | /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ | 541 | /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ |
542 | /* corresponds to "rename" in Ada, "with" in Pascal */ | 542 | /* corresponds to "rename" in Ada, "with" in Pascal */ |
543 | 543 | ||
544 | structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); | 544 | structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); |
545 | Ptr_Val_Par->variant.var_1.Int_Comp = 5; | 545 | Ptr_Val_Par->variant.var_1.Int_Comp = 5; |
546 | Next_Record->variant.var_1.Int_Comp | 546 | Next_Record->variant.var_1.Int_Comp |
547 | = Ptr_Val_Par->variant.var_1.Int_Comp; | 547 | = Ptr_Val_Par->variant.var_1.Int_Comp; |
548 | Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; | 548 | Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; |
549 | Proc_3 (&Next_Record->Ptr_Comp); | 549 | Proc_3 (&Next_Record->Ptr_Comp); |
550 | /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp | 550 | /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp |
551 | == Ptr_Glob->Ptr_Comp */ | 551 | == Ptr_Glob->Ptr_Comp */ |
552 | if (Next_Record->Discr == Ident_1) | 552 | if (Next_Record->Discr == Ident_1) |
553 | /* then, executed */ | 553 | /* then, executed */ |
554 | { | 554 | { |
555 | Next_Record->variant.var_1.Int_Comp = 6; | 555 | Next_Record->variant.var_1.Int_Comp = 6; |
556 | Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, | 556 | Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, |
557 | &Next_Record->variant.var_1.Enum_Comp); | 557 | &Next_Record->variant.var_1.Enum_Comp); |
558 | Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; | 558 | Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; |
559 | Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, | 559 | Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, |
560 | &Next_Record->variant.var_1.Int_Comp); | 560 | &Next_Record->variant.var_1.Int_Comp); |
561 | } | 561 | } |
562 | else /* not executed */ | 562 | else /* not executed */ |
563 | structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); | 563 | structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); |
564 | } /* Proc_1 */ | 564 | } /* Proc_1 */ |
565 | 565 | ||
566 | 566 | ||
567 | Proc_2 (Int_Par_Ref) | 567 | Proc_2 (Int_Par_Ref) |
568 | /******************/ | 568 | /******************/ |
569 | /* executed once */ | 569 | /* executed once */ |
570 | /* *Int_Par_Ref == 1, becomes 4 */ | 570 | /* *Int_Par_Ref == 1, becomes 4 */ |
571 | 571 | ||
572 | One_Fifty *Int_Par_Ref; | 572 | One_Fifty *Int_Par_Ref; |
573 | { | 573 | { |
574 | One_Fifty Int_Loc; | 574 | One_Fifty Int_Loc; |
575 | Enumeration Enum_Loc; | 575 | Enumeration Enum_Loc = Ident_2; |
576 | 576 | ||
577 | Int_Loc = *Int_Par_Ref + 10; | 577 | Int_Loc = *Int_Par_Ref + 10; |
578 | do /* executed once */ | 578 | do /* executed once */ |
579 | if (Ch_1_Glob == 'A') | 579 | if (Ch_1_Glob == 'A') |
580 | /* then, executed */ | 580 | /* then, executed */ |
581 | { | 581 | { |
582 | Int_Loc -= 1; | 582 | Int_Loc -= 1; |
583 | *Int_Par_Ref = Int_Loc - Int_Glob; | 583 | *Int_Par_Ref = Int_Loc - Int_Glob; |
584 | Enum_Loc = Ident_1; | 584 | Enum_Loc = Ident_1; |
585 | } /* if */ | 585 | } /* if */ |
586 | while (Enum_Loc != Ident_1); /* true */ | 586 | while (Enum_Loc != Ident_1); /* true */ |
587 | } /* Proc_2 */ | 587 | } /* Proc_2 */ |
588 | 588 | ||
589 | 589 | ||
590 | Proc_3 (Ptr_Ref_Par) | 590 | Proc_3 (Ptr_Ref_Par) |
591 | /******************/ | 591 | /******************/ |
592 | /* executed once */ | 592 | /* executed once */ |
593 | /* Ptr_Ref_Par becomes Ptr_Glob */ | 593 | /* Ptr_Ref_Par becomes Ptr_Glob */ |
594 | 594 | ||
595 | Rec_Pointer *Ptr_Ref_Par; | 595 | Rec_Pointer *Ptr_Ref_Par; |
596 | 596 | ||
597 | { | 597 | { |
598 | if (Ptr_Glob != Null) | 598 | if (Ptr_Glob != Null) |
599 | /* then, executed */ | 599 | /* then, executed */ |
600 | *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; | 600 | *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; |
601 | Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); | 601 | Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); |
602 | } /* Proc_3 */ | 602 | } /* Proc_3 */ |
603 | 603 | ||
604 | 604 | ||
605 | Proc_4 () /* without parameters */ | 605 | Proc_4 () /* without parameters */ |
606 | /*******/ | 606 | /*******/ |
607 | /* executed once */ | 607 | /* executed once */ |
608 | { | 608 | { |
609 | Boolean Bool_Loc; | 609 | Boolean Bool_Loc; |
610 | 610 | ||
611 | Bool_Loc = Ch_1_Glob == 'A'; | 611 | Bool_Loc = Ch_1_Glob == 'A'; |
612 | Bool_Glob = Bool_Loc | Bool_Glob; | 612 | Bool_Glob = Bool_Loc | Bool_Glob; |
613 | Ch_2_Glob = 'B'; | 613 | Ch_2_Glob = 'B'; |
614 | } /* Proc_4 */ | 614 | } /* Proc_4 */ |
615 | 615 | ||
616 | 616 | ||
617 | Proc_5 () /* without parameters */ | 617 | Proc_5 () /* without parameters */ |
618 | /*******/ | 618 | /*******/ |
619 | /* executed once */ | 619 | /* executed once */ |
620 | { | 620 | { |
621 | Ch_1_Glob = 'A'; | 621 | Ch_1_Glob = 'A'; |
622 | Bool_Glob = false; | 622 | Bool_Glob = false; |
623 | } /* Proc_5 */ | 623 | } /* Proc_5 */ |