1 /***************************************************************************
2 componentchooser.cpp - description
4 copyright : (C) 2002 by Joseph Wenninger
6 ***************************************************************************/
8 /***************************************************************************
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 *
12 * published by the Free Software Foundation *
14 ***************************************************************************/
16 #include "componentchooserterminal.h"
17 #include "componentchooserterminal.moc"
19 #include <ktoolinvocation.h>
20 #include <klauncher_iface.h>
21 #include <QtDBus/QtDBus>
25 #include <QRadioButton>
28 #include <kapplication.h>
30 #include <kmessagebox.h>
31 #include <kopenwithdialog.h>
33 #include <kstandarddirs.h>
34 #include <kmimetypetrader.h>
35 #include <kurlrequester.h>
36 #include <kconfiggroup.h>
39 CfgTerminalEmulator::CfgTerminalEmulator(QWidget
*parent
)
40 : QWidget(parent
), Ui::TerminalEmulatorConfig_UI(), CfgPlugin()
43 connect(terminalLE
,SIGNAL(textChanged(QString
)), this, SLOT(configChanged()));
44 connect(terminalCB
,SIGNAL(toggled(bool)),this,SLOT(configChanged()));
45 connect(otherCB
,SIGNAL(toggled(bool)),this,SLOT(configChanged()));
46 connect(btnSelectTerminal
,SIGNAL(clicked()),this,SLOT(selectTerminalApp()));
50 CfgTerminalEmulator::~CfgTerminalEmulator() {
53 void CfgTerminalEmulator::configChanged()
58 void CfgTerminalEmulator::defaults()
64 void CfgTerminalEmulator::load(KConfig
*) {
65 KConfigGroup
config(KSharedConfig::openConfig("kdeglobals"), "General");
66 QString terminal
= config
.readPathEntry("TerminalApplication","konsole");
67 if (terminal
== "konsole")
69 terminalLE
->setText("xterm");
70 terminalCB
->setChecked(true);
74 terminalLE
->setText(terminal
);
75 otherCB
->setChecked(true);
81 void CfgTerminalEmulator::save(KConfig
*)
83 KConfigGroup
config(KSharedConfig::openConfig("kdeglobals"), "General");
84 const QString terminal
= terminalCB
->isChecked() ? "konsole" : terminalLE
->text();
85 config
.writePathEntry("TerminalApplication", terminal
, KConfig::Normal
|KConfig::Global
);
88 KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged
);
89 KToolInvocation::klauncher()->reparseConfiguration();
94 void CfgTerminalEmulator::selectTerminalApp()
97 KOpenWithDialog
dlg(urlList
, i18n("Select preferred terminal application:"), QString(), this);
98 // hide "Run in &terminal" here, we don't need it for a Terminal Application
99 dlg
.hideRunInTerminal();
100 if (dlg
.exec() != QDialog::Accepted
) return;
101 QString client
= dlg
.text();
103 if (!client
.isEmpty())
105 terminalLE
->setText(client
);
108 // vim: sw=4 ts=4 noet