summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb/usb_NNI.cpp
blob: e90204c51cc8df3ac465b8d1e926c37e59d25d49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <qpe/qpeapplication.h>
#include "usbedit.h"
#include "usb_NNI.h"
#include "usb_NN.h"

AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) {

    GUI = 0;
    RT = 0;
}

void AUSB::setSpecificAttribute( QString & , QString & ) {
}

void AUSB::saveSpecificAttribute( QTextStream & ) {
}


QWidget * AUSB::edit( QWidget * parent ) {
    GUI = new USBEdit( parent );
    GUI->showData( Data ); 
    return GUI;
}

QString AUSB::acceptable( void ) {
    return ( GUI ) ? GUI->acceptable( ) : QString();
}

void AUSB::commit( void ) {
    if( GUI && GUI->commit( Data ) ) {
      setModified( 1 );
    }
}

bool AUSB::hasDataFor( const QString & S ) {
      return (S== "interfaces");
}

bool AUSB::generateDataForCommonFile( SystemFile & S, long DevNr ) {
    QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );

    if( S.name() == "interfaces" ) {
      // generate mapping stanza for this interface
      S << "  pre-up " 
        << QPEApplication::qpeDir() 
        << "bin/setmacaddress.sh " 
        << NIC 
        << " || true" 
        << endl;
    }
    return 0;
}