patrik08
5th April 2007, 08:49
To set a new ip or save location on my window OS notebook i know only one primityve way....
### backup ip config
netsh -c interface dump>c:\today.txt
### put new ip from other location ... to today.txt
### load ip config
netsh -f c:\today.txt
one the same pc on xubuntu i put a new name location .. and each place wo i go ... i only switch a combobox ... and the new config is running .... magic ... :-) like Mac OS X
on QNetworkAddressEntry
http://doc.trolltech.com/qtopia4.2/qnetworkaddressentry.html
i found a ip handler ... to chance ip but not work so if describe on doc... why??
why Only win Os make software expensive! and trouble?
i make a combobox from each network card.... and i suppose to chanche ....
void Load_Position( int netpos )
{
const QString OsInterfacesName = net->itemData(netpos).toString();
if (OsInterfacesName.size() < 1) {
return;
}
QNetworkInterface hop = QNetworkInterface::interfaceFromName(OsInterfacesN ame);
int ddi = hop.flags();
qDebug() << "hop.flags() >>> " << ddi;
QList<QNetworkAddressEntry> allhop = hop.addressEntries();
foreach(QNetworkAddressEntry eth, allhop) {
if (allhop.size() == 1 ) {
/* window os on name --- linux eth0:1 eth0:1 ecc... virtual ip */
actual = eth;
}
wbroad->setText(eth.broadcast().toString());
wmask->setText(eth.netmask().toString());
wip->setText(eth.ip().toString());
}
if ( wip->text().size() > 0 || wmask->text().size() > 0 || hop.isValid() ) {
/* have it */
qDebug() << " valid config && running ";
/* enable button to chance ip */
wset->setEnabled(true);
} else {
wset->setEnabled(false);
}
}
or is the better way edit netsh result file and resend it... ??
the full apps on attach zip
### backup ip config
netsh -c interface dump>c:\today.txt
### put new ip from other location ... to today.txt
### load ip config
netsh -f c:\today.txt
one the same pc on xubuntu i put a new name location .. and each place wo i go ... i only switch a combobox ... and the new config is running .... magic ... :-) like Mac OS X
on QNetworkAddressEntry
http://doc.trolltech.com/qtopia4.2/qnetworkaddressentry.html
i found a ip handler ... to chance ip but not work so if describe on doc... why??
why Only win Os make software expensive! and trouble?
i make a combobox from each network card.... and i suppose to chanche ....
void Load_Position( int netpos )
{
const QString OsInterfacesName = net->itemData(netpos).toString();
if (OsInterfacesName.size() < 1) {
return;
}
QNetworkInterface hop = QNetworkInterface::interfaceFromName(OsInterfacesN ame);
int ddi = hop.flags();
qDebug() << "hop.flags() >>> " << ddi;
QList<QNetworkAddressEntry> allhop = hop.addressEntries();
foreach(QNetworkAddressEntry eth, allhop) {
if (allhop.size() == 1 ) {
/* window os on name --- linux eth0:1 eth0:1 ecc... virtual ip */
actual = eth;
}
wbroad->setText(eth.broadcast().toString());
wmask->setText(eth.netmask().toString());
wip->setText(eth.ip().toString());
}
if ( wip->text().size() > 0 || wmask->text().size() > 0 || hop.isValid() ) {
/* have it */
qDebug() << " valid config && running ";
/* enable button to chance ip */
wset->setEnabled(true);
} else {
wset->setEnabled(false);
}
}
or is the better way edit netsh result file and resend it... ??
the full apps on attach zip