Changeset View
Changeset View
Standalone View
Standalone View
src/jobs/accountservicetogglejob.cpp
- This file was moved from src/jobs/accountservicetoggle.cpp.
Show All 10 Lines | |||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
12 | * GNU General Public License for more details. * | 12 | * GNU General Public License for more details. * | ||
13 | * * | 13 | * * | ||
14 | * You should have received a copy of the GNU General Public License * | 14 | * You should have received a copy of the GNU General Public License * | ||
15 | * along with this program; if not, write to the Free Software * | 15 | * along with this program; if not, write to the Free Software * | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * | ||
17 | *************************************************************************************/ | 17 | *************************************************************************************/ | ||
18 | 18 | | |||
19 | #include "accountservicetoggle.h" | 19 | #include "accountservicetogglejob.h" | ||
20 | 20 | | |||
21 | #include <QDebug> | 21 | #include <QDebug> | ||
22 | #include "core.h" | 22 | #include "core.h" | ||
23 | #include <Accounts/Manager> | 23 | #include <Accounts/Manager> | ||
24 | 24 | | |||
25 | class AccountServiceToggle::Private { | 25 | class AccountServiceToggleJob::Private { | ||
26 | public: | 26 | public: | ||
27 | Private() {} | 27 | Private() {} | ||
28 | QString accountId; | 28 | QString accountId; | ||
29 | QString serviceId; | 29 | QString serviceId; | ||
30 | bool serviceEnabled{false}; | 30 | bool serviceEnabled{false}; | ||
31 | }; | 31 | }; | ||
32 | 32 | | |||
33 | AccountServiceToggle::AccountServiceToggle(QObject* parent) | 33 | AccountServiceToggleJob::AccountServiceToggleJob(QObject* parent) | ||
34 | : KJob(parent) | 34 | : KJob(parent) | ||
35 | , d(new Private) | 35 | , d(new Private) | ||
36 | { } | 36 | { } | ||
37 | 37 | | |||
38 | AccountServiceToggle::~AccountServiceToggle() | 38 | AccountServiceToggleJob::~AccountServiceToggleJob() | ||
39 | { | 39 | { | ||
40 | delete d; | 40 | delete d; | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | QString AccountServiceToggle::accountId() const | 43 | QString AccountServiceToggleJob::accountId() const | ||
44 | { | 44 | { | ||
45 | return d->accountId; | 45 | return d->accountId; | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | void AccountServiceToggle::setAccountId(const QString& accountId) | 48 | void AccountServiceToggleJob::setAccountId(const QString& accountId) | ||
49 | { | 49 | { | ||
50 | d->accountId = accountId; | 50 | d->accountId = accountId; | ||
51 | Q_EMIT accountIdChanged(); | 51 | Q_EMIT accountIdChanged(); | ||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | QString AccountServiceToggle::serviceId() const | 54 | QString AccountServiceToggleJob::serviceId() const | ||
55 | { | 55 | { | ||
56 | return d->serviceId; | 56 | return d->serviceId; | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | void AccountServiceToggle::setServiceId(const QString& serviceId) | 59 | void AccountServiceToggleJob::setServiceId(const QString& serviceId) | ||
60 | { | 60 | { | ||
61 | d->serviceId = serviceId; | 61 | d->serviceId = serviceId; | ||
62 | Q_EMIT serviceIdChanged(); | 62 | Q_EMIT serviceIdChanged(); | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | bool AccountServiceToggle::serviceEnabled() const | 65 | bool AccountServiceToggleJob::serviceEnabled() const | ||
66 | { | 66 | { | ||
67 | return d->serviceEnabled; | 67 | return d->serviceEnabled; | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | void AccountServiceToggle::setServiceEnabled(bool serviceEnabled) | 70 | void AccountServiceToggleJob::setServiceEnabled(bool serviceEnabled) | ||
71 | { | 71 | { | ||
72 | d->serviceEnabled = serviceEnabled; | 72 | d->serviceEnabled = serviceEnabled; | ||
73 | Q_EMIT serviceEnabledChanged(); | 73 | Q_EMIT serviceEnabledChanged(); | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | void AccountServiceToggle::start() | 76 | void AccountServiceToggleJob::start() | ||
77 | { | 77 | { | ||
78 | Accounts::Manager* accountsManager = KAccounts::accountsManager(); | 78 | Accounts::Manager* accountsManager = KAccounts::accountsManager(); | ||
79 | if (accountsManager) { | 79 | if (accountsManager) { | ||
80 | Accounts::Account *account = accountsManager->account(d->accountId.toInt()); | 80 | Accounts::Account *account = accountsManager->account(d->accountId.toInt()); | ||
81 | if (account) { | 81 | if (account) { | ||
82 | Accounts::Service service = accountsManager->service(d->serviceId); | 82 | Accounts::Service service = accountsManager->service(d->serviceId); | ||
83 | if (!service.isValid()) { | 83 | if (!service.isValid()) { | ||
84 | // qWarning() << "Looks like we might have been given a name instead of an ID for the service, which will be expected when using the Ubuntu AccountServiceModel, which only gives you the name"; | 84 | // qWarning() << "Looks like we might have been given a name instead of an ID for the service, which will be expected when using the Ubuntu AccountServiceModel, which only gives you the name"; | ||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |