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

« back to all changes in this revision

Viewing changes to libs/internals/settings/pppoe.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:
2
2
// All changes you do to this file will be lost.
3
3
 
4
4
#include "pppoe.h"
5
 
#include "pppoesecrets.h"
6
5
 
7
6
using namespace Knm;
8
7
 
9
8
PppoeSetting::PppoeSetting() : Setting(Setting::Pppoe)
10
9
{
11
 
    m_secretsObject = new PppoeSecrets(this);
12
10
}
13
11
 
14
 
PppoeSetting::PppoeSetting(PppoeSetting *setting) : Setting(setting)
 
12
PppoeSetting::PppoeSetting(PppoeSetting *setting) : Setting(setting), mPasswordflags(Setting::AgentOwned)
15
13
{
16
 
    m_secretsObject = new PppoeSecrets(static_cast<PppoeSecrets*>(setting->getSecretsObject()), this);
17
14
    setService(setting->service());
18
15
    setUsername(setting->username());
19
16
    setPassword(setting->password());
28
25
{
29
26
  return QLatin1String("pppoe");
30
27
}
31
 
bool PppoeSetting::hasSecrets() const
32
 
{
33
 
  return true;
34
 
}
35
 
void PppoeSetting::setSecrets(Setting::secretsTypes types)
36
 
{
37
 
    if (!mPassword.isEmpty())
38
 
        setPasswordflags(types);
39
 
}
 
28
 
 
29
QMap<QString,QString> PppoeSetting::secretsToMap() const
 
30
{
 
31
    QMap<QString,QString> map;
 
32
    if (passwordflags().testFlag(Setting::AgentOwned)) {
 
33
        map.insert(QLatin1String("password"), password());
 
34
    }
 
35
    return map;
 
36
}
 
37
 
 
38
void PppoeSetting::secretsFromMap(QMap<QString,QString> secrets)
 
39
{
 
40
    setPassword(secrets.value("password"));
 
41
}
 
42
 
 
43
QStringList PppoeSetting::needSecrets() const
 
44
{
 
45
    QStringList list;
 
46
    if (password().isEmpty() && !passwordflags().testFlag(Setting::NotRequired))
 
47
        list.append("password");
 
48
    return list;
 
49
}
 
50
 
 
51
bool PppoeSetting::hasPersistentSecrets() const
 
52
{
 
53
    if (passwordflags().testFlag(Setting::None) || passwordflags().testFlag(Setting::AgentOwned))
 
54
        return true;
 
55
    return false;
 
56
}
 
 
b'\\ No newline at end of file'