-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 595633d..f61270b 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -61,58 +61,67 @@ OManufacturerDB::OManufacturerDB() | |||
61 | if ( !QFile::exists( filename ) ) | 61 | if ( !QFile::exists( filename ) ) |
62 | { | 62 | { |
63 | filename = "/opt/QtPalmtop/etc/manufacturers"; | 63 | filename = "/opt/QtPalmtop/etc/manufacturers"; |
64 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 64 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
65 | if ( !QFile::exists( filename ) ) | 65 | if ( !QFile::exists( filename ) ) |
66 | { | 66 | { |
67 | filename = "/usr/share/wellenreiter/manufacturers"; | 67 | filename = "/usr/share/wellenreiter/manufacturers"; |
68 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 68 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | QFile file( filename ); | 72 | QFile file( filename ); |
73 | bool hasFile = file.open( IO_ReadOnly ); | 73 | bool hasFile = file.open( IO_ReadOnly ); |
74 | if (!hasFile) | 74 | if (!hasFile) |
75 | { | 75 | { |
76 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 76 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
77 | } | 77 | } |
78 | else | 78 | else |
79 | { | 79 | { |
80 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 80 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
81 | QTextStream s( &file ); | 81 | QTextStream s( &file ); |
82 | QString addr; | 82 | QString addr; |
83 | QString manu; | 83 | QString manu; |
84 | QString extManu; | 84 | QString extManu; |
85 | #ifdef OPIE_IMPROVE_GUI_LATENCY | ||
86 | int counter = 0; | ||
87 | #endif | ||
85 | while (!s.atEnd()) | 88 | while (!s.atEnd()) |
86 | { | 89 | { |
87 | s >> addr; | 90 | s >> addr; |
88 | s >> manu; | 91 | s >> manu; |
89 | s >> extManu; | 92 | s >> extManu; |
90 | 93 | ||
91 | manufacturers.insert( addr, manu ); | 94 | manufacturers.insert( addr, manu ); |
92 | manufacturersExt.insert( addr, extManu ); | 95 | manufacturersExt.insert( addr, extManu ); |
93 | odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; | 96 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; |
94 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 97 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
95 | if ( qApp ) qApp->processEvents(); | 98 | counter++; |
99 | if ( counter == 50 ) | ||
100 | { | ||
101 | qApp->processEvents(); | ||
102 | counter = 0; | ||
103 | } | ||
96 | #endif | 104 | #endif |
97 | } | 105 | } |
106 | odebug << "OManufacturerDB: manufacturer list completed." << oendl; | ||
98 | } | 107 | } |
99 | } | 108 | } |
100 | 109 | ||
101 | 110 | ||
102 | OManufacturerDB::~OManufacturerDB() | 111 | OManufacturerDB::~OManufacturerDB() |
103 | { | 112 | { |
104 | } | 113 | } |
105 | 114 | ||
106 | 115 | ||
107 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 116 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
108 | { | 117 | { |
109 | return manufacturers[macaddr.upper().left(8)]; | 118 | return manufacturers[macaddr.upper().left(8)]; |
110 | } | 119 | } |
111 | 120 | ||
112 | 121 | ||
113 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 122 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
114 | { | 123 | { |
115 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 124 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
116 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 125 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
117 | } | 126 | } |
118 | 127 | ||