YaST Commits
Threads by month
- ----- 2024 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2007
- 25 participants
- 535 discussions
![](https://seccdn.libravatar.org/avatar/0cbed2c4f9cfdb209853a4743dd5705c.jpg?s=120&d=mm&r=g)
[yast-commit] r41362 - in /branches/SuSE-SLE-10-SP1-Branch/storage: package/yast2-storage.changes storage/src/include/auto_part_create.ycp storage/src/include/do_proposal_flexible.ycp
by fehr@svn.opensuse.org 11 Oct '07
by fehr@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: fehr
Date: Thu Oct 11 13:12:17 2007
New Revision: 41362
URL: http://svn.opensuse.org/viewcvs/yast?rev=41362&view=rev
Log:
fix performance hog with large number of disks and swap areas (#267262)
Modified:
branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/auto_part_create.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storag…
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes Thu Oct 11 13:12:17 2007
@@ -2,6 +2,7 @@
Thu Oct 11 13:08:33 CEST 2007 - fehr(a)suse.de
- add support for online resize of ext3 (feature #301943)
+- fix performance hog with large number of disks and swap areas (#267262)
-------------------------------------------------------------------
Mon Oct 8 10:49:37 CEST 2007 - fehr(a)suse.de
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/auto_part_create.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storag…
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/auto_part_create.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/auto_part_create.ycp Thu Oct 11 13:12:17 2007
@@ -27,6 +27,7 @@
y2milestone( "create_partitions disk:%1",
haskey(disk,"partitions")?remove(disk,"partitions"):disk );
y2milestone( "create_partitions partitions %1", partitions );
+ flex_init_swapable( tgmap );
boolean ret = false;
boolean has_flex = has_flex_proposal();
string vm = Storage::ProposalVM();
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storag…
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp Thu Oct 11 13:12:17 2007
@@ -77,6 +77,32 @@
}
return( ret );
};
+
+
+map swapable = $[];
+
+define void flex_init_swapable( map<string,map> tg )
+ ``{
+ swapable = $[];
+ foreach( string dev, map disk, tg,
+ ``{
+ list<map> sw = filter( map p, disk["partitions"]:[],
+ ``(p["type"]:`unknown!=`extended &&
+ !p["delete"]:false &&
+ p["detected_fs"]:`unknown==`swap));
+ sw = filter( map p, sw, ``(Storage::CheckSwapable(p["device"]:"")));
+ foreach( map p, sw,
+ ``{
+ swapable[p["device"]:""] = true;
+ });
+ });
+ y2milestone( "flex_init_swapable %1", swapable );
+ }
+
+define boolean check_swapable( string dev )
+ {
+ return( swapable[dev]:false );
+ }
define string pinfo_name()
``{
@@ -2143,7 +2169,7 @@
``(p["type"]:`unknown!=`free &&
!p["delete"]:false &&
p["detected_fs"]:`unknown==`swap));
- swaps = filter( map p, swaps, ``(Storage::CheckSwapable(p["device"]:"")));
+ swaps = filter( map p, swaps, ``(check_swapable(p["device"]:"")));
swaps = sort( map a, map b, swaps, ``(a["size_k"]:0>b["size_k"]:0));
y2milestone( "can_swap_reuse swaps %1", swaps );
if( swaps[0,"size_k"]:0 >= 128*1024 )
@@ -2179,7 +2205,7 @@
``(p["type"]:`unknown!=`extended &&
!p["delete"]:false &&
p["detected_fs"]:`unknown==`swap));
- sw = filter( map p, sw, ``(Storage::CheckSwapable(p["device"]:"")));
+ sw = filter( map p, sw, ``(check_swapable(p["device"]:"")));
y2milestone( "can_swap_reuse disk %1 sw %2", dev, sw );
swaps = (list<map>)union( swaps, sw );
});
@@ -2622,6 +2648,7 @@
map get_inst_proposal( map<string,map> target )
{
y2milestone( "get_inst_proposal start" );
+ flex_init_swapable( target );
map ret = $[];
target = Storage::AddWinInfo(target);
ret["target"] = target;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/0cbed2c4f9cfdb209853a4743dd5705c.jpg?s=120&d=mm&r=g)
[yast-commit] r41361 - in /branches/SuSE-SLE-10-SP1-Branch/storage: libstorage/src/Storage.cc package/yast2-storage.changes
by fehr@svn.opensuse.org 11 Oct '07
by fehr@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: fehr
Date: Thu Oct 11 13:09:21 2007
New Revision: 41361
URL: http://svn.opensuse.org/viewcvs/yast?rev=41361&view=rev
Log:
add support for online resize of ext3 (feature #301943)
Modified:
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc
branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storag…
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc Thu Oct 11 13:09:21 2007
@@ -4179,7 +4179,7 @@
static FsCapabilitiesX ext2Caps (true, false, true, false, true, true,
true, 16, 16);
- static FsCapabilitiesX ext3Caps (true, false, true, false, true, true,
+ static FsCapabilitiesX ext3Caps (true, true, true, false, true, true,
true, 16, 10*1024);
static FsCapabilitiesX xfsCaps (true, true, false, false, true, true,
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storag…
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes Thu Oct 11 13:09:21 2007
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Oct 11 13:08:33 CEST 2007 - fehr(a)suse.de
+
+- add support for online resize of ext3 (feature #301943)
+
+-------------------------------------------------------------------
Mon Oct 8 10:49:37 CEST 2007 - fehr(a)suse.de
- fix bug in script create_udev_cdrom_rules (#331125)
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
[yast-commit] r41360 - in /trunk/yast2: library/modules/FileUtils.ycp package/yast2.changes yast2.spec.in
by locilka@svn.opensuse.org 11 Oct '07
by locilka@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: locilka
Date: Thu Oct 11 11:53:35 2007
New Revision: 41360
URL: http://svn.opensuse.org/viewcvs/yast?rev=41360&view=rev
Log:
- New function FileUtils::MD5sum.
Modified:
trunk/yast2/library/modules/FileUtils.ycp
trunk/yast2/package/yast2.changes
trunk/yast2/yast2.spec.in
Modified: trunk/yast2/library/modules/FileUtils.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/modules/FileUtils.…
==============================================================================
--- trunk/yast2/library/modules/FileUtils.ycp (original)
+++ trunk/yast2/library/modules/FileUtils.ycp Thu Oct 11 11:53:35 2007
@@ -16,6 +16,7 @@
import "SCR";
import "Popup";
+ import "String";
/**
* Function which determines if the requested file/directory exists.
@@ -335,5 +336,46 @@
}
}
+ /**
+ * Function return the md5 of the file.
+ *
+ * @return integer GID, nil if doesn't exist
+ * @param string file name
+ *
+ * @example
+ * FileUtils::GetOwnerGroupID ("/etc/passwd") -> 0
+ * FileUtils::GetOwnerGroupID ("/does-not-exist") -> nil
+ */
+ global string MD5sum (string target) {
+ if (! Exists(target)) {
+ y2error ("File %1 doesn't exist", target);
+ return nil;
+ }
+
+ if (! IsFile(target)) {
+ y2error ("Not a file %1", target);
+ return nil;
+ }
+
+ string ret = "";
+
+ string cmd = sformat ("md5sum '%1'", String::Quote (target));
+ map cmd_out = (map) SCR::Execute (.target.bash_output, cmd);
+
+ if (cmd_out["exit"]:-1 != 0) {
+ y2error ("Command >%1< returned %2", cmd, cmd_out);
+ return nil;
+ }
+
+ string filemd5 = cmd_out["stdout"]:"";
+ if (regexpmatch (filemd5, "[^ \t]+[ \t]+.*$")) {
+ // Format: '19ea7ea41de37314f71c6849ddd259d5 /the/file'
+ filemd5 = regexpsub (filemd5, "^([^ \t]+)[ \t]+.*$", "\\1");
+ } else {
+ y2warning ("Strange md5out: '%1'", filemd5);
+ return nil;
+ }
+ }
+
/* EOF */
}
Modified: trunk/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=…
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Thu Oct 11 11:53:35 2007
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Oct 11 11:52:23 CEST 2007 - locilka(a)suse.cz
+
+- New function FileUtils::MD5sum.
+
+-------------------------------------------------------------------
Thu Oct 4 16:29:01 CEST 2007 - jsrain(a)suse.cz
- install bigsmp kernel regardless the memory size (Fate #159006)
Modified: trunk/yast2/yast2.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/yast2.spec.in?rev=41360&r1…
==============================================================================
--- trunk/yast2/yast2.spec.in (original)
+++ trunk/yast2/yast2.spec.in Thu Oct 11 11:53:35 2007
@@ -12,6 +12,7 @@
# For Cron Agent, Module
Requires: perl-Config-Crontab
# for ag_tty (/bin/stty)
+# for /usr/bin/md5sum
Requires: coreutils
Requires: yast2-xml yast2-hardware-detection
# for SLPAPI.pm
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
[yast-commit] r41359 - in /trunk/packager: package/yast2-packager.changes src/modules/ProductLicense.ycp yast2-packager.spec.in
by locilka@svn.opensuse.org 11 Oct '07
by locilka@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: locilka
Date: Thu Oct 11 11:52:11 2007
New Revision: 41359
URL: http://svn.opensuse.org/viewcvs/yast?rev=41359&view=rev
Log:
- Using the new FileUtils::MD5sum function.
- Adjusted RPM dependencies.
Modified:
trunk/packager/package/yast2-packager.changes
trunk/packager/src/modules/ProductLicense.ycp
trunk/packager/yast2-packager.spec.in
Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.…
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Thu Oct 11 11:52:11 2007
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Oct 11 11:51:20 CEST 2007 - locilka(a)suse.cz
+
+- Using the new FileUtils::MD5sum function.
+- Adjusted RPM dependencies.
+
+-------------------------------------------------------------------
Wed Oct 3 17:42:05 CEST 2007 - locilka(a)suse.cz
- During upgrade, old repositories are removed (they are already
Modified: trunk/packager/src/modules/ProductLicense.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/ProductLice…
==============================================================================
--- trunk/packager/src/modules/ProductLicense.ycp (original)
+++ trunk/packager/src/modules/ProductLicense.ycp Thu Oct 11 11:52:11 2007
@@ -46,25 +46,12 @@
return nil;
}
- string ret = "";
-
- string cmd = sformat ("md5sum '%1'", String::Quote (filename));
- map cmd_out = (map) SCR::Execute (.target.bash_output, cmd);
-
- if (cmd_out["exit"]:-1 != 0) {
- y2error ("Command >%1< returned %2", cmd, cmd_out);
+ string filemd5 = FileUtils::MD5sum (filename);
+ if (filemd5 == nil) {
return nil;
}
- string filemd5 = cmd_out["stdout"]:"";
- if (regexpmatch (filemd5, "[^ \t]+[ \t]+.*$")) {
- // Format: '19ea7ea41de37314f71c6849ddd259d5 /the/file'
- filemd5 = regexpsub (filemd5, "^([^ \t]+)[ \t]+.*$", "\\1");
- } else {
- y2warning ("Strange md5out: '%1'", filemd5);
- }
-
- ret = sformat("%1-%2", filemd5, FileUtils::GetSize (filename));
+ string ret = sformat("%1-%2", filemd5, FileUtils::GetSize (filename));
y2milestone ("License ident for '%1' is '%2'", filename, ret);
Modified: trunk/packager/yast2-packager.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/yast2-packager.spec.in?…
==============================================================================
--- trunk/packager/yast2-packager.spec.in (original)
+++ trunk/packager/yast2-packager.spec.in Thu Oct 11 11:52:11 2007
@@ -3,7 +3,7 @@
@HEADER@
BuildRequires: gcc-c++ libxcrypt-devel yast2-country yast2-xml docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files yast2-devtools yast2-testsuite yast2-slp
-BuildRequires: yast2 >= 2.15.38
+BuildRequires: yast2 >= 2.16.2
# Module: OneClickInstallStandard
Requires: perl-XML-Bare yast2-perl-bindings
@@ -14,8 +14,8 @@
# New function: Pkg::SourceProvideDirectory
Requires: yast2-pkg-bindings >= 2.15.38
-# Mode::live_installation
-Requires: yast2 >= 2.15.38
+# FileUtils::MD5sum
+Requires: yast2 >= 2.16.2
# unzipping license file
Requires: unzip
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
[yast-commit] r41358 - in /trunk/add-on: package/yast2-add-on.changes src/add-on-workflow.ycp
by locilka@svn.opensuse.org 11 Oct '07
by locilka@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: locilka
Date: Thu Oct 11 11:05:37 2007
New Revision: 41358
URL: http://svn.opensuse.org/viewcvs/yast?rev=41358&view=rev
Log:
- List Product Name, then Product URL instead if vice versa
(#332837).
Modified:
trunk/add-on/package/yast2-add-on.changes
trunk/add-on/src/add-on-workflow.ycp
Modified: trunk/add-on/package/yast2-add-on.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on/package/yast2-add-on.chan…
==============================================================================
--- trunk/add-on/package/yast2-add-on.changes (original)
+++ trunk/add-on/package/yast2-add-on.changes Thu Oct 11 11:05:37 2007
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Oct 11 11:03:11 CEST 2007 - locilka(a)suse.cz
+
+- List Product Name, then Product URL instead if vice versa
+ (#332837).
+
+-------------------------------------------------------------------
Mon Sep 24 14:15:57 CEST 2007 - locilka(a)suse.cz
- Do not ask whether to install packages in the inst-sys (#327742).
Modified: trunk/add-on/src/add-on-workflow.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/add-on/src/add-on-workflow.ycp?r…
==============================================================================
--- trunk/add-on/src/add-on-workflow.ycp (original)
+++ trunk/add-on/src/add-on-workflow.ycp Thu Oct 11 11:05:37 2007
@@ -960,22 +960,27 @@
if (dir == "")
dir = "/";
// table cell, %1 is URL, %2 is directory name
- string media = sformat (_("URL: %1, Directory: %2"),
+ string media = sformat (_("%1, Directory: %2"),
// placeholder for unknown URL
data["url"]:_("Unknown"), dir);
- return `item (`id (index),
- media,
+ return `item (
+ `id (index),
// sformat (_("Product %1"), product["product"]:"")
- product["product"]:""
+ product["product"]:"",
+ media
);
});
term contents = `VBox (
- `Table (`id (`summary), `header (
+ `Table (
+ `id (`summary),
+ `header (
// table header
- _("Media"),
+ _("Product"),
// table header
- _("Product")),
- items),
+ _("Media")
+ ),
+ items
+ ),
`Left(
`HBox (
`PushButton (`id (`add), Label::AddButton ()),
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
[yast-commit] r41357 - in /branches/SuSE-SLE-10-SP2-Branch/installation: package/yast2-installation.changes src/modules/AddOnProduct.ycp
by locilka@svn.opensuse.org 11 Oct '07
by locilka@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: locilka
Date: Thu Oct 11 09:39:47 2007
New Revision: 41357
URL: http://svn.opensuse.org/viewcvs/yast?rev=41357&view=rev
Log:
- Correctly evaluating relurl:// parameters, such as
relurl://.../?device=sda5 (#307196, #306670).
Modified:
branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes
branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp
Modified: branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/instal…
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes (original)
+++ branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes Thu Oct 11 09:39:47 2007
@@ -3,6 +3,8 @@
- Unpacking y2update.tgz before merging installation.xml when using
a new Add-On.
+- Correctly evaluating relurl:// parameters, such as
+ relurl://.../?device=sda5 (#307196, #306670).
- 2.13.197
-------------------------------------------------------------------
Modified: branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/instal…
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp (original)
+++ branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp Thu Oct 11 09:39:47 2007
@@ -116,6 +116,47 @@
}
/**
+ * Reads list of HTTP params and returns them as map
+ *
+ * @params string params
+ * @return map <string, string> params
+ *
+ * @example
+ * MakeMapFromParams ("device=sda3&login=aaa&password=bbb") -> $[
+ * "device" : "sda3",
+ * "login" : "aaa",
+ * "password" : "bbb"
+ * ]
+ */
+map <string, string> MakeMapFromParams (string params) {
+ list <string> params_list = splitstring (params, "&");
+
+ params_list = filter (string one_param, params_list, {
+ return (one_param != "" && one_param != nil);
+ });
+
+ map <string, string> ret = $[];
+ integer eq_pos = nil;
+ string opt = "";
+ string val = "";
+
+ foreach (string one_param, params_list, {
+ eq_pos = search (one_param, "=");
+
+ if (eq_pos == nil) {
+ ret[one_param] = "";
+ } else {
+ opt = substring (one_param, 0, eq_pos);
+ val = substring (one_param, (eq_pos + 1));
+
+ ret[opt] = val;
+ }
+ });
+
+ return ret;
+}
+
+/**
* Returns an absolute URL from base + relative url.
* Relative URL needs to start with 'reulrl://' othewise
* it is not considered being relative and it's returned
@@ -137,20 +178,37 @@
*/
global string GetAbsoluteURL (string base_url, string url) {
if (! regexpmatch (url, "^relurl://")) {
- y2debug ("Not a relative URL: %1", url);
- return url;
+ y2debug ("Not a relative URL: %1", url);
+ return url;
}
if (base_url == nil || base_url == "") {
- y2error ("No base_url defined");
- return url;
+ y2error ("No base_url defined");
+ return url;
+ }
+
+ // bugzilla #306670
+ integer base_params_pos = search (base_url, "?");
+ string base_params = "";
+
+ if (base_params_pos != nil && base_params_pos >= 0) {
+ base_params = substring (base_url, (base_params_pos + 1));
+ base_url = substring (base_url, 0, base_params_pos);
+ }
+
+ integer added_params_pos = search (url, "?");
+ string added_params = "";
+
+ if (added_params_pos != nil && added_params_pos >= 0) {
+ added_params = substring (url, (added_params_pos + 1));
+ url = substring (url, 0, added_params_pos);
}
if (! regexpmatch (base_url, "/$")) {
- base_url = base_url + "/";
+ base_url = base_url + "/";
}
- y2milestone ("Merging '%1' to '%2'", url, base_url);
+ y2milestone ("Merging '%1' (params '%2') to '%3' (params '%4')", url, added_params, base_url, base_params);
url = regexpsub (url, "^relurl://(.*)$", "\\1");
url = sformat ("%1%2", base_url, url);
@@ -159,33 +217,57 @@
integer max_count = 100;
while (max_count > 0 && regexpmatch (url, "(.*/)[^/]+/+\\.\\./")) {
- max_count = max_count - 1;
- list <integer> str_offset_l = (list <integer>) regexppos (url, "/\\.\\./");
- integer str_offset = str_offset_l[0]:nil;
-
- if (str_offset != nil && str_offset > 0) {
- string stringfirst = substring (url, 0, str_offset);
- string stringsecond = substring (url, str_offset);
-
- y2debug ("Pos: %1 First: >%2< Second: >%3<", str_offset, stringfirst, stringsecond);
-
- stringfirst = regexpsub (stringfirst, "^(.*/)[^/]+/*$", "\\1");
- stringsecond = regexpsub (stringsecond, "^/\\.\\./(.*)$", "\\1");
-
- url = stringfirst + stringsecond;
- }
+ max_count = max_count - 1;
+ list <integer> str_offset_l = (list <integer>) regexppos (url, "/\\.\\./");
+ integer str_offset = str_offset_l[0]:nil;
+
+ if (str_offset != nil && str_offset > 0) {
+ string stringfirst = substring (url, 0, str_offset);
+ string stringsecond = substring (url, str_offset);
+
+ y2debug ("Pos: %1 First: >%2< Second: >%3<", str_offset, stringfirst, stringsecond);
+
+ stringfirst = regexpsub (stringfirst, "^(.*/)[^/]+/*$", "\\1");
+ stringsecond = regexpsub (stringsecond, "^/\\.\\./(.*)$", "\\1");
+
+ url = stringfirst + stringsecond;
+ }
}
// remove /./
max_count = 100;
while (max_count > 0 && regexpmatch (url, "/\\./")) {
- max_count = max_count - 1;
- url = regexpsub (url, "^(.*)/\\./(.*)", "\\1/\\2");
+ max_count = max_count - 1;
+ url = regexpsub (url, "^(.*)/\\./(.*)", "\\1/\\2");
+ }
+
+ map <string, string> base_params_map = MakeMapFromParams (base_params);
+ map <string, string> added_params_map = MakeMapFromParams (added_params);
+ map <string, string> final_params_map = (map <string, string>) union (base_params_map, added_params_map);
+
+ if (size (final_params_map) > 0) {
+ y2milestone ("%1 merge %2 -> %3", base_params_map, added_params_map, final_params_map);
+
+ string url_add = "";
+
+ foreach (string opt, string val, final_params_map, {
+ url_add =
+ url_add +
+ // add '&' if needed
+ (size (url_add) > 0 ? "&" : "") +
+ opt +
+ // define 'opt=val' if val is set
+ // otherwise don't use '=val' at all
+ (size (val) > 0 ? "=" + val : "");
+ });
+
+ url = url + "?" + url_add;
}
y2milestone ("Final URL: '%1'", url);
return url;
+
}
// <--
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
[yast-commit] r41356 - in /branches/SuSE-SLE-10-SP2-Branch/installation: VERSION package/yast2-installation.changes src/modules/AddOnProduct.ycp
by locilka@svn.opensuse.org 11 Oct '07
by locilka@svn.opensuse.org 11 Oct '07
11 Oct '07
Author: locilka
Date: Thu Oct 11 09:30:52 2007
New Revision: 41356
URL: http://svn.opensuse.org/viewcvs/yast?rev=41356&view=rev
Log:
- Unpacking y2update.tgz before merging installation.xml when using
a new Add-On.
- 2.13.197
Modified:
branches/SuSE-SLE-10-SP2-Branch/installation/VERSION
branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes
branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp
Modified: branches/SuSE-SLE-10-SP2-Branch/installation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/instal…
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/installation/VERSION (original)
+++ branches/SuSE-SLE-10-SP2-Branch/installation/VERSION Thu Oct 11 09:30:52 2007
@@ -1 +1 @@
-2.13.196
+2.13.197
Modified: branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/instal…
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes (original)
+++ branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes Thu Oct 11 09:30:52 2007
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Thu Oct 11 09:26:48 CEST 2007 - locilka(a)suse.cz
+
+- Unpacking y2update.tgz before merging installation.xml when using
+ a new Add-On.
+- 2.13.197
+
+-------------------------------------------------------------------
Fri Jul 20 13:53:21 CEST 2007 - locilka(a)suse.cz
- Added support for relative URLs in the add_on_products file by
Modified: branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/instal…
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp (original)
+++ branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp Thu Oct 11 09:30:52 2007
@@ -1153,6 +1153,17 @@
global boolean Integrate (integer srcid) {
y2milestone ("Integrating source %1", srcid);
+ // bugzilla #297752
+ // Update inst-sys before merging the control file
+
+ // Updating inst-sys
+ string y2update = Pkg::SourceProvideOptionalFile (srcid, 1, "/y2update.tgz");
+ if (y2update == nil) {
+ y2milestone ("No YaST update found on the media");
+ } else {
+ UpdateInstSys (y2update);
+ }
+
// Updating workflow or proposals
// Trying to use a cached file, bugzilla #221377
@@ -1200,14 +1211,6 @@
control_files_to_add = add (control_files_to_add, sformat ("%1.xml", srcid));
}
- // Updating inst-sys
- string y2update = Pkg::SourceProvideOptionalFile (srcid, 1, "/y2update.tgz");
- if (y2update == nil) {
- y2milestone ("No YaST update found on the media");
- } else {
- UpdateInstSys (y2update);
- }
-
return true;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/d788d4d6ea7d5ed777eaa8feaaa2c1d8.jpg?s=120&d=mm&r=g)
[yast-commit] r41355 - /branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
by sh-sh-sh@svn.opensuse.org 10 Oct '07
by sh-sh-sh@svn.opensuse.org 10 Oct '07
10 Oct '07
Author: sh-sh-sh
Date: Wed Oct 10 22:37:35 2007
New Revision: 41355
URL: http://svn.opensuse.org/viewcvs/yast?rev=41355&view=rev
Log:
doc
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Wed Oct 10 22:37:35 2007
@@ -379,4 +379,8 @@
- Added support for icons in menu entries
- Added YMenuEvent( YMenuEntry * ) constructor
+ - Derived classes can use YMenuItem::index() as a unique ID
+ or use YMenuItem::data() and YMenuItem::setData() to store
+ a custom pointer to some other class.
+
Look at YQMenuButton for a sample implementation.
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/d788d4d6ea7d5ed777eaa8feaaa2c1d8.jpg?s=120&d=mm&r=g)
[yast-commit] r41354 - in /branches/tmp/sh/mod-ui: core/libyui/src/YMenuButton.cc core/libyui/src/YMenuButton.h qt/src/YQMenuButton.cc qt/src/YQMenuButton.h
by sh-sh-sh@svn.opensuse.org 10 Oct '07
by sh-sh-sh@svn.opensuse.org 10 Oct '07
10 Oct '07
Author: sh-sh-sh
Date: Wed Oct 10 22:35:28 2007
New Revision: 41354
URL: http://svn.opensuse.org/viewcvs/yast?rev=41354&view=rev
Log:
Moved gory details to base class
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc
branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h
branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc
branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc Wed Oct 10 22:35:28 2007
@@ -28,9 +28,10 @@
struct YMenuButtonPrivate
{
YMenuButtonPrivate()
+ : nextSerialNo( 0 )
{}
- int dummy;
+ int nextSerialNo;
};
@@ -51,7 +52,8 @@
}
-void YMenuButton::addItems( const YItemCollection & itemCollection )
+void
+YMenuButton::addItems( const YItemCollection & itemCollection )
{
YSelectionWidget::addItems( itemCollection );
resolveShortcutConflicts();
@@ -60,6 +62,73 @@
void
+YMenuButton::addItem( YItem * item )
+{
+ YSelectionWidget::addItem( item );
+ item->setIndex( ++(priv->nextSerialNo) );
+
+ if ( item->hasChildren() )
+ assignUniqueIndex( item->childrenBegin(), item->childrenEnd() );
+}
+
+
+void
+YMenuButton::assignUniqueIndex( YItemIterator begin, YItemIterator end )
+{
+ for ( YItemIterator it = begin; it != end; ++it )
+ {
+ YItem * item = *it;
+
+ item->setIndex( ++(priv->nextSerialNo) );
+
+ if ( item->hasChildren() )
+ assignUniqueIndex( item->childrenBegin(), item->childrenEnd() );
+ }
+}
+
+
+void
+YMenuButton::deleteAllItems()
+{
+ YSelectionWidget::deleteAllItems();
+ priv->nextSerialNo = 0;
+}
+
+
+YMenuItem *
+YMenuButton::findMenuItem( int index )
+{
+ return findMenuItem( index, itemsBegin(), itemsEnd() );
+}
+
+
+YMenuItem *
+YMenuButton::findMenuItem( int wantedIndex, YItemConstIterator begin, YItemConstIterator end )
+{
+ for ( YItemConstIterator it = begin; it != end; ++it )
+ {
+ YMenuItem * item = dynamic_cast<YMenuItem *> (*it);
+
+ if ( item )
+ {
+ if ( item->index() == wantedIndex )
+ return item;
+
+ if ( item->hasChildren() )
+ {
+ YMenuItem * result = findMenuItem( wantedIndex, item->childrenBegin(), item->childrenEnd() );
+
+ if ( result )
+ return result;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+void
YMenuButton::resolveShortcutConflicts()
{
// TO DO
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h Wed Oct 10 22:35:28 2007
@@ -20,6 +20,7 @@
#define YMenuButton_h
#include "YSelectionWidget.h"
+#include "YMenuItem.h"
class YMacroRecorder;
class YMenuItem;
@@ -85,6 +86,25 @@
virtual void addItems( const YItemCollection & itemCollection );
/**
+ * Add one item. This widget assumes ownership of the item object and will
+ * delete it in its destructor.
+ *
+ * This reimplementation will an index to the item that is unique for all
+ * items in this MenuButton. That index can be used later with
+ * findMenuItem() to find the item by that index.
+ *
+ * Reimplemented from YSelectionWidget.
+ **/
+ virtual void addItem( YItem * item );
+
+ /**
+ * Delete all items.
+ *
+ * Reimplemented from YSelectionWidget.
+ **/
+ virtual void deleteAllItems();
+
+ /**
* Resolve keyboard shortcut conflicts: Change shortcuts of menu items if
* there are duplicates in the respective menu level.
*
@@ -122,9 +142,37 @@
**/
virtual const YPropertySet & propertySet();
+protected:
+
+ /**
+ * Recursively find the first menu item with the specified index.
+ * Returns 0 if there is no such item.
+ **/
+ YMenuItem * findMenuItem( int index );
+
+ /**
+ * Recursively find the first menu item with the specified index
+ * from iterator 'begin' to iterator 'end'.
+ *
+ * Returns 0 if there is no such item.
+ **/
+ YMenuItem * findMenuItem( int index, YItemConstIterator begin, YItemConstIterator end );
+
+ /**
+ * Alias for findMenuItem(). Reimplemented to ensure consistent behaviour
+ * with YSelectionWidget::itemAt().
+ **/
+ YMenuItem * itemAt( int index )
+ { return findMenuItem( index ); }
private:
+ /**
+ * Assign a unique index to all items from iterator 'begin' to iterator 'end'.
+ **/
+ void assignUniqueIndex( YItemIterator begin, YItemIterator end );
+
+
ImplPtr<YMenuButtonPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQMenuBu…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc Wed Oct 10 22:35:28 2007
@@ -28,7 +28,6 @@
#include "utf8.h"
#include "YQUI.h"
#include "YQMenuButton.h"
-#include "YMenuItem.h"
#include "YEvent.h"
@@ -37,7 +36,6 @@
const string & label )
: QWidget( (QWidget *) parent->widgetRep() )
, YMenuButton( parent, label )
- , _nextSerialNo( 0 )
, _selectedItem( 0 )
{
setWidgetRep( this );
@@ -89,7 +87,6 @@
// Recursively add Qt menu items from the YMenuItems
//
- _nextSerialNo = 0;
rebuildMenuTree( menu, itemsBegin(), itemsEnd() );
}
@@ -103,7 +100,7 @@
YUI_CHECK_PTR( item );
QPixmap icon;
-
+
if ( item->hasIconName() )
{
string iconName = iconFullPath( item );
@@ -130,47 +127,16 @@
}
else // No children - leaf entry
{
- item->setData( (void *) ++_nextSerialNo );
-
+ // item->index() is guaranteed to be unique within this YMenuButton's items,
+ // so it can easily be used as unique ID in all QPopupMenus that belong
+ // to this YQMenuButton.
+
if ( icon.isNull() )
- parentMenu->insertItem( fromUTF8( item->label() ), _nextSerialNo );
+ parentMenu->insertItem( fromUTF8( item->label() ), item->index() );
else
- parentMenu->insertItem( QIconSet( icon ), fromUTF8( item->label() ), _nextSerialNo );
- }
- }
-}
-
-
-YMenuItem *
-YQMenuButton::findMenuItem( int serialNo )
-{
- return findMenuItem( serialNo, itemsBegin(), itemsEnd() );
-}
-
-
-YMenuItem *
-YQMenuButton::findMenuItem( int serialNo, YItemConstIterator begin, YItemConstIterator end )
-{
- for ( YItemConstIterator it = begin; it != end; ++it )
- {
- YMenuItem * item = dynamic_cast<YMenuItem *> (*it);
-
- if ( item )
- {
- if ( item->data() == (void *) serialNo )
- return item;
-
- if ( item->hasChildren() )
- {
- YMenuItem * result = findMenuItem( serialNo, item->childrenBegin(), item->childrenEnd() );
-
- if ( result )
- return result;
- }
+ parentMenu->insertItem( QIconSet( icon ), fromUTF8( item->label() ), item->index() );
}
}
-
- return 0;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQMenuBu…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h Wed Oct 10 22:35:28 2007
@@ -114,23 +114,11 @@
**/
void rebuildMenuTree( QPopupMenu * menu, YItemIterator begin, YItemIterator end );
- /**
- * Recursively find the first menu item with the specified serial no.
- **/
- YMenuItem * findMenuItem( int serialNo );
-
- /**
- * Recursively find the first menu item with the specified serial no
- * from iterator 'begin' to iterator 'end'.
- **/
- YMenuItem * findMenuItem( int serialNo, YItemConstIterator begin, YItemConstIterator end );
-
//
// Data members
//
- int _nextSerialNo;
YMenuItem * _selectedItem;
QPushButton * _qt_button;
};
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
![](https://seccdn.libravatar.org/avatar/d788d4d6ea7d5ed777eaa8feaaa2c1d8.jpg?s=120&d=mm&r=g)
[yast-commit] r41353 - in /branches/tmp/sh/mod-ui: core/libyui/src/ qt/src/
by sh-sh-sh@svn.opensuse.org 10 Oct '07
by sh-sh-sh@svn.opensuse.org 10 Oct '07
10 Oct '07
Author: sh-sh-sh
Date: Wed Oct 10 21:48:49 2007
New Revision: 41353
URL: http://svn.opensuse.org/viewcvs/yast?rev=41353&view=rev
Log:
Ported MenuButton
Added:
branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItem.h
branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.h
branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.h
branches/tmp/sh/mod-ui/core/libyui/src/YMenuItem.h
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.h
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
branches/tmp/sh/mod-ui/core/libyui/src/YEvent.cc
branches/tmp/sh/mod-ui/core/libyui/src/YEvent.h
branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc
branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h
branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
branches/tmp/sh/mod-ui/core/libyui/src/YTreeItem.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc
branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc
branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h
branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
branches/tmp/sh/mod-ui/qt/src/YQTable.cc
branches/tmp/sh/mod-ui/qt/src/YQTree.cc
branches/tmp/sh/mod-ui/qt/src/YQUI.h
branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Wed Oct 10 21:48:49 2007
@@ -347,7 +347,7 @@
* Ported Table
- now based on SelectionWidget
- much streamlined with the other selection widgets
- - QueryWidget(table) can now return the complete item term
+ - QueryWidget can now return the complete item term
as well as individual cells
Look at YQTable for a sample implementation.
@@ -369,3 +369,14 @@
* Ported LogView
+
+2007-10-10 22:00 sh(a)suse.de
+
+* Ported MenuButton
+ - Now derived from YSelectionWidget
+ - Added support for replacing (all!) items
+ - QueryWidget can now return the complete item term
+ - Added support for icons in menu entries
+ - Added YMenuEvent( YMenuEntry * ) constructor
+
+ Look at YQMenuButton for a sample implementation.
Modified: branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am Wed Oct 10 21:48:49 2007
@@ -16,10 +16,12 @@
YCPDialogParser.cc \
YCPItemParser.cc \
YCPItemWriter.cc \
- YCPTreeItemParser.cc \
- YCPTreeItemWriter.cc \
+ YCPMenuItemParser.cc \
+ YCPMenuItemWriter.cc \
YCPTableItemParser.cc \
YCPTableItemWriter.cc \
+ YCPTreeItemParser.cc \
+ YCPTreeItemWriter.cc \
YCPPropertyHandler.cc \
YCPValueWidgetID.cc \
YItem.cc \
@@ -98,17 +100,21 @@
YCPItem.h \
YCPItemParser.h \
YCPItemWriter.h \
- YCPTreeItem.h \
- YCPTreeItemParser.h \
- YCPTreeItemWriter.h \
+ YCPMenuItem.h \
+ YCPMenuItemParser.h \
+ YCPMenuItemWriter.h \
YCPTableItemParser.h \
YCPTableItemWriter.h \
YCPTableItem.h \
+ YCPTreeItem.h \
+ YCPTreeItemParser.h \
+ YCPTreeItemWriter.h \
YCPPropertyHandler.h \
YCPValueWidgetID.h \
YCP_UI_Exception.h \
YChildrenManager.h \
YItem.h \
+ YMenuItem.h \
YTreeItem.h \
YTableItem.h \
YOptionalWidgetFactory.h \
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Wed Oct 10 21:48:49 2007
@@ -33,6 +33,7 @@
#include "YWidget.h"
#include "YCPValueWidgetID.h"
#include "YCPItemParser.h"
+#include "YCPMenuItemParser.h"
#include "YCPTreeItemParser.h"
#include "YCPTableItemParser.h"
#include "YCP_UI_Exception.h"
@@ -1302,9 +1303,11 @@
YCPDialogParser::parseMenuButton( YWidget * parent, YWidgetOpt & opt,
const YCPTerm & term, const YCPList & optList, int argnr )
{
- if ( term->size() - argnr != 2
- || ! term->value(argnr )->isString()
- || ! term->value(argnr+1)->isList() )
+ int numargs = term->size() - argnr;
+
+ if ( numargs < 1 || numargs > 2
+ || ! term->value( argnr )->isString()
+ || ( numargs >= 2 && ! term->value( argnr+1 )->isList() ) )
{
y2error( "Invalid arguments for the MenuButton widget: "
"expected \"label\", [ `item(), `item(), ... ], not %s",
@@ -1314,111 +1317,20 @@
rejectAllOptions( term,optList );
- YMenuButton *menu_button = dynamic_cast<YMenuButton *>
- ( YUI::ui()->createMenuButton( parent, opt, term->value( argnr )->asString() ) );
-
- if ( ! menu_button ||
- parseMenuItemList( term->value( argnr+1 )->asList(), menu_button ) == -1 )
- {
- return 0;
- }
-
- menu_button->resolveShortcutConflicts();
- menu_button->createMenu(); // actually create the specific UI's menu hierarchy
-
- return menu_button;
-}
-
+ string label = term->value( argnr )->asString()->value();
+ YMenuButton * menuButton = YUI::widgetFactory()->createMenuButton( parent, label );
-int
-YCPDialogParser::parseMenuItemList( const YCPList & itemList,
- YMenuButton * menu_button,
- YMenu * parent_menu ) // 0 if top level
-{
- for ( int i=0; i < itemList->size(); i++ )
+ if ( numargs >= 2 )
{
- YCPValue item = itemList->value(i);
-
- if ( item->isTerm() && item->asTerm()->name() == YUISymbol_item )
- {
- // found `item()
-
- YCPTerm iterm = item->asTerm();
-
- if ( iterm->size() != 2 ||
- ! iterm->value(0)->isTerm() || // `id( ... )
- ! iterm->value(1)->isString() ) // "menu item label"
- {
- y2error( "MenuButton: Invalid menu item - expected `item( `id( ... ), \"label\" ), not %s",
- iterm->toString().c_str() );
-
- return -1;
- }
-
-
- // check for item `id() (mandatory)
-
- YCPValue item_id = YCPNull();
-
- if ( checkId ( iterm->value(0), true ) )
- {
- item_id = parseIdTerm( iterm->value(0) );
- }
- else // no `id()
- {
- y2error( "MenuButton: Invalid menu item - no `id() specified: %s",
- item->toString().c_str() );
-
- return -1;
- }
-
-
- // extract item label ( mandatory ) and create the item
-
- YCPString item_label = iterm->value(1)->asString();
- menu_button->addMenuItem( item_label, item_id, parent_menu );
- // y2debug( "Inserted menu entry '%s'", item_label->value().c_str() );
- }
- else if ( item->isTerm() && item->asTerm()->name() == YUISymbol_menu )
- {
- // found `menu()
-
- YCPTerm iterm = item->asTerm();
-
- if ( iterm->size() != 2 ||
- ! iterm->value(0)->isString() && // "submenu label"
- ! iterm->value(1)->isList() ) // [ `item( ... ), `item( ... ) ] )
- {
- y2error( "MenuButton: Invalid submenu specification: "
- "expected `menu( \"submenu label\", [ `item(), `item(), ... ] ), not %s",
- item->toString().c_str() );
-
- return -1;
- }
-
- YCPString sub_menu_label = iterm->value(0)->asString();
- YMenu * sub_menu = menu_button->addSubMenu( sub_menu_label, parent_menu );
- // y2debug( "Inserted sub menu '%s'", sub_menu_label->value().c_str() );
-
- if ( parseMenuItemList( iterm->value(1)->asList(), menu_button, sub_menu ) == -1 )
- {
- return -1;
- }
- }
- else
- {
- y2error( "MenuButton: Invalid menu item - use either `item() or `menu(), not %s",
- item->toString().c_str() );
- return -1;
- }
+ YCPList itemList = term->value( argnr+1 )->asList();
+ menuButton->addItems( YCPMenuItemParser::parseMenuItemList( itemList ) );
}
- return 0;
+ return menuButton;
}
-
/**
* @widget CheckBox
* @short Clickable on/off toggle button
@@ -1802,6 +1714,7 @@
const YCPTerm & term, const YCPList & optList, int argnr )
{
int numargs = term->size() - argnr;
+
if ( numargs < 1 || numargs > 2
|| ! term->value( argnr )->isString()
|| ( numargs >= 2 && ! term->value( argnr+1 )->isList() ) )
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.h Wed Oct 10 21:48:49 2007
@@ -91,11 +91,6 @@
static YCPValue parseIdTerm( const YCPValue & v );
/**
- * Parse a menu list (for menu buttons)
- **/
- static int parseMenuItemList( const YCPList & itemList, YMenuButton *menu_button, YMenu *parentMenu = 0 );
-
- /**
* Parse a list of numeric values and return it as a vector<float>.
* Throws exceptions upon syntax errors.
**/
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItem.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItem.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItem.h Wed Oct 10 21:48:49 2007
@@ -0,0 +1,120 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPMenuItem.h
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+#ifndef YCPMenuItem_h
+#define YCPMenuItem_h
+
+
+#include <ycp/YCPValue.h>
+#include <ycp/YCPString.h>
+#include "YMenuItem.h"
+
+
+/**
+ * Menu item class with YCPValue IDs.
+ *
+ * Similar to YCPItem (and even more similar to YCPTreeItem, but with YMenuItem
+ * as base class. There should be an elegant way to do this with templates, but
+ * the different constructor arguments make this difficult.
+ **/
+class YCPMenuItem: public YMenuItem
+{
+public:
+
+ /**
+ * Constructors
+ **/
+ YCPMenuItem( const YCPString & label,
+ const YCPValue & id )
+ : YMenuItem( label->value() )
+ , _id( id )
+ {}
+
+ YCPMenuItem( const YCPString & label,
+ const YCPValue & id,
+ const YCPString & iconName )
+ : YMenuItem( label->value(), iconName->value() )
+ , _id( id )
+ {}
+
+ YCPMenuItem( YCPMenuItem * parent,
+ const YCPString & label,
+ const YCPValue & id )
+ : YMenuItem( parent, label->value() )
+ , _id( id )
+ {}
+
+ YCPMenuItem( YCPMenuItem * parent,
+ const YCPString & label,
+ const YCPValue & id,
+ const YCPString & iconName )
+ : YMenuItem( parent, label->value(), iconName->value() )
+ , _id( id )
+ {}
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YCPMenuItem()
+ {}
+
+ /**
+ * Return 'true' if this item has an ID.
+ **/
+ bool hasId() const { return ! _id.isNull() && ! _id->isVoid(); }
+
+ /**
+ * Return this item's ID.
+ **/
+ YCPValue id() const { return _id; }
+
+ /**
+ * Set a new ID.
+ **/
+ void setId( const YCPValue & newId ) { _id = newId; }
+
+ /**
+ * Return this item's label as a YCPString.
+ **/
+ YCPString label() const { return YCPString( YMenuItem::label() ); }
+
+ /**
+ * Set this item's label with a YCPString.
+ **/
+ void setLabel( const YCPString & newLabel )
+ { YMenuItem::setLabel( newLabel->value() ); }
+
+ /**
+ * Return this item's icon name as a YCPString.
+ **/
+ YCPString iconName() const { return YCPString( YMenuItem::iconName() ); }
+
+ /**
+ * Set this item's icon name with a YCPString.
+ **/
+ void setIconName( const YCPString & newIconName )
+ { YMenuItem::setIconName( newIconName->value() ); }
+
+
+private:
+
+ YCPValue _id;
+};
+
+
+#endif // YCPMenuItem_h
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.cc (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.cc Wed Oct 10 21:48:49 2007
@@ -0,0 +1,180 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPMenuItemParser.h
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+
+#include <ycp/YCPTerm.h>
+#include <ycp/YCPBoolean.h>
+
+#define y2log_component "ui"
+#include <ycp/y2log.h>
+
+#include "YCPMenuItemParser.h"
+#include "YCP_UI_Exception.h"
+#include "YUISymbols.h"
+
+#define VERBOSE_PARSER 0
+
+
+YItemCollection
+YCPMenuItemParser::parseMenuItemList( const YCPList & itemList )
+{
+ YItemCollection itemCollection;
+ itemCollection.reserve( itemList.size() );
+
+ try
+ {
+ for ( int i=0; i < itemList->size(); i++ )
+ {
+ YCPMenuItem * item = parseMenuItem( 0, // parent item
+ itemList->value(i) );
+ itemCollection.push_back( item );
+ }
+ }
+ catch ( YUIException & exception )
+ {
+ YItemIterator it = itemCollection.begin();
+
+ while ( it != itemCollection.end() )
+ {
+ // Delete all items created so far
+
+ YItem * item = *it;
+ ++it;
+ delete item;
+ }
+
+ throw;
+ }
+
+#if VERBOSE_PARSER
+ y2debug( "%d items", itemCollection.size() );
+#endif
+
+ return itemCollection;
+}
+
+
+
+YCPMenuItem *
+YCPMenuItemParser::parseMenuItem( YCPMenuItem * parent, const YCPValue & rawItem )
+{
+ YCPMenuItem * item = 0;
+
+#if VERBOSE_PARSER
+ y2debug( "Parsing: %s", rawItem->toString().c_str() );
+#endif
+
+ if ( rawItem->isTerm() &&
+ ( rawItem->asTerm()->name() == YUISymbol_item || // `item(...)
+ rawItem->asTerm()->name() == YUISymbol_menu ) ) // `menu(...)
+ {
+ item = parseMenuItem( parent, rawItem->asTerm() );
+ }
+ else // No term or neither `item(...) nor `menu(...)
+ {
+ YUI_THROW( YCPDialogSyntaxErrorException( "Expected `item(...)", rawItem ) );
+ }
+
+ return item;
+}
+
+
+YCPMenuItem *
+YCPMenuItemParser::parseMenuItem( YCPMenuItem * parent, const YCPTerm & itemTerm )
+{
+ YCPValue id = YCPNull();
+ YCPString iconName = YCPNull();
+ YCPString label = YCPNull();
+ YCPList subItemList = YCPNull();
+
+ const char * usage =
+ "Expected: `item(`id(`myID), `icon(\"MyIcon.png\"), \"MyItemText\", list subItemList )";
+
+#if VERBOSE_PARSER
+ y2debug( "Parsing: %s", itemTerm->toString().c_str() );
+#endif
+
+ for ( int i=0; i < itemTerm->size(); i++ )
+ {
+ YCPValue arg = itemTerm->value(i);
+
+#if VERBOSE_PARSER
+ y2debug( "Parsing term arg #%d: %s", i, arg->toString().c_str() );
+#endif
+
+ if ( arg->isTerm() ) // `id(), `icon()
+ {
+ YCPTerm term = arg->asTerm();
+
+ if ( term->size() != 1 ) // Both `id() and `icon() have 1 argument
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
+
+ if ( term->name() == YUISymbol_id // `id(...)
+ && id.isNull() ) // and don't have an ID yet
+ {
+ id = term->value(0);
+ }
+ else if ( term->name() == YUISymbol_icon // `icon(...)
+ && term->value(0)->isString() // with a string argument
+ && iconName.isNull() ) // and don't have an icon name yet
+ {
+ iconName = term->value(0)->asString();
+ }
+ else
+ {
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
+ }
+ }
+ else if ( arg->isString() // label (the user-visible text)
+ && label.isNull() ) // and don't have a label yet
+ {
+ label = arg->asString();
+ }
+ else if( arg->isList() // sub item list
+ && subItemList.isNull() ) // and don't have a sub item list yet
+ {
+ subItemList = arg->asList();
+ }
+ else
+ {
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
+ }
+ }
+
+ if ( label.isNull() ) // the label is required
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
+
+ if ( iconName.isNull() )
+ iconName = YCPString( "" );
+
+ if ( id.isNull() ) // no `id() ?
+ id = label; // use the label instead
+
+ YCPMenuItem * item = new YCPMenuItem( parent, label, id, iconName );
+ YUI_CHECK_NEW( item );
+
+ if ( ! subItemList.isNull() )
+ {
+ for ( int i=0; i < subItemList->size(); i++ )
+ {
+ parseMenuItem( item, subItemList->value(i) );
+ }
+ }
+
+ return item;
+}
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemParser.h Wed Oct 10 21:48:49 2007
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPMenuItemParser.h
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+#ifndef YCPMenuItemParser_h
+#define YCPMenuItemParser_h
+
+#include <ycp/YCPTerm.h>
+#include "YCPMenuItem.h"
+
+
+/**
+ * Parser for menu item lists
+ **/
+class YCPMenuItemParser
+{
+public:
+
+ /**
+ * Parse a menu item list:
+ *
+ * [
+ * `item(`id( `myID1 ), "Label1" ),
+ * `item(`id( `myID2 ), `icon( "icon2.png"), "Label2", ),
+ * `menu(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] ),
+ * `item(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] ),
+ * ]
+ *
+ * Return a list of newly created YItem-derived objects.
+ *
+ * This function throws exceptions if there are syntax errors.
+ **/
+ static YItemCollection parseMenuItemList( const YCPList & ycpItemList );
+
+
+ /**
+ * Parse one item and create a YCPMenuItem from it.
+ *
+ * This function throws exceptions if there are syntax errors.
+ **/
+ static YCPMenuItem * parseMenuItem( YCPMenuItem * parent, const YCPValue & item );
+
+protected:
+
+ /**
+ * Parse an item term:
+ *
+ * `item(`id( `myID1 ), "Label1" )
+ * `item(`id( `myID2 ), `icon( "icon2.png"), "Label2", )
+ * `menu(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] )
+ * `item(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] )
+ *
+ * Everything but the label is optional. If no ID is specified, the label
+ * will be used as ID, which might not be very useful if labels are translated.
+ *
+ * This function throws exceptions if there are syntax errors.
+ **/
+ static YCPMenuItem * parseMenuItem( YCPMenuItem * parent, const YCPTerm & itemTerm );
+
+
+};
+
+
+#endif // YCPMenuItemParser_h
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.cc (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.cc Wed Oct 10 21:48:49 2007
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPMenuItemWriter.cc
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+#include <ycp/YCPVoid.h>
+#include <ycp/YCPBoolean.h>
+#include "YCPMenuItemWriter.h"
+#include "YUISymbols.h"
+
+
+YCPList
+YCPMenuItemWriter::itemList( YItemConstIterator begin, YItemConstIterator end )
+{
+ YCPList itemList;
+
+ for ( YItemConstIterator it = begin; it != end; ++it )
+ {
+ const YMenuItem * item = dynamic_cast<const YMenuItem *> (*it);
+
+ if ( item )
+ {
+ itemList->add( itemTerm( item ) );
+ }
+ }
+
+ return itemList;
+}
+
+
+YCPValue
+YCPMenuItemWriter::itemTerm( const YMenuItem * item )
+{
+ if ( ! item )
+ return YCPVoid();
+
+ YCPTerm itemTerm( YUISymbol_item ); // `item()
+
+ const YCPMenuItem * ycpItem = dynamic_cast<const YCPMenuItem *> (item);
+
+ if ( ycpItem && ycpItem->hasId() )
+ {
+ YCPTerm idTerm( YUISymbol_id ); // `id()
+ idTerm->add( ycpItem->id() );
+ itemTerm->add( idTerm );
+ }
+
+ if ( item->hasIconName() )
+ {
+ YCPTerm iconTerm( YUISymbol_icon ); // `icon()
+ iconTerm->add( YCPString( item->iconName() ) );
+ itemTerm->add( iconTerm );
+ }
+
+ itemTerm->add( YCPString( item->label() ) ); // label
+
+ if ( item->hasChildren() ) // subItemList
+ itemTerm->add( itemList( item->childrenBegin(), item->childrenEnd() ) );
+
+ return itemTerm;
+}
+
+
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPMenuItemWriter.h Wed Oct 10 21:48:49 2007
@@ -0,0 +1,60 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPMenuItemWriter.h
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+#ifndef YCPMenuItemWriter_h
+#define YCPMenuItemWriter_h
+
+#include <ycp/YCPList.h>
+#include <ycp/YCPTerm.h>
+#include <ycp/YCPValue.h>
+
+#include "YCPMenuItem.h"
+
+
+/**
+ * Writer for menu item lists
+ **/
+class YCPMenuItemWriter
+{
+public:
+
+ /**
+ * Create a YCPList from a tree item collection:
+ *
+ * [
+ * `item(`id( `myID1 ), "Label1" ),
+ * `item(`id( `myID2 ), `icon( "icon2.png"), "Label2", ),
+ * `item(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] ),
+ * ]
+ **/
+ static YCPList itemList( YItemConstIterator begin, YItemConstIterator end );
+
+
+ /**
+ * Create a YCPTerm for one tree item:
+ *
+ * `item(`id( `myID1 ), "Label1" )
+ * `item(`id( `myID2 ), `icon( "icon2.png"), "Label2", )
+ * `item(`id( `myID3 ), `icon( "icon3.png"), "Label3", [ subMenuList ] )
+ **/
+ static YCPValue itemTerm( const YMenuItem * item );
+
+};
+
+
+#endif // YCPMenuItemWriter_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc Wed Oct 10 21:48:49 2007
@@ -38,21 +38,24 @@
#include "YCPTreeItem.h"
#include "YCPItemParser.h"
#include "YCPItemWriter.h"
-#include "YCPTreeItemParser.h"
-#include "YCPTreeItemWriter.h"
+#include "YCPMenuItemParser.h"
+#include "YCPMenuItemWriter.h"
#include "YCPTableItemParser.h"
#include "YCPTableItemWriter.h"
+#include "YCPTreeItemParser.h"
+#include "YCPTreeItemWriter.h"
#include "YCPValueWidgetID.h"
#include "YCheckBox.h"
#include "YComboBox.h"
-#include "YMultiSelectionBox.h"
+#include "YMenuButton.h"
#include "YMultiProgressMeter.h"
+#include "YMultiSelectionBox.h"
#include "YRadioButton.h"
#include "YRadioButtonGroup.h"
#include "YSelectionBox.h"
-#include "YTree.h"
#include "YTable.h"
+#include "YTree.h"
#include "YUISymbols.h"
using std::list;
@@ -87,8 +90,10 @@
}
else if ( propertyName == YUIProperty_Items )
{
- // Make sure to try YTree and YTable before YSelectionWidget: both inherit YSelectionWidget!
+ // Make sure to try YMenuButton, YTable, YTree, before YSelectionWidget:
+ // they all inherit YSelectionWidget!
+ if ( trySetMenuButtonItems ( widget, val ) ) return true;
if ( trySetTreeItems ( widget, val ) ) return true;
if ( trySetTableItems ( widget, val ) ) return true;
if ( trySetSelectionWidgetItems ( widget, val ) ) return true;
@@ -171,10 +176,12 @@
}
else if ( propertyName == YUIProperty_Items )
{
- // Make sure to try YTree and YTable before YSelectionWidget: both inherit YSelectionWidget!
+ // Make sure to try YMenuButton, YTable, YTree, before YSelectionWidget:
+ // they all inherit YSelectionWidget!
- val = tryGetTreeItems ( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetMenuButtonItems ( widget ); if ( ! val.isNull() ) return val;
val = tryGetTableItems ( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetTreeItems ( widget ); if ( ! val.isNull() ) return val;
val = tryGetSelectionWidgetItems( widget ); if ( ! val.isNull() ) return val;
}
@@ -380,6 +387,27 @@
bool
+YCPPropertyHandler::trySetMenuButtonItems( YWidget * widget, const YCPValue & val )
+{
+ YMenuButton * menuButton = dynamic_cast<YMenuButton *> (widget );
+
+ if ( ! menuButton )
+ return false;
+
+ if ( val->isList() )
+ {
+ menuButton->setItems( YCPMenuItemParser::parseMenuItemList( val->asList() ) );
+ return true;
+ }
+
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Items,
+ YOtherProperty ),
+ widget ) );
+ return false;
+}
+
+
+bool
YCPPropertyHandler::trySetTreeItems( YWidget * widget, const YCPValue & val )
{
YTree * tree = dynamic_cast<YTree *> (widget );
@@ -975,6 +1003,18 @@
YCPValue
+YCPPropertyHandler::tryGetMenuButtonItems( YWidget * widget )
+{
+ YMenuButton * menuButton = dynamic_cast<YMenuButton *> (widget);
+
+ if ( ! menuButton )
+ return YCPNull();
+
+ return YCPMenuItemWriter::itemList( menuButton->itemsBegin(), menuButton->itemsEnd() );
+}
+
+
+YCPValue
YCPPropertyHandler::tryGetTableItems( YWidget * widget )
{
YTable * table = dynamic_cast<YTable *> (widget);
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Wed Oct 10 21:48:49 2007
@@ -97,6 +97,7 @@
static bool trySetTreeValue ( YWidget * widget, const YCPValue & val );
static bool trySetTableValue ( YWidget * widget, const YCPValue & val );
static bool trySetComboBoxValue ( YWidget * widget, const YCPValue & val );
+ static bool trySetMenuButtonItems ( YWidget * widget, const YCPValue & val );
static bool trySetTreeItems ( YWidget * widget, const YCPValue & val );
static bool trySetTableItems ( YWidget * widget, const YCPValue & val );
static bool trySetTableCell ( YWidget * widget, const YCPTerm & propTerm, const YCPValue & val );
@@ -126,6 +127,7 @@
static YCPValue tryGetTableItem ( YWidget * widget, const YCPTerm & propertyTerm );
static YCPValue tryGetTableItems ( YWidget * widget );
static YCPValue tryGetTreeItems ( YWidget * widget );
+ static YCPValue tryGetMenuButtonItems ( YWidget * widget );
static YCPValue tryGetSelectionWidgetItems ( YWidget * widget );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YEvent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YEvent.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YEvent.cc Wed Oct 10 21:48:49 2007
@@ -24,6 +24,7 @@
#include <ycp/YCPString.h>
#include <ycp/YCPInteger.h>
#include "YWidget.h"
+#include "YCPMenuItem.h"
#include "YEvent.h"
#include "YCPValueWidgetID.h"
@@ -297,7 +298,7 @@
YCPMap map = YEvent::ycpEvent();
// Add ID
- map->add( YCPString( "ID" ), _id );
+ map->add( YCPString( "ID" ), id() );
return map;
}
@@ -305,8 +306,21 @@
YCPValue YSimpleEvent::userInput()
{
- return _id;
+ return id();
}
+
+YCPValue YMenuEvent::id() const
+{
+ if ( _menuItem )
+ {
+ YCPMenuItem * ycpMenuItem = dynamic_cast<YCPMenuItem *> (_menuItem);
+
+ if ( ycpMenuItem )
+ return ycpMenuItem->id();
+ }
+
+ return _id;
+}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YEvent.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YEvent.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YEvent.h Wed Oct 10 21:48:49 2007
@@ -24,13 +24,15 @@
#include <ycp/YCPValue.h>
#include <ycp/YCPMap.h>
#include <ycp/YCPSymbol.h>
+#include <ycp/YCPVoid.h>
using std::string;
class YWidget;
+class YMenuItem;
/**
- * @short Abstract base class for events to be returned upon UI::UserInput()
+ * Abstract base class for events to be returned upon UI::UserInput()
* and related.
**/
class YEvent
@@ -212,7 +214,7 @@
/**
- * @short abstract base class for events that just deal with an ID.
+ * Abstract base class for events that just deal with an ID.
**/
class YSimpleEvent: public YEvent
{
@@ -228,7 +230,7 @@
/**
* Returns the ID associated with this event.
**/
- YCPValue id() const { return _id; }
+ virtual YCPValue id() const { return _id; }
/**
* Constructs a YCP map to be returned upon UI::WaitForEvent().
@@ -253,15 +255,31 @@
/**
- * @short Event to be returned upon menu selection
+ * Event to be returned upon menu selection.
**/
class YMenuEvent: public YSimpleEvent
{
public:
- YMenuEvent( const YCPValue & id ) : YSimpleEvent( MenuEvent, id ) {}
- YMenuEvent( const char * id ) : YSimpleEvent( MenuEvent, id ) {}
- YMenuEvent( const string & id ) : YSimpleEvent( MenuEvent, id ) {}
+ YMenuEvent( YMenuItem * menuItem )
+ : YSimpleEvent( MenuEvent, YCPVoid() ),
+ _menuItem( menuItem )
+ {}
+
+ YMenuEvent( const YCPValue & id ) : YSimpleEvent( MenuEvent, id ), _menuItem(0) {}
+ YMenuEvent( const char * id ) : YSimpleEvent( MenuEvent, id ), _menuItem(0) {}
+ YMenuEvent( const string & id ) : YSimpleEvent( MenuEvent, id ), _menuItem(0) {}
+
+ /**
+ * Returns the ID associated with this event.
+ *
+ * Reimplemented from YSimpleEvent.
+ **/
+ virtual YCPValue id() const;
+
+protected:
+
+ YMenuItem * _menuItem;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.cc Wed Oct 10 21:48:49 2007
@@ -17,103 +17,45 @@
/-*/
-#include <ycp/YCPSymbol.h>
-#include <ycp/YCPBoolean.h>
#define y2log_component "ui"
#include <ycp/y2log.h>
#include "YUISymbols.h"
#include "YMenuButton.h"
+#include "YMenuItem.h"
-YMenuButton::YMenuButton( const YWidgetOpt & opt, YCPString label )
- : YWidget( opt )
- , label( label )
- , next_index(0)
+struct YMenuButtonPrivate
{
- toplevel_menu = new YMenu( YCPString( "" ) );
-}
+ YMenuButtonPrivate()
+ {}
+
+ int dummy;
+};
-void YMenuButton::setLabel( const YCPString & label )
+YMenuButton::YMenuButton( YWidget * parent, const string & label )
+ : YSelectionWidget( parent, label,
+ false ) // enforceSingleSelection
+ , priv( new YMenuButtonPrivate() )
{
- this->label = label;
+ YUI_CHECK_NEW( priv );
}
-YCPString YMenuButton::getLabel()
+YMenuButton::~YMenuButton()
{
- return label;
+ // NOP
}
-YCPValue YMenuButton::changeWidget( const YCPSymbol & property, const YCPValue & newvalue )
+void YMenuButton::addItems( const YItemCollection & itemCollection )
{
- string s = property->symbol();
-
- /**
- * @property string Label the text on the MenuButton
- */
- if ( s == YUIProperty_Label )
- {
- if ( newvalue->isString() )
- {
- setLabel( newvalue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "MenuButton: Invalid parameter %s for Label property. Must be string",
- newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
- else return YWidget::changeWidget( property, newvalue );
-}
-
-
-
-YCPValue YMenuButton::queryWidget( const YCPSymbol & property )
-{
- string s = property->symbol();
- if ( s == YUIProperty_Label ) return getLabel();
- else return YWidget::queryWidget( property );
-}
-
-
-
-void
-YMenuButton::addMenuItem( const YCPString & item_label,
- const YCPValue & item_id,
- YMenu * parent_menu )
-{
- YMenuItem * item = new YMenuItem( item_label, parent_menu, next_index++, item_id );
-
- if ( ! parent_menu )
- {
- parent_menu = toplevel_menu;
- }
- parent_menu->addMenuItem( item );
-
- items.push_back( item );
-}
-
-
-YMenu *
-YMenuButton::addSubMenu( const YCPString & sub_menu_label,
- YMenu * parent_menu )
-{
- YMenu * menu = new YMenu( sub_menu_label, parent_menu );
-
- if ( ! parent_menu )
- {
- parent_menu = toplevel_menu;
- }
- parent_menu->addMenuItem( menu );
-
- return menu;
+ YSelectionWidget::addItems( itemCollection );
+ resolveShortcutConflicts();
+ rebuildMenuTree();
}
@@ -132,50 +74,56 @@
}
-YCPValue
-YMenuButton::indexToId( int index )
+const YPropertySet &
+YMenuButton::propertySet()
{
- if ( index >= 0 && ( unsigned ) index < items.size() )
- {
- YCPValue id = items[ index ]->getId();
- y2debug( "Selected menu item with ID '%s'", id->toString().c_str() );
+ static YPropertySet propSet;
- return id;
- }
- else
+ if ( propSet.isEmpty() )
{
- y2error( "No menu item with index %d", index );
- return YCPVoid();
+ /*
+ * @property string Label Label on the menu button
+ * @property itemList Items All menu items and submenus
+ * @property string IconPath Base path for icons (on menu items)
+ */
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_Items, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_IconPath, YStringProperty ) );
+ propSet.add( YWidget::propertySet() );
}
-}
-
-
-YMenuItem::YMenuItem( const YCPString & label,
- YMenu * parent_menu,
- int index,
- const YCPValue & id )
- : label( label )
- , id( id )
- , parent( parent_menu )
- , index( index )
-{
+ return propSet;
}
-YMenu::YMenu( const YCPString & label,
- YMenu * parent_menu,
- int index,
- const YCPValue & id )
- : YMenuItem( label, parent_menu, index, id )
+bool
+YMenuButton::setProperty( const string & propertyName, const YPropertyValue & val )
{
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() );
+ else if ( propertyName == YUIProperty_Items ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_IconPath ) setIconBasePath( val.stringVal() );
+ else
+ {
+ return YWidget::setProperty( propertyName, val );
+ }
+ return true; // success -- no special processing necessary
}
-void
-YMenu::addMenuItem( YMenuItem *item )
+YPropertyValue
+YMenuButton::getProperty( const string & propertyName )
{
- items.push_back( item );
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() );
+ else if ( propertyName == YUIProperty_Items ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_IconPath ) return YPropertyValue( iconBasePath() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMenuButton.h Wed Oct 10 21:48:49 2007
@@ -19,223 +19,113 @@
#ifndef YMenuButton_h
#define YMenuButton_h
-#include "YWidget.h"
-#include <ycp/YCPString.h>
-#include <ycp/YCPVoid.h>
+#include "YSelectionWidget.h"
-class YMenu;
+class YMacroRecorder;
class YMenuItem;
+class YMenuButtonPrivate;
-typedef vector<YMenuItem *> YMenuItemList;
-typedef vector<YMenuItem *>::iterator YMenuItemListIterator;
-typedef vector<YMenuItem *>::const_iterator YMenuItemListConstIterator;
-
-class YMenuButton : public YWidget
+/**
+ * MenuButton: Similar to PushButton, but with several actions: Upon clicking
+ * on a MenuButton (or activating it with the keyboard), a pop-up menu opens
+ * where the user can activate an action. Menu items in that pop-up menu can
+ * have submenus (that will pop up in separate pop-up menus).
+ *
+ * Internally, this widget is more similar to the Tree widget. The difference
+ * is that it does not keep a "selected" status, but triggers an action right
+ * away, just like a PushButton. Like PushButton, MenuButton sends an event
+ * right away when the user selects an item (clicks on a menu item or activates
+ * it with the keyboard). Items that have a submenu never send an event, they
+ * simply open their submenu when activated.
+ **/
+class YMenuButton : public YSelectionWidget
{
protected:
/**
- * Constructor
- * @param opt widget options
- * @param label the button label
+ * Constructor.
+ *
+ * 'label' is the user-visible text on the button (not above it like all
+ * other SelectionWidgets).
**/
- YMenuButton( const YWidgetOpt & opt, YCPString label );
+ YMenuButton( YWidget * parent, const string & label );
public:
/**
+ * Destructor.
+ **/
+ virtual ~YMenuButton();
+
+ /**
* Returns a descriptive name of this widget class for logging,
* debugging etc.
**/
virtual const char * widgetClass() const { return "YMenuButton"; }
/**
- * Implements the ui command changeWidget for the widget specific
- * properties.
- **/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
-
- /**
- * Implements the ui command changeWidget for the widget specific
- * properties.
- **/
- YCPValue queryWidget( const YCPSymbol & property );
-
- /**
- * change the label of the push button. Overload this, but call
- * YMenuButton::setLabel at the end of your own function.
- **/
- virtual void setLabel( const YCPString & label );
-
- /**
- * Get the current label of the MenuButton entry. This method cannot be
- * overidden. The value of the label cannot be changed other than by
- * calling setLabel, i.e. not by the ui. Therefore setLabel stores the
- * current label in label.
- **/
- YCPString getLabel();
-
- /**
- * Get the MenuButton's toplevel menu.
- **/
- YMenu * getToplevelMenu() { return toplevel_menu; }
-
-
- /**
- * Add one menu item.
+ * Rebuild the displayed menu tree from the internally stored YMenuItems.
*
- * Pass 0 for 'parent_menu' to add this item to the MenuButton's toplevel
- * menu.
- **/
- void addMenuItem( const YCPString & item_label,
- const YCPValue & item_id,
- YMenu * parent_menu = 0 );
-
- /**
- * Add a submenu.
+ * The application should call this (once) after all items have been added
+ * with addItem(). YMenuButton::addItems() calls this automatically.
*
- * Pass 0 for 'parent_menu' to add this submenu to the MenuButton's toplevel
- * menu.
+ * Derived classes are required to implement this.
**/
- YMenu * addSubMenu( const YCPString & sub_menu_label,
- YMenu * parent_menu = 0 );
+ virtual void rebuildMenuTree() = 0;
/**
- * Retrieve the corresponding application ID to an internal menu item
- * index.
+ * Add multiple items. For some UIs, this can be more efficient than
+ * calling addItem() multiple times. This function also automatically calls
+ * resolveShortcutConflicts() and rebuildMenuTree() at the end.
+ *
+ * Derived classes can overwrite this function, but they should call this
+ * base class function at the end of the new implementation.
+ *
+ * Reimplemented from YSelectionWidget.
**/
- YCPValue indexToId( int index );
-
+ virtual void addItems( const YItemCollection & itemCollection );
/**
* Resolve keyboard shortcut conflicts: Change shortcuts of menu items if
* there are duplicates in the respective menu level.
*
- * This has to be called after all items are added, but before createMenu()
- * (see below).
+ * This has to be called after all items are added, but before rebuildMenuTree()
+ * (see above). YMenuButton::addItems() calls this automatically.
**/
void resolveShortcutConflicts();
/**
- * Actually create the menu hierarchy in the specific UI.
- * This is called when the complete menu hierarchy is known.
+ * Set a property.
+ * Reimplemented from YWidget.
+ *
+ * This function may throw YUIPropertyExceptions.
*
- * Overwrite this method.
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
**/
- virtual void createMenu() = 0;
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
/**
- * Get the string of this widget that holds the keyboard shortcut.
- *
+ * Get a property.
* Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
**/
- virtual string shortcutString() { return getLabel()->value(); }
+ virtual YPropertyValue getProperty( const string & propertyName );
/**
- * Set the string of this widget that holds the keyboard shortcut.
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
*
* Reimplemented from YWidget.
**/
- virtual void setShortcutString( const string & str )
- { setLabel( YCPString( str ) ); }
-
-
-
-protected:
- /**
- * The button label
- **/
- YCPString label;
-
- /**
- * The next ( free ) item ID to use
- **/
- int next_index;
-
- /**
- * List of all items somewhere in the menu hierarchy.
- **/
- YMenuItemList items;
-
- /**
- * The top level menu
- **/
- YMenu * toplevel_menu;
-};
-
-
-/**
- * Helper class for menu items.
- *
- * This class provides the infrastructure for managing children
- * ( i.e. submenus ), yet it doesn't actually handle such children. Derived
- * classes may choose to do this.
- **/
-class YMenuItem
-{
-public:
-
- /**
- * Constructor.
- **/
- YMenuItem( const YCPString & label,
- YMenu * parent_menu = 0,
- int index = -1,
- const YCPValue & id = YCPVoid() );
-
- virtual ~YMenuItem() {}
-
-
- const YMenu * getParent() const { return parent; }
- const YCPValue & getId() const { return id; }
- int getIndex() const { return index; }
- const YCPString & getLabel() const { return label; }
- virtual bool hasChildren() const { return false; }
- YMenuItemList & itemList() { return items; }
- virtual bool isMenu() const { return false; }
-
- /**
- * Set this menu item's label. This will NOT have any immediate
- * visual effect with this base class method - it only stores the new label
- * for later retrieval. If a visual effect is desired, derived classes
- * should overwrite this method. Don't forget to call this base class
- * method in that case!
- **/
- virtual void setLabel( YCPString newLabel ) { label = newLabel; }
-
-
-protected:
-
- YCPString label;
- YCPValue id;
- YMenu * parent;
- int index;
- YMenuItemList items;
-};
-
-
-/**
- * Helper class for menus.
- *
- * Derived from @ref YMenuItem; this class can actually handle children.
- **/
-class YMenu: public YMenuItem
-{
-public:
-
- /**
- * Constructor
- **/
- YMenu( const YCPString & label,
- YMenu * parent_menu = 0,
- int index = -1,
- const YCPValue & id = YCPVoid() );
+ virtual const YPropertySet & propertySet();
- virtual ~YMenu() {}
+private:
- virtual bool hasChildren() const { return items.size() > 0; }
- void addMenuItem( YMenuItem *item );
- virtual bool isMenu() const { return true; }
+ ImplPtr<YMenuButtonPrivate> priv;
};
Added: branches/tmp/sh/mod-ui/core/libyui/src/YMenuItem.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YMenuItem.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YMenuItem.h Wed Oct 10 21:48:49 2007
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YMenuItem.h
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+#ifndef YMenuItem_h
+#define YMenuItem_h
+
+#include "YTreeItem.h"
+
+using std::string;
+using std::vector;
+
+
+/**
+ * Item class for menu items.
+ **/
+class YMenuItem: public YTreeItem
+{
+public:
+ /**
+ * Constructors for toplevel items.
+ **/
+ YMenuItem( const string & label )
+ : YTreeItem( label )
+ {}
+
+ YMenuItem( const string & label,
+ const string & iconName )
+ : YTreeItem( label, iconName )
+ {}
+
+ /**
+ * Constructors for items that have a parent item.
+ *
+ * They will automatically register this item with the parent item. The
+ * parent assumes ownership of this item and will delete it in its (the
+ * parent's) destructor.
+ **/
+ YMenuItem( YMenuItem * parent,
+ const string & label )
+ : YTreeItem( parent, label )
+ {}
+
+ YMenuItem( YMenuItem * parent,
+ const string & label,
+ const string & iconName )
+ : YTreeItem( parent, label, iconName )
+ {}
+
+ /**
+ * Destructor.
+ *
+ * This will delete all children.
+ **/
+ virtual ~YMenuItem() {}
+
+
+ /**
+ * Returns this item's parent item or 0 if it is a toplevel item.
+ **/
+ YMenuItem * parent() const
+ { return dynamic_cast<YMenuItem *> ( YTreeItem::parent() ); }
+
+
+private:
+
+ // Disable unwanted base class methods
+
+ bool isOpen() const { return false; }
+ void setOpen( bool ) {}
+};
+
+
+#endif // YMenuItem_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc Wed Oct 10 21:48:49 2007
@@ -55,7 +55,8 @@
}
-void YTree::addItems( const YItemCollection & itemCollection )
+void
+YTree::addItems( const YItemCollection & itemCollection )
{
YSelectionWidget::addItems( itemCollection );
rebuildTree();
@@ -75,7 +76,7 @@
* @property list<itemID> CurrentBranch List of IDs of current branch from root to current item
* @property itemList Items All items
* @property map<ItemID> OpenItems Map of IDs of all open items - can only be queried, not set
- * @property string Label caption above the tree
+ * @property string Label Caption above the tree
* @property string IconPath Base path for icons
*/
propSet.add( YProperty( YUIProperty_Value, YOtherProperty ) );
@@ -132,7 +133,8 @@
}
-void YTree::saveUserInput( YMacroRecorder *macroRecorder )
+void
+YTree::saveUserInput( YMacroRecorder *macroRecorder )
{
macroRecorder->recordWidgetProperty( this, YUIProperty_CurrentItem );
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTreeItem.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTreeItem.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTreeItem.h Wed Oct 10 21:48:49 2007
@@ -37,11 +37,11 @@
* Constructors for toplevel items.
**/
YTreeItem( const string & label,
- bool isOpen );
+ bool isOpen = false );
YTreeItem( const string & label,
const string & iconName,
- bool isOpen );
+ bool isOpen = false );
/**
* Constructors for items that have a parent item.
@@ -52,12 +52,12 @@
**/
YTreeItem( YTreeItem * parent,
const string & label,
- bool isOpen );
+ bool isOpen = false );
YTreeItem( YTreeItem * parent,
const string & label,
const string & iconName,
- bool isOpen );
+ bool isOpen = false );
/**
* Destructor.
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Wed Oct 10 21:48:49 2007
@@ -453,7 +453,6 @@
// FIXME: Obsolete
public:
virtual YDialog *createDialog( YWidgetOpt & opt ) = 0;
- virtual YWidget *createMenuButton( YWidget *parent, YWidgetOpt & opt, const YCPString & label ) = 0;
// FIXME: Obsolete
// FIXME: Obsolete
// FIXME: Obsolete
Modified: branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQComboB…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc Wed Oct 10 21:48:49 2007
@@ -109,7 +109,7 @@
icon = QPixmap( iconName.c_str() );
if ( icon.isNull() )
- y2error( "Can't load icon %s", iconName.c_str() );
+ y2warning( "Can't load icon %s", iconName.c_str() );
}
if ( icon.isNull() )
Modified: branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQMenuBu…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQMenuButton.cc Wed Oct 10 21:48:49 2007
@@ -17,9 +17,9 @@
/-*/
-#include <unistd.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
+#include <qiconset.h>
#include <qsize.h>
#include <qtimer.h>
#define y2log_component "qt-ui"
@@ -28,142 +28,227 @@
#include "utf8.h"
#include "YQUI.h"
#include "YQMenuButton.h"
-
-// Include low-level X headers AFTER Qt headers:
-// X.h pollutes the global namespace (!!!) with pretty useless #defines
-// like "Above", "Below" etc. that clash with some Qt headers.
+#include "YMenuItem.h"
#include "YEvent.h"
-YQMenuButton::YQMenuButton( QWidget * parent,
- const YWidgetOpt & opt,
- YCPString label )
- : QWidget( parent )
- , YMenuButton( opt, label )
- , _selected_item_index( -1 )
+
+YQMenuButton::YQMenuButton( YWidget * parent,
+ const string & label )
+ : QWidget( (QWidget *) parent->widgetRep() )
+ , YMenuButton( parent, label )
+ , _nextSerialNo( 0 )
+ , _selectedItem( 0 )
{
setWidgetRep( this );
- _qt_pushbutton = new QPushButton( fromUTF8( label->value() ), this );
- _qt_pushbutton->setMinimumSize( 2,2 );
- _qt_pushbutton->move( YQButtonBorder, YQButtonBorder );
- setMinimumSize( _qt_pushbutton->minimumSize()
+ _qt_button = new QPushButton( fromUTF8( label ), this );
+ // _qt_button->setMinimumSize( 2,2 );
+ _qt_button->move( YQButtonBorder, YQButtonBorder );
+ setMinimumSize( _qt_button->minimumSize()
+ 2 * QSize( YQButtonBorder, YQButtonBorder ) );
}
-void
-YQMenuButton::setEnabled( bool enabled )
+
+YQMenuButton::~YQMenuButton()
{
- _qt_pushbutton->setEnabled( enabled );
- YWidget::setEnabled( enabled );
+ // NOP
}
-int YQMenuButton::preferredWidth()
+void
+YQMenuButton::setLabel( const string & label )
{
- return 2*YQButtonBorder + _qt_pushbutton->sizeHint().width();
+ _qt_button->setText( fromUTF8( label ) );
+ YMenuButton::setLabel( label );
}
-int YQMenuButton::preferredHeight()
+void
+YQMenuButton::rebuildMenuTree()
{
- return 2*YQButtonBorder + _qt_pushbutton->sizeHint().height();
+ //
+ // Delete any previous menu
+ // (in case the menu items got replaced)
+ //
+
+ if ( _qt_button->popup() )
+ delete _qt_button->popup();
+
+ //
+ // Create toplevel menu
+ //
+
+ QPopupMenu * menu = new QPopupMenu( _qt_button );
+ YUI_CHECK_NEW( menu );
+ _qt_button->setPopup( menu );
+
+ connect( menu, SIGNAL( activated ( int ) ),
+ this, SLOT ( menuEntryActivated( int ) ) );
+
+ //
+ // Recursively add Qt menu items from the YMenuItems
+ //
+
+ _nextSerialNo = 0;
+ rebuildMenuTree( menu, itemsBegin(), itemsEnd() );
}
void
-YQMenuButton::setSize( int newWidth, int newHeight )
+YQMenuButton::rebuildMenuTree( QPopupMenu * parentMenu, YItemIterator begin, YItemIterator end )
{
- _qt_pushbutton->resize( newWidth - 2 * YQButtonBorder,
- newHeight - 2 * YQButtonBorder );
- resize( newWidth, newHeight );
+ for ( YItemIterator it = begin; it != end; ++it )
+ {
+ YMenuItem * item = dynamic_cast<YMenuItem *> (*it);
+ YUI_CHECK_PTR( item );
+
+ QPixmap icon;
+
+ if ( item->hasIconName() )
+ {
+ string iconName = iconFullPath( item );
+ icon = QPixmap( iconName.c_str() );
+
+ if ( icon.isNull() )
+ y2warning( "Can't load icon %s", iconName.c_str() );
+ }
+
+ if ( item->hasChildren() )
+ {
+ QPopupMenu * subMenu = new QPopupMenu( parentMenu );
+ YUI_CHECK_NEW( subMenu );
+
+ if ( icon.isNull() )
+ parentMenu->insertItem( fromUTF8( item->label() ), subMenu );
+ else
+ parentMenu->insertItem( QIconSet( icon ), fromUTF8( item->label() ), subMenu );
+
+ connect( subMenu, SIGNAL( activated ( int ) ),
+ this, SLOT ( menuEntryActivated( int ) ) );
+
+ rebuildMenuTree( subMenu, item->childrenBegin(), item->childrenEnd() );
+ }
+ else // No children - leaf entry
+ {
+ item->setData( (void *) ++_nextSerialNo );
+
+ if ( icon.isNull() )
+ parentMenu->insertItem( fromUTF8( item->label() ), _nextSerialNo );
+ else
+ parentMenu->insertItem( QIconSet( icon ), fromUTF8( item->label() ), _nextSerialNo );
+ }
+ }
}
-void
-YQMenuButton::setLabel( const YCPString & label )
+YMenuItem *
+YQMenuButton::findMenuItem( int serialNo )
{
- _qt_pushbutton->setText( fromUTF8( label->value() ) );
+ return findMenuItem( serialNo, itemsBegin(), itemsEnd() );
}
-bool
-YQMenuButton::setKeyboardFocus()
+YMenuItem *
+YQMenuButton::findMenuItem( int serialNo, YItemConstIterator begin, YItemConstIterator end )
{
- _qt_pushbutton->setFocus();
+ for ( YItemConstIterator it = begin; it != end; ++it )
+ {
+ YMenuItem * item = dynamic_cast<YMenuItem *> (*it);
- return true;
+ if ( item )
+ {
+ if ( item->data() == (void *) serialNo )
+ return item;
+
+ if ( item->hasChildren() )
+ {
+ YMenuItem * result = findMenuItem( serialNo, item->childrenBegin(), item->childrenEnd() );
+
+ if ( result )
+ return result;
+ }
+ }
+ }
+
+ return 0;
}
void
-YQMenuButton::menuEntryActivated( int menu_item_index )
+YQMenuButton::menuEntryActivated( int serialNo )
{
// y2debug( "Selected menu entry #%d", menu_item_index );
- _selected_item_index = menu_item_index;
-
- /*
- * Defer the real returnNow() until all popup related events have been
- * processed. This took me some hours to figure out; obviously exit_loop()
- * doesn't have any effect as long as there are still popups open. So be it
- * - use a zero timer to perform the real returnNow() later.
- */
-
- /*
- * the 100 delay is a ugly dirty workaround
- */
- QTimer::singleShot( 100, this, SLOT( returnNow() ) );
+ _selectedItem = findMenuItem( serialNo );
- // YQUI::ui()->wakeUpGuiThread();
- // YQUI::ui()->processEvents();
+ if ( _selectedItem )
+ {
+ /*
+ * Defer the real returnNow() until all popup related events have been
+ * processed. This took me some hours to figure out; obviously
+ * exit_loop() doesn't have any effect as long as there are still
+ * popups open. So be it - use a zero timer to perform the real
+ * returnNow() later.
+ */
+
+ /*
+ * the 100 delay is a ugly dirty workaround
+ */
+ QTimer::singleShot( 100, this, SLOT( returnNow() ) );
+ }
+ else
+ {
+ y2error( "No menu item with serial no. %d", serialNo );
+ }
}
void
YQMenuButton::returnNow()
{
- YQUI::ui()->sendEvent( new YMenuEvent( indexToId( _selected_item_index ) ) );
+ if ( _selectedItem )
+ {
+ YQUI::ui()->sendEvent( new YMenuEvent( _selectedItem ) );
+ _selectedItem = 0;
+ }
}
+
void
-YQMenuButton::createMenu()
+YQMenuButton::setEnabled( bool enabled )
{
- QPopupMenu * popup = new QPopupMenu( _qt_pushbutton );
- _qt_pushbutton->setPopup( popup );
- connect( popup, SIGNAL( activated(int) ),
- this, SLOT ( menuEntryActivated(int) ) );
+ _qt_button->setEnabled( enabled );
+ YWidget::setEnabled( enabled );
+}
- createMenu( getToplevelMenu(), popup );
+
+int YQMenuButton::preferredWidth()
+{
+ return 2*YQButtonBorder + _qt_button->sizeHint().width();
}
-void
-YQMenuButton::createMenu( YMenuItem * ymenu, QPopupMenu * qt_menu )
+int YQMenuButton::preferredHeight()
{
- YMenuItemListIterator it = ymenu->itemList().begin();
+ return 2*YQButtonBorder + _qt_button->sizeHint().height();
+}
- while ( it != ymenu->itemList().end() )
- {
- YMenuItem * item = *it;
- if ( item->isMenu() )
- {
- QPopupMenu * sub_menu = new QPopupMenu( qt_menu );
- // y2debug( "Inserting sub menu '%s'", item->getLabel()->value().c_str() );
- qt_menu->insertItem( fromUTF8( item->getLabel()->value() ), sub_menu );
- connect( sub_menu, SIGNAL( activated(int) ),
- this, SLOT ( menuEntryActivated(int) ) );
- createMenu( item, sub_menu );
+void
+YQMenuButton::setSize( int newWidth, int newHeight )
+{
+ _qt_button->resize( newWidth - 2 * YQButtonBorder,
+ newHeight - 2 * YQButtonBorder );
+ resize( newWidth, newHeight );
+}
- }
- else // simple menu item, no submenu
- {
- // y2debug( "Inserting menu item '%s'", item->getLabel()->value().c_str() );
- qt_menu->insertItem( fromUTF8( item->getLabel()->value() ), item->getIndex() );
- }
- ++it;
- }
+bool
+YQMenuButton::setKeyboardFocus()
+{
+ _qt_button->setFocus();
+
+ return true;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQMenuBu…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQMenuButton.h Wed Oct 10 21:48:49 2007
@@ -37,16 +37,34 @@
/**
* Constructor.
**/
- YQMenuButton( QWidget * parent,
- const YWidgetOpt & opt,
- YCPString label );
+ YQMenuButton( YWidget * parent,
+ const string & label );
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
+ * Destructor.
**/
- void setEnabled( bool enabled );
+ virtual ~YQMenuButton();
+
+ /**
+ * Change the label on the button.
+ *
+ * Reimplemented from YMenuButton / YSelectionWidget.
+ **/
+ virtual void setLabel( const string & label );
+
+ /**
+ * Rebuild the displayed menu tree from the internally stored YMenuItems.
+ *
+ * Implemented from YMenuButton.
+ **/
+ virtual void rebuildMenuTree();
+
+ /**
+ * Set enabled / disabled state.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
@@ -68,35 +86,19 @@
* Reimplemented from YWidget.
**/
virtual void setSize( int newWidth, int newHeight );
-
- /**
- * Changes the label of the button
- **/
- void setLabel( const YCPString & label );
-
+
/**
* Accept the keyboard focus.
**/
virtual bool setKeyboardFocus();
- /**
- * Actually create the menu structure.
- *
- * Reimplemented - inherited from YMenuButton.
- **/
- virtual void createMenu();
-
- /**
- * Recursively create the menu structure.
- **/
- void createMenu( YMenuItem * ymenu, QPopupMenu * _qt_menu );
protected slots:
/**
* Triggered when any menu item is activated.
**/
- void menuEntryActivated( int menu_item_index );
+ void menuEntryActivated( int menuItemIndex );
/**
* Triggered via menuEntryActivated() by zero timer to get back in sync
@@ -107,8 +109,30 @@
protected:
- QPushButton * _qt_pushbutton;
- int _selected_item_index;
+ /**
+ * Recursively insert menu items into 'menu' from iterator 'begin' to iterator 'end'.
+ **/
+ void rebuildMenuTree( QPopupMenu * menu, YItemIterator begin, YItemIterator end );
+
+ /**
+ * Recursively find the first menu item with the specified serial no.
+ **/
+ YMenuItem * findMenuItem( int serialNo );
+
+ /**
+ * Recursively find the first menu item with the specified serial no
+ * from iterator 'begin' to iterator 'end'.
+ **/
+ YMenuItem * findMenuItem( int serialNo, YItemConstIterator begin, YItemConstIterator end );
+
+
+ //
+ // Data members
+ //
+
+ int _nextSerialNo;
+ YMenuItem * _selectedItem;
+ QPushButton * _qt_button;
};
#endif // YQMenuButton_h
Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSelect…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc Wed Oct 10 21:48:49 2007
@@ -101,7 +101,7 @@
icon = QPixmap( iconName.c_str() );
if ( icon.isNull() )
- y2error( "Can't load icon %s", iconName.c_str() );
+ y2warning( "Can't load icon %s", iconName.c_str() );
}
if ( icon.isNull() )
Modified: branches/tmp/sh/mod-ui/qt/src/YQTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQTable.…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQTable.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQTable.cc Wed Oct 10 21:48:49 2007
@@ -319,7 +319,7 @@
QPixmap icon = QPixmap( iconName.c_str() );
if ( icon.isNull() )
- y2error( "Can't load icon %s", iconName.c_str() );
+ y2warning( "Can't load icon %s", iconName.c_str() );
else
setPixmap( column, icon );
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQTree.c…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQTree.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQTree.cc Wed Oct 10 21:48:49 2007
@@ -299,7 +299,7 @@
QPixmap icon( iconName.c_str() );
if ( icon.isNull() )
- y2error( "Can't load icon %s", iconName.c_str() );
+ y2warning( "Can't load icon %s", iconName.c_str() );
else
setPixmap( 0, icon );
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI.h?r…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI.h Wed Oct 10 21:48:49 2007
@@ -430,11 +430,6 @@
bool autoFonts() const { return _auto_fonts; }
- /*** Widget creation methods, all reimplemented from YUI ***/
-
- YWidget * createMenuButton ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
-
-
/*** Widget creation methods for optional widgets, all reimplemented from YUI ***/
bool hasBarGraph();
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI_wid…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc Wed Oct 10 21:48:49 2007
@@ -22,22 +22,16 @@
#include "YQUI.h"
#include "YQBarGraph.h"
-#include "YQCheckBox.h"
#include "YQDate.h"
#include "YQDialog.h"
#include "YQDownloadProgress.h"
#include "YQDumbTab.h"
#include "YQIntField.h"
-#include "YQMenuButton.h"
#include "YQMultiProgressMeter.h"
#include "YQPackageSelectorPlugin.h"
#include "YQPartitionSplitter.h"
-#include "YQPatternSelector.h"
-#include "YQSimplePatchSelector.h"
#include "YQSlider.h"
-#include "YQTable.h"
#include "YQTime.h"
-#include "YQTree.h"
@@ -59,14 +53,6 @@
}
-YWidget * YQUI::createMenuButton ( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & label )
-{
- return new YQMenuButton( (QWidget *) ( parent->widgetRep() ), opt, label);
-}
-
-
//========= Optional widgets ========================================================
Modified: branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWidget…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc Wed Oct 10 21:48:49 2007
@@ -232,7 +232,10 @@
YQMenuButton *
YQWidgetFactory::createMenuButton( YWidget * parent, const string & label )
{
- return 0; // FIXME: TO DO
+ YQMenuButton * menuButton = new YQMenuButton( parent, label );
+ YUI_CHECK_NEW( menuButton );
+
+ return menuButton;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0