首页 | 注册 | 登录 | 归档 | 搜索 | 标签 | 在线工具

network-conf.kmdr

<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>
Form1</class>
<
widget class="Dialog">
     <
property name="name">
             <
cstring>Form1</cstring>
     </
property>
     <
property name="geometry">
             <
rect>
                 <
x>0</x>
                 <
y>0</y>
                 <
width>280</width>
                 <
height>300</height>
             </
rect>
     </
property>
     <
property name="caption">
             <
string>Network configurator</string>
     </
property>
     <
property name="icon">
             <
pixmap>image0</pixmap>
     </
property>
     <
property name="populationText">
             <
string></string>
     </
property>
     <
property name="associations" stdset="0">
             <
stringlist>
                 <
string></string>
                 <
string>@if (@exec('whoami') != "root"then
    
@Message.info(@i18n("You should launch this with \nkdesu -c kmdr-executor network-conf.kmdr\nIf your account does not have admin authority changes will not save"), @i18n("Needs to be run as root"))
@endif
@
ComboBox1.insertItems(@exec('cat /proc/net/dev | grep ":" | grep -v lo | grep -v sit | cut -d ":" -f 1 | tr -d " "'),0)
@
Setup.execute
</string>
                 <
string></string>
             </
stringlist>
     </
property>
     <
property name="useInternalParser">
             <
bool>false</bool>
     </
property>
     <
grid>
             <
property name="name">
                 <
cstring>unnamed</cstring>
             </
property>
             <
property name="margin">
                 <
number>11</number>
             </
property>
             <
property name="spacing">
                 <
number>6</number>
             </
property>
             <
widget class="Label" row="0" column="0">
                 <
property name="name">
                     <
cstring>Label4</cstring>
                 </
property>
                 <
property name="text">
                     <
string>Device:</string>
                 </
property>
                 <
property name="associations" stdset="0">
                     <
stringlist>
                             <
string></string>
                     </
stringlist>
                 </
property>
             </
widget>
             <
widget class="ComboBox" row="0" column="1">
                 <
property name="name">
                     <
cstring>ComboBox1</cstring>
                 </
property>
                 <
property name="editable">
                     <
bool>true</bool>
                 </
property>
                 <
property name="populationText">
                     <
string></string>
                 </
property>
                 <
property name="associations" stdset="0">
                     <
stringlist>
                             <
string>@widgetText</string>
                     </
stringlist>
                 </
property>
             </
widget>
             <
widget class="ButtonGroup" row="1" column="0" rowspan="1" colspan="3">
                 <
property name="name">
                     <
cstring>IPGroup</cstring>
                 </
property>
                 <
property name="title">
                     <
string>Set the IP Address</string>
                 </
property>
                 <
property name="checkable">
                     <
bool>true</bool>
                 </
property>
                 <
property name="associations" stdset="0">
                     <
stringlist>
                             <
string>killall dhcpcd
ifconfig 
@ComboBox1.text down
ifconfig 
@ComboBox1.text @IP.text netmask @mask.text
route add 
default gateway @gateway.text @ComboBox1.text
@setGlobal(IPset, @i18n("Your IP address has been set to @IP.text\n"))</string>
                             <
string>@setGlobal(IPset, @i18n("IP not set\n"))
</
string>
                     </
stringlist>
                 </
property>
                 <
grid>
                     <
property name="name">
                             <
cstring>unnamed</cstring>
                     </
property>
                     <
property name="margin">
                             <
number>11</number>
                     </
property>
                     <
property name="spacing">
                             <
number>6</number>
                     </
property>
                     <
widget class="QLayoutWidget" row="0" column="0">
                             <
property name="name">
                                 <
cstring>Layout10</cstring>
                             </
property>
                             <
grid>
                                 <
property name="name">
                                     <
cstring>unnamed</cstring>
                                 </
property>
                                 <
property name="margin">
                                     <
number>0</number>
                                 </
property>
                                 <
property name="spacing">
                                     <
number>6</number>
                                 </
property>
                                 <
widget class="LineEdit" row="0" column="1">
                                     <
property name="name">
                                             <
cstring>IP</cstring>
                                     </
property>
                                     <
property name="populationText">
                                             <
string></string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="LineEdit" row="1" column="1">
                                     <
property name="name">
                                             <
cstring>mask</cstring>
                                     </
property>
                                     <
property name="populationText">
                                             <
string></string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="LineEdit" row="2" column="1">
                                     <
property name="name">
                                             <
cstring>gateway</cstring>
                                     </
property>
                                     <
property name="populationText">
                                             <
string></string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="Label" row="0" column="0">
                                     <
property name="name">
                                             <
cstring>Label1</cstring>
                                     </
property>
                                     <
property name="text">
                                             <
string>IP Address:</string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="Label" row="1" column="0">
                                     <
property name="name">
                                             <
cstring>Label2</cstring>
                                     </
property>
                                     <
property name="text">
                                             <
string>Subnet mask:</string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="Label" row="2" column="0">
                                     <
property name="name">
                                             <
cstring>Label3</cstring>
                                     </
property>
                                     <
property name="text">
                                             <
string>Default gateway:</string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                             </
grid>
                     </
widget>
                 </
grid>
             </
widget>
             <
widget class="ButtonGroup" row="2" column="0" rowspan="1" colspan="3">
                 <
property name="name">
                     <
cstring>DNSGroup</cstring>
                 </
property>
                 <
property name="title">
                     <
string>Set the DNS addresses</string>
                 </
property>
                 <
property name="checkable">
                     <
bool>true</bool>
                 </
property>
                 <
property name="associations" stdset="0">
                     <
stringlist>
                             <
string>echo "nameserver @DNS1.text" &gt;/etc/resolv.conf
echo "nameserver @DNS2.text" &gt;&gt;/etc/resolv.conf
@setGlobal(DNSset, @i18n("Your DNS has been set"))</string>
                             <
string>@setGlobal(DNSset, @i18n("DNS not set"))
</
string>
                     </
stringlist>
                 </
property>
                 <
grid>
                     <
property name="name">
                             <
cstring>unnamed</cstring>
                     </
property>
                     <
property name="margin">
                             <
number>11</number>
                     </
property>
                     <
property name="spacing">
                             <
number>6</number>
                     </
property>
                     <
widget class="QLayoutWidget" row="1" column="0">
                             <
property name="name">
                                 <
cstring>Layout14</cstring>
                             </
property>
                             <
grid>
                                 <
property name="name">
                                     <
cstring>unnamed</cstring>
                                 </
property>
                                 <
property name="margin">
                                     <
number>0</number>
                                 </
property>
                                 <
property name="spacing">
                                     <
number>6</number>
                                 </
property>
                                 <
widget class="Label" row="0" column="0">
                                     <
property name="name">
                                             <
cstring>Label5</cstring>
                                     </
property>
                                     <
property name="text">
                                             <
string>Primary DNS:</string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="LineEdit" row="0" column="1">
                                     <
property name="name">
                                             <
cstring>DNS1</cstring>
                                     </
property>
                                     <
property name="populationText">
                                             <
string></string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="LineEdit" row="1" column="1">
                                     <
property name="name">
                                             <
cstring>DNS2</cstring>
                                     </
property>
                                     <
property name="populationText">
                                             <
string></string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                                 <
widget class="Label" row="1" column="0">
                                     <
property name="name">
                                             <
cstring>Label6</cstring>
                                     </
property>
                                     <
property name="text">
                                             <
string>Secondary DNS:</string>
                                     </
property>
                                     <
property name="associations" stdset="0">
                                             <
stringlist>
                                                 <
string></string>
                                             </
stringlist>
                                     </
property>
                                 </
widget>
                             </
grid>
                     </
widget>
                 </
grid>
             </
widget>
             <
widget class="QLayoutWidget" row="3" column="2">
                 <
property name="name">
                     <
cstring>Layout6</cstring>
                 </
property>
                 <
hbox>
                     <
property name="name">
                             <
cstring>unnamed</cstring>
                     </
property>
                     <
property name="margin">
                             <
number>0</number>
                     </
property>
                     <
property name="spacing">
                             <
number>6</number>
                     </
property>
                     <
widget class="ExecButton">
                             <
property name="name">
                                 <
cstring>ExecButton1</cstring>
                             </
property>
                             <
property name="text">
                                 <
string>A&amp;pply</string>
                             </
property>
                             <
property name="associations" stdset="0">
                                 <
stringlist>
                                     <
string>@IPGroup
@DNSGroup
@Message.info(@global(IPset) @global(DNSset))</string>
                                 </
stringlist>
                             </
property>
                     </
widget>
                     <
widget class="CloseButton">
                             <
property name="name">
                                 <
cstring>CloseButton1</cstring>
                             </
property>
                             <
property name="text">
                                 <
string>C&amp;lose</string>
                             </
property>
                             <
property name="associations" stdset="0">
                                 <
stringlist>
                                     <
string></string>
                                 </
stringlist>
                             </
property>
                     </
widget>
                 </
hbox>
             </
widget>
             <
widget class="ScriptObject" row="0" column="2">
                 <
property name="name">
                     <
cstring>Setup</cstring>
                 </
property>
                 <
property name="associations" stdset="0">
                     <
stringlist>
                             <
string>@IP.setText(@exec('ifconfig @ComboBox1 |egrep -o "addr:[0-9.]+" | cut -b 6-'))
@
mask.setText(@exec('ifconfig @ComboBox1 |egrep -o Mask:[0-9.]+ | cut -b 6-'))
@
gateway.setText(@exec('route -n |grep @ComboBox1 |grep UG | tr -s " " |cut -d " " -f 2'))
@
DNS1.setText(@exec('cat /etc/resolv.conf | grep nameserver | cut -d " " -f 2 | tail -n 2 | head -n 1'))
@
DNS2.setText(@exec('cat /etc/resolv.conf | grep nameserver | cut -d " " -f 2 | tail -n 1'))</string>
                     </
stringlist>
                 </
property>
             </
widget>
     </
grid>
</
widget>
<
images>
     <
image name="image0">
             <
data format="XPM.GZ" length="19774">789cbd99d77223c97286efcf536c9cba3ba128c11240287441ef097aa7d045f96e80041d401254e8dd955df967cdcceecc727674a4e5d6343e96cbfc33cb34f8affff8edfaf8f0b77ffcebdf5ee6665ebbdf5c659e7ffb875fdcdf2fffe33ffffdbffef6f795de6ff4ffa0d5ffadf3f77ff9dbdf4fe6bfb9df8e1e66a101754da05af9bf86c352b83dccf556b893