Example #1
0
void qt_handle_xdnd_position( QWidget *w, const XEvent * xe, bool passive )
{
    const unsigned long *l = (const unsigned long *)xe->xclient.data.l;

    QPoint p( (l[2] & 0xffff0000) >> 16, l[2] & 0x0000ffff );
    QWidget * c = find_child( w, p ); // changes p to to c-local coordinates

    if (!passive && checkEmbedded(c, xe))
	return;

    if ( !c || !c->acceptDrops() && c->isDesktop() ) {
	return;
    }

    if ( l[0] != qt_xdnd_dragsource_xid ) {
	//qDebug( "xdnd drag position from unexpected source (%08lx not %08lx)",
	//     l[0], qt_xdnd_dragsource_xid );
	return;
    }

    if (l[3] != 0) {
        // timestamp from the source
        qt_xdnd_target_current_time = qt_x_user_time = l[3];
    }

    XClientMessageEvent response;
    response.type = ClientMessage;
    response.window = qt_xdnd_dragsource_xid;
    response.format = 32;
    response.message_type = qt_xdnd_status;
    response.data.l[0] = w->winId();
    response.data.l[1] = 0; // flags
    response.data.l[2] = 0; // x, y
    response.data.l[3] = 0; // w, h
    response.data.l[4] = 0; // action

    if ( !passive ) { // otherwise just reject
	while ( c && !c->acceptDrops() && !c->isTopLevel() ) {
	    p = c->mapToParent( p );
	    c = c->parentWidget();
	}

	QRect answerRect( c->mapToGlobal( p ), QSize( 1,1 ) );

	QDragMoveEvent me( p );
	QDropEvent::Action accepted_action = xdndaction_to_qtaction(l[4]);
	me.setAction(accepted_action);

	if ( c != qt_xdnd_current_widget ) {
	    qt_xdnd_target_answerwas = FALSE;
	    if ( qt_xdnd_current_widget ) {
		QDragLeaveEvent e;
		QApplication::sendEvent( qt_xdnd_current_widget, &e );
	    }
	    if ( c->acceptDrops() ) {
		qt_xdnd_current_widget = c;
		qt_xdnd_current_position = p;

		QDragEnterEvent de( p );
		de.setAction(accepted_action);
		QApplication::sendEvent( c, &de );
		if ( de.isAccepted() ) {
		    me.accept( de.answerRect() );
		    if ( !de.isActionAccepted() ) // only as a copy (move if we del)
			accepted_action = QDropEvent::Copy;
		    else
			me.acceptAction(TRUE);
		} else {
		    me.ignore( de.answerRect() );
		}
	    }
	} else {
	    if ( qt_xdnd_target_answerwas ) {
		me.accept();
		me.acceptAction(global_requested_action == global_accepted_action);
	    }
	}

	if ( !c->acceptDrops() ) {
	    qt_xdnd_current_widget = 0;
	    answerRect = QRect( p, QSize( 1, 1 ) );
	} else if ( xdndaction_to_qtaction(l[4]) < QDropEvent::Private ) {
	    qt_xdnd_current_widget = c;
	    qt_xdnd_current_position = p;

	    QApplication::sendEvent( c, &me );
	    qt_xdnd_target_answerwas = me.isAccepted();
	    if ( me.isAccepted() ) {
		response.data.l[1] = 1; // yes
		if ( !me.isActionAccepted() ) // only as a copy (move if we del)
		    accepted_action = QDropEvent::Copy;
	    } else {
		response.data.l[0] = 0;
	    }
	    answerRect = me.answerRect().intersect( c->rect() );
	} else {
	    response.data.l[0] = 0;
	    answerRect = QRect( p, QSize( 1, 1 ) );
	}
	answerRect = QRect( c->mapToGlobal( answerRect.topLeft() ),
			    answerRect.size() );

	if ( answerRect.left() < 0 )
	    answerRect.setLeft( 0 );
	if ( answerRect.right() > 4096 )
	    answerRect.setRight( 4096 );
	if ( answerRect.top() < 0 )
	    answerRect.setTop( 0 );
	if ( answerRect.bottom() > 4096 )
	    answerRect.setBottom( 4096 );
	if ( answerRect.width() < 0 )
	    answerRect.setWidth( 0 );
	if ( answerRect.height() < 0 )
	    answerRect.setHeight( 0 );

	response.data.l[2] = (answerRect.x() << 16) + answerRect.y();
	response.data.l[3] = (answerRect.width() << 16) + answerRect.height();
	response.data.l[4] = qtaction_to_xdndaction(accepted_action);
	global_accepted_action = accepted_action;
    }

    // reset
    qt_xdnd_target_current_time = CurrentTime;

    QWidget * source = QWidget::find( qt_xdnd_dragsource_xid );

    if ( source && source->isDesktop() && !source->acceptDrops() )
	source = 0;

    if ( source )
	qt_handle_xdnd_status( source, (const XEvent *)&response, passive );
    else
	XSendEvent( QPaintDevice::x11AppDisplay(), qt_xdnd_dragsource_xid, False,
		    NoEventMask, (XEvent*)&response );
}
bool IMPluginSwitcher::keyPressed(QKeyEvent *p_keyPressEvent,  ZInputField* field)
//bool IMPluginSwitcher::keyReleased(QKeyEvent *p_keyPressEvent,  ZInputField* field)
//bool IMPluginSwitcher::hack(QKeyEvent *p_keyPressEvent,  ZInputField* field)
{
	toLog( "##### Start my keyPressed! ");

	bool ret = keyPressedInternal( p_keyPressEvent, field );

    if ( field != NULL && p_keyPressEvent->key() == KEY_GREEN )
    {
		toLog( "##### Key code is GREEN !!! " );
		toLog( "##### Getting editor" );
		
		QWidget * editor = field->getEditorWidget();
		
		toLog( "##### Create action dlg" );
		EDIT_FILD_TYPE tupeEditor = TYPE_UDEFINE;
		
		{ //For not use more memory, to store class name
		QString s = QString(editor->className());

		toLog( "##### Editor class: "+s );

		if ( s.find("MultiLineEdit") != -1)
			tupeEditor = TYPE_MULTI_LINE_EDIT; 
		else if ( s.find("LineEdit") != -1 )
			tupeEditor = TYPE_LINE_EDIT; 
		else if ( (s.find("ZTextEdit") != -1) || (s.find("MMS_PageWidget") != -1) )
			tupeEditor = TYPE_TEXT_EDIT;
		else if  ( s.find("SVGCanvas") != -1 )
			return false; //Copy past don't work(
	
		}

		int selected=CANCEL_CODE;
		
		if ( onSelectText )
		{
			toLog( "##### Auto select" );
			selected = ACTION_SELECT_END;
		} else
		{			
			QRect rect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
			ZOptionsMenu * menu = new ZOptionsMenu (rect, editor);//editor->topLevelWidget()
			
			toLog( "##### Insert item to list" );		
			
			INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_COPY", "Copy"),  ACTION_COPY);
			INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_INSERT", "Paste"), ACTION_PAST);
			
			int x1=0,x2=0,y1,y2;
			bool oldSel=false;
			
			if ( tupeEditor != TYPE_UDEFINE )
			{
				INSERT_ITEM(ZWidget::tr("TXT_RID_MENU_CUT", "Cut"), ACTION_CUT);
		        INSERT_SEP();
		        INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_SELECT_ALL", "onSelectText all"), ACTION_SELECT_ALL);
				INSERT_ITEM(ZWidget::tr("TXT_RID_HEADER_SELECT", "Select"), ACTION_SELECT_START);
				
				//save curren state of input fild and get cursor point
				QPoint pos(0,0);
				switch ( tupeEditor )
				{
					case TYPE_MULTI_LINE_EDIT:
						pos = ((ZMultiLineEdit*)editor)->mapToGlobal(((ZMultiLineEdit*)editor)->cursorPoint());
						oldSel = ((ZMultiLineEdit*)editor)->hasMarkedText();
						if ( oldSel )
							((ZMultiLineEdit*)editor)->getMarkedRegion( &x1, &y1, &x2, &y2 );
						else
							((ZMultiLineEdit*)editor)->getCursorPosition( &x1, &y1 );
						break;
					case TYPE_LINE_EDIT:
						pos = ((ZLineEdit*)editor)->mapToGlobal(((ZLineEdit*)editor)->cursorPoint());
						oldSel = ((ZLineEdit*)editor)->hasMarkedText();
						if ( !oldSel )
							x1=((ZLineEdit*)editor)->cursorPosition();
						break;
					case TYPE_TEXT_EDIT:
					default:
						pos = editor->mapToGlobal( field->getCursorPos() );
						break;
				}
				menu->setPosition(ZOptionsMenu::TopLeft, pos );
			}
			
			toLog(  "##### Show dlg" );
			
			menu->popup();	
			while ( !menu->isHidden() ) qApp->processEvents();
			selected = menu->getCurrentSelectedItemId();

			//load state of input fild
			if ( tupeEditor>0 )
			{
				switch ( tupeEditor )
				{
					case TYPE_MULTI_LINE_EDIT:
						if ( oldSel )
							((ZMultiLineEdit*)editor)->setSelection( x1, y1, x2, y2 );
						else
							((ZMultiLineEdit*)editor)->setCursorPosition( x1, y1, false );
						break;
					case TYPE_LINE_EDIT:
						if ( oldSel )
						{
							if ( GET_CURSOR_Y == -1 )
								((ZLineEdit*)editor)->selectAll();
							else
								((ZLineEdit*)editor)->setSelection( GET_CURSOR_X, GET_CURSOR_Y );
						}
						else
							((ZLineEdit*)editor)->setCursorPosition(x1);
						break;
					default:
						break;					
				}				
			}

			toLog(  "##### Delete dlg" );		
			    	
			delete menu;
			menu = NULL;
		}		
		
		if ( selected >= 0 )
		{
			toLog( "##### Operate code:" << selected << " edit type:" << tupeEditor );		
				
			switch (tupeEditor)
			{
				case TYPE_UDEFINE:
				{
					switch (selected)
					{
						case ACTION_COPY:
						{
							QString text = field->getText(QPoint(-1,-1),true);
							QApplication::clipboard()->setText( text=="text/plain"?"":text );
							toLog( "##### >Text:" + text  );
							break;
						}
						case ACTION_PAST:
						{
							field->insertString( field->getCursorPos(), QApplication::clipboard()->text());
							break;
						}
					}
					break;
				}	
				case TYPE_MULTI_LINE_EDIT:
				{							
					switch (selected)
					{
						case ACTION_COPY:
						{
							((ZMultiLineEdit*)editor)->copy();
							break;
						}
						case ACTION_PAST:
						{
							((ZMultiLineEdit*)editor)->paste();
							break;
						}
						case ACTION_CUT:
						{							
							((ZMultiLineEdit*)editor)->cut();
							break;
						}
						case ACTION_SELECT_ALL:
						{
							((ZMultiLineEdit*)editor)->selectAll();
							break;
						}
						case ACTION_SELECT_START:
						{
							int iSelX = 0;
							int iSelY = 0;
							((ZMultiLineEdit*)editor)->getCursorPosition( &iSelX, &iSelY );
							
							onSelectText = true;
		    				SET_CURSOR
							break;
						}	
						case ACTION_SELECT_END:
						{
							if ( !onSelectText )
								break;

							int iSelX = 0;
							int iSelY = 0;
							((ZMultiLineEdit*)editor)->getCursorPosition( &iSelX, &iSelY );

		    				((ZMultiLineEdit*)editor)->setCursorPosition( GET_CURSOR_X, GET_CURSOR_Y, false );
							((ZMultiLineEdit*)editor)->setCursorPosition( iSelX, iSelY, true );
							
		    				onSelectText = false;			
							break;
						}															
					}
					break;
				}
				case TYPE_TEXT_EDIT:
				{				
					switch (selected)
					{
						case ACTION_COPY:
						{
							if ( ((ZTextEdit*)editor)->hasSelectedText() )
								QApplication::clipboard()->setText( ((ZTextEdit*)editor)->selectedText() );
							else
								QApplication::clipboard()->setText( ((ZTextEdit*)editor)->text() );
							break;
						}
						case ACTION_PAST:
						{
							if ( ((ZTextEdit*)editor)->hasSelectedText() )	
								((ZTextEdit*)editor)->del();

							int iSelX = 0;
							int iSelY = 0;
							
		    				((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY );
		    				((ZTextEdit*)editor)->insertAt(QApplication::clipboard()->text(), iSelX, iSelY);							
							break;
						}
						case ACTION_CUT:
						{
							if ( ((ZTextEdit*)editor)->hasSelectedText() )
								QApplication::clipboard()->setText( ((ZTextEdit*)editor)->selectedText() );
							else
								QApplication::clipboard()->setText( ((ZTextEdit*)editor)->text() );	
							if ( ((ZTextEdit*)editor)->hasSelectedText() )	
								((ZTextEdit*)editor)->del();
							else
								((ZTextEdit*)editor)->clear();						
							break;
						}
						case ACTION_SELECT_ALL:
						{
							((ZTextEdit*)editor)->selectAll(true);
							break;
						}
						case ACTION_SELECT_START:
						{
							int iSelX = 0;
							int iSelY = 0;
							
		    				((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY );
							onSelectText = true;
		    				SET_CURSOR
							break;
						}	
						case ACTION_SELECT_END:
						{
							if ( !onSelectText )
								break;

							int iSelX = 0;
							int iSelY = 0;

		    				((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY );					
							((ZTextEdit*)editor)->setSelection( GET_CURSOR_X, GET_CURSOR_Y, iSelX, iSelY );
							
		    				onSelectText = false;			
							break;
						}															
					}
					break;					
				} 
				case TYPE_LINE_EDIT:
				{				
					switch (selected)
					{
						case ACTION_COPY:
						{
							if ( ((ZLineEdit*)editor)->hasMarkedText() )
								QApplication::clipboard()->setText( ((ZLineEdit*)editor)->markedText() );
							else
							{
								QString text = ((ZLineEdit*)editor)->text();
								QApplication::clipboard()->setText( text=="text/plain"?"":text );
							}
							break;
						}
						case ACTION_PAST:
						{
		    				((ZLineEdit*)editor)->insert(QApplication::clipboard()->text());							
							break;
						}
						case ACTION_CUT:
						{
							if ( ((ZLineEdit*)editor)->hasMarkedText() )
								QApplication::clipboard()->setText( ((ZLineEdit*)editor)->markedText() );
							else
								QApplication::clipboard()->setText( ((ZLineEdit*)editor)->text() );	
							if ( ((ZLineEdit*)editor)->hasMarkedText() )	
								((ZLineEdit*)editor)->del();
							else
								((ZLineEdit*)editor)->clear();						
							break;
						}
						case ACTION_SELECT_ALL:
						{
							((ZLineEdit*)editor)->selectAll();
		    				int iSelX=-1;
		    				int iSelY=0;
		    				SET_CURSOR							
							break;
						}
						case ACTION_SELECT_START:
						{
		    				onSelectText = true;
		    				int iSelX=(((ZLineEdit*)editor)->cursorPosition());
		    				int iSelY=0;
		    				
		    				SET_CURSOR		
							break;
						}	
						case ACTION_SELECT_END:
						{
							if ( !onSelectText )
								break;		
							
							int iSelY = ((ZLineEdit*)editor)->cursorPosition()-GET_CURSOR_X;
							int iSelX=GET_CURSOR_X;
							if ( iSelY > 0 )
								((ZLineEdit*)editor)->setSelection( GET_CURSOR_X, iSelY );
		    				
		    				SET_CURSOR	
		    				
		    				onSelectText = false;				
							break;
						}														
					}
					break;					
				}
			}
		}
Example #3
0
void VirtualKeyboardQt::SwitchLayout(const QString &lang)
{
    if (!m_parentEdit)
    {
        LOG(VB_GENERAL, LOG_ERR, "No edit receiving output");
        reject();
        return;
    }

    QString language = lang.toLower();

    QString theme_file = QString("keyboard/%1_").arg(language);

    if (!loadThemedWindow("keyboard", theme_file))
    {
        LOG(VB_GENERAL, LOG_WARNING,
                 QString("Cannot find layout for '%1'").arg(language));

        // cannot find layout so fallback to US English layout
        if (!loadThemedWindow("keyboard", "keyboard/en_us_"))
        {
            LOG(VB_GENERAL, LOG_ERR, "Cannot find layout for US English");

            reject();
            return;
        }
    }

    // get dialog size from keyboard_container area
    LayerSet *container = getContainer("keyboard_container");

    if (!container)
    {
        LOG(VB_GENERAL, LOG_ERR,
                 "Cannot find the 'keyboard_container' in your theme");

        reject();
        return;
    }

    m_popupWidth = container->GetAreaRect().width();
    m_popupHeight = container->GetAreaRect().height();
    setFixedSize(QSize(m_popupWidth, m_popupHeight));

    QWidget *pw = m_parentEdit;
    QWidget *tlw = pw->topLevelWidget();
    QRect pwg = pw->geometry();
    QRect tlwg = tlw->frameGeometry();

    QPoint newpos;

    PopupPositionQt preferredPos;
    if (m_parentEdit->inherits("MythLineEdit"))
    {
        MythLineEdit *par = (MythLineEdit *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else if (m_parentEdit->inherits("MythRemoteLineEdit"))
    {
        MythRemoteLineEdit *par = (MythRemoteLineEdit *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else if (m_parentEdit->inherits("MythComboBox"))
    {
        MythComboBox *par = (MythComboBox *)m_parentEdit;
        preferredPos = par->getPopupPosition();
    }
    else
    {
        preferredPos = VKQT_POSCENTERDIALOG;
    }

    if (preferredPos == VKQT_POSBELOWEDIT)
    {
        if (pw->mapTo(tlw, QPoint(0,pwg.height() + m_popupHeight + 5)).y()
                < tlwg.height())
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5);
        }
        else
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight);
        }
    }
    else if (preferredPos == VKQT_POSABOVEEDIT)
    {
        if (pw->mapTo(tlw, QPoint(0, - m_popupHeight - 5)).y()
            > 0)
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight);
        }
        else
        {
            newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5);
        }
    }
    else if (preferredPos == VKQT_POSTOPDIALOG)
    {
        newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2, 5);
        this->move(newpos);
    }
    else if (preferredPos == VKQT_POSBOTTOMDIALOG)
    {
        newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2,
                        tlwg.height() - 5 - m_popupHeight);
        this->move(newpos);
    }
    else if (preferredPos == VKQT_POSCENTERDIALOG)
    {
        newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2,
                        tlwg.height() / 2 - m_popupHeight / 2);
        this->move(newpos);
    }

    if (preferredPos == VKQT_POSABOVEEDIT || preferredPos == VKQT_POSBELOWEDIT)
    {
        int delx = pw->mapTo(tlw,newpos).x() + m_popupWidth - tlwg.width() + 5;
        newpos = QPoint(newpos.x() - (delx > 0 ? delx : 0), newpos.y());
        delx = pw->mapTo(tlw, newpos).x();
        newpos = QPoint(newpos.x() - (delx < 0 ? delx : 0), newpos.y());

        int xbase, width, ybase, height;
        float wmult, hmult;
        GetMythUI()->GetScreenSettings(xbase, width, wmult, ybase, height, hmult);
        newpos.setX(newpos.x() - xbase);
        newpos.setY(newpos.y() - ybase);

        this->move( pw->mapToGlobal( newpos ) );
    }

    // find the UIKeyboardType
    m_keyboard = getUIKeyboardType("keyboard");
    if (!m_keyboard)
    {
        LOG(VB_GENERAL, LOG_ERR,
                 "Cannot find the UIKeyboardType in your theme");

        reject();
        return;
    }

    if (m_parentEdit->inherits("QComboBox"))
    {
        QComboBox *combo = (QComboBox *) m_parentEdit;
        m_keyboard->SetEdit(combo->lineEdit());
    }
    else
        m_keyboard->SetEdit(m_parentEdit);

    m_keyboard->SetParentDialog(this);
}
Example #4
0
bool QISplitter::eventFilter(QObject *pWatched, QEvent *pEvent)
{
    if (pWatched == handle(1))
    {
        switch (pEvent->type())
        {
            case QEvent::MouseButtonDblClick:
                restoreState(m_baseState);
                break;
            default:
                break;
        }
    }
#ifdef Q_WS_MAC
    /* Special handling on the Mac. Cause there the horizontal handle is only 1
     * pixel wide, its hard to catch. Therefor we make some invisible area
     * around the handle and forwarding the mouse events to the handle, if the
     * user presses the left mouse button. */
    else if (   m_type == Native
             && orientation() == Qt::Horizontal
             && count() > 1
             && qApp->activeWindow() == window())
    {
        switch (pEvent->type())
        {
            case QEvent::MouseButtonPress:
            case QEvent::MouseMove:
            {
                const int margin = 3;
                QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent);
                for (int i=1; i < count(); ++i)
                {
                    QWidget *pHandle = handle(i);
                    if (   pHandle
                        && pHandle != pWatched)
                    {
                        /* Create new mouse event with translated mouse positions. */
                        QMouseEvent newME(pMouseEvent->type(),
                                          pHandle->mapFromGlobal(pMouseEvent->globalPos()),
                                          pMouseEvent->button(),
                                          pMouseEvent->buttons(),
                                          pMouseEvent->modifiers());
                        /* Check if we hit the handle */
                        bool fMarginHit = QRect(pHandle->mapToGlobal(QPoint(0, 0)), pHandle->size()).adjusted(-margin, 0, margin, 0).contains(pMouseEvent->globalPos());
                        if (pEvent->type() == QEvent::MouseButtonPress)
                        {
                            /* If we have a handle position hit and the left
                             * button is pressed, start the grabbing. */
                            if (   fMarginHit
                                && pMouseEvent->buttons().testFlag(Qt::LeftButton))
                            {
                                m_fHandleGrabbed = true;
                                setCursor(Qt::SplitHCursor);
                                qApp->postEvent(pHandle, new QMouseEvent(newME));
                                return true;
                            }
                        }
                        else if(pEvent->type() == QEvent::MouseMove)
                        {
                            /* If we are in the near of the handle or currently
                             * dragging, forward the mouse event. */
                            if (   fMarginHit
                                || (   m_fHandleGrabbed
                                    && pMouseEvent->buttons().testFlag(Qt::LeftButton)))
                            {
                                setCursor(Qt::SplitHCursor);
                                qApp->postEvent(pHandle, new QMouseEvent(newME));
                                return true;
                            }
                            else
                            {
                                /* If not, reset the state. */
                                m_fHandleGrabbed = false;
                                setCursor(Qt::ArrowCursor);
                            }
                        }
                    }
                }
                break;
            }
            case QEvent::WindowDeactivate:
            case QEvent::MouseButtonRelease:
            {
                m_fHandleGrabbed = false;
                setCursor(Qt::ArrowCursor);
                break;
            }
            default:
                break;
        }
    }
