-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 3003e12..32bae0a 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -11,84 +11,87 @@ | |||
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "omanufacturerdb.h" | 29 | #include "omanufacturerdb.h" |
30 | 30 | ||
31 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 31 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <qpe/qpeapplication.h> | ||
35 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 36 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
36 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
37 | #endif | 38 | #endif |
38 | 39 | ||
40 | |||
41 | |||
39 | /* QT */ | 42 | /* QT */ |
40 | #include <qapplication.h> | 43 | #include <qapplication.h> |
41 | #include <qfile.h> | 44 | #include <qfile.h> |
42 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
43 | 46 | ||
44 | using namespace Opie::Core; | 47 | using namespace Opie::Core; |
45 | namespace Opie { | 48 | namespace Opie { |
46 | namespace Net { | 49 | namespace Net { |
47 | 50 | ||
48 | OManufacturerDB* OManufacturerDB::_instance = 0; | 51 | OManufacturerDB* OManufacturerDB::_instance = 0; |
49 | 52 | ||
50 | OManufacturerDB* OManufacturerDB::instance() | 53 | OManufacturerDB* OManufacturerDB::instance() |
51 | { | 54 | { |
52 | if ( !OManufacturerDB::_instance ) | 55 | if ( !OManufacturerDB::_instance ) |
53 | { | 56 | { |
54 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
55 | _instance = new OManufacturerDB(); | 58 | _instance = new OManufacturerDB(); |
56 | } | 59 | } |
57 | return _instance; | 60 | return _instance; |
58 | } | 61 | } |
59 | 62 | ||
60 | 63 | ||
61 | OManufacturerDB::OManufacturerDB() | 64 | OManufacturerDB::OManufacturerDB() |
62 | { | 65 | { |
63 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 66 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
64 | Global::statusMessage( "Reading Manufacturers..." ); | 67 | Global::statusMessage( "Reading Manufacturers..." ); |
65 | #endif | 68 | #endif |
66 | QString filename( "/etc/manufacturers" ); | 69 | QString filename( "/etc/manufacturers" ); |
67 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
68 | if ( !QFile::exists( filename ) ) | 71 | if ( !QFile::exists( filename ) ) |
69 | { | 72 | { |
70 | filename = "/opt/QtPalmtop/etc/manufacturers"; | 73 | filename = QPEApplication::qpeDir()+"/etc/manufacturers"; |
71 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
72 | if ( !QFile::exists( filename ) ) | 75 | if ( !QFile::exists( filename ) ) |
73 | { | 76 | { |
74 | filename = "/usr/share/wellenreiter/manufacturers"; | 77 | filename = "/usr/share/wellenreiter/manufacturers"; |
75 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
76 | } | 79 | } |
77 | } | 80 | } |
78 | 81 | ||
79 | QFile file( filename ); | 82 | QFile file( filename ); |
80 | bool hasFile = file.open( IO_ReadOnly ); | 83 | bool hasFile = file.open( IO_ReadOnly ); |
81 | if (!hasFile) | 84 | if (!hasFile) |
82 | { | 85 | { |
83 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
84 | } | 87 | } |
85 | else | 88 | else |
86 | { | 89 | { |
87 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
88 | QTextStream s( &file ); | 91 | QTextStream s( &file ); |
89 | QString addr; | 92 | QString addr; |
90 | QString manu; | 93 | QString manu; |
91 | QString extManu; | 94 | QString extManu; |
92 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 95 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
93 | int counter = 0; | 96 | int counter = 0; |
94 | #endif | 97 | #endif |