summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-27 21:44:42 (UTC)
committer zecke <zecke>2004-09-27 21:44:42 (UTC)
commit9c8f2e26e05be9230ed960d4b4ed21dc658df33e (patch) (side-by-side diff)
treef0c16477d1d25374fb0a983da786ef96839e7db5
parentba463a1029d1c0ff553a3dc9bf544617289d95f0 (diff)
downloadopie-9c8f2e26e05be9230ed960d4b4ed21dc658df33e.zip
opie-9c8f2e26e05be9230ed960d4b4ed21dc658df33e.tar.gz
opie-9c8f2e26e05be9230ed960d4b4ed21dc658df33e.tar.bz2
Do not crash due an empty image
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index 4a2440a..110786a 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -1,26 +1,29 @@
#include <time.h>
#include <qpe/qpeapplication.h>
+#include <qpe/resource.h>
+
+
#include <qpainter.h>
#include <qbitmap.h>
#include <qtextstream.h>
#include <qpixmap.h>
#include "resources.h"
#include "netnode.h"
#include "asdevice.h"
#include "asline.h"
#include "asconnection.h"
#include "asfullsetup.h"
QString & deQuote( QString & X ) {
if( X[0] == '"' ) {
// remove end and trailing "" and \x -> x
QChar R;
long idx;
idx = X.length()-1;
X = X.mid( 1, idx );
idx = 0;
while( ( idx = X.find( '\\', idx ) ) >= 0 ) {
R = X.at( idx + 1 );
@@ -232,48 +235,51 @@ ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) {
int NodeCollection::compareItems( QCollection::Item I1,
QCollection::Item I2 ) {
ANetNodeInstance * NNI1, * NNI2;
NNI1 = (ANetNodeInstance *)I1;
NNI2 = (ANetNodeInstance *)I2;
return strcmp( NNI1->name(), NNI2->name() );
}
static char * State2PixmapTbl[] = {
"NULL", // Unchecked : no pixmap
"check", // Unknown
"delete", // unavailable
"disabled", // disabled
"off", // off
"disconnected", // available
"connected" // up
};
QPixmap NodeCollection::devicePixmap( void ) {
QPixmap pm = NSResources->getPixmap(
getToplevel()->nextNode()->pixmapName()+"-large");
QPixmap Mini = NSResources->getPixmap( device()->netNode()->pixmapName() );
+ if( pm.isNull() || Mini.isNull() )
+ return Resource::loadPixmap("Unknown");
+
QPainter painter( &pm );
painter.drawPixmap( pm.width()-Mini.width(),
pm.height()-Mini.height(),
Mini );
pm.setMask( pm.createHeuristicMask( TRUE ) );
return pm;
}
QPixmap NodeCollection::statePixmap( State_t S) {
return NSResources->getPixmap( State2PixmapTbl[S] );
}
QString NodeCollection::stateName( State_t S) {
switch( S ) {
case Unknown :
return qApp->translate( "networksettings2", "Unknown");
case Unavailable :
return qApp->translate( "networksettings2", "Unavailable");
case Disabled :
return qApp->translate( "networksettings2", "Disabled");
case Off :
return qApp->translate( "networksettings2", "Off");
case Available :
return qApp->translate( "networksettings2", "Available");