[yast-commit] r42557 - in /trunk: core/libyui/doc/examples/ core/libyui/src/ ncurses/src/ qt/src/
Author: sh-sh-sh Date: Fri Nov 30 14:19:17 2007 New Revision: 42557 URL: http://svn.opensuse.org/viewcvs/yast?rev=42557&view=rev Log: - Ported YDialog and derived to mod-ui - Removed YContainerWidget for good - Removed legacy YWidget::queryWidget() and YWidget::changeWidget() methods - Dropped support for outdated property handling with old YWidget::queryWidget() and YWidget::changeWidget() methods - Dropped support for outdated YWidget( YWidgetOpt ) constructors - Unified Y*WidgetFactory::create*Dialog() methods: - Added pure virtual YWidgetFactory::createDialog( type, colorMode) - Made YWidgetFactory::createMainDialog() and YWidgetFactory::createPopupDialog() non-virtual - Moved special YInputField macro handling for passwords to YMacroRecorder (don't record passwords in macros) - Removed unneeded YWidgetOpt fields - Catch exceptions in evaluateReplaceWidget (more graceful error handling) Removed: trunk/core/libyui/src/YContainerWidget.cc trunk/core/libyui/src/YContainerWidget.h Modified: trunk/core/libyui/doc/examples/DefaultSizeDialogs.ycp trunk/core/libyui/src/Makefile.am trunk/core/libyui/src/Y2UINamespace.cc trunk/core/libyui/src/YCPDialogParser.cc trunk/core/libyui/src/YCheckBoxFrame.cc trunk/core/libyui/src/YDialog.cc trunk/core/libyui/src/YDialog.h trunk/core/libyui/src/YInputField.cc trunk/core/libyui/src/YMacroRecorder.cc trunk/core/libyui/src/YMacroRecorder.h trunk/core/libyui/src/YTypes.h trunk/core/libyui/src/YUI.h trunk/core/libyui/src/YUISymbols.h trunk/core/libyui/src/YUI_builtins.cc trunk/core/libyui/src/YWidget.cc trunk/core/libyui/src/YWidget.h trunk/core/libyui/src/YWidgetFactory.cc trunk/core/libyui/src/YWidgetFactory.h trunk/core/libyui/src/YWidgetOpt.h trunk/ncurses/src/NCDialog.cc trunk/ncurses/src/NCDialog.h trunk/ncurses/src/NCPopup.cc trunk/ncurses/src/NCPopup.h trunk/ncurses/src/NCWidgetFactory.cc trunk/ncurses/src/NCWidgetFactory.h trunk/ncurses/src/YNCursesUI.cc trunk/ncurses/src/YNCursesUI.h trunk/qt/src/YQDialog.cc trunk/qt/src/YQDialog.h trunk/qt/src/YQInputField.cc trunk/qt/src/YQUI.h trunk/qt/src/YQUI_core.cc trunk/qt/src/YQWidgetFactory.cc trunk/qt/src/YQWidgetFactory.h Modified: trunk/core/libyui/doc/examples/DefaultSizeDialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/DefaultSizeDialogs.ycp?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/doc/examples/DefaultSizeDialogs.ycp (original) +++ trunk/core/libyui/doc/examples/DefaultSizeDialogs.ycp Fri Nov 30 14:19:17 2007 @@ -35,6 +35,14 @@ ); UI::UserInput(); + UI::OpenDialog(`opt(`defaultsize), + `VBox( + `Label( "A fourth main dialog" ), + `PushButton(`opt(`default), "OK\nLevel 4" ) + ) + ); + UI::UserInput(); + UI::OpenDialog( `VBox( `Label( "And another independent popup dialog" ), `PushButton(`opt(`default), "OK" ) @@ -46,5 +54,6 @@ UI::CloseDialog(); UI::UserInput(); UI::CloseDialog(); UI::UserInput(); UI::CloseDialog(); UI::UserInput(); + UI::CloseDialog(); UI::UserInput(); UI::CloseDialog(); } Modified: trunk/core/libyui/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Makefile.am?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/Makefile.am (original) +++ trunk/core/libyui/src/Makefile.am Fri Nov 30 14:19:17 2007 @@ -48,7 +48,6 @@ YCheckBox.cc \ YCheckBoxFrame.cc \ YComboBox.cc \ - YContainerWidget.cc \ YDateField.cc \ YDialog.cc \ YDownloadProgress.cc \ @@ -149,7 +148,6 @@ YCheckBox.h \ YCheckBoxFrame.h \ YComboBox.h \ - YContainerWidget.h \ YDateField.h \ YDialog.h \ YDownloadProgress.h \ Modified: trunk/core/libyui/src/Y2UINamespace.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/Y2UINamespace.cc (original) +++ trunk/core/libyui/src/Y2UINamespace.cc Fri Nov 30 14:19:17 2007 @@ -173,8 +173,7 @@ Y2UINamespace::OpenDialog( const YCPTerm & opts, const YCPTerm & dialog_term ) { if ( YUIComponent::ui() ) - // Notice: Parameter order is switched! - return YUIComponent::ui()->evaluateOpenDialog( dialog_term, opts ); + return YUIComponent::ui()->evaluateOpenDialog( opts, dialog_term ); else return YCPVoid(); } @@ -183,7 +182,7 @@ YCPValue Y2UINamespace::OpenDialog( const YCPTerm & dialog_term ) { - return m_comp->ui()->evaluateOpenDialog( dialog_term ); + return m_comp->ui()->evaluateOpenDialog( YCPNull(), dialog_term ); } Modified: trunk/core/libyui/src/YCPDialogParser.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPDialogParser.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YCPDialogParser.cc (original) +++ trunk/core/libyui/src/YCPDialogParser.cc Fri Nov 30 14:19:17 2007 @@ -317,29 +317,6 @@ if ( opt.isHStretchable.value() ) w->setStretchable( YD_HORIZ, true ); if ( opt.isVStretchable.value() ) w->setStretchable( YD_VERT, true ); if ( opt.key_Fxx.value() > 0 ) w->setFunctionKey( opt.key_Fxx.value() ); - - if ( w->oldStyleConstructor() ) - { - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - - if ( p && ! w->hasParent() ) - { - w->setParent( p ); - } - - if ( ! p->contains( w ) ) - { - y2warning( "Late adding child %s to %s", w->widgetClass(), p->widgetClass() ); - p->addChild( w ); - } - - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - } - } else { @@ -1248,21 +1225,6 @@ else logUnknownOption( term, optList->value(o) ); } - - // Look up default function keys unless explicitly set - -#if 0 - // FIXME - // FIXME - // FIXME - if ( opt.key_Fxx.value() == 0 ) - opt.key_Fxx.setValue( defaultFunctionKey( YCPString( label ) ) ); - // FIXME - // FIXME - // FIXME -#endif - - YPushButton * button = YUI::widgetFactory()->createPushButton( parent, label ); if ( opt.isDefaultButton.value() ) @@ -1454,10 +1416,10 @@ else logUnknownOption( term, optList->value(o) ); } - if ( opt.noAutoEnable.value() && opt.invertAutoEnable.value() ) + if ( invertAutoEnable && ! autoEnable ) { y2warning( "`opt(noAutoEnable) automatically disables `opt(`invertAutoEnable)" ); - opt.invertAutoEnable.setValue( false ); + invertAutoEnable = false; } YCheckBoxFrame * checkBoxFrame = YUI::widgetFactory()->createCheckBoxFrame( parent, label, checked ); Modified: trunk/core/libyui/src/YCheckBoxFrame.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCheckBoxFrame.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YCheckBoxFrame.cc (original) +++ trunk/core/libyui/src/YCheckBoxFrame.cc Fri Nov 30 14:19:17 2007 @@ -48,11 +48,6 @@ , priv( new YCheckBoxFramePrivate( label ) ) { YUI_CHECK_NEW( priv ); - -#if 0 - // FIXME - _debugLabelWidget = this; -#endif } Modified: trunk/core/libyui/src/YDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YDialog.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YDialog.cc (original) +++ trunk/core/libyui/src/YDialog.cc Fri Nov 30 14:19:17 2007 @@ -29,21 +29,30 @@ #define VERBOSE_DIALOGS 0 - std::stack<YDialog *> YDialog::_dialogStack; -YDialog::YDialog( const YWidgetOpt & opt ) - : YSingleChildContainerWidget( 0 ) +struct YDialogPrivate { - _hasDefaultSize.setValue( opt.hasDefaultSize.value() ); - _hasWarnColor.setValue( opt.hasWarnColor.value() ); - _hasInfoColor.setValue( opt.hasInfoColor.value() ); - _isDecorated.setValue( opt.isDecorated.value() ); - _isCentered.setValue( opt.isCentered.value() ); - _hasSmallDecorations.setValue( opt.hasSmallDecorations.value() ); - _shortcutCheckPostponed = false; + YDialogPrivate( YDialogType dialogType, YDialogColorMode colorMode ) + : dialogType( dialogType ) + , colorMode( colorMode ) + , shortcutCheckPostponed( false ) + {} + + YDialogType dialogType; + YDialogColorMode colorMode; + bool shortcutCheckPostponed; +}; + + +YDialog::YDialog( YDialogType dialogType, YDialogColorMode colorMode ) + : YSingleChildContainerWidget( 0 ) + , priv( new YDialogPrivate( dialogType, colorMode ) ) +{ + YUI_CHECK_NEW( priv ); + _dialogStack.push( this ); #if VERBOSE_DIALOGS @@ -60,54 +69,54 @@ } -YDialog * -YDialog::currentDialog( bool doThrow ) +YDialogType +YDialog::dialogType() const { - if ( _dialogStack.empty() ) - { - if ( doThrow ) - YUI_THROW( YUINoDialogException() ); - return 0; - } - else - return _dialogStack.top(); + return priv->dialogType; } -bool -YDialog::deleteTopmostDialog( bool doThrow ) +YDialogColorMode +YDialog::colorMode() const { - if ( _dialogStack.empty() ) - { - if ( doThrow ) - YUI_THROW( YUINoDialogException() ); - } - else - { - delete _dialogStack.top(); - _dialogStack.pop(); - } - - return ! _dialogStack.empty(); + return priv->colorMode; } void -YDialog::deleteAllDialogs() +YDialog::postponeShortcutCheck() { - while ( deleteTopmostDialog( false ) ) - {} + priv->shortcutCheckPostponed = true; } -int -YDialog::openDialogsCount() +bool +YDialog::shortcutCheckPostponed() const { - return _dialogStack.size(); + return priv->shortcutCheckPostponed; +} + + +void +YDialog::checkShortcuts( bool force ) +{ + if ( priv->shortcutCheckPostponed && ! force ) + { + y2debug( "shortcut check postponed" ); + } + else + { + + YShortcutManager shortcutManager( this ); + shortcutManager.checkShortcuts(); + + priv->shortcutCheckPostponed = false; + } } -void YDialog::setInitialSize() +void +YDialog::setInitialSize() { #if VERBOSE_DIALOGS y2debug( "Setting initial size for YDialog at %p", this ); @@ -118,88 +127,52 @@ } -void YDialog::checkShortcuts( bool force ) -{ - if ( _shortcutCheckPostponed && ! force ) - { - y2debug( "shortcut check postponed" ); - return; - } - YShortcutManager shortcutManager( this ); - shortcutManager.checkShortcuts(); - _shortcutCheckPostponed = false; -} - - -YCPValue YDialog::queryWidget( const YCPSymbol & property ) +YDialog * +YDialog::currentDialog( bool doThrow ) { - string symbol = property->symbol(); - - if ( symbol == YUIProperty_DebugLabel || - symbol == YUIProperty_DialogDebugLabel ) return YCPString( dialogDebugLabel() ); - else + if ( _dialogStack.empty() ) { - return YWidget::queryWidget( property ); + if ( doThrow ) + YUI_THROW( YUINoDialogException() ); + return 0; } + else + return _dialogStack.top(); } -string YDialog::dialogDebugLabel() +bool +YDialog::deleteTopmostDialog( bool doThrow ) { -#if 0 - // FIXME - // FIXME - // FIXME - - if ( _debugLabelWidget ) + if ( _dialogStack.empty() ) { - string label = _debugLabelWidget->debugLabel(); - - if ( ! label.empty() ) - return formatDebugLabel( _debugLabelWidget, label ); + if ( doThrow ) + YUI_THROW( YUINoDialogException() ); } - - for ( YWidgetListConstIterator * it = parent->childrenBegin(); - it != parent->childrenEnd(); - ++it ) + else { - string label = (*it)->debugLabel(); - - if ( ! label.empty() ) - return formatDebugLabel( child(i), label ); + delete _dialogStack.top(); + _dialogStack.pop(); } - // FIXME - // FIXME - // FIXME -#endif - - return widgetClass(); + return ! _dialogStack.empty(); } -string YDialog::formatDebugLabel( YWidget * widget, const string & debLabel ) +void +YDialog::deleteAllDialogs() { - if ( debLabel.empty() ) - return ""; - - string label = "Dialog with "; + while ( deleteTopmostDialog( false ) ) + {} +} - if ( widget->hasChildren() ) - { - label += debLabel; - } - else - { - label += widget->widgetClass(); - label += " \""; - label += debLabel; - label += "\""; - } - return label; +int +YDialog::openDialogsCount() +{ + return _dialogStack.size(); } Modified: trunk/core/libyui/src/YDialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YDialog.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YDialog.h (original) +++ trunk/core/libyui/src/YDialog.h Fri Nov 30 14:19:17 2007 @@ -25,6 +25,9 @@ class YMacroRecorder; class YShortcutManager; +class YDialogPrivate; + +// See YTypes.h for enum YDialogType and enum YDialogColorMode class YDialog : public YSingleChildContainerWidget @@ -32,8 +35,15 @@ protected: /** * Constructor. + * + * 'dialogType' is one of YMainDialog or YPopupDialog. + * + * 'colorMode' can be set to YDialogWarnColor to use very bright "warning" + * colors or YDialogInfoColor to use more prominent, yet not quite as + * bright as "warning" colors. Use both only very rarely. **/ - YDialog( const YWidgetOpt & opt ); + YDialog( YDialogType dialogType, + YDialogColorMode colorMode = YDialogNormalColor ); /** * Destructor. @@ -43,6 +53,12 @@ public: /** + * Return a descriptive name of this widget class for logging, + * debugging etc. + **/ + virtual const char * widgetClass() const { return "YDialog"; } + + /** * Delete the topmost dialog. * * Will throw a YUINoDialogException if there is no dialog and 'doThrow' is @@ -79,108 +95,54 @@ { return currentDialog( doThrow ); } /** - * Returns a descriptive name of this widget class for logging, - * debugging etc. - **/ - virtual const char * widgetClass() const { return "YDialog"; } - - /** - * Sets the initial dialog size. Honors the `defaultsize option - * and -geometry + * Set the initial dialog size, depending on dialogType: + * YMainDialog dialogs get the UI's "default main window" size, + * YPopupDialog dialogs use their content's preferred size. **/ void setInitialSize(); /** - * Returns true if the dialog has the `defaultsize option set. - **/ - bool hasDefaultSize() { return _hasDefaultSize.value(); } - - /** - * Returns true if the dialog has the `warncolor option set. + * Return this dialog's type (YMainDialog / YPopupDialog). **/ - bool hasWarnColor() { return _hasWarnColor.value(); } + YDialogType dialogType() const; /** - * Returns true if the dialog has the `infocolor option set. + * Return this dialog's color mode. **/ - bool hasInfoColor() { return _hasInfoColor.value(); } + YDialogColorMode colorMode() const; /** - * Returns true if the dialog has the `decorated option set. - **/ - bool isDecorated() { return _isDecorated.value(); } - - /** - * Returns true if the dialog has the `decorated option set. - **/ - bool isCentered() { return _isCentered.value(); } - - /** - * Returns true if the dialog has the `smallDecorations option set. - **/ - bool hasSmallDecorations() { return _hasSmallDecorations.value(); } - - /** - * Checks the keyboard shortcuts of all children of this dialog - * (not for sub-dialogs!) unless shortcut checks are postponed or 'force' - * is 'true'. + * Checks the keyboard shortcuts of widgets in this dialog unless shortcut + * checks are postponed or 'force' is 'true'. * * A forced shortcut check resets postponed checking. **/ void checkShortcuts( bool force = false ); /** - * From now on, postpone keyboard shortcut checks - - * i.e. normal ( not forced ) checkKeyboardShortcuts() will do nothing. - * Reset this mode by forcing a shortcut check with - * checkKeyboardShortcuts( true ). + * From now on, postpone keyboard shortcut checks - i.e. normal (not + * forced) checkKeyboardShortcuts() will do nothing. Reset this mode by + * forcing a shortcut check with checkKeyboardShortcuts( true ). **/ - void postponeShortcutCheck() { _shortcutCheckPostponed = true; } + void postponeShortcutCheck(); /** * Return whether or not shortcut checking is currently postponed. **/ - bool shortcutCheckPostponed() const { return _shortcutCheckPostponed; } + bool shortcutCheckPostponed() const; /** * Implements the ui command queryWidget **/ YCPValue queryWidget( const YCPSymbol & property ); - /** - * Returns a (possibly translated) text describing this dialog for - * debugging. - **/ - virtual std::string dialogDebugLabel(); - - /** - * Alias for dialogDebugLabel(); - **/ - virtual std::string debugLabel() { return dialogDebugLabel(); } - - protected: - /** - * Format a debug label. - **/ - string formatDebugLabel( YWidget * widget, const string & debLabel ); - - - // - // Data members - // + static std::stack<YDialog *> _dialogStack; - YBoolOpt _hasDefaultSize; - YBoolOpt _hasWarnColor; - YBoolOpt _hasInfoColor; - YBoolOpt _isDecorated; - YBoolOpt _isCentered; - YBoolOpt _hasSmallDecorations; +private: - bool _shortcutCheckPostponed; - - static std::stack<YDialog *> _dialogStack; + ImplPtr<YDialogPrivate> priv; }; Modified: trunk/core/libyui/src/YInputField.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YInputField.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YInputField.cc (original) +++ trunk/core/libyui/src/YInputField.cc Fri Nov 30 14:19:17 2007 @@ -178,34 +178,9 @@ void YInputField::saveUserInput( YMacroRecorder *macroRecorder ) { -#if 0 - // FIXME - // FIXME - // FIXME - - if ( passwordMode() ) - { - if ( hasId() ) - { - string text = "UI::"; - text += YUIBuiltin_ChangeWidget; - text += "( " + id()->toString() + ", \t`"; - text += YUIProperty_Value; - text += ", \"<not recording password in plain text>\" );\t// "; - text += widgetClass(); - text += " \"" + debugLabel() + "\""; - - macroRecorder->recordComment( text ); - } - } - else + if ( ! passwordMode() ) // Don't record passwords in the macro file { macroRecorder->recordWidgetProperty( this, YUIProperty_Value ); } - - // FIXME - // FIXME - // FIXME -#endif } Modified: trunk/core/libyui/src/YMacroRecorder.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YMacroRecorder.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YMacroRecorder.cc (original) +++ trunk/core/libyui/src/YMacroRecorder.cc Fri Nov 30 14:19:17 2007 @@ -30,6 +30,7 @@ #include "YUISymbols.h" #include "YWidget.h" +#include "YInputField.h" #include "YDialog.h" #include "YMacroRecorder.h" #include "YUIComponent.h" @@ -165,14 +166,6 @@ } -void YMacroRecorder::recordDialogDebugLabel() -{ - fprintf( _macroFile, "%s%s// %s\n", - YMACRO_INDENT, YMACRO_INDENT, - YDialog::currentDialog()->debugLabel().c_str() ); -} - - void YMacroRecorder::recordComment( string text ) { fprintf( _macroFile, "%s%s// %s\n", @@ -187,7 +180,6 @@ return; fprintf( _macroFile, "%s{\n", YMACRO_INDENT ); - recordDialogDebugLabel(); fprintf( _macroFile, "%s%s//\n", YMACRO_INDENT, YMACRO_INDENT ); recordYcpCodeLocation(); recordTimeStamp(); @@ -309,22 +301,41 @@ if ( ! widgetId ) return; - YCPTerm idTerm( YUISymbol_id ); // `id() + YCPTerm idTerm( YUISymbol_id ); // `id() idTerm->add( widgetId->value() ); // `id( `something ) - YCPValue val = widget->queryWidget( YCPSymbol( propertyName ) ); + YInputField * inputField = dynamic_cast<YInputField *> (widget); - fprintf( _macroFile, "%s%sUI::%s( %s,\t`%s,\t%s );\t// %s \"%s\"\n", - // UI::ChangeWidget( `id( `something ), `Value, 42 ) // YWidget - YMACRO_INDENT, YMACRO_INDENT, - YUIBuiltin_ChangeWidget, - idTerm->toString().c_str(), - propertyName, - val->toString().c_str(), - widget->widgetClass(), - widget->debugLabel().c_str() ); + if ( inputField && inputField->passwordMode() ) + { + // Don't record passwords in the macro file - y2debug( "Recording %s status: %s: %s", - widget->widgetClass(), propertyName, val->toString().c_str() ); + string text = "UI::"; + text += YUIBuiltin_ChangeWidget; + text += "( " + idTerm->toString() + ", \t`"; + text += YUIProperty_Value; + text += ", \"<not recording password in plain text>\" );\t// "; + text += widget->widgetClass(); + text += " \"" + widget->debugLabel() + "\""; + + recordComment( text ); + } + else + { + YCPValue val = YUI::ui()->evaluateQueryWidget( idTerm, YCPSymbol( propertyName ) ); + + fprintf( _macroFile, "%s%sUI::%s( %s,\t`%s,\t%s );\t// %s \"%s\"\n", + // UI::ChangeWidget( `id( `something ), `Value, 42 ) // YWidget + YMACRO_INDENT, YMACRO_INDENT, + YUIBuiltin_ChangeWidget, + idTerm->toString().c_str(), + propertyName, + val->toString().c_str(), + widget->widgetClass(), + widget->debugLabel().c_str() ); + + y2debug( "Recording %s status: %s: %s", + widget->widgetClass(), propertyName, val->toString().c_str() ); + } } Modified: trunk/core/libyui/src/YMacroRecorder.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YMacroRecorder.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YMacroRecorder.h (original) +++ trunk/core/libyui/src/YMacroRecorder.h Fri Nov 30 14:19:17 2007 @@ -115,11 +115,6 @@ void recordTimeStamp(); /** - * Record a human-readable identification of the dialog (its heading etc.) - **/ - void recordDialogDebugLabel(); - - /** * The internally used macro file; valid if non-null. **/ FILE * _macroFile; Modified: trunk/core/libyui/src/YTypes.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YTypes.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YTypes.h (original) +++ trunk/core/libyui/src/YTypes.h Fri Nov 30 14:19:17 2007 @@ -53,4 +53,20 @@ }; +enum YDialogType +{ + YMainDialog, + YPopupDialog +}; + + +enum YDialogColorMode +{ + YDialogNormalColor, // Default + YDialogInfoColor, // Brighter colors + YDialogWarnColor // Very bright Warning colors +}; + + + #endif // YTypes_h Modified: trunk/core/libyui/src/YUI.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YUI.h (original) +++ trunk/core/libyui/src/YUI.h Fri Nov 30 14:19:17 2007 @@ -48,9 +48,6 @@ class Y2UIFunction; class YUIBuiltinCallData; -// FIXME: Obsolete -class YContainerWidget; - struct YUIBuiltinCallData { @@ -308,7 +305,7 @@ YCPValue evaluateHasSpecialWidget ( const YCPSymbol & widget ); void evaluateMakeScreenShot ( const YCPString & filename ); void evaluateNormalCursor (); - YCPBoolean evaluateOpenDialog ( const YCPTerm & term, const YCPTerm & opts = YCPNull() ); + YCPBoolean evaluateOpenDialog ( const YCPTerm & opts, const YCPTerm & dialogTerm ); void evaluatePlayMacro ( const YCPString & filename ); void evaluatePostponeShortcutCheck (); YCPValue evaluateQueryWidget ( const YCPValue& value_id, const YCPValue& property ); @@ -441,16 +438,6 @@ **/ virtual YCPString glyph( const YCPSymbol & glyphSymbol ) { return YCPString( "" ); } - - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete -public: - virtual YDialog *createDialog( YWidgetOpt & opt ) = 0; - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - protected: Modified: trunk/core/libyui/src/YUISymbols.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUISymbols.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YUISymbols.h (original) +++ trunk/core/libyui/src/YUISymbols.h Fri Nov 30 14:19:17 2007 @@ -153,7 +153,6 @@ #define YUIProperty_CurrentSize "CurrentSize" #define YUIProperty_CurrentItem "CurrentItem" #define YUIProperty_DebugLabel "DebugLabel" -#define YUIProperty_DialogDebugLabel "DialogDebugLabel" #define YUIProperty_EasterEgg "EasterEgg" #define YUIProperty_Enabled "Enabled" #define YUIProperty_ExpectedSize "ExpectedSize" @@ -200,6 +199,7 @@ #define YUIOpt_invertAutoEnable "invertAutoEnable" #define YUIOpt_keepSorting "keepSorting" #define YUIOpt_keyEvents "keyEvents" +#define YUIOpt_mainDialog "mainDialog" #define YUIOpt_noAutoEnable "noAutoEnable" #define YUIOpt_notify "notify" #define YUIOpt_outputField "outputField" @@ -208,7 +208,6 @@ #define YUIOpt_scaleToFit "scaleToFit" #define YUIOpt_searchMode "searchMode" #define YUIOpt_shrinkable "shrinkable" -#define YUIOpt_smallDecorations "smallDecorations" #define YUIOpt_stepsEnabled "stepsEnabled" #define YUIOpt_summaryMode "summaryMode" #define YUIOpt_testMode "testMode" Modified: trunk/core/libyui/src/YUI_builtins.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YUI_builtins.cc (original) +++ trunk/core/libyui/src/YUI_builtins.cc Fri Nov 30 14:19:17 2007 @@ -24,8 +24,6 @@ #define VERBOSE_REPLACE_WIDGET 0 #define VERBOSE_EVENTS 0 -#define NONFATAL_OPENDIALOG_EXCEPTIONS 0 - #include <stdio.h> #include <unistd.h> // pipe() #include <fcntl.h> // fcntl() @@ -52,6 +50,7 @@ #include "YReplacePoint.h" #include "YShortcut.h" #include "YWizard.h" +#include "YWidgetFactory.h" #include "YCPValueWidgetID.h" #include "YCPDialogParser.h" #include "YCPItemParser.h" @@ -705,39 +704,37 @@ * Same as the OpenDialog with one argument, but you can specify options * with a term of the form <tt><b>`opt</b></tt>. * - * The option <tt>`defaultsize</tt> makes the dialog be resized to the default - * size, for example for the Qt interface the -geometry option is honored and - * for ncurses the dialog fills the whole window. - * - * The option <tt>`centered</tt> centers the dialog to the desktop. - * This has no effect for popup dialogs that are a child of a `defaultsize dialog - * that is currently visible. - * - * The option <tt>`decorated</tt> add a window border around the dialog, which - * comes in handy if no window manager is running. This option may be ignored in - * non-graphical UIs. - * - * <tt>`smallDecorations</tt> tells the window manager to use only minimal - * decorations - in particular, no title bar. This is useful for very small - * popups (like only a one line label and no button). Don't overuse this. - * This option is ignored for `defaultsize dialogs. + * The <tt>`mainDialog</tt> option creates a "main window" dialog: + * The dialog will get a large "default size". In the Qt UI, this typically + * means 800x600 pixels large (or using a -geometry command line argument if + * present) or full screen. In the NCurses UI, this is always full screen. + * + * <tt>`defaultsize</tt> is an alias for <tt>`mainDialog</tt>. * - * The option <tt>`warncolor</tt> displays the entire dialog in a bright + * The <tt>`warncolor</tt> option displays the entire dialog in a bright * warning color. * - * The option <tt>`infocolor</tt> is a less intrusive color. + * The <tt>`infocolor</tt> option displays the dialog in a color scheme that is + * distinct from the normal colors, but not as bright as warncolor. + * + * The <tt>`decorated</tt> option is now obsolete, but still accepted to keep + * old code working. + * + * The <tt>`centered</tt> option is now obsolete, but still accepted to keep + * old code working. * * @param term options * @param term widget * @return boolean * - * @usage OpenDialog( `opt( `defaultsize ), `Label( "Hi" ) ) + * @usage OpenDialog( `opt( `defaultsize ), `Label( "Hello, World!" ) ) */ -YCPBoolean YUI::evaluateOpenDialog( const YCPTerm & dialog_term, const YCPTerm & opts ) +YCPBoolean YUI::evaluateOpenDialog( const YCPTerm & opts, const YCPTerm & dialogTerm ) { - YWidgetOpt opt; - + YDialogType dialogType = YPopupDialog; + YDialogColorMode colorMode = YDialogNormalColor; + if ( ! opts.isNull() ) // evaluate `opt() contents { YCPList optList = opts->args(); @@ -746,59 +743,48 @@ { if ( optList->value(o)->isSymbol() ) { - if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_defaultsize ) opt.hasDefaultSize.setValue( true ); - else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_warncolor ) opt.hasWarnColor.setValue( true ); - else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_infocolor ) opt.hasInfoColor.setValue( true ); - else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_decorated ) opt.isDecorated.setValue( true ); - else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_centered ) opt.isCentered.setValue( true ); - else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_smallDecorations ) opt.hasSmallDecorations.setValue( true ); + if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_mainDialog ) dialogType = YMainDialog; + if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_defaultsize ) dialogType = YMainDialog; + else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_infocolor ) colorMode = YDialogInfoColor; + else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_warncolor ) colorMode = YDialogWarnColor; + else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_decorated ) {} // obsolete + else if ( optList->value(o)->asSymbol()->symbol() == YUIOpt_centered ) {} // obsolete else y2warning( "Unknown option %s for OpenDialog", opts->value(o)->toString().c_str() ); } } } - blockEvents(); // We don't want self-generated events from UI builtins. - YDialog *dialog = createDialog( opt ); + blockEvents(); // Prevent self-generated events from UI built-ins. - if ( dialog ) + bool ok = true; + + try { -#if NONFATAL_OPENDIALOG_EXCEPTIONS - try - { -#endif - YWidget * child = YCPDialogParser::parseWidgetTreeTerm( dialog, dialog_term ); + YDialog * dialog = YUI::widgetFactory()->createDialog( dialogType, colorMode ); + YUI_CHECK_NEW( dialog ); - if ( child ) - { - dialog->setInitialSize(); - dialog->checkShortcuts(); - showDialog( dialog ); + YCPDialogParser::parseWidgetTreeTerm( dialog, dialogTerm ); - unblockEvents(); - return YCPBoolean( true ); - } - else - { - YDialog::deleteTopmostDialog(); - } -#if NONFATAL_OPENDIALOG_EXCEPTIONS - } - catch ( YUIException & exception ) - { - YUI_CAUGHT( exception ); + dialog->setInitialSize(); + dialog->checkShortcuts(); + showDialog( dialog ); + } + catch ( YUIException & exception ) + { + YUI_CAUGHT( exception ); - // Delete this half-created dialog: - // Some widgets are in a very undefined state (no children etc.) - YDialog::deleteTopmostDialog(); + // Delete this half-created dialog: + // Some widgets are in a very undefined state (no children etc.) + YDialog::deleteTopmostDialog(); - ycperror( "UI::OpenDialog(): Dialog term parse error" ); - } -#endif + ycperror( "UI::OpenDialog() failed" ); + ok = false; } unblockEvents(); - return YCPBoolean( false ); + + return YCPBoolean( ok ); } @@ -856,7 +842,7 @@ * @return boolean Returns true on success. */ -YCPValue YUI::evaluateChangeWidget( const YCPValue & id_value, const YCPValue & property, const YCPValue & newValue ) +YCPValue YUI::evaluateChangeWidget( const YCPValue & idValue, const YCPValue & property, const YCPValue & newValue ) { YCPValue ret = YCPVoid(); @@ -864,99 +850,61 @@ { blockEvents(); // We don't want self-generated events from UI::ChangeWidget(). - if ( ! YCPDialogParser::isSymbolOrId( id_value ) ) + if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) { YUI_THROW( YUISyntaxErrorException( string( "Expected `id(...) or `symbol, not " ) + - id_value->toString().c_str() ) ); + idValue->toString().c_str() ) ); } - YCPValue id = YCPDialogParser::parseIdTerm( id_value ); + YCPValue id = YCPDialogParser::parseIdTerm( idValue ); YWidget * widget = YCPDialogParser::findWidgetWithId( id, true ); // throw if not found YPropertySet propSet = widget->propertySet(); - if ( propSet.size() == 5 ) // unchanged from YWidget, no properties supported + if ( property->isSymbol() ) { - // FIXME: Get rid of this - // FIXME: Get rid of this - // FIXME: Get rid of this + string oldShortcutString = widget->shortcutString(); + string propertyName = property->asSymbol()->symbol(); + // y2milestone( "New style UI::ChangeWidget() for %s::%s", widget->widgetClass(), propertyName.c_str() ); - if ( property->isSymbol() ) - { - YCPSymbol sym = property->asSymbol(); - y2debug( "Old style UI::ChangeWidget() for %s::%s", - widget->widgetClass(), sym->toString().c_str() ); - ret = widget->changeWidget( sym, newValue ); - } + YPropertyValue val; + + if ( newValue->isString() ) val = YPropertyValue( newValue->asString()->value() ); + else if ( newValue->isInteger() ) val = YPropertyValue( newValue->asInteger()->value() ); + else if ( newValue->isBoolean() ) val = YPropertyValue( newValue->asBoolean()->value() ); else + val = YPropertyValue( false ); // Dummy value, will be rejected anyway + + bool success = widget->setProperty( propertyName, val ); + + if ( ! success ) { - y2error( "Bad argument for UI::ChangeWidget(): %s", - property->toString().c_str() ); + // Try again with the known special cases + success = YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue ); } - - // FIXME: Get rid of this - // FIXME: Get rid of this - // FIXME: Get rid of this + + ret = YCPBoolean( success ); + + if ( oldShortcutString != widget->shortcutString() ) + YDialog::currentDialog()->checkShortcuts(); + } + else if ( property->isTerm() ) + { + bool success = YCPPropertyHandler::setComplexProperty( widget, property->asTerm(), newValue ); + ret = YCPBoolean( success ); } else { - try - { - if ( property->isSymbol() ) - { - string oldShortcutString = widget->shortcutString(); - string propertyName = property->asSymbol()->symbol(); - // y2milestone( "New style UI::ChangeWidget() for %s::%s", widget->widgetClass(), propertyName.c_str() ); - - YPropertyValue val; - - if ( newValue->isString() ) val = YPropertyValue( newValue->asString()->value() ); - else if ( newValue->isInteger() ) val = YPropertyValue( newValue->asInteger()->value() ); - else if ( newValue->isBoolean() ) val = YPropertyValue( newValue->asBoolean()->value() ); - else - val = YPropertyValue( false ); // Dummy value, will be rejected anyway - - bool success = widget->setProperty( propertyName, val ); - - if ( ! success ) - { - // Try again with the known special cases - success = YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue ); - } - - ret = YCPBoolean( success ); - - if ( oldShortcutString != widget->shortcutString() ) - YDialog::currentDialog()->checkShortcuts(); - } - else if ( property->isTerm() ) - { - bool success = YCPPropertyHandler::setComplexProperty( widget, property->asTerm(), newValue ); - ret = YCPBoolean( success ); - } - else - { - YUI_THROW( YUISyntaxErrorException( string( "Bad UI::ChangeWidget args: " ) - + property->toString() ) ); - } - } - catch( YUIException & exception ) - { - YUI_CAUGHT( exception ); - ycperror( "UI::ChangeWidget() failed for property %s of %s with ID %s, new value: %s", - property->toString().c_str(), - widget->widgetClass(), - id->toString().c_str(), - newValue->toString().c_str() ); - } + YUI_THROW( YUISyntaxErrorException( string( "Bad UI::ChangeWidget args: " ) + + property->toString() ) ); } } catch( YUIException & exception ) { YUI_CAUGHT( exception ); ycperror( "UI::ChangeWidget failed: UI::ChangeWidget( %s, %s, %s )", - id_value->toString().c_str(), + idValue->toString().c_str(), property->toString().c_str(), newValue->toString().c_str() ); ret = YCPNull(); @@ -985,89 +933,56 @@ * @return any */ -YCPValue YUI::evaluateQueryWidget( const YCPValue & id_value, const YCPValue & property ) +YCPValue YUI::evaluateQueryWidget( const YCPValue & idValue, const YCPValue & property ) { YCPValue ret = YCPVoid(); try { - if ( ! YCPDialogParser::isSymbolOrId( id_value ) ) + if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) { YUI_THROW( YUISyntaxErrorException( string( "Expected `id(...) or `symbol, not " ) + - id_value->toString().c_str() ) ); + idValue->toString().c_str() ) ); } - YCPValue id = YCPDialogParser::parseIdTerm( id_value ); + YCPValue id = YCPDialogParser::parseIdTerm( idValue ); YWidget *widget = YCPDialogParser::findWidgetWithId( id, true ); // throw if not found YPropertySet propSet = widget->propertySet(); - if ( propSet.size() == 5 ) // unchanged from YWidget, no properties supported + if ( property->isSymbol() ) // The normal case: UI::QueryWidget(`myWidget, `SomeProperty) { - if ( property->isSymbol() ) + string propertyName = property->asSymbol()->symbol(); + YPropertyValue val = widget->getProperty( propertyName ); + + switch ( val.type() ) { - // FIXME: Get rid of this - // FIXME: Get rid of this - // FIXME: Get rid of this - YCPSymbol sym = property->asSymbol(); - y2debug( "Old style UI::QueryWidget() for %s::%s", - widget->widgetClass(), sym->symbol().c_str() ); - return widget->queryWidget( sym ); - // FIXME: Get rid of this - // FIXME: Get rid of this - // FIXME: Get rid of this + case YStringProperty: return YCPString ( val.stringVal() ); + case YBoolProperty: return YCPBoolean( val.boolVal() ); + case YIntegerProperty: return YCPInteger( val.integerVal() ); + case YOtherProperty: return YCPPropertyHandler::getComplexProperty( widget, propertyName ); + + default: + ycperror( "Unknown result for setProperty( %s )", propertyName.c_str() ); + return YCPVoid(); } } + else if ( property->isTerm() ) // Very rare: UI::QueryWidget(`myTable, `Item("abc", 3) ) + { + return YCPPropertyHandler::getComplexProperty( widget, property->asTerm() ); + } else { - // y2debug( "New style UI::QueryWidget() for %s::%s", widget->widgetClass(), sym->symbol().c_str() ); - - try - { - if ( property->isSymbol() ) // The normal case: UI::QueryWidget(`myWidget, `SomeProperty) - { - string propertyName = property->asSymbol()->symbol(); - YPropertyValue val = widget->getProperty( propertyName ); - - switch ( val.type() ) - { - case YStringProperty: return YCPString ( val.stringVal() ); - case YBoolProperty: return YCPBoolean( val.boolVal() ); - case YIntegerProperty: return YCPInteger( val.integerVal() ); - case YOtherProperty: return YCPPropertyHandler::getComplexProperty( widget, propertyName ); - - default: - ycperror( "Unknown result for setProperty( %s )", propertyName.c_str() ); - return YCPVoid(); - } - } - else if ( property->isTerm() ) // Very rare: UI::QueryWidget(`myTable, `Item("abc", 3) ) - { - return YCPPropertyHandler::getComplexProperty( widget, property->asTerm() ); - } - else - { - YUI_THROW( YUISyntaxErrorException( string( "Bad UI::QueryWidget args: " ) - + property->toString() ) ); - } - } - catch( YUIException & exception ) - { - YUI_CAUGHT( exception ); - ycperror( "UI::QueryWidget() failed for property %s of %s with ID %s", - property->toString().c_str(), - widget->widgetClass(), - id->toString().c_str() ); - - } + YUI_THROW( YUISyntaxErrorException( string( "Bad UI::QueryWidget args: " ) + + property->toString() ) ); } } catch( YUIException & exception ) { YUI_CAUGHT( exception ); ycperror( "UI::QueryWidget failed: UI::QueryWidget( %s, %s )", - id_value->toString().c_str(), + idValue->toString().c_str(), property->toString().c_str() ); ret = YCPNull(); } @@ -1087,64 +1002,64 @@ * * @param symbol id * @param term newWidget - * @return boolean + * @return true if success, false if failed */ -YCPBoolean YUI::evaluateReplaceWidget( const YCPValue & id_value, const YCPTerm & newContentTerm ) +YCPBoolean YUI::evaluateReplaceWidget( const YCPValue & idValue, const YCPTerm & newContentTerm ) { - if ( ! YCPDialogParser::isSymbolOrId( id_value ) ) + bool success = true; + + try { - return YCPNull(); - } + if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) + { + YUI_THROW( YUISyntaxErrorException( string( "Expected `id(...) or `symbol, not " ) + + idValue->toString().c_str() ) ); + } - YCPValue id = YCPDialogParser::parseIdTerm( id_value ); - YWidget * widget = YCPDialogParser::findWidgetWithId( id ); - if ( ! widget ) return YCPBoolean( false ); + blockEvents(); // Prevent self-generated events + YCPValue id = YCPDialogParser::parseIdTerm( idValue ); + YWidget * widget = YCPDialogParser::findWidgetWithId( id, + true ); // throw if not found + if ( ! widget ) return YCPBoolean( false ); - YReplacePoint * replacePoint = dynamic_cast<YReplacePoint *> (widget); + YReplacePoint * replacePoint = dynamic_cast<YReplacePoint *> (widget); - if ( ! replacePoint ) - { - y2error( "ReplaceWidget: widget %s is not a ReplacePoint", - id->toString().c_str() ); - return YCPBoolean( false ); - } + if ( ! replacePoint ) + YUI_THROW( YUIException( string( "Widget with ID " ) + id->toString() + " is not a ReplacePoint" ) ); #if VERBOSE_REPLACE_WIDGET - replacePoint->dumpDialogWidgetTree(); + replacePoint->dumpDialogWidgetTree(); #endif - YDialog * dialog = YDialog::currentDialog(); - - YWidget::OptimizeChanges below( *dialog ); // delay screen updates until this block is left - replacePoint->deleteChildren(); + YDialog * dialog = YDialog::currentDialog(); - YWidget * child = YCPDialogParser::parseWidgetTreeTerm( replacePoint, newContentTerm ); + YWidget::OptimizeChanges below( *dialog ); // delay screen updates until this block is left + replacePoint->deleteChildren(); - if ( ! child->hasParent() ) - child->setParent( replacePoint ); - - replacePoint->showChild(); + YCPDialogParser::parseWidgetTreeTerm( replacePoint, newContentTerm ); + replacePoint->showChild(); #if VERBOSE_REPLACE_WIDGET - replacePoint->dumpDialogWidgetTree(); + replacePoint->dumpDialogWidgetTree(); #endif - if ( child ) - { - blockEvents(); // We don't want self-generated events from UI builtins. - dialog->setInitialSize(); dialog->checkShortcuts(); - - unblockEvents(); - - return YCPBoolean( true ); } - else + catch( YUIException & exception ) { - YUI_THROW( YUIException( "ReplaceWidget() failed" ) ); - return YCPBoolean( false ); + YUI_CAUGHT( exception ); + success = false; + + ycperror( "UI::ReplaceWidget() failed: UI::ReplaceWidget( %s, %s )", + idValue->toString().c_str(), + newContentTerm->toString().c_str() ); + } + + unblockEvents(); + + return YCPBoolean( success ); } @@ -1207,12 +1122,12 @@ * @return boolean Returns true on success (i.e. the widget accepted the focus). */ -YCPBoolean YUI::evaluateSetFocus( const YCPValue & id_value ) +YCPBoolean YUI::evaluateSetFocus( const YCPValue & idValue ) { - if ( ! YCPDialogParser::isSymbolOrId( id_value ) ) + if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) return YCPNull(); - YCPValue id = YCPDialogParser::parseIdTerm( id_value ); + YCPValue id = YCPDialogParser::parseIdTerm( idValue ); YWidget *widget = YCPDialogParser::findWidgetWithId( id ); if ( ! widget ) @@ -1705,11 +1620,11 @@ * @param symbol widgetId * @return boolean */ -YCPBoolean YUI::evaluateWidgetExists( const YCPValue & id_value ) +YCPBoolean YUI::evaluateWidgetExists( const YCPValue & idValue ) { - if ( ! YCPDialogParser::isSymbolOrId( id_value ) ) return YCPNull(); + if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) return YCPNull(); - YCPValue id = YCPDialogParser::parseIdTerm( id_value ); + YCPValue id = YCPDialogParser::parseIdTerm( idValue ); YWidget *widget = YCPDialogParser::findWidgetWithId( id, false ); // Don't throw if not found return widget ? YCPBoolean( true ) : YCPBoolean( false ); Modified: trunk/core/libyui/src/YWidget.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidget.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YWidget.cc (original) +++ trunk/core/libyui/src/YWidget.cc Fri Nov 30 14:19:17 2007 @@ -63,7 +63,6 @@ , notify( false ) , sendKeyEvents( false ) , autoShortcut( false ) - , oldStyleConstructor( false ) , toolkitWidgetRep( 0 ) , id( 0 ) , functionKey( 0 ) @@ -86,7 +85,6 @@ bool notify; bool sendKeyEvents; bool autoShortcut; - bool oldStyleConstructor; void * toolkitWidgetRep; YWidgetID * id; YBothDim<bool> stretch; @@ -99,20 +97,6 @@ bool YWidget::_usedOperatorNew = false; -// FIXME: Obsolete -// FIXME: Obsolete -// FIXME: Obsolete -YWidget::YWidget( const YWidgetOpt & opt ) - : priv( new YWidgetPrivate( new YWidgetChildrenRejector( this ) ) ) -{ - YUI_CHECK_NEW( priv ); - priv->oldStyleConstructor = true; -} -// FIXME: Obsolete -// FIXME: Obsolete -// FIXME: Obsolete - - YWidget::YWidget( YWidget * parent ) : priv( new YWidgetPrivate( new YWidgetChildrenRejector( this ), parent ) ) @@ -271,9 +255,6 @@ YWidget * YWidget::parent() const { - if ( oldStyleConstructor() && ! priv->parent ) - YUI_THROW( YUIException( string( "No parent set yet for " ) + widgetClass() ) ); - return priv->parent; } @@ -300,13 +281,6 @@ } -bool -YWidget::oldStyleConstructor() const -{ - return priv->oldStyleConstructor; -} - - bool YWidget::sendKeyEvents() const { return priv->sendKeyEvents; @@ -403,14 +377,12 @@ * @property boolean Notify the current notify state (see also `opt( `notify )) * @property string WidgetClass the widget class of this widget (YLabel, YPushButton, ...) * @property string DebugLabel (possibly translated) text describing this widget for debugging - * @property string DialogDebugLabel (possibly translated) text describing this dialog for debugging **/ propSet.add( YProperty( YUIProperty_Enabled, YBoolProperty ) ); propSet.add( YProperty( YUIProperty_Notify, YBoolProperty ) ); propSet.add( YProperty( YUIProperty_WidgetClass, YStringProperty, true ) ); // read-only propSet.add( YProperty( YUIProperty_DebugLabel, YStringProperty, true ) ); // read-only - propSet.add( YProperty( YUIProperty_DialogDebugLabel, YStringProperty, true ) ); // read-only } return propSet; @@ -454,15 +426,6 @@ if ( propertyName == YUIProperty_Notify ) return YPropertyValue( notify() ); if ( propertyName == YUIProperty_WidgetClass ) return YPropertyValue( widgetClass() ); if ( propertyName == YUIProperty_DebugLabel ) return YPropertyValue( debugLabel() ); - if ( propertyName == YUIProperty_DialogDebugLabel ) - { - YDialog * dialog = findDialog(); - - if ( dialog ) - return YPropertyValue( dialog->debugLabel() ); - else - return YPropertyValue( debugLabel() ); - } return YPropertyValue( false ); // NOTREACHED } @@ -724,72 +687,3 @@ } -// FIXME: Obsolete -// FIXME: Obsolete -// FIXME: Obsolete - - -YCPValue YWidget::changeWidget( const YCPSymbol & property, const YCPValue & newvalue ) -{ - string symbol = property->symbol(); - - if ( ! isValid() ) - { - y2error( "YWidget::changeWidget( %s ): ERROR: Invalid widget", symbol.c_str() ); - - return YCPBoolean( false ); // Error - } - - if ( symbol == YUIProperty_Enabled ) - { - if ( newvalue->isBoolean() ) - { - bool e = newvalue->asBoolean()->value(); - setEnabled(e); - priv->enabled = e; - return YCPBoolean( true ); - } - else y2error( "Wrong argument %s for widget property `Enabled - boolean expected.", - newvalue->toString().c_str() ); - } - - if ( symbol == YUIProperty_Notify ) - { - if ( newvalue->isBoolean() ) - { - setNotify( newvalue->asBoolean()->value() ); - return YCPBoolean( true ); - } - else y2error( "Wrong argument %s for widget property `Notify - boolean expected.", - newvalue->toString().c_str() ); - } - - return YCPBoolean( false ); -} - - -YCPValue YWidget::queryWidget( const YCPSymbol & property ) -{ - string symbol = property->symbol(); - - if ( symbol == YUIProperty_Enabled ) return YCPBoolean( isEnabled() ); - if ( symbol == YUIProperty_Notify ) return YCPBoolean( notify() ); - if ( symbol == YUIProperty_WidgetClass ) return YCPString( widgetClass() ); - if ( symbol == YUIProperty_DebugLabel ) return YCPString( debugLabel() ); - if ( symbol == YUIProperty_DialogDebugLabel ) - { - return YDialog::currentDialog()->queryWidget( property ); - } - else - { - y2error( "Couldn't query unkown widget property %s::%s", - widgetClass(), symbol.c_str() ); - return YCPVoid(); - } -} - - -// FIXME: Obsolete -// FIXME: Obsolete -// FIXME: Obsolete - Modified: trunk/core/libyui/src/YWidget.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidget.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YWidget.h (original) +++ trunk/core/libyui/src/YWidget.h Fri Nov 30 14:19:17 2007 @@ -56,14 +56,6 @@ **/ YWidget( YWidget * parent ); - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - YWidget( const YWidgetOpt & opt ); - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - public: /** * Destructor. @@ -142,7 +134,6 @@ **/ virtual bool setProperty( const string & propertyName, const YPropertyValue & val ); - // FIXME: = 0 /** * Get a property. Derived classes need to implement this. @@ -151,7 +142,6 @@ * - if there is no property with that name **/ virtual YPropertyValue getProperty( const string & propertyName ); - // FIXME: = 0 // @@ -249,24 +239,6 @@ **/ void setParent( YWidget * newParent ); - - // FIXME: Throw this out once all widgets are ported! - // FIXME: Throw this out once all widgets are ported! - // FIXME: Throw this out once all widgets are ported! - /** - * Return 'true' if an old-style constructor was used to create this widget. - * In that case, setParent() needs to be called from the outside, and for - * the parent widget, addChild() needs to be called. - * - * NOTICE: This function will silently disappear once all widgets are - * ported in the libyui. - **/ - bool oldStyleConstructor() const; - // FIXME: Throw this out once all widgets are ported! - // FIXME: Throw this out once all widgets are ported! - // FIXME: Throw this out once all widgets are ported! - - /** * Traverse up the widget hierarchy and find the dialog this widget belongs * to. Returns 0 if there is none. @@ -505,18 +477,6 @@ **/ virtual void setFunctionKey( int fkey_no ); - - - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - virtual YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue ); - virtual YCPValue queryWidget( const YCPSymbol & property ); - // FIXME: Obsolete - // FIXME: Obsolete - // FIXME: Obsolete - - /** * Set the keyboard focus to this widget. * The default implementation just emits a warning message. Modified: trunk/core/libyui/src/YWidgetFactory.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidgetFactory.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YWidgetFactory.cc (original) +++ trunk/core/libyui/src/YWidgetFactory.cc Fri Nov 30 14:19:17 2007 @@ -33,6 +33,20 @@ } +YDialog * +YWidgetFactory::createMainDialog( YDialogColorMode colorMode ) +{ + return createDialog( YMainDialog, colorMode ); +} + + +YDialog * +YWidgetFactory::createPopupDialog( YDialogColorMode colorMode ) +{ + return createDialog( YPopupDialog, colorMode ); +} + + YLayoutBox * YWidgetFactory::createVBox( YWidget * parent ) { Modified: trunk/core/libyui/src/YWidgetFactory.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidgetFactory.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YWidgetFactory.h (original) +++ trunk/core/libyui/src/YWidgetFactory.h Fri Nov 30 14:19:17 2007 @@ -74,8 +74,9 @@ // Dialogs // - virtual YDialog * createMainDialog() = 0; - virtual YDialog * createPopupDialog() = 0; + YDialog * createMainDialog ( YDialogColorMode colorMode = YDialogNormalColor ); + YDialog * createPopupDialog ( YDialogColorMode colorMode = YDialogNormalColor ); + virtual YDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ) = 0; // // Layout Boxes Modified: trunk/core/libyui/src/YWidgetOpt.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidgetOpt.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/core/libyui/src/YWidgetOpt.h (original) +++ trunk/core/libyui/src/YWidgetOpt.h Fri Nov 30 14:19:17 2007 @@ -116,15 +116,13 @@ struct YWidgetOpt { // Common options for all widgets. - // See the inline doc in YUIInterpreter::createWidget() for details - // or ../../doc/autodocs/YWidget-widget.html + // See the inline doc in YCPDialogParser for details. YBoolOpt isDisabled; YBoolOpt notifyMode; YBoolOpt isHStretchable; YBoolOpt isVStretchable; YBoolOpt autoShortcut; - YBoolOpt autoAdvance; YBoolOpt keyEvents; YBoolOpt testMode; YBoolOpt boldFont; // YCheckBox, YRadioButton, YLabel @@ -133,40 +131,12 @@ // Widget-specific options // // See the respective widget doc in YCPDialogParser::parse???() - // or ../../doc/autodocs/???-widget.html YBoolOpt isDefaultButton; // YPushButton YBoolOpt isOutputField; // YLabel YBoolOpt autoScrollDown; // YRichText YBoolOpt plainTextMode; // YRichText - YBoolOpt isShrinkable; // YTextEntry - YBoolOpt isEditable; // YComboBox - YBoolOpt immediateMode; // YTable - YBoolOpt keepSorting; // YTable - YBoolOpt invertAutoEnable; // YCheckBoxFrame - YBoolOpt noAutoEnable; // YCheckBoxFrame - YBoolOpt zeroWidth; // YImage - YBoolOpt zeroHeight; // YImage - YBoolOpt animated; // YImage - YBoolOpt tiled; // YImage - YBoolOpt scaleToFit; // YImage - YBoolOpt countShowDelta; // YPartitionSplitter YLongOpt key_Fxx; // YPushButton: No. of F-Key (1..24), 0 if none - - YBoolOpt stepsEnabled; // YWizard - YBoolOpt treeEnabled; // YWizard - - // YDialog-specific options - // - // These are multiplexed into YWidgetOpt since YDialog inherits - // YSingleChildContainerWidget which in turn inherits YWidget. - - YBoolOpt hasDefaultSize; - YBoolOpt hasWarnColor; - YBoolOpt hasInfoColor; - YBoolOpt isDecorated; - YBoolOpt isCentered; - YBoolOpt hasSmallDecorations; }; Modified: trunk/ncurses/src/NCDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCDialog.cc (original) +++ trunk/ncurses/src/NCDialog.cc Fri Nov 30 14:19:17 2007 @@ -57,8 +57,9 @@ // // DESCRIPTION : // -NCDialog::NCDialog( const YWidgetOpt & opt ) - : YDialog ( opt ) +NCDialog::NCDialog( YDialogType dialogType, + YDialogColorMode colorMode ) + : YDialog ( dialogType, colorMode ) , pan ( 0 ) , dlgstyle ( 0 ) , inMultiDraw_i( 0 ) @@ -67,8 +68,8 @@ , ncdopts ( DEFAULT ) , popedpos ( -1 ) { - NCMIL << "NCDialog(opt) derived from YDialog(opt)" << endl; - _init( opt ); + NCMIL << "NCDialog() derived from YDialog()" << endl; + _init(); } /////////////////////////////////////////////////////////////////// @@ -79,8 +80,8 @@ // // DESCRIPTION : // -NCDialog::NCDialog( const YWidgetOpt & opt, const wpos at, const bool boxed ) - : YDialog ( opt ) +NCDialog::NCDialog( YDialogType dialogType, const wpos at, const bool boxed ) + : YDialog ( dialogType, YDialogNormalColor ) , pan ( 0 ) , dlgstyle ( 0 ) , inMultiDraw_i( 0 ) @@ -89,8 +90,8 @@ , ncdopts ( boxed ? POPUP : POPUP|NOBOX ) , popedpos ( at ) { - NCMIL << "NCDialog(opt, at, boxed) derived from YDialog(opt)" << endl; - _init( opt ); + NCMIL << "NCDialog(type, at, boxed) derived from YDialog(opt)" << endl; + _init(); } /////////////////////////////////////////////////////////////////// @@ -101,7 +102,7 @@ // // DESCRIPTION : Constructor helper // -void NCDialog::_init( const YWidgetOpt & opt ) +void NCDialog::_init() { NCurses::RememberDlg( this ); @@ -110,9 +111,9 @@ _init_size(); wstate = NC::WSdumb; - if ( opt.hasWarnColor.value() ) { + if ( colorMode() == YDialogWarnColor ) { mystyleset = NCstyle::WarnStyle; - } else if ( opt.hasInfoColor.value() ) { + } else if ( colorMode() == YDialogInfoColor ) { mystyleset = NCstyle::InfoStyle; } else if ( isPopup() ) { mystyleset = NCstyle::PopupStyle; @@ -190,7 +191,7 @@ int NCDialog::preferredWidth() { - if ( hasDefaultSize() || !childrenCount() ) + if ( dialogType() == YMainDialog || ! hasChildren() ) return wGetDefsze().W; wsze csze( firstChild()->preferredHeight(), firstChild()->preferredWidth() ); @@ -202,7 +203,7 @@ int NCDialog::preferredHeight() { - if ( hasDefaultSize() || !childrenCount() ) { + if ( dialogType() == YMainDialog || ! hasChildren() ) { return wGetDefsze().H; } wsze csze( firstChild()->preferredHeight(), Modified: trunk/ncurses/src/NCDialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDialog.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCDialog.h (original) +++ trunk/ncurses/src/NCDialog.h Fri Nov 30 14:19:17 2007 @@ -49,8 +49,7 @@ NCWidget & GetNormal( NCWidget & startwith, SeekDir Direction ); void Activate( SeekDir Direction ); - void _init( const YWidgetOpt & opt ); - + void _init(); void _init_size(); protected: @@ -122,7 +121,8 @@ public: - NCDialog( const YWidgetOpt & opt ); + NCDialog( YDialogType dialogType, + YDialogColorMode colorMode = YDialogNormalColor ); virtual ~NCDialog(); void showDialog(); @@ -162,7 +162,7 @@ bool hshaddow; bool vshaddow; - NCDialog( const YWidgetOpt & opt, const wpos at, const bool boxed = true ); + NCDialog( YDialogType dialogType, const wpos at, const bool boxed = true ); bool isPopup() const { return (ncdopts & POPUP); } bool isBoxed() const { return !(ncdopts & NOBOX); } Modified: trunk/ncurses/src/NCPopup.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCPopup.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCPopup.cc (original) +++ trunk/ncurses/src/NCPopup.cc Fri Nov 30 14:19:17 2007 @@ -19,9 +19,6 @@ #include "Y2Log.h" #include "NCPopup.h" -/////////////////////////////////////////////////////////////////// - -YWidgetOpt NCPopup::wopt; /////////////////////////////////////////////////////////////////// // @@ -32,7 +29,7 @@ // DESCRIPTION : // NCPopup::NCPopup( const wpos at, const bool boxed ) - : NCDialog( wopt, at, boxed ) + : NCDialog( YPopupDialog, at, boxed ) { } Modified: trunk/ncurses/src/NCPopup.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCPopup.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCPopup.h (original) +++ trunk/ncurses/src/NCPopup.h Fri Nov 30 14:19:17 2007 @@ -34,10 +34,6 @@ NCPopup & operator=( const NCPopup & ); NCPopup ( const NCPopup & ); - private: - - static YWidgetOpt wopt; - protected: NCursesEvent postevent; Modified: trunk/ncurses/src/NCWidgetFactory.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCWidgetFactory.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCWidgetFactory.cc (original) +++ trunk/ncurses/src/NCWidgetFactory.cc Fri Nov 30 14:19:17 2007 @@ -12,7 +12,8 @@ File: NCWidgetFactory.cc - Author: Stefan Hundhammer <sh@suse.de> + Authors: Stefan Hundhammer <sh@suse.de> + Gabriele Mohr <gs@suse.de> /-*/ @@ -45,23 +46,18 @@ // NCDialog * -NCWidgetFactory::createMainDialog() +NCWidgetFactory::createDialog( YDialogType dialogType, YDialogColorMode colorMode ) { - return 0; // FIXME: TO DO -} - + UIDBG << "Flush input buffer - new dialog" << endl; + ::flushinp(); + NCDialog * dialog = new NCDialog( dialogType, colorMode ); + YUI_CHECK_NEW( dialog ); -NCDialog * -NCWidgetFactory::createPopupDialog() -{ - return 0; // FIXME: TO DO + return dialog; } - - - // // Common Leaf Widgets // Modified: trunk/ncurses/src/NCWidgetFactory.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCWidgetFactory.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/NCWidgetFactory.h (original) +++ trunk/ncurses/src/NCWidgetFactory.h Fri Nov 30 14:19:17 2007 @@ -71,21 +71,18 @@ // Dialogs // - virtual NCDialog * createMainDialog(); - virtual NCDialog * createPopupDialog(); + virtual NCDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ); // // Layout Boxes // - virtual NCLayoutBox * createLayoutBox( YWidget * parent, YUIDimension dim ); + virtual NCLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dim ); + + // + // Common Leaf Widgets + // - /** - * Creates a push button. - * @param label Label of the button - * @param default_button true if the button should be the dialogs default button - */ - virtual NCPushButton * createPushButton ( YWidget * parent, const string & label ); @@ -139,7 +136,6 @@ /** * Creates a MultiLineEdit widget * @param label label above the edit field - * @param text initial contents of the edit field */ virtual NCMultiLineEdit * createMultiLineEdit ( YWidget * parent, const string & label ); @@ -154,7 +150,7 @@ * Creates a log view widget * @param label label above the log view * @param visibleLines default number of vislible lines - * @param maxLines number of lines to store (use 0 for "all") + * @param storedLines number of lines to store (use 0 for "all") */ virtual NCLogView * createLogView ( YWidget * parent, const string & label, Modified: trunk/ncurses/src/YNCursesUI.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/YNCursesUI.cc (original) +++ trunk/ncurses/src/YNCursesUI.cc Fri Nov 30 14:19:17 2007 @@ -309,18 +309,6 @@ // /////////////////////////////////////////////////////////////////// -YDialog * YNCursesUI::createDialog( YWidgetOpt & opt ) -{ - UIDBG << "Flush input buffer - new dialog" << endl; - ::flushinp(); - - NCMIL << "Calling createDialog()" << endl; - NCDialog * dialog = new NCDialog( opt ); - - UIDBG << dialog << endl; - return dialog; -} - void YNCursesUI::showDialog( YDialog * dialog ) { NCDialog * dlg = dynamic_cast<NCDialog *>( dialog ); UIDBG << dlg << endl; Modified: trunk/ncurses/src/YNCursesUI.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/ncurses/src/YNCursesUI.h (original) +++ trunk/ncurses/src/YNCursesUI.h Fri Nov 30 14:19:17 2007 @@ -122,11 +122,6 @@ virtual YEvent * pollInput(); /** - * Inherited from YUIInterpreter. Creates a dialog. - */ - virtual YDialog * createDialog( YWidgetOpt & opt ); - - /** * Inherited from YUIInterpreter. Shows and activates a dialog */ virtual void showDialog( YDialog * dialog ); Modified: trunk/qt/src/YQDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDialog.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQDialog.cc (original) +++ trunk/qt/src/YQDialog.cc Fri Nov 30 14:19:17 2007 @@ -38,14 +38,22 @@ // like "Above", "Below" etc. that clash with some Qt headers. #include <X11/Xlib.h> +#define YQMainDialogWFlags 0 -YQDialog::YQDialog( const YWidgetOpt & opt, - QWidget * qt_parent, - bool default_size ) - : QWidget( qt_parent, - 0, // name - default_size ? 0 : WStyle_Customize | WStyle_DialogBorder | WType_Modal | WStyle_Dialog ) // WFlags - , YDialog( opt ) +#define YQPopupDialogWFlags \ + ( WStyle_Customize | \ + WStyle_Dialog | \ + WType_Modal | \ + WStyle_DialogBorder ) + + +YQDialog::YQDialog( QWidget * qParent, + YDialogType dialogType, + YDialogColorMode colorMode ) + : QWidget( qParent, + 0, // name + dialogType == YMainDialog ? YQMainDialogWFlags : YQPopupDialogWFlags ) + , YDialog( dialogType, colorMode ) { _userResized = false; _focusButton = 0; @@ -53,16 +61,16 @@ setWidgetRep( this ); - setCaption( hasDefaultSize() ? "YaST2" : "" ); + setCaption( dialogType == YMainDialog ? "YaST2" : "" ); setFocusPolicy( QWidget::StrongFocus ); - if ( hasWarnColor() || hasInfoColor() ) + if ( colorMode != YDialogNormalColor ) { QColor normalBackground ( 0, 128, 0 ); QColor inputFieldBackground ( 0, 96, 0 ); QColor text = white; - if ( hasInfoColor() ) + if ( colorMode == YDialogInfoColor ) { normalBackground = QColor ( 238, 232, 170 ); // PaleGoldenrod } @@ -74,31 +82,6 @@ warnPalette.setNormal( normalColors ); setPalette( warnPalette ); } - - _qFrame = new QFrame ( this ); - bool decorate = ! hasDefaultSize() && ! YQUI::ui()->haveWM(); - -#if 0 - if ( hasSmallDecorations() ) - { - // None of this works (yet). :-(( - - clearWFlags( getWFlags() ); - setWFlags( WStyle_Customize | WStyle_DialogBorder | WStyle_StaysOnTop ); - // decorate = true; - } -#endif - - if ( decorate ) - { - _qFrame->setFrameStyle ( QFrame::Box | QFrame::Raised ); - _qFrame->setLineWidth(2); - _qFrame->setMidLineWidth(3); - } - else - { - _qFrame->setFrameStyle ( QFrame::NoFrame ); - } } @@ -111,7 +94,7 @@ { int preferredWidth; - if ( hasDefaultSize() ) + if ( dialogType() == YMainDialog ) { if ( userResized() ) preferredWidth = _userSize.width(); @@ -120,7 +103,7 @@ } else { - preferredWidth = YDialog::preferredWidth() + 2 * decorationWidth(); + preferredWidth = YDialog::preferredWidth(); } int screenWidth = qApp->desktop()->width(); @@ -139,7 +122,7 @@ { int preferredHeight; - if ( hasDefaultSize() ) + if ( dialogType() == YMainDialog ) { if ( userResized() ) preferredHeight = _userSize.height(); @@ -148,7 +131,7 @@ } else { - preferredHeight = YDialog::preferredHeight() + 2 * decorationWidth(); + preferredHeight = YDialog::preferredHeight(); } int screenHeight = qApp->desktop()->height(); @@ -163,19 +146,10 @@ } -int YQDialog::decorationWidth() -{ - if ( ! hasDefaultSize() && _qFrame ) - return _qFrame->frameWidth(); - else - return 0; -} - - void YQDialog::setEnabled( bool enabled ) { QWidget::setEnabled( enabled ); - YWidget::setEnabled( enabled ); + YDialog::setEnabled( enabled ); } @@ -189,16 +163,9 @@ if ( hasChildren() ) { - firstChild()->setSize( newWidth - 2 * decorationWidth(), - newHeight - 2 * decorationWidth() ); - - QWidget * qChild = (QWidget *) firstChild()->widgetRep(); - qChild->move( decorationWidth(), decorationWidth() ); + firstChild()->setSize( newWidth, newHeight ); } - if ( _qFrame ) - _qFrame->resize( newWidth, newHeight ); - resize( newWidth, newHeight ); } @@ -619,9 +586,9 @@ void YQDialog::closeEvent( QCloseEvent * event ) { - // The window manager "close window" button ( and menu, e.g. Alt-F4 ) will be + // The window manager "close window" button (and WM menu, e.g. Alt-F4) will be // handled just like the user had clicked on the `id`( `cancel ) button in - // that dialog. It's up to the YCP application to handle this ( if desired ). + // that dialog. It's up to the YCP application to handle this (if desired). y2debug( "Ignoring window manager close button." ); event->ignore(); @@ -654,10 +621,8 @@ void YQDialog::show() { - if ( ! hasDefaultSize() && qApp->mainWidget()->isVisible() ) - center( this, qApp->mainWidget() ); - else if ( isCentered() ) - center( this, qApp->desktop() ); + if ( ! dialogType() == YMainDialog && qApp->mainWidget()->isVisible() ) + center( this, qApp->mainWidget() ); QWidget::show(); } Modified: trunk/qt/src/YQDialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDialog.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQDialog.h (original) +++ trunk/qt/src/YQDialog.h Fri Nov 30 14:19:17 2007 @@ -26,7 +26,6 @@ class YQGenericButton; class YQWizard; -class QFrame; class YQDialog : public QWidget, public YDialog @@ -35,17 +34,27 @@ public: /** - * Constructor: Constructor. + * Constructor. + * + * 'dialogType' is one of YMainDialog or YPopupDialog. + * + * 'colorMode' can be set to YDialogWarnColor to use very bright "warning" + * colors or YDialogInfoColor to use more prominent, yet not quite as + * bright as "warning" colors. Use both only very rarely. **/ - YQDialog( const YWidgetOpt & opt, - QWidget * qt_parent = 0, - bool default_size = false ); + YQDialog( QWidget * qParent, + YDialogType dialogType, + YDialogColorMode colorMode = YDialogNormalColor ); + +protected: /** - * Destructor: Cleans up. + * Destructor. + * Don't delete a dialog directly, use YDialog::deleteTopmostDialog(). **/ - ~YQDialog(); + virtual ~YQDialog(); +public: /** * Makes this dialog active or inactive **/ @@ -86,12 +95,6 @@ virtual void setSize( int newWidth, int newHeight ); /** - * Returns the size of (artificial) window manager decorations, depending - * on the value of YDialog::isDecorated(). - **/ - int decorationWidth(); - - /** * Return this dialog's (first) default button or 0 if none **/ YQGenericButton * findDefaultButton(); @@ -228,8 +231,6 @@ // Data members // - QFrame * _qFrame; - bool _userResized; QSize _userSize; Modified: trunk/qt/src/YQInputField.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQInputField.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQInputField.cc (original) +++ trunk/qt/src/YQInputField.cc Fri Nov 30 14:19:17 2007 @@ -14,7 +14,7 @@ Author: Stefan Hundhammer <sh@suse.de> - textdomain "packages-qt" + Textdomain "packages-qt" /-*/ Modified: trunk/qt/src/YQUI.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQUI.h (original) +++ trunk/qt/src/YQUI.h Fri Nov 30 14:19:17 2007 @@ -340,13 +340,6 @@ YEvent * pollInput(); /** - * Create a dialog. - * - * Reimplemented from YUI. - **/ - YDialog * createDialog( YWidgetOpt & opt ); - - /** * Show and activate a dialog. * * Reimplemented from YUI. Modified: trunk/qt/src/YQUI_core.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQUI_core.cc (original) +++ trunk/qt/src/YQUI_core.cc Fri Nov 30 14:19:17 2007 @@ -485,6 +485,8 @@ } +#warning obsolete +#if 0 YDialog * YQUI::createDialog( YWidgetOpt & opt ) { bool has_defaultsize = opt.hasDefaultSize.value(); @@ -510,6 +512,7 @@ return dialog; } +#endif void YQUI::showDialog( YDialog * dialog ) @@ -522,7 +525,7 @@ return; } - if ( dialog->hasDefaultSize() ) + if ( dialog->dialogType() == YMainDialog ) { _widget_stack->addWidget ( qw, ++_main_dialog_id ); _widget_stack->raiseWidget( qw ); // maybe this is not necessary (?) @@ -559,7 +562,7 @@ return; } - if ( dialog->hasDefaultSize() ) + if ( dialog->dialogType() == YMainDialog ) { _widget_stack->removeWidget( qw ); @@ -579,6 +582,8 @@ { qw->hide(); +#warning FIXME +#if 0 // Clean up the popup stack. libyui guarantees that a dialog will be // deleted after closeDialog() so it is safe to pop that dialog from // the popup stack here. @@ -587,6 +592,7 @@ _popup_stack.pop_back(); else y2error( "Popup dialog stack corrupted!" ); +#endif } } Modified: trunk/qt/src/YQWidgetFactory.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWidgetFactory.cc?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQWidgetFactory.cc (original) +++ trunk/qt/src/YQWidgetFactory.cc Fri Nov 30 14:19:17 2007 @@ -47,22 +47,17 @@ // YQDialog * -YQWidgetFactory::createMainDialog() +YQWidgetFactory::createDialog( YDialogType dialogType, YDialogColorMode colorMode ) { - return 0; // FIXME: TO DO -} - - + QWidget * qParent = 0; + YQDialog * dialog = new YQDialog( qParent, dialogType, colorMode ); + YUI_CHECK_NEW( dialog ); -YQDialog * -YQWidgetFactory::createPopupDialog() -{ - return 0; // FIXME: TO DO + return dialog; } - // // Layout Boxes // Modified: trunk/qt/src/YQWidgetFactory.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWidgetFactory.h?rev=42557&r1=42556&r2=42557&view=diff ============================================================================== --- trunk/qt/src/YQWidgetFactory.h (original) +++ trunk/qt/src/YQWidgetFactory.h Fri Nov 30 14:19:17 2007 @@ -70,14 +70,13 @@ // Dialogs // - virtual YQDialog * createMainDialog(); - virtual YQDialog * createPopupDialog(); + virtual YQDialog * createDialog ( YDialogType dialogType, YDialogColorMode colorMode = YDialogNormalColor ); // // Layout Boxes // - virtual YQLayoutBox * createLayoutBox( YWidget * parent, YUIDimension dim ); + virtual YQLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dim ); // // Common Leaf Widgets -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org