[yast-commit] r53728 - in /trunk/qt-pkg: VERSION.cmake package/yast2-qt-pkg.changes src/YQPackageSelector.cc src/YQPackageSelectorBase.cc src/YQPkgChangesDialog.cc src/YQPkgChangesDialog.h
Author: dmacvicar
Date: Fri Nov 28 17:16:24 2008
New Revision: 53728
URL: http://svn.opensuse.org/viewcvs/yast?rev=53728&view=rev
Log:
- refactor the mess of methods with 3 boolean parameters, by using QFlags.
- fix the displaying of confirmations
Modified:
trunk/qt-pkg/VERSION.cmake
trunk/qt-pkg/package/yast2-qt-pkg.changes
trunk/qt-pkg/src/YQPackageSelector.cc
trunk/qt-pkg/src/YQPackageSelectorBase.cc
trunk/qt-pkg/src/YQPkgChangesDialog.cc
trunk/qt-pkg/src/YQPkgChangesDialog.h
Modified: trunk/qt-pkg/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/VERSION.cmake?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/VERSION.cmake (original)
+++ trunk/qt-pkg/VERSION.cmake Fri Nov 28 17:16:24 2008
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "2")
SET(VERSION_MINOR "17")
-SET(VERSION_PATCH "20")
+SET(VERSION_PATCH "21")
Modified: trunk/qt-pkg/package/yast2-qt-pkg.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/package/yast2-qt-pkg.changes?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/package/yast2-qt-pkg.changes (original)
+++ trunk/qt-pkg/package/yast2-qt-pkg.changes Fri Nov 28 17:16:24 2008
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Fri Nov 28 17:10:23 CET 2008 - dmacvicar@suse.de
+
+- fix displaying of automatic changes confirmations and
+ unsupported packages confirmations.
+- Needs fix in libzypp 5.24.2 so vendor unsupported packagages are
+ marked correctly.
+- V 2.17.21
+
+-------------------------------------------------------------------
Tue Nov 25 19:03:35 CET 2008 - sh@suse.de
- Fixed fix for bnc #447273 (versions missing) that broke fix for
Modified: trunk/qt-pkg/src/YQPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPackageSelector.cc?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPackageSelector.cc (original)
+++ trunk/qt-pkg/src/YQPackageSelector.cc Fri Nov 28 17:16:24 2008
@@ -1467,7 +1467,8 @@
QRegExp( ".*" + suffix + "$" ),
_( "&OK" ),
QString::null, // rejectButtonLabel
- true ); // showIfEmpty
+ YQPkgChangesDialog::FilterAutomatic,
+ YQPkgChangesDialog::OptionNone ); // showIfEmpty
}
Modified: trunk/qt-pkg/src/YQPackageSelectorBase.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPackageSelectorBase.cc?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPackageSelectorBase.cc (original)
+++ trunk/qt-pkg/src/YQPackageSelectorBase.cc Fri Nov 28 17:16:24 2008
@@ -187,7 +187,8 @@
msg,
_( "&OK" ),
QString::null, // rejectButtonLabel
- true ); // showIfEmpty
+ YQPkgChangesDialog::FilterAutomatic,
+ YQPkgChangesDialog::OptionNone ); // showIfEmpty
}
@@ -275,13 +276,14 @@
" have been changed to resolve dependencies:" )
+ "<p>";
- if ( YQPkgChangesDialog::showChangesDialog( this, msg, _( "C&ontinue" ), _( "&Cancel" ) )
+ if ( YQPkgChangesDialog::showChangesDialog( this, msg, _( "C&ontinue" ), _( "&Cancel" ), YQPkgChangesDialog::FilterAutomatic, YQPkgChangesDialog::OptionAutoAcceptIfEmpty )
== QDialog::Rejected )
return;
}
if ( confirmUnsupported() )
{
+ yuiMilestone() << "Confirm unsupported packages enabled." << endl;
// Show which packages are unsupported
QString msg =
@@ -295,7 +297,7 @@
" requires an additional customer contract for support." )
+ "<p>";
- if ( YQPkgUnsupportedPackagesDialog::showChangesDialog( this, msg, _( "C&ontinue" ), _( "&Cancel" ) )
+ if ( YQPkgUnsupportedPackagesDialog::showChangesDialog( this, msg, _( "C&ontinue" ), _( "&Cancel" ), YQPkgChangesDialog::FilterUser, YQPkgChangesDialog::OptionAutoAcceptIfEmpty )
== QDialog::Rejected )
return;
}
Modified: trunk/qt-pkg/src/YQPkgChangesDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgChangesDialog.cc?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgChangesDialog.cc (original)
+++ trunk/qt-pkg/src/YQPkgChangesDialog.cc Fri Nov 28 17:16:24 2008
@@ -26,7 +26,6 @@
#include <QLabel>
#include <QLayout>
#include <QPushButton>
-#include <QComboBox>
#include <QStyle>
#include <QBoxLayout>
@@ -49,6 +48,7 @@
const QString & acceptButtonLabel,
const QString & rejectButtonLabel )
: QDialog( parent )
+ , _filter(0)
{
// Dialog title
setWindowTitle( _( "Changed Packages" ) );
@@ -86,14 +86,18 @@
hbox->addWidget(label);
label->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert
+ _filter = new QComboBox(this);
- QComboBox *filter = new QComboBox(this);
- filter->addItems( QStringList() << _("All")
+ // add the items.
+ _filter->addItems( QStringList() << _("All")
<< _("Selected by the user")
<< _("Automatic Changes") );
- layout->addWidget(filter);
- connect( filter, SIGNAL(currentIndexChanged(int)),
+ _filter->setCurrentIndex(0);
+
+
+ layout->addWidget(_filter);
+ connect( _filter, SIGNAL(currentIndexChanged(int)),
SLOT(slotFilterChanged(int)));
// Pkg list
@@ -113,9 +117,7 @@
hbox->addStretch();
-
// Accept button - usually "OK" or "Continue"
-
QPushButton * button = new QPushButton( acceptButtonLabel, this );
Q_CHECK_PTR( button );
hbox->addWidget( button );
@@ -140,40 +142,94 @@
}
}
+YQPkgChangesDialog::Filters
+YQPkgChangesDialog::indexToFilter( int i ) const
+{
+ switch (i)
+ {
+ case FilterIndexUser:
+ return FilterUser;
+ case FilterIndexAutomatic:
+ return FilterAutomatic;
+ case FilterIndexAll:
+ default:
+ return FilterAll;
+ }
+ return FilterAll;
+}
+
+int
+YQPkgChangesDialog::filterToIndex( Filters f ) const
+{
+ switch (f)
+ {
+ case FilterAll:
+ return FilterIndexAll;
+ case FilterUser:
+ return FilterIndexUser;
+ case FilterAutomatic:
+ return FilterIndexAutomatic;
+ default:
+ return FilterIndexAll;
+ }
+
+ return FilterIndexAll;
+}
+
+
void
-YQPkgChangesDialog::filter( bool byAuto, bool byApp, bool byUser )
+YQPkgChangesDialog::filter( Filters f )
{
- filter( QRegExp( "" ), byAuto, byApp, byUser );
+ filter( QRegExp( "" ), f );
}
void
YQPkgChangesDialog::slotFilterChanged( int index )
{
- switch(index)
- {
- case All:
- filter( true, true, true );
- break;
- case User:
- filter( false, true, true );
- break;
- case Automatic:
- filter( true, false, false );
- break;
- default:
- break;
- };
+ yuiMilestone() << "filter index changed to: " << index << endl;
+ Filters f = indexToFilter(index);
+ filter(f);
+}
+
+void
+YQPkgChangesDialog::setFilter( Filters f )
+{
+ setFilter(QRegExp(""), f);
+}
+
+void
+YQPkgChangesDialog::setFilter( const QRegExp ®exp, Filters f )
+{
+ int index = filterToIndex(f);
+ yuiMilestone() << "filter changed to: " << f << ", index: " << index << endl;
+ // so we dont get called again
+ _filter->blockSignals(true);
+ // try to set the widget
+ _filter->setCurrentIndex(f);
+
+ _filter->blockSignals(false);
+ filter(regexp, f);
}
void
-YQPkgChangesDialog::filter( const QRegExp & regexp, bool byAuto, bool byApp, bool byUser )
+YQPkgChangesDialog::filter( const QRegExp & regexp, Filters f )
{
YQUI::ui()->busyCursor();
_pkgList->clear();
+ bool byAuto = f.testFlag(FilterAutomatic);
+ bool byUser = f.testFlag(FilterUser);
+ bool byApp = f.testFlag(FilterUser);
+
+ int discard_regex = 0;
+ int discard_ignored = 0;
+ int discard_extra = 0;
+ int discard_notmodified = 0;
+ int discard_whomodified = 0;
+
set<string> ignoredNames;
if ( ! byUser || ! byApp )
@@ -187,7 +243,7 @@
if ( selectable->toModify() )
{
- zypp::ResStatus::TransactByValue modifiedBy = selectable->modifiedBy();
+ zypp::ResStatus::TransactByValue modifiedBy = selectable->modifiedBy();
if ( ( ( modifiedBy == zypp::ResStatus::SOLVER ) && byAuto ) ||
( ( modifiedBy == zypp::ResStatus::APPL_LOW ||
@@ -202,13 +258,30 @@
ZyppPkg pkg = tryCastToZyppPkg( selectable->theObj() );
if ( extraFilter( selectable, pkg ) )
_pkgList->addPkgItem( selectable, pkg );
+ else
+ discard_extra++;
}
-
+ else
+ { discard_ignored++; }
}
+ else
+ { discard_regex++; }
}
+ else
+ { discard_whomodified++; }
+
}
+ else
+ { discard_notmodified++; }
+
}
+ yuiMilestone() << "Filter result summary: " << endl;
+ yuiMilestone() << "Discarded by extra filter: " << discard_extra << endl;
+ yuiMilestone() << "Discarded by ignored: " << discard_ignored << endl;
+ yuiMilestone() << "Discarded by regex: " << discard_regex << endl;
+ yuiMilestone() << "Discarded because not modified: " << discard_notmodified << endl;
+ yuiMilestone() << "Discarded by who modified: " << discard_whomodified << endl;
YQUI::ui()->normalCursor();
}
@@ -237,16 +310,22 @@
const QString & message,
const QString & acceptButtonLabel,
const QString & rejectButtonLabel,
- bool showIfListEmpty )
+ Filters f,
+ Options o )
{
YQPkgChangesDialog dialog( parent,
message,
acceptButtonLabel,
rejectButtonLabel );
- dialog.filter();
-
- if ( dialog.isEmpty() && ! showIfListEmpty )
+
+ dialog.setFilter(f);
+
+ if ( dialog.isEmpty() && o.testFlag(OptionAutoAcceptIfEmpty) )
+ {
+ yuiMilestone() << "No items to show in dialog, accepting it automatically" << endl;
return true;
+ }
+
dialog.exec();
@@ -260,16 +339,20 @@
const QRegExp & regexp,
const QString & acceptButtonLabel,
const QString & rejectButtonLabel,
- bool showIfListEmpty )
+ Filters f,
+ Options o )
{
YQPkgChangesDialog dialog( parent,
message,
acceptButtonLabel,
rejectButtonLabel );
- dialog.filter( regexp, true, true, true );
-
- if ( dialog.isEmpty() && ! showIfListEmpty )
+ dialog.setFilter(regexp,f);
+
+ if ( dialog.isEmpty() && o.testFlag(OptionAutoAcceptIfEmpty) )
+ {
+ yuiMilestone() << "No items to show in dialog, accepting it automatically" << endl;
return true;
+ }
dialog.exec();
@@ -278,9 +361,11 @@
bool YQPkgUnsupportedPackagesDialog::extraFilter( ZyppSel sel, ZyppPkg pkg )
{
+ yuiMilestone() << "***: " << pkg << sel << endl;
if (!pkg || !sel)
return false;
+ yuiMilestone() << "PKG: " << pkg << endl;
return pkg->maybeUnsupported();
}
Modified: trunk/qt-pkg/src/YQPkgChangesDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt-pkg/src/YQPkgChangesDialog.h?rev=53728&r1=53727&r2=53728&view=diff
==============================================================================
--- trunk/qt-pkg/src/YQPkgChangesDialog.h (original)
+++ trunk/qt-pkg/src/YQPkgChangesDialog.h Fri Nov 28 17:16:24 2008
@@ -20,13 +20,13 @@
#ifndef YQPkgChangesDialog_h
#define YQPkgChangesDialog_h
-#include
participants (1)
-
dmacvicar@svn.opensuse.org