Hello community,
here is the log from the commit of package yast2-core
checked in at Fri Feb 1 00:07:01 CET 2008.
--------
--- yast2-core/yast2-core.changes 2008-01-29 20:08:28.000000000 +0100
+++ yast2-core/yast2-core.changes 2008-01-31 15:41:36.590883000 +0100
@@ -1,0 +2,6 @@
+Thu Jan 31 15:25:52 CET 2008 - sh@suse.de
+
+- Simplified and unified internal UI dialog handling
+- V 2.16.25
+
+-------------------------------------------------------------------
Old:
----
yast2-core-2.16.24.tar.bz2
New:
----
yast2-core-2.16.25.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-core.spec ++++++
--- /var/tmp/diff_new_pack.l10664/_old 2008-02-01 00:06:25.000000000 +0100
+++ /var/tmp/diff_new_pack.l10664/_new 2008-02-01 00:06:25.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-core (Version 2.16.24)
+# spec file for package yast2-core (Version 2.16.25)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-core
-Version: 2.16.24
+Version: 2.16.25
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-core-2.16.24.tar.bz2
+Source0: yast2-core-2.16.25.tar.bz2
Prefix: /usr
# obviously
BuildRequires: gcc-c++
@@ -86,7 +86,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-core-2.16.24
+%setup -n yast2-core-2.16.25
%build
%{prefix}/bin/y2tool y2autoconf
@@ -162,7 +162,11 @@
%{_libdir}/pkgconfig/yast2-core.pc
%doc %{prefix}/share/doc/packages/yast2-core
/usr/share/YaST2/data/devtools/bin/generateYCPWrappers
+
%changelog
+* Thu Jan 31 2008 sh@suse.de
+- Simplified and unified internal UI dialog handling
+- V 2.16.25
* Tue Jan 29 2008 sh@suse.de
- YCP-less event handling in libyui core
- V 2.16.24
++++++ yast2-core-2.16.24.tar.bz2 -> yast2-core-2.16.25.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/configure new/yast2-core-2.16.25/configure
--- old/yast2-core-2.16.24/configure 2008-01-24 14:28:05.000000000 +0100
+++ new/yast2-core-2.16.25/configure 2008-01-31 15:31:41.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for yast2-core 2.16.23.
+# Generated by GNU Autoconf 2.60 for yast2-core 2.16.25.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -713,8 +713,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-core'
PACKAGE_TARNAME='yast2-core'
-PACKAGE_VERSION='2.16.23'
-PACKAGE_STRING='yast2-core 2.16.23'
+PACKAGE_VERSION='2.16.25'
+PACKAGE_STRING='yast2-core 2.16.25'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1433,7 +1433,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-core 2.16.23 to adapt to many kinds of systems.
+\`configure' configures yast2-core 2.16.25 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1504,7 +1504,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-core 2.16.23:";;
+ short | recursive ) echo "Configuration of yast2-core 2.16.25:";;
esac
cat <<\_ACEOF
@@ -1610,7 +1610,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-core configure 2.16.23
+yast2-core configure 2.16.25
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1624,7 +1624,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by yast2-core $as_me 2.16.23, which was
+It was created by yast2-core $as_me 2.16.25, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@@ -2425,7 +2425,7 @@
# Define the identity of the package.
PACKAGE='yast2-core'
- VERSION='2.16.23'
+ VERSION='2.16.25'
cat >>confdefs.h <<_ACEOF
@@ -2653,7 +2653,7 @@
-VERSION="2.16.23"
+VERSION="2.16.25"
RPMNAME="yast2-core"
MAINTAINER="Martin Vidner "
@@ -23794,7 +23794,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-core $as_me 2.16.23, which was
+This file was extended by yast2-core $as_me 2.16.25, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23847,7 +23847,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-core config.status 2.16.23
+yast2-core config.status 2.16.25
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/configure.in new/yast2-core-2.16.25/configure.in
--- old/yast2-core-2.16.24/configure.in 2008-01-24 14:27:50.000000000 +0100
+++ new/yast2-core-2.16.25/configure.in 2008-01-31 15:31:22.000000000 +0100
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.16.3 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-core, 2.16.23, http://bugs.opensuse.org/, yast2-core)
+AC_INIT(yast2-core, 2.16.25, http://bugs.opensuse.org/, yast2-core)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -18,7 +18,7 @@
AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
dnl Important YaST2 variables
-VERSION="2.16.23"
+VERSION="2.16.25"
RPMNAME="yast2-core"
MAINTAINER="Martin Vidner "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/doc/examples/DumbTab2.ycp new/yast2-core-2.16.25/libyui/doc/examples/DumbTab2.ycp
--- old/yast2-core-2.16.24/libyui/doc/examples/DumbTab2.ycp 2007-11-27 15:07:30.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/doc/examples/DumbTab2.ycp 2008-01-31 15:24:59.000000000 +0100
@@ -6,7 +6,7 @@
`VSpacing(),
`HCenter(
`HSquash(
- `VBox(
+ `VBox(
`HSpacing( 50 ),
`InputField( "Name" ),
`InputField( "E-Mail" ),
@@ -27,7 +27,10 @@
+ "You need to do most everything yourself.\n"
+ "Each tab behaves very much like a push button;\n"
+ "the YCP application is notified when the user clicks on a tab.\n"
- + "The application must take care to exchange the tab contents." )
+ + "The application must take care to exchange the tab contents.\n"
+ + "\n"
+ + "Note: That means changes made in on tab are lost when switching\n"
+ + "the tabs, e.g. text entered here in the address tab.")
);
term style_hints_page =
@@ -44,8 +47,8 @@
)
);
-
-
+
+
UI::OpenDialog(`opt(`defaultsize),
`VBox(
`DumbTab( [
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/ChangeLog new/yast2-core-2.16.25/libyui/src/ChangeLog
--- old/yast2-core-2.16.24/libyui/src/ChangeLog 2008-01-29 19:04:19.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/ChangeLog 2008-01-31 15:29:51.000000000 +0100
@@ -484,3 +484,13 @@
* Moved YCP part out of YEvent to new class YCPEvent
* YUI::runPkgSelection() now returns YEvent * and is pure virtual
+
+
+2008-01-31 sh@suse.de
+
+* Moved dialog handling from YUI to YDialog:
+ - removed YUI::showDialog()
+ - removed YUI::closeDialog()
+ - Now using YDialog::open() and YDialog::destroy()
+ - Derived classes now have to implement YDialog::openInternal()
+ and YDialog::activate()
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YCPErrorDialog.cc new/yast2-core-2.16.25/libyui/src/YCPErrorDialog.cc
--- old/yast2-core-2.16.24/libyui/src/YCPErrorDialog.cc 2008-01-25 19:50:13.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YCPErrorDialog.cc 2008-01-30 18:14:44.000000000 +0100
@@ -51,20 +51,19 @@
fac->createHStretch( buttonBox );
YPushButton * closeButton = fac->createPushButton( buttonBox, "&Close" );
closeButton->setId( new YCPValueWidgetID( YCPSymbol( "cancel" ) ) );
-
- dialog->setInitialSize();
- dialog->checkShortcuts();
- YUI::ui()->showDialog( dialog );
+ dialog->open();
YCPValue input = YUI::ui()->waitForUserInput();
yuiMilestone() << "Input: " << input << endl;
- YUI::ui()->closeDialog( YDialog::currentDialog() );
- YDialog::deleteTopmostDialog();
+ dialog->destroy();
}
catch ( YUIException & ex )
{
YUI_CAUGHT( exception );
+
+ // No other action. If opening this error dialog fails, the user will
+ // just have to live with the error being reported in the log file only.
}
catch ( ... )
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YCPEvent.cc new/yast2-core-2.16.25/libyui/src/YCPEvent.cc
--- old/yast2-core-2.16.24/libyui/src/YCPEvent.cc 2008-01-29 17:16:25.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YCPEvent.cc 2008-01-29 20:20:14.000000000 +0100
@@ -44,6 +44,9 @@
YCPValue
YCPEvent::eventId() const
{
+ if ( ! _event )
+ return YCPVoid();
+
//
// Widget Events
//
@@ -121,18 +124,21 @@
{
YCPMap map;
- map->add( YCPString( "EventType" ), YCPString ( YEvent::toString( _event->eventType() ) ) );
- map->add( YCPString( "EventSerialNo" ), YCPInteger( _event->serial() ) );
+ if ( _event )
+ {
+ map->add( YCPString( "EventType" ), YCPString ( YEvent::toString( _event->eventType() ) ) );
+ map->add( YCPString( "EventSerialNo" ), YCPInteger( _event->serial() ) );
- YCPValue id = eventId();
+ YCPValue id = eventId();
- if ( ! id.isNull() && ! id->isVoid() )
- {
- map->add( YCPString( "ID" ), id );
- }
+ if ( ! id.isNull() && ! id->isVoid() )
+ {
+ map->add( YCPString( "ID" ), id );
+ }
- addWidgetEventFields( map, id );
- addKeyEventFields ( map, id );
+ addWidgetEventFields( map, id );
+ addKeyEventFields ( map, id );
+ }
return map;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YDialog.cc new/yast2-core-2.16.25/libyui/src/YDialog.cc
--- old/yast2-core-2.16.24/libyui/src/YDialog.cc 2008-01-17 15:03:20.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YDialog.cc 2008-01-30 19:07:15.000000000 +0100
@@ -40,12 +40,14 @@
, colorMode( colorMode )
, shortcutCheckPostponed( false )
, defaultButton( 0 )
+ , isOpen( false )
{}
YDialogType dialogType;
YDialogColorMode colorMode;
bool shortcutCheckPostponed;
YPushButton * defaultButton;
+ bool isOpen;
};
@@ -55,7 +57,7 @@
, priv( new YDialogPrivate( dialogType, colorMode ) )
{
YUI_CHECK_NEW( priv );
-
+
_dialogStack.push( this );
#if VERBOSE_DIALOGS
@@ -69,6 +71,57 @@
#if VERBOSE_DIALOGS
yuiDebug() << "Destroying " << this << endl;
#endif
+
+ if ( ! _dialogStack.empty() && _dialogStack.top() == this )
+ {
+ _dialogStack.pop();
+
+ if ( ! _dialogStack.empty() )
+ _dialogStack.top()->activate();
+ }
+ else
+ yuiError() << "Not top of dialog stack: " << this << endl;
+}
+
+
+void
+YDialog::open()
+{
+ if ( priv->isOpen )
+ return;
+
+ checkShortcuts();
+ setInitialSize();
+ openInternal(); // Make sure this is only called once!
+
+ priv->isOpen = true;
+}
+
+
+bool
+YDialog::isOpen() const
+{
+ return priv->isOpen;
+}
+
+
+bool
+YDialog::destroy( bool doThrow )
+{
+ YUI_CHECK_WIDGET( this );
+
+ if ( _dialogStack.empty() ||
+ _dialogStack.top() != this )
+ {
+ if ( doThrow )
+ YUI_THROW( YUIDialogStackingOrderException() );
+
+ return false;
+ }
+
+ delete this;
+
+ return true;
}
@@ -145,12 +198,21 @@
#if VERBOSE_DIALOGS
yuiDebug() << "Setting initial size for " << this << endl;
#endif
-
+
// Trigger geometry management
setSize( preferredWidth(), preferredHeight() );
}
+void
+YDialog::recalcLayout()
+{
+ yuiDebug() << "Recalculating layout for " << this << endl;
+
+ setSize( preferredWidth(), preferredHeight() );
+}
+
+
YDialog *
@@ -178,7 +240,6 @@
else
{
delete _dialogStack.top();
- _dialogStack.pop();
}
return ! _dialogStack.empty();
@@ -188,8 +249,31 @@
void
YDialog::deleteAllDialogs()
{
- while ( deleteTopmostDialog( false ) )
- {}
+ while ( ! _dialogStack.empty() )
+ {
+ delete _dialogStack.top();
+ }
+}
+
+
+void
+YDialog::deleteTo( YDialog * targetDialog )
+{
+ YUI_CHECK_WIDGET( targetDialog );
+
+ while ( ! _dialogStack.empty() )
+ {
+ YDialog * dialog = _dialogStack.top();
+
+ delete dialog;
+
+ if ( dialog == targetDialog )
+ return;
+ }
+
+ // If we ever get here, targetDialog was nowhere in the dialog stack.
+
+ YUI_THROW( YUIDialogStackingOrderException() );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YDialog.h new/yast2-core-2.16.25/libyui/src/YDialog.h
--- old/yast2-core-2.16.24/libyui/src/YDialog.h 2007-12-03 18:03:02.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YDialog.h 2008-01-30 19:09:56.000000000 +0100
@@ -48,7 +48,8 @@
/**
* Destructor.
- * Don't delete a dialog directly, use YDialog::deleteTopmostDialog().
+ * Don't delete a dialog directly, use YDialog::deleteTopmostDialog()
+ * or YDialog::destroy().
**/
virtual ~YDialog();
@@ -60,10 +61,47 @@
virtual const char * widgetClass() const { return "YDialog"; }
/**
+ * Open a newly created dialog: Finalize it and make it visible
+ * on the screen.
+ *
+ * Applications should call this once after all children are created.
+ * If the application doesn't do this, it will be done automatically upon
+ * the next call of YDialog::waitForEvent() (or related). This is OK if
+ * YDialog::waitForEvent() is called immediately after creating the dialog
+ * anyway. If it is not, the application might appear sluggish to the user.
+ *
+ * Derived classes are free to reimplement this, but they should call this
+ * base class method in the new implementation.
+ **/
+ void open();
+
+ /**
+ * Return 'true' if open() has already been called for this dialog.
+ **/
+ bool isOpen() const;
+
+ /**
+ * Close and delete this dialog (and all its children) if it is the topmost
+ * dialog. If this is not the topmost dialog, this will throw an exception
+ * if 'doThrow' is true (default).
+ *
+ * Remember that all pointers to the dialog and its children will be
+ * invalid after this operation.
+ *
+ * This is intentionally not named close() since close() would not imply
+ * that the dialog and its children are deleted.
+ *
+ * Returns 'true' upon success, 'false' upon failure.
+ **/
+ bool destroy( bool doThrow = true );
+
+ /**
* Delete the topmost dialog.
*
* Will throw a YUINoDialogException if there is no dialog and 'doThrow' is
- * 'true'.
+ * 'true'.
+ *
+ * This is equivalent to YDialog::currentDialog()->destroy().
*
* Returns 'true' if there is another open dialog after deleting,
* 'false' if there is none.
@@ -76,6 +114,11 @@
static void deleteAllDialogs();
/**
+ * Delete all dialogs from the topmost to the one specified.
+ **/
+ static void deleteTo( YDialog * dialog );
+
+ /**
* Returns the number of currently open dialogs (from 1 on), i.e., the
* depth of the dialog stack.
**/
@@ -103,6 +146,20 @@
void setInitialSize();
/**
+ * Recalculate the layout of the dialog and of all its children after
+ * children have been added or removed or if any of them changed its
+ * preferred width of height.
+ *
+ * This is a very expensive operation. Call it only when really necessary.
+ * YDialog::open() includes a call to YDialog::setInitialSize() which does
+ * the same.
+ *
+ * The basic idea behind this function is to call it when the dialog
+ * changed after it (and its children hierarchy) was initially created.
+ **/
+ void recalcLayout();
+
+ /**
* Return this dialog's type (YMainDialog / YPopupDialog).
**/
YDialogType dialogType() const;
@@ -153,9 +210,29 @@
**/
virtual void setDefaultButton( YPushButton * defaultButton );
+ /**
+ * Activate this dialog: Make sure that it is shown as the topmost dialog
+ * of this application and that it can receive input.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual void activate() = 0;
+
protected:
+ /**
+ * Internal open() method. This is called (exactly once during the life
+ * time of the dialog) in open().
+ *
+ * Derived classes are required to implement this to do whatever is
+ * necessary to make this dialog visible on the screen.
+ **/
+ virtual void openInternal() = 0;
+
+ /**
+ * Stack holding all currently existing dialogs.
+ **/
static std::stack _dialogStack;
private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YUI_builtins.cc new/yast2-core-2.16.25/libyui/src/YUI_builtins.cc
--- old/yast2-core-2.16.24/libyui/src/YUI_builtins.cc 2008-01-29 20:01:45.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YUI_builtins.cc 2008-01-30 19:11:18.000000000 +0100
@@ -712,6 +712,8 @@
YDialog::currentDialog()->dumpWidgetTree();
#endif
+ YDialog::currentDialog()->activate();
+
delete widgetEvent;
return 0;
}
@@ -791,10 +793,7 @@
YUI_CHECK_NEW( dialog );
YCPDialogParser::parseWidgetTreeTerm( dialog, dialogTerm );
-
- dialog->setInitialSize();
- dialog->checkShortcuts();
- showDialog( dialog );
+ dialog->open();
}
catch ( YUIException & exception )
{
@@ -830,28 +829,13 @@
YCPValue YUI::evaluateCloseDialog()
{
blockEvents(); // We don't want self-generated events from UI builtins.
-
- closeDialog( YDialog::currentDialog() );
YDialog::deleteTopmostDialog();
-
unblockEvents();
return YCPBoolean( true );
}
-void YUI::showDialog( YDialog * )
-{
- // dummy default implementation
-}
-
-
-void YUI::closeDialog( YDialog * )
-{
- // dummy default implementation
-}
-
-
/**
* @builtin ChangeWidget
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YUIException.h new/yast2-core-2.16.25/libyui/src/YUIException.h
--- old/yast2-core-2.16.24/libyui/src/YUIException.h 2008-01-17 13:49:02.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YUIException.h 2008-01-30 17:40:56.000000000 +0100
@@ -457,6 +457,18 @@
};
+class YUIDialogStackingOrderException: public YUIException
+{
+public:
+ YUIDialogStackingOrderException()
+ : YUIException( "Dialog stacking order violated" )
+ {}
+
+ virtual ~YUIDialogStackingOrderException() throw()
+ {}
+};
+
+
class YUISyntaxErrorException: public YUIException
{
public:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/libyui/src/YUI.h new/yast2-core-2.16.25/libyui/src/YUI.h
--- old/yast2-core-2.16.24/libyui/src/YUI.h 2008-01-29 18:59:45.000000000 +0100
+++ new/yast2-core-2.16.25/libyui/src/YUI.h 2008-01-30 18:39:20.000000000 +0100
@@ -427,22 +427,6 @@
virtual YEvent * pollInput() = 0;
-public:
- /**
- * Show and activate a previously created dialog.
- * This default implementation does nothing.
- **/
- virtual void showDialog( YDialog *dialog );
-
- /**
- * Decativate and close a previously created dialog.
- * This default implementation does nothing.
- *
- * Don't delete the dialog. This will be done at some other place.
- **/
- virtual void closeDialog( YDialog *dialog );
-
-
protected:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.16.24/VERSION new/yast2-core-2.16.25/VERSION
--- old/yast2-core-2.16.24/VERSION 2008-01-29 17:23:39.000000000 +0100
+++ new/yast2-core-2.16.25/VERSION 2008-01-31 15:25:47.000000000 +0100
@@ -1 +1 @@
-2.16.24
+2.16.25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org