Author: aschnell
Date: Fri Oct 31 14:43:19 2008
New Revision: 52798
URL: http://svn.opensuse.org/viewcvs/yast?rev=52798&view=rev
Log:
- added function getCommitInfo (for fate #302857)
Modified:
trunk/storage/libstorage/bindings/ycp/LibStorage.i
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
trunk/storage/libstorage/src/StorageInterface.h
trunk/storage/package/yast2-storage.changes
Modified: trunk/storage/libstorage/bindings/ycp/LibStorage.i
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/bindings/ycp/LibStorage.i?rev=52798&r1=52797&r2=52798&view=diff
==============================================================================
--- trunk/storage/libstorage/bindings/ycp/LibStorage.i (original)
+++ trunk/storage/libstorage/bindings/ycp/LibStorage.i Fri Oct 31 14:43:19 2008
@@ -35,6 +35,7 @@
specialize_sequence(storage::DmraidInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmmultipathInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::PartitionSlotInfo, TO_PACK, FROM_PACK, CHECK)
+specialize_sequence(storage::CommitInfo, TO_PACK, FROM_PACK, CHECK)
%include "../../src/StorageInterface.h"
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=52798&r1=52797&r2=52798&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Fri Oct 31 14:43:19 2008
@@ -3483,43 +3483,56 @@
}
-deque<string> Storage::getCommitActions( bool mark_destructive ) const
- {
- deque<string> ret;
+deque<string>
+Storage::getCommitActions(bool mark_destructive) const
+{
+ CommitInfo info;
+ getCommitInfo(mark_destructive, info);
+ return info.actions;
+}
+
+
+void
+Storage::getCommitInfo(bool mark_destructive, CommitInfo& info) const
+{
+ info.destructive = false;
+ info.actions.clear();
+
ConstContPair p = contPair();
- y2milestone( "empty:%d", p.empty() );
+ y2mil("empty:" << p.empty());
if( !p.empty() )
- {
+ {
list ac;
for( ConstContIterator i = p.begin(); i != p.end(); ++i )
- {
+ {
list l;
i->getCommitActions( l );
ac.splice( ac.end(), l );
- }
+ }
ac.sort( cont_less<commitAction>() );
string txt;
for( list::const_iterator i=ac.begin(); i!=ac.end(); ++i )
- {
+ {
+ if ((*i)->destructive)
+ info.destructive = true;
txt.erase();
if( mark_destructive && (*i)->destructive )
txt += "<font color=red>";
txt += (*i)->descr;
const Volume *v = (*i)->vol();
if( v && !v->getDescText().empty() )
- {
+ {
txt += ". ";
txt += v->getDescText();
- }
+ }
if( mark_destructive && (*i)->destructive )
txt += "</font>";
- ret.push_back( txt );
+ info.actions.push_back( txt );
delete *i;
- }
}
- y2mil("ret.size():" << ret.size());
- return ret;
}
+ y2mil("destructive:" << info.destructive << " actions.size():" << info.actions.size());
+}
static bool sort_cont_up( const Container* rhs, const Container* lhs )
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=52798&r1=52797&r2=52798&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Fri Oct 31 14:43:19 2008
@@ -445,6 +445,7 @@
int removeDmraid( const string& name );
deque<string> getCommitActions( bool mark_destructive ) const;
+ void getCommitInfo(bool mark_destructive, CommitInfo& info) const;
const string& getLastAction() const { return lastAction; }
const string& getExtendedErrorMessage() const { return extendedError; }
void eraseFreeInfo( const string& device );
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=52798&r1=52797&r2=52798&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Fri Oct 31 14:43:19 2008
@@ -452,6 +452,16 @@
};
/**
+ * Contains info about actions performed during commit().
+ */
+ struct CommitInfo
+ {
+ bool destructive;
+ deque<string> actions;
+ };
+
+
+ /**
* preliminary list of error codes, must have negative values
*/
enum ErrorCodes
@@ -1302,7 +1312,8 @@
/**
* Sets the value of description text.
- * This text will be returned together with the text returned by getCommitActions
+ * This text will be returned together with the text returned by
+ * getCommitInfo().
*
* @param device name of volume, e.g. /dev/hda1
* @param txt description text for this partition
@@ -1814,13 +1825,24 @@
/**
* Gets a list of string describing the actions to be executed
- * after next call to commit()
+ * after next call to commit().
*
+ * Deprecated, use getCommitInfo().
+ *
* @param mark_destructive if true use <red> around </red>
* destructive actions (like e.g. deletion, formatting, ...)
* @return list of strings presentable to the user
*/
- virtual deque<string> getCommitActions( bool mark_destructive ) const = 0;
+ virtual deque<string> getCommitActions(bool mark_destructive) const = 0;
+
+ /**
+ * Gets info about actions to be executed after next call to commit().
+ *
+ * @param mark_destructive if true use <red> around </red>
+ * destructive actions (like e.g. deletion, formatting, ...)
+ * @param info record that gets filled with data
+ */
+ virtual void getCommitInfo(bool mark_destructive, CommitInfo& info) const = 0;
/**
* Gets action performed last during previous call to commit()
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=52798&r1=52797&r2=52798&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Fri Oct 31 14:43:19 2008
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Fri Oct 31 14:21:58 CET 2008 - aschnell@suse.de
+
+- added function getCommitInfo (for fate #302857)
+
+-------------------------------------------------------------------
Thu Oct 30 16:50:16 CET 2008 - aschnell@suse.de
- prior to creating file system check that volume is big enough
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org