Diffstat (limited to 'libopie2/opienet/omanufacturerdb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index b93b752..209ec94 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -22,48 +22,52 @@ | |||
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 | 30 | ||
31 | #include "omanufacturerdb.h" | 31 | #include "omanufacturerdb.h" |
32 | 32 | ||
33 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 33 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
34 | 34 | ||
35 | /* OPIE */ | 35 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 37 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | 45 | ||
46 | using namespace Opie::Core; | ||
47 | namespace Opie { | ||
48 | namespace Net { | ||
49 | |||
46 | OManufacturerDB* OManufacturerDB::_instance = 0; | 50 | OManufacturerDB* OManufacturerDB::_instance = 0; |
47 | 51 | ||
48 | OManufacturerDB* OManufacturerDB::instance() | 52 | OManufacturerDB* OManufacturerDB::instance() |
49 | { | 53 | { |
50 | if ( !OManufacturerDB::_instance ) | 54 | if ( !OManufacturerDB::_instance ) |
51 | { | 55 | { |
52 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 56 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
53 | _instance = new OManufacturerDB(); | 57 | _instance = new OManufacturerDB(); |
54 | } | 58 | } |
55 | return _instance; | 59 | return _instance; |
56 | } | 60 | } |
57 | 61 | ||
58 | 62 | ||
59 | OManufacturerDB::OManufacturerDB() | 63 | OManufacturerDB::OManufacturerDB() |
60 | { | 64 | { |
61 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 65 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
62 | Global::statusMessage( "Reading Manufacturers..." ); | 66 | Global::statusMessage( "Reading Manufacturers..." ); |
63 | #endif | 67 | #endif |
64 | QString filename( "/etc/manufacturers" ); | 68 | QString filename( "/etc/manufacturers" ); |
65 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 69 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
66 | if ( !QFile::exists( filename ) ) | 70 | if ( !QFile::exists( filename ) ) |
67 | { | 71 | { |
68 | filename = "/opt/QtPalmtop/etc/manufacturers"; | 72 | filename = "/opt/QtPalmtop/etc/manufacturers"; |
69 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 73 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
@@ -112,24 +116,27 @@ OManufacturerDB::OManufacturerDB() | |||
112 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 116 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
113 | Global::statusMessage( "Manufacturers Complete..." ); | 117 | Global::statusMessage( "Manufacturers Complete..." ); |
114 | #endif | 118 | #endif |
115 | } | 119 | } |
116 | } | 120 | } |
117 | 121 | ||
118 | 122 | ||
119 | OManufacturerDB::~OManufacturerDB() | 123 | OManufacturerDB::~OManufacturerDB() |
120 | { | 124 | { |
121 | } | 125 | } |
122 | 126 | ||
123 | 127 | ||
124 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 128 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
125 | { | 129 | { |
126 | return manufacturers[macaddr.upper().left(8)]; | 130 | return manufacturers[macaddr.upper().left(8)]; |
127 | } | 131 | } |
128 | 132 | ||
129 | 133 | ||
130 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 134 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
131 | { | 135 | { |
132 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 136 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
133 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 137 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
134 | } | 138 | } |
135 | 139 | ||
140 | } | ||
141 | } | ||
142 | |||