Changeset View
Changeset View
Standalone View
Standalone View
kcms/componentchooser/componentchooserterminal.cpp
1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
---|---|---|---|---|---|
2 | componentchooser.cpp - description | 2 | componentchooser.cpp - description | ||
3 | ------------------- | 3 | ------------------- | ||
4 | copyright : (C) 2002 by Joseph Wenninger | 4 | copyright : (C) 2002 by Joseph Wenninger | ||
5 | email : jowenn@kde.org | 5 | email : jowenn@kde.org | ||
6 | ***************************************************************************/ | 6 | ***************************************************************************/ | ||
7 | 7 | | |||
8 | /*************************************************************************** | 8 | /*************************************************************************** | ||
9 | * * | 9 | * * | ||
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * | ||
11 | * it under the terms of the GNU General Public License verstion 2 as * | 11 | * it under the terms of the GNU General Public License verstion 2 as * | ||
12 | * published by the Free Software Foundation * | 12 | * published by the Free Software Foundation * | ||
13 | * * | 13 | * * | ||
14 | ***************************************************************************/ | 14 | ***************************************************************************/ | ||
15 | 15 | | |||
16 | #include "componentchooserterminal.h" | 16 | #include "componentchooserterminal.h" | ||
17 | #include "terminal_settings.h" | ||||
17 | 18 | | |||
18 | #include <ktoolinvocation.h> | 19 | #include <ktoolinvocation.h> | ||
19 | #include <QDBusConnection> | 20 | #include <QDBusConnection> | ||
20 | #include <QDBusMessage> | 21 | #include <QDBusMessage> | ||
21 | #include <QCheckBox> | 22 | #include <QCheckBox> | ||
22 | 23 | | |||
23 | #include <kmessagebox.h> | 24 | #include <kmessagebox.h> | ||
24 | #include <kopenwithdialog.h> | 25 | #include <kopenwithdialog.h> | ||
Show All 29 Lines | |||||
54 | 55 | | |||
55 | void CfgTerminalEmulator::defaults() | 56 | void CfgTerminalEmulator::defaults() | ||
56 | { | 57 | { | ||
57 | load(nullptr); | 58 | load(nullptr); | ||
58 | } | 59 | } | ||
59 | 60 | | |||
60 | bool CfgTerminalEmulator::isDefaults() const | 61 | bool CfgTerminalEmulator::isDefaults() const | ||
61 | { | 62 | { | ||
62 | return false; | 63 | return terminalCB->isChecked(); | ||
63 | } | 64 | } | ||
64 | 65 | | |||
65 | 66 | | |||
66 | void CfgTerminalEmulator::load(KConfig *) { | 67 | void CfgTerminalEmulator::load(KConfig *) { | ||
67 | KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General"); | 68 | TerminalSettings settings; | ||
68 | QString terminal = config.readPathEntry("TerminalApplication",QStringLiteral("konsole")); | 69 | QString terminal = settings.terminalApplication(); | ||
69 | if (terminal == QLatin1String("konsole")) | 70 | if (terminal == QLatin1String("konsole")) | ||
70 | { | 71 | { | ||
71 | terminalLE->setText(QStringLiteral("xterm")); | 72 | terminalLE->setText(QStringLiteral("xterm")); | ||
72 | terminalCB->setChecked(true); | 73 | terminalCB->setChecked(true); | ||
73 | } | 74 | } | ||
74 | else | 75 | else | ||
75 | { | 76 | { | ||
76 | terminalLE->setText(terminal); | 77 | terminalLE->setText(terminal); | ||
77 | otherCB->setChecked(true); | 78 | otherCB->setChecked(true); | ||
78 | } | 79 | } | ||
79 | 80 | | |||
80 | emit changed(false); | 81 | emit changed(false); | ||
81 | } | 82 | } | ||
82 | 83 | | |||
83 | void CfgTerminalEmulator::save(KConfig *) | 84 | void CfgTerminalEmulator::save(KConfig *) | ||
84 | { | 85 | { | ||
85 | KSharedConfig::Ptr profile = KSharedConfig::openConfig(QStringLiteral("kdeglobals")); | 86 | TerminalSettings settings; | ||
86 | KConfigGroup config(profile, QStringLiteral("General")); | 87 | settings.setTerminalApplication(terminalCB->isChecked() ? settings.defaultTerminalApplicationValue() : terminalLE->text()); | ||
87 | const QString terminal = terminalCB->isChecked() ? QStringLiteral("konsole") : terminalLE->text(); | 88 | settings.save(); | ||
88 | config.writePathEntry("TerminalApplication", terminal); // KConfig::Normal|KConfig::Global); | | |||
89 | | ||||
90 | config.sync(); | | |||
91 | Kdelibs4SharedConfig::syncConfigGroup(QLatin1String("General"), "kdeglobals"); | | |||
92 | 89 | | |||
93 | QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.klauncher5"), | 90 | QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.klauncher5"), | ||
94 | QStringLiteral("/KLauncher"), | 91 | QStringLiteral("/KLauncher"), | ||
95 | QStringLiteral("org.kde.KLauncher"), | 92 | QStringLiteral("org.kde.KLauncher"), | ||
96 | QStringLiteral("reparseConfiguration")); | 93 | QStringLiteral("reparseConfiguration")); | ||
97 | QDBusConnection::sessionBus().send(message); | 94 | QDBusConnection::sessionBus().send(message); | ||
98 | emit changed(false); | 95 | emit changed(false); | ||
99 | } | 96 | } | ||
Show All 16 Lines |