Revision: 6160
Author: nogu.dev
Date: Thu Feb 25 14:55:18 2010
Log: * qt4/toolbar/common-uimstateindicator.cpp
* qt4/toolbar/standalone-qt4.cpp
* qt4/toolbar/standalone-qt4.h
- Qt4 toolbar should shrink when left edge is double-clicked
http://code.google.com/p/uim/source/detail?r=6160
Modified:
/trunk/qt4/toolbar/common-uimstateindicator.cpp
/trunk/qt4/toolbar/standalone-qt4.cpp
/trunk/qt4/toolbar/standalone-qt4.h
=======================================
--- /trunk/qt4/toolbar/common-uimstateindicator.cpp Mon Dec 21 17:42:58 2009
+++ /trunk/qt4/toolbar/common-uimstateindicator.cpp Thu Feb 25 14:55:18 2010
@@ -129,7 +129,9 @@
return;
QHelperPopupMenu *popupMenu = 0;
+#ifdef PLASMA_APPLET_UIM
int prevCount = m_layout->count();
+#endif
foreach ( QHelperToolbarButton *button, buttons )
{
if ( m_layout->indexOf( button ) >= 0 )
@@ -206,10 +208,10 @@
}
}
+#ifdef PLASMA_APPLET_UIM
if ( m_layout->count() != prevCount )
+#endif
emit indicatorResized();
-
- parentWidget()->show();
}
void UimStateIndicator::helper_disconnect_cb()
=======================================
--- /trunk/qt4/toolbar/standalone-qt4.cpp Mon Sep 28 00:13:54 2009
+++ /trunk/qt4/toolbar/standalone-qt4.cpp Thu Feb 25 14:55:18 2010
@@ -62,11 +62,11 @@
setLayout( layout );
adjustSize();
- UimToolbarDraggingHandler *h = new UimToolbarDraggingHandler( this );
- layout->addWidget( h );
- h->adjustSize();
- h->show();
- connect( h, SIGNAL( handleDoubleClicked() ),
+ handler = new UimToolbarDraggingHandler( this );
+ layout->addWidget( handler );
+ handler->adjustSize();
+ handler->show();
+ connect( handler, SIGNAL( handleDoubleClicked() ),
this, SLOT( slotToolbarDoubleClicked() ) );
@@ -81,11 +81,12 @@
int panelHeight = 64; // FIXME!
int screenwidth = QApplication::desktop()->screenGeometry().width();
int screenheight = QApplication::desktop()->screenGeometry().height();
- QPoint p( screenwidth - panelHeight - toolbar->width() - h->width(),
screenheight - height() - panelHeight );
+ QPoint p( screenwidth - panelHeight - toolbar->width() -
handler->width(),
+ screenheight - height() - panelHeight );
move( p );
// Enable Dragging Feature
- connect( h, SIGNAL( moveTo( const QPoint & ) ),
+ connect( handler, SIGNAL( moveTo( const QPoint & ) ),
this, SLOT( moveTo( const QPoint & ) ) );
// Quit
@@ -102,16 +103,22 @@
void
UimStandaloneToolbar::slotToolbarResized()
{
+ toolbar->show();
adjustSize();
}
void
UimStandaloneToolbar::slotToolbarDoubleClicked()
{
- if (toolbar->isVisible())
- toolbar->hide();
- else
- toolbar->show();
+ if (toolbar->isVisible()) {
+ toolbar->hide();
+ // shrink this toolbar
+ int width = maximumWidth();
+ setFixedWidth(handler->width());
+ setMaximumWidth(width);
+ } else {
+ toolbar->show();
+ }
adjustSize();
}
=======================================
--- /trunk/qt4/toolbar/standalone-qt4.h Fri Sep 25 08:52:02 2009
+++ /trunk/qt4/toolbar/standalone-qt4.h Thu Feb 25 14:55:18 2010
@@ -37,6 +37,7 @@
#include <QtGui/QMouseEvent>
class QUimHelperToolbar;
+class UimToolbarDraggingHandler;
class QPoint;
class QMouseEvent;
@@ -57,6 +58,7 @@
void moveTo(const QPoint &point);
private:
+ UimToolbarDraggingHandler *handler;
QUimHelperToolbar *toolbar;
};