Author: sh-sh-sh
Date: Tue Jan 29 20:07:06 2008
New Revision: 43983
URL: http://svn.opensuse.org/viewcvs/yast?rev=43983&view=rev
Log:
YCP-less event handling
Added:
trunk/core/libyui/src/YCPEvent.cc
trunk/core/libyui/src/YCPEvent.h
Modified:
trunk/core/VERSION
trunk/core/libyui/doc/examples/IconButton1.ycp
trunk/core/libyui/src/ChangeLog
trunk/core/libyui/src/Makefile.am
trunk/core/libyui/src/YEvent.cc
trunk/core/libyui/src/YEvent.h
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUI_builtins.cc
trunk/core/package/yast2-core.changes
trunk/ncurses/VERSION
trunk/ncurses/package/yast2-ncurses.changes
trunk/ncurses/src/NCPackageSelectorPlugin.cc
trunk/ncurses/src/NCPackageSelectorPlugin.h
trunk/ncurses/src/YNCursesUI.cc
trunk/ncurses/src/YNCursesUI.h
trunk/ncurses/src/pkg/NCPackageSelector.cc
trunk/ncurses/yast2-ncurses.spec.in
trunk/qt/VERSION.cmake
trunk/qt/package/yast2-qt.changes
trunk/qt/src/YQDumbTab.cc
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_builtins.cc
trunk/qt/src/pkg/YQPackageSelectorBase.cc
trunk/qt/src/pkg/YQPatternSelector.cc
trunk/qt/src/pkg/YQSimplePatchSelector.cc
Modified: trunk/core/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Tue Jan 29 20:07:06 2008
@@ -1 +1 @@
-2.16.23
+2.16.24
Modified: trunk/core/libyui/doc/examples/IconButton1.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/IconButton1.ycp?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/doc/examples/IconButton1.ycp (original)
+++ trunk/core/libyui/doc/examples/IconButton1.ycp Tue Jan 29 20:07:06 2008
@@ -4,8 +4,8 @@
// then close the dialog and terminate.
UI::OpenDialog(
- `IconButton( "topRow_right.png", "&OK" )
- );
+ `IconButton( "icons/22x22/apps/yast-users.png", "&OK" )
+ );
UI::UserInput();
UI::CloseDialog();
Modified: trunk/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/ChangeLog?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/ChangeLog (original)
+++ trunk/core/libyui/src/ChangeLog Tue Jan 29 20:07:06 2008
@@ -469,3 +469,18 @@
* Moved glyph handling from YUI to YApplication,
now using std::string instead of YCPString and YCPSymbol;
forget YMyUI::glyph(), implement YMyApplication::glyph()
+
+
+2008-01-25 sh@suse.de
+
+* UI::OpenDialog() now opens error dialog in case of exception
+ (using the new mod-ui calls, works for all UIs)
+
+* UI::UserInput() now opens error dialog in case of exception
+ (using the new mod-ui calls, works for all UIs)
+
+
+2008-01-29 sh@suse.de
+
+* Moved YCP part out of YEvent to new class YCPEvent
+* YUI::runPkgSelection() now returns YEvent * and is pure virtual
Modified: trunk/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Makefile.am?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/Makefile.am (original)
+++ trunk/core/libyui/src/Makefile.am Tue Jan 29 20:07:06 2008
@@ -17,6 +17,7 @@
YApplication.cc \
YCPDialogParser.cc \
YCPErrorDialog.cc \
+ YCPEvent.cc \
YCPItemParser.cc \
YCPItemWriter.cc \
YCPMenuItemParser.cc \
@@ -110,6 +111,7 @@
YColor.h \
YCPDialogParser.h \
YCPErrorDialog.h \
+ YCPEvent.h \
YCPItem.h \
YCPItemParser.h \
YCPItemWriter.h \
Added: trunk/core/libyui/src/YCPEvent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPEvent.cc?rev=43983&view=auto
==============================================================================
--- trunk/core/libyui/src/YCPEvent.cc (added)
+++ trunk/core/libyui/src/YCPEvent.cc Tue Jan 29 20:07:06 2008
@@ -0,0 +1,242 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPEvent.cc
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+
+#include
+#include
+#include
+#include
+
+#include "YCPEvent.h"
+#include "YWidget.h"
+#include "YCPItem.h"
+#include "YCPMenuItem.h"
+#include "YCPValueWidgetID.h"
+
+#define YUILogComponent "ui"
+#include "YUILog.h"
+
+
+
+
+YCPEvent::YCPEvent( const YEvent * event )
+ : _event( event )
+{
+}
+
+
+
+YCPValue
+YCPEvent::eventId() const
+{
+ //
+ // Widget Events
+ //
+
+ const YWidgetEvent * widgetEvent = dynamic_cast (_event);
+
+ if ( widgetEvent )
+ {
+ if ( widgetEvent->widget() && widgetEvent->widget()->hasId() )
+ {
+ YCPValueWidgetID * id = dynamic_cast ( widgetEvent->widget()->id() );
+
+ if ( id )
+ return id->value();
+ }
+ }
+
+
+ //
+ // Menu Events
+ //
+
+ const YMenuEvent * menuEvent = dynamic_cast (_event);
+
+ if ( menuEvent )
+ {
+ if ( menuEvent->item() )
+ {
+ YCPMenuItem * ycpMenuItem = dynamic_cast ( menuEvent->item() );
+
+ if ( ycpMenuItem )
+ return ycpMenuItem->id();
+
+ YCPItem * ycpItem = dynamic_cast ( menuEvent->item() );
+
+ if ( ycpItem )
+ return ycpItem->id();
+
+ return YCPString( menuEvent->item()->label() );
+ }
+ else
+ {
+ return YCPString( menuEvent->id() );
+ }
+ }
+
+
+ //
+ // Key Events
+ //
+
+ const YKeyEvent * keyEvent = dynamic_cast (_event);
+
+ if ( keyEvent )
+ {
+ return YCPString( keyEvent->keySymbol() );
+ }
+
+
+ //
+ // Misc Simple Events
+ //
+
+ if ( dynamic_cast (_event ) ) return YCPSymbol( "cancel" );
+ if ( dynamic_cast (_event ) ) return YCPSymbol( "timeout" );
+ if ( dynamic_cast (_event ) ) return YCPSymbol( "debugHotkey" );
+
+ return YCPVoid();
+}
+
+
+
+YCPMap
+YCPEvent::eventMap() const
+{
+ YCPMap map;
+
+ map->add( YCPString( "EventType" ), YCPString ( YEvent::toString( _event->eventType() ) ) );
+ map->add( YCPString( "EventSerialNo" ), YCPInteger( _event->serial() ) );
+
+ YCPValue id = eventId();
+
+ if ( ! id.isNull() && ! id->isVoid() )
+ {
+ map->add( YCPString( "ID" ), id );
+ }
+
+ addWidgetEventFields( map, id );
+ addKeyEventFields ( map, id );
+
+ return map;
+}
+
+
+
+void
+YCPEvent::addWidgetEventFields( YCPMap & map, const YCPValue & id ) const
+{
+ const YWidgetEvent * widgetEvent = dynamic_cast (_event);
+
+ if ( ! widgetEvent )
+ return;
+
+ map->add( YCPString( "EventReason" ), YCPString ( YEvent::toString( widgetEvent->reason() ) ) );
+
+ YWidget * widget = widgetEvent->widget();
+
+ if ( widget )
+ {
+ // Add widget specific info:
+ // Add WidgetID
+
+ if ( ! id.isNull() && ! id->isVoid() )
+ {
+ map->add( YCPString( "WidgetID" ), id ); // Just an alias for "ID"
+ }
+
+
+ // Add WidgetClass
+
+ const char * widgetClass = widget->widgetClass();
+
+ if ( widgetClass )
+ {
+ if ( *widgetClass == 'Y' ) // skip leading "Y" (YPushButton, YInputField, ...)
+ widgetClass++;
+
+ map->add( YCPString( "WidgetClass" ), YCPSymbol( widgetClass ) );
+ }
+
+
+ // Add the Widget's debug label.
+ // This is usually the label (translated to the user's locale).
+
+ string debugLabel = widget->debugLabel();
+
+ if ( ! debugLabel.empty() )
+ map->add( YCPString( "WidgetDebugLabel" ), YCPString( debugLabel ) );
+ }
+}
+
+
+
+void
+YCPEvent::addKeyEventFields( YCPMap & map, const YCPValue & id ) const
+{
+ const YKeyEvent * keyEvent = dynamic_cast (_event);
+
+ if ( ! keyEvent )
+ return;
+
+ if ( ! id.isNull() && ! id->isVoid() )
+ {
+ map->add( YCPString( "KeySymbol" ), id ); // Just an alias for "ID"
+ }
+
+ YWidget * focusWidget = keyEvent->focusWidget();
+
+ if ( focusWidget )
+ {
+ // Add widget specific info:
+ // Add ID of the focus widget
+
+ if ( focusWidget->hasId() )
+ {
+ YCPValueWidgetID * id = dynamic_cast ( focusWidget->id() );
+
+ if ( id )
+ map->add( YCPString( "FocusWidgetID" ), id->value() ); // just an alias
+ }
+
+
+ // Add WidgetClass
+
+ const char * widgetClass = focusWidget->widgetClass();
+
+ if ( widgetClass )
+ {
+ if ( *widgetClass == 'Y' ) // skip leading "Y" (YPushButton, YInputField, ...)
+ widgetClass++;
+
+ map->add( YCPString( "FocusWidgetClass" ), YCPSymbol( widgetClass ) );
+ }
+
+
+ // Add the Widget's shortcut property.
+ // This is usually the label (translated to the user's locale).
+
+ string debugLabel = focusWidget->debugLabel();
+
+ if ( ! debugLabel.empty() )
+ map->add( YCPString( "FocusWidgetDebugLabel" ), YCPString( debugLabel ) );
+ }
+}
+
+
Added: trunk/core/libyui/src/YCPEvent.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPEvent.h?rev=43983&view=auto
==============================================================================
--- trunk/core/libyui/src/YCPEvent.h (added)
+++ trunk/core/libyui/src/YCPEvent.h Tue Jan 29 20:07:06 2008
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPEvent.h
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+#ifndef YCPEvent_h
+#define YCPEvent_h
+
+
+#include
+#include
+
+#include "YEvent.h"
+
+
+/**
+ * Adaptor class to translate YEvents to YCPValues.
+ **/
+class YCPEvent
+{
+public:
+
+ /**
+ * Constructor.
+ *
+ * This does NOT transfer ownership of 'event' to this object.
+ **/
+ YCPEvent( const YEvent * event );
+
+ /**
+ * Return the event ID for this event.
+ * This is the same that UI::UserInput() returns.
+ **/
+ YCPValue eventId() const;
+
+ /**
+ * Return the event map for this event.
+ * This is the same map that UI::WaitForEvent() returns.
+ **/
+ YCPMap eventMap() const;
+
+ /**
+ * Return the raw event.
+ **/
+ const YEvent * event() const { return _event; }
+
+private:
+
+ /**
+ * Add the map fields (key/value pairs) for a widget event
+ * if this is a widget event. Do nothing otherwise.
+ **/
+ void addWidgetEventFields( YCPMap & map, const YCPValue & id ) const;
+
+ /**
+ * Add the map fields (key/value pairs) for a key event
+ * if this is a key event. Do nothing otherwise.
+ **/
+ void addKeyEventFields ( YCPMap & map, const YCPValue & id ) const;
+
+
+ const YEvent * _event;
+};
+
+
+
+#endif // YCPEvent_h
Modified: trunk/core/libyui/src/YEvent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YEvent.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/YEvent.cc (original)
+++ trunk/core/libyui/src/YEvent.cc Tue Jan 29 20:07:06 2008
@@ -20,14 +20,8 @@
#define YUILogComponent "ui-events"
#include "YUILog.h"
-#include
-#include
-#include
#include "YWidget.h"
-#include "YCPItem.h"
-#include "YCPMenuItem.h"
#include "YEvent.h"
-#include "YCPValueWidgetID.h"
using std::string;
@@ -98,25 +92,6 @@
}
-YCPValue YEvent::userInput()
-{
- return YCPVoid();
-}
-
-
-YCPMap YEvent::ycpEvent()
-{
- YCPMap map;
-
- map->add( YCPString( "EventType" ), YCPString ( toString( eventType() ) ) );
- map->add( YCPString( "EventSerialNo" ), YCPInteger( serial() ) );
-
- return map;
-}
-
-
-
-
YWidgetEvent::YWidgetEvent( YWidget * widget,
@@ -129,73 +104,6 @@
}
-YCPMap YWidgetEvent::ycpEvent()
-{
- // Use the generic YEvent's map as a base
-
- YCPMap map = YEvent::ycpEvent();
- map->add( YCPString( "EventReason" ), YCPString ( toString( reason() ) ) );
-
- if ( _widget )
- {
- // Add widget specific info:
- // Add WidgetID
-
- if ( _widget->hasId() )
- {
- YCPValueWidgetID * id = dynamic_cast ( _widget->id() );
-
- if ( id )
- {
- map->add( YCPString( "ID" ), id->value() );
- map->add( YCPString( "WidgetID" ), id->value() ); // This is just an alias
- }
- }
-
-
- // Add WidgetClass
-
- const char * widgetClass = _widget->widgetClass();
-
- if ( widgetClass )
- {
- if ( *widgetClass == 'Y' ) // skip leading "Y" (YPushButton, YInputField, ...)
- widgetClass++;
-
- map->add( YCPString( "WidgetClass" ), YCPSymbol( widgetClass ) );
- }
-
-
- // Add the Widget's debug label.
- // This is usually the label (translated to the user's locale).
-
- string debugLabel = _widget->debugLabel();
-
- if ( ! debugLabel.empty() )
- map->add( YCPString( "WidgetDebugLabel" ), YCPString( debugLabel ) );
- }
-
- return map;
-}
-
-
-YCPValue YWidgetEvent::userInput()
-{
- if ( _widget->hasId() )
- {
- YCPValueWidgetID * id = dynamic_cast ( _widget->id() );
-
- if ( id )
- return id->value();
- }
-
- return YCPVoid();
-}
-
-
-
-
-
YKeyEvent::YKeyEvent( const string & keySymbol,
YWidget * focusWidget )
@@ -205,131 +113,3 @@
{
}
-
-YCPMap YKeyEvent::ycpEvent()
-{
- // Use the generic YEvent's map as a base
-
- YCPMap map = YEvent::ycpEvent();
-
- if ( ! _keySymbol.empty() )
- {
- map->add( YCPString( "KeySymbol" ), YCPString( _keySymbol ) );
- map->add( YCPString( "ID" ), YCPString( _keySymbol ) ); // just an alias
- }
-
- if ( _focusWidget )
- {
- // Add widget specific info:
- // Add ID of the focus widget
-
- if ( _focusWidget->hasId() )
- {
- YCPValueWidgetID * id = dynamic_cast ( _focusWidget->id() );
-
- if ( id )
- map->add( YCPString( "FocusWidgetID" ), id->value() ); // just an alias
- }
-
-
- // Add WidgetClass
-
- const char * widgetClass = _focusWidget->widgetClass();
-
- if ( widgetClass )
- {
- if ( *widgetClass == 'Y' ) // skip leading "Y" (YPushButton, YInputField, ...)
- widgetClass++;
-
- map->add( YCPString( "FocusWidgetClass" ), YCPSymbol( widgetClass ) );
- }
-
-
- // Add the Widget's shortcut property.
- // This is usually the label (translated to the user's locale).
-
- string debugLabel = _focusWidget->debugLabel();
-
- if ( ! debugLabel.empty() )
- map->add( YCPString( "FocusWidgetDebugLabel" ), YCPString( debugLabel ) );
- }
-
- return map;
-}
-
-
-YCPValue YKeyEvent::userInput()
-{
- return YCPString( _keySymbol );
-}
-
-
-
-
-
-
-YSimpleEvent::YSimpleEvent( EventType eventType,
- const YCPValue & id )
- : YEvent( eventType )
- , _id( id )
-{
-}
-
-
-YSimpleEvent::YSimpleEvent( EventType eventType,
- const char * id )
- : YEvent( eventType )
- , _id( YCPString( id ) )
-{
-}
-
-
-YSimpleEvent::YSimpleEvent( EventType eventType,
- const string & id )
- : YEvent( eventType )
- , _id( YCPString( id ) )
-{
-}
-
-
-YCPMap YSimpleEvent::ycpEvent()
-{
- // Use the generic YEvent's map as a base
-
- YCPMap map = YEvent::ycpEvent();
-
- // Add ID
- map->add( YCPString( "ID" ), id() );
-
- return map;
-}
-
-
-YCPValue YSimpleEvent::userInput()
-{
- return id();
-}
-
-
-
-
-YCPValue YMenuEvent::id() const
-{
- if ( _item )
- {
- YCPMenuItem * ycpMenuItem = dynamic_cast (_item);
-
- if ( ycpMenuItem )
- return ycpMenuItem->id();
-
- YCPItem * ycpItem = dynamic_cast (_item);
-
- if ( ycpItem )
- return ycpItem->id();
-
- return YCPString( _item->label() );
- }
-
- return _id;
-}
-
Modified: trunk/core/libyui/src/YEvent.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YEvent.h?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/YEvent.h (original)
+++ trunk/core/libyui/src/YEvent.h Tue Jan 29 20:07:06 2008
@@ -21,10 +21,6 @@
#include <string>
-#include
-#include
-#include
-#include
using std::string;
class YWidget;
@@ -33,7 +29,7 @@
/**
* Abstract base class for events to be returned upon UI::UserInput()
- * and related.
+ * and related functions.
**/
class YEvent
{
@@ -68,7 +64,7 @@
/**
* Virtual desctructor to force a polymorph object
- * so dynamic_cast can be used
+ * so dynamic_cast<> can be used.
**/
virtual ~YEvent();
@@ -93,20 +89,6 @@
**/
static const char * toString( EventReason reason );
- /**
- * Constructs a YCP map to be returned upon UI::WaitForEvent().
- **/
- virtual YCPMap ycpEvent();
-
- /**
- * Returns the ID to be returned upon UI::UserInput().
- *
- * This is the same as the "id" field of the ycpEvent() map
- * (if this type of event has any such field in its map).
- * It may also be YCPVoid() (nil).
- **/
- virtual YCPValue userInput();
-
protected:
@@ -141,21 +123,6 @@
**/
EventReason reason() const { return _reason; }
- /**
- * Constructs a YCP map to be returned upon UI::WaitForEvent().
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPMap ycpEvent();
-
- /**
- * Returns the ID to be returned upon UI::UserInput().
- * This is the same as the "id" field of the ycpEvent() map.
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPValue userInput();
-
protected:
YWidget * _widget;
@@ -186,26 +153,11 @@
/**
* Returns the widget that currently has the keyboard focus.
*
- * This might as well be 0 if no widget has the focus or if the creator of
+ * This might be 0 if no widget has the focus or if the creator of
* this event could not obtain that information.
**/
YWidget * focusWidget() const { return _focusWidget; }
- /**
- * Constructs a YCP map to be returned upon UI::WaitForEvent().
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPMap ycpEvent();
-
- /**
- * Returns the ID to be returned upon UI::UserInput().
- * This is the same as the "id" field of the ycpEvent() map.
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPValue userInput();
-
protected:
string _keySymbol;
@@ -214,72 +166,36 @@
/**
- * Abstract base class for events that just deal with an ID.
- **/
-class YSimpleEvent: public YEvent
-{
-public:
-
- /**
- * Constructors.
- **/
- YSimpleEvent( EventType eventType, const YCPValue & id );
- YSimpleEvent( EventType eventType, const char * id );
- YSimpleEvent( EventType eventType, const string & id );
-
- /**
- * Returns the ID associated with this event.
- **/
- virtual YCPValue id() const { return _id; }
-
- /**
- * Constructs a YCP map to be returned upon UI::WaitForEvent().
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPMap ycpEvent();
-
- /**
- * Returns the ID to be returned upon UI::UserInput().
- * This is the same as the "id" field of the ycpEvent() map.
- *
- * Reimplemented from YEvent.
- **/
- virtual YCPValue userInput();
-
-
-protected:
-
- YCPValue _id;
-};
-
-
-/**
* Event to be returned upon menu selection.
**/
-class YMenuEvent: public YSimpleEvent
+class YMenuEvent: public YEvent
{
public:
YMenuEvent( YItem * item )
- : YSimpleEvent( MenuEvent, YCPVoid() ),
- _item( item )
+ : YEvent( MenuEvent )
+ , _item( item )
{}
- YMenuEvent( const YCPValue & id ) : YSimpleEvent( MenuEvent, id ), _item(0) {}
- YMenuEvent( const char * id ) : YSimpleEvent( MenuEvent, id ), _item(0) {}
- YMenuEvent( const string & id ) : YSimpleEvent( MenuEvent, id ), _item(0) {}
+ YMenuEvent( const char * id ) : YEvent( MenuEvent ), _item(0), _id( id ) {}
+ YMenuEvent( const string & id ) : YEvent( MenuEvent ), _item(0), _id( id ) {}
/**
- * Returns the ID associated with this event.
- *
- * Reimplemented from YSimpleEvent.
+ * Return the YItem that corresponds to this event or 0 if the event was
+ * constructed with a string ID.
+ **/
+ YItem * item() const { return _item; }
+
+ /**
+ * Return the string ID of this event. This will be an empty string if the
+ * event was constructed with a YItem.
**/
- virtual YCPValue id() const;
+ string id() const { return _id; }
protected:
YItem * _item;
+ string _id;
};
@@ -287,11 +203,11 @@
* Event to be returned upon closing a dialog with the window manager close
* button (or Alt-F4)
**/
-class YCancelEvent: public YSimpleEvent
+class YCancelEvent: public YEvent
{
public:
- YCancelEvent() : YSimpleEvent( CancelEvent, YCPSymbol( "cancel" ) ) {}
+ YCancelEvent() : YEvent( CancelEvent ) {}
};
@@ -299,11 +215,11 @@
* Event to be returned upon closing a dialog with the window manager close
* button (or Alt-F4)
**/
-class YDebugEvent: public YSimpleEvent
+class YDebugEvent: public YEvent
{
public:
- YDebugEvent() : YSimpleEvent( DebugEvent, YCPSymbol( "debugHotkey" ) ) {}
+ YDebugEvent() : YEvent( DebugEvent ) {}
};
@@ -311,14 +227,12 @@
* Event to be returned upon timeout
* (i.e. no event available in the specified timeout)
**/
-class YTimeoutEvent: public YSimpleEvent
+class YTimeoutEvent: public YEvent
{
public:
- YTimeoutEvent() : YSimpleEvent( TimeoutEvent, YCPSymbol( "timeout" ) ) {}
+ YTimeoutEvent() : YEvent( TimeoutEvent ) {}
};
-
-
#endif // YEvent_h
Modified: trunk/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Tue Jan 29 20:07:06 2008
@@ -426,7 +426,7 @@
**/
virtual YEvent * pollInput() = 0;
-
+
public:
/**
* Show and activate a previously created dialog.
@@ -521,12 +521,10 @@
/**
* UI-specific runPkgSelection method.
- * This default implementation does nothing.
*
- * Use this to post-initialize widget stuff that cannot be upon creating
- * the PackageSelector.
+ * Derived classes are required to implement this.
**/
- virtual YCPValue runPkgSelection( YWidget * /*packageSelector*/ ) { return YCPVoid(); }
+ virtual YEvent * runPkgSelection( YWidget * packageSelector ) = 0;
Modified: trunk/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Tue Jan 29 20:07:06 2008
@@ -58,6 +58,7 @@
#include "YWizard.h"
#include "YWidgetFactory.h"
#include "YCPErrorDialog.h"
+#include "YCPEvent.h"
#include "YCPValueWidgetID.h"
#include "YCPDialogParser.h"
#include "YCPItemParser.h"
@@ -605,11 +606,12 @@
if ( event )
{
-
+ YCPEvent ycpEvent( event );
+
if ( detailed )
- input = event->ycpEvent(); // The event map
+ input = ycpEvent.eventMap();
else
- input = event->userInput(); // Only one single ID (or 'nil')
+ input = ycpEvent.eventId();
#if VERBOSE_EVENTS
yuiDebug() << "Got regular event from keyboard / mouse: " << input << endl;
@@ -1664,8 +1666,21 @@
YCPValue id = YCPDialogParser::parseIdTerm( value_id );
YWidget * selector = YCPDialogParser::findWidgetWithId( id );
- // call overloaded method from specific UI
- result = runPkgSelection( selector );
+ yuiMilestone() << "Running package selection..." << endl;
+ YEvent * event = runPkgSelection( selector );
+
+ if ( event )
+ {
+ YCPEvent ycpEvent( event );
+ result = ycpEvent.eventId();
+
+ if ( result->isString() )
+ result = YCPSymbol( result->asString()->value() ); // "accept" -> `accept
+
+ yuiMilestone() << "Package selection done. Returning with " << result << endl;
+
+ delete event;
+ }
}
catch ( YUIException & exception )
{
Modified: trunk/core/package/yast2-core.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Tue Jan 29 20:07:06 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jan 29 20:02:26 CET 2008 - sh@suse.de
+
+- YCP-less event handling in libyui core
+- V 2.16.24
+
+-------------------------------------------------------------------
Fri Jan 25 19:56:35 CET 2008 - sh@suse.de
- Improved UI syntax error handling: Open dialogs to inform the user
Modified: trunk/ncurses/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/VERSION?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/VERSION (original)
+++ trunk/ncurses/VERSION Tue Jan 29 20:07:06 2008
@@ -1 +1 @@
-2.16.11
+2.16.12
Modified: trunk/ncurses/package/yast2-ncurses.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/package/yast2-ncurses.changes?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/package/yast2-ncurses.changes (original)
+++ trunk/ncurses/package/yast2-ncurses.changes Tue Jan 29 20:07:06 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jan 29 20:04:53 CET 2008 - sh@suse.de
+
+- YCP-less event handling
+- V 2.16.12
+
+-------------------------------------------------------------------
Tue Jan 29 15:50:37 CET 2008 - kmachalkova@suse.cz
- Delete any leftover dialogs (popups, menus) on exit from package
Modified: trunk/ncurses/src/NCPackageSelectorPlugin.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCPackageSelectorPlugin.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/src/NCPackageSelectorPlugin.cc (original)
+++ trunk/ncurses/src/NCPackageSelectorPlugin.cc Tue Jan 29 20:07:06 2008
@@ -22,6 +22,7 @@
#include
#include "NCPackageSelectorStart.h"
#include "NCPkgTable.h"
+#include "YNCursesUI.h" // NCtoY2Event
#define y2log_component "ncurses-ui"
@@ -124,12 +125,12 @@
//
//
// METHOD NAME : NCPackageSelectorPLugin::runPkgSelection
-// METHOD TYPE : void
+// METHOD TYPE : YEvent *
//
// DESCRIPTION : Implementation of UI builtin RunPkgSelection() which
// has to be called after OpenDialog( `PackageSelector() ).
//
-YCPValue NCPackageSelectorPlugin::runPkgSelection( YDialog * dialog,
+YEvent * NCPackageSelectorPlugin::runPkgSelection( YDialog * dialog,
YWidget * selector )
{
NCPackageSelectorStart * ncSelector = 0;
@@ -139,12 +140,12 @@
if ( !dialog )
{
UIERR << "ERROR package selection: No dialog existing." << endl;
- return YCPVoid();
+ return 0;
}
if ( !selector )
{
UIERR << "ERROR package selection: No package selector existing." << endl;
- return YCPVoid();
+ return 0;
}
ncSelector = dynamic_cast( selector );
@@ -186,16 +187,16 @@
if ( event.result != "" )
{
- //before returning some value to YCP client
- //we must delete (==close) any leftover dialogs,
- //Wizard will not do it for us (#354712)
+ // Before returning some value to the YCP client,
+ // we must delete (==close) any leftover dialogs,
+ // Wizard will not do it for us (#354712)
while( YDialog::topmostDialog() != dialog ) {
YDialog::deleteTopmostDialog();
}
NCMIL << "Return value: " << event.result << endl;
- return YCPSymbol( event.result );
+ return new YMenuEvent( event.result );
}
else
- return YCPVoid();
+ return new YCancelEvent();
}
Modified: trunk/ncurses/src/NCPackageSelectorPlugin.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCPackageSelectorPlugin.h?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/src/NCPackageSelectorPlugin.h (original)
+++ trunk/ncurses/src/NCPackageSelectorPlugin.h Tue Jan 29 20:07:06 2008
@@ -23,6 +23,7 @@
#include
#include
+#include
#include
@@ -58,7 +59,7 @@
/**
* Fills the PackageSelector widget (runs the package selection).
*/
- virtual YCPValue runPkgSelection( YDialog *currentDialog,
+ virtual YEvent * runPkgSelection( YDialog *currentDialog,
YWidget * packageSelector );
/**
Modified: trunk/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Tue Jan 29 20:07:06 2008
@@ -279,7 +279,6 @@
ncd->activate ( false );
YEvent * yevent = cevent.propagate();
- UIDBG << "Returning event: " << ( yevent ? yevent->ycpEvent()->toString().c_str() : "(nil)" ) << endl;
return yevent;
}
@@ -305,9 +304,6 @@
YEvent * yevent = cevent.propagate();
- if ( yevent )
- UIDBG << "Returning event: " << yevent->ycpEvent()->toString() << endl;
-
return yevent;
}
@@ -375,14 +371,14 @@
//
//
// METHOD NAME : YNCursesUI::runPkgSelection
-// METHOD TYPE : YCPValue
+// METHOD TYPE : YEvent *
//
// DESCRIPTION : Implementation of UI builtin RunPkgSelection() which
// has to be called after OpenDialog( `PackageSelector() ).
//
-YCPValue YNCursesUI::runPkgSelection( YWidget * selector )
+YEvent * YNCursesUI::runPkgSelection( YWidget * selector )
{
- YCPValue result = YCPVoid();
+ YEvent * event = 0;
YDialog *dialog = YDialog::currentDialog();
NCPackageSelectorPlugin * plugin = packageSelectorPlugin();
@@ -390,12 +386,12 @@
if ( !dialog )
{
UIERR << "ERROR package selection: No dialog rexisting." << endl;
- return YCPVoid();
+ return 0;
}
if ( !selector )
{
UIERR << "ERROR package selection: No package selector existing." << endl;
- return YCPVoid();
+ return 0;
}
// FIXME - remove debug logging
NCMIL << "Dump current dialog in YNCursesUI::runPkgSelection" << endl;
@@ -404,10 +400,10 @@
if ( plugin )
{
- result = plugin->runPkgSelection( dialog, selector );
+ event = plugin->runPkgSelection( dialog, selector );
}
- return result;
+ return event;
}
Modified: trunk/ncurses/src/YNCursesUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.h (original)
+++ trunk/ncurses/src/YNCursesUI.h Tue Jan 29 20:07:06 2008
@@ -132,9 +132,9 @@
virtual void closeDialog( YDialog * dialog );
/**
- * Fills the PackageSelector widget.
+ * Fills the PackageSelector widget and runs package selection.
*/
- virtual YCPValue runPkgSelection( YWidget * packageSelector );
+ virtual YEvent * runPkgSelection( YWidget * packageSelector );
/**
* UI-specific setConsoleFont() function.
Modified: trunk/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/pkg/NCPackageSelector.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ trunk/ncurses/src/pkg/NCPackageSelector.cc Tue Jan 29 20:07:06 2008
@@ -57,6 +57,7 @@
#include "YWidgetID.h"
#include "YCPDialogParser.h"
+#include "YCPMenuItem.h"
#include "YCPValueWidgetID.h"
#include "YPackageSelector.h"
@@ -495,22 +496,15 @@
string NCPackageSelector::getMenuId( YMenuItem *menuItem )
{
- string id;
- YMenuEvent * menuEvent;
-
- if ( !menuItem )
- return id;
-
- menuEvent = new YMenuEvent( menuItem );
- if ( menuEvent )
+ if ( menuItem )
{
- YCPValue selectionId = menuEvent->id();
- id = selectionId->toString();
+ YCPMenuItem * ycpMenuItem = dynamic_cast ( menuItem );
- delete menuEvent;
+ if ( ycpMenuItem )
+ return ycpMenuItem->id()->toString();
}
- return id;
+ return "";
}
///////////////////////////////////////////////////////////////////
Modified: trunk/ncurses/yast2-ncurses.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/yast2-ncurses.spec.in?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/ncurses/yast2-ncurses.spec.in (original)
+++ trunk/ncurses/yast2-ncurses.spec.in Tue Jan 29 20:07:06 2008
@@ -17,8 +17,8 @@
Provides: y2curses
Obsoletes: y2curses
Requires: glibc-locale
-BuildRequires: yast2-core-devel >= 2.16.23
-Requires: yast2-core >= 2.16.23
+BuildRequires: yast2-core-devel >= 2.16.24
+Requires: yast2-core >= 2.16.24
#adapted to libzypp 3.11 refactoring
Requires: libzypp >= 3.11.8
#FSize.h and YRpmGroupsTree.h moved to libyui
Modified: trunk/qt/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/VERSION.cmake (original)
+++ trunk/qt/VERSION.cmake Tue Jan 29 20:07:06 2008
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "2")
SET(VERSION_MINOR "16")
-SET(VERSION_PATCH "18")
+SET(VERSION_PATCH "19")
Modified: trunk/qt/package/yast2-qt.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/package/yast2-qt.changes (original)
+++ trunk/qt/package/yast2-qt.changes Tue Jan 29 20:07:06 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jan 29 20:03:56 CET 2008 - sh@suse.de
+
+- YCP-less event handling
+- V 2.16.19
+
+-------------------------------------------------------------------
Wed Jan 23 18:35:29 CET 2008 - sh@suse.de
- Use new YCP-less logging (part 1)
Modified: trunk/qt/src/YQDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDumbTab.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/YQDumbTab.cc (original)
+++ trunk/qt/src/YQDumbTab.cc Tue Jan 29 20:07:06 2008
@@ -72,8 +72,6 @@
_tabBar->insertTab( item->index(), fromUTF8( item->label() ) );
yuiDebug() << "Adding tab page [" << item->label() << "]" << endl;
-#warning YItem::setData
- // item->setData( tab );
if ( item->selected() )
_tabBar->setCurrentIndex( item->index() );
Modified: trunk/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Tue Jan 29 20:07:06 2008
@@ -174,7 +174,7 @@
*
* Reimplemented from YUI.
**/
- YCPValue runPkgSelection( YWidget * packageSelector );
+ virtual YEvent * runPkgSelection( YWidget * packageSelector );
/**
* Toggle macro recording (activated by Ctrl-Shift-Alt-M):
Modified: trunk/qt/src/YQUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_builtins.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/YQUI_builtins.cc (original)
+++ trunk/qt/src/YQUI_builtins.cc Tue Jan 29 20:07:06 2008
@@ -53,14 +53,16 @@
-YCPValue YQUI::runPkgSelection( YWidget * packageSelector )
+YEvent * YQUI::runPkgSelection( YWidget * packageSelector )
{
- yuiMilestone() << "Running package selection..." << endl;
- YCPValue input = YCPVoid();
+ YEvent * event = 0;
try
{
- input = evaluateUserInput();
+ do
+ {
+ event = filterInvalidEvents( userInput() );
+ } while ( ! event );
}
catch (const std::exception & e)
{
@@ -75,9 +77,7 @@
<< endl;
}
- yuiMilestone() << "Package selection done. Returning " << input->toString() << endl;
-
- return input;
+ return event;
}
Modified: trunk/qt/src/pkg/YQPackageSelectorBase.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPackageSelectorBase.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPackageSelectorBase.cc (original)
+++ trunk/qt/src/pkg/YQPackageSelectorBase.cc Tue Jan 29 20:07:06 2008
@@ -287,7 +287,7 @@
return;
yuiMilestone() << "Closing PackageSelector with \"Accept\"" << endl;
- YQUI::ui()->sendEvent( new YMenuEvent( YCPSymbol( "accept" ) ) );
+ YQUI::ui()->sendEvent( new YMenuEvent( "accept" ) );
}
Modified: trunk/qt/src/pkg/YQPatternSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPatternSelector.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPatternSelector.cc (original)
+++ trunk/qt/src/pkg/YQPatternSelector.cc Tue Jan 29 20:07:06 2008
@@ -363,7 +363,7 @@
YQPatternSelector::detailedPackageSelection()
{
yuiMilestone() << "\"Details..\" button clicked" << endl;
- YQUI::ui()->sendEvent( new YMenuEvent( YCPSymbol( "details" ) ) );
+ YQUI::ui()->sendEvent( new YMenuEvent( "details" ) );
}
Modified: trunk/qt/src/pkg/YQSimplePatchSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQSimplePatchSelector.cc?rev=43983&r1=43982&r2=43983&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQSimplePatchSelector.cc (original)
+++ trunk/qt/src/pkg/YQSimplePatchSelector.cc Tue Jan 29 20:07:06 2008
@@ -246,7 +246,7 @@
YQSimplePatchSelector::detailedPackageSelection()
{
yuiMilestone() << "\"Details..\" button clicked" << endl;
- YQUI::ui()->sendEvent( new YMenuEvent( YCPSymbol( "details" ) ) );
+ YQUI::ui()->sendEvent( new YMenuEvent( "details" ) );
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org