summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-10-22 14:12:43 (UTC)
committer zautrix <zautrix>2005-10-22 14:12:43 (UTC)
commita72d70beb381b9cd6f2af301b52ca82cdcafb299 (patch) (side-by-side diff)
treef5b068e80395821abb5717fb07757a17d805f770 /microkde
parenta72f3f3acfac791715a1c512fc4cc4c3facdbb62 (diff)
downloadkdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.zip
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.gz
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.bz2
fix
Diffstat (limited to 'microkde') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kapplication.cpp4
-rw-r--r--microkde/kdeui/ktoolbar.cpp12
-rw-r--r--microkde/kdeui/ktoolbar.h2
3 files changed, 16 insertions, 2 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index f36c5ae..d7c12bb 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -1,188 +1,190 @@
#include <stdlib.h>
#include <stdio.h>
#include "kapplication.h"
#include "ktextedit.h"
#include <qapplication.h>
#include <qstring.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qtextbrowser.h>
#include <qregexp.h>
int KApplication::random()
{
return rand();
}
//US
QString KApplication::randomString(int length)
{
if (length <=0 ) return QString::null;
QString str;
while (length--)
{
int r=random() % 62;
r+=48;
if (r>57) r+=7;
if (r>90) r+=6;
str += char(r);
// so what if I work backwards?
}
return str;
}
int KApplication::execDialog( QDialog* d )
{
if (QApplication::desktop()->width() <= 640 )
d->showMaximized();
else
;//d->resize( 800, 600 );
return d->exec();
}
void KApplication::showLicence()
{
KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
}
void KApplication::testCoords( int* x, int* y, int* wid, int * hei )
{
int dWid = QApplication::desktop()->width() ;
int dHei = QApplication::desktop()->height();
+ if ( *x < 0 ) *x = 0;
+ if ( *y < 20 ) *y = 20 ;
if ( *x + *wid > dWid ) {
*x = 0;
if ( *wid > dWid )
*wid = dWid;
}
if ( *y + *hei > dHei ) {
- *y = 0;
+ *y = 20;
if ( *hei > dHei )
*hei = dHei;
}
}
void KApplication::showFile(QString caption, QString fn)
{
QString text;
QString fileName;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
fileName += "/pics/" + fn ;
#else
fileName = qApp->applicationDirPath () + "/" + fn;
#endif
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return ;
}
QTextStream ts( &file );
text = ts.read();
file.close();
KApplication::showText( caption, text );
}
bool KApplication::convert2latin1(QString fileName)
{
QString text;
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setEncoding( QTextStream::UnicodeUTF8 );
text = ts.read();
file.close();
if (!file.open( IO_WriteOnly ) ) {
return false;
}
QTextStream tsIn( &file );
tsIn.setEncoding( QTextStream::Latin1 );
tsIn << text.latin1();
file.close();
return true;
}
void KApplication::showText(QString caption, QString text)
{
QDialog dia( 0, "name", true ); ;
dia.setCaption( caption );
QVBoxLayout* lay = new QVBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
KTextEdit tb ( &dia );
tb.setWordWrap( QMultiLineEdit::WidgetWidth );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdir.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include "kglobal.h"
#include "klocale.h"
class KBackupPrefs : public QDialog
{
public:
KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Backup Failed!") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( message, this );
lay->addWidget( lab );
QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
vcal = new QRadioButton(i18n("Try again now"), format );
tcal = new QRadioButton(i18n("Try again later"), format );
ical = new QRadioButton(i18n("Try again tomorrow"), format );
ocal = new QRadioButton(i18n("Disable backup"), format );
vcal->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget(ok );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
}
bool again() { return vcal->isChecked(); }
bool later() { return tcal->isChecked(); }
bool againTomorrow() { return ical->isChecked(); }
private:
QRadioButton* vcal, *ical, *ocal, *tcal;
};
int KApplication::createBackup( QString fn, QString dp, int numBup )
{
if ( numBup < 1) return 3;
int ret = 3;
//qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup);
QDir bupDir ( dp );
bool tryAgain = true;
while ( tryAgain ) {
if ( !bupDir.exists() ) {
QString bd = dp.right(25);
if ( dp.length() > 25 )
bd = "..." + bd;
KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + bd);
if ( !noDir.exec() ) return 3;
if ( noDir.againTomorrow() ) {
return 0;
} else if ( noDir.later() ) {
return 3;
} else if ( !noDir.again() ) {
return 2;
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index df2aad8..027e5e9 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -130,256 +130,258 @@ public:
QWidget *m_parent;
QMainWindow::ToolBarDock oldPos;
KXMLGUIClient *m_xmlguiClient;
struct ToolBarInfo
{
//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {}
//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
int index, offset;
bool newline;
//US Qt::Dock dock;
QMainWindow::ToolBarDock dock;
};
ToolBarInfo toolBarInfo;
QValueList<int> iconSizes;
QTimer repaintTimer;
// Default Values.
bool HiddenDefault;
int IconSizeDefault;
QString IconTextDefault;
int IndexDefault;
bool NewLineDefault;
int OffsetDefault;
QString PositionDefault;
QPtrList<QWidget> idleButtons;
};
KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent,
const char* name )
:QFrame( parent, name ), line( l )
{
connect( parent, SIGNAL(orientationChanged(Orientation)),
this, SLOT(setOrientation(Orientation)) );
setOrientation( o );
setBackgroundMode( parent->backgroundMode() );
setBackgroundOrigin( ParentOrigin );
}
void KToolBarSeparator::setOrientation( Orientation o )
{
orient = o;
if ( line ) {
if ( orientation() == Vertical )
setFrameStyle( HLine + Sunken );
else
setFrameStyle( VLine + Sunken );
} else {
setFrameStyle( NoFrame );
}
}
void KToolBarSeparator::styleChange( QStyle& )
{
setOrientation( orient );
}
QSize KToolBarSeparator::sizeHint() const
{
return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
}
QSizePolicy KToolBarSeparator::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
}
KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
: QToolBar( QString::fromLatin1( name ),
parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
parent, FALSE,
name ? name : "mainToolBar")
#else
: QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
: QToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
: QToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
KToolBar::~KToolBar()
{
inshutdownprocess = true;
emit toolbarDestroyed();
delete d;
}
void KToolBar::init( bool readConfig, bool honorStyle )
{
+ sizeHintW = 240;
+ sizeHintH = 22;
inshutdownprocess = false;
d = new KToolBarPrivate;
setFullSize( TRUE );
d->m_honorStyle = honorStyle;
context = 0;
layoutTimer = new QTimer( this );
connect( layoutTimer, SIGNAL( timeout() ),
this, SLOT( rebuildLayout() ) );
connect( &(d->repaintTimer), SIGNAL( timeout() ),
this, SLOT( slotRepaint() ) );
/*US
if ( kapp ) { // may be null when started inside designer
connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged()));
// request notification of changes in icon style
kapp->addKipcEventMask(KIPC::IconChanged);
connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int)));
}
*/
// finally, read in our configurable settings
if ( readConfig )
slotReadConfig();
if ( mainWindow() )
connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ),
this, SLOT( toolBarPosChanged( QToolBar * ) ) );
// Hack to make sure we recalculate our size when we dock.
//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
}
int KToolBar::insertButton(const QString& icon, int id, bool enabled,
const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QString& icon, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
connect( button, signal, receiver, slot );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled,
const QString& text, int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
doConnections( button );
return index;
}
#if 0
bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index/*US, instance*/ );
#endif
int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text,
int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
connect( button, signal, receiver, slot );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
int KToolBar::insertLined (const QString& text, int id,
const char *signal,
const QObject *receiver, const char *slot,
bool enabled ,
const QString& toolTipText,
int size, int index )
{
KLineEdit *lined = new KLineEdit ( this, 0 );
if ( !toolTipText.isEmpty() )
QToolTip::add( lined, toolTipText );
if ( size > 0 )
lined->setMinimumWidth( size );
insertWidgetInternal( lined, index, id );
connect( lined, signal, receiver, slot );
lined->setText(text);
lined->setEnabled( enabled );
return index;
}
int KToolBar::insertCombo (const QStringList &list, int id, bool writable,
@@ -1315,257 +1317,265 @@ void KToolBar::rebuildLayout()
QBoxLayout *l = boxLayout();
l->setMargin( 1 );
// clear the old layout
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
if ( w == rightAligned ) {
continue;
}
if ( w->inherits( "KToolBarSeparator" ) &&
!( (KToolBarSeparator*)w )->showLine() ) {
l->addSpacing( 6 );
w->hide();
continue;
}
if ( w->inherits( "QPopupMenu" ) )
continue;
l->addWidget( w );
w->show();
}
if ( rightAligned ) {
l->addStretch();
l->addWidget( rightAligned );
rightAligned->show();
}
if ( fullSize() ) {
// This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword).
//if ( !stretchableWidget && widgets.last() &&
// !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) )
// setStretchableWidget( widgets.last() );
if ( !rightAligned )
l->addStretch();
if ( stretchableWidget )
l->setStretchFactor( stretchableWidget, 10 );
}
l->invalidate();
QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
//#endif //DESKTOP_VERSION
}
void KToolBar::childEvent( QChildEvent *e )
{
if ( e->child()->isWidgetType() ) {
QWidget * w = (QWidget*)e->child();
if ( e->type() == QEvent::ChildInserted ) {
if ( !e->child()->inherits( "QPopupMenu" ) &&
::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
// prevent items that have been explicitly inserted by insert*() from
// being inserted again
if ( !widget2id.contains( w ) )
{
int dummy = -1;
insertWidgetInternal( w, dummy, -1 );
}
}
} else {
removeWidgetInternal( w );
}
if ( isVisibleTo( 0 ) )
{
QBoxLayout *l = boxLayout();
// QLayout *l = layout();
// clear the old layout so that we don't get unnecassery layout
// changes till we have rebuild the thing
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
layoutTimer->start( 50, TRUE );
}
}
QToolBar::childEvent( e );
}
void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
{
// we can't have it in widgets, or something is really wrong
//widgets.removeRef( w );
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
if ( index == -1 || index > (int)widgets.count() ) {
widgets.append( w );
index = (int)widgets.count();
}
else
widgets.insert( index, w );
if ( id == -1 )
id = id2widget.count();
id2widget.insert( id, w );
widget2id.insert( w, id );
}
void KToolBar::repaintMe()
{
setUpdatesEnabled( true );
QToolBar::repaint( true );
qDebug(" KToolBar::repaintMe() ");
}
void KToolBar::showEvent( QShowEvent *e )
{
rebuildLayout();
QToolBar::showEvent( e );
}
void KToolBar::setStretchableWidget( QWidget *w )
{
QToolBar::setStretchableWidget( w );
stretchableWidget = w;
}
QSizePolicy KToolBar::sizePolicy() const
{
if ( orientation() == Horizontal )
return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
else
return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
}
QSize KToolBar::sizeHint() const
{
- return QToolBar::sizeHint();
+ QSize sh = QToolBar::sizeHint();
+ //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() );
+ if ( sh.height() <= 20 || sh.width() < 60 )
+ return QSize( sizeHintW, sizeHintH );
+ KToolBar* ttt = (KToolBar*) this;
+ ttt->sizeHintW = sh.width();
+ ttt->sizeHintH = sh.height();
+ return sh;
+ //return QToolBar::sizeHint();
#if 0
QWidget::polish();
static int iii = 0;
++iii;
qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
switch( barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
for ( QWidget *w = widgets.first(); w; w =widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(6, 0);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(0, sh.height()));
minSize += QSize(sh.width()+1, 0);
}
}
/*US
minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0);
*/
minSize += QSize(margin*2, margin*2);
break;
case KToolBar::Left:
case KToolBar::Right:
for ( QWidget *w = widgets.first(); w; w = widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(0, 6);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(sh.width(), 0));
minSize += QSize(0, sh.height()+1);
}
}
/*US
minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
*/
minSize += QSize(margin*2, margin*2);
break;
default:
minSize = QToolBar::sizeHint();
break;
}
return minSize;
#endif
}
QSize KToolBar::minimumSize() const
{
return minimumSizeHint();
}
QSize KToolBar::minimumSizeHint() const
{
return sizeHint();
}
bool KToolBar::highlight() const
{
return d->m_highlight;
}
void KToolBar::hide()
{
QToolBar::hide();
}
void KToolBar::show()
{
QToolBar::show();
}
void KToolBar::resizeEvent( QResizeEvent *e )
{
bool b = isUpdatesEnabled();
setUpdatesEnabled( FALSE );
QToolBar::resizeEvent( e );
if (b)
d->repaintTimer.start( 100, true );
}
void KToolBar::slotIconChanged(int group)
{
if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
return;
if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
return;
emit modechange();
if (isVisible())
updateGeometry();
}
void KToolBar::slotReadConfig()
{
//kdDebug(220) << "KToolBar::slotReadConfig" << endl;
// Read appearance settings (hmm, we used to do both here,
// but a well behaved application will call applyMainWindowSettings
// anyway, right ?)
applyAppearanceSettings(KGlobal::config(), QString::null );
}
void KToolBar::slotAppearanceChanged()
{
// Read appearance settings from global file.
applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ );
// And remember to save the new look later
/*US
if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 7a5c114..3319fa8 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -957,152 +957,154 @@ signals:
/**
* Emitted when button @p id is double-clicked.
*
* Note: you will always
* recive two @ref clicked() , @ref pressed() and @ref released() signals.
* There is no way to avoid it - at least no easy way.
* If you need to resolve this all you can do is set up timers
* which wait for @ref QApplication::doubleClickInterval() to expire.
* If in that time you don't get this signal, you may belive that
* button was only clicked and not double-clicked.
* And please note that butons with popup menus do not emit this signal,
* but those with delayed popup do.
*/
void doubleClicked (int id);
/**
* Emitted when button @p id is pressed.
*/
void pressed(int);
/**
* Emits when button @p id is released.
*/
void released(int);
/**
* Emitted when a toggle button changes state.
*
* Emitted also if you change state
* with @ref setButton() or @ref toggleButton()
* If you make a button normal again, with
* setToggle(false), this signal won't
* be emitted.
*/
void toggled(int);
/**
* This signal is emitted when item id gets highlighted/unhighlighted
* (i.e when mouse enters/exits).
*
* Note that this signal is emitted from
* all buttons (normal, disabled and toggle) even when there is no visible
* change in buttons (i.e., buttons do not raise when mouse enters).
* The parameter @p isHighlighted is @p true when mouse enters and @p false when
* mouse exits.
*/
void highlighted(int id, bool isHighlighted);
/**
* This signal is emitted when item id gets highlighted/unhighlighted
* (i.e when mouse enters/exits).
*
* Note that this signal is emitted from
* all buttons (normal, disabled and toggle) even when there is no visible
* change in buttons (i.e., buttons do not raise when mouse enters).
*/
void highlighted(int id );
/**
* Emitted when toolbar changes position, or when
* an item is removed from toolbar.
*
* If you subclass @ref KMainWindow and reimplement
* @ref KMainWindow::resizeEvent() be sure to connect to
* this signal. Note: You can connect this signal to a slot that
* doesn't take parameter.
*/
void moved( BarPosition );
/**
* @internal
* This signal is emitted when toolbar detects changing of
* following parameters:
* highlighting, button-size, button-mode. This signal is
* internal, aimed to buttons.
*/
void modechange ();
/**
* This signal is emitted when the toolbar is getting deleted,
* and before ~KToolbar finishes (so it's still time to remove
* widgets from the toolbar).
* Used by KWidgetAction.
* @since 3.2
*/
void toolbarDestroyed();
public:
/**
* @return global setting for "Highlight buttons under mouse"
*/
void repaintMe();
static bool highlightSetting();
/**
* @return global setting for "Toolbars transparent when moving"
*/
static bool transparentSetting();
/**
* @return global setting for "Icon Text"
*/
static IconText iconTextSetting();
public slots:
virtual void setIconText( const QString &txt )
{ QToolBar::setIconText( txt ); }
void slotRepaint();
protected:
void mousePressEvent( QMouseEvent * );
void childEvent( QChildEvent *e );
void showEvent( QShowEvent *e );
void resizeEvent( QResizeEvent *e );
bool event( QEvent *e );
void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
QString settingsGroup();
private slots:
void rebuildLayout();
void slotReadConfig ();
void slotAppearanceChanged();
void slotIconChanged(int);
void toolBarPosChanged( QToolBar *tb );
void slotContextAboutToShow();
void widgetDestroyed();
private:
+ int sizeHintW;
+ int sizeHintH;
void init( bool readConfig = true, bool honorStyle = false );
void doConnections( KToolBarButton *button );
void insertWidgetInternal( QWidget *w, int &index, int id );
void removeWidgetInternal( QWidget *w );
void getAttributes( QString &position, QString &icontext, int &index );
//US KPopupMenu *contextMenu();
QPopupMenu *contextMenu();
QMap<QWidget*, int > widget2id;
typedef QMap<int, QWidget* > Id2WidgetMap;
Id2WidgetMap id2widget;
//US KPopupMenu *context;
QPopupMenu *context;
QPtrList<QWidget> widgets;
QTimer *layoutTimer;
QGuardedPtr<QWidget> stretchableWidget, rightAligned;
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarPrivate *d;
bool inshutdownprocess;
};
#endif