Author: coolo
Date: Sun Jan 6 22:26:58 2008
New Revision: 43289
URL: http://svn.opensuse.org/viewcvs/yast?rev=43289&view=rev
Log:
reworking the "save to file" function
Modified:
trunk/qt/src/pkg/YQPkgConflictList.cc
trunk/qt/src/pkg/YQPkgConflictList.h
Modified: trunk/qt/src/pkg/YQPkgConflictList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgConflictList.cc?rev=43289&r1=43288&r2=43289&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgConflictList.cc (original)
+++ trunk/qt/src/pkg/YQPkgConflictList.cc Sun Jan 6 22:26:58 2008
@@ -154,7 +154,6 @@
void
YQPkgConflictList::saveToFile( const QString filename, bool interactive ) const
{
-#if 0
// Open file
QFile file(filename);
@@ -183,17 +182,12 @@
header += QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" );
header += " ####\n\n";
- file.write(header.toUtf8());
+ file.write(header.toUtf8());
-
- // Recursively write all items
- int count=0;
- const QTreeWidgetItem * item;
-
- while ( (item = topLevelItem(count)) )
+ YQPkgConflict * conflict;
+ foreach( conflict, _conflicts )
{
- saveItemToFile( file, item );
- count++;
+ conflict->saveToFile( file );
}
@@ -207,59 +201,6 @@
if ( file.isOpen() )
file.close();
-#endif
-}
-
-
-void
-YQPkgConflictList::saveItemToFile( QFile &file,
- const YQPkgConflict * item ) const
-{
-#if FIXME
- if ( ! item || ! file.isOpen() )
- return;
-
- // Write indentation
- for ( int level = 0; level < item->depth(); level++ )
- file.write( " " );
-
- // Write item
-
- const QTreeWidgetItem * checkListItem = dynamic_cast (item);
-
- if ( checkListItem )
- {
- switch ( checkListItem->type() )
- {
- QString buffer;
- case Q3CheckListItem::CheckBox:
- buffer.sprintf( "[%c] ", checkListItem->( checkState(0) == Qt::Checked ) ? 'x' : ' ' );
- break;
- case Q3CheckListItem::RadioButton:
- sbuffer.sprintf( "(%c) ", checkListItem->( checkState(0) == Qt::Checked ) ? 'x' : ' ' );
- break;
- default:
- break;
- }
- file.write(buffer.toUtf8());
- }
-
- buffer.sprintf("%s\n", qPrintable(item->text(0)) );
- file.write(buffer.toUtf8());
-
- if ( item->isExpanded() )
- {
- // Recursively write children
-
- const QTreeWidgetItem * child = item->firstChild();
-
- while ( child )
- {
- saveItemToFile( file, child );
- child = child->nextSibling();
- }
- }
-#endif
}
YQPkgConflict::YQPkgConflict( QWidget * parent,
@@ -354,4 +295,27 @@
return zypp::ProblemSolution_Ptr(); // Null pointer
}
+void
+YQPkgConflict::saveToFile( QFile &file ) const
+{
+ if ( ! file.isOpen() )
+ return;
+
+ // Write item
+
+ QMap::const_iterator it;
+
+ file.write( problem()->description().c_str() );
+ file.write( problem()->details().c_str() );
+
+ QString buffer;
+
+ for ( it = _solutions.begin(); it != _solutions.end(); ++it )
+ {
+ QRadioButton *button = it.key();
+ buffer.sprintf( "[%c] %s", button->isChecked() ? 'x' : ' ', qPrintable( button->text() ) );
+ file.write(buffer.toUtf8());
+ }
+}
+
#include "YQPkgConflictList.moc"
Modified: trunk/qt/src/pkg/YQPkgConflictList.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgConflictList.h?rev=43289&r1=43288&r2=43289&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgConflictList.h (original)
+++ trunk/qt/src/pkg/YQPkgConflictList.h Sun Jan 6 22:26:58 2008
@@ -106,11 +106,6 @@
protected:
- /**
- * (Recursively) save one item to file.
- **/
- void saveItemToFile( QFile &file, const YQPkgConflict * item ) const;
-
QList _conflicts;
QVBoxLayout *_layout;
@@ -156,6 +151,10 @@
**/
zypp::ProblemSolution_Ptr userSelectedResolution();
+ /**
+ * save one item to file.
+ **/
+ void saveToFile( QFile &file ) const;
protected:
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org