Author: aschnell
Date: Tue Mar 4 15:44:22 2008
New Revision: 45187
URL: http://svn.opensuse.org/viewcvs/yast?rev=45187&view=rev
Log:
- added loop and dm panels
Added:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp
branches/tmp/aschnell/part-redesign/storage/src/modules/Partitions.ycp
branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp
Added: branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp?rev=45187&view=auto
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp (added)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp Tue Mar 4 15:44:22 2008
@@ -0,0 +1,67 @@
+/**
+ * File: ep-dm.ycp
+ * Package: yast2-storage
+ * Summary: Expert Partitioner
+ * Authors: Arvin Schnell
+ *
+ */
+{
+ textdomain "storage";
+
+
+ void CreateDmMainPanel(any user_data)
+ {
+ UI::ReplaceWidget(`tree_panel,
+ `VBox(
+ `HStretch(),
+ `Left(`Heading("Device Mapper (DM)")),
+ `VStretch()
+ )
+ );
+
+ Wizard::RestoreHelp("Help about Device Mapper");
+ }
+
+
+ void HandleDmMainPanel(any user_data, any widget)
+ {
+ }
+
+
+ void CreateDmPanel(any user_data)
+ {
+ string part_device = (string) user_data;
+
+ map target_map = Storage::GetTargetMap();
+
+ list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `fs_type ]);
+
+ UI::ReplaceWidget(`tree_panel,
+ `VBox(
+ `Left(`Heading("DM: " + part_device)),
+ `HStretch(),
+ StorageFields::Overview(fields, target_map, part_device),
+ `VStretch(),
+ `HBox(
+ `PushButton(`id(`edit), "Edit..."),
+ `HStretch()
+ )
+ )
+ );
+ }
+
+
+ void HandleDmPanel(any user_data, any widget)
+ {
+ string part_device = (string) user_data;
+
+ switch ((symbol) widget)
+ {
+ case `edit:
+ break;
+
+ case `delete:
+ break;
+ }
+ }
+}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp Tue Mar 4 15:44:22 2008
@@ -13,7 +13,7 @@
include "partitioning/ep-hd-lib.ycp";
- void CreateHdPanel(any user_data)
+ void CreateHdMainPanel(any user_data)
{
UI::ReplaceWidget(`tree_panel,
`VBox(
@@ -29,7 +29,7 @@
}
- void HandleHdPanel(any user_data, any widget)
+ void HandleHdMainPanel(any user_data, any widget)
{
if (widget == `rescan)
{
Added: branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp?rev=45187&view=auto
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp (added)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp Tue Mar 4 15:44:22 2008
@@ -0,0 +1,76 @@
+/**
+ * File: ep-loop.ycp
+ * Package: yast2-storage
+ * Summary: Expert Partitioner
+ * Authors: Arvin Schnell
+ *
+ */
+{
+ textdomain "storage";
+
+
+ void CreateLoopMainPanel(any user_data)
+ {
+ UI::ReplaceWidget(`tree_panel,
+ `VBox(
+ `HStretch(),
+ `Left(`Heading("Crypt Files")),
+ `VBox(
+ `PushButton(`id(`create_loop), "Create Crypt File...")
+ ),
+ `VStretch()
+ )
+ );
+
+ Wizard::RestoreHelp("Help about Crypt Files");
+ }
+
+
+ void HandleLoopMainPanel(any user_data, any widget)
+ {
+ switch ((symbol) widget)
+ {
+ case `create_loop:
+ break;
+ }
+ }
+
+
+ void CreateLoopPanel(any user_data)
+ {
+ string part_device = (string) user_data;
+
+ map target_map = Storage::GetTargetMap();
+
+ list<symbol> fields = StorageFields::Filter([ `mount_point, `size, `fs_type, `file_path ]);
+
+ UI::ReplaceWidget(`tree_panel,
+ `VBox(
+ `Left(`Heading("Crypt File: " + part_device)),
+ `HStretch(),
+ StorageFields::Overview(fields, target_map, part_device),
+ `VStretch(),
+ `HBox(
+ `PushButton(`id(`edit), "Edit..."),
+ `PushButton(`id(`delete), "Delete..."),
+ `HStretch()
+ )
+ )
+ );
+ }
+
+
+ void HandleLoopPanel(any user_data, any widget)
+ {
+ string part_device = (string) user_data;
+
+ switch ((symbol) widget)
+ {
+ case `edit:
+ break;
+
+ case `delete:
+ break;
+ }
+ }
+}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp Tue Mar 4 15:44:22 2008
@@ -12,7 +12,7 @@
include "partitioning/ep-lvm-dialogs.ycp";
- void CreateLvmPanel(any user_data)
+ void CreateLvmMainPanel(any user_data)
{
UI::ReplaceWidget(`tree_panel,
`VBox(
@@ -30,7 +30,7 @@
}
- void HandleLvmPanel(any user_data, any widget)
+ void HandleLvmMainPanel(any user_data, any widget)
{
if (widget == `create_vg)
{
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Tue Mar 4 15:44:22 2008
@@ -45,6 +45,8 @@
include "partitioning/ep-hd.ycp";
include "partitioning/ep-lvm.ycp";
include "partitioning/ep-raid.ycp";
+ include "partitioning/ep-loop.ycp";
+ include "partitioning/ep-dm.ycp";
include "partitioning/ep-nfs.ycp";
include "partitioning/ep-settings.ycp";
@@ -54,9 +56,11 @@
list<term> MakeNavigationTree()
{
data = $[ `all : $[ `create : CreateAllPanel, `handle : HandleAllPanel, `save : SaveAllPanel ],
- `hd : $[ `create : CreateHdPanel, `handle : HandleHdPanel ],
- `lvm : $[ `create : CreateLvmPanel, `handle : HandleLvmPanel ],
+ `hd : $[ `create : CreateHdMainPanel, `handle : HandleHdMainPanel ],
+ `lvm : $[ `create : CreateLvmMainPanel, `handle : HandleLvmMainPanel ],
`md : $[ `create : CreateRaidMainPanel, `handle : HandleRaidMainPanel ],
+ `loop : $[ `create : CreateLoopMainPanel, `handle : HandleLoopMainPanel ],
+ `dm : $[ `create : CreateDmMainPanel, `handle : HandleDmMainPanel ],
`nfs : $[ `create : CreateNfsMainPanel, `handle : HandleNfsMainPanel ],
`settings : $[ `create : CreateSettingsPanel, `save : SaveSettingsPanel ] ];
@@ -104,13 +108,13 @@
huhu(disk, `md, $[ `create : CreateRaidPanel, `handle : HandleRaidPanel ], nil);
}
else if (type == `CT_LOOP) {
- huhu(disk, `loop, $[], nil);
+ huhu(disk, `loop, $[ `create : CreateLoopPanel, `handle : HandleLoopPanel ], nil);
}
else if (type == `CT_DM) {
- huhu(disk, `dm, $[], nil);
+ huhu(disk, `dm, $[ `create : CreateDmPanel, `handle : HandleDmPanel ], nil);
}
else if (type == `CT_NFS) {
- huhu(disk, `nfs, $[ `create : CreateNfsOverviewPanel, `handle : HandleNfsOverviewPanel ], nil);
+ huhu(disk, `nfs, $[ `create : CreateNfsPanel, `handle : HandleNfsPanel ], nil);
}
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp Tue Mar 4 15:44:22 2008
@@ -36,7 +36,7 @@
}
- void CreateNfsOverviewPanel(any user_data)
+ void CreateNfsPanel(any user_data)
{
string part_device = (string) user_data;
@@ -60,7 +60,7 @@
}
- void HandleNfsOverviewPanel(any user_data, any widget)
+ void HandleNfsPanel(any user_data, any widget)
{
string part_device = (string) user_data;
Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/Partitions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/modules/Partitions.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/modules/Partitions.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/modules/Partitions.ycp Tue Mar 4 15:44:22 2008
@@ -756,57 +756,65 @@
/*---------------------------------------------------------------------
- * Convert <number-of-bytes> to XXX.X MB or XXX.X GB or XXX.X TB
+ * Convert <number-of-bytes> to XXX.X KB, XXX.X MB, XXX.X GB or XXX.X TB
*
- * see also ByteToHumanStringWithZero !
- * Return value: string "unknown" if input == 0
+ * see also ByteToHumanString
+ *
+ * Return value: string "0.0 KB" if input == 0
*----------------------------------------------------------------------
*
* TODO: also defined in partition_defines.ycp, remove one
*/
-global string ByteToHumanString(integer number)
- ``{
- // column description, if disk space is not known
- if( number == 0 ) return( _("unknown") );
-
- if( number < 1073741824 )
- {
+global string ByteToHumanStringWithZero(integer number)
+{
+ if( number < 1048576 )
+ {
+ // < 1 MB
+ integer KB = number / 1024;
+ integer hunB = (number - (KB * 1024)) / 103;
+ return sformat("%1.%2 KB", KB, hunB);
+ }
+ else if( number < 1073741824 )
+ {
// < 1 GB
integer MB = number / 1048576;
integer hunKB = (number - (MB * 1048576)) / 104858;
return sformat("%1.%2 MB", MB, hunKB);
- }
+ }
else if ( number < 1099511627776 )
- {
+ {
// < 1 TB
integer GB = number / 1073741824;
integer hunMB = (number - (GB * 1073741824)) / 107374183;
return sformat("%1.%2 GB", GB, hunMB);
- }
+ }
else
- {
- // >= 1 TB
- integer TB = number / 1099511627776;
- integer hunGB = (number - (TB * 1099511627776)) / 109951162778;
+ {
+ // >= 1 TB
+ integer TB = number / 1099511627776;
+ integer hunGB = (number - (TB * 1099511627776)) / 109951162778;
return sformat("%1.%2 TB", TB, hunGB);
- }
- };
+ }
+};
/*---------------------------------------------------------------------
- * Convert <number-of-bytes> to XXX.X MB or XXX.X GB or XXX.X TB
+ * Convert <number-of-bytes> to XXX.X KB, XXX.X MB, XXX.X GB or XXX.X TB
+ *
+ * see also ByteToHumanStringWithZero
*
- * see also ByteToHumanString !
- * Return value: string "0" if input == 0
+ * Return value: string "unknown" if input == 0
*----------------------------------------------------------------------
*/
-global string ByteToHumanStringWithZero(integer number)
+global string ByteToHumanString(integer number)
{
if (number == 0)
- return sformat("%1.%2 MB", 0, 0);
+ {
+ // column description, if disk space is not known
+ return _("unknown");
+ }
- return ByteToHumanString(number);
+ return ByteToHumanStringWithZero(number);
};
-
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp?rev=45187&r1=45186&r2=45187&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp Tue Mar 4 15:44:22 2008
@@ -436,7 +436,7 @@
{
string value = "";
if (disk["type"]:`CT_UNKNOWN == `CT_LVM && part == nil)
- value = sformat("%1", disk["pesize"]:0); // FIXME
+ value = Partitions::ByteToHumanString(disk["pesize"]:0);
if (style == `table)
return value;
else
@@ -453,7 +453,7 @@
if (stripes == 1)
value = sformat("%1", stripes);
else
- value = sformat("%1 (%2)", stripes, stripesize); // FIXME
+ value = sformat("%1 (%2)", stripes, Partitions::ByteToHumanStringWithZero(stripesize*1024));
}
if (style == `table)
return value;
@@ -500,6 +500,15 @@
return "End Cylinder: " + value + "\n";
}
+ case `file_path:
+ {
+ string value = data["fpath"]:"";
+ if (style == `table)
+ return value;
+ else
+ return "File Path: " + value + "\n";
+ }
+
default:
{
y2error("unknown field %1", field);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org