#endif /* Q_WS_MAC */

    return QSplitter::eventFilter(pWatched, pEvent);
}
Example #5
0
void FullScreenContent::showOptionsMenu()
{
    Q_ASSERT(!mConfigWidget);

    mConfigWidget = new FullScreenConfigWidget;
    FullScreenConfigWidget* widget = mConfigWidget;

    // Put widget in a menu
    QMenu menu;
    QWidgetAction* action = new QWidgetAction(&menu);
    action->setDefaultWidget(widget);
    menu.addAction(action);

    // Slideshow checkboxes
    widget->mSlideShowLoopCheckBox->setChecked(mSlideShow->loopAction()->isChecked());
    connect(widget->mSlideShowLoopCheckBox, SIGNAL(toggled(bool)),
            mSlideShow->loopAction(), SLOT(trigger()));

    widget->mSlideShowRandomCheckBox->setChecked(mSlideShow->randomAction()->isChecked());
    connect(widget->mSlideShowRandomCheckBox, SIGNAL(toggled(bool)),
            mSlideShow->randomAction(), SLOT(trigger()));

    // Interval slider
    widget->mSlideShowIntervalSlider->setValue(int(GwenviewConfig::interval()));
    connect(widget->mSlideShowIntervalSlider, SIGNAL(valueChanged(int)),
            mSlideShow, SLOT(setInterval(int)));
    connect(widget->mSlideShowIntervalSlider, SIGNAL(valueChanged(int)),
            SLOT(updateSlideShowIntervalLabel()));

    // Interval label
    QString text = formatSlideShowIntervalText(88);
    int width = widget->mSlideShowIntervalLabel->fontMetrics().width(text);
    widget->mSlideShowIntervalLabel->setFixedWidth(width);
    updateSlideShowIntervalLabel();

    // Image information
    connect(widget->mConfigureDisplayedInformationButton, SIGNAL(clicked()),
            SLOT(showImageMetaInfoDialog()));

    // Thumbnails
    widget->mThumbnailGroupBox->setVisible(mViewPageVisible);
    if (mViewPageVisible) {
        widget->mShowThumbnailsCheckBox->setChecked(GwenviewConfig::showFullScreenThumbnails());
        widget->mHeightSlider->setMinimum(mRightToolBar->sizeHint().height());
        widget->mHeightSlider->setValue(mThumbnailBar->height());
        connect(widget->mShowThumbnailsCheckBox, SIGNAL(toggled(bool)),
                SLOT(slotShowThumbnailsToggled(bool)));
        connect(widget->mHeightSlider, SIGNAL(valueChanged(int)),
                SLOT(setFullScreenBarHeight(int)));
    }

    // Show menu below its button
    QPoint pos;
    QWidget* button = mOptionsAction->associatedWidgets().first();
    Q_ASSERT(button);
    qWarning() << button << button->geometry();
    if (QApplication::isRightToLeft()) {
        pos = button->mapToGlobal(button->rect().bottomLeft());
    } else {
        pos = button->mapToGlobal(button->rect().bottomRight());
        pos.rx() -= menu.sizeHint().width();
    }
    qWarning() << pos;
    menu.exec(pos);
}