-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings2/networksettings.h | 13 |
2 files changed, 14 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index a0d4c7c..dca6631 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp @@ -1,147 +1,147 @@ #include <stdio.h> #include <unistd.h> #include <errno.h> #include <opie2/odebug.h> #include <opie2/oledbox.h> #include <qpe/qpeapplication.h> #include <qlistbox.h> #include <qlayout.h> #include <qgroupbox.h> #include <qtimer.h> #include <qlistbox.h> #include <qmessagebox.h> #include <qlabel.h> #include <qiconview.h> #include <qtimer.h> #include <qpe/qpeapplication.h> #include <qtoolbutton.h> #include <qevent.h> #include "networksettings.h" #include "netnode.h" #include "editconnection.h" NetworkSettings::NetworkSettings( QWidget *parent, const char *name, WFlags fl ) : NetworkSettingsGUI(parent,name,fl), NSD() { UpdateTimer = new QTimer( this ); // set pixmaps Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); Disable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); Up_TB->setPixmap( NSResources->getPixmap( "more" ) ); Down_TB->setPixmap( NSResources->getPixmap( "less" ) ); QVBoxLayout* V = new QVBoxLayout( LED_Frm ); QHBoxLayout * H = new QHBoxLayout( 0 ); V->addStretch(1); V->addLayout( H ); - Leds[0] = new OLedBox( red, LED_Frm ); + Leds[0] = new Opie::Ui::OLedBox( red, LED_Frm ); H->addWidget( Leds[0], 0, Qt::AlignVCenter ); - Leds[1] = new OLedBox( red, LED_Frm ); + Leds[1] = new Opie::Ui::OLedBox( red, LED_Frm ); H->addWidget( Leds[1], 0, Qt::AlignVCenter ); - Leds[2] = new OLedBox( red, LED_Frm ); + Leds[2] = new Opie::Ui::OLedBox( red, LED_Frm ); H->addWidget( Leds[2], 0, Qt::AlignVCenter ); V->addStretch(1); SLOT_ToProfile(); // populate main Listbox Profiles_LB->clear(); QPEApplication::setStylusOperation( Profiles_LB->viewport(), QPEApplication::RightOnHold ); connect( Profiles_LB, SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), this, SLOT(SLOT_EditNode(QListBoxItem*)) ); { Name2Connection_t & M = NSResources->connections(); NodeCollection * NC; // for all connections for( QDictIterator<NodeCollection> it(M); it.current(); ++it ) { NC = it.current(); Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); } } if( Profiles_LB->count() ) { Profiles_LB->setSelected( 0, TRUE ); } // if no profiles -> auto popup editing if( NSResources->connections().count() == 0 ) { QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); } connect( &(NSResources->system()), SIGNAL( stdoutLine(const QString &) ), this, SLOT( SLOT_CmdMessage(const QString &) ) ); connect( &(NSResources->system()), SIGNAL( stderrLine(const QString &) ), this, SLOT( SLOT_CmdMessage(const QString &) ) ); connect( &(NSResources->system()), SIGNAL( processEvent(const QString &) ), this, SLOT( SLOT_CmdMessage(const QString &) ) ); UpdateTimer->start( 5000 ); connect( UpdateTimer, SIGNAL( timeout() ), this, SLOT( SLOT_RefreshStates() ) ); /* Add QCopChannel */ connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); } NetworkSettings::~NetworkSettings() { QString S; owarn << "Dispose NS" << oendl; if( NSD.isModified() ) { owarn << "Modified" << oendl; S = NSD.saveSettings(); if( ! S.isEmpty() ) { S.insert( 0, "<p>" ); S.append( "</p>" ); // problem saving QMessageBox::warning( 0, tr( "Saving setup" ), S ); } SLOT_GenerateConfig(); NSD.setModified( 0 ); } } void NetworkSettings::SLOT_CmdMessage( const QString & S ) { Messages_LB->insertItem( S ); Messages_LB->setCurrentItem( Messages_LB->count()-1 ); Messages_LB->ensureCurrentVisible(); } void NetworkSettings::SLOT_RefreshStates( void ) { QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember if( LBI ) { NodeCollection * NC; NSResources->system().probeInterfaces(); // update current selection only NC = NSResources->findConnection( LBI->text() ); if( NC ) { State_t OldS = NC->state(); State_t NewS = NC->state(1); diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h index 987e311..e1c2b80 100644 --- a/noncore/settings/networksettings2/networksettings.h +++ b/noncore/settings/networksettings2/networksettings.h @@ -1,59 +1,68 @@ #include "nsdata.h" #include "networksettingsGUI.h" #include "resources.h" class ANetNode; class ANetNodeInstance; class QTimer; class QListBoxItem; class QEvent; -class OLedBox; + +namespace Opie { + + namespace Ui { + + class OLedBox; + + }; + +}; class NetworkSettings : public NetworkSettingsGUI { Q_OBJECT public : NetworkSettings( QWidget *parent=0, const char *name=0, WFlags fl = 0 ); virtual ~NetworkSettings( void ); static QString appName( void ) { return QString::fromLatin1("networksettings"); } public slots : void SLOT_AddNode( void ); void SLOT_DeleteNode( void ); void SLOT_ShowNode( QListBoxItem * ); void SLOT_EditNode( QListBoxItem * ); void SLOT_CheckState( void ); void SLOT_Up( void ); void SLOT_Down( void ); void SLOT_Disable( bool ); void SLOT_GenerateConfig( void ); void SLOT_RefreshStates( void ); void SLOT_QCopMessage( const QCString&,const QByteArray& ); void SLOT_ToProfile( void ); void SLOT_ToMessages( void ); void SLOT_CmdMessage( const QString & S ); private : void updateProfileState( QListBoxItem * it ); QTimer * UpdateTimer; NetworkSettingsData NSD; /* no leds : not present, unknown, unchecked or disabled (1) down : hardware present but inactive (2) available : hardware present and active (3) up : present active and connected */ - OLedBox * Leds[3]; + Opie::Ui::OLedBox * Leds[3]; }; |