~ubuntu-branches/ubuntu/precise/networkmanagement/precise-updates

« back to all changes in this revision

Viewing changes to libs/ui/ipv4widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl, Modestas Vainius, Michael Biebl
  • Date: 2011-05-27 12:18:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110527121825-vfufwquq3vy0k3zn
Tags: 0.1+git20110526.911025d-1
[ Modestas Vainius ]
* Use official KDE branding in the package descriptions.

[ Michael Biebl ]
* New upstream Git snapshot 911025d81fdfbe09b64705e94e5411f521c38e3e.
* debian/control
  - Bump Build-Depends on kdelibs5-dev and kdebase-workspace-dev to
    (>= 4:4.6.0).
  - Bump Build-Depends on network-manager-dev and libnm-util-dev to
    (>= 0.8.1).
  - Bump Depends on network-manager to (>= 0.8.1).

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "settingwidget_p.h"
23
23
 
24
24
#include <KDebug>
25
 
#include <KEditListBox>
26
25
 
27
26
#include <QNetworkAddressEntry>
28
27
 
44
43
    }
45
44
 
46
45
    // Make sure that this order is same as the combobox shown in ipv4.ui file
47
 
    enum MethodIndex { AutomaticMethodIndex = 0, AutomaticOnlyIPMethodIndex, ManualMethodIndex, LinkLocalMethodIndex, SharedMethodIndex };
 
46
    enum MethodIndex { AutomaticMethodIndex = 0, AutomaticOnlyIPMethodIndex, ManualMethodIndex, LinkLocalMethodIndex, SharedMethodIndex, DisabledMethodIndex};
48
47
    Ui_SettingsIp4Config ui;
49
48
    Knm::Ipv4Setting * setting;
50
49
    bool isAdvancedModeOn;
160
159
            kDebug() << "Method: Shared";
161
160
            d->ui.method->setCurrentIndex(d->SharedMethodIndex);
162
161
            break;
 
162
        case Knm::Ipv4Setting::EnumMethod::Disabled:
 
163
            kDebug() << "Method: Shared";
 
164
            d->ui.method->setCurrentIndex(d->DisabledMethodIndex);
 
165
            break;
163
166
        default:
164
167
            kDebug() << "Unrecognised value for method:" << d->setting->method();
165
168
            break;
207
210
    }
208
211
    // dhcp client ID
209
212
    d->ui.dhcpClientId->setText(d->setting->dhcpclientid());
 
213
 
210
214
    // routing
211
 
    d->ui.cbNeverDefault->setChecked(d->setting->neverdefault());
212
 
    d->ui.cbIgnoreAutoRoutes->setChecked(d->setting->ignoreautoroute());
 
215
    if (advancedSettingsPartEnabled)
 
216
    {
 
217
        d->ui.routesSettings->setNeverDefault(d->setting->neverdefault());
 
218
        d->ui.routesSettings->setIgnoreAutoRoutes(d->setting->ignoreautoroute());
 
219
        d->ui.routesSettings->setRoutes(d->setting->routes());
 
220
    }
 
221
 
 
222
    //required or not
 
223
    d->ui.cbMayFail->setChecked(!d->setting->mayfail());
213
224
}
214
225
 
215
226
void IpV4Widget::writeConfig()
237
248
            d->setting->setMethod(Knm::Ipv4Setting::EnumMethod::Shared);
238
249
            d->setting->setIgnoredhcpdns(false);
239
250
            break;
 
251
        case IpV4WidgetPrivate::DisabledMethodIndex:
 
252
            d->setting->setMethod(Knm::Ipv4Setting::EnumMethod::Disabled);
 
253
            d->setting->setIgnoredhcpdns(false);
 
254
            break;
240
255
        default:
241
256
            kDebug() << "Unrecognised combo box index for method:" << d->ui.method->currentIndex();
242
257
            break;
286
301
    // dhcp client ID
287
302
    d->setting->setDhcpclientid(d->ui.dhcpClientId->text());
288
303
    // routing
289
 
    d->setting->setNeverdefault(d->ui.cbNeverDefault->isChecked());
290
 
    d->setting->setIgnoreautoroute(d->ui.cbIgnoreAutoRoutes->isChecked());
 
304
    d->setting->setNeverdefault(d->ui.routesSettings->neverdefault());
 
305
    d->setting->setIgnoreautoroute(d->ui.routesSettings->ignoreautoroutes());
 
306
    d->setting->setRoutes(d->ui.routesSettings->routes());
 
307
 
 
308
    //required or not
 
309
    d->setting->setMayfail(!d->ui.cbMayFail->isChecked());
291
310
}
292
311
 
293
312
void IpV4Widget::methodChanged(int currentIndex)
360
379
    }
361
380
 
362
381
    d->ui.advancedSettings->setEnabled(advancedSettingsPartEnabled);
 
382
    d->ui.routesSettings->setEnabled(advancedSettingsPartEnabled);
363
383
    d->ui.address->setEnabled(addressPartEnabled);
364
384
    d->ui.addressLabel->setEnabled(addressPartEnabled);
365
385
    d->ui.netMask->setEnabled(addressPartEnabled);