summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/usb/usb_NNI.cpp
blob: 6fcd6d5cf631f34c9f825c83bf3c5503b137974f (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
53
54
55
56
57
#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::generateDataForCommonFile( SystemFile & S, long DevNr ) {
    AsDevice * Dev = runtime()->device();
    QString NIC = Dev->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;
}

bool AUSB::generateDeviceDataForCommonFile( SystemFile & S, long DevNr ) {
    AsDevice * Dev = runtime()->device();
    QString NIC = Dev->genNic( DevNr );

    if( S.name() == "interfaces" ) {
      // generate mapping stanza for this interface
      S << "# check if " << NIC << " can be brought UP" << endl;
      S << "mapping " << NIC << endl;
      S << "  script networksettings2-request" << endl << endl;
    }
    return 0;
}