Hello community, here is the log from the commit of package yast2-qt for openSUSE:Factory checked in at Wed Mar 25 19:06:36 CET 2009. -------- --- yast2-qt/yast2-qt.changes 2009-02-15 12:40:14.000000000 +0100 +++ yast2-qt/yast2-qt.changes 2009-03-12 21:55:42.000000000 +0100 @@ -1,0 +2,28 @@ +Wed Mar 11 15:30:46 CET 2009 - kmachalkova@suse.cz + +- Added tooltips to BarGraph widget (duplicate segment text in + a tooltip should the segment become too small) + +------------------------------------------------------------------- +Tue Mar 10 16:40:26 CET 2009 - tgoettlicher@suse.de + +- Fixed frame widget min width (bnc #409143) + +------------------------------------------------------------------- +Fri Mar 6 10:35:25 CET 2009 - tgoettlicher@suse.de + +- Added context menus +- V 2.18.6 + +------------------------------------------------------------------- +Fri Feb 20 16:18:37 CET 2009 - tgoettlicher@suse.de + +- Fixed menubar spacing in wizard (bnc #464088) + +------------------------------------------------------------------- +Thu Feb 19 17:21:48 CET 2009 - tgoettlicher@suse.de + +- Fixed bnc #464152: save file dialog asks twice to replace file + when the file exists + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- yast2-qt-2.18.5.tar.bz2 New: ---- yast2-qt-2.18.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-qt.spec ++++++ --- /var/tmp/diff_new_pack.v11408/_old 2009-03-25 19:02:38.000000000 +0100 +++ /var/tmp/diff_new_pack.v11408/_new 2009-03-25 19:02:38.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package yast2-qt (Version 2.18.5) +# spec file for package yast2-qt (Version 2.18.6) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -18,12 +18,12 @@ Name: yast2-qt -Version: 2.18.5 -Release: 2 +Version: 2.18.6 +Release: 1 License: GPL v2 or later Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-qt-2.18.5.tar.bz2 +Source0: yast2-qt-2.18.6.tar.bz2 BuildRequires: docbook-xsl-stylesheets BuildRequires: doxygen BuildRequires: libdrm-devel @@ -37,8 +37,8 @@ BuildRequires: cmake Summary: YaST2 - Graphical User Interface BuildRequires: yast2-devtools >= 2.16.3 -BuildRequires: yast2-libyui-devel >= 2.18.4 -Requires: yast2-libyui >= 2.18.4 +BuildRequires: yast2-libyui-devel >= 2.18.7 +Requires: yast2-libyui >= 2.18.7 Requires: yast2_theme >= 2.16.1 Provides: yast2_ui Provides: y2base:/usr/lib/YaST2/servers/qt @@ -119,6 +119,19 @@ %_includedir/* %changelog +* Wed Mar 11 2009 kmachalkova@suse.cz +- Added tooltips to BarGraph widget (duplicate segment text in + a tooltip should the segment become too small) +* Tue Mar 10 2009 tgoettlicher@suse.de +- Fixed frame widget min width (bnc #409143) +* Fri Mar 06 2009 tgoettlicher@suse.de +- Added context menus +- V 2.18.6 +* Fri Feb 20 2009 tgoettlicher@suse.de +- Fixed menubar spacing in wizard (bnc #464088) +* Thu Feb 19 2009 tgoettlicher@suse.de +- Fixed bnc #464152: save file dialog asks twice to replace file + when the file exists * Sun Feb 15 2009 coolo@suse.de - include stdio to fix compilation with gcc 4.4 * Mon Feb 09 2009 sh@suse.de ++++++ yast2-qt-2.18.5.tar.bz2 -> yast2-qt-2.18.6.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/package/yast2-qt.changes new/yast2-qt-2.18.6/package/yast2-qt.changes --- old/yast2-qt-2.18.5/package/yast2-qt.changes 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/package/yast2-qt.changes 2009-03-12 21:55:39.000000000 +0100 @@ -1,4 +1,32 @@ ------------------------------------------------------------------- +Wed Mar 11 15:30:46 CET 2009 - kmachalkova@suse.cz + +- Added tooltips to BarGraph widget (duplicate segment text in + a tooltip should the segment become too small) + +------------------------------------------------------------------- +Tue Mar 10 16:40:26 CET 2009 - tgoettlicher@suse.de + +- Fixed frame widget min width (bnc #409143) + +------------------------------------------------------------------- +Fri Mar 6 10:35:25 CET 2009 - tgoettlicher@suse.de + +- Added context menus +- V 2.18.6 + +------------------------------------------------------------------- +Fri Feb 20 16:18:37 CET 2009 - tgoettlicher@suse.de + +- Fixed menubar spacing in wizard (bnc #464088) + +------------------------------------------------------------------- +Thu Feb 19 17:21:48 CET 2009 - tgoettlicher@suse.de + +- Fixed bnc #464152: save file dialog asks twice to replace file + when the file exists + +------------------------------------------------------------------- Sun Feb 15 12:39:06 CET 2009 - coolo@suse.de - include stdio to fix compilation with gcc 4.4 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/CMakeLists.txt new/yast2-qt-2.18.6/src/CMakeLists.txt --- old/yast2-qt-2.18.5/src/CMakeLists.txt 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/CMakeLists.txt 2009-03-12 21:55:39.000000000 +0100 @@ -32,6 +32,7 @@ YQCheckBox.cc YQCheckBoxFrame.cc YQComboBox.cc + YQContextMenu.cc YQDateField.cc YQDialog.cc YQDownloadProgress.cc @@ -96,6 +97,7 @@ YQCheckBox.h YQCheckBoxFrame.h YQComboBox.h + YQContextMenu.h YQDateField.h YQDialog.h YQDownloadProgress.h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQApplication.cc new/yast2-qt-2.18.6/src/YQApplication.cc --- old/yast2-qt-2.18.5/src/YQApplication.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQApplication.cc 2009-03-12 21:55:39.000000000 +0100 @@ -28,6 +28,7 @@ #include <QMessageBox> #include <QSettings> #include <QFontDatabase> +#include <QMenu> #include <fontconfig/fontconfig.h> @@ -42,6 +43,7 @@ #include "YQApplication.h" #include "YQPackageSelectorPluginStub.h" #include "YQGraphPluginStub.h" +#include "YQContextMenu.h" YQApplication::YQApplication() @@ -54,8 +56,10 @@ , _autoFonts( false ) , _autoNormalFontSize( -1 ) , _autoHeadingFontSize( -1 ) - , _leftHandedMouse( false ) + , _leftHandedMouse( false ) , _askedForLeftHandedMouse( false ) + , _contextMenuPos ( QPoint (0, 0) ) + , _contextMenu ( 0 ) { yuiDebug() << "YQApplication constructor start" << endl; @@ -509,6 +513,15 @@ } +bool +YQApplication::openContextMenu( const YItemCollection & itemCollection ) +{ + YQContextMenu* menu = new YQContextMenu( _contextMenuPos ); + menu->addItems(itemCollection); + + return true; +} + QString YQApplication::askForSaveFileName( const QString & startWith, @@ -516,7 +529,6 @@ const QString & headline ) { QString fileName; - bool tryAgain = false; QWidget* parent = 0; YDialog * currentDialog = YDialog::currentDialog( false ); @@ -524,45 +536,16 @@ parent = (QWidget *) currentDialog->widgetRep(); - do - { - // Leave the mouse cursor alone - this function might be called from - // some other widget, not only from UI::AskForSaveFileName(). - - fileName = QFileDialog::getSaveFileName( parent, // parent - headline, // caption - startWith, // dir - filter ); // filter - - if ( fileName.isEmpty() ) // this includes fileName.isNull() - return QString::null; + // Leave the mouse cursor alone - this function might be called from + // some other widget, not only from UI::AskForSaveFileName(). + fileName = QFileDialog::getSaveFileName( parent, // parent + headline, // caption + startWith, // dir + filter ); // filter - if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) // file exists? - { - QString msg; - - if ( access( QFile::encodeName( fileName ), W_OK ) == 0 ) - { - // Confirm if the user wishes to overwrite an existing file - msg = ( _( "%1 exists! Really overwrite?" ) ).arg( fileName ); - } - else - { - // Confirm if the user wishes to overwrite a write-protected file %1 - msg = ( _( "%1 exists and is write-protected!\nReally overwrite?" ) ).arg( fileName ); - } - - int buttonNo = QMessageBox::information( parent, - // Translators: Window title for confirmation dialog - _( "Confirm" ), - msg, - _( "C&ontinue" ), - _( "&Cancel" ) ); - tryAgain = ( buttonNo != 0 ); - } - - } while ( tryAgain ); + if ( fileName.isEmpty() ) // this includes fileName.isNull() + return QString::null; return fileName; } @@ -743,5 +726,11 @@ return plugin; } +void +YQApplication::setContextMenuPos( QPoint contextMenuPos ) +{ + _contextMenuPos = contextMenuPos; +} + #include "YQApplication.moc" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQApplication.h new/yast2-qt-2.18.6/src/YQApplication.h --- old/yast2-qt-2.18.5/src/YQApplication.h 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQApplication.h 2009-03-12 21:55:39.000000000 +0100 @@ -31,6 +31,7 @@ class QSettings; class YQPackageSelectorPlugin; class YQGraphPlugin; +class QMenu; class YQApplication: public QObject, public YApplication @@ -211,6 +212,18 @@ const QString & headline ); /** + * Open a context menu for a widget + * + * 'itemCollection' describes the menu structure + * + * Returns true on success (otherwise false). + * + * Implemented from YApplication. + **/ + virtual bool openContextMenu ( const YItemCollection & itemCollection ); + + + /** * Return the package selector plugin singleton or creates it * (including loading the plugin lib) if it does not exist yet. **/ @@ -276,7 +289,16 @@ * Reimplemented from YApplication. **/ virtual void beep(); + + /** + * Return position of the context menu (in gloabl coordinates) + **/ + virtual QPoint contextMenuPos() { return _contextMenuPos; } + /** + * Sets the position of the context menu (in gloabl coordinates) + **/ + virtual void setContextMenuPos( QPoint contextMenuPos ); // Display information and UI capabilities. // @@ -304,7 +326,6 @@ virtual bool hasWizardDialogSupport() { return true; } virtual bool leftHandedMouse(); - protected: /** @@ -355,6 +376,9 @@ bool _leftHandedMouse; bool _askedForLeftHandedMouse; + QPoint _contextMenuPos; + QMenu* _contextMenu; + }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQBarGraph.cc new/yast2-qt-2.18.6/src/YQBarGraph.cc --- old/yast2-qt-2.18.5/src/YQBarGraph.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQBarGraph.cc 2009-03-12 21:55:39.000000000 +0100 @@ -37,6 +37,12 @@ using std::max; +// a helper function, takes std::pair as a param and compares +// its key (int) to the second param - true if less +inline bool in_segment (pair <int, QString> seg, int cmp) +{ + return seg.first < cmp; +} YQBarGraph::YQBarGraph( YWidget * parent ) : QFrame( (QWidget *) parent->widgetRep() ) @@ -58,6 +64,24 @@ QFrame::update(); // triggers drawContents() } +bool +YQBarGraph::event ( QEvent *event) +{ + if (event->type() == QEvent::ToolTip) { + QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); + + // Ook, I know this is write-only piece of code, but it basically means this: + // Traverse map from the rear end, looking for the lower bound of the segment the + // mouse pointer is in, using in_segment function as comparison + map<int, QString>::reverse_iterator lbound = + find_if( toolTips.rbegin(), toolTips.rend(), bind2nd( ptr_fun(in_segment), helpEvent->x())); + + if (lbound != toolTips.rend()) + QToolTip::showText(helpEvent->globalPos(), lbound->second ); + } + return QWidget::event(event); + +} void YQBarGraph::paintEvent( QPaintEvent* paintEvent ) @@ -72,6 +96,7 @@ int x_off = YQBarGraphOuterMargin; int y_off = YQBarGraphOuterMargin; int valueTotal = 0; + toolTips.clear(); for ( int i=0; i < segments(); i++ ) valueTotal += segment(i).value(); @@ -136,6 +161,8 @@ segHeight - 2 * YQBarGraphLabelVerticalMargin + 1, Qt::AlignCenter, txt ); + + toolTips.insert(make_pair( x_off, txt)); // Prepare for the next segment x_off += segWidth; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQBarGraph.h new/yast2-qt-2.18.6/src/YQBarGraph.h --- old/yast2-qt-2.18.5/src/YQBarGraph.h 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQBarGraph.h 2009-03-12 21:55:39.000000000 +0100 @@ -21,7 +21,12 @@ #define YQBarGraph_h #include "qframe.h" +#include "qevent.h" +#include "qtooltip.h" #include "YBarGraph.h" +#include <map> + +using namespace std; class QPainter; @@ -80,6 +85,7 @@ protected: + virtual bool event( QEvent * event ); /** * Draw the contents. * @@ -97,6 +103,10 @@ * guaranteed to contrast with the defaultSegmentColor with the same index. **/ YColor defaultTextColor( unsigned index ); + +private: + map <int, QString> toolTips ; + }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQContextMenu.cc new/yast2-qt-2.18.6/src/YQContextMenu.cc --- old/yast2-qt-2.18.5/src/YQContextMenu.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQContextMenu.cc 2009-03-12 21:55:39.000000000 +0100 @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------\ +| | +| __ __ ____ _____ ____ | +| \ \ / /_ _/ ___|_ _|___ \ | +| \ V / _` \___ \ | | __) | | +| | | (_| |___) || | / __/ | +| |_|\__,_|____/ |_| |_____| | +| | +| core system | +| (C) SuSE GmbH | +\----------------------------------------------------------------------/ + + File: YQContextMenu.cc + + Author: Thomas Goettlicher <tgoettlicher@suse.de> + +/-*/ + + +#include <QMenu> +#include <qtimer.h> +#define YUILogComponent "qt-ui" +#include "YUILog.h" + +#include "utf8.h" +#include "YQUI.h" +#include "YQContextMenu.h" +#include "YEvent.h" + + +YQContextMenu::YQContextMenu() + : QObject () + , YContextMenu( ) +{ + yuiWarning() << "YQContextMenu"; + +} + +YQContextMenu::YQContextMenu( const QPoint position ) + : QObject () + , YContextMenu( ) + , _position ( position ) +{ + yuiWarning() << "YQContextMenu"; + +} + + +YQContextMenu::~YQContextMenu() +{ + // NOP +} + + +void +YQContextMenu::rebuildMenuTree() +{ + QMenu * menu = new QMenu( 0 ); + YUI_CHECK_NEW( menu ); + menu->setProperty( "class", "ycontextmenu QMenu" ); + + connect( menu, SIGNAL( triggered ( QAction * ) ), + this, SLOT ( menuEntryActivated( QAction * ) ) ); + + connect( menu, SIGNAL( aboutToHide () ), + this, SLOT ( slotMenuHidden () ) ); + // + // Recursively add Qt menu items from the YMenuItems + // + + rebuildMenuTree( menu, itemsBegin(), itemsEnd() ); + menu->exec( _position ); +} + + +void +YQContextMenu::rebuildMenuTree( QMenu * parentMenu, YItemIterator begin, YItemIterator end ) +{ + for ( YItemIterator it = begin; it != end; ++it ) + { + YItem * item = *it; + QPixmap icon; + + if ( item->hasIconName() ) + { + string iconName = iconFullPath( item ); + icon = QPixmap( iconName.c_str() ); + + if ( icon.isNull() ) + yuiWarning() << "Can't load icon " << iconName << endl; + } + + if ( item->hasChildren() ) + { + QMenu * subMenu; + + if ( icon.isNull() ) + subMenu = parentMenu->addMenu( fromUTF8( item->label() )); + else + subMenu = parentMenu->addMenu( QIcon( icon ), fromUTF8( item->label() )); + + connect( subMenu, SIGNAL( triggered ( QAction * ) ), + this, SLOT ( menuEntryActivated( QAction * ) ) ); + + rebuildMenuTree( subMenu, item->childrenBegin(), item->childrenEnd() ); + } + else // No children - leaf entry + { + // item->index() is guaranteed to be unique within this YContextMenu's items, + // so it can easily be used as unique ID in all Q3PopupMenus that belong + // to this YQContextMenu. + + QAction *act; + + if ( icon.isNull() ) + act = parentMenu->addAction( fromUTF8( item->label() ) ); + else + act = parentMenu->addAction( QIcon( icon ), fromUTF8( item->label() ) ); + + _serials[act] = item->index(); + } + } +} + +void +YQContextMenu::slotMenuHidden() +{ + // dirty hack + // see menuEntryActivated() for details + QTimer::singleShot( 100, this, SLOT( slotReturnMenuHidden() ) ); +} + + +void +YQContextMenu::slotReturnMenuHidden() +{ + YQUI::ui()->sendEvent( new YCancelEvent() ); +} + + +void +YQContextMenu::menuEntryActivated( QAction* action ) +{ + int serialNo = -1; + if ( _serials.contains( action ) ) + serialNo = _serials[action]; + + // yuiDebug() << "Selected menu entry #" << menu_item_index << endl; + _selectedItem = findMenuItem( serialNo ); + + if ( _selectedItem ) + { + /* + * Defer the real returnNow() until all popup related events have been + * processed. This took me some hours to figure out; obviously + * exit_loop() doesn't have any effect as long as there are still + * popups open. So be it - use a zero timer to perform the real + * returnNow() later. + */ + + /* + * the 100 delay is a ugly dirty workaround + */ + QTimer::singleShot( 100, this, SLOT( returnNow() ) ); + } + else + { + yuiError() << "No menu item with serial no. " << serialNo << endl; + } +} + + +void +YQContextMenu::returnNow() +{ + if ( _selectedItem ) + { + YQUI::ui()->sendEvent( new YMenuEvent( _selectedItem ) ); + _selectedItem = 0; + } +} + + +int YQContextMenu::preferredWidth() +{ + return 42; +} + + +int YQContextMenu::preferredHeight() +{ + return 42; +} + + +void +YQContextMenu::setSize( int newWidth, int newHeight ) +{ + +} + + +#include "YQContextMenu.moc" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQContextMenu.h new/yast2-qt-2.18.6/src/YQContextMenu.h --- old/yast2-qt-2.18.5/src/YQContextMenu.h 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQContextMenu.h 2009-03-12 21:55:39.000000000 +0100 @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------\ +| | +| __ __ ____ _____ ____ | +| \ \ / /_ _/ ___|_ _|___ \ | +| \ V / _` \___ \ | | __) | | +| | | (_| |___) || | / __/ | +| |_|\__,_|____/ |_| |_____| | +| | +| core system | +| (C) SuSE GmbH | +\----------------------------------------------------------------------/ + + File: YQContextMenu.h + + Author: Thomas Goettlicher <tgoettlicher@suse.de> + +/-*/ + + +#ifndef YQContextMenu_h +#define YQContextMenu_h + +#include <qwidget.h> +#include "YContextMenu.h" +#include <QHash> + +class QAction; +class QPushButton; +class QMenu; + +class YQContextMenu : public QObject, public YContextMenu +{ + Q_OBJECT + +public: + /** + * Constructor. + **/ +// YQContextMenu( YWidget * parent, +// const string & label ); + YQContextMenu( ); + YQContextMenu( const QPoint position ); + + + /** + * Destructor. + **/ + virtual ~YQContextMenu(); + + /** + * Change the label on the button. + * + * Reimplemented from YContextMenu / YSelectionWidget. + **/ +// virtual void setLabel( const string & label ); + + /** + * Rebuild the displayed menu tree from the internally stored YMenuItems. + * + * Implemented from YContextMenu. + **/ + virtual void rebuildMenuTree(); + + /** + * Preferred width of the widget. + * + * Reimplemented from YWidget. + **/ + virtual int preferredWidth(); + + /** + * Preferred height of the widget. + * + * Reimplemented from YWidget. + **/ + virtual int preferredHeight(); + + /** + * Set the new size of the widget. + * + * Reimplemented from YWidget. + **/ + virtual void setSize( int newWidth, int newHeight ); + + +protected slots: + + /** + * Triggered when any menu item is activated. + **/ + void menuEntryActivated( QAction * menuItem ); + + /** + * Triggered via menuEntryActivated() by zero timer to get back in sync + * with the Qt event loop. + **/ + void returnNow(); + + /** + * Triggered when the context menu is hidden + **/ + void slotMenuHidden(); + + /** + * Triggered via slotMenuHidden() by zero timer to get back in sync + * with the Qt event loop. + **/ + void slotReturnMenuHidden(); + + + + +protected: + + /** + * Recursively insert menu items into 'menu' from iterator 'begin' to iterator 'end'. + **/ + void rebuildMenuTree( QMenu * menu, YItemIterator begin, YItemIterator end ); + + + // + // Data members + // + + YMenuItem * _selectedItem; + QPushButton * _qt_button; + QHash<QAction*,int> _serials; + + +private: + QPoint _position; + +}; + +#endif // YQContextMenu_h diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQFrame.cc new/yast2-qt-2.18.6/src/YQFrame.cc --- old/yast2-qt-2.18.5/src/YQFrame.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQFrame.cc 2009-03-12 21:55:39.000000000 +0100 @@ -85,7 +85,12 @@ int left, top, right, bottom; getContentsMargins( &left, &top, &right, &bottom ); - return preferredWidth + left + right; + preferredWidth += left + right; + + if ( minimumSizeHint().width() > preferredWidth ) + preferredWidth = minimumSizeHint().width(); + + return preferredWidth; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQOptionalWidgetFactory.cc new/yast2-qt-2.18.6/src/YQOptionalWidgetFactory.cc --- old/yast2-qt-2.18.5/src/YQOptionalWidgetFactory.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQOptionalWidgetFactory.cc 2009-03-12 21:55:39.000000000 +0100 @@ -306,3 +306,10 @@ else return 0; } + +bool YQOptionalWidgetFactory::hasContextMenu() +{ + return true; +} + + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQOptionalWidgetFactory.h new/yast2-qt-2.18.6/src/YQOptionalWidgetFactory.h --- old/yast2-qt-2.18.5/src/YQOptionalWidgetFactory.h 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQOptionalWidgetFactory.h 2009-03-12 21:55:39.000000000 +0100 @@ -118,6 +118,8 @@ const string & layoutAlgorithm ); virtual YGraph * createGraph( YWidget * parent, graph_t * graph ); + virtual bool hasContextMenu(); + protected: friend class YQUI; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQSelectionBox.cc new/yast2-qt-2.18.6/src/YQSelectionBox.cc --- old/yast2-qt-2.18.5/src/YQSelectionBox.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQSelectionBox.cc 2009-03-12 21:55:39.000000000 +0100 @@ -289,6 +289,14 @@ YQUI::yqApp()->maybeLeftHandedUser(); } } + else if ( ev->type() == QEvent::ContextMenu ) + { + QContextMenuEvent * contextMenuEvent = dynamic_cast<QContextMenuEvent *> (ev); + + YQUI::yqApp()->setContextMenuPos( contextMenuEvent->globalPos() ); + if ( notifyContextMenu() ) + YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ContextMenuActivated ) ); + } return QWidget::eventFilter( obj, ev ); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQTable.cc new/yast2-qt-2.18.6/src/YQTable.cc --- old/yast2-qt-2.18.5/src/YQTable.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQTable.cc 2009-03-12 21:55:39.000000000 +0100 @@ -30,6 +30,8 @@ #include "QY2ListView.h" #include "YQTable.h" +#include "YQApplication.h" + YQTable::YQTable( YWidget * parent, YTableHeader * tableHeader, bool multiSelectionMode ) @@ -48,11 +50,13 @@ layout->addWidget( _qt_listView ); _qt_listView->setAllColumnsShowFocus( true ); _qt_listView->header()->setStretchLastSection( false ); + setKeepSorting( keepSorting() ); if ( multiSelectionMode ) _qt_listView->setSelectionMode( QAbstractItemView::ExtendedSelection ); + _qt_listView->setContextMenuPolicy( Qt::CustomContextMenu ); // // Add columns @@ -80,6 +84,10 @@ connect( _qt_listView, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ), this, SLOT ( slotSelected ( QTreeWidgetItem * ) ) ); + connect( _qt_listView, SIGNAL( customContextMenuRequested ( const QPoint & ) ), + this, SLOT ( slotContextMenu ( const QPoint & ) ) ); + + if ( multiSelectionMode ) { // This is the exceptional case - avoid performance drop in the normal case @@ -378,6 +386,17 @@ } +void +YQTable::slotContextMenu ( const QPoint & pos ) +{ + if ( ! _qt_listView || ! _qt_listView->viewport() ) + return; + + YQUI::yqApp()->setContextMenuPos( _qt_listView->viewport()->mapToGlobal( pos ) ); + if ( notifyContextMenu() ) + YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ContextMenuActivated ) ); +} + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQTable.h new/yast2-qt-2.18.6/src/YQTable.h --- old/yast2-qt-2.18.5/src/YQTable.h 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQTable.h 2009-03-12 21:55:39.000000000 +0100 @@ -152,6 +152,14 @@ **/ void slotActivated( QTreeWidgetItem * ); + /** + * Propagate a context menu selection + * + * This will trigger an 'ContextMenuActivated' event if 'notifyContextMenu' is set. + **/ + void slotContextMenu ( const QPoint & pos ); + + protected: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQTree.cc new/yast2-qt-2.18.6/src/YQTree.cc --- old/yast2-qt-2.18.5/src/YQTree.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQTree.cc 2009-03-12 21:55:39.000000000 +0100 @@ -36,6 +36,8 @@ #include "YTreeItem.h" #include "YQSignalBlocker.h" #include "YQWidgetCaption.h" +#include "YQApplication.h" + #define VERBOSE_TREE_ITEMS 0 @@ -68,6 +70,8 @@ // _qt_treeWidget->setHeader(0L); _qt_treeWidget->setRootIsDecorated ( true ); + _qt_treeWidget->setContextMenuPolicy( Qt::CustomContextMenu ); + _caption->setBuddy ( _qt_treeWidget ); connect( _qt_treeWidget, SIGNAL( itemSelectionChanged () ), @@ -81,6 +85,10 @@ connect( _qt_treeWidget, SIGNAL( itemCollapsed ( QTreeWidgetItem * ) ), this, SLOT ( slotItemCollapsed( QTreeWidgetItem * ) ) ); + + connect( _qt_treeWidget, SIGNAL( customContextMenuRequested ( const QPoint & ) ), + this, SLOT ( slotContextMenu ( const QPoint & ) ) ); + } @@ -283,6 +291,16 @@ } +void YQTree::slotContextMenu ( const QPoint & pos ) +{ + if ( ! _qt_treeWidget || ! _qt_treeWidget->viewport() ) + return; + + YQUI::yqApp()->setContextMenuPos( _qt_treeWidget->viewport()->mapToGlobal( pos ) ); + if ( notifyContextMenu() ) + YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ContextMenuActivated ) ); +} + /*============================================================================*/ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQTree.h new/yast2-qt-2.18.6/src/YQTree.h --- old/yast2-qt-2.18.5/src/YQTree.h 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQTree.h 2009-03-12 21:55:39.000000000 +0100 @@ -120,6 +120,8 @@ protected slots: + + /** * Propagate a tree item selection. * @@ -144,6 +146,13 @@ **/ void slotItemCollapsed( QTreeWidgetItem * item ); + /** + * Propagate a context menu selection + * + * This will trigger an 'ContextMenuActivated' event if 'notifyContextMenu' is set. + **/ + void slotContextMenu ( const QPoint & pos ); + protected: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/src/YQWizard.cc new/yast2-qt-2.18.6/src/YQWizard.cc --- old/yast2-qt-2.18.5/src/YQWizard.cc 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/src/YQWizard.cc 2009-03-12 21:55:39.000000000 +0100 @@ -687,6 +687,11 @@ QY2Styler::styler()->registerChildWidget( this, _workArea ); QVBoxLayout *vbox = new QVBoxLayout( _workArea ); + YUI_CHECK_NEW( vbox ); + + // + // Menu bar + // _menuBar = new QMenuBar( _workArea ); YUI_CHECK_NEW( _menuBar ); @@ -694,6 +699,16 @@ _menuBar->hide(); // will be made visible when menus are added vbox->addWidget( _menuBar ); + + QVBoxLayout *innerbox = new QVBoxLayout( _workArea ); + YUI_CHECK_NEW( innerbox ); + + innerbox->setMargin ( YQWidgetMargin ); + + vbox->addLayout(innerbox); + vbox->setMargin( 0 ); + + // // Dialog icon and heading // @@ -701,7 +716,7 @@ QHBoxLayout * headingHBox = new QHBoxLayout(); YUI_CHECK_NEW( headingHBox ); //headingHBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert - vbox->addLayout( headingHBox ); + innerbox->addLayout( headingHBox ); _dialogIcon = new QLabel( _workArea ); YUI_CHECK_NEW( _dialogIcon ); @@ -723,14 +738,14 @@ // layoutClientArea( _workArea ); - vbox->addWidget( _clientArea ); + innerbox->addWidget( _clientArea ); // // Button box // QLayout *bb = layoutButtonBox( _workArea ); - vbox->addLayout( bb ); + innerbox->addLayout( bb ); return _workArea; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/VERSION.cmake new/yast2-qt-2.18.6/VERSION.cmake --- old/yast2-qt-2.18.5/VERSION.cmake 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/VERSION.cmake 2009-03-12 21:55:39.000000000 +0100 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "18") -SET(VERSION_PATCH "5") +SET(VERSION_PATCH "6") diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-2.18.5/yast2-qt.spec.in new/yast2-qt-2.18.6/yast2-qt.spec.in --- old/yast2-qt-2.18.5/yast2-qt.spec.in 2009-02-15 12:40:13.000000000 +0100 +++ new/yast2-qt-2.18.6/yast2-qt.spec.in 2009-03-12 21:55:39.000000000 +0100 @@ -16,8 +16,8 @@ Summary: - BuildRequires: yast2-devtools >= 2.16.3 -BuildRequires: yast2-libyui-devel >= 2.18.4 -Requires: yast2-libyui >= 2.18.4 +BuildRequires: yast2-libyui-devel >= 2.18.7 +Requires: yast2-libyui >= 2.18.7 Requires: yast2_theme >= 2.16.1 Provides: yast2_ui Provides: y2base:/usr/lib/YaST2/servers/qt ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de