|
|
@ -27,7 +27,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <tqevent.h>
|
|
|
|
#include <tqevent.h>
|
|
|
|
#include <tqvbox.h>
|
|
|
|
#include <tqvbox.h>
|
|
|
|
#include <tqlayout.h>
|
|
|
|
#include <layout.h>
|
|
|
|
#include <tqpushbutton.h>
|
|
|
|
#include <tqpushbutton.h>
|
|
|
|
#include <tqpixmap.h>
|
|
|
|
#include <tqpixmap.h>
|
|
|
|
#include <tqpixmapcache.h>
|
|
|
|
#include <tqpixmapcache.h>
|
|
|
@ -94,20 +94,20 @@ TQString WirelessNetworkItem::getDisplayText()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString security = "";
|
|
|
|
TQString security = "";
|
|
|
|
if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE && _net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE && _net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
security = TQString("(%1/%2)").tqarg(i18n("WPA")).tqarg(i18n("RSN"));
|
|
|
|
security = TQString("(%1/%2)").arg(i18n("WPA")).arg(i18n("RSN"));
|
|
|
|
else if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
else if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
security = TQString("(%1)").tqarg(i18n("WPA"));
|
|
|
|
security = TQString("(%1)").arg(i18n("WPA"));
|
|
|
|
else if (_net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
else if (_net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
|
|
|
|
security = TQString("(%2)").tqarg(i18n("RSN"));
|
|
|
|
security = TQString("(%2)").arg(i18n("RSN"));
|
|
|
|
|
|
|
|
|
|
|
|
Info* info = NULL;
|
|
|
|
Info* info = NULL;
|
|
|
|
if (_conn)
|
|
|
|
if (_conn)
|
|
|
|
info = _conn->getInfoSetting();
|
|
|
|
info = _conn->getInfoSetting();
|
|
|
|
|
|
|
|
|
|
|
|
if (info && info->getName() != _net.getDisplaySsid())
|
|
|
|
if (info && info->getName() != _net.getDisplaySsid())
|
|
|
|
return TQString("%2/%1 %3").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(info->getName()).tqarg(security);
|
|
|
|
return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(info->getName()).arg(security);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return TQString("%1 %2").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(security);
|
|
|
|
return TQString("%1 %2").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(security);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
@ -115,35 +115,35 @@ WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highl
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int spacer = 0;
|
|
|
|
int spacer = 0;
|
|
|
|
pbarStrength->setTotalSteps (100);
|
|
|
|
pbarStrength->setTotalSteps (100);
|
|
|
|
pbarStrength->tqsetSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ()));
|
|
|
|
pbarStrength->setSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ()));
|
|
|
|
pbarStrength->setFixedHeight (_height - 2);
|
|
|
|
pbarStrength->setFixedHeight (_height - 2);
|
|
|
|
pbarStrength->setProgress (_net.getStrength());
|
|
|
|
pbarStrength->setProgress (_net.getStrength());
|
|
|
|
pbarStrength->setPercentageVisible (false);
|
|
|
|
pbarStrength->setPercentageVisible (false);
|
|
|
|
|
|
|
|
|
|
|
|
if (highlighted) {
|
|
|
|
if (highlighted) {
|
|
|
|
p->setPen(parent->tqpalette ().active ().highlightedText ());
|
|
|
|
p->setPen(parent->palette ().active ().highlightedText ());
|
|
|
|
pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight );
|
|
|
|
pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight );
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p->setPen(parent->tqpalette ().active ().text ());
|
|
|
|
p->setPen(parent->palette ().active ().text ());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText());
|
|
|
|
p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText());
|
|
|
|
|
|
|
|
|
|
|
|
if (_net.isEncrypted()) {
|
|
|
|
if (_net.isEncrypted()) {
|
|
|
|
TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic);
|
|
|
|
TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic);
|
|
|
|
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock);
|
|
|
|
p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock);
|
|
|
|
spacer = pmLock.size ().width () + 4;
|
|
|
|
spacer = pmLock.size ().width () + 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_adhoc) {
|
|
|
|
if (_adhoc) {
|
|
|
|
TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic);
|
|
|
|
TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic);
|
|
|
|
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc);
|
|
|
|
p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength));
|
|
|
|
p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQSize
|
|
|
|
TQSize
|
|
|
|
WirelessNetworkItem::tqsizeHint ()
|
|
|
|
WirelessNetworkItem::sizeHint ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return TQSize (_width, _height);
|
|
|
|
return TQSize (_width, _height);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -169,7 +169,7 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw
|
|
|
|
// figure out the height of the text
|
|
|
|
// figure out the height of the text
|
|
|
|
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
|
|
|
|
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
|
|
|
|
// the item is height of the text plus the default frame width
|
|
|
|
// the item is height of the text plus the default frame width
|
|
|
|
_height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
_height = _textHeight + kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
|
|
|
|
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
|
|
|
|
if (_height < _widgetHeight) {
|
|
|
|
if (_height < _widgetHeight) {
|
|
|
|
_height = _widgetHeight + 2;
|
|
|
|
_height = _widgetHeight + 2;
|
|
|
@ -177,8 +177,8 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw
|
|
|
|
|
|
|
|
|
|
|
|
/* border required for pmLock and pbarStrength */
|
|
|
|
/* border required for pmLock and pbarStrength */
|
|
|
|
_border = 1;
|
|
|
|
_border = 1;
|
|
|
|
if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
|
|
|
|
if (_border == kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth))
|
|
|
|
_border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
_border += 2 * kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
if (_border == 0)
|
|
|
|
if (_border == 0)
|
|
|
|
_border ++;
|
|
|
|
_border ++;
|
|
|
|
|
|
|
|
|
|
|
@ -209,7 +209,7 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw
|
|
|
|
// figure out the height of the text
|
|
|
|
// figure out the height of the text
|
|
|
|
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
|
|
|
|
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
|
|
|
|
// the item is height of the text plus the default frame width
|
|
|
|
// the item is height of the text plus the default frame width
|
|
|
|
_height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
_height = _textHeight + kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
|
|
|
|
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
|
|
|
|
if (_height < _widgetHeight) {
|
|
|
|
if (_height < _widgetHeight) {
|
|
|
|
_height = _widgetHeight + 2;
|
|
|
|
_height = _widgetHeight + 2;
|
|
|
@ -217,8 +217,8 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw
|
|
|
|
|
|
|
|
|
|
|
|
/* border required for pmLock and pbarStrength */
|
|
|
|
/* border required for pmLock and pbarStrength */
|
|
|
|
_border = 1;
|
|
|
|
_border = 1;
|
|
|
|
if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
|
|
|
|
if (_border == kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth))
|
|
|
|
_border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
_border += 2 * kapp->tqstyle ().pixelMetric (TQStyle::PM_DefaultFrameWidth);
|
|
|
|
if (_border == 0)
|
|
|
|
if (_border == 0)
|
|
|
|
_border ++;
|
|
|
|
_border ++;
|
|
|
|
|
|
|
|
|
|
|
|