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

« back to all changes in this revision

Viewing changes to libs/ui/security/eapmethodleap.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-10-23 14:00:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20111023140013-e38hdzybcg6zndrk
Tags: 0.9~svngit.nm09.20111023.ff842e-0ubuntu1
* New upstream snapshot.
* Drop all patches, merged upstream.
* Add kubuntu_add_subdirectory_po.diff to build the translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
: EapMethod(connection, parent)
31
31
{
32
32
    setupUi(this);
 
33
    connect(cmbPasswordStorage, SIGNAL(currentIndexChanged(int)), this, SLOT(passwordStorageChanged(int)));
33
34
}
34
35
 
35
36
EapMethodLeap::~EapMethodLeap()
55
56
    d->setting->setEapFlags(Knm::Security8021xSetting::leap);
56
57
    // LEAP stuff
57
58
    d->setting->setIdentity(leUsername->text());
58
 
    d->setting->setPassword(lePassword->text());
 
59
    switch (cmbPasswordStorage->currentIndex()) {
 
60
        case EapMethodPrivate::Store:
 
61
            d->setting->setPassword(lePassword->text());
 
62
            if (!d->connection->permissions().isEmpty())
 
63
                d->setting->setPasswordflags(Knm::Setting::AgentOwned);
 
64
            else
 
65
                d->setting->setPasswordflags(Knm::Setting::None);
 
66
            break;
 
67
        case EapMethodPrivate::AlwaysAsk:
 
68
            d->setting->setPasswordflags(Knm::Setting::NotSaved);
 
69
            break;
 
70
        case EapMethodPrivate::NotRequired:
 
71
            d->setting->setPasswordflags(Knm::Setting::NotRequired);
 
72
            break;
 
73
    }
59
74
    d->setting->setUseSystemCaCerts(false);
60
 
    d->setting->remove();
61
75
}
62
76
 
63
77
void EapMethodLeap::readSecrets()
64
78
{
65
79
    Q_D(EapMethod);
66
 
    lePassword->setText(d->setting->password());
 
80
    if (d->setting->passwordflags().testFlag(Knm::Setting::AgentOwned) || d->setting->passwordflags().testFlag(Knm::Setting::None)) {
 
81
        lePassword->setText(d->setting->password());
 
82
        cmbPasswordStorage->setCurrentIndex(EapMethodPrivate::Store);
 
83
    } else if (d->setting->passwordflags().testFlag(Knm::Setting::NotSaved)) {
 
84
        cmbPasswordStorage->setCurrentIndex(EapMethodPrivate::AlwaysAsk);
 
85
    } else if (d->setting->passwordflags().testFlag(Knm::Setting::NotRequired)){
 
86
        cmbPasswordStorage->setCurrentIndex(EapMethodPrivate::NotRequired);
 
87
    }
67
88
}
68
89
 
69
90
void EapMethodLeap::setShowPasswords(bool on)
71
92
    lePassword->setPasswordMode(!on);
72
93
}
73
94
 
 
95
void EapMethodLeap::passwordStorageChanged(int type)
 
96
{
 
97
    switch (type)
 
98
    {
 
99
        case EapMethodPrivate::Store:
 
100
            lePassword->setEnabled(true);
 
101
            break;
 
102
        default:
 
103
            lePassword->setEnabled(false);
 
104
            break;
 
105
    }
 
106
}
 
107
 
74
108
// vim: sw=4 sts=4 et tw=100