summaryrefslogtreecommitdiff
path: root/noncore/applets/networkapplet/networkapplet.cpp
Side-by-side diff
Diffstat (limited to 'noncore/applets/networkapplet/networkapplet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/networkapplet/networkapplet.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp
index 5eb5ad2..534a8d0 100644
--- a/noncore/applets/networkapplet/networkapplet.cpp
+++ b/noncore/applets/networkapplet/networkapplet.cpp
@@ -15,59 +15,61 @@
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "networkapplet.h"
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/onetwork.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
-#include <qpainter.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
+using namespace Opie::Net;
/* QT */
+#include <qpainter.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qobjectlist.h>
+/* STD */
#include <assert.h>
-using namespace Opie::Ui;
-using namespace Opie::Net;
IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name )
:QToolButton( parent, name )
{
_iface = ONetwork::instance()->interface( name );
assert( _iface );
setToggleButton( true );
//setAutoRaise( true );
setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) );
setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) );
setOn( _iface->isUp() );
//setFixedWidth( 16 );
connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) );
}
IfaceUpDownButton::~IfaceUpDownButton()
{
}
void IfaceUpDownButton::clicked()
{
_iface->setUp( isOn() );
setOn( _iface->isUp() ); // it might not have worked...
@@ -146,85 +148,85 @@ NetworkAppletControl::~NetworkAppletControl()
{
}
QString NetworkAppletControl::guessDevice( ONetworkInterface* iface )
{
if ( iface->isWireless() )
return "networksettings/wlan";
if ( iface->isLoopback() )
return "networksettings/lo";
if ( QString( iface->name() ).contains( "usb" ) )
return "networksettings/usb";
if ( QString( iface->name() ).contains( "ir" ) )
return "networksettings/irda";
//TODO: Insert neat symbol and check for tunnel devices
return "networksettings/lan";
}
void NetworkAppletControl::showEvent( QShowEvent* e )
{
- qDebug( "showEvent" );
+ odebug << "showEvent" << oendl;
build();
QWidget::showEvent( e );
}
void NetworkAppletControl::hideEvent( QHideEvent* e )
{
- qDebug( "hideEvent" );
+ odebug << "hideEvent" << oendl;
QWidget::hideEvent( e );
delete l;
// delete all child widgets from this frame
QObjectList* list = const_cast<QObjectList*>( children() );
QObjectListIt it(*list);
QObject* obj;
while ( (obj=it.current()) )
{
++it;
delete obj;
}
list = const_cast<QObjectList*>( children() );
if ( list )
- qWarning( "D'oh! We still have %d children...", list->count() );
+ owarn << "D'oh! We still have " << list->count() << " children..." << oendl;
// renew layout
l = new QVBoxLayout( this, 4, 2 );
resize( 0, 0 );
}
QSize NetworkAppletControl::sizeHint() const
{
ONetwork::instance()->synchronize(); // rebuild interface database
- qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() );
+ odebug << "sizeHint (#ifaces=" << ONetwork::instance()->count() << ")" << oendl;
return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 );
}
NetworkApplet::NetworkApplet( QWidget *parent, const char *name )
:OTaskbarApplet( parent, name )
{
setFixedHeight( AppLnk::smallIconSize() );
setFixedWidth( AppLnk::smallIconSize() );
_pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) );
_control = new NetworkAppletControl( this, "control" );
}
NetworkApplet::~NetworkApplet()
{
}
int NetworkApplet::position()
{
return 4;
}