Changeset View
Changeset View
Standalone View
Standalone View
libs/configuration.cpp
Show All 17 Lines | 1 | /* | |||
---|---|---|---|---|---|
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "configuration.h" | 21 | #include "configuration.h" | ||
22 | 22 | | |||
23 | #include <KConfigGroup> | 23 | #include <KConfigGroup> | ||
24 | #include <KSharedConfig> | 24 | #include <KSharedConfig> | ||
25 | 25 | | |||
26 | Q_GLOBAL_STATIC_WITH_ARGS(KSharedConfigPtr, config, (KSharedConfig::openConfig(QLatin1String("plasma-nm")))) | ||||
27 | | ||||
26 | bool Configuration::unlockModemOnDetection() | 28 | bool Configuration::unlockModemOnDetection() | ||
27 | { | 29 | { | ||
28 | KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm")); | 30 | KConfigGroup grp(*config, QLatin1String("General")); | ||
29 | KConfigGroup grp(config, QLatin1String("General")); | | |||
30 | 31 | | |||
31 | if (grp.isValid()) { | 32 | if (grp.isValid()) { | ||
32 | return grp.readEntry(QLatin1String("UnlockModemOnDetection"), true); | 33 | return grp.readEntry(QLatin1String("UnlockModemOnDetection"), true); | ||
33 | } | 34 | } | ||
34 | 35 | | |||
35 | return true; | 36 | return true; | ||
36 | } | 37 | } | ||
37 | 38 | | |||
38 | void Configuration::setUnlockModemOnDetection(bool unlock) | 39 | void Configuration::setUnlockModemOnDetection(bool unlock) | ||
39 | { | 40 | { | ||
40 | KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm")); | 41 | KConfigGroup grp(*config, QLatin1String("General")); | ||
41 | KConfigGroup grp(config, QLatin1String("General")); | | |||
42 | 42 | | |||
43 | if (grp.isValid()) { | 43 | if (grp.isValid()) { | ||
44 | grp.writeEntry(QLatin1String("UnlockModemOnDetection"), unlock); | 44 | grp.writeEntry(QLatin1String("UnlockModemOnDetection"), unlock); | ||
45 | } | 45 | } | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | bool Configuration::manageVirtualConnections() | 48 | bool Configuration::manageVirtualConnections() | ||
49 | { | 49 | { | ||
50 | KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm")); | 50 | KConfigGroup grp(*config, QLatin1String("General")); | ||
51 | KConfigGroup grp(config, QLatin1String("General")); | | |||
52 | 51 | | |||
53 | if (grp.isValid()) { | 52 | if (grp.isValid()) { | ||
54 | return grp.readEntry(QLatin1String("ManageVirtualConnections"), false); | 53 | return grp.readEntry(QLatin1String("ManageVirtualConnections"), false); | ||
55 | } | 54 | } | ||
56 | 55 | | |||
57 | return true; | 56 | return true; | ||
58 | } | 57 | } | ||
59 | 58 | | |||
60 | void Configuration::setManageVirtualConnections(bool manage) | 59 | void Configuration::setManageVirtualConnections(bool manage) | ||
61 | { | 60 | { | ||
62 | KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm")); | 61 | KConfigGroup grp(*config, QLatin1String("General")); | ||
63 | KConfigGroup grp(config, QLatin1String("General")); | | |||
64 | 62 | | |||
65 | if (grp.isValid()) { | 63 | if (grp.isValid()) { | ||
66 | grp.writeEntry(QLatin1String("ManageVirtualConnections"), manage); | 64 | grp.writeEntry(QLatin1String("ManageVirtualConnections"), manage); | ||
67 | } | 65 | } | ||
68 | } | 66 | } | ||
69 | 67 | | |||
70 | bool Configuration::showPasswordDialog() | 68 | bool Configuration::showPasswordDialog() | ||
71 | { | 69 | { | ||
72 | KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm")); | 70 | KConfigGroup grp(*config, QLatin1String("General")); | ||
73 | KConfigGroup grp(config, QLatin1String("General")); | | |||
74 | 71 | | |||
75 | if (grp.isValid()) { | 72 | if (grp.isValid()) { | ||
76 | return grp.readEntry(QLatin1String("ShowPasswordDialog"), true); | 73 | return grp.readEntry(QLatin1String("ShowPasswordDialog"), true); | ||
77 | } | 74 | } | ||
78 | 75 | | |||
79 | return true; | 76 | return true; | ||
80 | } | 77 | } | ||
81 | 78 | |