Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- initial version

svn path=/trunk/bluetooth/; revision=18331
  • Loading branch information...
commit a9cd25ef135b52160faad1f085395d8b0e99b85b 0 parents
@lslezak lslezak authored
20 .cvsignore
@@ -0,0 +1,20 @@
+Makefile
+Makefile.am
+Makefile.am.common
+Makefile.in
+aclocal.m4
+config.cache
+config.guess
+config.h.in
+config.log
+config.status
+config.sub
+configure
+configure.in
+depcomp
+install-sh
+missing
+mkinstalldirs
+stamp-h
+bluetooth.pot
+autom4te.cache
1  MAINTAINER
@@ -0,0 +1 @@
+Ladislav Slezak <lslezak@suse.cz>
18 Makefile.cvs
@@ -0,0 +1,18 @@
+#
+# Makefile.cvs
+#
+configure: all
+ ./configure
+
+all:
+ y2tool y2autoconf
+ y2tool y2automake
+ autoreconf --force --install
+
+install: configure
+ make
+ make install
+
+reconf: all
+ ./config.status --recheck
+ ./config.status
1  RPMNAME
@@ -0,0 +1 @@
+yast2-bluetooth
1  VERSION
@@ -0,0 +1 @@
+2.10.0
2  agents/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
8 agents/Makefile.am
@@ -0,0 +1,8 @@
+# Makefile.am for bluetooth/agents
+
+agent_SCRIPTS =
+
+scrconf_DATA = bt_hcid.scr \
+ cfg_bluetooth.scr
+
+EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA)
39 agents/bt_hcid.scr
@@ -0,0 +1,39 @@
+/**
+ * File: bt_hcid.scr
+ * Summary: Agent for rading and writing of /etc/bluetooth/hcid.conf file
+ * Author: Ladislav Slezak <lslezak@suse.cz>
+ * Access: read, write
+ *
+ * $Id$
+ *
+ * This file is based on dns_named.conf
+ */
+.bluetooth.hcid
+
+// TODO: INI agent isn't optimal, in this file multiple occurences of one key
+// in one section may be possible, section on one line is handled as a
+// single value, and many many other problems are to be expected....
+// should be replaced in future by some better agent
+
+`ag_ini(
+ `IniAgent( "/etc/bluetooth/hcid.conf",
+ $[
+ "options" : [ "global_values", "repeat_names" ],
+ "comments" : [ "^[ \t]*#.*$", "^[ \t]*$" ],
+ "params" : [
+ $[ "match" : [ "([^ \t]+)[ \t]([^ \t]+(.*[^ \t]+)+)[ \t]*;$", "%s %s;" ]],
+ // (...)* made the agent crash when it did not match,
+ // changed it to ((...)*), #39597
+ // Still don't know why this is here at all
+ $[ "match" : [ "([^ \t]+)((.*[^ \t]+)*)[ \t]*\\{.*\\}[ \t]*;", "%s %s;" ]],
+ ],
+ "sections" : [
+ $[
+ "begin" : [ "[ \t]*([^ \t]+(.*[^ \t]+)*)[ \t]*\\{$", "%s {" ],
+ "end" : [ "^[ \t]*\\}", "}" ],
+ ],
+ ],
+ "subindent" : "\t"
+ ]
+))
+
19 agents/cfg_bluetooth.scr
@@ -0,0 +1,19 @@
+/**
+ * File:
+ * cfg_bluetooth.scr
+ * Summary:
+ * SCR Agent for reading/writing /etc/sysconfig/bluetooth
+ * using the ini-agent
+ * Access:
+ * read/write
+ * Authors:
+ * Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ *
+ */
+.sysconfig.bluetooth
+
+`ag_ini(
+ `SysConfigFile("/etc/sysconfig/bluetooth")
+)
12 configure.in.in
@@ -0,0 +1,12 @@
+## YCP module configure.in.in
+
+## Initialize
+@YAST2-INIT-COMMON@
+@YAST2-INIT-YCP@
+
+## some common checks
+@YAST2-CHECKS-COMMON@
+@YAST2-CHECKS-YCP@
+
+## and generate the output...
+@YAST2-OUTPUT@
2  doc/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
10 doc/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am for bluetooth/doc
+
+SUBDIRS = autodocs
+
+htmldir = $(docdir)
+
+doc_DATA =
+html_DATA =
+
+EXTRA_DIST = $(doc_DATA) $(html_DATA)
4 src/.cvsignore
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+*.ybc
+.dep
263 src/Bluetooth.ycp
@@ -0,0 +1,263 @@
+/**
+ * File: modules/Bluetooth.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Bluetooth settings, input and output functions
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ *
+ * Representation of the configuration of bluetooth devices.
+ * Input and output routines.
+ */
+
+{
+
+module "Bluetooth";
+textdomain "bluetooth";
+
+import "Progress";
+import "Report";
+import "Summary";
+
+/**
+ * Prototypes
+ */
+global boolean Modified();
+
+/**
+ * Data was modified?
+ */
+global boolean modified = false;
+
+/**
+ */
+global boolean proposal_valid = false;
+
+/**
+ * Write only, used during autoinstallation.
+ * Don't run services and SuSEconfig, it's all done at one place.
+ */
+global boolean write_only = false;
+
+/**
+ * Abort function
+ * return boolean return true if abort
+ */
+global boolean() AbortFunction = Modified;
+
+/**
+ * Abort function
+ * @return boolean return true if abort
+ */
+global define boolean Abort() ``{
+ if(AbortFunction != nil)
+ {
+ return AbortFunction () == true;
+ }
+ return false;
+}
+
+/**
+ * Data was modified?
+ * @return true if modified
+ */
+global boolean Modified() {
+ y2debug("modified=%1",modified);
+ return modified;
+}
+
+
+global boolean enabled = false;
+
+global boolean authentification = false;
+
+global boolean encryption = false;
+
+global list<map<string,any> > daemons = [];
+
+global string pin = "";
+
+/**
+ * Read all bluetooth settings
+ * @return true on success
+ */
+global boolean Read() {
+
+ /* Bluetooth read dialog caption */
+ string caption = _("Initializing bluetooth Configuration");
+
+ // TODO FIXME Set the right number of stages
+ integer steps = 4;
+
+ integer sl = 0;
+ sleep(sl);
+
+ // TODO FIXME Names of real stages
+ // We do not set help text here, because it was set outside
+ Progress::New( caption, " ", steps, [
+ /* Progress stage 1/3 */
+ _("Read the database"),
+ /* Progress stage 2/3 */
+ _("Read the previous settings"),
+ /* Progress stage 3/3 */
+ _("Detect the devices")
+ ], [
+ /* Progress step 1/3 */
+ _("Reading the database..."),
+ /* Progress step 2/3 */
+ _("Reading the previous settings..."),
+ /* Progress step 3/3 */
+ _("Detecting the devices..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+ // read database
+ if(Abort()) return false;
+ Progress::NextStage();
+ /* Error message */
+ if(false) Report::Error(_("Cannot read the database1."));
+ sleep(sl);
+
+ // read another database
+ if(Abort()) return false;
+ Progress::NextStep();
+ /* Error message */
+ if(false) Report::Error(_("Cannot read the database2."));
+ sleep(sl);
+
+ // read current settings
+ if(Abort()) return false;
+ Progress::NextStage();
+ /* Error message */
+ if(false) Report::Error(_("Cannot read current settings."));
+ sleep(sl);
+
+ // detect devices
+ if(Abort()) return false;
+ Progress::NextStage();
+ /* Error message */
+ if(false) Report::Warning(_("Cannot detect devices."));
+ sleep(sl);
+
+ if(Abort()) return false;
+ /* Progress finished */
+ Progress::NextStage();
+ sleep(sl);
+
+ if(Abort()) return false;
+ modified = false;
+ return true;
+}
+
+/**
+ * Write all bluetooth settings
+ * @return true on success
+ */
+global boolean Write() {
+
+ /* Bluetooth read dialog caption */
+ string caption = _("Saving bluetooth Configuration");
+
+ // TODO FIXME And set the right number of stages
+ integer steps = 2;
+
+ integer sl = 0;
+ sleep(sl);
+
+ // TODO FIXME Names of real stages
+ // We do not set help text here, because it was set outside
+ Progress::New(caption, " ", steps, [
+ /* Progress stage 1/2 */
+ _("Write the settings"),
+ /* Progress stage 2/2 */
+ _("Run SuSEconfig")
+ ], [
+ /* Progress step 1/2 */
+ _("Writing the settings..."),
+ /* Progress step 2/2 */
+ _("Running SuSEconfig..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
+ );
+
+ // write settings
+ if(Abort()) return false;
+ Progress::NextStage();
+ /* Error message */
+ if(false) Report::Error (_("Cannot write settings."));
+ sleep(sl);
+
+ // run SuSEconfig
+ if(Abort()) return false;
+ Progress::NextStage ();
+ /* Error message */
+ if(false) Report::Error (_("SuSEconfig script failed."));
+ sleep(sl);
+
+ if(Abort()) return false;
+ /* Progress finished */
+ Progress::NextStage();
+ sleep(sl);
+
+ if(Abort()) return false;
+ return true;
+}
+
+/**
+ * Get all bluetooth settings from the first parameter
+ * (For use by autoinstallation.)
+ * @param settings The YCP structure to be imported.
+ * @return boolean True on success
+ */
+global boolean Import (map settings) {
+ // TODO FIXME: your code here (fill the above mentioned variables)...
+ return true;
+}
+
+/**
+ * Dump the bluetooth settings to a single map
+ * (For use by autoinstallation.)
+ * @return map Dumped settings (later acceptable by Import ())
+ */
+global map Export () {
+ // TODO FIXME: your code here (return the above mentioned variables)...
+ return $[];
+}
+
+/**
+ * Create a textual summary and a list of unconfigured cards
+ * @return summary of the current configuration
+ */
+global list Summary() {
+ // TODO FIXME: your code here...
+ /* Configuration summary text for autoyast */
+ return [ _("Configuration summary ..."), [] ];
+}
+
+/**
+ * Create an overview table with all configured cards
+ * @return table items
+ */
+global list Overview() {
+ // TODO FIXME: your code here...
+ return [];
+}
+
+/**
+ * Return packages needed to be installed and removed during
+ * Autoinstallation to insure module has all needed software
+ * installed.
+ * @return map with 2 lists.
+ */
+global map AutoPackages() {
+ // TODO FIXME: your code here...
+ return $[ "install":[], "remove":[] ];
+}
+
+/* EOF */
+}
24 src/Makefile.am
@@ -0,0 +1,24 @@
+# Makefile.am for bluetooth/src
+
+yncludedir = @yncludedir@/bluetooth
+
+client_DATA = \
+ bluetooth.ycp \
+ bluetooth_auto.ycp \
+ bluetooth_proposal.ycp
+
+ynclude_DATA = \
+ helps.ycp \
+ wizards.ycp \
+ dialogs.ycp \
+ complex.ycp
+
+desktop_DATA = \
+ bluetooth.desktop
+
+module_DATA = \
+ Bluetooth.ycp
+
+EXTRA_DIST = $(client_DATA) $(ynclude_DATA) $(module_DATA) $(desktop_DATA)
+
+include $(top_srcdir)/Makefile.am.common
23 src/bluetooth.desktop
@@ -0,0 +1,23 @@
+[Desktop Entry]
+Type=Application
+Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc;
+
+X-KDE-ModuleType=Library
+X-KDE-RootOnly=true
+X-KDE-HasReadOnlyMode=true
+X-KDE-Library=yast2
+X-SuSE-YaST-Call=bluetooth
+
+X-SuSE-YaST-Group=Hardware
+X-SuSE-YaST-Argument=
+X-SuSE-YaST-RootOnly=true
+X-SuSE-YaST-AutoInst=
+X-SuSE-YaST-Geometry=
+X-SuSE-YaST-SortKey=
+X-SuSE-YaST-AutoInstResource=bluetooth
+
+Icon=bluetooth
+Exec=/sbin/yast2 bluetooth
+
+Name=Bluetooth
+GenericName=Bluetooth Configuration
74 src/bluetooth.ycp
@@ -0,0 +1,74 @@
+/**
+ * File: clients/bluetooth.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Main file
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ *
+ * Main file for bluetooth configuration. Uses all other files.
+ */
+
+{
+
+/***
+ * <h3>Configuration of bluetooth</h3>
+ */
+
+textdomain "bluetooth";
+
+/* The main () */
+y2milestone ("----------------------------------------");
+y2milestone ("Bluetooth module started");
+
+import "Progress";
+import "Report";
+import "Summary";
+import "Bluetooth";
+
+import "CommandLine";
+include "bluetooth/wizards.ycp";
+
+map cmdline_description = $[
+ "id" : "bluetooth",
+ /* Command line help text for the Xbluetooth module */
+ "help" : _("Configuration of bluetooth"),
+ "guihandler" : BluetoothSequence,
+ "initialize" : Bluetooth::Read,
+ "finish" : Bluetooth::Write,
+ "actions" : $[
+ // FIXME TODO: fill the functionality description here
+ ],
+ "options" : $[
+ // FIXME TODO: fill the option descriptions here
+ ],
+ "mapping" : $[
+ // FIXME TODO: fill the mappings of actions and options here
+ ]
+];
+
+/* is this proposal or not? */
+boolean propose = false;
+list args = WFM::Args();
+if(size(args) > 0) {
+ if(is(WFM::Args(0), path) && WFM::Args(0) == .propose) {
+ y2milestone("Using PROPOSE mode");
+ propose = true;
+ }
+}
+
+/* main ui function */
+any ret = nil;
+
+if(propose) ret = BluetoothAutoSequence();
+else ret = CommandLine::Run(cmdline_description);
+y2debug("ret=%1", ret);
+
+/* Finish */
+y2milestone("Bluetooth module finished");
+y2milestone("----------------------------------------");
+
+return ret;
+
+/* EOF */
+}
98 src/bluetooth_auto.ycp
@@ -0,0 +1,98 @@
+/**
+ * File: clients/bluetooth_auto.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Client for autoinstallation
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ *
+ * This is a client for autoinstallation. It takes its arguments,
+ * goes through the configuration and return the setting.
+ * Does not do any changes to the configuration.
+ */
+
+/**
+ * @param function to execute
+ * @param map/list of bluetooth settings
+ * @return map edited settings, Summary or boolean on success depending on called function
+ * @example map mm = $[ "FAIL_DELAY" : "77" ];
+ * @example map ret = WFM::CallFunction ("bluetooth_auto", [ "Summary", mm ]);
+ */
+
+{
+
+textdomain "bluetooth";
+
+y2milestone("----------------------------------------");
+y2milestone("Bluetooth auto started");
+
+import "Bluetooth";
+include "bluetooth/wizards.ycp";
+
+any ret = nil;
+string func = "";
+map param = $[];
+
+/* Check arguments */
+if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
+ func = (string)WFM::Args(0);
+ if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
+ param = (map) WFM::Args(1);
+}
+y2debug("func=%1", func);
+y2debug("param=%1", param);
+
+/* Create a summary*/
+if(func == "Summary") {
+ ret = select(Bluetooth::Summary(), 0, "");
+}
+/* Reset configuration */
+else if (func == "Reset") {
+ Bluetooth::Import($[]);
+ ret = $[];
+}
+/* Change configuration (run AutoSequence) */
+else if (func == "Change") {
+ ret = BluetoothAutoSequence();
+}
+/* Import configuration */
+else if (func == "Import") {
+ ret = Bluetooth::Import(param);
+}
+/* Return actual state */
+else if (func == "Export") {
+ ret = Bluetooth::Export();
+}
+/* Return needed packages */
+else if (func == "Packages") {
+ ret = Bluetooth::AutoPackages();
+}
+/* Read current state */
+else if (func == "Read") {
+ import "Progress";
+ Progress::off();
+ ret = Bluetooth::Read();
+ Progress::on();
+}
+/* Write givven settings */
+else if (func == "Write") {
+ import "Progress";
+ Progress::off();
+ Bluetooth::write_only = true;
+ ret = Bluetooth::Write();
+ Progress::on();
+}
+/* Unknown function */
+else {
+ y2error("Unknown function: %1", func);
+ ret = false;
+}
+
+y2debug("ret=%1", ret);
+y2milestone("Bluetooth auto finished");
+y2milestone("----------------------------------------");
+
+return ret;
+
+/* EOF */
+}
87 src/bluetooth_proposal.ycp
@@ -0,0 +1,87 @@
+/**
+ * File: clients/bluetooth_proposal.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Proposal function dispatcher.
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ *
+ * Proposal function dispatcher for bluetooth configuration.
+ * See source/installation/proposal/proposal-API.txt
+ */
+
+{
+
+textdomain "bluetooth";
+
+import "Bluetooth";
+import "Progress";
+
+/* The main () */
+y2milestone("----------------------------------------");
+y2milestone("Bluetooth proposal started");
+
+string func = (string) WFM::Args(0);
+map param = (map) WFM::Args(1);
+map ret = $[];
+
+/* create a textual proposal */
+if(func == "MakeProposal") {
+ string proposal = "";
+ string warning = nil;
+ symbol warning_level = nil;
+ boolean force_reset = param["force_reset"]:false;
+
+ if(force_reset || !Bluetooth::proposal_valid) {
+ Bluetooth::proposal_valid = true;
+ Progress::off();
+ Bluetooth::Read();
+ }
+ list sum = Bluetooth::Summary();
+ proposal = sum[0]:"";
+ Progress::on();
+
+ ret = $[
+ "preformatted_proposal" : proposal,
+ "warning_level" : warning_level,
+ "warning" : warning,
+ ];
+}
+/* run the module */
+else if(func == "AskUser") {
+ map stored = Bluetooth::Export();
+ symbol seq = (symbol) WFM::CallFunction("bluetooth", [.propose]);
+ if(seq != `next) Bluetooth::Import(stored);
+ y2debug("stored=%1",stored);
+ y2debug("seq=%1",seq);
+ ret = $[
+ "workflow_sequence" : seq
+ ];
+}
+/* create titles */
+else if(func == "Description") {
+ ret = $[
+ /* Rich text title for Bluetooth in proposals */
+ "rich_text_title" : _("Bluetooth"),
+ /* Menu title for Bluetooth in proposals */
+ "menu_title" : _("&Bluetooth"),
+ "id" : "bluetooth",
+ ];
+}
+/* write the proposal */
+else if(func == "Write") {
+ Bluetooth::Write();
+}
+/* unknown function */
+else {
+ y2error("unknown function: %1", func);
+}
+
+/* Finish */
+y2debug("ret=%1",ret);
+y2milestone("Bluetooth proposal finished");
+y2milestone("----------------------------------------");
+return ret;
+
+/* EOF */
+}
61 src/complex.ycp
@@ -0,0 +1,61 @@
+/**
+ * File: include/bluetooth/complex.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Dialogs definitions
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "bluetooth";
+
+import "Label";
+import "Popup";
+import "Wizard";
+import "Wizard_hw";
+import "Bluetooth";
+
+include "bluetooth/helps.ycp";
+
+/**
+ * Return a modification status
+ * @return true if data was modified
+ */
+boolean Modified() {
+ return Bluetooth::Modified();
+}
+
+boolean ReallyAbort() {
+ return !Bluetooth::Modified() || Popup::ReallyAbort(true);
+}
+
+boolean PollAbort() {
+ return UI::PollInput() == `abort;
+}
+
+/**
+ * Read settings dialog
+ * @return `abort if aborted and `next otherwise
+ */
+symbol ReadDialog() {
+ Wizard::RestoreHelp(HELPS["read"]:"");
+ // Bluetooth::AbortFunction = PollAbort;
+ boolean ret = Bluetooth::Read();
+ return ret ? `next : `abort;
+}
+
+/**
+ * Write settings dialog
+ * @return `abort if aborted and `next otherwise
+ */
+symbol WriteDialog() {
+ Wizard::RestoreHelp(HELPS["write"]:"");
+ // Bluetooth::AbortFunction = PollAbort;
+ boolean ret = Bluetooth::Write();
+ return ret ? `next : `abort;
+}
+
+/* EOF */
+}
306 src/dialogs.ycp
@@ -0,0 +1,306 @@
+/**
+ * File: include/bluetooth/dialogs.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Dialogs definitions
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "bluetooth";
+
+import "Label";
+import "Wizard";
+import "Bluetooth";
+
+include "bluetooth/helps.ycp";
+
+/**
+ * Show global settings dialog - enable/disable bluetooth support, some global general options
+ * @return symbol dialog result
+ */
+symbol GlobalOptionsDialog () {
+
+ /* Bluetooth global settings dialog caption */
+ string caption = _("Bluetooth Configuration");
+
+ /* Bluetooth global settings dialog content */
+ term contents = `RadioButtonGroup(`id(`rb),
+ `HBox(
+ `HSpacing(3),
+ `VBox(
+ `Left(`RadioButton(`id(`BTenable), _("&Disable Bluetooth services"))),
+ `VSpacing(1),
+ `Left(`RadioButton(`id(`BTdisable), _("&Enable Bluetooth services"))),
+ `VSpacing(0.5),
+
+ `HBox(
+ `HSpacing(4),
+ `Frame(_("Basic configuration"),
+ `VBox(
+ `Left(`Password(`id(`pin), _("I&dentification number (PIN)")))
+ )
+ ),
+ `HSpacing(1)
+ ),
+
+ `VSpacing(1),
+ `PushButton(`id(`services), _("Advanced &Daemon Configuration...")),
+ `VSpacing(0.5),
+ `PushButton(`id(`security), _("&Security Options..."))
+ )
+ )
+ );
+
+ Wizard::SetContentsButtons(caption, contents, HELPS["global"]:"",
+ Label::BackButton(), Label::FinishButton());
+
+ Wizard::HideBackButton();
+ Wizard::SetAbortButton(`abort, Label::CancelButton());
+
+ // allow only numbers in PIN widget
+ UI::ChangeWidget(`id(`pin), `ValidChars, "0132456789");
+
+ symbol ret = nil;
+
+ while (true) {
+
+ ret = (symbol) UI::UserInput();
+
+ /* abort? */
+ if (ret == `abort || ret == `cancel) {
+ if (ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == `next || ret == `back || ret == `security || ret == `services) {
+ break;
+ }
+ else {
+ y2error("unexpected retcode: %1", ret);
+ continue;
+ }
+ }
+
+ Wizard::RestoreBackButton();
+ Wizard::RestoreAbortButton();
+
+ return ret;
+}
+
+/**
+ * Dialog for expert configuration of the selected bluetooth daemon.
+ * @return map dialog result
+ */
+map<string,any> DaemonExpertPopup(string daemon, string arguments) {
+
+ /* Dialog caption - daemon configuration */
+ string caption = sformat(_("%1 Daemon Configuration"), daemon);
+
+ term pand_option = `VBox(
+ `VSpacing(1),
+ `RadioButtonGroup(`id(`rbg),
+ `VBox(
+ `Left(`RadioButton(`id(`listen), _("Set network dameon to &listen mode"))),
+ `VSpacing(0.2),
+ `Left(`RadioButton(`id(`search), _("Set network daemon to &search mode"))),
+ `VSpacing(0.2),
+ `Left(`RadioButton(`id(`other), _("&Other settings")))
+ )
+ )
+ );
+
+ /* Daemon configuration dialog content */
+ term contents = `VBox(
+ `Heading(caption),
+ (daemon == "PAND") ? pand_option : `Empty(),
+ `HBox(
+ (daemon == "PAND") ? `HSpacing(3) : `HSpacing(1),
+ `TextEntry(`id(`args), _("&Daemon Arguments"), arguments),
+ `HSpacing(1)
+ ),
+ `VSpacing(1),
+ `HBox(
+ `HStretch(),
+ `HWeight(1, `PushButton(`id(`ok), `opt(`key_F10, `default), Label::OKButton())),
+ `HSpacing(2),
+ `HWeight(1, `PushButton(`id(`cancel), `opt(`key_F9), Label::CancelButton())),
+ `HStretch()
+ )
+ );
+
+ UI::OpenDialog(contents);
+
+ UI::SetFocus(`id(`ok));
+
+ symbol ret = nil;
+
+ while (true) {
+ ret = (symbol) UI::UserInput();
+
+ if (ret == `ok || ret == `cancel) {
+ break;
+ }
+ else {
+ y2error("unexpected retcode: %1", ret);
+ continue;
+ }
+ }
+
+ map<string,any> r = $[ "ret" : ret];
+
+ if (ret == `ok)
+ {
+ string text = (string) UI::QueryWidget(`id(`args), `Value);
+ r = add(r, "text", text);
+ }
+
+ UI::CloseDialog();
+
+ return r;
+}
+
+/**
+ * Dialog for configuration bluetooth daemons.
+ * @return symbol dialog result
+ */
+symbol DaemonDialog () {
+
+ /* caption in bluetooth services configuration dialog */
+ string caption = _("Bluetooth Daemon Configuration");
+
+ list<term> table = [`item(`id(`HCID), "HCID", "yes", "HCI Daemon descriptive summary..."),
+ `item(`id(`SDP), "SDP", "yes", "SDP Daemon"),
+ `item(`id(`OPD), "OPD", "yes", "OPD Daemon"),
+ `item(`id(`RFCOMM), "RFCOMM", "yes", "RFCOMM Daemon"),
+ `item(`id(`PAND), "PAND", "yes", "PAND Daemon"),
+ `item(`id(`DUND), "DUND", "yes", "DUND Daemon"),
+ `item(`id(`HID), "HID", "yes", "HID Daemon"),
+ `item(`id(`HID2HCI), "HID2HCI", "yes", "HID2HCI Daemon"),
+ ];
+
+ /* Bluetooth configuration dialog content */
+ term contents = `VBox(
+ `Left(`Label(_("Current Available Daemons:"))),
+ `Table(`id(`daemons), `header(_("Daemon"), _("Enabled"), _("Description")), table),
+ `VSpacing(0.5),
+ `HBox(
+ `PushButton(`id(`enable), _("&Enable")),
+ `PushButton(`id(`disable), _("&Disable")),
+ `HSpacing(2),
+ `PushButton(`id(`expert), _("E&dit...")),
+ `HStretch()
+ ),
+ `VSpacing(1)
+ );
+
+ Wizard::SetContentsButtons(caption, contents, HELPS["daemon"]:"",
+ Label::BackButton(), Label::OKButton());
+
+ symbol ret = nil;
+
+ while (true) {
+ ret = (symbol) UI::UserInput();
+
+ /* abort? */
+ if (ret == `abort || ret == `cancel) {
+ if (ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == `enable || ret == `disable)
+ {
+ // TODO handle buttons
+ }
+ else if (ret == `next || ret == `back) {
+ break;
+ }
+ else if (ret == `expert)
+ {
+ DaemonExpertPopup("PAND", "-a -b -c");
+ }
+ else {
+ y2error("unexpected retcode: %1", ret);
+ continue;
+ }
+ }
+
+ return ret;
+}
+
+
+/**
+ * Dialog for configuration bluetooth daemons.
+ * @return symbol dialog result
+ */
+symbol SecurityDialog () {
+
+ /* caption in bluetooth services configuration dialog */
+ string caption = _("Security options");
+
+
+ /* Bluetooth configuration dialog content */
+ term contents = `HBox(
+ `HSpacing(3),
+ `VBox(
+ `VSpacing(1),
+ `Frame(_("Authentification and Encryption"),
+ `VBox(
+ `VSpacing(0.2),
+ `Left(`CheckBox(`id(`auth), _("&Enable Authentification"))),
+ `VSpacing(0.5),
+ `Left(`CheckBox(`id(`encrypt), _("Enable En&cryption"))),
+ `VSpacing(0.2)
+ )
+ ),
+ `VSpacing(2),
+ `Frame(_("Scan Options"),
+ `VBox(
+ `VSpacing(0.2),
+ `Left(`CheckBox(`id(`inq), _("Enable &Inquiry Scan"))),
+ `VSpacing(0.5),
+ `Left(`CheckBox(`id(`page), _("Enable &Page Scan"))),
+ `VSpacing(0.2)
+ )
+ ),
+ `VSpacing(1)
+ ),
+ `HSpacing(3)
+ );
+
+ Wizard::SetContentsButtons(caption, contents, HELPS["security"]:"",
+ Label::BackButton(), Label::OKButton());
+
+ symbol ret = nil;
+
+ while (true) {
+ ret = (symbol) UI::UserInput();
+
+ /* abort? */
+ if (ret == `abort || ret == `cancel) {
+ if (ReallyAbort()) break;
+ else continue;
+ }
+ else if (ret == `enable || ret == `disable)
+ {
+ // TODO handle buttons
+ }
+ else if (ret == `next || ret == `back) {
+ break;
+ }
+ else if (ret == `expert)
+ {
+ DaemonExpertPopup("HCID", "-a -b -c");
+ }
+ else {
+ y2error("unexpected retcode: %1", ret);
+ continue;
+ }
+ }
+
+ return ret;
+}
+
+
+/* EOF */
+}
117 src/helps.ycp
@@ -0,0 +1,117 @@
+/**
+ * File: include/bluetooth/helps.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Help texts of all the dialogs
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "bluetooth";
+
+/**
+ * All helps are here
+ */
+map HELPS = $[
+
+ /* Read dialog help 1/2 */
+ "read" : _("<p><b><big>Initializing bluetooth Configuration</big></b><br>
+Please wait...<br></p>
+") +
+
+ /* Read dialog help 2/2 */
+ _("<p><b><big>Aborting Initialization:</big></b><br>
+Safely abort the configuration utility by pressing <b>Abort</b> now.</p>
+"),
+
+ /* Write dialog help 1/2 */
+ "write" : _("<p><b><big>Saving bluetooth Configuration</big></b><br>
+Please wait...<br></p>
+") +
+
+ /* Write dialog help 2/2 */
+_("<p><b><big>Aborting Saving:</big></b><br>
+Abort the save procedure by pressing <b>Abort</b>.
+An additional dialog informs whether it is safe to do so.
+</p>
+"),
+
+
+ /* Help text for global settings dialog */
+ "global" : _("<P><B>Configure Bluetooth support</B></P>") +
+
+_("<P>If you enable Bluetooth support, the Bluetooth system will be started
+automatically by the hotplug system after a Bluetooth adapter is found in your
+computer.</P>") +
+
+_("<P>Which services (or <I>Profiles</I> as they are called in Bluetooth) are available
+when the Bluetooth system is started is assigned in <B>Advanced Daemon Configuration<B>.</P>") +
+
+_("<P>Some devices require a PIN for identification. Usually this is a four or
+five digit number. If no PIN is required choose '00000'.</P>"),
+
+
+ /* Help text for service configuration dialog */
+ "daemon" : _("<P><B>Daemon Configuration</B></P>") +
+
+_("<P>The daemons here provide various services. If you want to change daemon
+settings press <B>Edit</B> button.</P>") +
+
+_("<P><B>HCID</B> - The Host Controller Interface Daemon manages all Bluetooth
+devices in your computer.</P>") +
+
+_("<P><B>SDPD</B> - The Service Discovery Protocol Daemon is needed from remote devices to
+find out which bluetooth-services are available on your computer. The other
+daemons connect to this one.</P>") +
+
+_("<P><B>OPD</B> - The OBEX Push Daemon is needed if you want to e.g. transfer files from a device
+onto your computer.</P>") +
+
+_("<P><B>RFCOMM</B> - It's a Serial Cable Emulation Protocol needed for some devices and
+services. It's not a 'real' daemon, but a process configuring the existing
+bluetooth-devices.</P>") +
+
+_("<P><B>PAND</B> - The Personal Area Network Daemon is used to create
+networks using Bluetooth. It creates a kind of 'wireless ethernet'-network.</P>") +
+
+_("<P><B>DUND</B> - The Dial-Up networking daemon allows to have LAN access over
+PPP. You need it if you have a Bluetooth-modem.</P>") +
+
+_("<P><B>HID</B> - The Human Interface Device Profil is used for devices like
+keyboard and mouse.</P>") +
+
+_("<P><B>HID2HCI</B> - This is actually no 'real' daemon, but a help-util to switch
+a HID-adapter into HCI-mode (or vice versa). Normally you shouldn't need it.</P>"),
+
+ /* Help text for detailed service configuration dialog */
+ "security" : _("<P><B>Security Options</B></P>") +
+
+_("<P>To enhance security you should enable <B>Authentification</B> and <B>Encryption</B>.</P>") +
+
+_("<P>Encryption can only be done if authentification is enabled. Activating both
+enhances security a little bit, but you often run into problems if you do so:
+Not all devices support encryption. If you have problems connecting to a remote
+device, try it with encryption disabled.</P>") +
+
+_("<P>With <B>Inquiry Scan</B> option you can decide if remote devices detect your
+adapter when scanning for available devices.</P>") +
+
+_("<P>Enabled <B>Page Scan</B> option allows remote devices to connect to your device.</P>")
+
+];
+
+map<string,string> daemon_descriptions = $[
+ "HCID" : _("Bluetooth device manager"),
+ "SDPD" : _("Device annoucement"),
+ "OPD" : _("File transfer service"),
+ "RFCOMM" : _("Serial cable emulation"),
+ "PAND" : _("Network connection"),
+ "DUND" : _("Dial-up connection"),
+ "HID" : _("Input device support (keyboard, mouse)"),
+ "HID2HCI" : _("Use HID device in HCID mode")
+];
+
+/* EOF */
+}
106 src/wizards.ycp
@@ -0,0 +1,106 @@
+/**
+ * File: include/bluetooth/wizards.ycp
+ * Package: Configuration of bluetooth
+ * Summary: Wizards definitions
+ * Authors: Ladislav Slezak <lslezak@suse.cz>
+ *
+ * $Id$
+ */
+
+{
+
+textdomain "bluetooth";
+
+import "Sequencer";
+import "Wizard";
+
+include "bluetooth/complex.ycp";
+include "bluetooth/dialogs.ycp";
+
+/**
+ * Main workflow of the bluetooth configuration
+ * @return sequence result
+ */
+any MainSequence() {
+
+ // sequencer aliases
+ map aliases = $[
+ "global" : ``(GlobalOptionsDialog()),
+ "services" : ``(DaemonDialog()),
+ "security" : ``(SecurityDialog())
+ ];
+
+ // sequence of dialogs
+ map sequence = $[
+ "ws_start" : "global",
+ "global" : $[
+ `services : "services",
+ `security : "security",
+ `abort : `abort,
+ `next : `next
+ ],
+ "services" : $[
+ `next : "global",
+ `abort : `abort
+ ],
+ "security" : $[
+ `next : "global",
+ `abort : `abort
+ ]
+ ];
+
+ return Sequencer::Run(aliases, sequence);
+}
+
+/**
+ * Whole configuration of bluetooth
+ * @return sequence result
+ */
+any BluetoothSequence() {
+
+ map aliases = $[
+ "read" : [ ``( ReadDialog() ), true ],
+ "main" : ``( MainSequence() ),
+ "write" : [ ``( WriteDialog() ), true ]
+ ];
+
+ map sequence = $[
+ "ws_start" : "read",
+ "read" : $[
+ `abort : `abort,
+ `next : "main"
+ ],
+ "main" : $[
+ `abort : `abort,
+ `next : "write"
+ ],
+ "write" : $[
+ `abort : `abort,
+ `next : `next
+ ]
+ ];
+
+ Wizard::CreateDialog();
+
+ any ret = Sequencer::Run(aliases, sequence);
+
+ UI::CloseDialog();
+ return ret;
+}
+
+/**
+ * Whole configuration of bluetooth but without reading and writing.
+ * For use with autoinstallation.
+ * @return sequence result
+ */
+any BluetoothAutoSequence() {
+
+ Wizard::CreateDialog();
+ any ret = MainSequence();
+
+ UI::CloseDialog();
+ return ret;
+}
+
+/* EOF */
+}
11 testsuite/.cvsignore
@@ -0,0 +1,11 @@
+Makefile
+Makefile.in
+site.exp
+*.sum
+*.log
+tmp.out*
+tmp.err*
+tmp.log*
+config
+run
+*.test
21 testsuite/Makefile.am
@@ -0,0 +1,21 @@
+#
+# Makefile.am for .../testsuite
+#
+# Do not edit this file (Makefile.am) as it will be overwritten!
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.ycp) $(wildcard tests/*.yh)
+
+testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite
+
+all-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir)
+
+clean-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean
+
+check-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check
+
+# EOF
32 yast2-bluetooth.spec.in
@@ -0,0 +1,32 @@
+@HEADER-COMMENT@
+# neededforbuild yast2-devel-packages
+
+@HEADER@
+Requires: yast2
+
+BuildArchitectures: noarch
+
+Summary: Bluetooth configuration module
+
+%description
+-
+
+@PREP@
+
+@BUILD@
+
+@INSTALL@
+
+@CLEAN@
+
+%files
+%defattr(-,root,root)
+%dir @yncludedir@/bluetooth
+@yncludedir@/bluetooth/*
+@clientdir@/bluetooth.ycp
+@clientdir@/bluetooth_*.ycp
+@moduledir@/Bluetooth.*
+@scrconfdir@/bt_hcid.scr
+@scrconfdir@/cfg_bluetooth.scr
+@desktopdir@/bluetooth.desktop
+%doc @docdir@
Please sign in to comment.
Something went wrong with that request. Please try again.