Author: sh-sh-sh Date: Mon Oct 29 18:55:42 2007 New Revision: 41628 URL: http://svn.opensuse.org/viewcvs/yast?rev=41628&view=rev Log: Got rid of outdated methods removed YCP types Modified: branches/tmp/sh/mod-ui/core/libyui/src/YDialog.cc branches/tmp/sh/mod-ui/core/libyui/src/YDialog.h branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.cc branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.h branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.cc branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.h branches/tmp/sh/mod-ui/qt/src/YQDialog.cc branches/tmp/sh/mod-ui/qt/src/YQDialog.h Modified: branches/tmp/sh/mod-ui/core/libyui/src/YDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YDialog.cc?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YDialog.cc (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YDialog.cc Mon Oct 29 18:55:42 2007 @@ -146,34 +146,6 @@ } -YWidgetList YDialog::widgets() const -{ - YWidgetList widgetList; - fillWidgetList( widgetList, this ); - - return widgetList; -} - - -void YDialog::fillWidgetList( YWidgetList & widgetList, - const YWidget * parent ) const -{ - if ( ! parent ) - return; - - for ( YWidgetListConstIterator it = parent->childrenBegin(); - it != parent->childrenEnd(); - ++it ) - { - YWidget * child = *it; - widgetList.push_back( child ); - - if ( child->hasChildren() ) - fillWidgetList( widgetList, child ); - } -} - - string YDialog::dialogDebugLabel() { #if 0 Modified: branches/tmp/sh/mod-ui/core/libyui/src/YDialog.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YDialog.h?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YDialog.h (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YDialog.h Mon Oct 29 18:55:42 2007 @@ -148,11 +148,6 @@ YCPValue queryWidget( const YCPSymbol & property ); /** - * Return a list of all widgets that belong to this dialog. - **/ - YWidgetList widgets() const; - - /** * Returns a (possibly translated) text describing this dialog for * debugging. **/ @@ -167,13 +162,6 @@ protected: /** - * Recursively fill a widgets list with all children and grandchildren of - * 'parent' that are in the same dialog. - **/ - void fillWidgetList( YWidgetList & widgetList, - const YWidget * parent ) const; - - /** * Format a debug label. **/ string formatDebugLabel( YWidget * widget, const string & debLabel ); Modified: branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.cc?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.cc (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.cc Mon Oct 29 18:55:42 2007 @@ -20,8 +20,6 @@ #define y2log_component "ui-shortcuts" #include <ycp/y2log.h> -#include <ycp/YCPString.h> -#include <ycp/YCPSymbol.h> #include "YShortcut.h" #include "YPushButton.h" #include <ctype.h> // toupper(), tolower() @@ -31,22 +29,22 @@ #define DIM( ARRAY ) ( (int) ( sizeof( ARRAY)/( sizeof( ARRAY[0] ) ) ) ) -YShortcut::YShortcut( YWidget *shortcut_widget ) - : _widget( shortcut_widget ) +YShortcut::YShortcut( YWidget * shortcutWidget ) + : _widget( shortcutWidget ) { - _preferred = -1; - _shortcut = -1; - _distinctShortcutChars = -1; - _conflict = false; - _shortcut_string_chached = false; - _clean_shortcut_string_chached = false; + _preferred = -1; + _shortcut = -1; + _distinctShortcutChars = -1; + _conflict = false; + _shortcutStringCached = false; + _cleanShortcutStringCached = false; - YPushButton * button = dynamic_cast<YPushButton *>( shortcut_widget); + YPushButton * button = dynamic_cast<YPushButton *>( shortcutWidget); _isButton = ( button != 0 ); if ( _isButton ) { - _isWizardButton = strstr( shortcut_widget->widgetClass(), "WizardButton" ); + _isWizardButton = strstr( shortcutWidget->widgetClass(), "WizardButton" ); // y2debug( "%s %s is %sa wizard button", widgetClass(), cleanShortcutString().c_str(), _isWizardButton ? "" : "not " ); } @@ -67,42 +65,42 @@ string YShortcut::shortcutString() { - if ( ! _shortcut_string_chached ) + if ( ! _shortcutStringCached ) { - _shortcut_string = getShortcutString(); - _shortcut_string_chached = true; + _shortcutString = getShortcutString(); + _shortcutStringCached = true; // Note: We really need a separate variable here - an empty string // might be a valid value! } - return _shortcut_string; + return _shortcutString; } string YShortcut::cleanShortcutString() { - if ( ! _clean_shortcut_string_chached ) + if ( ! _cleanShortcutStringCached ) { - _clean_shortcut_string = cleanShortcutString( shortcutString() ); + _cleanShortcutString = cleanShortcutString( shortcutString() ); } - return _clean_shortcut_string; + return _cleanShortcutString; } string -YShortcut::cleanShortcutString( string shortcut_string ) +YShortcut::cleanShortcutString( string shortcutString ) { string::size_type pos = 0; - while ( ( pos = findShortcutPos( shortcut_string, pos ) ) != string::npos ) + while ( ( pos = findShortcutPos( shortcutString, pos ) ) != string::npos ) { - shortcut_string.erase( pos, ( string::size_type ) 1 ); + shortcutString.erase( pos, ( string::size_type ) 1 ); } - return shortcut_string; + return shortcutString; } @@ -131,19 +129,19 @@ void -YShortcut::setShortcut( char new_shortcut ) +YShortcut::setShortcut( char newShortcut ) { string str = cleanShortcutString(); - if ( new_shortcut != YShortcut::None ) + if ( newShortcut != YShortcut::None ) { - char findme[] = { tolower( new_shortcut ), toupper( new_shortcut ), 0 }; + char findme[] = { tolower( newShortcut ), toupper( newShortcut ), 0 }; string::size_type pos = str.find_first_of( findme ); if ( pos == string::npos ) { y2error( "Can't find '%c' in %s \"%s\"", - new_shortcut, widgetClass(), cleanShortcutString().c_str() ); + newShortcut, widgetClass(), cleanShortcutString().c_str() ); return; } @@ -154,9 +152,9 @@ widget()->setShortcutString( str ); - _shortcut_string_chached = false; - _clean_shortcut_string_chached = false; - _shortcut = new_shortcut; + _shortcutStringCached = false; + _cleanShortcutStringCached = false; + _shortcut = newShortcut; } Modified: branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.h?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.h (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YShortcut.h Mon Oct 29 18:55:42 2007 @@ -42,7 +42,7 @@ virtual ~YShortcut(); /** - * + * Marker for "no shortcut" **/ enum { None = 0 }; @@ -55,7 +55,7 @@ * Returns the textual representation of the widget class of the widget * this shortcut data belongs to. **/ - const char *widgetClass() const { return widget()->widgetClass(); } + const char * widgetClass() const { return widget()->widgetClass(); } /** * Returns 'true' if the widget that is associated with this shortcut is a @@ -107,7 +107,7 @@ /** * Set (override) the shortcut character. **/ - void setShortcut( char new_shortcut ); + void setShortcut( char newShortcut ); /** * Clear the shortcut: Override the shortcut character with nothing. @@ -185,11 +185,11 @@ // Data members YWidget * _widget; - string _shortcut_string; - bool _shortcut_string_chached; + string _shortcutString; + bool _shortcutStringCached; - string _clean_shortcut_string; - bool _clean_shortcut_string_chached; + string _cleanShortcutString; + bool _cleanShortcutStringCached; int _preferred; // int to enable initializing with invalid char ( -1 ) int _shortcut; // int to enable initializing with invalid char ( -1 ) Modified: branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.cc?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.cc (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.cc Mon Oct 29 18:55:42 2007 @@ -19,8 +19,9 @@ #define y2log_component "ui-shortcuts" #include <ycp/y2log.h> -#include <ycp/YCPString.h> #include "YShortcutManager.h" +#include "YDialog.h" + // Return the number of elements of an array of any type #define DIM( ARRAY ) ( (int) ( sizeof( ARRAY)/( sizeof( ARRAY[0] ) ) ) ) @@ -28,9 +29,10 @@ YShortcutManager::YShortcutManager( YDialog *dialog ) : _dialog( dialog ) + , _conflictCount( 0 ) + , _didCheck( false ) { - _conflictCount = 0; - _did_check = false; + YUI_CHECK_PTR( _dialog ); } @@ -46,7 +48,7 @@ y2debug( "Checking keyboard shortcuts" ); clearShortcutList(); - findShortcutWidgets(); + findShortcutWidgets( _dialog->childrenBegin(), _dialog->childrenEnd() ); // Initialize wanted character counters @@ -104,7 +106,7 @@ } } - _did_check = true; + _didCheck = true; if ( _conflictCount > 0 ) { @@ -138,7 +140,7 @@ { y2debug( "Resolving shortcut conflicts" ); - if ( ! _did_check ) + if ( ! _didCheck ) { y2milestone( "Call checkShortcuts() first!" ); return; @@ -147,18 +149,18 @@ // Make a list of all shortcuts with conflicts - YShortcutList conflictList; - YShortcutListIterator it( _shortcutList.begin() ); + YShortcutList conflictList; _conflictCount = 0; - while ( it != _shortcutList.end() ) + for ( YShortcutListIterator it = _shortcutList.begin(); + it != _shortcutList.end(); + ++it ) { if ( ( *it )->conflict() ) { conflictList.push_back( *it ); _conflictCount++; } - ++it; } @@ -171,15 +173,15 @@ // // Wizard buttons have priority - check any of them first. - int prio_index = findShortestWizardButton( conflictList ); + int prioIndex = findShortestWizardButton( conflictList ); - if ( prio_index < 0 ) - prio_index = findShortestWidget( conflictList); // Find the shortest widget. Buttons have priority. + if ( prioIndex < 0 ) + prioIndex = findShortestWidget( conflictList); // Find the shortest widget. Buttons have priority. // Pick a new shortcut for this widget. - YShortcut * shortcut = conflictList[ prio_index ]; + YShortcut * shortcut = conflictList[ prioIndex ]; resolveConflict( shortcut ); if ( shortcut->conflict() ) @@ -192,7 +194,7 @@ // Mark this particular conflict as resolved. - conflictList.erase( conflictList.begin() + prio_index ); + conflictList.erase( conflictList.begin() + prioIndex ); } if ( _conflictCount > 0 ) @@ -277,24 +279,24 @@ int YShortcutManager::findShortestWizardButton( const YShortcutList & conflictList ) { - int shortest_index = -1; - int shortest_len = -1; + int shortestIndex = -1; + int shortestLen = -1; for ( unsigned i=1; i < conflictList.size(); i++ ) { if ( conflictList[i]->isWizardButton() ) { - if ( shortest_len < 0 || - conflictList[i]->distinctShortcutChars() < shortest_len ) + if ( shortestLen < 0 || + conflictList[i]->distinctShortcutChars() < shortestLen ) { - shortest_index = i; - shortest_len = conflictList[i]->distinctShortcutChars(); + shortestIndex = i; + shortestLen = conflictList[i]->distinctShortcutChars(); } } } - return shortest_index; + return shortestIndex; } @@ -302,34 +304,34 @@ unsigned YShortcutManager::findShortestWidget( const YShortcutList & conflictList ) { - unsigned shortest_index = 0; - int shortest_len = conflictList[ shortest_index ]->distinctShortcutChars(); + unsigned shortestIndex = 0; + int shortestLen = conflictList[ shortestIndex ]->distinctShortcutChars(); for ( unsigned i=1; i < conflictList.size(); i++ ) { - int this_len = conflictList[i]->distinctShortcutChars(); + int currentLen = conflictList[i]->distinctShortcutChars(); - if ( this_len < shortest_len ) + if ( currentLen < shortestLen ) { // Found an even shorter one - shortest_index = i; - shortest_len = this_len; + shortestIndex = i; + shortestLen = currentLen; } - else if ( this_len == shortest_len ) + else if ( currentLen == shortestLen ) { if ( conflictList[i]->isButton() && - ! conflictList[ shortest_index ]->isButton() ) + ! conflictList[ shortestIndex ]->isButton() ) { // Prefer a button over another widget with the same length - shortest_index = i; - shortest_len = this_len; + shortestIndex = i; + shortestLen = currentLen; } } } - return shortest_index; + return shortestIndex; } @@ -347,24 +349,26 @@ void -YShortcutManager::findShortcutWidgets() +YShortcutManager::findShortcutWidgets( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) { - if ( ! _dialog ) - { - y2error( "NULL YDialog" ); - return; - } - - YWidgetList widgetList = _dialog->widgets(); - - for ( YWidgetListIterator it = widgetList.begin(); it != widgetList.end(); ++it ) + for ( YWidgetListConstIterator it = begin; it != end; ++it ) { - if ( ! (*it)->shortcutString().empty() ) + YWidget * widget = *it; + + if ( ! widget->shortcutString().empty() ) { YShortcut * shortcut = new YShortcut( *it ); _shortcutList.push_back( shortcut ); } + + if ( widget->hasChildren() ) + { + findShortcutWidgets( widget->childrenBegin(), + widget->childrenEnd() ); + } } } + Modified: branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.h?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.h (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YShortcutManager.h Mon Oct 29 18:55:42 2007 @@ -20,19 +20,20 @@ #ifndef YShortcutManager_h #define YShortcutManager_h -#include "YDialog.h" +#include "YWidget.h" #include "YShortcut.h" +class YDialog; /** - * @short Helper class to manage keyboard shortcuts within one dialog and - * resolve keyboard shortcut conflicts + * Helper class to manage keyboard shortcuts within one dialog and resolve + * keyboard shortcut conflicts. **/ class YShortcutManager { public: /** - * Constructor + * Constructor. **/ YShortcutManager( YDialog *dialog ); @@ -41,23 +42,20 @@ **/ virtual ~YShortcutManager(); - /** - * Checks the keyboard shortcuts of all children of this dialog - * ( not for sub-dialogs! ). + * Check the keyboard shortcuts of all children of this dialog + * (not for sub-dialogs!). * - * Runs resolveAllConflicts() if 'autoResolve' is 'true'. + * Call resolveAllConflicts() if 'autoResolve' is 'true'. **/ void checkShortcuts( bool autoResolve = true ); - /** * Returns the number of shortcut conflicts. * Valid only after checkShortcuts() or resolveAllConflicts(). **/ int conflictCount(); - /** * Resolve shortcut conflicts. Requires checkShortcuts() to be called first. * @@ -94,13 +92,11 @@ **/ void resolveAllConflicts(); - /** * Returns the dialog this shortcut manager works on. **/ YDialog *dialog() { return _dialog; } - protected: /** @@ -109,11 +105,12 @@ void clearShortcutList(); /** - * Search all children of _dialog (not those of any sub-dialogs!) for child - * widgets that could accept a keyboard shortcut and add these to - * _shortcutList. + * Recursively search all widgets between iterators 'begin' and 'end' (not + * those of any sub-dialogs!) for child widgets that could accept a + * keyboard shortcut and add these to _shortcutList. **/ - void findShortcutWidgets(); + void findShortcutWidgets( YWidgetListConstIterator begin, + YWidgetListConstIterator end ); /** * Pick a new shortcut character for 'shortcut' - one that isn't marked as @@ -165,7 +162,7 @@ private: - bool _did_check; + bool _didCheck; }; Modified: branches/tmp/sh/mod-ui/qt/src/YQDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDialog.cc?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQDialog.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/YQDialog.cc Mon Oct 29 18:55:42 2007 @@ -13,7 +13,7 @@ File: YQDialog.cc Author: Stefan Hundhammer <sh@suse.de> - + Textdomain "packages-qt" /-*/ @@ -77,12 +77,12 @@ _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; @@ -195,7 +195,7 @@ QWidget * qChild = (QWidget *) firstChild()->widgetRep(); qChild->move( decorationWidth(), decorationWidth() ); } - + if ( _qFrame ) _qFrame->resize( newWidth, newHeight ); @@ -238,39 +238,62 @@ { if ( _defaultButton ) return _defaultButton; - - YWidgetList widgetList = YDialog::widgets(); - for ( YWidgetListIterator it = widgetList.begin(); it != widgetList.end(); ++it ) + _defaultButton = findDefaultButton( childrenBegin(), childrenEnd() ); + + return _defaultButton; +} + + +YQGenericButton * +YQDialog::findDefaultButton( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) const + +{ + for ( YWidgetListConstIterator it = begin; it != end; ++it ) { - YQGenericButton * button = dynamic_cast<YQGenericButton *> ( *it ); + YWidget * widget = *it; + + // + // Check this widget + // + + YQGenericButton * button = dynamic_cast<YQGenericButton *> (widget); if ( button && button->isDefaultButton() ) { - _defaultButton = button; - - return _defaultButton; + return button; + } + + + // + // Recurse over the children of this widget + // + + if ( widget->hasChildren() ) + { + button = findDefaultButton( widget->childrenBegin(), + widget->childrenEnd() ); + if ( button ) + return button; } } - _defaultButton = 0; - - return _defaultButton; + return 0; } -void -YQDialog::ensureOnlyOneDefaultButton() +YQWizard * +YQDialog::ensureOnlyOneDefaultButton( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) { YQGenericButton * def = _focusButton ? _focusButton : _defaultButton; - YWidgetList widgetList = YDialog::widgets(); - _defaultButton = 0; YQWizard * wizard = 0; - for ( YWidgetListIterator it = widgetList.begin(); it != widgetList.end(); ++it ) + for ( YWidgetListConstIterator it = begin; it != end; ++it ) { - YQGenericButton * button = dynamic_cast<YQGenericButton *> (*it); - YQWizardButton * wizardButton = dynamic_cast<YQWizardButton *> (*it); + YQGenericButton * button = dynamic_cast<YQGenericButton *> (*it); + YQWizardButton * wizardButton = dynamic_cast<YQWizardButton * > (*it); if ( ! wizard ) wizard = dynamic_cast<YQWizard *> (*it); @@ -285,7 +308,7 @@ { if ( _defaultButton && button != _defaultButton ) { - y2error( "Too many `opt( `default ) PushButtons: [%s]", + y2error( "Too many default buttons: [%s]", (const char *) button->text() ); y2error( "Using old default button: [%s]", (const char *) _defaultButton->text() ); @@ -295,19 +318,37 @@ _defaultButton = button; } } - + if ( button->isShownAsDefault() && button != def ) button->showAsDefault( false ); } + + if ( (*it)->hasChildren() ) + { + YQWizard * wiz = ensureOnlyOneDefaultButton( (*it)->childrenBegin(), + (*it)->childrenEnd() ); + if ( wiz ) + wizard = wiz; + } } - - if ( ! _defaultButton && wizard ) + + return wizard; +} + + +void +YQDialog::ensureOnlyOneDefaultButton() +{ + _defaultButton = 0; + YQWizard * wizard = ensureOnlyOneDefaultButton( childrenBegin(), childrenEnd() ); + + if ( ! _defaultButton && wizard ) { _defaultButton = wizardDefaultButton( wizard ); } - - def = _focusButton ? _focusButton : _defaultButton; - + + YQGenericButton * def = _focusButton ? _focusButton : _defaultButton; + if ( def ) def->showAsDefault(); } @@ -316,15 +357,30 @@ YQWizard * YQDialog::findWizard() const { - YWidgetList widgetList = YDialog::widgets(); - YQWizard * wizard = 0; + return findWizard( childrenBegin(), childrenEnd() ); +} + - for ( YWidgetListIterator it = widgetList.begin(); it != widgetList.end(); ++it ) +YQWizard * +YQDialog::findWizard( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) const + +{ + for ( YWidgetListConstIterator it = begin; it != end; ++it ) { - wizard = dynamic_cast<YQWizard *> (*it); + YWidget * widget = *it; + YQWizard * wizard = dynamic_cast<YQWizard *> (widget); if ( wizard ) return wizard; + + if ( widget->hasChildren() ) + { + wizard = findWizard( widget->childrenBegin(), + widget->childrenEnd() ); + if ( wizard ) + return wizard; + } } return 0; @@ -335,7 +391,7 @@ YQDialog::wizardDefaultButton( YQWizard * wizard ) const { YQGenericButton * def = 0; - + if ( ! wizard ) wizard = findWizard(); @@ -395,7 +451,7 @@ { _defaultButton->setDefaultButton( true ); y2debug( "New default button: [%s]", (const char *) _defaultButton->text() ); - + if ( _defaultButton && ! _focusButton ) _defaultButton->showAsDefault( true ); } @@ -406,7 +462,7 @@ YQDialog::activateDefaultButton( bool warn ) { // Try the focus button first, if there is any. - + if ( _focusButton && _focusButton->isEnabled() && _focusButton->isShownAsDefault() ) @@ -416,9 +472,9 @@ return true; } - + // No focus button - try the default button, if there is any. - + _defaultButton = findDefaultButton(); if ( _defaultButton && @@ -441,7 +497,8 @@ } -void YQDialog::losingFocus( YQGenericButton * button ) +void +YQDialog::losingFocus( YQGenericButton * button ) { if ( button == _focusButton ) { @@ -456,7 +513,8 @@ } -void YQDialog::gettingFocus( YQGenericButton * button ) +void +YQDialog::gettingFocus( YQGenericButton * button ) { if ( _focusButton && _focusButton != button ) _focusButton->showAsDefault( false ); @@ -600,7 +658,7 @@ center( this, qApp->mainWidget() ); else if ( isCentered() ) center( this, qApp->desktop() ); - + QWidget::show(); } @@ -610,7 +668,7 @@ { if ( ! dialog ) return; - + if ( ! parent ) { if ( dialog == qApp->mainWidget() ) Modified: branches/tmp/sh/mod-ui/qt/src/YQDialog.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDialog.h?rev=41628&r1=41627&r2=41628&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQDialog.h (original) +++ branches/tmp/sh/mod-ui/qt/src/YQDialog.h Mon Oct 29 18:55:42 2007 @@ -77,7 +77,7 @@ * Reimplemented from YWidget. **/ virtual void setSize( int newWidth, int newHeight ); - + /** * Returns the size of (artificial) window manager decorations, depending * on the value of YDialog::isDecorated(). @@ -120,7 +120,7 @@ * the dialog can keep track of its focusButton. **/ void losingFocus( YQGenericButton * button ); - + /** * Notification that a button gets the keyboard focus. * @@ -140,7 +140,7 @@ * Ensure presence of no more than one single default button. **/ void ensureOnlyOneDefaultButton(); - + /** * Activate ( i.e. click ) this dialog's default button, if there is any. * Issue a warning to the log file if 'warn' is true. @@ -155,7 +155,7 @@ /** * Find a wizard button that would make sense as a default button. - * Returns 0 if none can be found. + * Return 0 if none can be found. **/ YQGenericButton * wizardDefaultButton( YQWizard * wizard ) const; @@ -168,10 +168,33 @@ **/ static void center( QWidget * dialog, QWidget * parent = 0 ); - + protected: /** + * Return the (first) default button between 'begin' and 'end' + * or 0 if there is none. + **/ + YQGenericButton * findDefaultButton( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) const; + + /** + * Return the (first) wizard widget between 'begin' and 'end' + * or 0 if there is none. + **/ + YQWizard * findWizard( YWidgetListConstIterator begin, + YWidgetListConstIterator end ) const; + + /** + * Helper function for ensureOnlyOneDefaultButton(): + * Recursively find all normal and wizard buttons between 'begin' and 'end' + * and make sure that no more than one button is marked as default. + * Return (the first) wizard widget found on the way. + **/ + YQWizard * ensureOnlyOneDefaultButton( YWidgetListConstIterator begin, + YWidgetListConstIterator end ); + + /** * Event handler for keyboard input. * Only very special keys are processed here. * -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org