author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
35 files changed, 940 insertions, 806 deletions
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp index d38a6d5..c2df381 100644 --- a/microkde/kdeui/kaction.cpp +++ b/microkde/kdeui/kaction.cpp @@ -19,41 +19,44 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kaction.h" #include <assert.h> #include <qtooltip.h> +//Added by qt3to4: +#include <Q3CString> +#include <Q3ValueList> //US#include <qwhatsthis.h> //US#include <kaccel.h> //US#include <kaccelbase.h> #include <kapplication.h> #include <kdebug.h> #include <kguiitem.h> //US#include <kmainwindow.h> //US#include <kmenubar.h> //US#include <kpopupmenu.h> #include <ktoolbar.h> #include <ktoolbarbutton.h> //US added this includefiles #include <qmenubar.h> -#include <qtoolbar.h> -#include <qpopupmenu.h> -#include <qiconset.h> +#include <q3toolbar.h> +#include <q3popupmenu.h> +#include <qicon.h> /** * How it works. * KActionCollection is an organizing container for KActions. * KActionCollection keeps track of the information necessary to handle * configuration and shortcuts. * * Focus Widget pointer: * This is the widget which is the focus for action shortcuts. * It is set either by passing a QWidget* to the KActionCollection constructor * or by calling setWidget() if the widget wasn't known when the object was * initially constructed (as in KXMLGUIClient and KParts::PartBase) @@ -78,68 +81,68 @@ int KAction::getToolButtonID() //--------------------------------------------------------------------- class KAction::KActionPrivate : public KGuiItem { public: KActionPrivate() : KGuiItem() { m_kaccel = 0; m_configurable = true; } KAccel *m_kaccel; - QValueList<KAccel*> m_kaccelList; + Q3ValueList<KAccel*> m_kaccelList; QString m_groupText; QString m_group; KShortcut m_cut; KShortcut m_cutDefault; bool m_configurable; struct Container { Container() { m_container = 0; m_representative = 0; m_id = 0; } Container( const Container& s ) { m_container = s.m_container; m_id = s.m_id; m_representative = s.m_representative; } QWidget* m_container; int m_id; QWidget* m_representative; }; - QValueList<Container> m_containers; + Q3ValueList<Container> m_containers; }; //--------------------------------------------------------------------- // KAction //--------------------------------------------------------------------- KAction::KAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, receiver, slot ); } KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, receiver, slot ); d->setIconName( sIconName ); } -KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, +KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, receiver, slot ); d->setIconSet( pix ); } KAction::KAction( const KGuiItem& item, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ) : QObject( parent, name ) { @@ -155,43 +158,43 @@ KAction::KAction( const QString& text, const KShortcut& cut, QObject* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, 0, 0 ); } KAction::KAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, receiver, slot ); } -KAction::KAction( const QString& text, const QIconSet& pix, +KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, 0, 0 ); setIconSet( pix ); } KAction::KAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, 0, 0 ); d->setIconName( pix ); } -KAction::KAction( const QString& text, const QIconSet& pix, +KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : QObject( parent, name ) { initPrivate( text, cut, receiver, slot ); setIconSet( pix ); } KAction::KAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, @@ -497,37 +500,37 @@ void KAction::removeKAccel( KAccel* kaccel ) // KDE 4: remove void KAction::setAccel( int keyQt ) { setShortcut( KShortcut(keyQt) ); } // KDE 4: remove end void KAction::updateShortcut( int i ) { int id = itemId( i ); QWidget* w = container( i ); - if ( w->inherits( "QPopupMenu" ) ) { - QPopupMenu* menu = static_cast<QPopupMenu*>(w); + if ( w->inherits( "Q3PopupMenu" ) ) { + Q3PopupMenu* menu = static_cast<Q3PopupMenu*>(w); updateShortcut( menu, id ); } else if ( w->inherits( "QMenuBar" ) ) //US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); } -void KAction::updateShortcut( QPopupMenu* menu, int id ) +void KAction::updateShortcut( Q3PopupMenu* menu, int id ) { /*US //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; // If the action has a KAccel object, // show the string representation of its shortcut. if ( d->m_kaccel || d->m_kaccelList.count() ) { QString s = menu->text( id ); int i = s.find( '\t' ); if ( i >= 0 ) s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() ); else s += "\t" + d->m_cut.seq(0).toString(); @@ -612,52 +615,52 @@ void KAction::setToolTip( const QString& tt ) int len = containerCount(); for( int i = 0; i < len; ++i ) updateToolTip( i ); } void KAction::updateToolTip( int i ) { //qDebug("KAction::updateToolTip ...1 has top be fixed"); QWidget *w = container( i ); if ( w->inherits( "KToolBar" ) ) QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); - else if ( w->inherits( "QToolBar" ) ) + else if ( w->inherits( "Q3ToolBar" ) ) QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); } QString KAction::toolTip() const { return d->toolTip(); } int KAction::plug( QWidget *w, int index ) { //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; if (w == 0) { kdWarning(129) << "KAction::plug called with 0 argument\n"; return -1; } // Check if action is permitted //US if (kapp && !kapp->authorizeKAction(name())) //US return -1; plugShortcut(); - if ( w->inherits("QPopupMenu") ) + if ( w->inherits("Q3PopupMenu") ) { - QPopupMenu* menu = static_cast<QPopupMenu*>( w ); + Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( w ); int id; // Don't insert shortcut into menu if it's already in a KAccel object. //qDebug("KAction::plug warning: real shortcuts not available yet. "); //US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); int keyQt = 0; if ( d->hasIcon() ) { /*US KInstance *instance; if ( m_parentCollection ) instance = m_parentCollection->instance(); @@ -712,25 +715,25 @@ int KAction::plug( QWidget *w, int index ) SLOT( slotActivated() ), d->isEnabled(), d->plainText(), index ); } else { QString icon = d->iconName(); if ( icon.isEmpty() ) icon = "unknown"; bar->insertButton( icon, id_, SIGNAL( clicked() ), this, SLOT( slotActivated() ), d->isEnabled(), d->plainText(), index/*US, instance*/ ); } - bar->getButton( id_ )->setName( QCString("toolbutton_")+name() ); + bar->getButton( id_ )->setName( Q3CString("toolbutton_")+name() ); //US if ( !d->whatsThis().isEmpty() ) //US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() ); if ( !d->toolTip().isEmpty() ) QToolTip::add( bar->getButton(id_), d->toolTip() ); addContainer( bar, id_ ); connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); if ( m_parentCollection ) m_parentCollection->connectHighlight( bar, this ); @@ -740,27 +743,27 @@ int KAction::plug( QWidget *w, int index ) } return -1; } void KAction::unplug( QWidget *w ) { int i = findContainer( w ); if ( i == -1 ) return; int id = itemId( i ); - if ( w->inherits( "QPopupMenu" ) ) + if ( w->inherits( "Q3PopupMenu" ) ) { - QPopupMenu *menu = static_cast<QPopupMenu *>( w ); + Q3PopupMenu *menu = static_cast<Q3PopupMenu *>( w ); menu->removeItem( id ); } else if ( w->inherits( "KToolBar" ) ) { KToolBar *bar = static_cast<KToolBar *>( w ); bar->removeItemDelayed( id ); } else if ( w->inherits( "QMenuBar" ) ) { QMenuBar *bar = static_cast<QMenuBar *>( w ); bar->removeItem( id ); } @@ -853,26 +856,26 @@ void KAction::setEnabled(bool enable) int len = containerCount(); for( int i = 0; i < len; ++i ) updateEnabled( i ); emit enabled( d->isEnabled() ); } void KAction::updateEnabled( int i ) { QWidget *w = container( i ); - if ( w->inherits("QPopupMenu") ) - static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); + if ( w->inherits("Q3PopupMenu") ) + static_cast<Q3PopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); else if ( w->inherits("QMenuBar") ) static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); else if ( w->inherits( "KToolBar" ) ) { static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); } } void KAction::setShortcutConfigurable( bool b ) { d->m_configurable = b; } @@ -897,28 +900,28 @@ void KAction::setText( const QString& text ) d->setText( text ); int len = containerCount(); for( int i = 0; i < len; ++i ) updateText( i ); } void KAction::updateText( int i ) { QWidget *w = container( i ); - if ( w->inherits( "QPopupMenu" ) ) { + if ( w->inherits( "Q3PopupMenu" ) ) { int id = itemId( i ); - static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); - updateShortcut( static_cast<QPopupMenu*>(w), id ); + static_cast<Q3PopupMenu*>(w)->changeItem( id, d->text() ); + updateShortcut( static_cast<Q3PopupMenu*>(w), id ); } else if ( w->inherits( "QMenuBar" ) ) static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); else if ( w->inherits( "KToolBar" ) ) { //qDebug("KAction::updateText ...3 has top be fixed"); QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); if ( button->inherits( "KToolBarButton" ) ) static_cast<KToolBarButton *>(button)->setText( d->plainText() ); } } @@ -938,100 +941,100 @@ void KAction::setIcon( const QString &icon ) d->setIconName( icon ); // now handle any toolbars int len = containerCount(); for ( int i = 0; i < len; ++i ) updateIcon( i ); } void KAction::updateIcon( int id ) { QWidget* w = container( id ); - if ( w->inherits( "QPopupMenu" ) ) { + if ( w->inherits( "Q3PopupMenu" ) ) { int itemId_ = itemId( id ); - static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); - updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); + static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); + updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ ); } else if ( w->inherits( "QMenuBar" ) ) static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() ); else if ( w->inherits( "KToolBar" ) ) static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); - else if ( w->inherits( "QToolBar" ) ) + else if ( w->inherits( "Q3ToolBar" ) ) { qDebug("KAction::updateIcon has top be fixed"); //US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); } } QString KAction::icon() const { return d->iconName( ); } -void KAction::setIconSet( const QIconSet &iconset ) +void KAction::setIconSet( const QIcon &iconset ) { d->setIconSet( iconset ); int len = containerCount(); for( int i = 0; i < len; ++i ) updateIconSet( i ); } void KAction::updateIconSet( int id ) { QWidget *w = container( id ); - if ( w->inherits( "QPopupMenu" ) ) + if ( w->inherits( "Q3PopupMenu" ) ) { int itemId_ = itemId( id ); - static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); - updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); + static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); + updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ ); } else if ( w->inherits( "QMenuBar" ) ) static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() ); else if ( w->inherits( "KToolBar" ) ) { if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better ) static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() ); else static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) ); } } -QIconSet KAction::iconSet( KIcon::Group group, int size ) const +QIcon KAction::iconSet( KIcon::Group group, int size ) const { return d->iconSet( group, size ); } bool KAction::hasIcon() const { return d->hasIcon(); } void KAction::setWhatsThis( const QString& text ) { d->setWhatsThis( text ); int len = containerCount(); for( int i = 0; i < len; ++i ) updateWhatsThis( i ); } void KAction::updateWhatsThis( int i ) { qDebug("KAction::updateWhatsThis ...1 has top be fixed"); - QPopupMenu* pm = popupMenu( i ); + Q3PopupMenu* pm = popupMenu( i ); if ( pm ) { pm->setWhatsThis( itemId( i ), d->whatsThis() ); return; } KToolBar *tb = toolBar( i ); if ( tb ) { QWidget *w = tb->getButton( itemId( i ) ); //US QWhatsThis::remove( w ); //US QWhatsThis::add( w, d->whatsThis() ); @@ -1055,28 +1058,28 @@ QString KAction::whatsThisWithIcon() const QWidget* KAction::container( int index ) const { assert( index < containerCount() ); return d->m_containers[ index ].m_container; } KToolBar* KAction::toolBar( int index ) const { //US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container ); return (KToolBar *)( d->m_containers[ index ].m_container ); } -QPopupMenu* KAction::popupMenu( int index ) const +Q3PopupMenu* KAction::popupMenu( int index ) const { //US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container ); - return (QPopupMenu *)( d->m_containers[ index ].m_container ); + return (Q3PopupMenu *)( d->m_containers[ index ].m_container ); } QWidget* KAction::representative( int index ) const { return d->m_containers[ index ].m_representative; } int KAction::itemId( int index ) const { return d->m_containers[ index ].m_id; } @@ -1146,40 +1149,40 @@ void KAction::slotDestroyed() do { i = findContainer( static_cast<const QWidget*>( o ) ); if ( i != -1 ) removeContainer( i ); } while ( i != -1 ); } int KAction::findContainer( const QWidget* widget ) const { int pos = 0; - QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); + Q3ValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); while( it != d->m_containers.end() ) { if ( (*it).m_representative == widget || (*it).m_container == widget ) return pos; ++it; ++pos; } return -1; } void KAction::removeContainer( int index ) { int i = 0; - QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); + Q3ValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); while( it != d->m_containers.end() ) { if ( i == index ) { d->m_containers.remove( it ); return; } ++it; ++i; } } diff --git a/microkde/kdeui/kaction.h b/microkde/kdeui/kaction.h index 13e2e1e..5c690ec 100644 --- a/microkde/kdeui/kaction.h +++ b/microkde/kdeui/kaction.h @@ -20,39 +20,41 @@ along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //$Id$ #ifndef __kaction_h__ #define __kaction_h__ //US #include <qkeysequence.h> #include <qobject.h> -#include <qvaluelist.h> -#include <qguardedptr.h> +#include <q3valuelist.h> +#include <qpointer.h> +//Added by qt3to4: +#include <Q3PopupMenu> #include <kguiitem.h> #include <kshortcut.h> #include <kstdaction.h> //US#include <kicontheme.h> //US added the following files #include <kiconloader.h> class QMenuBar; -class QPopupMenu; +class Q3PopupMenu; //USclass QComboBox; //USclass QPoint; -class QIconSet; +class QIcon; class QString; class KToolBar; class KAccel; //USclass KAccelActions; //USclass KConfig; //USclass KConfigBase; //USclass KURL; //USclass KInstance; //USclass KToolBar; class KActionCollection; //USclass KPopupMenu; @@ -250,25 +252,25 @@ public: * This is the other common KAction used. Use it when you * @p do have a corresponding icon. * * @param text The text that will be displayed. * @param pix The icon to display. * @param cut The corresponding keyboard shortcut. * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ); /** * Constructs an action with text, icon, potential keyboard * shortcut, and a SLOT to call when this action is invoked by * the user. The icon is loaded on demand later based on where it * is plugged in. * * If you do not want or have a keyboard shortcut, set the * @p cut param to 0. * @@ -299,35 +301,35 @@ public: /** * @obsolete */ KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @obsolete */ KAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @obsolete */ - KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @obsolete */ KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @obsolete */ - KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @obsolete */ KAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @obsolete */ KAction( QObject* parent = 0, const char* name = 0 ); @@ -452,28 +454,28 @@ public: */ virtual QString whatsThis() const; /** * Get the tooltip text for the action. */ virtual QString toolTip() const; /** * Get the QIconSet from which the icons used to display this action will * be chosen. */ - virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const; + virtual QIcon iconSet( KIcon::Group group, int size=0 ) const; #ifndef KDE_NO_COMPAT - QIconSet iconSet() const + QIcon iconSet() const { return iconSet( KIcon::Small ); } #endif virtual QString icon() const; KActionCollection *parentCollection() const; /** * @internal * Generate a toolbar button id. Made public for reimplementations. @@ -509,25 +511,25 @@ public slots: /** * Sets the tooltip text for the action. * This will be used as a tooltip for a toolbar button, as a * statusbar help-text for a menu item, and it also appears * in the toolbar editor, to describe the action. */ virtual void setToolTip( const QString& ); /** * Sets the QIconSet from which the icons used to display this action will * be chosen. */ - virtual void setIconSet( const QIconSet &iconSet ); + virtual void setIconSet( const QIcon &iconSet ); virtual void setIcon( const QString& icon ); /** * Enables or disables this action. All uses of this action (eg. in menus * or toolbars) will be updated to reflect the state of the action. */ virtual void setEnabled(bool enable); /** * Indicate whether the user may configure the action's shortcut. */ @@ -537,34 +539,34 @@ public slots: * Emulate user's interaction programmatically, by activating the action. * The implementation simply emits activated(). */ virtual void activate(); protected slots: virtual void slotDestroyed(); virtual void slotKeycodeChanged(); virtual void slotActivated(); protected: KToolBar* toolBar( int index ) const; - QPopupMenu* popupMenu( int index ) const; + Q3PopupMenu* popupMenu( int index ) const; void removeContainer( int index ); int findContainer( const QWidget* widget ) const; void plugMainWindowAccel( QWidget *w ); void addContainer( QWidget* parent, int id ); void addContainer( QWidget* parent, QWidget* representative ); virtual void updateShortcut( int i ); - virtual void updateShortcut( QPopupMenu* menu, int id ); + virtual void updateShortcut( Q3PopupMenu* menu, int id ); virtual void updateGroup( int id ); virtual void updateText(int i ); virtual void updateEnabled(int i); virtual void updateIconSet(int i); virtual void updateIcon( int i); virtual void updateToolTip( int id ); virtual void updateWhatsThis( int i ); KActionCollection *m_parentCollection; QString whatsThisWithIcon() const; signals: diff --git a/microkde/kdeui/kactionclasses.cpp b/microkde/kdeui/kactionclasses.cpp index 82e6c8b..c611865 100644 --- a/microkde/kdeui/kactionclasses.cpp +++ b/microkde/kdeui/kactionclasses.cpp @@ -19,51 +19,53 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kactionclasses.h" #include <assert.h> #include <qfontdatabase.h> -#include <qobjectlist.h> +#include <qobject.h> //US#include <qwhatsthis.h> #include <qtimer.h> +//Added by qt3to4: +#include <Q3ValueList> //US#include <kaccel.h> //US#include <kapplication.h> #include <kconfig.h> #include <kdebug.h> //US#include <kfontcombo.h> //US#include <kmainwindow.h> //US#include <kmenubar.h> //US#include <kpopupmenu.h> #include <kcombobox.h> #include <ktoolbar.h> #include <ktoolbarbutton.h> #include <kurl.h> //US added the following includefiles #include <kconfigbase.h> #include <qwidget.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qmenubar.h> -#include <qmainwindow.h> -#include <qtoolbar.h> +#include <q3mainwindow.h> +#include <q3toolbar.h> #include <qcombobox.h> -#include <qmainwindow.h> - +#include <q3mainwindow.h> +#include <qcoreapplication.h> static QFontDatabase *fontDataBase = 0; static void cleanupFontDatabase() { delete fontDataBase; fontDataBase = 0; } static void get_fonts( QStringList &lst ) { if ( !fontDataBase ) { @@ -74,25 +76,25 @@ static void get_fonts( QStringList &lst ) QStringList families = fontDataBase->families(); for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) { QString family = *it; if ( family. contains('-') ) // remove foundry family = family.right( family.length() - family.find('-' ) - 1); if ( !lst.contains( family ) ) lst.append( family ); } lst.sort(); } -static QValueList<int> get_standard_font_sizes() +static Q3ValueList<int> get_standard_font_sizes() { if ( !fontDataBase ) { fontDataBase = new QFontDatabase(); qAddPostRoutine( cleanupFontDatabase ); } return fontDataBase->standardSizes(); } class KToggleAction::KToggleActionPrivate { public: KToggleActionPrivate() @@ -111,41 +113,41 @@ KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, { d = new KToggleActionPrivate; } KToggleAction::KToggleAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KAction( text, cut, receiver, slot, parent, name ) { d = new KToggleActionPrivate; } -KToggleAction::KToggleAction( const QString& text, const QIconSet& pix, +KToggleAction::KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KAction( text, pix, cut, parent, name ) { d = new KToggleActionPrivate; } KToggleAction::KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KAction( text, pix, cut, parent, name ) { d = new KToggleActionPrivate; } -KToggleAction::KToggleAction( const QString& text, const QIconSet& pix, +KToggleAction::KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KAction( text, pix, cut, receiver, slot, parent, name ) { d = new KToggleActionPrivate; } KToggleAction::KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, @@ -160,44 +162,44 @@ KToggleAction::KToggleAction( QObject* parent, const char* name ) : KAction( parent, name ) { d = new KToggleActionPrivate; } KToggleAction::~KToggleAction() { delete d; } int KToggleAction::plug( QWidget* widget, int index ) { - if ( !widget->inherits("QPopupMenu") && !widget->inherits("KToolBar") ) + if ( !widget->inherits("Q3PopupMenu") && !widget->inherits("KToolBar") ) { kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl; return -1; } /*US if (kapp && !kapp->authorizeKAction(name())) return -1; */ int _index = KAction::plug( widget, index ); if ( _index == -1 ) return _index; - if ( widget->inherits("QPopupMenu") ) + if ( widget->inherits("Q3PopupMenu") ) { int id = itemId( _index ); - static_cast<QPopupMenu*>(widget)->setItemChecked( id, d->m_checked ); + static_cast<Q3PopupMenu*>(widget)->setItemChecked( id, d->m_checked ); } else if ( widget->inherits( "KToolBar" ) ) { KToolBar *bar = static_cast<KToolBar *>( widget ); bar->setToggle( itemId( _index ), true ); bar->setButton( itemId( _index ), isChecked() ); } return _index; } void KToggleAction::setChecked( bool c ) @@ -205,47 +207,46 @@ void KToggleAction::setChecked( bool c ) if ( c == d->m_checked ) return; //kdDebug(129) << "KToggleAction::setChecked(" << c << ") " << this << " " << name() << endl; d->m_checked = c; int len = containerCount(); for( int i = 0; i < len; ++i ) updateChecked( i ); if ( c && parent() && !exclusiveGroup().isEmpty() ) { - const QObjectList *list = parent()->children(); - if ( list ) { - QObjectListIt it( *list ); - for( ; it.current(); ++it ) { - if ( it.current()->inherits( "KToggleAction" ) && it.current() != this && - static_cast<KToggleAction*>(it.current())->exclusiveGroup() == exclusiveGroup() ) { - KToggleAction *a = static_cast<KToggleAction*>(it.current()); + const QObjectList list = parent()->children(); + if ( !list.empty() ) { + for(QObjectList::const_iterator it=list.begin();it!=list.end();++it) { + if ( (*it)->inherits( "KToggleAction" ) && (*it) != this && + static_cast<KToggleAction*>((*it))->exclusiveGroup() == exclusiveGroup() ) { + KToggleAction *a = static_cast<KToggleAction*>(*it); if( a->isChecked() ) { a->setChecked( false ); emit a->toggled( false ); } } } } } } void KToggleAction::updateChecked( int id ) { QWidget *w = container( id ); - if ( w->inherits( "QPopupMenu" ) ) - static_cast<QPopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked ); + if ( w->inherits( "Q3PopupMenu" ) ) + static_cast<Q3PopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked ); else if ( w->inherits( "QMenuBar" ) ) static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked ); else if ( w->inherits( "KToolBar" ) ) { QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) ); if ( r && r->inherits( "KToolBarButton" ) ) static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked ); } } void KToggleAction::slotActivated() { @@ -274,39 +275,39 @@ KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, QObject* parent, const char* name ) : KToggleAction( text, cut, parent, name ) { } KRadioAction::KRadioAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KToggleAction( text, cut, receiver, slot, parent, name ) { } -KRadioAction::KRadioAction( const QString& text, const QIconSet& pix, +KRadioAction::KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KToggleAction( text, pix, cut, parent, name ) { } KRadioAction::KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KToggleAction( text, pix, cut, parent, name ) { } -KRadioAction::KRadioAction( const QString& text, const QIconSet& pix, +KRadioAction::KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KToggleAction( text, pix, cut, receiver, slot, parent, name ) { } KRadioAction::KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KToggleAction( text, pix, cut, receiver, slot, parent, name ) @@ -340,25 +341,25 @@ class KSelectAction::KSelectActionPrivate { public: KSelectActionPrivate() { m_edit = false; m_menuAccelsEnabled = true; m_menu = 0; m_current = -1; m_comboWidth = -1; } bool m_edit; bool m_menuAccelsEnabled; - QPopupMenu *m_menu; + Q3PopupMenu *m_menu; int m_current; int m_comboWidth; QStringList m_list; QString makeMenuText( const QString &_text ) { if ( m_menuAccelsEnabled ) return _text; QString text = _text; uint i = 0; while ( i < text.length() ) { if ( text.at( i ) == '&' ) { @@ -378,41 +379,41 @@ KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, { d = new KSelectActionPrivate; } KSelectAction::KSelectAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KAction( text, cut, receiver, slot, parent, name ) { d = new KSelectActionPrivate; } -KSelectAction::KSelectAction( const QString& text, const QIconSet& pix, +KSelectAction::KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KAction( text, pix, cut, parent, name ) { d = new KSelectActionPrivate; } KSelectAction::KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KAction( text, pix, cut, parent, name ) { d = new KSelectActionPrivate; } -KSelectAction::KSelectAction( const QString& text, const QIconSet& pix, +KSelectAction::KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KAction( text, pix, cut, receiver, slot, parent, name ) { d = new KSelectActionPrivate; } KSelectAction::KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, @@ -430,25 +431,25 @@ KSelectAction::KSelectAction( QObject* parent, const char* name ) } KSelectAction::~KSelectAction() { assert(d); delete d->m_menu; delete d; d = 0; } void KSelectAction::setCurrentItem( int id ) { if ( id >= (int)d->m_list.count() ) { - ASSERT(id < (int)d->m_list.count()); + Q_ASSERT(id < (int)d->m_list.count()); return; } if ( d->m_menu ) { if ( d->m_current >= 0 ) d->m_menu->setItemChecked( d->m_current, false ); if ( id >= 0 ) { //US qDebug("KSelectAction::setCurrentItem %i", id); d->m_menu->setItemChecked( id, true ); } @@ -470,31 +471,31 @@ void KSelectAction::setComboWidth( int width ) { if ( width < 0 ) return; d->m_comboWidth=width; int len = containerCount(); for( int i = 0; i < len; ++i ) updateComboWidth( i ); } -QPopupMenu* KSelectAction::popupMenu() const +Q3PopupMenu* KSelectAction::popupMenu() const { kdDebug(129) << "KSelectAction::popupMenu()" << endl; // remove -- ellis if ( !d->m_menu ) { //US d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()"); - d->m_menu = new QPopupMenu(0L, "QSelectAction::popupMenu()"); + d->m_menu = new Q3PopupMenu(0L, "QSelectAction::popupMenu()"); setupMenu(); if ( d->m_current >= 0 ) d->m_menu->setItemChecked( d->m_current, true ); } return d->m_menu; } void KSelectAction::setupMenu() const { if ( !d->m_menu ) return; @@ -634,30 +635,30 @@ void KSelectAction::updateItems( int id ) cb->setMinimumWidth( cb->sizeHint().width() ); } } } int KSelectAction::plug( QWidget *widget, int index ) { //US if (kapp && !kapp->authorizeKAction(name())) //US return -1; kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis - if ( widget->inherits("QPopupMenu") ) + if ( widget->inherits("Q3PopupMenu") ) { // Create the PopupMenu and store it in m_menu (void)popupMenu(); - QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); + Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); int id; if ( hasIconSet() ) id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index ); else id = menu->insertItem( text(), d->m_menu, -1, index ); if ( !isEnabled() ) menu->setItemEnabled( id, false ); QString wth = whatsThis(); if ( !wth.isEmpty() ) @@ -673,25 +674,25 @@ int KSelectAction::plug( QWidget *widget, int index ) KToolBar* bar = static_cast<KToolBar*>( widget ); int id_ = KAction::getToolButtonID(); bar->insertCombo( comboItems(), id_, isEditable(), SIGNAL( activated( const QString & ) ), this, SLOT( slotActivated( const QString & ) ), isEnabled(), toolTip(), -1, index ); KComboBox *cb = bar->getCombo( id_ ); if ( cb ) { cb->setMaximumHeight( 34 ); - if (!isEditable()) cb->setFocusPolicy(QWidget::NoFocus); + if (!isEditable()) cb->setFocusPolicy(Qt::NoFocus); cb->setMinimumWidth( cb->sizeHint().width() ); if ( d->m_comboWidth > 0 ) { cb->setMinimumWidth( d->m_comboWidth ); cb->setMaximumWidth( d->m_comboWidth ); } cb->setInsertionPolicy( QComboBox::NoInsertion ); //US QWhatsThis::add( cb, whatsThis() ); } addContainer( bar, id_ ); @@ -843,41 +844,41 @@ KListAction::KListAction( const QString& text, const KShortcut& cut, } KListAction::KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, cut, parent, name ) { d = new KListActionPrivate; if ( receiver ) connect( this, SIGNAL( activated( int ) ), receiver, slot ); } -KListAction::KListAction( const QString& text, const QIconSet& pix, +KListAction::KListAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { d = new KListActionPrivate; } KListAction::KListAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { d = new KListActionPrivate; } -KListAction::KListAction( const QString& text, const QIconSet& pix, +KListAction::KListAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { d = new KListActionPrivate; if ( receiver ) connect( this, SIGNAL( activated( int ) ), receiver, slot ); } KListAction::KListAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, @@ -956,25 +957,25 @@ KRecentFilesAction::KRecentFilesAction( const QString& text, { d = new KRecentFilesActionPrivate; d->m_maxItems = maxItems; init(); if ( receiver ) connect( this, SIGNAL(urlSelected(const KURL&)), receiver, slot ); } KRecentFilesAction::KRecentFilesAction( const QString& text, - const QIconSet& pix, + const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name, uint maxItems ) : KListAction( text, pix, cut, parent, name) { d = new KRecentFilesActionPrivate; d->m_maxItems = maxItems; init(); } KRecentFilesAction::KRecentFilesAction( const QString& text, @@ -982,25 +983,25 @@ KRecentFilesAction::KRecentFilesAction( const QString& text, const KShortcut& cut, QObject* parent, const char* name, uint maxItems ) : KListAction( text, pix, cut, parent, name) { d = new KRecentFilesActionPrivate; d->m_maxItems = maxItems; init(); } KRecentFilesAction::KRecentFilesAction( const QString& text, - const QIconSet& pix, + const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name, uint maxItems ) : KListAction( text, pix, cut, parent, name) { d = new KRecentFilesActionPrivate; d->m_maxItems = maxItems; init(); @@ -1192,47 +1193,47 @@ KFontAction::KFontAction( const QString& text, KFontAction::KFontAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, cut, receiver, slot, parent, name ) { d = new KFontActionPrivate; get_fonts( d->m_fonts ); KSelectAction::setItems( d->m_fonts ); setEditable( true ); } -KFontAction::KFontAction( const QString& text, const QIconSet& pix, +KFontAction::KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { d = new KFontActionPrivate; get_fonts( d->m_fonts ); KSelectAction::setItems( d->m_fonts ); setEditable( true ); } KFontAction::KFontAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { d = new KFontActionPrivate; get_fonts( d->m_fonts ); KSelectAction::setItems( d->m_fonts ); setEditable( true ); } -KFontAction::KFontAction( const QString& text, const QIconSet& pix, +KFontAction::KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, receiver, slot, parent, name ) { d = new KFontActionPrivate; get_fonts( d->m_fonts ); KSelectAction::setItems( d->m_fonts ); setEditable( true ); } KFontAction::KFontAction( const QString& text, const QString& pix, @@ -1352,41 +1353,41 @@ KFontSizeAction::KFontSizeAction( const QString& text, init(); } KFontSizeAction::KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, cut, receiver, slot, parent, name ) { init(); } -KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix, +KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { init(); } KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, parent, name ) { init(); } -KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix, +KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name ) : KSelectAction( text, pix, cut, receiver, slot, parent, name ) { init(); } KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, @@ -1405,61 +1406,61 @@ KFontSizeAction::KFontSizeAction( QObject* parent, const char* name ) KFontSizeAction::~KFontSizeAction() { delete d; d = 0; } void KFontSizeAction::init() { d = new KFontSizeActionPrivate; setEditable( true ); - QValueList<int> sizes = get_standard_font_sizes(); + Q3ValueList<int> sizes = get_standard_font_sizes(); QStringList lst; - for ( QValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it ) + for ( Q3ValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it ) lst.append( QString::number( *it ) ); setItems( lst ); } void KFontSizeAction::setFontSize( int size ) { if ( size == fontSize() ) { setCurrentItem( items().findIndex( QString::number( size ) ) ); return; } if ( size < 1 ) { kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl; return; } int index = items().findIndex( QString::number( size ) ); if ( index == -1 ) { // Insert at the correct position in the list (to keep sorting) - QValueList<int> lst; + Q3ValueList<int> lst; // Convert to list of ints QStringList itemsList = items(); for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it) lst.append( (*it).toInt() ); // New size lst.append( size ); // Sort the list qDebug("KFontSizeAction::setFontSize heapsort not found."); //US has to be fixed //US qHeapSort( lst ); // Convert back to string list QStringList strLst; - for (QValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it) + for (Q3ValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it) strLst.append( QString::number(*it) ); KSelectAction::setItems( strLst ); // Find new current item index = lst.findIndex( size ); setCurrentItem( index ); } else setCurrentItem( index ); //emit KAction::activated(); //emit activated( index ); @@ -1483,55 +1484,55 @@ void KFontSizeAction::slotActivated( const QString& size ) { setFontSize( size.toInt() ); // insert sorted first KSelectAction::slotActivated( size ); emit fontSizeChanged( size.toInt() ); } class KActionMenu::KActionMenuPrivate { public: KActionMenuPrivate() { //US m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate"); - m_popup = new QPopupMenu(0L,"KActionMenu::KActionMenuPrivate"); + m_popup = new Q3PopupMenu(0L,"KActionMenu::KActionMenuPrivate"); m_delayed = true; m_stickyMenu = true; } ~KActionMenuPrivate() { delete m_popup; m_popup = 0; } //US KPopupMenu *m_popup; - QPopupMenu *m_popup; + Q3PopupMenu *m_popup; bool m_delayed; bool m_stickyMenu; }; KActionMenu::KActionMenu( QObject* parent, const char* name ) : KAction( parent, name ) { d = new KActionMenuPrivate; setShortcutConfigurable( false ); } KActionMenu::KActionMenu( const QString& text, QObject* parent, const char* name ) : KAction( text, 0, parent, name ) { d = new KActionMenuPrivate; setShortcutConfigurable( false ); } -KActionMenu::KActionMenu( const QString& text, const QIconSet& icon, +KActionMenu::KActionMenu( const QString& text, const QIcon& icon, QObject* parent, const char* name ) : KAction( text, icon, 0, parent, name ) { d = new KActionMenuPrivate; setShortcutConfigurable( false ); } KActionMenu::KActionMenu( const QString& text, const QString& icon, QObject* parent, const char* name ) : KAction( text, icon, 0, parent, name ) { d = new KActionMenuPrivate; @@ -1543,25 +1544,25 @@ KActionMenu::~KActionMenu() unplugAll(); kdDebug(129) << "KActionMenu::~KActionMenu()" << endl; // ellis delete d; d = 0; } void KActionMenu::popup( const QPoint& global ) { popupMenu()->popup( global ); } //US KPopupMenu* KActionMenu::popupMenu() const -QPopupMenu* KActionMenu::popupMenu() const +Q3PopupMenu* KActionMenu::popupMenu() const { return d->m_popup; } void KActionMenu::insert( KAction* cmd, int index ) { if ( cmd ) cmd->plug( d->m_popup, index ); } void KActionMenu::remove( KAction* cmd ) { @@ -1583,27 +1584,27 @@ bool KActionMenu::stickyMenu() const { void KActionMenu::setStickyMenu(bool sticky) { d->m_stickyMenu = sticky; } int KActionMenu::plug( QWidget* widget, int index ) { /*US if (kapp && !kapp->authorizeKAction(name())) return -1; */ kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis - if ( widget->inherits("QPopupMenu") ) + if ( widget->inherits("Q3PopupMenu") ) { - QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); + Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); int id; if ( hasIconSet() ) id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index ); else id = menu->insertItem( text(), d->m_popup, -1, index ); if ( !isEnabled() ) menu->setItemEnabled( id, false ); addContainer( menu, id ); connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); @@ -1772,30 +1773,30 @@ int KToolBarPopupAction::plug( QWidget *widget, int index ) /*US if ( !whatsThis().isEmpty() ) QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() ); */ return containerCount() - 1; } return KAction::plug( widget, index ); } //US KPopupMenu *KToolBarPopupAction::popupMenu() const -QPopupMenu *KToolBarPopupAction::popupMenu() const +Q3PopupMenu *KToolBarPopupAction::popupMenu() const { if ( !m_popup ) { KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this); //US that->m_popup = new KPopupMenu; - that->m_popup = new QPopupMenu; + that->m_popup = new Q3PopupMenu; } return m_popup; } //////// KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName, const QString& text, KActionCollection* parent, const char* name ) : KToggleAction( text, KShortcut(), parent, name ) , m_toolBarName( toolBarName ) , m_toolBar( 0L ) { @@ -1944,48 +1945,48 @@ void KWidgetAction::unplug( QWidget *w ) if ( toolBar == w ) { disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) ); m_widget->reparent( 0L, QPoint(), false ); // false = showit } KAction::unplug( w ); } void KWidgetAction::slotToolbarDestroyed() { //Q_ASSERT( m_widget ); // When exiting the app the widget could be destroyed before the toolbar. - ASSERT( isPlugged() ); + Q_ASSERT( isPlugged() ); if( !m_widget || !isPlugged() ) return; // Don't let a toolbar being destroyed, delete my widget. m_widget->reparent( 0L, QPoint(), false /*showIt*/ ); } //////// KActionSeparator::KActionSeparator( QObject *parent, const char *name ) : KAction( parent, name ) { } KActionSeparator::~KActionSeparator() { } int KActionSeparator::plug( QWidget *widget, int index ) { - if ( widget->inherits("QPopupMenu") ) + if ( widget->inherits("Q3PopupMenu") ) { - QPopupMenu* menu = static_cast<QPopupMenu*>( widget ); + Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget ); int id = menu->insertSeparator( index ); addContainer( menu, id ); connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); return containerCount() - 1; } else if ( widget->inherits( "QMenuBar" ) ) { QMenuBar *menuBar = static_cast<QMenuBar *>( widget ); diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h index f6e7a0f..a9b9104 100644 --- a/microkde/kdeui/kactionclasses.h +++ b/microkde/kdeui/kactionclasses.h @@ -25,45 +25,48 @@ #ifndef __kactionclasses_h__ #define __kactionclasses_h__ #include <kaction.h> //US#include <qkeysequence.h> //US#include <qobject.h> //US#include <qvaluelist.h> //US#include <qguardedptr.h> //US#include <kguiitem.h> #include <kshortcut.h> +//Added by qt3to4: +#include <Q3CString> +#include <Q3PopupMenu> //US#include <kstdaction.h> //US#include <kicontheme.h> class QMenuBar; -class QPopupMenu; +class Q3PopupMenu; //USclass QComboBox; //USclass QPoint; //USclass QIconSet; //USclass QString; //USclass KToolBar; //USclass KAccel; //USclass KAccelActions; class KConfig; //USclass KConfigBase; class KURL; //USclass KInstance; //US class KToolBar needs to be replaced -class KToolBar; +#include "ktoolbar.h" class KActionCollection; //US class KPopupMenu needs to be replaced //US class KPopupMenu; //USclass KMainWindow; /** * Checkbox like action. * * This action provides two states: checked or not. * * @short Checkbox like action. @@ -96,47 +99,47 @@ public: * @param name An internal name for this action. */ KToggleAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, @@ -237,47 +240,47 @@ public: * @param name An internal name for this action. */ KRadioAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, @@ -343,47 +346,47 @@ public: * @param name An internal name for this action. */ KSelectAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, @@ -429,25 +432,25 @@ public: virtual void changeItem( int index, const QString& text ); virtual QString currentText() const; virtual int currentItem() const; /** * When this action is plugged into a toolbar, it creates a combobox. * This returns the maximum width set by setComboWidth */ virtual int comboWidth() const; - QPopupMenu* popupMenu() const; + Q3PopupMenu* popupMenu() const; /** * Deprecated. See @ref setMenuAccelsEnabled . * @since 3.1 */ void setRemoveAmpersandsInCombo( bool b ); /// @since 3.1 bool removeAmpersandsInCombo() const; /** * Sets whether any occurence of the ampersand character ( & ) in items * should be interpreted as keyboard accelerator for items displayed in a @@ -558,47 +561,47 @@ public: * @param name An internal name for this action. */ KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KListAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ @@ -676,25 +679,25 @@ public: const QObject* receiver, const char* slot, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ - KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, @@ -703,25 +706,25 @@ public: /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke when a URL is selected. * Its signature is of the form slotURLSelected( const KURL & ). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ - KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke when a URL is selected. * Its signature is of the form slotURLSelected( const KURL & ). * @param parent This action's parent. @@ -825,29 +828,29 @@ private: }; class KFontAction : public KSelectAction { Q_OBJECT Q_PROPERTY( QString font READ font WRITE setFont ) public: KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); - KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); - KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontAction( QObject* parent = 0, const char* name = 0 ); ~KFontAction(); QString font() const { return currentText(); } @@ -864,29 +867,29 @@ private: KFontActionPrivate *d; }; class KFontSizeAction : public KSelectAction { Q_OBJECT Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize ) public: KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); - KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); - KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontSizeAction( QObject* parent = 0, const char* name = 0 ); virtual ~KFontSizeAction(); virtual int fontSize() const; public slots: @@ -922,36 +925,36 @@ private: * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. * See also setDelayed about the main action. */ class KActionMenu : public KAction { Q_OBJECT Q_PROPERTY( bool delayed READ delayed WRITE setDelayed ) Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu ) public: KActionMenu( const QString& text, QObject* parent = 0, const char* name = 0 ); - KActionMenu( const QString& text, const QIconSet& icon, + KActionMenu( const QString& text, const QIcon& icon, QObject* parent = 0, const char* name = 0 ); KActionMenu( const QString& text, const QString& icon, QObject* parent = 0, const char* name = 0 ); KActionMenu( QObject* parent = 0, const char* name = 0 ); virtual ~KActionMenu(); virtual void insert( KAction*, int index = -1 ); virtual void remove( KAction* ); //US KPopupMenu* popupMenu() const; - QPopupMenu* popupMenu() const; + Q3PopupMenu* popupMenu() const; void popup( const QPoint& global ); /** * Returns true if this action creates a delayed popup menu * when plugged in a KToolbar. */ bool delayed() const; /** * If set to true, this action will create a delayed popup menu * when plugged in a KToolbar. Otherwise it creates a normal popup. * Default: delayed * @@ -1058,25 +1061,25 @@ public: KActionCollection* parent, const char* name ); virtual ~KToolBarPopupAction(); virtual int plug( QWidget *widget, int index = -1 ); /** * The popup menu that is shown when clicking (some time) on the toolbar * button. You may want to plug items into it on creation, or connect to * aboutToShow for a more dynamic menu. */ //US KPopupMenu *popupMenu() const; - QPopupMenu *popupMenu() const; + Q3PopupMenu *popupMenu() const; /** * Returns true if this action creates a delayed popup menu * when plugged in a KToolbar. */ bool delayed() const; /** * If set to true, this action will create a delayed popup menu * when plugged in a KToolbar. Otherwise it creates a normal popup. * Default: delayed. */ void setDelayed(bool delayed); @@ -1089,25 +1092,25 @@ public: * If set to true, this action will create a sticky popup menu * when plugged in a KToolbar. * "Sticky", means it's visible until a selection is made or the mouse is * clicked elsewhere. This feature allows you to make a selection without * having to press and hold down the mouse while making a selection. * Only available if delayed() is true. * Default: sticky. */ void setStickyMenu(bool sticky); private: //US KPopupMenu *m_popup; - QPopupMenu *m_popup; + Q3PopupMenu *m_popup; bool m_delayed:1; bool m_stickyMenu:1; protected: virtual void virtual_hook( int id, void* data ); private: class KToolBarPopupActionPrivate; KToolBarPopupActionPrivate *d; }; /** * An action that takes care of everything associated with * showing or hiding a toolbar by a menu action. It will @@ -1138,26 +1141,26 @@ public: virtual ~KToggleToolBarAction(); virtual int plug( QWidget*, int index = -1 ); KToolBar *toolBar() { return m_toolBar; } public slots: virtual void setChecked( bool ); private: - QCString m_toolBarName; - QGuardedPtr<KToolBar> m_toolBar; + Q3CString m_toolBarName; + QPointer<KToolBar> m_toolBar; protected: virtual void virtual_hook( int id, void* data ); private: class KToggleToolBarActionPrivate; KToggleToolBarActionPrivate *d; }; /** * An action that automatically embeds a widget into a * toolbar. */ class KWidgetAction : public KAction @@ -1186,25 +1189,25 @@ public: * Plug the action. The widget passed to the constructor * will be reparented to w, which must inherit KToolBar. */ virtual int plug( QWidget* w, int index = -1 ); /** * Unplug the action. Ensures that the action is not * destroyed. It will be hidden and reparented to 0L instead. */ virtual void unplug( QWidget *w ); protected slots: void slotToolbarDestroyed(); private: - QGuardedPtr<QWidget> m_widget; + QPointer<QWidget> m_widget; bool m_autoSized; protected: virtual void virtual_hook( int id, void* data ); private: class KWidgetActionPrivate; KWidgetActionPrivate *d; }; class KActionSeparator : public KAction { Q_OBJECT public: diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index 69e5d02..4d66c7f 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp @@ -17,36 +17,38 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kactioncollection.h" //US#include "kactionshortcutlist.h" -#include <qptrdict.h> +#include <q3ptrdict.h> +//Added by qt3to4: +#include <Q3ValueList> //US#include <qvariant.h> //US#include <kaccel.h> //US#include <kaccelbase.h> //US#include <kapplication.h> #include <kdebug.h> //US#include <kxmlguifactory.h> //US I included the following files -#include <qasciidict.h> -#include <qptrlist.h> +#include <q3asciidict.h> +#include <q3ptrlist.h> #include "kaction.h" #include <kglobal.h> #include <qobject.h> #include <qwidget.h> class KActionCollection::KActionCollectionPrivate { public: KActionCollectionPrivate() { //US m_instance = 0; //m_bOneKAccelOnly = false; @@ -58,31 +60,31 @@ public: m_highlight = false; m_currentHighlightAction = 0; m_statusCleared = true; } //US KInstance *m_instance; //US QString m_sXMLFile; bool m_bAutoConnectShortcuts; //bool m_bOneKAccelOnly; //int m_iWidgetCurrent; //QValueList<QWidget*> m_widgetList; //QValueList<KAccel*> m_kaccelList; - QValueList<KActionCollection*> m_docList; + Q3ValueList<KActionCollection*> m_docList; QWidget *m_widget; KAccel *m_kaccel; KAccel *m_builderKAccel; - QAsciiDict<KAction> m_actionDict; - QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; + Q3AsciiDict<KAction> m_actionDict; + Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers; bool m_highlight; KAction *m_currentHighlightAction; bool m_statusCleared; }; KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, KInstance *instance */) : QObject( (QObject*)parent, name ) { kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis d = new KActionCollectionPrivate; if( parent ) @@ -124,25 +126,25 @@ KActionCollection::KActionCollection( QObject *parent, const char *name /*US, KActionCollection::KActionCollection( const KActionCollection © ) : QObject() { kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; d = new KActionCollectionPrivate; *this = copy; } // KDE 4: remove end KActionCollection::~KActionCollection() { kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; - for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { + for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { KAction* pAction = it.current(); if ( pAction->m_parentCollection == this ) pAction->m_parentCollection = 0L; } //US delete d->m_kaccel; //US delete d->m_builderKAccel; delete d; d = 0; } void KActionCollection::setWidget( QWidget* w ) { @@ -356,118 +358,118 @@ KAction* KActionCollection::_take( KAction* action ) } KAction *a = d->m_actionDict.take( name ); if ( !a || a != action ) return 0; emit removed( action ); return a; } void KActionCollection::_clear() { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); while ( it.current() ) _remove( it.current() ); } void KActionCollection::insert( KAction* action ) { _insert( action ); } void KActionCollection::remove( KAction* action ) { _remove( action ); } KAction* KActionCollection::take( KAction* action ) { return _take( action ); } void KActionCollection::clear() { _clear(); } KAccel* KActionCollection::accel() { return kaccel(); } const KAccel* KActionCollection::accel() const { return kaccel(); } KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; } KAction* KActionCollection::action( const char* name, const char* classname ) const { KAction* pAction = 0; if ( !classname && name ) pAction = d->m_actionDict[ name ]; else { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) { if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) && ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) { pAction = it.current(); break; } } } if( !pAction ) { for( uint i = 0; i < d->m_docList.count() && !pAction; i++ ) pAction = d->m_docList[i]->action( name, classname ); } return pAction; } KAction* KActionCollection::action( int index ) const { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it += index; return it.current(); // return d->m_actions.at( index ); } /*US bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) { return KActionShortcutList(this).readSettings( sConfigGroup, pConfig ); } bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const { return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig ); } */ uint KActionCollection::count() const { return d->m_actionDict.count(); } QStringList KActionCollection::groups() const { QStringList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) ) lst.append( it.current()->group() ); return lst; } KActionPtrList KActionCollection::actions( const QString& group ) const { KActionPtrList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) if ( it.current()->group() == group ) lst.append( it.current() ); else if ( it.current()->group().isEmpty() && group.isEmpty() ) lst.append( it.current() ); return lst; } KActionPtrList KActionCollection::actions() const { KActionPtrList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) lst.append( it.current() ); return lst; } /*US we have no instance object. Use KGlobal instead void KActionCollection::setInstance( KInstance *instance ) { if ( instance ) d->m_instance = instance; qDebug("KActionCollection::setInstance has to be fixed"); @@ -499,59 +501,59 @@ void KActionCollection::setHighlightingEnabled( bool enable ) } bool KActionCollection::highlightingEnabled() const { return d->m_highlight; } void KActionCollection::connectHighlight( QWidget *container, KAction *action ) { if ( !d->m_highlight ) return; - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; if ( !actionList ) { - actionList = new QPtrList<KAction>; + actionList = new Q3PtrList<KAction>; - if ( container->inherits( "QPopupMenu" ) ) + if ( container->inherits( "Q3PopupMenu" ) ) { connect( container, SIGNAL( highlighted( int ) ), this, SLOT( slotMenuItemHighlighted( int ) ) ); connect( container, SIGNAL( aboutToHide() ), this, SLOT( slotMenuAboutToHide() ) ); } //US else if ( container->inherits( "KToolBar" ) ) - else if ( container->inherits( "QToolBar" ) ) + else if ( container->inherits( "Q3ToolBar" ) ) { connect( container, SIGNAL( highlighted( int, bool ) ), this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) ); } connect( container, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); d->m_dctHighlightContainers.insert( container, actionList ); } actionList->append( action ); } void KActionCollection::disconnectHighlight( QWidget *container, KAction *action ) { if ( !d->m_highlight ) return; - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; if ( !actionList ) return; actionList->removeRef( action ); if ( actionList->count() == 0 ) d->m_dctHighlightContainers.remove( container ); } void KActionCollection::slotMenuItemHighlighted( int id ) { @@ -616,70 +618,70 @@ void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight ) d->m_currentHighlightAction = 0; // emit clearStatusText(); } } void KActionCollection::slotDestroyed() { d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) ); } KAction *KActionCollection::findAction( QWidget *container, int id ) { - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; if ( !actionList ) return 0; - QPtrListIterator<KAction> it( *actionList ); + Q3PtrListIterator<KAction> it( *actionList ); for (; it.current(); ++it ) if ( it.current()->isPlugged( container, id ) ) return it.current(); return 0; } // KDE 4: remove KActionCollection KActionCollection::operator+(const KActionCollection &c ) const { kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl; KActionCollection ret( *this ); - QValueList<KAction *> actions = c.actions(); - QValueList<KAction *>::ConstIterator it = actions.begin(); - QValueList<KAction *>::ConstIterator end = actions.end(); + Q3ValueList<KAction *> actions = c.actions(); + Q3ValueList<KAction *>::ConstIterator it = actions.begin(); + Q3ValueList<KAction *>::ConstIterator end = actions.end(); for (; it != end; ++it ) ret.insert( *it ); return ret; } KActionCollection &KActionCollection::operator=( const KActionCollection © ) { kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl; //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly; //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent; //d->m_widgetList = copy.d->m_widgetList; //d->m_kaccelList = copy.d->m_kaccelList; d->m_widget = copy.d->m_widget; d->m_kaccel = copy.d->m_kaccel; d->m_actionDict = copy.d->m_actionDict; //US setInstance( copy.instance() ); return *this; } KActionCollection &KActionCollection::operator+=( const KActionCollection &c ) { kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl; - QAsciiDictIterator<KAction> it(c.d->m_actionDict); + Q3AsciiDictIterator<KAction> it(c.d->m_actionDict); for ( ; it.current(); ++it ) insert( it.current() ); return *this; } // KDE 4: remove end //--------------------------------------------------------------------- // KActionShortcutList //--------------------------------------------------------------------- /*US KActionShortcutList::KActionShortcutList( KActionCollection* pColl ) diff --git a/microkde/kdeui/kactioncollection.h b/microkde/kdeui/kactioncollection.h index b9466d0..50cb02a 100644 --- a/microkde/kdeui/kactioncollection.h +++ b/microkde/kdeui/kactioncollection.h @@ -21,24 +21,26 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //$Id$ #ifndef __kactioncollection_h__ #define __kactioncollection_h__ #include <kaction.h> //US #include <qkeysequence.h> #include <qobject.h> +//Added by qt3to4: +#include <Q3ValueList> //US#include <qvaluelist.h> //US#include <qguardedptr.h> //US #include <kguiitem.h> //US#include <kshortcut.h> //US#include <kstdaction.h> //US#include <kicontheme.h> //USclass QMenuBar; //USclass QPopupMenu; //USclass QComboBox; //USclass QPoint; //USclass QIconSet; @@ -51,25 +53,25 @@ //USclass KConfigBase; //USclass KURL; //USclass KInstance; //USclass KToolBar; //USclass KActionCollection; //USclass KPopupMenu; //USclass KMainWindow; //US added inclidefiles class QWidget; -typedef QValueList<KAction *> KActionPtrList; +typedef Q3ValueList<KAction *> KActionPtrList; /** * A managed set of KAction objects. */ class KActionCollection : public QObject { friend class KAction; friend class KXMLGUIClient; Q_OBJECT public: KActionCollection( QWidget *parent, const char *name = 0/*US , KInstance *instance = 0 */); diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp index 83d622a..3ea6703 100644 --- a/microkde/kdeui/kbuttonbox.cpp +++ b/microkde/kdeui/kbuttonbox.cpp @@ -40,49 +40,51 @@ * * 01/09/98 Mario Weilguni <mweilguni@sime.com> * The last button was to far right away from the right/bottom border. * Fixed this. Removed old code. Buttons get now a minimum width. * Programmer may now override minimum width and height of a button. * */ //US #include "kbuttonbox.moc" #include <kbuttonbox.h> #include <qpushbutton.h> -#include <qptrlist.h> +#include <q3ptrlist.h> +//Added by qt3to4: +#include <QResizeEvent> #include <assert.h> #define minButtonWidth 50 class KButtonBox::Item { public: QPushButton *button; bool noexpand; unsigned short stretch; unsigned short actual_size; }; -template class QPtrList<KButtonBox::Item>; +template class Q3PtrList<KButtonBox::Item>; class KButtonBoxPrivate { public: unsigned short border; unsigned short autoborder; unsigned short orientation; bool activated; - QPtrList<KButtonBox::Item> buttons; + Q3PtrList<KButtonBox::Item> buttons; }; -KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation, +KButtonBox::KButtonBox(QWidget *parent, Qt::Orientation _orientation, int border, int autoborder) : QWidget(parent) { data = new KButtonBoxPrivate; assert(data != 0); data->orientation = _orientation; data->border = border; data->autoborder = autoborder < 0 ? border : autoborder; data->buttons.setAutoDelete(TRUE); } @@ -140,25 +142,25 @@ void KButtonBox::layout() { b->setFixedSize(buttonSizeHint(b)); else b->setFixedSize(bs); } } setMinimumSize(sizeHint()); } void KButtonBox::placeButtons() { unsigned int i; - if(data->orientation == Horizontal) { + if(data->orientation == Qt::Horizontal) { // calculate free size and stretches int fs = width() - 2 * data->border; int stretch = 0; for(i = 0; i < data->buttons.count(); i++) { Item *item = data->buttons.at(i); if(item->button != 0) { fs -= item->button->width(); // Last button? if(i != data->buttons.count() - 1) fs -= data->autoborder; } else @@ -242,44 +244,44 @@ QSize KButtonBox::sizeHint() const { QSize bs = bestButtonSize(); for(i = 0; i < data->buttons.count(); i++) { KButtonBox *that = (KButtonBox*)this; Item *item = that->data->buttons.at(i); QPushButton *b = item->button; if(b != 0) { QSize s; if(item->noexpand) s = that->buttonSizeHint(b); else s = bs; - if(data->orientation == Horizontal) + if(data->orientation == Qt::Horizontal) dw += s.width(); else dw += s.height(); if( i != data->buttons.count() - 1 ) dw += data->autoborder; } } - if(data->orientation == Horizontal) + if(data->orientation == Qt::Horizontal) return QSize(dw, bs.height() + 2 * data->border); else return QSize(bs.width() + 2 * data->border, dw); } } QSizePolicy KButtonBox::sizePolicy() const { - return data->orientation == Horizontal? + return data->orientation == Qt::Horizontal? QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); } /* * Returns the best size for a button. If a button is less than * minButtonWidth pixels wide, return minButtonWidth pixels * as minimum width */ QSize KButtonBox::buttonSizeHint(QPushButton *b) const { QSize s = b->sizeHint(); QSize ms = b->minimumSize(); diff --git a/microkde/kdeui/kbuttonbox.h b/microkde/kdeui/kbuttonbox.h index 1104366..2e0f41d 100644 --- a/microkde/kdeui/kbuttonbox.h +++ b/microkde/kdeui/kbuttonbox.h @@ -12,24 +12,26 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __KBUTTONBOX__H__ #define __KBUTTONBOX__H__ #include <qwidget.h> +//Added by qt3to4: +#include <QResizeEvent> class QPushButton; class KButtonBoxPrivate; /** * Container widget for buttons. * * This class uses Qt layout control to place the buttons; can handle * both vertical and horizontal button placement. The default border * is now @p 0 (making it easier to deal with layouts). The space * between buttons is now more Motif compliant. * * @author Mario Weilguni <mweilguni@sime.com> @@ -39,25 +41,25 @@ class KButtonBoxPrivate; class KButtonBox : public QWidget { Q_OBJECT public: /** * Create an empty container for buttons. * * If @p _orientation is @p Vertical, the buttons inserted with * @ref addButton() are laid out from top to bottom, otherwise they * are laid out from left to right. */ - KButtonBox(QWidget *parent, Orientation _orientation = Horizontal, + KButtonBox(QWidget *parent, Qt::Orientation _orientation = Qt::Horizontal, int border = 0, int _autoborder = 6); /** * Free private data field */ ~KButtonBox(); /** * @return The minimum size needed to fit all buttons. * * This size is * calculated by the width/height of all buttons plus border/autoborder. diff --git a/microkde/kdeui/kguiitem.cpp b/microkde/kdeui/kguiitem.cpp index 828c5e6..c91ffb7 100644 --- a/microkde/kdeui/kguiitem.cpp +++ b/microkde/kdeui/kguiitem.cpp @@ -11,25 +11,25 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qregexp.h> #include <qstring.h> -#include <qiconset.h> +#include <qicon.h> #include <qpixmap.h> #include <assert.h> //US #include <kiconloader.h> #include <kdebug.h> #include "kguiitem.h" class KGuiItem::KGuiItemPrivate { public: KGuiItemPrivate() @@ -53,45 +53,45 @@ public: m_statusText = rhs.m_statusText; m_enabled = rhs.m_enabled; m_hasIcon = rhs.m_hasIcon; return *this; } QString m_text; QString m_toolTip; QString m_whatsThis; QString m_statusText; QString m_iconName; - QIconSet m_iconSet; + QIcon m_iconSet; bool m_hasIcon : 1; bool m_enabled : 1; }; KGuiItem::KGuiItem() { d = new KGuiItemPrivate; } KGuiItem::KGuiItem( const QString &text, const QString &iconName, const QString &toolTip, const QString &whatsThis ) { d = new KGuiItemPrivate; d->m_text = text; d->m_toolTip = toolTip; d->m_whatsThis = whatsThis; setIconName( iconName ); } -KGuiItem::KGuiItem( const QString &text, const QIconSet &iconSet, +KGuiItem::KGuiItem( const QString &text, const QIcon &iconSet, const QString &toolTip, const QString &whatsThis ) { d = new KGuiItemPrivate; d->m_text = text; d->m_toolTip = toolTip; d->m_whatsThis = whatsThis; setIconSet( iconSet ); } KGuiItem::KGuiItem( const KGuiItem &rhs ) : d( 0 ) { @@ -115,49 +115,49 @@ KGuiItem::~KGuiItem() { } QString KGuiItem::text() const { return d->m_text; } QString KGuiItem::plainText() const { QString stripped( d->m_text ); stripped.replace( QRegExp( "&(?!&)" ), QString::null ); return stripped; } -QIconSet KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const +QIcon KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const { if( d->m_hasIcon ) { if( !d->m_iconName.isEmpty()) { // some caching here would(?) come handy //US return instance->iconLoader()->loadIconSet( d->m_iconName, group, size ); return KGlobal::iconLoader()->loadIconSet( d->m_iconName); // here is a little problem that with delayed icon loading // we can't check if the icon really exists ... so what ... // if( set.isNull() ) // { // d->m_hasIcon = false; // return QIconSet(); // } // return set; } else { return d->m_iconSet; } } else - return QIconSet(); + return QIcon(); } QString KGuiItem::iconName() const { return d->m_iconName; } QString KGuiItem::toolTip() const { return d->m_toolTip; } QString KGuiItem::whatsThis() const { return d->m_whatsThis; @@ -168,35 +168,35 @@ bool KGuiItem::isEnabled() const return d->m_enabled; } bool KGuiItem::hasIcon() const { return d->m_hasIcon; } void KGuiItem::setText( const QString &text ) { d->m_text=text; } -void KGuiItem::setIconSet( const QIconSet &iconset ) +void KGuiItem::setIconSet( const QIcon &iconset ) { d->m_iconSet = iconset; d->m_iconName = QString::null; d->m_hasIcon = !iconset.isNull(); } void KGuiItem::setIconName( const QString &iconName ) { d->m_iconName = iconName; - d->m_iconSet = QIconSet(); + d->m_iconSet = QIcon(); d->m_hasIcon = !iconName.isEmpty(); } void KGuiItem::setToolTip( const QString &toolTip) { d->m_toolTip = toolTip; } void KGuiItem::setWhatsThis( const QString &whatsThis ) { d->m_whatsThis = whatsThis; } void KGuiItem::setEnabled( bool enabled ){ d->m_enabled = enabled; } diff --git a/microkde/kdeui/kguiitem.h b/microkde/kdeui/kguiitem.h index 0079bb4..6f92137 100644 --- a/microkde/kdeui/kguiitem.h +++ b/microkde/kdeui/kguiitem.h @@ -14,71 +14,71 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Many thanks to Simon tronical Hausmann */ #ifndef __kguiitem_h__ #define __kguiitem_h__ #include <qstring.h> -#include <qiconset.h> +#include <qicon.h> #include <qpixmap.h> -#include <qvaluelist.h> +#include <q3valuelist.h> //US#include <kicontheme.h> #include <kglobal.h> //US added the following files #include <kiconloader.h> class KGuiItem { public: KGuiItem(); KGuiItem( const QString &text, const QString &iconName = QString::null, const QString &toolTip = QString::null, const QString &whatsThis = QString::null ); - KGuiItem( const QString &text, const QIconSet &iconSet, + KGuiItem( const QString &text, const QIcon &iconSet, const QString &toolTip = QString::null, const QString &whatsThis = QString::null ); KGuiItem( const KGuiItem &rhs ); KGuiItem &operator=( const KGuiItem &rhs ); ~KGuiItem(); QString text() const; QString plainText() const; - QIconSet iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const; + QIcon iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const; #ifndef KDE_NO_COMPAT - QIconSet iconSet() const { return iconSet( KIcon::Small); } + QIcon iconSet() const { return iconSet( KIcon::Small); } #endif QString iconName() const; QString toolTip() const; QString whatsThis() const; bool isEnabled() const; bool hasIcon() const; #ifndef KDE_NO_COMPAT bool hasIconSet() const { return hasIcon(); } #endif void setText( const QString &text ); - void setIconSet( const QIconSet &iconset ); + void setIconSet( const QIcon &iconset ); void setIconName( const QString &iconName ); void setToolTip( const QString &tooltip ); void setWhatsThis( const QString &whatsThis ); void setEnabled( bool enable ); private: class KGuiItemPrivate; KGuiItemPrivate *d; }; /* vim: et sw=4 */ diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp index 462c44f..3d9173d 100644 --- a/microkde/kdeui/kjanuswidget.cpp +++ b/microkde/kdeui/kjanuswidget.cpp @@ -13,33 +13,41 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <qpixmap.h> #include <qbitmap.h> #include <qlayout.h> #include <qlabel.h> -#include <qwidgetstack.h> +#include <q3widgetstack.h> #include <qtabwidget.h> -#include <qlistview.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qgrid.h> +#include <q3listview.h> +#include <q3hbox.h> +#include <q3vbox.h> +#include <q3grid.h> #include <qpainter.h> -#include <qobjectlist.h> +#include <qobject.h> #include <qstringlist.h> +//Added by qt3to4: +#include <Q3HBoxLayout> +#include <Q3GridLayout> +#include <Q3PtrList> +#include <Q3Frame> +#include <QEvent> +#include <Q3VBoxLayout> +#include <QShowEvent> /*US #include <qbitmap.h> #include <qgrid.h> #include <qhbox.h> #include <qheader.h> #include <qlabel.h> #include <qlayout.h> #include <qobjectlist.h> #include <qpixmap.h> #include <qsplitter.h> #include <qtabwidget.h> #include <qvbox.h> @@ -56,31 +64,31 @@ #include "kjanuswidget.h" #include <klistview.h> */ #include <kseparator.h> #include <kdialog.h> // Access to some static members #include <kdebug.h> #include <klistview.h> #include "kjanuswidget.h" -class KJanusWidget::IconListItem : public QListBoxItem +class KJanusWidget::IconListItem : public Q3ListBoxItem { public: - IconListItem( QListBox *listbox, const QPixmap &pixmap, + IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, const QString &text ); - virtual int height( const QListBox *lb ) const; - virtual int width( const QListBox *lb ) const; + virtual int height( const Q3ListBox *lb ) const; + virtual int width( const Q3ListBox *lb ) const; int expandMinimumWidth( int width ); protected: const QPixmap &defaultPixmap(); void paint( QPainter *painter ); private: QPixmap mPixmap; int mMinimumWidth; }; class KJanusWidget::KJanusWidgetPrivate @@ -89,39 +97,39 @@ public: KJanusWidgetPrivate() : mNextPageIndex(0) { } int mNextPageIndex; // The next page index. // Dictionary for multipage modes. QMap<int,QWidget*> mIntToPage; // Reverse dictionary. Used because showPage() may be performance critical. QMap<QWidget*,int> mPageToInt; // Dictionary of title string associated with page. QMap<int, QString> mIntToTitle; }; -template class QPtrList<QListViewItem>; +template class Q3PtrList<Q3ListViewItem>; KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) : QWidget( parent, name ), mValid(false), mPageList(0), mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), mShowIconsInTreeList(false), d(0) { - QVBoxLayout *topLayout = new QVBoxLayout( this ); + Q3VBoxLayout *topLayout = new Q3VBoxLayout( this ); if( mFace == TreeList || mFace == IconList ) { d = new KJanusWidgetPrivate; - QFrame *page = 0; + Q3Frame *page = 0; if( mFace == TreeList ) { //US qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet"); /*US QSplitter *splitter = new QSplitter( this ); topLayout->addWidget( splitter, 10 ); mTreeListResizeMode = QSplitter::KeepSize; mTreeList = new KListView( splitter ); mTreeList->addColumn( QString::null ); mTreeList->header()->hide(); @@ -136,79 +144,79 @@ KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face ) // QFrame *p = new QFrame( splitter ); QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 ); hbox->addSpacing( KDialog::marginHint() ); page = new QFrame( p ); hbox->addWidget( page, 10 ); */ } else { - QHBoxLayout *hbox = new QHBoxLayout( topLayout ); + Q3HBoxLayout *hbox = new Q3HBoxLayout( topLayout ); mIconList = new IconListBox( this ); QFont listFont( mIconList->font() ); listFont.setBold( true ); mIconList->setFont( listFont ); mIconList->verticalScrollBar()->installEventFilter( this ); hbox->addWidget( mIconList ); connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage())); hbox->addSpacing( KDialog::marginHint() ); - page = new QFrame( this ); + page = new Q3Frame( this ); hbox->addWidget( page, 10 ); } // // Rest of page area. Title at top with a separator below and a // pagestack using all available space at bottom. // - QVBoxLayout *vbox = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + Q3VBoxLayout *vbox = new Q3VBoxLayout( page, 0, KDialog::spacingHint() ); mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" ); vbox->addWidget( mTitleLabel ); QFont titleFont( mTitleLabel->font() ); titleFont.setBold( true ); mTitleLabel->setFont( titleFont ); mTitleSep = new KSeparator( page ); - mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain ); + mTitleSep->setFrameStyle( Q3Frame::HLine|Q3Frame::Plain ); vbox->addWidget( mTitleSep ); - mPageStack = new QWidgetStack( page ); + mPageStack = new Q3WidgetStack( page ); connect(mPageStack, SIGNAL(aboutToShow(QWidget *)), SIGNAL(aboutToShowPage(QWidget *))); vbox->addWidget( mPageStack, 10 ); } else if( mFace == Tabbed ) { d = new KJanusWidgetPrivate; mTabControl = new QTabWidget( this ); mTabControl->setMargin (KDialog::marginHint()); topLayout->addWidget( mTabControl, 10 ); } else if( mFace == Swallow ) { mSwallowPage = new QWidget( this ); topLayout->addWidget( mSwallowPage, 10 ); } else { mFace = Plain; - mPlainPage = new QFrame( this ); + mPlainPage = new Q3Frame( this ); topLayout->addWidget( mPlainPage, 10 ); } /*US if ( kapp ) connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged())); */ mValid = true; setSwallowedWidget(0); // Set default size if 'mFace' is Swallow. } KJanusWidget::~KJanusWidget() @@ -236,213 +244,213 @@ KJanusWidget::~KJanusWidget() delete d; } bool KJanusWidget::isValid() const { return( mValid ); } -QFrame *KJanusWidget::plainPage() +Q3Frame *KJanusWidget::plainPage() { return( mPlainPage ); } int KJanusWidget::face() const { return( mFace ); } QWidget *KJanusWidget::FindParent() { if( mFace == Tabbed ) { return mTabControl; } else { return this; } } -QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header, +Q3Frame *KJanusWidget::addPage( const QStringList &items, const QString &header, const QPixmap &pixmap ) { if( mValid == false ) { kdDebug() << "addPage: Invalid object" << endl; return( 0 ); } - QFrame *page = new QFrame( FindParent(), "page" ); + Q3Frame *page = new Q3Frame( FindParent(), "page" ); addPageWidget( page, items, header, pixmap ); return page; } void KJanusWidget::pageGone( QObject *obj ) { // QObject* obj = (QObject*)sender(); removePage( static_cast<QWidget*>( obj ) ); } -void KJanusWidget::slotReopen( QListViewItem * item ) +void KJanusWidget::slotReopen( Q3ListViewItem * item ) { if( item ) item->setOpen( true ); } -QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header, +Q3Frame *KJanusWidget::addPage( const QString &itemName, const QString &header, const QPixmap &pixmap ) { QStringList items; items << itemName; return addPage(items, header, pixmap); } -QVBox *KJanusWidget::addVBoxPage( const QStringList &items, +Q3VBox *KJanusWidget::addVBoxPage( const QStringList &items, const QString &header, const QPixmap &pixmap ) { if( mValid == false ) { qDebug("addPage: Invalid object "); return( 0 ); } - QVBox *page = new QVBox(FindParent() , "vbox_page" ); + Q3VBox *page = new Q3VBox(FindParent() , "vbox_page" ); page->setSpacing( KDialog::spacingHintSmall() ); addPageWidget( page, items, header, pixmap ); return page; } -QVBox *KJanusWidget::addVBoxPage( const QString &itemName, +Q3VBox *KJanusWidget::addVBoxPage( const QString &itemName, const QString &header, const QPixmap &pixmap ) { QStringList items; items << itemName; return addVBoxPage(items, header, pixmap); } -QHBox *KJanusWidget::addHBoxPage( const QStringList &items, +Q3HBox *KJanusWidget::addHBoxPage( const QStringList &items, const QString &header, const QPixmap &pixmap ) { if( mValid == false ) { kdDebug() << "addPage: Invalid object" << endl; return( 0 ); } - QHBox *page = new QHBox(FindParent(), "hbox_page"); + Q3HBox *page = new Q3HBox(FindParent(), "hbox_page"); page->setSpacing( KDialog::spacingHint() ); addPageWidget( page, items, header, pixmap ); return page; } -QHBox *KJanusWidget::addHBoxPage( const QString &itemName, +Q3HBox *KJanusWidget::addHBoxPage( const QString &itemName, const QString &header, const QPixmap &pixmap ) { QStringList items; items << itemName; return addHBoxPage(items, header, pixmap); } -QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, +Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, const QStringList &items, const QString &header, const QPixmap &pixmap ) { if( mValid == false ) { kdDebug() << "addPage: Invalid object" << endl; return( 0 ); } - QGrid *page = new QGrid( n, dir, FindParent(), "page" ); + Q3Grid *page = new Q3Grid( n, dir, FindParent(), "page" ); page->setSpacing( KDialog::spacingHint() ); addPageWidget( page, items, header, pixmap ); return page; } -QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir, +Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir, const QString &itemName, const QString &header, const QPixmap &pixmap ) { QStringList items; items << itemName; return addGridPage(n, dir, items, header, pixmap); } -void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page) +void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page) { bool isTop = true; - QListViewItem *curTop = 0, *child, *last, *newChild; + Q3ListViewItem *curTop = 0, *child, *last, *newChild; unsigned int index = 1; QStringList curPath; for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) { QString name = (*it); bool isPath = ( index != items.count() ); // Find the first child. if (isTop) { child = mTreeList->firstChild(); } else { child = curTop->firstChild(); } // Now search for a child with the current Name, and if it we doesn't // find it, then remember the location of the last child. for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling()); if (last == 0 && child == 0) { // This node didn't have any children at all, lets just insert the // new child. if (isTop) - newChild = new QListViewItem(mTreeList, name); + newChild = new Q3ListViewItem(mTreeList, name); else - newChild = new QListViewItem(curTop, name); + newChild = new Q3ListViewItem(curTop, name); } else if (child != 0) { // we found the given name in this child. if (!isPath) { kdDebug() << "The element inserted was already in the TreeList box!" << endl; return; } else { // Ok we found the folder newChild = child; } } else { // the node had some children, but we didn't find the given name if (isTop) - newChild = new QListViewItem(mTreeList, last, name); + newChild = new Q3ListViewItem(mTreeList, last, name); else - newChild = new QListViewItem(curTop, last, name); + newChild = new Q3ListViewItem(curTop, last, name); } // Now make the element expandable if it is a path component, and make // ready for next loop if (isPath) { newChild->setExpandable(true); curTop = newChild; isTop = false; curPath << name; QString key = curPath.join("_/_"); if (mFolderIconMap.contains(key)) { @@ -450,25 +458,25 @@ void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &p newChild->setPixmap(0,p); } } else { if (mShowIconsInTreeList) { newChild->setPixmap(0, pixmap); } mTreeListToPageStack.insert(newChild, page); } } } -void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items, +void KJanusWidget::addPageWidget( Q3Frame *page, const QStringList &items, const QString &header,const QPixmap &pixmap ) { /*US the following signal causes a segmentation fault while closing the dialog. Why not just remove all pages in the destructor?? */ //US connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); // we have the SIGNAL(destroyed(QObject*) only in Qt3 #ifdef DESKTOP_VERSION // connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*))); #endif if( mFace == Tabbed ) { @@ -541,33 +549,33 @@ bool KJanusWidget::setSwallowedWidget( QWidget *widget ) if( mFace != Swallow || mValid == false ) { return( false ); } // // Remove current layout and make a new. // if( mSwallowPage->layout() != 0 ) { delete mSwallowPage->layout(); } - QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 ); + Q3GridLayout *gbox = new Q3GridLayout( mSwallowPage, 1, 1, 0 ); // // Hide old children // - QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please - for( uint i=0; i < l->count(); i++ ) + QObjectList l = mSwallowPage->children(); // silence please + for( uint i=0; i < l.count(); i++ ) { - QObject *o = l->at(i); + QObject *o = l.at(i); if( o->isWidgetType() ) { ((QWidget*)o)->hide(); } } // // Add new child or make default size // if( widget == 0 ) { gbox->addRowSpacing(0,100); @@ -588,34 +596,34 @@ bool KJanusWidget::setSwallowedWidget( QWidget *widget ) return( true ); } bool KJanusWidget::slotShowPage() { if( mValid == false ) { return( false ); } if( mFace == TreeList ) { - QListViewItem *node = mTreeList->selectedItem(); + Q3ListViewItem *node = mTreeList->selectedItem(); if( node == 0 ) { return( false ); } QWidget *stackItem = mTreeListToPageStack[node]; // Make sure to call through the virtual function showPage(int) return showPage(d->mPageToInt[stackItem]); } else if( mFace == IconList ) { - QListBoxItem *node = mIconList->item( mIconList->currentItem() ); + Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); if( node == 0 ) { return( false ); } QWidget *stackItem = mIconListToPageStack[node]; // Make sure to call through the virtual function showPage(int) return showPage(d->mPageToInt[stackItem]); } return( false ); } bool KJanusWidget::showPage( int index ) { @@ -637,39 +645,39 @@ bool KJanusWidget::showPage( QWidget *w ) return( false ); } if( mFace == TreeList || mFace == IconList ) { mPageStack->raiseWidget( w ); mActivePageWidget = w; int index = d->mPageToInt[w]; mTitleLabel->setText( d->mIntToTitle[index] ); if( mFace == TreeList ) { - QMap<QListViewItem *, QWidget *>::Iterator it; + QMap<Q3ListViewItem *, QWidget *>::Iterator it; for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ - QListViewItem *key = it.key(); + Q3ListViewItem *key = it.key(); QWidget *val = it.data(); if (val == w) { mTreeList->setSelected(key, true ); break; } } } else { - QMap<QListBoxItem *, QWidget *>::Iterator it; + QMap<Q3ListBoxItem *, QWidget *>::Iterator it; for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ - QListBoxItem *key = it.key(); + Q3ListBoxItem *key = it.key(); QWidget *val = it.data(); if (val == w) { mIconList->setSelected( key, true ); break; } } } } else if( mFace == Tabbed ) { mTabControl->showPage(w); mActivePageWidget = w; @@ -677,31 +685,31 @@ bool KJanusWidget::showPage( QWidget *w ) else { return( false ); } return( true ); } int KJanusWidget::activePageIndex() const { if( mFace == TreeList) { - QListViewItem *node = mTreeList->selectedItem(); + Q3ListViewItem *node = mTreeList->selectedItem(); if( node == 0 ) { return -1; } QWidget *stackItem = mTreeListToPageStack[node]; return d->mPageToInt[stackItem]; } else if (mFace == IconList) { - QListBoxItem *node = mIconList->item( mIconList->currentItem() ); + Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() ); if( node == 0 ) { return( false ); } QWidget *stackItem = mIconListToPageStack[node]; return d->mPageToInt[stackItem]; } else if( mFace == Tabbed ) { QWidget *widget = mTabControl->currentPage(); return( widget == 0 ? -1 : d->mPageToInt[widget] ); } else { return( -1 ); } } @@ -752,25 +760,25 @@ void KJanusWidget::slotFontChanged() if( mFace == IconList ) { QFont listFont( mIconList->font() ); listFont.setBold( true ); mIconList->setFont( listFont ); mIconList->invalidateHeight(); mIconList->invalidateWidth(); } } */ // makes the treelist behave like the list of kcontrol -void KJanusWidget::slotItemClicked(QListViewItem *it) +void KJanusWidget::slotItemClicked(Q3ListViewItem *it) { if(it && (it->childCount()>0)) it->setOpen(!it->isOpen()); } void KJanusWidget::setFocus() { if( mValid == false ) { return; } if( mFace == TreeList ) { mTreeList->setFocus(); } @@ -886,29 +894,29 @@ void KJanusWidget::setShowIconsInTreeList( bool state ) void KJanusWidget::setRootIsDecorated( bool state ) { if( mFace == TreeList ) { mTreeList->setRootIsDecorated(state); } } void KJanusWidget::unfoldTreeList( bool persist ) { if( mFace == TreeList ) { if( persist ) - connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); + connect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); else - disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) ); + disconnect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) ); - for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) + for( Q3ListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) item->setOpen( true ); } } void KJanusWidget::showEvent( QShowEvent * ) { if( mFace == TreeList ) { /*US QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); splitter->setResizeMode( mTreeList, mTreeListResizeMode ); */ @@ -944,58 +952,58 @@ bool KJanusWidget::eventFilter( QObject *o, QEvent *e ) } return QWidget::eventFilter( o, e ); } // // Code for the icon list box // KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, - WFlags f ) + Qt::WFlags f ) :KListBox( parent, name, f ), mShowAll(false), mHeightValid(false), mWidthValid(false) { } void KJanusWidget::IconListBox::updateMinimumHeight() { if( mShowAll == true && mHeightValid == false ) { int h = frameWidth()*2; - for( QListBoxItem *i = item(0); i != 0; i = i->next() ) + for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) { h += i->height( this ); } setMinimumHeight( h ); mHeightValid = true; } } void KJanusWidget::IconListBox::updateWidth() { if( mWidthValid == false ) { int maxWidth = 10; - for( QListBoxItem *i = item(0); i != 0; i = i->next() ) + for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) { int w = ((IconListItem *)i)->width(this); maxWidth = QMAX( w, maxWidth ); } - for( QListBoxItem *i = item(0); i != 0; i = i->next() ) + for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() ) { ((IconListItem *)i)->expandMinimumWidth( maxWidth ); } if( verticalScrollBar()->isVisible() ) { maxWidth += verticalScrollBar()->sizeHint().width(); } setFixedWidth( maxWidth + frameWidth()*2 ); mWidthValid = true; } @@ -1013,27 +1021,27 @@ void KJanusWidget::IconListBox::invalidateWidth() mWidthValid = false; } void KJanusWidget::IconListBox::setShowAll( bool showAll ) { mShowAll = showAll; mHeightValid = false; } -KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap, +KJanusWidget::IconListItem::IconListItem( Q3ListBox *listbox, const QPixmap &pixmap, const QString &text ) - : QListBoxItem( listbox ) + : Q3ListBoxItem( listbox ) { mPixmap = pixmap; if( mPixmap.isNull() == true ) { mPixmap = defaultPixmap(); } setText( text ); mMinimumWidth = 0; } int KJanusWidget::IconListItem::expandMinimumWidth( int width ) @@ -1074,38 +1082,38 @@ void KJanusWidget::IconListItem::paint( QPainter *painter ) //int wt = fm.boundingRect(text()).width(); int wp = mPixmap.width(); int ht = fm.lineSpacing(); int hp = mPixmap.height(); painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap ); if( text().isEmpty() == false ) { painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() ); } } -int KJanusWidget::IconListItem::height( const QListBox *lb ) const +int KJanusWidget::IconListItem::height( const Q3ListBox *lb ) const { if( text().isEmpty() == true ) { return( mPixmap.height() ); } else { return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 ); } } -int KJanusWidget::IconListItem::width( const QListBox *lb ) const +int KJanusWidget::IconListItem::width( const Q3ListBox *lb ) const { int wt = lb->fontMetrics().boundingRect(text()).width()+10; int wp = mPixmap.width() + 10; int w = QMAX( wt, wp ); return( QMAX( w, mMinimumWidth ) ); } void KJanusWidget::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } // TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to @@ -1113,40 +1121,40 @@ void KJanusWidget::virtual_hook( int, void* ) void KJanusWidget::removePage( QWidget *page ) { //US qDebug("KJanusWidget::removePage 1 %lu , %lu, %lu", d, page, &(d->mPageToInt)); if (!d || !(d->mPageToInt.contains(page))) { return; } int index = d->mPageToInt[page]; if ( mFace == TreeList ) { - QMap<QListViewItem*, QWidget *>::Iterator i; + QMap<Q3ListViewItem*, QWidget *>::Iterator i; for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) if (i.data()==page) { delete i.key(); mPageStack->removeWidget(page); mTreeListToPageStack.remove(i); d->mIntToTitle.remove(index); d->mPageToInt.remove(page); d->mIntToPage.remove(index); break; } } else if ( mFace == IconList ) { - QMap<QListBoxItem*, QWidget *>::Iterator i; + QMap<Q3ListBoxItem*, QWidget *>::Iterator i; for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) if (i.data()==page) { delete i.key(); mPageStack->removeWidget(page); mIconListToPageStack.remove(i); d->mIntToTitle.remove(index); d->mPageToInt.remove(page); d->mIntToPage.remove(index); break; } } diff --git a/microkde/kdeui/kjanuswidget.h b/microkde/kdeui/kjanuswidget.h index 6d3f23d..72465ea 100644 --- a/microkde/kdeui/kjanuswidget.h +++ b/microkde/kdeui/kjanuswidget.h @@ -11,48 +11,54 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _KJANUS_WIDGET_H_ #define _KJANUS_WIDGET_H_ -#include <qptrlist.h> +#include <q3ptrlist.h> #include <qwidget.h> #include <qmap.h> -#include <qgrid.h> +#include <q3grid.h> +//Added by qt3to4: +#include <QShowEvent> +#include <Q3Frame> +#include <QPixmap> +#include <QLabel> +#include <QEvent> #include <klistbox.h> /*US #include <qptrlist.h> #include <qpixmap.h> #include <qsplitter.h> #include <qstringlist.h> #include <qmap.h> */ class KSeparator; class KListView; -class QWidgetStack; +class Q3WidgetStack; class QLabel; class QTabWidget; -class QListViewItem; -class QVBox; -class QHBox; +class Q3ListViewItem; +class Q3VBox; +class Q3HBox; /** * Provides a number of ready to use layouts (faces). It is used * as an internal widget in @ref KDialogBase, but can also used as a * widget of its own. * * It provides TreeList, IconList, Tabbed, Plain and Swallow layouts. * * The TreeList face provides a list in the left area and pages in the * right. The area are separated by a movable splitter. The style is somewhat * similar to the layout in the Control Center. A page is raised by * selecting the corresponding tree list item. @@ -93,25 +99,25 @@ class QHBox; * * @short Easy to use widget with many layouts * @author Espen Sand (espen@kde.org) */ class KJanusWidget : public QWidget { Q_OBJECT private: class IconListBox : public KListBox { public: - IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 ); + IconListBox( QWidget *parent=0, const char *name=0, Qt::WFlags f=0 ); void updateMinimumHeight(); void updateWidth(); void invalidateHeight(); void invalidateWidth(); void setShowAll( bool showAll ); private: bool mShowAll; bool mHeightValid; bool mWidthValid; }; @@ -184,141 +190,141 @@ class KJanusWidget : public QWidget * Returns the recommended size for the widget in order to be displayed * properly. * * @return The recommended size. */ virtual QSize sizeHint() const; /** * Returns the empty widget that is available in Plain mode. * * @return The widget or 0 if the face in not Plain. */ - virtual QFrame *plainPage(); + virtual Q3Frame *plainPage(); /** * Add a new page when the class is used in TreeList, IconList or Tabbed * mode. The returned widget is empty and you must add your widgets * as children to this widget. In most cases you must create a layout * manager and associate it with this widget as well. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. * * @param item String used in the list or Tab item. * @param header A longer string used in TreeList and IconList mode to * describe the contents of a page. If empty, the item string * will be used instead. * @param pixmap Used in IconList mode or in TreeList mode. You should * prefer a pixmap with size 32x32 pixels. * * @return The empty page or 0 if the face is not TreeList, IconList or * Tabbed. */ - virtual QFrame *addPage(const QString &item,const QString &header=QString::null, + virtual Q3Frame *addPage(const QString &item,const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * This is like addPage just above, with the difference that the first * element is a list of strings. These strings are used to form a path * of folders down to the given page. The initial elements are names * for the folders, while the last element is the name of the page. * Note: This does yet only work for the TreeList face. Later this may * be added for the IconList face too. In other faces than the * TreeList, all the strings except the last one is ignored. * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. **/ - virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null, + virtual Q3Frame *addPage(const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * Add a new page when the class is used in TreeList, IconList or Tabbed * mode. The returned widget is empty and you must add your widgets * as children to this widget. The returned widget is a @ref QVBox * so it contains a QVBoxLayout layout that lines up the child widgets * are vertically. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. * * @param item String used in the list or Tab item. * @param header A longer string used in TreeList and IconList mode to * describe the contents of a page. If empty, the item string * will be used instead. * @param pixmap Used in IconList mode or in TreeList mode. You should * prefer a pixmap with size 32x32 pixels. * * @return The empty page or 0 if the face is not TreeList, IconList or * Tabbed. */ - virtual QVBox *addVBoxPage( const QString &item, + virtual Q3VBox *addVBoxPage( const QString &item, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * This is like addVBoxPage just above, with the difference that the first * element is a list of strings. These strings are used to form a path * of folders down to the given page. The initial elements are names * for the folders, while the last element is the name of the page. * Note: This does yet only work for the TreeList face. Later this may * be added for the IconList face too. In other faces than the * TreeList, all the strings except the last one is ignored. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. **/ - virtual QVBox *addVBoxPage( const QStringList &items, + virtual Q3VBox *addVBoxPage( const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * Add a new page when the class is used in TreeList, IconList or Tabbed * mode. The returned widget is empty and you must add your widgets * as children to this widget. The returned widget is a @ref QHBox * so it contains a QHBoxLayout layout that lines up the child widgets * are horizontally. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. * * @param item String used in the list or Tab item. * @param header A longer string used in TreeList and IconList mode to * describe the contents of a page. If empty, the item string * will be used instead. * @param pixmap Used in IconList mode or in TreeList mode. You should * prefer a pixmap with size 32x32 pixels. * * @return The empty page or 0 if the face is not TreeList, IconList or * Tabbed. */ - virtual QHBox *addHBoxPage( const QString &itemName, + virtual Q3HBox *addHBoxPage( const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * This is like addHBoxPage just above, with the difference that the first * element is a list of strings. These strings are used to form a path * of folders down to the given page. The initial elements are names * for the folders, while the last element is the name of the page. * Note: This does yet only work for the TreeList face. Later this may * be added for the IconList face too. In other faces than the * TreeList, all the strings except the last one is ignored. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. **/ - virtual QHBox *addHBoxPage( const QStringList &items, + virtual Q3HBox *addHBoxPage( const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * Add a new page when the class is used in either TreeList or Tabbed * mode. The returned widget is empty and you must add your widgets * as children to this widget. The returned widget is a @ref QGrid * so it contains a QGridLayout layout that places up the child widgets * in a grid. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. @@ -328,43 +334,43 @@ class KJanusWidget : public QWidget * @param dir Can be QGrid::Horizontal or QGrid::Vertical. * @param item String used in the list or Tab item. * @param header A longer string used in TreeList and IconList mode to * describe the contents of a page. If empty, the item string * will be used instead. * @param pixmap Used in IconList mode or in TreeList mode. You should * prefer a pixmap with size 32x32 pixels. * * @return The empty page or 0 if the face is not TreeList, IconList or * Tabbed. */ //US changed Orientation into Direction for compatibility - virtual QGrid *addGridPage( int n, QGrid::Direction dir, + virtual Q3Grid *addGridPage( int n, Qt::Orientation dir, const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * This is like addGridPage just above, with the difference that the first * element is a list of strings. These strings are used to form a path * of folders down to the given page. The initial elements are names * for the folders, while the last element is the name of the page. * Note: This does yet only work for the TreeList face. Later this may * be added for the IconList face too. In other faces than the * TreeList, all the strings except the last one is ignored. * * Deleting the returned frame will cause the listitem or tab to be * removed (you can re-add a page with the same name later. **/ //US changed Orientation into Direction for compatibility - virtual QGrid *addGridPage( int n, QGrid::Direction dir, + virtual Q3Grid *addGridPage( int n, Qt::Orientation dir, const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap() ); /** * @short Removes a page created with @ref addPage, @ref addVBoxPage, * @ref addHBoxPage or @ref addGridPage. If the page has already * been deleted or has already been removed, nothing happens. The widget * itself is not deleted. * * @param page The widget returned by @ref addPage , @ref addVBoxPage , * @ref addHBoxPage or @ref addGridPage . @@ -508,56 +514,56 @@ class KJanusWidget : public QWidget * This function is used internally when in IconList mode. If you * reimplement this class a make your own event filter, make sure to * call this function from your filter. * * @param o Object that has received an event. * @param e The event. */ virtual bool eventFilter( QObject *o, QEvent *e ); private slots: bool slotShowPage(); //US not yet implemented void slotFontChanged(); - void slotItemClicked(QListViewItem *it); + void slotItemClicked(Q3ListViewItem *it); void pageGone( QObject *obj); // signal from the added page's "destroyed" signal - void slotReopen(QListViewItem *item); + void slotReopen(Q3ListViewItem *item); protected: bool showPage( QWidget *w ); - void addPageWidget( QFrame *page, const QStringList &items, + void addPageWidget( Q3Frame *page, const QStringList &items, const QString &header, const QPixmap &pixmap ); - void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page); + void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page); QWidget *FindParent(); private: bool mValid; // Obsolete members. Remove in KDE 4. - QPtrList<QWidget> *mPageList; + Q3PtrList<QWidget> *mPageList; QStringList *mTitleList; int mFace; KListView *mTreeList; IconListBox *mIconList; - QWidgetStack *mPageStack; + Q3WidgetStack *mPageStack; QLabel *mTitleLabel; QTabWidget *mTabControl; - QFrame *mPlainPage; + Q3Frame *mPlainPage; QWidget *mSwallowPage; QWidget *mActivePageWidget; KSeparator *mTitleSep; //US QSplitter::ResizeMode mTreeListResizeMode; bool mShowIconsInTreeList; - QMap<QListViewItem *, QWidget *> mTreeListToPageStack; - QMap<QListBoxItem *, QWidget *> mIconListToPageStack; + QMap<Q3ListViewItem *, QWidget *> mTreeListToPageStack; + QMap<Q3ListBoxItem *, QWidget *> mIconListToPageStack; QMap<QString, QPixmap> mFolderIconMap; QMap<QString, QStringList> mChildrenNames; QMap<QString, QWidget *> mChildPages; public: class IconListItem; protected: virtual void virtual_hook( int id, void* data ); private: class KJanusWidgetPrivate; KJanusWidgetPrivate *d; }; diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp index c65b892..71020b3 100644 --- a/microkde/kdeui/klistbox.cpp +++ b/microkde/kdeui/klistbox.cpp @@ -7,69 +7,75 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qtimer.h> +//Added by qt3to4: +#include <QEvent> +#include <QMouseEvent> +#include <QKeyEvent> +#include <QFocusEvent> #include <kglobalsettings.h> //US#include <kcursor.h> #include <kapplication.h> //US#include <kipc.h> #include <kdebug.h> #include "klistbox.h" #ifdef Q_WS_X11 +#include <QX11Info> #include <X11/Xlib.h> #endif #ifdef _WIN32_ #define Q_WS_QWS #endif -KListBox::KListBox( QWidget *parent, const char *name, WFlags f ) - : QListBox( parent, name, f ) +KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f ) + : Q3ListBox( parent, name, f ) { connect( this, SIGNAL( onViewport() ), this, SLOT( slotOnViewport() ) ); - connect( this, SIGNAL( onItem( QListBoxItem * ) ), - this, SLOT( slotOnItem( QListBoxItem * ) ) ); + connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ), + this, SLOT( slotOnItem( Q3ListBoxItem * ) ) ); - connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *, + connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *, const QPoint & ) ), - this, SLOT( slotMouseButtonClicked( int, QListBoxItem *, + this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *, const QPoint & ) ) ); /*US slotSettingsChanged(KApplication::SETTINGS_MOUSE); if (kapp) { connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); kapp->addKipcEventMask( KIPC::SettingsChanged ); } */ m_pCurrentItem = 0L; //US set single to true m_bUseSingle = true; m_pAutoSelect = new QTimer( this ); connect( m_pAutoSelect, SIGNAL( timeout() ), this, SLOT( slotAutoSelect() ) ); } -void KListBox::slotOnItem( QListBoxItem *item ) +void KListBox::slotOnItem( Q3ListBoxItem *item ) { /*US if ( item && m_bChangeCursorOverItem && m_bUseSingle ) viewport()->setCursor( KCursor().handCursor() ); */ if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) { m_pAutoSelect->start( m_autoSelectDelay, true ); m_pCurrentItem = item; } } void KListBox::slotOnViewport() @@ -130,72 +136,72 @@ void KListBox::slotAutoSelect() if( index( m_pCurrentItem ) == -1 ) return; //Give this widget the keyboard focus. if( !hasFocus() ) setFocus(); #ifdef Q_WS_X11 //FIXME Window root; Window child; int root_x, root_y, win_x, win_y; uint keybstate; - XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, + XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, &root_x, &root_y, &win_x, &win_y, &keybstate ); #endif - QListBoxItem* previousItem = item( currentItem() ); + Q3ListBoxItem* previousItem = item( currentItem() ); setCurrentItem( m_pCurrentItem ); if( m_pCurrentItem ) { #ifndef Q_WS_QWS //FIXME //Shift pressed? if( (keybstate & ShiftMask) ) { #endif bool block = signalsBlocked(); blockSignals( true ); #ifndef Q_WS_QWS //FIXME //No Ctrl? Then clear before! if( !(keybstate & ControlMask) ) clearSelection(); #endif //US in my QT version it is called isSelected() So what is right? //US bool select = !m_pCurrentItem->isSelected(); bool select = !m_pCurrentItem->selected(); bool update = viewport()->isUpdatesEnabled(); viewport()->setUpdatesEnabled( false ); bool down = index( previousItem ) < index( m_pCurrentItem ); - QListBoxItem* it = down ? previousItem : m_pCurrentItem; + Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem; for (;it ; it = it->next() ) { if ( down && it == m_pCurrentItem ) { setSelected( m_pCurrentItem, select ); break; } if ( !down && it == previousItem ) { setSelected( previousItem, select ); break; } setSelected( it, select ); } blockSignals( block ); viewport()->setUpdatesEnabled( update ); triggerUpdate( false ); emit selectionChanged(); - if( selectionMode() == QListBox::Single ) + if( selectionMode() == Q3ListBox::Single ) emit selectionChanged( m_pCurrentItem ); } #ifndef Q_WS_QWS //FIXME else if( (keybstate & ControlMask) ) setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() ); #endif else { bool block = signalsBlocked(); blockSignals( true ); //US in my QT version it is called isSelected() So what is right? //US if( !m_pCurrentItem->isSelected() ) @@ -204,32 +210,32 @@ void KListBox::slotAutoSelect() blockSignals( block ); setSelected( m_pCurrentItem, true ); } #ifndef Q_WS_QWS //FIXME } else kdDebug() << "Thats not supposed to happen!!!!" << endl; #endif } -void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) +void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos ) { #ifdef Q_WS_X11 //FIXME Window root; Window child; int root_x, root_y, win_x, win_y; uint keybstate; - XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, + XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, &root_x, &root_y, &win_x, &win_y, &keybstate ); #endif m_pAutoSelect->stop(); #ifndef Q_WS_QWS //FIXME //Dont emit executed if in SC mode and Shift or Ctrl are pressed if( !( m_bUseSingle && ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { #endif emit executed( item ); emit executed( item, pos ); #ifndef Q_WS_QWS //FIXME @@ -237,78 +243,78 @@ void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) #endif } // // 2000-16-01 Espen Sand // This widget is used in dialogs. It should ignore // F1 (and combinations) and Escape since these are used // to start help or close the dialog. This functionality // should be done in QListView but it is not (at least now) // void KListBox::keyPressEvent(QKeyEvent *e) { - if( e->key() == Key_Escape ) + if( e->key() == Qt::Key_Escape ) { e->ignore(); } - else if( e->key() == Key_F1 ) + else if( e->key() == Qt::Key_F1 ) { e->ignore(); } else { - QListBox::keyPressEvent(e); + Q3ListBox::keyPressEvent(e); } } void KListBox::focusOutEvent( QFocusEvent *fe ) { m_pAutoSelect->stop(); - QListBox::focusOutEvent( fe ); + Q3ListBox::focusOutEvent( fe ); } void KListBox::leaveEvent( QEvent *e ) { m_pAutoSelect->stop(); - QListBox::leaveEvent( e ); + Q3ListBox::leaveEvent( e ); } void KListBox::contentsMousePressEvent( QMouseEvent *e ) { - if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) { + if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) { bool block = signalsBlocked(); blockSignals( true ); clearSelection(); blockSignals( block ); } - QListBox::contentsMousePressEvent( e ); + Q3ListBox::contentsMousePressEvent( e ); } void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) { - QListBox::contentsMouseDoubleClickEvent( e ); + Q3ListBox::contentsMouseDoubleClickEvent( e ); - QListBoxItem* item = itemAt( e->pos() ); + Q3ListBoxItem* item = itemAt( e->pos() ); if( item ) { emit doubleClicked( item, e->globalPos() ); - if( (e->button() == LeftButton) && !m_bUseSingle ) + if( (e->button() == Qt::LeftButton) && !m_bUseSingle ) emitExecute( item, e->globalPos() ); } } -void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ) +void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos ) { - if( (btn == LeftButton) && item ) + if( (btn == Qt::LeftButton) && item ) emitExecute( item, pos ); } void KListBox::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } //US #include "klistbox.moc" diff --git a/microkde/kdeui/klistbox.h b/microkde/kdeui/klistbox.h index 8023780..5ec514b 100644 --- a/microkde/kdeui/klistbox.h +++ b/microkde/kdeui/klistbox.h @@ -9,104 +9,109 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KLISTBOX_H #define KLISTBOX_H -#include <qlistbox.h> +#include <q3listbox.h> +//Added by qt3to4: +#include <QMouseEvent> +#include <QFocusEvent> +#include <QKeyEvent> +#include <QEvent> /** * Extends the functionality of @ref QListBox to honor the system * wide settings for Single Click/Double Click mode, Auto Selection and * Change Cursor over Link. * * There is a new signal @ref executed(). It gets connected to either * @ref QListBox::clicked() or @ref QListBox::doubleClicked() * depending on the KDE wide Single Click/Double Click settings. It is * strongly recomended that you use this signal instead of the above * mentioned. This way you don't need to care about the current * settings. If you want to get informed when the user selects * something connect to the @ref QListBox::selectionChanged() signal. * * @short A variant of @ref QListBox that honors KDE's system-wide settings. **/ -class KListBox : public QListBox +class KListBox : public Q3ListBox { Q_OBJECT public: - KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); + KListBox( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 ); signals: /** * Emitted whenever the user executes an listbox item. * * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listbox item. * * Note that you may not delete any @ref QListBoxItem objects in slots * connected to this signal. */ - void executed( QListBoxItem *item ); + void executed( Q3ListBoxItem *item ); /** * Emitted whenever the user executes an listbox item. * * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listbox item. * @param pos is the position where the user has clicked * * Note that you may not delete any @ref QListBoxItem objects in slots * connected to this signal. */ - void executed( QListBoxItem *item, const QPoint &pos ); + void executed( Q3ListBoxItem *item, const QPoint &pos ); /** * This signal gets emitted whenever the user double clicks into the * listbox. * * @param item The pointer to the clicked listbox item. * @param pos The position where the user has clicked. * * Note that you may not delete any @ref QListBoxItem objects in slots * connected to this signal. * * This signal is more or less here for the sake of completeness. * You should normally not need to use this. In most cases it's better * to use @ref executed() instead. */ - void doubleClicked( QListBoxItem *item, const QPoint &pos ); + void doubleClicked( Q3ListBoxItem *item, const QPoint &pos ); protected slots: - void slotOnItem( QListBoxItem *item ); + void slotOnItem( Q3ListBoxItem *item ); void slotOnViewport(); //US void slotSettingsChanged(int); /** * Auto selection happend. */ void slotAutoSelect(); protected: - void emitExecute( QListBoxItem *item, const QPoint &pos ); + void emitExecute( Q3ListBoxItem *item, const QPoint &pos ); /** * @reimplemented */ virtual void keyPressEvent(QKeyEvent *e); /** * @reimplemented */ virtual void focusOutEvent( QFocusEvent *fe ); /** * @reimplemented */ @@ -114,28 +119,28 @@ protected: /** * @reimplemented */ virtual void contentsMousePressEvent( QMouseEvent *e ); /** * @reimplemented */ virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e ); bool m_bUseSingle; //US bool m_bChangeCursorOverItem; - QListBoxItem* m_pCurrentItem; + Q3ListBoxItem* m_pCurrentItem; QTimer* m_pAutoSelect; int m_autoSelectDelay; private slots: - void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ); + void slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos ); protected: virtual void virtual_hook( int id, void* data ); private: class KListBoxPrivate; KListBoxPrivate *d; }; #endif diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 60f3084..0e98160 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp @@ -9,74 +9,89 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qdragobject.h> +#include <q3dragobject.h> #include <qtimer.h> -#include <qheader.h> +#include <q3header.h> #include <qcursor.h> #include <qtooltip.h> #include <qstyle.h> #include <qpainter.h> +//Added by qt3to4: +#include <QDragLeaveEvent> +#include <QKeyEvent> +#include <Q3ValueList> +#include <Q3PtrList> +#include <QPixmap> +#include <QDragEnterEvent> +#include <QDragMoveEvent> +#include <QDropEvent> +#include <QResizeEvent> +#include <QFocusEvent> +#include <QMouseEvent> +#include <QEvent> +#include <QPaintEvent> #include <kglobalsettings.h> #include <kconfig.h> #include <kconfigbase.h> //US #include <kcursor.h> #include <kapplication.h> //US #include <kipc.h> #include <kdebug.h> #ifdef _WIN32_ #define Q_WS_QWS #endif #ifndef _WIN32_ #define private public -#include <qlistview.h> +#include <q3listview.h> #undef private #endif #include "klistview.h" //US #include "klistviewlineedit.h" #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif +#include <Q3Action> // /*US -class KListView::Tooltip : public QToolTip +class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */ { public: Tooltip (KListView* parent, QToolTipGroup* group = 0L); virtual ~Tooltip () {} protected: // */ /** * Reimplemented from QToolTip for internal reasons. */ // /*US virtual void maybeTip (const QPoint&); private: KListView* mParent; }; KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) - : QToolTip (parent, group), + : /* XXX:hacker:XXX: QToolTip (parent, group), */ mParent (parent) { } void KListView::Tooltip::maybeTip (const QPoint&) { // FIXME } // */ class KListView::KListViewPrivate { @@ -114,38 +129,38 @@ public: showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()), mDropVisualizerWidth (4) { renameable += 0; //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); } ~KListViewPrivate () { //US delete editor; } - QListViewItem* pCurrentItem; + Q3ListViewItem* pCurrentItem; QTimer autoSelect; int autoSelectDelay; QTimer dragExpand; - QListViewItem* dragOverItem; + Q3ListViewItem* dragOverItem; QPoint dragOverPoint; QPoint startDragPos; int dragDelay; //US KListViewLineEdit *editor; - QValueList<int> renameable; + Q3ValueList<int> renameable; bool cursorInExecuteArea:1; bool bUseSingle:1; bool bChangeCursorOverItem:1; bool itemsMovable:1; bool selectedBySimpleMove : 1; bool selectedUsingMouse:1; bool itemsRenameable:1; bool validDrag:1; bool dragEnabled:1; bool autoOpen:1; bool dropVisualizer:1; @@ -161,26 +176,26 @@ public: //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX int selectionDirection; int tooltipColumn; SelectionModeExt selectionMode; int contextMenuKey; bool showContextMenusOnPress; QRect mOldDropVisualizer; int mDropVisualizerWidth; QRect mOldDropHighlighter; - QListViewItem *afterItemDrop; - QListViewItem *parentItemDrop; + Q3ListViewItem *afterItemDrop; + Q3ListViewItem *parentItemDrop; QColor alternateBackground; }; /*US KListViewLineEdit::KListViewLineEdit(KListView *parent) : KLineEdit(parent->viewport()), item(0), col(0), p(parent) { setFrame( false ); hide(); connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); } @@ -217,59 +232,59 @@ void KListViewLineEdit::load(QListViewItem *i, int c) fieldW -= d; } setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); show(); setFocus(); } */ /* Helper functions to for * tabOrderedRename functionality. */ -static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) +static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir) { if (pi) { // Find the next renameable column in the current row for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) if (pl->isRenameable(start)) return start; } return -1; } -static QListViewItem *prevItem (QListViewItem *pi) +static Q3ListViewItem *prevItem (Q3ListViewItem *pi) { - QListViewItem *pa = pi->itemAbove(); + Q3ListViewItem *pa = pi->itemAbove(); /* Does what the QListViewItem::previousSibling() * of my dreams would do. */ if (pa && pa->parent() == pi->parent()) return pa; return NULL; } -static QListViewItem *lastQChild (QListViewItem *pi) +static Q3ListViewItem *lastQChild (Q3ListViewItem *pi) { if (pi) { /* Since there's no QListViewItem::lastChild(). * This finds the last sibling for the given * item. */ - for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) + for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) pi = pt; } return pi; } /*US void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) { const int ncols = p->columns(); const int dir = forward ? +1 : -1; const int restart = forward ? 0 : (ncols - 1); QListViewItem *top = (pitem && pitem->parent()) @@ -319,28 +334,28 @@ void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool f #ifdef KeyPress #undef KeyPress #endif bool KListViewLineEdit::event (QEvent *pe) { if (pe->type() == QEvent::KeyPress) { QKeyEvent *k = (QKeyEvent *) pe; if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && p->tabOrderedRenaming() && p->itemsRenameable() && - !(k->state() & ControlButton || k->state() & AltButton)) + !(k->state() & Qt::ControlButton || k->state() & AltButton)) { selectNextCell(item, col, - (k->key() == Key_Tab && !(k->state() & ShiftButton))); + (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton))); return true; } } return KLineEdit::event(pe); } void KListViewLineEdit::keyPressEvent(QKeyEvent *e) { if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) terminate(true); else if(e->key() == Qt::Key_Escape) @@ -397,37 +412,37 @@ void KListViewLineEdit::paintEvent( QPaintEvent *e ) // selection changed -> terminate. As our "item" can be already deleted, // we can't call terminate(false), because that would emit done() with // a dangling pointer to "item". void KListViewLineEdit::slotSelectionChanged() { item = 0; col = 0; hide(); } */ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) - : QListView( parent, name ), + : Q3ListView( parent, name ), d (new KListViewPrivate (this)) { #ifndef DESKTOP_VERSION if ( emulateRightMouse ) QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif //US setDragAutoScroll(true); connect( this, SIGNAL( onViewport() ), this, SLOT( slotOnViewport() ) ); - connect( this, SIGNAL( onItem( QListViewItem * ) ), - this, SLOT( slotOnItem( QListViewItem * ) ) ); + connect( this, SIGNAL( onItem( Q3ListViewItem * ) ), + this, SLOT( slotOnItem( Q3ListViewItem * ) ) ); connect (this, SIGNAL(contentsMoving(int,int)), this, SLOT(cleanDropVisualizer())); connect (this, SIGNAL(contentsMoving(int,int)), this, SLOT(cleanItemHighlighter())); /*US slotSettingsChanged(KApplication::SETTINGS_MOUSE); if (kapp) { connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); @@ -436,83 +451,83 @@ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse */ slotSettingsChanged(1); //US do this to initialize the connections connect(&d->autoSelect, SIGNAL( timeout() ), this, SLOT( slotAutoSelect() ) ); connect(&d->dragExpand, SIGNAL( timeout() ), this, SLOT( slotDragExpand() ) ); // context menu handling if (d->showContextMenusOnPress) { - connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), - this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); + connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)), + this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); } else { - connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), - this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); + connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)), + this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); } - connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), - this, SLOT (emitContextMenu (KListView*, QListViewItem*))); + connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)), + this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*))); //qDebug("KListView::KListView make alternate color configurable"); d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); } KListView::~KListView() { delete d; } bool KListView::isExecuteArea( const QPoint& point ) { if ( itemAt( point ) ) return isExecuteArea( point.x() ); return false; } QSize KListView::sizeHint() const { //qDebug("KListView::QSize sizeHint() "); #ifdef DESKTOP_VERSION - return QListView::sizeHint(); + return Q3ListView::sizeHint(); #else return QSize ( 40, 40 ); #endif } bool KListView::isExecuteArea( int x ) { if( allColumnsShowFocus() ) return true; else { int offset = 0; int width = columnWidth( 0 ); int pos = header()->mapToIndex( 0 ); for ( int index = 0; index < pos; index++ ) offset += columnWidth( header()->mapToSection( index ) ); x += contentsX(); // in case of a horizontal scrollbar return ( x > offset && x < ( offset + width ) ); } } -void KListView::slotOnItem( QListViewItem *item ) +void KListView::slotOnItem( Q3ListViewItem *item ) { QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { d->autoSelect.start( d->autoSelectDelay, true ); d->pCurrentItem = item; } } void KListView::slotOnViewport() { if ( d->bChangeCursorOverItem ) viewport()->unsetCursor(); @@ -525,30 +540,30 @@ void KListView::slotSettingsChanged(int category) { //qDebug("KListView::slotSettingsChanged has to be verified"); switch (category) { //US I create my private category (=1) to set the settings case 1: d->dragDelay = 2; //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); - disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); + disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int))); if( d->bUseSingle ) - connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); + connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int))); //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); if( !d->bUseSingle || !d->bChangeCursorOverItem ) viewport()->unsetCursor(); break; /*US case KApplication::SETTINGS_MOUSE: d->dragDelay = KGlobalSettings::dndEventDelay(); @@ -602,65 +617,65 @@ void KListView::slotAutoSelect() return; if (!isActiveWindow()) { d->autoSelect.stop(); return; } //Give this widget the keyboard focus. if( !hasFocus() ) setFocus(); - QListViewItem* previousItem = currentItem(); + Q3ListViewItem* previousItem = currentItem(); setCurrentItem( d->pCurrentItem ); #if 0 #ifndef Q_WS_QWS // FIXME(E): Implement for Qt Embedded if( d->pCurrentItem ) { //Shift pressed? if( (keybstate & ShiftMask) ) { bool block = signalsBlocked(); blockSignals( true ); //No Ctrl? Then clear before! if( !(keybstate & ControlMask) ) clearSelection(); bool select = !d->pCurrentItem->isSelected(); bool update = viewport()->isUpdatesEnabled(); viewport()->setUpdatesEnabled( false ); bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); - QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); + Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); for ( ; lit.current(); ++lit ) { if ( down && lit.current() == d->pCurrentItem ) { d->pCurrentItem->setSelected( select ); break; } if ( !down && lit.current() == previousItem ) { previousItem->setSelected( select ); break; } lit.current()->setSelected( select ); } blockSignals( block ); viewport()->setUpdatesEnabled( update ); triggerUpdate(); emit selectionChanged(); - if( selectionMode() == QListView::Single ) + if( selectionMode() == Q3ListView::Single ) emit selectionChanged( d->pCurrentItem ); } else if( (keybstate & ControlMask) ) setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); else { bool block = signalsBlocked(); blockSignals( true ); if( !d->pCurrentItem->isSelected() ) clearSelection(); blockSignals( block ); @@ -675,55 +690,55 @@ void KListView::slotAutoSelect() } void KListView::slotHeaderChanged() { if (d->fullWidth && columns()) { int w = 0; for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); } } -void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) +void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c) { // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { // Double click mode ? if ( !d->bUseSingle ) { emit executed( item ); emit executed( item, pos, c ); } else { //US special implementation for embedded systems d->autoSelect.stop(); //Dont emit executed if in SC mode and Shift or Ctrl are pressed - if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { + if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) { // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { emit executed( item ); emit executed( item, pos, c ); } } } } void KListView::focusInEvent( QFocusEvent *fe ) { // kdDebug()<<"KListView::focusInEvent()"<<endl; - QListView::focusInEvent( fe ); + Q3ListView::focusInEvent( fe ); if ((d->selectedBySimpleMove) && (d->selectionMode == FileManager) && (fe->reason()!=QFocusEvent::Popup) && (fe->reason()!=QFocusEvent::ActiveWindow) && (currentItem()!=0)) { currentItem()->setSelected(true); currentItem()->repaint(); emit selectionChanged(); }; } @@ -738,102 +753,102 @@ void KListView::focusOutEvent( QFocusEvent *fe ) && (d->selectionMode == FileManager) && (fe->reason()!=QFocusEvent::Popup) && (fe->reason()!=QFocusEvent::ActiveWindow) && (currentItem()!=0) /*US && (!d->editor->isVisible()) */ ) { currentItem()->setSelected(false); currentItem()->repaint(); emit selectionChanged(); }; - QListView::focusOutEvent( fe ); + Q3ListView::focusOutEvent( fe ); } void KListView::leaveEvent( QEvent *e ) { d->autoSelect.stop(); - QListView::leaveEvent( e ); + Q3ListView::leaveEvent( e ); } bool KListView::event( QEvent *e ) { if (e->type() == QEvent::ApplicationPaletteChange) { //qDebug("KListView::event make alternate color configurable"); //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); d->alternateBackground = QColor(240, 240, 240); } - return QListView::event(e); + return Q3ListView::event(e); } void KListView::contentsMousePressEvent( QMouseEvent *e ) { //qDebug("KListView::contentsMousePressEvent"); - if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) + if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) { bool block = signalsBlocked(); blockSignals( true ); clearSelection(); blockSignals( block ); } else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove)) { d->selectedBySimpleMove=false; d->selectedUsingMouse=true; if (currentItem()!=0) { currentItem()->setSelected(false); currentItem()->repaint(); // emit selectionChanged(); }; }; QPoint p( contentsToViewport( e->pos() ) ); - QListViewItem *at = itemAt (p); + Q3ListViewItem *at = itemAt (p); // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) bool rootDecoClicked = at && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); - if (e->button() == LeftButton && !rootDecoClicked) + if (e->button() == Qt::LeftButton && !rootDecoClicked) { //Start a drag d->startDragPos = e->pos(); if (at) { d->validDrag = true; d->pressedOnSelected = at->isSelected(); } } - QListView::contentsMousePressEvent( e ); + Q3ListView::contentsMousePressEvent( e ); } void KListView::contentsMouseMoveEvent( QMouseEvent *e ) { if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { - QListView::contentsMouseMoveEvent (e); + Q3ListView::contentsMouseMoveEvent (e); return; } QPoint vp = contentsToViewport(e->pos()); - QListViewItem *item = itemAt( vp ); + Q3ListViewItem *item = itemAt( vp ); //do we process cursor changes at all? if ( item && d->bChangeCursorOverItem && d->bUseSingle ) { //Cursor moved on a new item or in/out the execute area if( (item != d->pCurrentItem) || (isExecuteArea(vp) != d->cursorInExecuteArea) ) { d->cursorInExecuteArea = isExecuteArea(vp); //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); /*US if( d->cursorInExecuteArea ) //cursor moved in execute area @@ -844,95 +859,95 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) } } bool dragOn = dragEnabled(); QPoint newPos = e->pos(); if (dragOn && d->validDrag && (newPos.x() > d->startDragPos.x()+d->dragDelay || newPos.x() < d->startDragPos.x()-d->dragDelay || newPos.y() > d->startDragPos.y()+d->dragDelay || newPos.y() < d->startDragPos.y()-d->dragDelay)) //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { - QListView::contentsMouseReleaseEvent( 0 ); + Q3ListView::contentsMouseReleaseEvent( 0 ); startDrag(); d->startDragPos = QPoint(); d->validDrag = false; } } void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) { - if (e->button() == LeftButton) + if (e->button() == Qt::LeftButton) { // If the row was already selected, maybe we want to start an in-place editing if ( d->pressedOnSelected && itemsRenameable() ) { QPoint p( contentsToViewport( e->pos() ) ); - QListViewItem *at = itemAt (p); + Q3ListViewItem *at = itemAt (p); if ( at ) { // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) bool rootDecoClicked = ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); if (!rootDecoClicked) { int col = header()->mapToLogical( header()->cellAt( p.x() ) ); if ( d->renameable.contains(col) ) rename(at, col); } } } d->pressedOnSelected = false; d->validDrag = false; d->startDragPos = QPoint(); } - QListView::contentsMouseReleaseEvent( e ); + Q3ListView::contentsMouseReleaseEvent( e ); } void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) { //qDebug("KListView::contentsMouseDoubleClickEvent"); // We don't want to call the parent method because it does setOpen, // whereas we don't do it in single click mode... (David) //QListView::contentsMouseDoubleClickEvent( e ); QPoint vp = contentsToViewport(e->pos()); - QListViewItem *item = itemAt( vp ); - emit QListView::doubleClicked( item ); // we do it now + Q3ListViewItem *item = itemAt( vp ); + emit Q3ListView::doubleClicked( item ); // we do it now int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; if( item ) { //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); emit doubleClicked( item, e->globalPos(), col ); - if( (e->button() == LeftButton) && !d->bUseSingle ) { + if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) { //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); emitExecute( e->button(), item, e->globalPos(), col); } } } -void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) +void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ) { //qDebug("KListView::slotMouseButtonClicked"); - if( (btn == LeftButton) && item ) { + if( (btn == Qt::LeftButton) && item ) { //qDebug("KListView::slotMouseButtonClicked: emitExecute"); emitExecute(btn, item, pos, c); } } void KListView::contentsDropEvent(QDropEvent* e) { qDebug("KListView::contentsDropEvent drag&drop not supported yet"); /*US cleanDropVisualizer(); cleanItemHighlighter(); @@ -952,64 +967,64 @@ qDebug("KListView::contentsDropEvent drag&drop not supported yet"); emit dropped(e, afterme); emit dropped(this, e, afterme); emit dropped(e, parent, afterme); emit dropped(this, e, parent, afterme); } } */ } -void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) +void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme) { - QPtrList<QListViewItem> items, afterFirsts, afterNows; - QListViewItem *current=currentItem(); + Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows; + Q3ListViewItem *current=currentItem(); bool hasMoved=false; - for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) + for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) { iNext=i->itemBelow(); if (!i->isSelected()) continue; // don't drop an item after itself, or else // it moves to the top of the list if (i==afterme) continue; i->setSelected(false); - QListViewItem *afterFirst = i->itemAbove(); + Q3ListViewItem *afterFirst = i->itemAbove(); if (!hasMoved) { emit aboutToMove(); hasMoved=true; } moveItem(i, parent, afterme); // ###### This should include the new parent !!! -> KDE 3.0 // If you need this right now, have a look at keditbookmarks. emit moved(i, afterFirst, afterme); items.append (i); afterFirsts.append (afterFirst); afterNows.append (afterme); afterme = i; } clearSelection(); - for (QListViewItem *i=items.first(); i != 0; i=items.next() ) + for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() ) i->setSelected(true); if (current) setCurrentItem(current); emit moved(items,afterFirsts,afterNows); if (firstChild()) emit moved(); } void KListView::contentsDragMoveEvent(QDragMoveEvent *event) { @@ -1077,32 +1092,32 @@ void KListView::cleanDropVisualizer() { QRect rect=d->mOldDropVisualizer; d->mOldDropVisualizer = QRect(); viewport()->repaint(rect, true); } } int KListView::depthToPixels( int depth ) { return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); } -void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) +void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after) { QPoint p (contentsToViewport(pos)); // Get the position to put it in - QListViewItem *atpos = itemAt(p); + Q3ListViewItem *atpos = itemAt(p); - QListViewItem *above; + Q3ListViewItem *above; if (!atpos) // put it at the end above = lastItem(); else { // Get the closest item before us ('atpos' or the one above, if any) if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) above = atpos->itemAbove(); else above = atpos; } if (above) @@ -1114,62 +1129,62 @@ void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewIte // The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children if (p.x() >= depthToPixels( above->depth() + 1 ) || (above->isOpen() && above->childCount() > 0) ) { parent = above; after = 0L; return; } } // Ok, there's one more level of complexity. We may want to become a new // sibling, but of an upper-level group, rather than the "above" item - QListViewItem * betterAbove = above->parent(); - QListViewItem * last = above; + Q3ListViewItem * betterAbove = above->parent(); + Q3ListViewItem * last = above; while ( betterAbove ) { // We are allowed to become a sibling of "betterAbove" only if we are // after its last child if ( last->nextSibling() == 0 ) { if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) above = betterAbove; // store this one, but don't stop yet, there may be a better one else break; // not enough on the left, so stop last = betterAbove; betterAbove = betterAbove->parent(); // up one level } else break; // we're among the child of betterAbove, not after the last one } } // set as sibling after = above; parent = after ? after->parent() : 0L ; } -QListViewItem* KListView::lastChild () const +Q3ListViewItem* KListView::lastChild () const { - QListViewItem* lastchild = firstChild(); + Q3ListViewItem* lastchild = firstChild(); if (lastchild) for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); return lastchild; } -QListViewItem *KListView::lastItem() const +Q3ListViewItem *KListView::lastItem() const { - QListViewItem* last = lastChild(); + Q3ListViewItem* last = lastChild(); - for (QListViewItemIterator it (last); it.current(); ++it) + for (Q3ListViewItemIterator it (last); it.current(); ++it) last = it.current(); return last; } KLineEdit *KListView::renameLineEdit() const { //US return d->editor; qDebug("KListView::renameLineEdit returns 0. Might crash"); return 0; } @@ -1178,30 +1193,30 @@ void KListView::startDrag() qDebug("KListView::startDrag drag&drop not supported yet."); /*US QDragObject *drag = dragObject(); if (!drag) return; if (drag->drag() && drag->target() != viewport()) emit moved(); */ } -QDragObject *KListView::dragObject() +Q3DragObject *KListView::dragObject() { if (!currentItem()) return 0; - return new QStoredDrag("application/x-qlistviewitem", viewport()); + return new Q3StoredDrag("application/x-qlistviewitem", viewport()); } void KListView::setItemsMovable(bool b) { d->itemsMovable=b; } bool KListView::itemsMovable() const { return d->itemsMovable; } @@ -1237,37 +1252,37 @@ bool KListView::autoOpen() const } bool KListView::dropVisualizer() const { return d->dropVisualizer; } void KListView::setDropVisualizer(bool b) { d->dropVisualizer=b; } -QPtrList<QListViewItem> KListView::selectedItems() const +Q3PtrList<Q3ListViewItem> KListView::selectedItems() const { - QPtrList<QListViewItem> list; - for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) + Q3PtrList<Q3ListViewItem> list; + for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) if (i->isSelected()) list.append(i); return list; } -void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) +void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after) { // sanity check - don't move a item into it's own child structure - QListViewItem *i = parent; + Q3ListViewItem *i = parent; while(i) { if(i == item) return; i = i->parent(); } // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor // in here, without ever deleting the item. if (item->parent()) item->parent()->takeItem(item); else @@ -1287,37 +1302,37 @@ void KListView::contentsDragEnterEvent(QDragEnterEvent *event) qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); /*US if (acceptDrag (event)) event->accept(); */ } void KListView::setDropVisualizerWidth (int w) { d->mDropVisualizerWidth = w > 0 ? w : 1; } -QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, - QListViewItem *after) +QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent, + Q3ListViewItem *after) { QRect insertmarker; if (!after && !parent) insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); else { int level = 0; if (after) { - QListViewItem* it = 0L; + Q3ListViewItem* it = 0L; if (after->isOpen()) { // Look for the last child (recursively) it = after->firstChild(); if (it) while (it->nextSibling() || it->firstChild()) if ( it->nextSibling() ) it = it->nextSibling(); else it = it->firstChild(); } @@ -1329,30 +1344,30 @@ QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, insertmarker = itemRect (parent); level = parent->depth() + 1; } insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); insertmarker.setRight (viewport()->width()); insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); } // This is not used anymore, at least by KListView itself (see viewportPaintEvent) // Remove for KDE 3.0. if (p) - p->fillRect(insertmarker, Dense4Pattern); + p->fillRect(insertmarker, Qt::Dense4Pattern); return insertmarker; } -QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) +QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item) { QRect r; if (item) { r = itemRect(item); r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); if (painter) { //US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), //US QStyle::Style_FocusAtBorder, colorGroup().highlight()); const QColor* pHighl = &(colorGroup().highlight()); //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); @@ -1367,25 +1382,25 @@ qDebug("KListView::drawItemHighlighter has to be verified"); } void KListView::cleanItemHighlighter () { if (d->mOldDropHighlighter.isValid()) { QRect rect=d->mOldDropHighlighter; d->mOldDropHighlighter = QRect(); viewport()->repaint(rect, true); } } -void KListView::rename(QListViewItem *item, int c) +void KListView::rename(Q3ListViewItem *item, int c) { if (d->renameable.contains(c)) { ensureItemVisible(item); //US d->editor->load(item,c); qDebug("KListView::rename has to be verified"); } } bool KListView::isRenameable (int col) const { @@ -1394,25 +1409,25 @@ bool KListView::isRenameable (int col) const void KListView::setRenameable (int col, bool yesno) { if (col>=header()->count()) return; d->renameable.remove(col); if (yesno && d->renameable.find(col)==d->renameable.end()) d->renameable+=col; else if (!yesno && d->renameable.find(col)!=d->renameable.end()) d->renameable.remove(col); } -void KListView::doneEditing(QListViewItem *item, int row) +void KListView::doneEditing(Q3ListViewItem *item, int row) { emit itemRenamed(item, item->text(row), row); emit itemRenamed(item); } bool KListView::acceptDrag(QDropEvent* e) const { qDebug("KListView::acceptDrag drag&drop not supported yet"); //US return acceptDrops() && itemsMovable() && (e->source()==viewport()); return false; } @@ -1438,30 +1453,30 @@ void KListView::setTooltipColumn(int column) } void KListView::setDropHighlighter(bool b) { d->dropHighlighter=b; } bool KListView::dropHighlighter() const { return d->dropHighlighter; } -bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const +bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const { return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); } -QString KListView::tooltip(QListViewItem *item, int column) const +QString KListView::tooltip(Q3ListViewItem *item, int column) const { return item->text(column); } void KListView::setTabOrderedRenaming(bool b) { d->tabRename = b; } bool KListView::tabOrderedRenaming() const { return d->tabRename; @@ -1473,25 +1488,25 @@ void KListView::keyPressEvent (QKeyEvent* e) if (e->key() == d->contextMenuKey) { emit menuShortCutPressed (this, currentItem()); return; } if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) { emit signalDelete ( ); return; } if (d->selectionMode != FileManager) - QListView::keyPressEvent (e); + Q3ListView::keyPressEvent (e); else fileManagerKeyPressEvent (e); } void KListView::activateAutomaticSelection() { d->selectedBySimpleMove=true; d->selectedUsingMouse=false; if (currentItem()!=0) { selectAll(false); currentItem()->setSelected(true); @@ -1504,112 +1519,112 @@ void KListView::deactivateAutomaticSelection() { d->selectedBySimpleMove=false; } bool KListView::automaticSelection() const { return d->selectedBySimpleMove; } void KListView::fileManagerKeyPressEvent (QKeyEvent* e) { //don't care whether it's on the keypad or not - int e_state=(e->state() & ~Keypad); + int e_state=(e->state() & ~Qt::Keypad); int oldSelectionDirection(d->selectionDirection); - if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) - && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) + if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) + && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)) { - if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) + if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) selectAll(FALSE); d->selectionDirection=0; - d->wasShiftEvent = (e_state == ShiftButton); + d->wasShiftEvent = (e_state == Qt::ShiftButton); }; - //d->wasShiftEvent = (e_state == ShiftButton); + //d->wasShiftEvent = (e_state == Qt::ShiftButton); - QListViewItem* item = currentItem(); + Q3ListViewItem* item = currentItem(); if (item==0) return; - QListViewItem* repaintItem1 = item; - QListViewItem* repaintItem2 = 0L; - QListViewItem* visItem = 0L; + Q3ListViewItem* repaintItem1 = item; + Q3ListViewItem* repaintItem2 = 0L; + Q3ListViewItem* visItem = 0L; - QListViewItem* nextItem = 0L; + Q3ListViewItem* nextItem = 0L; int items = 0; - bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); + bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton)); int selectedItems(0); - for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) + for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) if (tmpItem->isSelected()) selectedItems++; if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) - && (e_state==NoButton) - && ((e->key()==Key_Down) - || (e->key()==Key_Up) - || (e->key()==Key_Next) - || (e->key()==Key_Prior) - || (e->key()==Key_Home) - || (e->key()==Key_End))) + && (e_state==Qt::NoButton) + && ((e->key()==Qt::Key_Down) + || (e->key()==Qt::Key_Up) + || (e->key()==Qt::Key_Next) + || (e->key()==Qt::Key_Prior) + || (e->key()==Qt::Key_Home) + || (e->key()==Qt::Key_End))) { d->selectedBySimpleMove=true; d->selectedUsingMouse=false; } else if (selectedItems>1) d->selectedBySimpleMove=false; bool emitSelectionChanged(false); switch (e->key()) { - case Key_Escape: + case Qt::Key_Escape: selectAll(FALSE); emitSelectionChanged=TRUE; break; - case Key_Space: + case Qt::Key_Space: //toggle selection of current item if (d->selectedBySimpleMove) d->selectedBySimpleMove=false; item->setSelected(!item->isSelected()); emitSelectionChanged=TRUE; break; - case Key_Insert: + case Qt::Key_Insert: //toggle selection of current item and move to the next item if (d->selectedBySimpleMove) { d->selectedBySimpleMove=false; if (!item->isSelected()) item->setSelected(TRUE); } else { item->setSelected(!item->isSelected()); }; nextItem=item->itemBelow(); if (nextItem!=0) { repaintItem2=nextItem; visItem=nextItem; setCurrentItem(nextItem); }; d->selectionDirection=1; emitSelectionChanged=TRUE; break; - case Key_Down: + case Qt::Key_Down: nextItem=item->itemBelow(); //toggle selection of current item and move to the next item if (shiftOrCtrl) { d->selectionDirection=1; if (d->selectedBySimpleMove) d->selectedBySimpleMove=false; else { if (oldSelectionDirection!=-1) { item->setSelected(!item->isSelected()); @@ -1624,25 +1639,25 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) }; if (nextItem!=0) { if (d->selectedBySimpleMove) nextItem->setSelected(true); repaintItem2=nextItem; visItem=nextItem; setCurrentItem(nextItem); }; break; - case Key_Up: + case Qt::Key_Up: nextItem=item->itemAbove(); d->selectionDirection=-1; //move to the prev. item and toggle selection of this one // => No, can't select the last item, with this. For symmetry, let's // toggle selection and THEN move up, just like we do in down (David) if (shiftOrCtrl) { if (d->selectedBySimpleMove) d->selectedBySimpleMove=false; else { if (oldSelectionDirection!=1) @@ -1659,72 +1674,72 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) }; if (nextItem!=0) { if (d->selectedBySimpleMove) nextItem->setSelected(true); repaintItem2=nextItem; visItem=nextItem; setCurrentItem(nextItem); }; break; - case Key_End: + case Qt::Key_End: //move to the last item and toggle selection of all items inbetween nextItem=item; if (d->selectedBySimpleMove) item->setSelected(false); if (shiftOrCtrl) d->selectedBySimpleMove=false; while(nextItem!=0) { if (shiftOrCtrl) nextItem->setSelected(!nextItem->isSelected()); if (nextItem->itemBelow()==0) { if (d->selectedBySimpleMove) nextItem->setSelected(true); repaintItem2=nextItem; visItem=nextItem; setCurrentItem(nextItem); } nextItem=nextItem->itemBelow(); } emitSelectionChanged=TRUE; break; - case Key_Home: + case Qt::Key_Home: // move to the first item and toggle selection of all items inbetween nextItem = firstChild(); visItem = nextItem; repaintItem2 = visItem; if (d->selectedBySimpleMove) item->setSelected(false); if (shiftOrCtrl) { d->selectedBySimpleMove=false; while ( nextItem != item ) { nextItem->setSelected( !nextItem->isSelected() ); nextItem = nextItem->itemBelow(); } item->setSelected( !item->isSelected() ); } setCurrentItem( firstChild() ); emitSelectionChanged=TRUE; break; - case Key_Next: + case Qt::Key_Next: items=visibleHeight()/item->height(); nextItem=item; if (d->selectedBySimpleMove) item->setSelected(false); if (shiftOrCtrl) { d->selectedBySimpleMove=false; d->selectionDirection=1; }; for (int i=0; i<items; i++) { @@ -1742,25 +1757,25 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) setCurrentItem(nextItem); update(); if ((shiftOrCtrl) || (d->selectedBySimpleMove)) { emit selectionChanged(); } return; } nextItem=nextItem->itemBelow(); } break; - case Key_Prior: + case Qt::Key_Prior: items=visibleHeight()/item->height(); nextItem=item; if (d->selectedBySimpleMove) item->setSelected(false); if (shiftOrCtrl) { d->selectionDirection=-1; d->selectedBySimpleMove=false; }; for (int i=0; i<items; i++) { @@ -1776,43 +1791,43 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) setCurrentItem(nextItem); update(); if ((shiftOrCtrl) || (d->selectedBySimpleMove)) { emit selectionChanged(); } return; } nextItem=nextItem->itemAbove(); } break; - case Key_Minus: + case Qt::Key_Minus: if ( item->isOpen() ) setOpen( item, FALSE ); break; - case Key_Plus: + case Qt::Key_Plus: if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) setOpen( item, TRUE ); break; default: - bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) - && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); + bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) + && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)); bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); if (realKey && selectCurrentItem) item->setSelected(false); //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) - QListView::SelectionMode oldSelectionMode = selectionMode(); - setSelectionMode (QListView::Multi); - QListView::keyPressEvent (e); + Q3ListView::SelectionMode oldSelectionMode = selectionMode(); + setSelectionMode (Q3ListView::Multi); + Q3ListView::keyPressEvent (e); setSelectionMode (oldSelectionMode); if (realKey && selectCurrentItem) { currentItem()->setSelected(true); emitSelectionChanged=TRUE; } repaintItem2=currentItem(); if (realKey) visItem=currentItem(); break; } @@ -1841,127 +1856,127 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) } void KListView::setSelectionModeExt (SelectionModeExt mode) { d->selectionMode = mode; switch (mode) { case Single: case Multi: case Extended: case NoSelection: - setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); + setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode))); break; case FileManager: - setSelectionMode (QListView::Extended); + setSelectionMode (Q3ListView::Extended); break; default: kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; break; } } KListView::SelectionModeExt KListView::selectionModeExt () const { return d->selectionMode; } -int KListView::itemIndex( const QListViewItem *item ) const +int KListView::itemIndex( const Q3ListViewItem *item ) const { if ( !item ) return -1; if ( item == firstChild() ) return 0; else { - QListViewItemIterator it(firstChild()); + Q3ListViewItemIterator it(firstChild()); uint j = 0; for (; it.current() && it.current() != item; ++it, ++j ); if( !it.current() ) return -1; return j; } } -QListViewItem* KListView::itemAtIndex(int index) +Q3ListViewItem* KListView::itemAtIndex(int index) { if (index<0) return 0; int j(0); - for (QListViewItemIterator it=firstChild(); it.current(); it++) + for (Q3ListViewItemIterator it=firstChild(); it.current(); it++) { if (j==index) return it.current(); j++; }; return 0; } -void KListView::emitContextMenu (KListView*, QListViewItem* i) +void KListView::emitContextMenu (KListView*, Q3ListViewItem* i) { QPoint p; // qDebug("KListView::emitContextMenu "); if (i) p = viewport()->mapToGlobal(itemRect(i).center()); else p = mapToGlobal(rect().center()); emit contextMenu (this, i, p); } -void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) +void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col) { - QListViewItem* item = i; + Q3ListViewItem* item = i; int c = col; // do not trust the values for QListViewItem* i and int col; // qDebug("KListView::emitContextMenu col"); if ( col == -1 ) { QPoint pp = viewport()->mapFromGlobal(p); item = itemAt( pp); c = header()->sectionAt(pp.x() ); } emit contextRequest( item, p, c ); emit contextMenu (this, item, p); } void KListView::setAcceptDrops (bool val) { - QListView::setAcceptDrops (val); + Q3ListView::setAcceptDrops (val); viewport()->setAcceptDrops (val); } int KListView::dropVisualizerWidth () const { return d->mDropVisualizerWidth; } void KListView::viewportPaintEvent(QPaintEvent *e) { - QListView::viewportPaintEvent(e); + Q3ListView::viewportPaintEvent(e); if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) { QPainter painter(viewport()); // This is where we actually draw the drop-visualizer - painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); + painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern); } if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) { QPainter painter(viewport()); qDebug("KListView::viewportPaintEvent has to be verified"); // This is where we actually draw the drop-highlighter //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), //US QStyle::Style_FocusAtBorder); //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); @@ -1979,51 +1994,51 @@ void KListView::setFullWidth(bool fullWidth) { d->fullWidth = fullWidth; //US header()->setStretchEnabled(fullWidth, columns()-1); } bool KListView::fullWidth() const { return d->fullWidth; } int KListView::addColumn(const QString& label, int width) { - int result = QListView::addColumn(label, width); + int result = Q3ListView::addColumn(label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); } return result; } -int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) +int KListView::addColumn(const QIcon& iconset, const QString& label, int width) { - int result = QListView::addColumn(iconset, label, width); + int result = Q3ListView::addColumn(iconset, label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); } return result; } void KListView::removeColumn(int index) { - QListView::removeColumn(index); + Q3ListView::removeColumn(index); //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); } void KListView::viewportResizeEvent(QResizeEvent* e) { - QListView::viewportResizeEvent(e); + Q3ListView::viewportResizeEvent(e); } const QColor &KListView::alternateBackground() const { return d->alternateBackground; } void KListView::setAlternateBackground(const QColor &c) { d->alternateBackground = c; repaint(); } @@ -2061,89 +2076,89 @@ void KListView::restoreLayout(KConfig *config, const QString &group) if (config->hasKey("SortColumn")) setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); */ QStringList langLst = config->readListEntry( "SortColumn" ); if (!langLst.isEmpty()) setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); } void KListView::setSorting(int column, bool ascending) { d->sortColumn = column; d->sortAscending = ascending; - QListView::setSorting(column, ascending); + Q3ListView::setSorting(column, ascending); } int KListView::columnSorted(void) const { return d->sortColumn; } bool KListView::ascendingSort(void) const { return d->sortAscending; } -KListViewItem::KListViewItem(QListView *parent) - : QListViewItem(parent) +KListViewItem::KListViewItem(Q3ListView *parent) + : Q3ListViewItem(parent) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent) - : QListViewItem(parent) +KListViewItem::KListViewItem(Q3ListViewItem *parent) + : Q3ListViewItem(parent) { init(); } -KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) - : QListViewItem(parent, after) +KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after) + : Q3ListViewItem(parent, after) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) - : QListViewItem(parent, after) +KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after) + : Q3ListViewItem(parent, after) { init(); } -KListViewItem::KListViewItem(QListView *parent, +KListViewItem::KListViewItem(Q3ListView *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, +KListViewItem::KListViewItem(Q3ListViewItem *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, +KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, +KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } KListViewItem::~KListViewItem() { } void KListViewItem::init() { m_known = false; } @@ -2203,30 +2218,30 @@ bool KListViewItem::isAlternate() void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) { QColorGroup _cg = cg; const QPixmap *pm = listView()->viewport()->backgroundPixmap(); if (pm && !pm->isNull()) { _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); QPoint o = p->brushOrigin(); p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); } else if (isAlternate()) { //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) - if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) + if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground) _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); else _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); } - QListViewItem::paintCell(p, _cg, column, width, alignment); + Q3ListViewItem::paintCell(p, _cg, column, width, alignment); } //US we do not have a "global KDE" variable to setup singleClick functionality void KListView::setSingleClick(bool s) { d->bUseSingle = s; slotSettingsChanged(1); // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); } void KListView::virtual_hook( int, void* ) diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index 9f0d9fd..2176525 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h @@ -11,35 +11,46 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KLISTVIEW_H #define KLISTVIEW_H -#include <qlistview.h> - -#include <qptrlist.h> +#include <q3listview.h> + +#include <q3ptrlist.h> +//Added by qt3to4: +#include <QDragMoveEvent> +#include <QDropEvent> +#include <QDragLeaveEvent> +#include <QPaintEvent> +#include <QResizeEvent> +#include <QFocusEvent> +#include <QMouseEvent> +#include <QKeyEvent> +#include <QEvent> +#include <QDragEnterEvent> //US class QDropEvent; class QDragLeaveEvent; class QDragMoveEvent; class QDragEnterEvent; -class QDragObject; +class Q3DragObject; class KConfig; class KLineEdit; /** * This Widget extends the functionality of QListView to honor the system * wide settings for Single Click/Double Click mode, AutoSelection and * ChangeCursorOverLink (TM). * * There is a new signal executed(). It gets connected to either * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE * wide Single Click/Double Click settings. It is strongly recommended that * you use this signal instead of the above mentioned. This way you dont * need to care about the current settings. @@ -48,25 +59,25 @@ class KLineEdit; * * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) * and connect it to a suitable slot. * To see where you are dropping, @ref setDropVisualizer(true). * And also you'll need @ref acceptDrag(QDropEvent*) * * KListView is drag-enabled, too: to benefit from that you've got derive from it. * Reimplement @ref dragObject() and (possibly) @ref startDrag(), * and @ref setDragEnabled(true). * * @version $Id$ */ -class KListView : public QListView +class KListView : public Q3ListView { Q_OBJECT Q_ENUMS( SelectionModeExt ) Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) //US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) @@ -97,33 +108,33 @@ public: * item to (including) the item one page up * * The combinations work the same with SHIFT instead of CTRL, except * that if you start selecting something using SHIFT everything selected * before will be deselected first. * * Additionally the current item is always selected automatically when * navigating using the keyboard, except other items were selected explicitely. * * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected */ enum SelectionModeExt { - Single = QListView::Single, - Multi = QListView::Multi, - Extended = QListView::Extended, - NoSelection = QListView::NoSelection, + Single = Q3ListView::Single, + Multi = Q3ListView::Multi, + Extended = Q3ListView::Extended, + NoSelection = Q3ListView::NoSelection, FileManager }; void repaintContents( bool erase = true ) { - QScrollView::repaintContents( contentsX(), contentsY(), + Q3ScrollView::repaintContents( contentsX(), contentsY(), visibleWidth(), visibleHeight(), erase ); }; /** * Constructor. * * The parameters @p parent and @p name are handled by * @ref QListView, as usual. */ KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); /** * Destructor. @@ -152,44 +163,44 @@ public: virtual bool isExecuteArea( const QPoint& point ); /** * Same thing, but from an x coordinate only. This only checks if x is in * the first column (if all columns don't show focus), without testing if * the y coordinate is over an item or not. */ bool isExecuteArea( int x ); /** * @return a list containing the currently selected items. */ - QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) + Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) /** * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. */ - void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); + void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after); /** * @return the last item (not child!) of this listview. * * @see lastChild() */ - QListViewItem *lastItem() const; + Q3ListViewItem *lastItem() const; /** * @return the last child of this listview. * * @see lastItem() */ - QListViewItem* lastChild () const; + Q3ListViewItem* lastChild () const; /** * @return the lineedit used for inline renaming. * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit * * @since 3.2 */ KLineEdit* renameLineEdit() const; /** * @returns if it is legal to move items in the list view. True by default. * @@ -267,32 +278,32 @@ public: * @return the "extended" selection mode of this listview. * * @see SelectionModeExt * @see setSelectionModeExt */ SelectionModeExt selectionModeExt () const; /** * Returns the index of @p item within the item tree or -1 if * @p item doesn't exist in this list view. This function takes * all items into account not only the visible ones. */ - int itemIndex( const QListViewItem *item ) const; + int itemIndex( const Q3ListViewItem *item ) const; /** * Returns the item of @p index within the item tree or 0 if * @p index doesn't exist in this list view. This function takes * all items into account not only the visible ones. */ - QListViewItem* itemAtIndex(int index); + Q3ListViewItem* itemAtIndex(int index); /** * @deprecated * @see #setFullWidth() */ void setFullWidth(); /** * Let the last column fit exactly all the available width. * * @see #fullWidth() */ @@ -305,25 +316,25 @@ public: */ bool fullWidth() const; /** * Reimplemented for full width support * * @see #removeColumn() */ virtual int addColumn(const QString& label, int width = -1); /** * Reimplemented for full width support */ - virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); + virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1); /** * Reimplemented for full width support * * @see #addColumn() */ virtual void removeColumn(int index); /** * sets the alternate background background color. * This only has an effect if the items are KListViewItems * * @param c the color to use for every other item. Set to an invalid @@ -379,108 +390,108 @@ public: signals: /** * This signal is emitted whenever the user executes an listview item. * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listview item. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. */ - void executed( QListViewItem *item ); + void executed( Q3ListViewItem *item ); /** * This signal is emitted whenever the user executes an listview item. * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listview item. * @param pos is the position where the user has clicked * @param c is the column into which the user clicked. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. */ - void executed( QListViewItem *item, const QPoint &pos, int c ); + void executed( Q3ListViewItem *item, const QPoint &pos, int c ); /** * This signal gets emitted whenever the user double clicks into the * listview. * @param item is the pointer to the clicked listview item. * @param pos is the position where the user has clicked, and * @param c is the column into which the user clicked. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. * * This signal is more or less here for the sake of completeness. * You should normally not need to use this. In most cases its better * to use @ref #executed() instead. */ - void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); - void contextRequest( QListViewItem *item, const QPoint &pos, int c ); + void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c ); + void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c ); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * @param e is the drop event itself (it has already been accepted) * @param after is the item after which the drop occured (or 0L, if * the drop was above all items) * * @see #acceptDrop() */ - void dropped (QDropEvent * e, QListViewItem *after); + void dropped (QDropEvent * e, Q3ListViewItem *after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This is an overloaded version of the above (provided to simplify * processing drops outside of the class). * * @param list is the listview * @param e is the drop event itself (it has already been accepted) * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ - void dropped (KListView* list, QDropEvent* e, QListViewItem* after); + void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This function also provides a parent, in the event that your listview * is a tree * @param list is the listview * @param e is the drop event itself (it has already been accepted) * @param parent the item that is to be the parent of the new item * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ - void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); + void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This function also provides a parent, in the event that your listview * is a tree * @param e is the drop event itself (it has already been accepted) * @param parent the item that is to be the parent of the new item * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ - void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); + void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after); /** * This signal is emitted when ever the user moves an item in the list via * DnD. * If more than one item is moved at the same time, this signal is only emitted * once. */ void moved(); /** * Connect to this signal if you want to do some preprocessing before * a move is made, for example, to disable sorting @@ -493,76 +504,76 @@ signals: /** * This signal is emitted when ever the user moves an item in the list via * DnD. * If more than one item is moved at the same time, @p afterFirst and * @p afterNow will reflect what was true before the move. * This differs from @ref moved(), so be careful. All the items will have been * moved before @ref moved() is emitted, which is not true in this method. // FIXME * @param item the item that was moved * @param afterFirst the item that parameter item was in before the move, in the list * @param afterNow the item it's currently after. */ - void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); + void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow); /** * This signal is emitted after all the items have been moved. It reports info for * each and every item moved, in order. The first element in @p items associates * with the first of afterFirst and afterNow. */ - void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); + void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow); /** * This signal gets emitted when an item is renamed via in-place renaming. * * @param item is the renamed item. * @param str is the new value of column @p col. * @param col is the renamed column. */ - void itemRenamed(QListViewItem* item, const QString &str, int col); + void itemRenamed(Q3ListViewItem* item, const QString &str, int col); /** * Same as above, but without the extra information. */ - void itemRenamed(QListViewItem* item); + void itemRenamed(Q3ListViewItem* item); void signalDelete(); /** * This signal is emitted when the shortcut key for popup-menus is pressed. * * Normally you should not use this, just connect a slot to signal * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly * handle showing context menus regardless of settings. * * @param list is this listview. * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. */ - void menuShortCutPressed (KListView* list, QListViewItem* item); + void menuShortCutPressed (KListView* list, Q3ListViewItem* item); /** * This signal is emitted whenever a context-menu should be shown for item @p i. * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). * * @param l is this listview. * @param i is the item for which the menu should be shown. May be 0L. * @param p is the point at which the menu should be shown. */ - void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); + void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p); public slots: /** * Rename column @p c of @p item. */ - virtual void rename(QListViewItem *item, int c); + virtual void rename(Q3ListViewItem *item, int c); /** * By default, if you called setItemsRenameable(true), * only the first column is renameable. * Use this function to enable the feature on other columns. * * If you want more intelligent (dynamic) selection, * you'll have to derive from KListView, * and override @ref rename() and call only call it * if you want the item to be renamed. */ void setRenameable (int column, bool yesno=true); @@ -664,41 +675,41 @@ protected: return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); } /** * An overloaded version of below(const QRect&, const QPoint&). * * It differs from the above only in what arguments it takes. * * @param i the item whose rect() is passed to the above function. * @param p is translated from contents coordinates to viewport coordinates * before being passed to the above function. */ - inline bool below (QListViewItem* i, const QPoint& p) + inline bool below (Q3ListViewItem* i, const QPoint& p) { return below (itemRect(i), contentsToViewport(p)); } /** * Reimplemented to reload the alternate background in palette changes. * @internal */ virtual bool event( QEvent * ); /** * Emit signal @ref #executed. * @internal */ //US I added buttonstate to pass the current keyboard status - void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); + void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c); /** * Reimplemented for internal reasons. * Further reimplementations should call this function or else * some features may not work correctly. * * The API is unaffected. */ virtual void focusInEvent(QFocusEvent* fe); /** * Reimplemented for internal reasons. @@ -712,30 +723,30 @@ protected: /** * Reimplemented for internal reasons. * Further reimplementations should call this function or else * some features may not work correctly. * * The API is unaffected. */ virtual void leaveEvent( QEvent *e ); /** * @return the tooltip for @p column of @p item. */ - virtual QString tooltip(QListViewItem* item, int column) const; + virtual QString tooltip(Q3ListViewItem* item, int column) const; /** * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. */ - virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const; + virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const; /** * Reimplemented for internal reasons. * Further reimplementations should call this function or else * some features may not work correctly. * * The API is unaffected. */ virtual void contentsDragMoveEvent (QDragMoveEvent *event); /** * Reimplemented for internal reasons. @@ -796,49 +807,49 @@ protected: * Further reimplementations should call this function or else * some features may not work correctly. * * The API is unaffected. */ virtual void contentsDragEnterEvent (QDragEnterEvent *); /** * @return a dragobject encoding the current selection. * * @see setDragEnabled() */ - virtual QDragObject *dragObject(); + virtual Q3DragObject *dragObject(); /** * @return true if the @p event provides some acceptable * format. * A common mistake is to forget the "const" in your reimplementation */ virtual bool acceptDrag (QDropEvent* event) const; /** * Paint the drag line. If painter is null, don't try to :) * * If after == 0 then the marker should be drawn at the top. * * @return the rectangle that you painted to. */ - virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after); + virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after); /** * Paint the drag rectangle. If painter is null, don't try to :) * * * @return the rectangle that you painted to. */ - virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item); + virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item); /** * This method calls @ref dragObject() and starts the drag. * * Reimplement it to do fancy stuff like setting a pixmap or * using a non-default DragMode */ virtual void startDrag(); /** * Reimplemented for internal reasons. * Further reimplementations should call this function or else @@ -877,52 +888,52 @@ protected: /** * Reimplemented for setFullWidth() */ virtual void viewportResizeEvent(QResizeEvent* e); protected slots: /** * Update internal settings whenever the global ones change. * @internal */ void slotSettingsChanged(int); - void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ); - void doneEditing(QListViewItem *item, int row); + void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ); + void doneEditing(Q3ListViewItem *item, int row); /** * Repaint the rect where I was drawing the drop line. */ void cleanDropVisualizer(); /** * Repaint the rect where I was drawing the drop rectangle. */ void cleanItemHighlighter(); /** * Emit the @ref contextMenu signal. This slot is for mouse actions. */ - void emitContextMenu (QListViewItem*, const QPoint&, int); + void emitContextMenu (Q3ListViewItem*, const QPoint&, int); /** * Emit the @ref #contextMenu signal. This slot is for key presses. */ - void emitContextMenu (KListView*, QListViewItem*); + void emitContextMenu (KListView*, Q3ListViewItem*); /** * Accessory slot for AutoSelect * @internal */ - void slotOnItem( QListViewItem *item ); + void slotOnItem( Q3ListViewItem *item ); /** * Accessory slot for AutoSelect/ChangeCursorOverItem * @internal */ void slotOnViewport(); /** * Process AutoSelection. * @internal */ void slotAutoSelect(); @@ -930,33 +941,33 @@ protected slots: void slotDragExpand(); /** * Reacts to header changes in full width mode * @internal */ void slotHeaderChanged(); protected: /** * Handle dropEvent when itemsMovable() is set to true. */ - virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme); + virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme); /** * Where is the nearest QListViewItem that I'm going to drop? * * FIXME KDE 4.0: Make this method const so it can be called from an * acceptDrag method without ugly casts */ - virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after); + virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after); /** * A special keyPressEvent (for FileManager selection mode). */ void fileManagerKeyPressEvent (QKeyEvent*); /** * Convert the depth of an item into its indentation in pixels */ int depthToPixels( int depth ); private: @@ -965,57 +976,57 @@ protected: virtual void virtual_hook( int id, void* data ); private: class KListViewPrivate; KListViewPrivate *d; }; /** * A listview item with support for alternate background colours. It is * a drop-in replacement for @ref QListViewItem * * @short listview item with alternate background colour support */ -class KListViewItem : public QListViewItem +class KListViewItem : public Q3ListViewItem { public: /** * constructors. The semantics remain as in @ref QListViewItem. * Although they accept a @ref QListViewItem as parent, please * don't mix KListViewItem (or subclasses) with QListViewItem * (or subclasses). */ - KListViewItem(QListView *parent); - KListViewItem(QListViewItem *parent); - KListViewItem(QListView *parent, QListViewItem *after); - KListViewItem(QListViewItem *parent, QListViewItem *after); + KListViewItem(Q3ListView *parent); + KListViewItem(Q3ListViewItem *parent); + KListViewItem(Q3ListView *parent, Q3ListViewItem *after); + KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after); - KListViewItem(QListView *parent, + KListViewItem(Q3ListView *parent, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null); - KListViewItem(QListViewItem *parent, + KListViewItem(Q3ListViewItem *parent, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null); - KListViewItem(QListView *parent, QListViewItem *after, + KListViewItem(Q3ListView *parent, Q3ListViewItem *after, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null); - KListViewItem(QListViewItem *parent, QListViewItem *after, + KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null); virtual ~KListViewItem(); /** * retuns true if this item is to be drawn with the alternate background */ bool isAlternate(); /** diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index fa678f2..bac0db8 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp @@ -12,30 +12,36 @@ License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qobjectlist.h> +#include <qobject.h> #include <qstringlist.h> #include <qtimer.h> #include <qmenubar.h> #include <qstatusbar.h> #include <qapplication.h> +//Added by qt3to4: +#include <QCloseEvent> +#include <QPaintEvent> +#include <QResizeEvent> +#include <QChildEvent> +#include <Q3PtrList> #include "kdebug.h" #include "kmainwindow.h" #include "kglobalsettings.h" #include "kactioncollection.h" class KMainWindowPrivate { public: //US bool showHelpMenu:1; bool autoSaveSettings:1; @@ -45,25 +51,25 @@ public: QString autoSaveGroup; //US KAccel * kaccel; //US KMainWindowInterface *m_interface; KDEPrivate::ToolBarHandler *toolBarHandler; QTimer* settingsTimer; KToggleAction *showStatusBarAction; QRect defaultWindowSize; }; static bool no_query_exit = false; KMainWindow::KMainWindow( QWidget* parent, const char *name ) - : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ + : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ { mQToolBar = 0; initKMainWindow(name); } void KMainWindow::parseGeometry(bool parsewidth) { //US the following code is not getting used in the embedded version !! So disable it for now /*US assert ( !kapp->geometryArgument().isNull() ); assert ( d->care_about_geometry ); @@ -267,25 +273,25 @@ void KMainWindow::setCaption( const QString &caption ) //US setPlainCaption( kapp->makeStdCaption(caption) ); setPlainCaption( caption ); } void KMainWindow::setCaption( const QString &caption, bool modified ) { //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); setPlainCaption( caption + "modified:" ); } void KMainWindow::setPlainCaption( const QString &caption ) { - QMainWindow::setCaption( caption ); + Q3MainWindow::setCaption( caption ); #ifndef Q_WS_QWS //US the following is disabled for the embedded version //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); //US info.setName( caption.utf8().data() ); #endif } void KMainWindow::slotStateChanged(const QString &newstate) { stateChanged(newstate, KXMLGUIClient::StateNoReverse); } @@ -412,73 +418,74 @@ bool KMainWindow::isStandardToolBarMenuEnabled() const return ( d->toolBarHandler != 0 ); } void KMainWindow::createStandardStatusBarAction(){ if(!d->showStatusBarAction){ d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); if(internalStatusBar()) d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); } } -QToolBar *KMainWindow::tBar( ) +Q3ToolBar *KMainWindow::tBar( ) { if ( ! mQToolBar ) - mQToolBar = new QToolBar( this ); + mQToolBar = new Q3ToolBar( this ); return mQToolBar; } KToolBar *KMainWindow::toolBar( const char * name ) { if (!name) name = "mainToolBar"; KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); if ( tb ) return tb; bool honor_mode = (name == "mainToolBar"); /*US if ( builderClient() ) return new KToolBar(this, name, honor_mode); // XMLGUI constructor else */ - return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI + return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI } -QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() +Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator() { toolbarList.clear(); - QPtrList<QToolBar> lst; - for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { - lst = toolBars( (ToolBarDock)i ); - for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { + QList<Q3ToolBar*> lst; + for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) { + lst = toolBars( (Qt::ToolBarDock)i ); + for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) { + Q3ToolBar *tb = *i; if ( !tb->inherits( "KToolBar" ) ) continue; toolbarList.append( (KToolBar*)tb ); } } - return QPtrListIterator<KToolBar>( toolbarList ); + return Q3PtrListIterator<KToolBar>( toolbarList ); } void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) { d->autoSaveSettings = true; d->autoSaveGroup = groupName; d->autoSaveWindowSize = saveWindowSize; // Get notified when the user moves a toolbar around //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), //US this, SLOT( setSettingsDirty() ) ); - connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), + connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ), this, SLOT( setSettingsDirty() ) ); // Get default values //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); //US QRect desk = QApplication::desktop()->screenGeometry(scnum); QRect desk = KGlobalSettings::desktopGeometry(0); d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); // Now read the previously saved settings applyMainWindowSettings( KGlobal::config(), groupName ); } @@ -494,25 +501,25 @@ void KMainWindow::resetAutoSaveSettings() bool KMainWindow::autoSaveSettings() const { return d->autoSaveSettings; } QString KMainWindow::autoSaveGroup() const { return d->autoSaveGroup; } void KMainWindow::saveAutoSaveSettings() { - ASSERT( d->autoSaveSettings ); + Q_ASSERT( d->autoSaveSettings ); //kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl; saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup ); KGlobal::config()->sync(); d->settingsDirty = false; if ( d->settingsTimer ) d->settingsTimer->stop(); } void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory ) { // disabling the updates prevents unnecessary redraws setUpdatesEnabled( false ); @@ -630,25 +637,25 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG entryList.append("Enabled"); // By default we don't hide. if(mb->isHidden()) //US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';'); config->writeEntry(QString::fromLatin1("MenuBar"), entryList); else config->deleteEntry(QString::fromLatin1("MenuBar")); } int n = 1; // Toolbar counter. toolbars are counted from 1, KToolBar *toolbar = 0; - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); while ( ( toolbar = it.current() ) ) { ++it; QString group; if (!configGroup.isEmpty()) { // Give a number to the toolbar, but prefer a name if there is one, // because there's no real guarantee on the ordering of toolbars group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); group.prepend(" Toolbar"); group.prepend(configGroup); } toolbar->saveSettings(config, group); @@ -705,37 +712,39 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config sb->hide(); else sb->show(); if(d->showStatusBarAction) d->showStatusBarAction->setChecked(!sb->isHidden()); } QMenuBar* mb = internalMenuBar(); if (mb) { entryList.clear(); //US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';'); entryList = config->readListEntry (QString::fromLatin1("MenuBar")); + if(!entryList.empty()) { entry = entryList.first(); if (entry==QString::fromLatin1("Disabled")) { mb->hide(); } else { mb->show(); } } + } int n = 1; // Toolbar counter. toolbars are counted from 1, KToolBar *toolbar; - QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator for ( ; it.current(); ++it) { toolbar= it.current(); QString group; if (!configGroup.isEmpty()) { // Give a number to the toolbar, but prefer a name if there is one, // because there's no real guarantee on the ordering of toolbars group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); group.prepend(" Toolbar"); group.prepend(configGroup); } @@ -747,25 +756,25 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config } void KMainWindow::finalizeGUI( bool force ) { //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; // The whole reason for this is that moveToolBar relies on the indexes // of the other toolbars, so in theory it should be called only once per // toolbar, but in increasing order of indexes. // Since we can't do that immediately, we move them, and _then_ // we call positionYourself again for each of them, but this time // the toolbariterator should give them in the proper order. // Both the XMLGUI and applySettings call this, hence "force" for the latter. - QPtrListIterator<KToolBar> it( toolBarIterator() ); + Q3PtrListIterator<KToolBar> it( toolBarIterator() ); for ( ; it.current() ; ++ it ) it.current()->positionYourself( force ); d->settingsDirty = false; } void KMainWindow::saveWindowSize( KConfig * config ) const { /*US int scnum = QApplication::desktop()->screenNumber(parentWidget()); QRect desk = QApplication::desktop()->screenGeometry(scnum); */ @@ -842,117 +851,105 @@ bool KMainWindow::settingsDirty() const return d->settingsDirty; } QString KMainWindow::settingsGroup() const { return d->autoSaveGroup; } void KMainWindow::resizeEvent( QResizeEvent * e) { if ( d->autoSaveWindowSize ) setSettingsDirty(); - QMainWindow::resizeEvent( e ); + Q3MainWindow::resizeEvent( e ); } bool KMainWindow::hasMenuBar() { return (internalMenuBar()); } //US KMenuBar *KMainWindow::menuBar() QMenuBar *KMainWindow::menuBar() { //US KMenuBar * mb = internalMenuBar(); QMenuBar * mb = internalMenuBar(); if ( !mb ) { //US mb = new KMenuBar( this ); mb = new QMenuBar( this ); // trigger a re-layout and trigger a call to the private // setMenuBar method. - QMainWindow::menuBar(); + Q3MainWindow::menuBar(); } return mb; } //US KStatusBar *KMainWindow::statusBar() QStatusBar *KMainWindow::statusBar() { //US KStatusBar * sb = internalStatusBar(); QStatusBar * sb = internalStatusBar(); if ( !sb ) { //US sb = new KStatusBar( this ); sb = new QStatusBar( this ); // trigger a re-layout and trigger a call to the private // setStatusBar method. - QMainWindow::statusBar(); + Q3MainWindow::statusBar(); } return sb; } void KMainWindow::shuttingDown() { // Needed for Qt <= 3.0.3 at least to prevent reentrancy // when queryExit() shows a dialog. Check before removing! static bool reentrancy_protection = false; if (!reentrancy_protection) { reentrancy_protection = true; // call the virtual queryExit queryExit(); reentrancy_protection = false; } } //US KMenuBar *KMainWindow::internalMenuBar() QMenuBar *KMainWindow::internalMenuBar() { //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); - QObjectList *l = queryList( "QMenuBar", 0, false, false ); - if ( !l || !l->first() ) { - delete l; + QObjectList l = queryList( "QMenuBar", 0, false, false ); + if(l.empty()) return 0; - } - -//US KMenuBar *m = (KMenuBar*)l->first(); - QMenuBar *m = (QMenuBar*)l->first(); - delete l; - return m; + return (QMenuBar*)l.front(); } //US KStatusBar *KMainWindow::internalStatusBar() QStatusBar *KMainWindow::internalStatusBar() { //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); - QObjectList *l = queryList( "QStatusBar", 0, false, false ); - if ( !l || !l->first() ) { - delete l; + QObjectList l = queryList( "QStatusBar", 0, false, false ); + if(l.empty()) return 0; - } - -//US KStatusBar *s = (KStatusBar*)l->first(); - QStatusBar *s = (QStatusBar*)l->first(); - delete l; - return s; + return (QStatusBar*)l.front(); } void KMainWindow::childEvent( QChildEvent* e) { - QMainWindow::childEvent( e ); + Q3MainWindow::childEvent( e ); } void KMainWindow::paintEvent( QPaintEvent * e) { - QMainWindow::paintEvent( e ); + Q3MainWindow::paintEvent( e ); } QSize KMainWindow::sizeForCentralWidgetSize(QSize size) { KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); if (tb && !tb->isHidden()) { switch( tb->barPos() ) { case KToolBar::Top: case KToolBar::Bottom: size += QSize(0, tb->sizeHint().height()); break; diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h index 2dc8033..a3ac82f 100644 --- a/microkde/kdeui/kmainwindow.h +++ b/microkde/kdeui/kmainwindow.h @@ -1,12 +1,17 @@ +//Added by qt3to4: +#include <QResizeEvent> +#include <QChildEvent> +#include <QCloseEvent> +#include <QPaintEvent> /* This file is part of the KDE libraries This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. @@ -41,30 +46,30 @@ class KMWSessionManaged; class KAccel; class KToolBarMenuAction; */ class QMenuBar; class QStatusBar; class KMainWindowPrivate; class KAction; #include <ktoolbar.h> #include <ktoolbarhandler.h> #include <kxmlguiclient.h> -#include <qmainwindow.h> -#include <qptrlist.h> +#include <q3mainwindow.h> +#include <q3ptrlist.h> class KActionCollection; -class KMainWindow : public QMainWindow, virtual public KXMLGUIClient +class KMainWindow : public Q3MainWindow, virtual public KXMLGUIClient { Q_OBJECT private: //US create private defaultconstructor KMainWindow() {;}; public: /** * Construct a main window. * @@ -311,30 +316,30 @@ public: /** * Returns a pointer to the toolbar with the specified name. * This refers to toolbars created dynamically from the XML UI * framework. If the toolbar does not exist one will be created. * * @param name The internal name of the toolbar. If no name is * specified "mainToolBar" is assumed. * * @return A pointer to the toolbar **/ KToolBar *toolBar( const char *name=0 ); // method for getting rid of KDE-Crap - QToolBar *tBar( ); + Q3ToolBar *tBar( ); /** * @return An iterator over the list of all toolbars for this window. */ - QPtrListIterator<KToolBar> toolBarIterator(); + Q3PtrListIterator<KToolBar> toolBarIterator(); /** * @return A KAccel instance bound to this mainwindow. Used automatically * by KAction to make keybindings work in all cases. */ KAccel *accel(); void setFrameBorderWidth( int ) {} /** * Call this to enable "auto-save" of toolbar/menubar/statusbar settings * (and optionally window size). @@ -749,29 +754,29 @@ protected slots: */ //US virtual void showAboutApplication(); private slots: /** * Called when the app is shutting down. */ void shuttingDown(); void saveAutoSaveSettings(); private: - QToolBar * mQToolBar; + Q3ToolBar * mQToolBar; //US KMenuBar *internalMenuBar(); QMenuBar *internalMenuBar(); //US KStatusBar *internalStatusBar(); QStatusBar *internalStatusBar(); KMainWindowPrivate *d; void initKMainWindow(const char *name); - QPtrList<KToolBar> toolbarList; + Q3PtrList<KToolBar> toolbarList; protected: virtual void virtual_hook( int id, void* data ); }; #endif diff --git a/microkde/kdeui/knuminput.cpp b/microkde/kdeui/knuminput.cpp index 335d6f4..da01a20 100644 --- a/microkde/kdeui/knuminput.cpp +++ b/microkde/kdeui/knuminput.cpp @@ -33,24 +33,27 @@ #include <limits.h> #endif #include <assert.h> #include <math.h> #include <algorithm> #include <qlabel.h> #include <qlineedit.h> #include <qsize.h> #include <qslider.h> #include <qspinbox.h> #include <qstyle.h> +//Added by qt3to4: +#include <QResizeEvent> +#include <QEvent> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include "knumvalidator.h" #include "knuminput.h" static inline int calcDiffByTen( int x, int y ) { // calculate ( x - y ) / 10 without overflowing ints: return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10; } @@ -97,50 +100,50 @@ KNumInput::~KNumInput() } void KNumInput::setLabel(const QString & label, int a) { if(label.isEmpty()) { delete m_label; m_label = 0; m_alignment = 0; } else { if (m_label) m_label->setText(label); else m_label = new QLabel(label, this, "KNumInput::QLabel"); - m_label->setAlignment((a & (~(AlignTop|AlignBottom|AlignVCenter))) - | AlignVCenter); + m_label->setAlignment((a & (~(Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter))) + | Qt::AlignVCenter); // if no vertical alignment set, use Top alignment - if(!(a & (AlignTop|AlignBottom|AlignVCenter))) - a |= AlignTop; + if(!(a & (Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter))) + a |= Qt::AlignTop; m_alignment = a; } layout(true); } QString KNumInput::label() const { if (m_label) return m_label->text(); return QString::null; } void KNumInput::layout(bool deep) { int w1 = m_colw1; int w2 = m_colw2; // label sizeHint m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0)); - if(m_label && (m_alignment & AlignVCenter)) + if(m_label && (m_alignment & Qt::AlignVCenter)) m_colw1 = m_sizeLabel.width() + 4; else m_colw1 = 0; // slider sizeHint m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0)); doLayout(); if(!deep) { m_colw1 = w1; m_colw2 = w2; @@ -193,38 +196,38 @@ QSize KNumInput::sizeHint() const void KNumInput::setSteps(int minor, int major) { if(m_slider) m_slider->setSteps( minor, major ); } // ---------------------------------------------------------------------------- KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name) : QSpinBox(0, 99, 1, parent, name) { - editor()->setAlignment(AlignRight); + setAlignment(Qt::AlignRight); val_base = 10; setValue(0); } KIntSpinBox::~KIntSpinBox() { } KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base, QWidget* parent, const char* name) : QSpinBox(lower, upper, step, parent, name) { - editor()->setAlignment(AlignRight); + setAlignment(Qt::AlignRight); val_base = base; setValue(value); } void KIntSpinBox::setBase(int base) { val_base = base; } int KIntSpinBox::base() const { @@ -234,27 +237,27 @@ int KIntSpinBox::base() const QString KIntSpinBox::mapValueToText(int v) { return QString::number(v, val_base); } int KIntSpinBox::mapTextToValue(bool* ok) { return cleanText().toInt(ok, val_base); } void KIntSpinBox::setEditFocus(bool mark) { - editor()->setFocus(); + setFocus(); if(mark) - editor()->selectAll(); + selectAll(); } // ---------------------------------------------------------------------------- class KIntNumInput::KIntNumInputPrivate { public: int referencePoint; short blockRelative; KIntNumInputPrivate( int r ) : referencePoint( r ), blockRelative( 0 ) {} @@ -316,32 +319,32 @@ void KIntNumInput::slotEmitRelativeValueChanged( int value ) { if ( d->blockRelative || !d->referencePoint ) return; emit relativeValueChanged( double( value ) / double( d->referencePoint ) ); } void KIntNumInput::setRange(int lower, int upper, int step, bool slider) { upper = kMax(upper, lower); lower = kMin(upper, lower); m_spin->setMinValue(lower); m_spin->setMaxValue(upper); m_spin->setLineStep(step); - step = m_spin->lineStep(); // maybe QRangeControl didn't like out lineStep? + step = m_spin->singleStep(); // maybe QRangeControl didn't like out lineStep? if(slider) { if (m_slider) m_slider->setRange(lower, upper); else { m_slider = new QSlider(lower, upper, step, m_spin->value(), - QSlider::Horizontal, this); + Qt::Horizontal, this); m_slider->setTickmarks(QSlider::Below); connect(m_slider, SIGNAL(valueChanged(int)), m_spin, SLOT(setValue(int))); } // calculate (upper-lower)/10 without overflowing int's: int major = calcDiffByTen( upper, lower ); if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4 m_slider->setSteps(step, major); m_slider->setTickInterval(major); } @@ -349,35 +352,35 @@ void KIntNumInput::setRange(int lower, int upper, int step, bool slider) delete m_slider; m_slider = 0; } // check that reference point is still inside valid range: setReferencePoint( referencePoint() ); layout(true); } void KIntNumInput::setMinValue(int min) { - setRange(min, m_spin->maxValue(), m_spin->lineStep(), m_slider); + setRange(min, m_spin->maxValue(), m_spin->singleStep(), m_slider); } int KIntNumInput::minValue() const { return m_spin->minValue(); } void KIntNumInput::setMaxValue(int max) { - setRange(m_spin->minValue(), max, m_spin->lineStep(), m_slider); + setRange(m_spin->minValue(), max, m_spin->singleStep(), m_slider); } int KIntNumInput::maxValue() const { return m_spin->maxValue(); } void KIntNumInput::setSuffix(const QString &suffix) { m_spin->setSuffix(suffix); layout(true); @@ -406,70 +409,70 @@ void KIntNumInput::setEditFocus(bool mark) } QSize KIntNumInput::minimumSizeHint() const { constPolish(); int w; int h; h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height()); // if in extra row, then count it here - if(m_label && (m_alignment & (AlignBottom|AlignTop))) + if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop))) h += 4 + m_sizeLabel.height(); else // label is in the same row as the other widgets h = QMAX(h, m_sizeLabel.height() + 2); w = m_slider ? m_slider->sizeHint().width() + 8 : 0; w += m_colw1 + m_colw2; - if(m_alignment & (AlignTop|AlignBottom)) + if(m_alignment & (Qt::AlignTop|Qt::AlignBottom)) w = QMAX(w, m_sizeLabel.width() + 4); return QSize(w, h); } void KIntNumInput::doLayout() { m_sizeSpin = m_spin->sizeHint(); m_colw2 = m_sizeSpin.width(); if (m_label) m_label->setBuddy(m_spin); } void KIntNumInput::resizeEvent(QResizeEvent* e) { int w = m_colw1; int h = 0; - if(m_label && (m_alignment & AlignTop)) { + if(m_label && (m_alignment & Qt::AlignTop)) { m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); h += m_sizeLabel.height() + 4; } - if(m_label && (m_alignment & AlignVCenter)) + if(m_label && (m_alignment & Qt::AlignVCenter)) m_label->setGeometry(0, 0, w, m_sizeSpin.height()); m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height()); w += m_colw2 + 8; if(m_slider) m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height()); h += m_sizeSpin.height() + 2; - if(m_label && (m_alignment & AlignBottom)) + if(m_label && (m_alignment & Qt::AlignBottom)) m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); } KIntNumInput::~KIntNumInput() { delete d; } void KIntNumInput::setValue(int val) { m_spin->setValue(val); // slider value is changed by spinValueChanged @@ -637,62 +640,62 @@ void KDoubleNumInput::slotEmitRelativeValueChanged( double value ) } QSize KDoubleNumInput::minimumSizeHint() const { constPolish(); int w; int h; h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height()); // if in extra row, then count it here - if(m_label && (m_alignment & (AlignBottom|AlignTop))) + if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop))) h += 4 + m_sizeLabel.height(); else // label is in the same row as the other widgets h = QMAX(h, m_sizeLabel.height() + 2); w = m_slider ? m_slider->sizeHint().width() + 8 : 0; w += m_colw1 + m_colw2; - if(m_alignment & (AlignTop|AlignBottom)) + if(m_alignment & (Qt::AlignTop|Qt::AlignBottom)) w = QMAX(w, m_sizeLabel.width() + 4); return QSize(w, h); } void KDoubleNumInput::resizeEvent(QResizeEvent* e) { int w = m_colw1; int h = 0; - if(m_label && (m_alignment & AlignTop)) { + if(m_label && (m_alignment & Qt::AlignTop)) { m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height()); h += m_sizeLabel.height() + 4; } - if(m_label && (m_alignment & AlignVCenter)) + if(m_label && (m_alignment & Qt::AlignVCenter)) m_label->setGeometry(0, 0, w, m_sizeEdit.height()); d->spin->setGeometry(w, h, m_slider ? m_colw2 : e->size().width() - w, m_sizeEdit.height()); w += m_colw2 + 8; if(m_slider) m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height()); h += m_sizeEdit.height() + 2; - if(m_label && (m_alignment & AlignBottom)) + if(m_label && (m_alignment & Qt::AlignBottom)) m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height()); } void KDoubleNumInput::doLayout() { m_sizeEdit = d->spin->sizeHint(); m_colw2 = m_sizeEdit.width(); } void KDoubleNumInput::setValue(double val) { d->spin->setValue( val ); @@ -721,32 +724,32 @@ void KDoubleNumInput::setRange(double lower, double upper, double step, QSpinBox * spin = d->spin; disconnect(spin, SIGNAL(valueChanged(int)), m_slider, SLOT(setValue(int)) ); } d->spin->setRange( lower, upper, step, d->spin->precision() ); if(slider) { // upcast to base type to get the min/maxValue in int form: QSpinBox * spin = d->spin; int slmax = spin->maxValue(); int slmin = spin->minValue(); int slvalue = spin->value(); - int slstep = spin->lineStep(); + int slstep = spin->singleStep(); if (m_slider) { m_slider->setRange(slmin, slmax); m_slider->setLineStep(slstep); m_slider->setValue(slvalue); } else { m_slider = new QSlider(slmin, slmax, slstep, slvalue, - QSlider::Horizontal, this); + Qt::Horizontal, this); m_slider->setTickmarks(QSlider::Below); // feedback line: when one moves, the other moves, too: connect(m_slider, SIGNAL(valueChanged(int)), SLOT(sliderMoved(int)) ); } connect(spin, SIGNAL(valueChanged(int)), m_slider, SLOT(setValue(int)) ); // calculate ( slmax - slmin ) / 10 without overflowing ints: int major = calcDiffByTen( slmax, slmin ); if ( !major ) major = slstep; // ### needed? m_slider->setTickInterval(major); } else { @@ -903,35 +906,35 @@ public: double mapToDouble( int value ) const { return double(value) * basicStep(); } int mPrecision; KDoubleValidator * mValidator; }; KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name ) : QSpinBox( parent, name ) { - editor()->setAlignment( Qt::AlignRight ); + setAlignment( Qt::AlignRight ); d = new Private(); updateValidator(); } KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step, double value, int precision, QWidget * parent, const char * name ) : QSpinBox( parent, name ) { - editor()->setAlignment( Qt::AlignRight ); + setAlignment( Qt::AlignRight ); d = new Private(); setRange( lower, upper, step, precision ); setValue( value ); connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) ); } KDoubleSpinBox::~KDoubleSpinBox() { delete d; d = 0; } bool KDoubleSpinBox::acceptLocalizedNumbers() const { if ( !d->mValidator ) return true; // we'll set one that does; @@ -1018,25 +1021,25 @@ double KDoubleSpinBox::maxValue() const { return d->mapToDouble( base::maxValue() ); } void KDoubleSpinBox::setMaxValue( double value ) { bool ok = false; int max = d->mapToInt( value, &ok ); if ( !ok ) return; base::setMaxValue( max ); updateValidator(); } double KDoubleSpinBox::lineStep() const { - return d->mapToDouble( base::lineStep() ); + return d->mapToDouble( base::singleStep() ); } void KDoubleSpinBox::setLineStep( double step ) { bool ok = false; if ( step > maxValue() - minValue() ) base::setLineStep( 1 ); else base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) ); } QString KDoubleSpinBox::mapValueToText( int value ) { if ( acceptLocalizedNumbers() ) @@ -1063,25 +1066,25 @@ int KDoubleSpinBox::mapTextToValue( bool * ok ) { void KDoubleSpinBox::setValidator( const QValidator * ) { // silently discard the new validator. We don't want another one ;-) } void KDoubleSpinBox::slotValueChanged( int value ) { emit valueChanged( d->mapToDouble( value ) ); } void KDoubleSpinBox::updateValidator() { if ( !d->mValidator ) { d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(), this, "d->mValidator" ); - base::setValidator( d->mValidator ); + lineEdit()->setValidator( d->mValidator ); } else d->mValidator->setRange( minValue(), maxValue(), precision() ); } void KNumInput::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } void KIntNumInput::virtual_hook( int id, void* data ) { KNumInput::virtual_hook( id, data ); } void KDoubleNumInput::virtual_hook( int id, void* data ) { KNumInput::virtual_hook( id, data ); } diff --git a/microkde/kdeui/knuminput.h b/microkde/kdeui/knuminput.h index 123fefa..9f9e200 100644 --- a/microkde/kdeui/knuminput.h +++ b/microkde/kdeui/knuminput.h @@ -20,24 +20,29 @@ * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef K_NUMINPUT_H #define K_NUMINPUT_H #include <qwidget.h> #include <qspinbox.h> +#include <QLineEdit> +//Added by qt3to4: +#include <QResizeEvent> +#include <QLabel> +#include <QEvent> class QLabel; class QSlider; class QLineEdit; class QLayout; class QValidator; class KIntSpinBox; /* ------------------------------------------------------------------------ */ /** @@ -72,25 +77,25 @@ public: * @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and * @p AlignTop, @p AlignVCenter, @p AlignBottom. * default is @p AlignLeft | @p AlignTop. * * The vertical alignment flags have special meaning with this * widget: * * @li @p AlignTop The label is placed above the edit/slider * @li @p AlignVCenter The label is placed left beside the edit * @li @p AlignBottom The label is placed below the edit/slider * */ - virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); + virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); /** * @return the text of the label. */ QString label() const; /** * @return if the num input has a slider. * @since 3.1 */ bool showSlider() const { return m_slider; } @@ -293,25 +298,25 @@ public: /** * Sets the special value text. If set, the SpinBox will display * this text instead of the numeric value whenever the current * value is equal to minVal(). Typically this is used for indicating * that the choice has a special (default) meaning. */ void setSpecialValueText(const QString& text); /** * @reimplemented */ - virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); + virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); /** * This method returns the minimum size necessary to display the * control. The minimum size is enough to show all the labels * in the current font (font change may invalidate the return value). * * @return the minimum size necessary to show the control */ virtual QSize minimumSizeHint() const; public slots: /** @@ -579,25 +584,25 @@ public: /** * Sets the special value text. If set, the spin box will display * this text instead of the numeric value whenever the current * value is equal to @ref #minVal(). Typically this is used for indicating * that the choice has a special (default) meaning. */ void setSpecialValueText(const QString& text); /** * @reimplemented */ - virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop); + virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop); /** * @reimplemented */ virtual QSize minimumSizeHint() const; /** * @reimplemented */ virtual bool eventFilter(QObject*, QEvent*); public slots: /** * Sets the value of the control. @@ -749,24 +754,28 @@ public: */ void setBase(int base); /** * @return the base in which numbers in the spin box are represented. */ int base() const; /** * sets focus and optionally marks all text * */ void setEditFocus(bool mark); + void setValidator(const QValidator *v) { + lineEdit()->setValidator(v); + } + protected: /** * Overloaded the method in QSpinBox * to make use of the base given in the constructor. */ virtual QString mapValueToText(int); /** * Overloaded the method in QSpinBox * to make use of the base given in the constructor. */ diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp index 96d2a87..7e1503c 100644 --- a/microkde/kdeui/kpopupmenu.cpp +++ b/microkde/kdeui/kpopupmenu.cpp @@ -1,19 +1,22 @@ #include <kpopupmenu.h> #include <qtimer.h> +//Added by qt3to4: +#include <QFocusEvent> +#include <Q3PopupMenu> KPopupMenu::KPopupMenu ( QWidget * parent, const char * name ) - : QPopupMenu ( parent, name ) {;} + : Q3PopupMenu ( parent, name ) {;} KMenuBar::KMenuBar ( QWidget * parent, const char * name ) : QPEMenuBar ( parent, name ) {} void KMenuBar::focusOutEvent ( QFocusEvent * e) { QPEMenuBar::focusOutEvent( e ); QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) ); } diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h index fd00f36..1c903ad 100644 --- a/microkde/kdeui/kpopupmenu.h +++ b/microkde/kdeui/kpopupmenu.h @@ -1,24 +1,26 @@ #ifndef KPOPUPMENU_H #define KPOPUPMENU_H -#include <qpopupmenu.h> +#include <q3popupmenu.h> +//Added by qt3to4: +#include <QFocusEvent> #ifdef DESKTOP_VERSION #include <qmenubar.h> #define QPEMenuBar QMenuBar #else #include <qpe/qpemenubar.h> #endif -class KPopupMenu : public QPopupMenu +class KPopupMenu : public Q3PopupMenu { Q_OBJECT public: KPopupMenu ( QWidget * parent=0, const char * name=0 ); }; class KMenuBar : public QPEMenuBar { Q_OBJECT public: diff --git a/microkde/kdeui/kseparator.cpp b/microkde/kdeui/kseparator.cpp index d028420..66000f0 100644 --- a/microkde/kdeui/kseparator.cpp +++ b/microkde/kdeui/kseparator.cpp @@ -9,68 +9,70 @@ * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include <qstyle.h> +//Added by qt3to4: +#include <Q3Frame> #include <kdebug.h> //US #include <kapplication.h> //US #include "kseparator.moc" #include "kseparator.h" -KSeparator::KSeparator(QWidget* parent, const char* name, WFlags f) - : QFrame(parent, name, f) +KSeparator::KSeparator(QWidget* parent, const char* name, Qt::WFlags f) + : Q3Frame(parent, name, f) { setLineWidth(1); setMidLineWidth(0); setOrientation( HLine ); } -KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, WFlags f) - : QFrame(parent, name, f) +KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, Qt::WFlags f) + : Q3Frame(parent, name, f) { setLineWidth(1); setMidLineWidth(0); setOrientation( orientation ); } void KSeparator::setOrientation(int orientation) { switch(orientation) { - case Vertical: + case Qt::Vertical: case VLine: - setFrameStyle( QFrame::VLine | QFrame::Sunken ); + setFrameStyle( Q3Frame::VLine | Q3Frame::Sunken ); setMinimumSize(2, 0); break; default: kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl; - case Horizontal: + case Qt::Horizontal: case HLine: - setFrameStyle( QFrame::HLine | QFrame::Sunken ); + setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken ); setMinimumSize(0, 2); break; } } int KSeparator::orientation() const { if ( frameStyle() & VLine ) return VLine; diff --git a/microkde/kdeui/kseparator.h b/microkde/kdeui/kseparator.h index 6d2712a..c673475 100644 --- a/microkde/kdeui/kseparator.h +++ b/microkde/kdeui/kseparator.h @@ -11,49 +11,49 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef __KSEPARATOR_H__ #define __KSEPARATOR_H__ -#include <qframe.h> +#include <q3frame.h> /** * Standard horizontal or vertical separator. * * @author Michael Roth <mroth@wirlweb.de> * @version $Id$ */ -class KSeparator : public QFrame +class KSeparator : public Q3Frame { Q_OBJECT Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) public: /** * Constructor. **/ - KSeparator(QWidget* parent=0, const char* name=0, WFlags f=0); + KSeparator(QWidget* parent=0, const char* name=0, Qt::WFlags f=0); /** * Constructor. * * @param orientation Set the orientation of the separator. * Possible values are HLine or Horizontal and VLine or Vertical. **/ KSeparator(int orientation, QWidget* parent=0, const char* name=0, - WFlags f=0); + Qt::WFlags f=0); /** * Returns the orientation of the separator. * * Possible values are VLine and HLine. **/ int orientation() const; /** * Set the orientation of the separator to @p orient * * Possible values are VLine and HLine. diff --git a/microkde/kdeui/ksqueezedtextlabel.cpp b/microkde/kdeui/ksqueezedtextlabel.cpp index 37fa29a..e2c61fd 100644 --- a/microkde/kdeui/ksqueezedtextlabel.cpp +++ b/microkde/kdeui/ksqueezedtextlabel.cpp @@ -9,24 +9,27 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ksqueezedtextlabel.h" #include <qtooltip.h> +//Added by qt3to4: +#include <QResizeEvent> +#include <QLabel> KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name ) : QLabel ( parent, name ) { setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); fullText = text; squeezeTextToLabel(); } KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name ) : QLabel ( parent, name ) { setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); } diff --git a/microkde/kdeui/ksqueezedtextlabel.h b/microkde/kdeui/ksqueezedtextlabel.h index 1634adc..487d0b0 100644 --- a/microkde/kdeui/ksqueezedtextlabel.h +++ b/microkde/kdeui/ksqueezedtextlabel.h @@ -11,24 +11,26 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KSQUEEZEDTEXTLABEL_H #define KSQUEEZEDTEXTLABEL_H #include <qlabel.h> +//Added by qt3to4: +#include <QResizeEvent> /** * A label class that squeezes its text into the label * * If the text is too long to fit into the label it is divided into * remaining left and right parts which are separated by three dots. * * Example: * http://www.kde.org/documentation/index.html could be squeezed to * http://www.kde...ion/index.html * @short A replacement for QLabel that squeezes its text diff --git a/microkde/kdeui/kstdaction.cpp b/microkde/kdeui/kstdaction.cpp index cfd7b54..f0d162d 100644 --- a/microkde/kdeui/kstdaction.cpp +++ b/microkde/kdeui/kstdaction.cpp @@ -10,25 +10,25 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kstdaction.h" #include <qtoolbutton.h> -#include <qwhatsthis.h> +#include <q3whatsthis.h> //US #include <kaboutdata.h> #include <kaction.h> #include <kapplication.h> #include <kdebug.h> #include <kglobal.h> #include <kiconloader.h> #include <klocale.h> //US #include <kstdaccel.h> //US #include <kmainwindow.h> namespace KStdAction diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 027e5e9..02db316 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp @@ -16,40 +16,51 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef KDE_USE_FINAL #undef Always -#include <qdockwindow.h> +#include <q3dockwindow.h> #endif - +//Added by qt3to4: +#include <Q3ValueList> +#include <Q3PtrList> +#include <QPixmap> +#include <Q3Frame> +#include <QResizeEvent> +#include <QMouseEvent> +#include <QChildEvent> +#include <QEvent> +#include <QShowEvent> +#include <QDesktopWidget> +#include <QBoxLayout> #include "ktoolbar.h" #include "kmainwindow.h" #include <string.h> #include <qpainter.h> #include <qtooltip.h> #include <qdrawutil.h> #include <qstring.h> #include <qrect.h> -#include <qobjectlist.h> +#include <qobject.h> #include <qtimer.h> #include <qstyle.h> #include <qapplication.h> //US #include <config.h> #include "klineedit.h" #include "kseparator.h" #include <klocale.h> #include <kapplication.h> #include <kaction.h> #include <kstdaction.h> @@ -60,26 +71,26 @@ //US #include <kpopupmenu.h> //US #include <kanimwidget.h> //US #include <kipc.h> //US #include <kwin.h> #include <kdebug.h> #include <qlayout.h> #include "ktoolbarbutton.h" //US #include "kconfigbase.h" -#include <qpopupmenu.h> -#include <qmainwindow.h> +#include <q3popupmenu.h> +#include <q3mainwindow.h> enum { CONTEXT_TOP = 0, CONTEXT_LEFT = 1, CONTEXT_RIGHT = 2, CONTEXT_BOTTOM = 3, CONTEXT_FLOAT = 4, CONTEXT_FLAT = 5, CONTEXT_ICONS = 6, CONTEXT_TEXT = 7, CONTEXT_TEXTRIGHT = 8, CONTEXT_TEXTUNDER = 9, @@ -93,25 +104,25 @@ public: m_iconSize = 0; m_iconText = KToolBar::IconOnly; m_highlight = true; m_transparent = true; m_honorStyle = false; m_enableContext = true; m_xmlguiClient = 0; m_configurePlugged = false; //US oldPos = Qt::DockUnmanaged; - oldPos = QMainWindow::Unmanaged; + oldPos = Qt::Unmanaged; modified = m_isHorizontal = positioned = FALSE; HiddenDefault = false; IconSizeDefault = 0; IconTextDefault = "IconOnly"; IndexDefault = -1; NewLineDefault = false; OffsetDefault = -1; PositionDefault = "Top"; idleButtons.setAutoDelete(true); } @@ -120,129 +131,129 @@ public: KToolBar::IconText m_iconText; bool m_highlight : 1; bool m_transparent : 1; bool m_honorStyle : 1; bool m_isHorizontal : 1; bool m_enableContext : 1; bool m_configurePlugged : 1; bool modified : 1; bool positioned : 1; QWidget *m_parent; - QMainWindow::ToolBarDock oldPos; + Qt::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 ) {} + ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} //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 ) {} + ToolBarInfo( Qt::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; + Qt::ToolBarDock dock; }; ToolBarInfo toolBarInfo; - QValueList<int> iconSizes; + Q3ValueList<int> iconSizes; QTimer repaintTimer; // Default Values. bool HiddenDefault; int IconSizeDefault; QString IconTextDefault; int IndexDefault; bool NewLineDefault; int OffsetDefault; QString PositionDefault; - QPtrList<QWidget> idleButtons; + Q3PtrList<QWidget> idleButtons; }; -KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, +KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent, const char* name ) - :QFrame( parent, name ), line( l ) + :Q3Frame( parent, name ), line( l ) { - connect( parent, SIGNAL(orientationChanged(Orientation)), - this, SLOT(setOrientation(Orientation)) ); + connect( parent, SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(setOrientation(Qt::Orientation)) ); setOrientation( o ); setBackgroundMode( parent->backgroundMode() ); setBackgroundOrigin( ParentOrigin ); } -void KToolBarSeparator::setOrientation( Orientation o ) +void KToolBarSeparator::setOrientation( Qt::Orientation o ) { orient = o; if ( line ) { - if ( orientation() == Vertical ) + if ( orientation() == Qt::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 ); + return orientation() == Qt::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, + : Q3ToolBar( QString::fromLatin1( name ), + parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0, parent, FALSE, name ? name : "mainToolBar") #else - : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, + : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(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 ) +KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) #ifdef DESKTOP_VERSION - : QToolBar( QString::fromLatin1( name ), + : Q3ToolBar( 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 ) +KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) #ifdef DESKTOP_VERSION - : QToolBar( QString::fromLatin1( name ), + : Q3ToolBar( QString::fromLatin1( name ), parentWindow, dock, newLine, name ? name : "mainToolBar") #else : QPEToolBar( parentWindow,QString::fromLatin1( name )) #endif { init( readConfig, honorStyle ); } @@ -271,26 +282,26 @@ void KToolBar::init( bool readConfig, bool honorStyle ) 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 * ) ) ); + connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ), + this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) ); // 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 ); @@ -332,37 +343,37 @@ int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, 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, +int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *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, +int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *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, @@ -531,37 +542,37 @@ void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap ) void KToolBar::setButtonIcon( int id, const QString& _icon ) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); KToolBarButton * button = (KToolBarButton *)( *it ); if ( button ) button->setIcon( _icon ); } -void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) +void KToolBar::setButtonIconSet( int id, const QIcon& iconset ) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); KToolBarButton * button = (KToolBarButton *)( *it ); if ( button ) button->setIconSet( iconset ); } -void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) +void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle ) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) return; //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); KToolBarButton * button = (KToolBarButton *)( *it ); if ( button ) button->setDelayedPopup( _popup, toggle ); } void KToolBar::setAutoRepeat (int id, bool flag) @@ -778,25 +789,25 @@ QWidget *KToolBar::getWidget (int id) void KToolBar::setItemAutoSized (int id, bool yes ) { QWidget *w = getWidget(id); if ( w && yes ) setStretchableWidget( w ); } void KToolBar::clear () { - QToolBar::clear(); + Q3ToolBar::clear(); widget2id.clear(); id2widget.clear(); } void KToolBar::removeItem(int id) { Id2WidgetMap::Iterator it = id2widget.find( id ); if ( it == id2widget.end() ) { kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; return; @@ -867,39 +878,39 @@ bool KToolBar::fullSize() const void KToolBar::enableMoving(bool flag ) { //US setMovingEnabled(flag); this->mainWindow()->setToolBarsMovable(flag); } void KToolBar::setBarPos (BarPosition bpos) { if ( !mainWindow() ) return; //US mainWindow()->moveDockWindow( this, (Dock)bpos ); - mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); + mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos ); } const KToolBar::BarPosition KToolBar::barPos() { - if ( !(QMainWindow*)mainWindow() ) + if ( !(Q3MainWindow*)mainWindow() ) return KToolBar::Top; //US Dock dock; - QMainWindow::ToolBarDock dock; + Qt::ToolBarDock dock; int dm1, dm2; bool dm3; - ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); + ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 ); //US if ( dock == DockUnmanaged ) { - if ( dock == QMainWindow::Unmanaged ) { + if ( dock == Qt::Unmanaged ) { return (KToolBar::BarPosition)Top; } return (BarPosition)dock; } bool KToolBar::enable(BarStatus stat) { bool mystat = isVisible(); if ( (stat == Toggle && mystat) || stat == Hide ) hide(); @@ -958,25 +969,25 @@ void KToolBar::setIconText(IconText icontext, bool update) d->m_iconText = icontext; doUpdate=true; } if (update == false) return; if (doUpdate) emit modechange(); // tell buttons what happened // ugly hack to force a QMainWindow::triggerLayout( TRUE ) if ( mainWindow() ) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setUpdatesEnabled( TRUE ); } } KToolBar::IconText KToolBar::iconText() const { return d->m_iconText; } @@ -995,25 +1006,25 @@ void KToolBar::setIconSize(int size, bool update) d->m_iconSize = size; doUpdate=true; } if (update == false) return; if (doUpdate) emit modechange(); // tell buttons what happened // ugly hack to force a QMainWindow::triggerLayout( TRUE ) if ( mainWindow() ) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); mw->setUpdatesEnabled( FALSE ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setToolBarsMovable( !mw->toolBarsMovable() ); mw->setUpdatesEnabled( TRUE ); } } int KToolBar::iconSize() const { /*US if ( !d->m_iconSize ) // default value? @@ -1053,28 +1064,28 @@ void KToolBar::setItemNoStyle(int id, bool no_style ) KToolBarButton * button = (KToolBarButton *)( *it ); if (button) button->setNoStyle( no_style ); } void KToolBar::setFlat (bool flag) { if ( !mainWindow() ) return; if ( flag ) //US mainWindow()->moveDockWindow( this, DockMinimized ); - mainWindow()->moveToolBar( this, QMainWindow::Minimized ); + mainWindow()->moveToolBar( this, Qt::Minimized ); else //US mainWindow()->moveDockWindow( this, DockTop ); - mainWindow()->moveToolBar( this, QMainWindow::Top ); + mainWindow()->moveToolBar( this, Qt::Top ); // And remember to save the new look later /*US if ( mainWindow()->inherits( "KMainWindow" ) ) static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); */ } int KToolBar::count() const { return id2widget.count(); } @@ -1240,52 +1251,52 @@ void KToolBar::doConnections( KToolBarButton *button ) connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); } void KToolBar::mousePressEvent ( QMouseEvent *m ) { if ( !mainWindow() ) return; - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); if ( mw->toolBarsMovable() && d->m_enableContext ) { - if ( m->button() == RightButton ) { + if ( m->button() == Qt::RightButton ) { int i = contextMenu()->exec( m->globalPos(), 0 ); switch ( i ) { case -1: return; // popup cancelled case CONTEXT_LEFT: //US mw->moveDockWindow( this, DockLeft ); - mw->moveToolBar( this, QMainWindow::Left ); + mw->moveToolBar( this, Qt::Left ); break; case CONTEXT_RIGHT: //US mw->moveDockWindow( this, DockRight ); - mw->moveToolBar( this, QMainWindow::Right ); + mw->moveToolBar( this, Qt::Right ); break; case CONTEXT_TOP: //US mw->moveDockWindow( this, DockTop ); - mw->moveToolBar( this, QMainWindow::Top ); + mw->moveToolBar( this, Qt::Top ); break; case CONTEXT_BOTTOM: //US mw->moveDockWindow( this, DockBottom ); - mw->moveToolBar( this, QMainWindow::Bottom ); + mw->moveToolBar( this, Qt::Bottom ); break; case CONTEXT_FLOAT: break; case CONTEXT_FLAT: //US mw->moveDockWindow( this, DockMinimized ); - mw->moveToolBar( this, QMainWindow::Minimized ); + mw->moveToolBar( this, Qt::Minimized ); break; case CONTEXT_ICONS: setIconText( IconOnly ); break; case CONTEXT_TEXTRIGHT: setIconText( IconTextRight ); break; case CONTEXT_TEXT: setIconText( TextOnly ); break; case CONTEXT_TEXTUNDER: setIconText( IconTextBottom ); @@ -1323,25 +1334,25 @@ void KToolBar::rebuildLayout() 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" ) ) + if ( w->inherits( "Q3PopupMenu" ) ) 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). @@ -1355,103 +1366,103 @@ void KToolBar::rebuildLayout() } 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" ) && + if ( !e->child()->inherits( "Q3PopupMenu" ) && ::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 { + } else if( e->type() == QEvent::ChildRemoved ) { removeWidgetInternal( w ); } - if ( isVisibleTo( 0 ) ) + /* TODO:hacker: 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 ); + Q3ToolBar::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 ); + Q3ToolBar::repaint( true ); qDebug(" KToolBar::repaintMe() "); } void KToolBar::showEvent( QShowEvent *e ) { rebuildLayout(); - QToolBar::showEvent( e ); + Q3ToolBar::showEvent( e ); } void KToolBar::setStretchableWidget( QWidget *w ) { - QToolBar::setStretchableWidget( w ); + Q3ToolBar::setStretchableWidget( w ); stretchableWidget = w; } QSizePolicy KToolBar::sizePolicy() const { - if ( orientation() == Horizontal ) + if ( orientation() == Qt::Horizontal ) return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); else return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); } QSize KToolBar::sizeHint() const { - QSize sh = QToolBar::sizeHint(); + QSize sh = Q3ToolBar::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; @@ -1499,61 +1510,61 @@ QSize KToolBar::sizeHint() const 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(); + minSize = Q3ToolBar::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(); + Q3ToolBar::hide(); } void KToolBar::show() { - QToolBar::show(); + Q3ToolBar::show(); } void KToolBar::resizeEvent( QResizeEvent *e ) { bool b = isUpdatesEnabled(); setUpdatesEnabled( FALSE ); - QToolBar::resizeEvent( e ); + Q3ToolBar::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(); @@ -1717,25 +1728,25 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr if (icon_text != d->m_iconText) { //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; setIconText(icon_text, false); doUpdate = true; } // ...and check if the icon size has changed if (iconsize != d->m_iconSize) { setIconSize(iconsize, false); doUpdate = true; } - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); // ...and if we should highlight if ( highlight != d->m_highlight ) { d->m_highlight = highlight; doUpdate = true; } // ...and if we should move transparently if ( mw && transparent != (!mw->opaqueMoving()) ) { mw->setOpaqueMoving( !transparent ); } @@ -1796,47 +1807,47 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup) pos = DockTop; else if ( position == "Bottom" ) pos = DockBottom; else if ( position == "Left" ) pos = DockLeft; else if ( position == "Right" ) pos = DockRight; else if ( position == "Floating" ) pos = DockTornOff; else if ( position == "Flat" ) pos = DockMinimized; */ - QMainWindow::ToolBarDock pos(QMainWindow::Top); + Qt::ToolBarDock pos(Qt::DockTop); if ( position == "Top" ) - pos = QMainWindow::Top; + pos = Qt::Top; else if ( position == "Bottom" ) - pos = QMainWindow::Bottom; + pos = Qt::Bottom; else if ( position == "Left" ) - pos = QMainWindow::Left; + pos = Qt::Left; else if ( position == "Right" ) - pos = QMainWindow::Right; + pos = Qt::Right; else if ( position == "Floating" ) - pos = QMainWindow::TornOff; + pos = Qt::TornOff; else if ( position == "Flat" ) - pos = QMainWindow::Minimized; + pos = Qt::Minimized; //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; if (hidden) hide(); else show(); if ( mainWindow() ) { - QMainWindow *mw = mainWindow(); + Q3MainWindow *mw = mainWindow(); //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); // moveDockWindow calls QDockArea which does a reparent() on us with // showIt = true, so we loose our visibility status bool doHide = isHidden(); //US mw->moveDockWindow( this, pos, newLine, index, offset ); mw->moveToolBar( this, pos, newLine, index, offset ); //kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl; @@ -1853,50 +1864,50 @@ bool KToolBar::event( QEvent *e ) if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() ) d->repaintTimer.start( 100, true ); if (e->type() == QEvent::ChildInserted ) { // By pass QToolBar::event, // it will show() the inserted child and we don't want to // do that until we have rebuild the layout. childEvent((QChildEvent *)e); return true; } - return QToolBar::event( e ); + return Q3ToolBar::event( e ); } void KToolBar::slotRepaint() { setUpdatesEnabled( FALSE ); // Send a resizeEvent to update the "toolbar extension arrow" // (The button you get when your toolbar-items don't fit in // the available space) QResizeEvent ev(size(), size()); resizeEvent(&ev); //#ifdef DESKTOP_VERSION QApplication::sendPostedEvents( this, QEvent::LayoutHint ); //#endif //DESKTOP_VERSION setUpdatesEnabled( TRUE ); repaint( TRUE ); } -void KToolBar::toolBarPosChanged( QToolBar *tb ) +void KToolBar::toolBarPosChanged( Q3ToolBar *tb ) { if ( tb != this ) return; //US if ( d->oldPos == DockMinimized ) - if ( d->oldPos == QMainWindow::Minimized ) + if ( d->oldPos == Qt::Minimized ) rebuildLayout(); - d->oldPos = (QMainWindow::ToolBarDock)barPos(); + d->oldPos = (Qt::ToolBarDock)barPos(); /*US if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); */ } /*US void KToolBar::loadState( const QDomElement &element ) { //kdDebug(220) << "KToolBar::loadState " << this << endl; if ( !mainWindow() ) return; @@ -2022,25 +2033,25 @@ void KToolBar::getAttributes( QString &position, QString &icontext, int &index ) position = "Right"; break; case KToolBar::Floating: position = "Floating"; break; case KToolBar::Top: default: position = "Top"; break; } if ( mainWindow() ) { - QMainWindow::ToolBarDock dock; + Qt::ToolBarDock dock; bool newLine; int offset; mainWindow()->getLocation( this, dock, index, newLine, offset ); } switch (d->m_iconText) { case KToolBar::IconTextRight: icontext = "IconTextRight"; break; case KToolBar::IconTextBottom: icontext = "IconTextBottom"; break; @@ -2091,70 +2102,70 @@ void KToolBar::positionYourself( bool force ) d->toolBarInfo.index, d->toolBarInfo.offset ); */ mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); if ( doHide ) hide(); // This method can only have an effect once - unless force is set d->positioned = TRUE; } //US KPopupMenu *KToolBar::contextMenu() -QPopupMenu *KToolBar::contextMenu() +Q3PopupMenu *KToolBar::contextMenu() { if ( context ) return context; // Construct our context popup menu. Name it qt_dockwidget_internal so it // won't be deleted by QToolBar::clear(). //US context = new KPopupMenu( this, "qt_dockwidget_internal" ); - context = new QPopupMenu( this, "qt_dockwidget_internal" ); + context = new Q3PopupMenu( this, "qt_dockwidget_internal" ); //US context->insertTitle(i18n("Toolbar Menu")); //US KPopupMenu *orient = new KPopupMenu( context, "orient" ); - QPopupMenu *orient = new QPopupMenu( context, "orient" ); + Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" ); orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT ); orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT ); orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM ); orient->insertSeparator(-1); //orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT ); orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT ); //US KPopupMenu *mode = new KPopupMenu( context, "mode" ); - QPopupMenu *mode = new QPopupMenu( context, "mode" ); + Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" ); mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); mode->insertItem( i18n("Text Only"), CONTEXT_TEXT ); mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT ); mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER ); //US KPopupMenu *size = new KPopupMenu( context, "size" ); - QPopupMenu *size = new QPopupMenu( context, "size" ); + Q3PopupMenu *size = new Q3PopupMenu( context, "size" ); size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); // Query the current theme for available sizes - QValueList<int> avSizes; + Q3ValueList<int> avSizes; /*US KIconTheme *theme = KGlobal::instance()->iconLoader()->theme(); if (!::qstrcmp(QObject::name(), "mainToolBar")) avSizes = theme->querySizes( KIcon::MainToolbar); else avSizes = theme->querySizes( KIcon::Toolbar); */ avSizes << 16; avSizes << 32; d->iconSizes = avSizes; - QValueList<int>::Iterator it; + Q3ValueList<int>::Iterator it; for (it=avSizes.begin(); it!=avSizes.end(); it++) { QString text; if ( *it < 19 ) text = i18n("Small (%1x%2)").arg(*it).arg(*it); else if (*it < 25) text = i18n("Medium (%1x%2)").arg(*it).arg(*it); else text = i18n("Large (%1x%2)").arg(*it).arg(*it); //we use the size as an id, with an offset size->insertItem( text, CONTEXT_ICONSIZES + *it ); } @@ -2209,26 +2220,26 @@ void KToolBar::slotContextAboutToShow() break; case IconTextRight: context->setItemChecked(CONTEXT_TEXTRIGHT, true); break; case TextOnly: context->setItemChecked(CONTEXT_TEXT, true); break; case IconTextBottom: context->setItemChecked(CONTEXT_TEXTUNDER, true); break; } - QValueList<int>::ConstIterator iIt = d->iconSizes.begin(); - QValueList<int>::ConstIterator iEnd = d->iconSizes.end(); + Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin(); + Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end(); for (; iIt != iEnd; ++iIt ) context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false ); context->setItemChecked( CONTEXT_ICONSIZES, false ); context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true ); for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i ) context->setItemChecked( i, false ); switch ( barPos() ) { diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 3319fa8..4e00abd 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h @@ -17,77 +17,85 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KTOOLBAR_H #define KTOOLBAR_H #ifndef DESKTOP_VERSION #define private public -#include <qtoolbar.h> +#include <q3toolbar.h> #undef private #include <qpe/qpetoolbar.h> #else -#include <qtoolbar.h> +#include <q3toolbar.h> #endif -#include <qmainwindow.h> +#include <q3mainwindow.h> #include <qcombobox.h> #include <qmap.h> -#include <qptrlist.h> +#include <q3ptrlist.h> +//Added by qt3to4: +#include <QPixmap> +#include <QResizeEvent> +#include <Q3PopupMenu> +#include <QMouseEvent> +#include <QChildEvent> +#include <QEvent> +#include <QShowEvent> #include <kglobal.h> -#include <qguardedptr.h> -#include <qframe.h> -#include <qiconset.h> +#include <qpointer.h> +#include <q3frame.h> +#include <qicon.h> class QDomElement; class QSize; class QPixmap; -class QPopupMenu; +class Q3PopupMenu; class QStringList; class QDomDocument; class QTimer; class KLineEdit; class KToolBar; class KToolBarButton; class KToolBoxManager; //US class KAnimWidget; //US class KPopupMenu; //US class KInstance; class KComboBox; class KXMLGUIClient; class KToolBarPrivate; -class KToolBarSeparator : public QFrame +class KToolBarSeparator : public Q3Frame { Q_OBJECT public: - KToolBarSeparator( Orientation, bool l, QToolBar *parent, const char* name=0 ); + KToolBarSeparator( Qt::Orientation, bool l, Q3ToolBar *parent, const char* name=0 ); QSize sizeHint() const; - Orientation orientation() const { return orient; } + Qt::Orientation orientation() const { return orient; } QSizePolicy sizePolicy() const; bool showLine() const { return line; } public slots: - void setOrientation( Orientation ); + void setOrientation( Qt::Orientation ); protected: void styleChange( QStyle& ); private: - Orientation orient; + Qt::Orientation orient; bool line; }; /** * A KDE-style toolbar. * * KToolBar can be dragged around in and between different docks. * * A KToolBar can contain all sorts of widgets. * * KToolBar can be used as a standalone widget, but @ref KMainWindow @@ -102,41 +110,41 @@ private: * construction. It will reread this config group on a * @ref KApplication::appearanceChanged() signal. * * @short Floatable toolbar with auto resize. * @version $Id$ * @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>. */ // strange things are happening ... so I have to use strange define methods ... // porting KToolBar back to Qt2 really needs some strange hacks #ifndef DESKTOP_VERSION -#define QToolBar QPEToolBar +#define Q3ToolBar QPEToolBar #endif - class KToolBar : public QToolBar + class KToolBar : public Q3ToolBar { Q_OBJECT Q_ENUMS( IconText BarPosition ) Q_PROPERTY( IconText iconText READ iconText WRITE setIconText ) Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos ) Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize ) Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize ) Q_PROPERTY( QString text READ text WRITE setText ) #ifndef DESKTOP_VERSION -#undef QToolBar +#undef Q3ToolBar #endif public: enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom}; /** * The state of the status bar. * @deprecated **/ enum BarStatus{Toggle, Show, Hide}; /** * Possible bar positions. **/ enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat}; @@ -166,43 +174,43 @@ public: * The toolbar will read in various global config settings for * things like icon size and text position, etc. However, some of * the settings will be honored only if @ref #_honor_mode is set to * true. All other toolbars will be IconOnly and use Medium icons. * * @param parentWindow The window that should be the parent of this toolbar * @param dock The position of the toolbar. Usually QMainWindow::Top. * @param newLine If true, start a new line in the dock for this toolbar. * @param name The standard internal name * @param honor_style If true, then global settings for IconSize and IconText will be honored * @param readConfig whether to apply the configuration (global and application-specific) */ - KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false, + KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); /** * Constructor for non-XML-GUI applications. * * The toolbar will read in various global config settings for * things like icon size and text position, etc. However, some of * the settings will be honored only if @ref #_honor_mode is set to * true. All other toolbars will be IconOnly and use Medium icons. * * @param parentWindow The window that should be the parent of this toolbar * @param dock Another widget than the mainwindow to dock toolbar to. * @param newLine If true, start a new line in the dock for this toolbar. * @param name The standard internal name * @param honor_style If true, then global settings for IconSize and IconText will be honored * @param readConfig whether to apply the configuration (global and application-specific) */ - KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine = false, + KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine = false, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE ); virtual ~KToolBar(); /** * Insert a button (a @ref KToolBarButton) with a pixmap. The * pixmap is loaded by the button itself based on the global icon * settings. * * You should connect to one or more signals in KToolBar: * @ref clicked() , @ref pressed() , @ref released() , or * @ref highlighted() and if the button is a toggle button @@ -294,40 +302,40 @@ public: /** * Inserts a button with popupmenu. * * Button will have small * triangle. You have to connect to popup's signals. The * signals @ref KButton::pressed(), @ref KButton::released(), * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not * emmited by * this button (see @ref setDelayedPopup() for that). * You can add custom popups which inherit @ref QPopupMenu to get popups * with tables, drawings etc. Just don't fiddle with events there. */ - int insertButton(const QString& icon, int id, QPopupMenu *popup, + int insertButton(const QString& icon, int id, Q3PopupMenu *popup, bool enabled, const QString&_text, int index=-1); /** * Inserts a button with popupmenu. * * Button will have small * triangle. You have to connect to popup's signals. The * signals @ref KButton::pressed(), @ref KButton::released(), * @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not * emmited by * this button (see @ref setDelayedPopup() for that). * You can add custom popups which inherit @ref QPopupMenu to get popups * with tables, drawings etc. Just don't fiddle with events there. */ - int insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, + int insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup, bool enabled, const QString&_text, int index=-1); /** * Inserts a @ref KLineEdit. You have to specify signals and slots to * which KLineEdit will be connected. KLineEdit has all slots QLineEdit * has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation * KLineEdit can be set to autoresize itself to full free width * in toolbar, that is to last right aligned item. For that, * toolbar must be set to full width (which it is by default). * @see setFullWidth() * @see setItemAutoSized() * @see KLineEdit @@ -350,41 +358,41 @@ public: * computed. * * @see setFullWidth() * @see setItemAutoSized() * @see KComboBox * @return Item index. */ int insertCombo (const QStringList &list, int id, bool writable, const char *signal, const QObject *receiver, const char *slot, bool enabled=true, const QString& tooltiptext=QString::null, int size=70, int index=-1, - QComboBox::Policy policy = QComboBox::AtBottom); + QComboBox::Policy policy = QComboBox::InsertAtBottom); /** * Insert a @ref KComboBox with text. * * The rest is the same as above. * @see setItemAutoSized() * * @see KComboBox * @return Item index. */ int insertCombo (const QString& text, int id, bool writable, const char *signal, QObject *recevier, const char *slot, bool enabled=true, const QString& tooltiptext=QString::null, int size=70, int index=-1, - QComboBox::Policy policy = QComboBox::AtBottom); + QComboBox::Policy policy = QComboBox::InsertAtBottom); /** * Inserts a separator into the toolbar with the given id. * Returns the separator's index */ int insertSeparator( int index = -1, int id = -1 ); /** * Inserts a line separator into the toolbar with the given id. * Returns the separator's index */ int insertLineSeparator( int index = -1, int id = -1 ); @@ -456,25 +464,25 @@ public: /** * Sets button pixmap. * * Can be used while button is visible. */ void setButtonPixmap( int id, const QPixmap& _pixmap ); /** * Sets a button icon from a QIconSet. * * Can be used while button is visible. */ - void setButtonIconSet( int id, const QIconSet& iconset ); + void setButtonIconSet( int id, const QIcon& iconset ); /** * Sets a delayed popup for a button. * * Delayed popup is what you see in * Netscape Navigator's Previous and Next buttons: If you click them you * go back * or forth. If you press them long enough, you get a history-menu. * This is exactly what we do here. * * You will insert normal a button with connection (or use signals from * toolbar): @@ -482,25 +490,25 @@ public: * bar->insertButton(icon, id, SIGNAL(clicked ()), this, * SLOT (slotClick()), true, "click or wait for popup"); * </pre> And then add a delayed popup: * <pre> * bar->setDelayedPopup (id, historyPopup); </pre> * * Don't add delayed popups to buttons which have normal popups. * * You may add popups which are derived from @ref QPopupMenu. You may * add popups that are already in the menu bar or are submenus of * other popups. */ - void setDelayedPopup (int id , QPopupMenu *_popup, bool toggle = false); + void setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle = false); /** * Turns a button into an autorepeat button. * * Toggle buttons, buttons with menus, or * buttons with delayed menus cannot be made into autorepeat buttons. * Moreover, you can and will receive * only the signal clicked(), but not pressed() or released(). * When the user presses this button, you will receive the signal clicked(), * and if the button is still pressed after some time, * you will receive more clicked() signals separated by regular * intervals. Since this uses @ref QButton::setAutoRepeat() , @@ -1051,60 +1059,60 @@ public: /** * @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 ); } + { Q3ToolBar::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 toolBarPosChanged( Q3ToolBar *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(); + Q3PopupMenu *contextMenu(); QMap<QWidget*, int > widget2id; typedef QMap<int, QWidget* > Id2WidgetMap; Id2WidgetMap id2widget; //US KPopupMenu *context; - QPopupMenu *context; - QPtrList<QWidget> widgets; + Q3PopupMenu *context; + Q3PtrList<QWidget> widgets; QTimer *layoutTimer; - QGuardedPtr<QWidget> stretchableWidget, rightAligned; + QPointer<QWidget> stretchableWidget, rightAligned; protected: virtual void virtual_hook( int id, void* data ); private: KToolBarPrivate *d; bool inshutdownprocess; }; #endif diff --git a/microkde/kdeui/ktoolbarbutton.cpp b/microkde/kdeui/ktoolbarbutton.cpp index 1d5d0e5..7b98b32 100644 --- a/microkde/kdeui/ktoolbarbutton.cpp +++ b/microkde/kdeui/ktoolbarbutton.cpp @@ -24,40 +24,44 @@ //US #include <config.h> #include <string.h> #include "ktoolbarbutton.h" #include "ktoolbar.h" #include <qstyle.h> #include <qimage.h> #include <qtimer.h> #include <qdrawutil.h> #include <qtooltip.h> #include <qbitmap.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qcursor.h> #include <qpainter.h> #include <qlayout.h> +//Added by qt3to4: +#include <QPixmap> +#include <QMouseEvent> +#include <QEvent> #include <kapplication.h> #include <kdebug.h> #include <kglobal.h> #include <kglobalsettings.h> //US #include <kiconeffect.h> #include <kiconloader.h> // needed to get our instance #include <kmainwindow.h> -template class QIntDict<KToolBarButton>; +template class Q3IntDict<KToolBarButton>; class KToolBarButtonPrivate { public: KToolBarButtonPrivate() { m_noStyle = false; m_isSeparator = false; m_isRadio = false; m_highlight = false; m_isRaised = false; m_isActive = false; @@ -106,25 +110,25 @@ KToolBarButton::KToolBarButton( QWidget *_parent, const char *_name ) KToolBarButton::KToolBarButton( const QString& _icon, int _id, QWidget *_parent, const char *_name, const QString &_txt/*US, KInstance *_instance*/ ) : QToolButton( _parent, _name ), d( 0 ) { d = new KToolBarButtonPrivate; d->m_id = _id; d->m_parent = (KToolBar*)_parent; QToolButton::setTextLabel(_txt); //US d->m_instance = _instance; - setFocusPolicy( NoFocus ); + setFocusPolicy( Qt::NoFocus ); // connect all of our slots and start trapping events connect(d->m_parent, SIGNAL( modechange() ), this, SLOT( modeChange() )); connect(this, SIGNAL( clicked() ), this, SLOT( slotClicked() ) ); connect(this, SIGNAL( pressed() ), this, SLOT( slotPressed() ) ); connect(this, SIGNAL( released() ), this, SLOT( slotReleased() ) ); installEventFilter(this); @@ -137,40 +141,40 @@ KToolBarButton::KToolBarButton( const QString& _icon, int _id, KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id, QWidget *_parent, const char *name, const QString& txt) : QToolButton( _parent, name ), d( 0 ) { d = new KToolBarButtonPrivate; d->m_id = _id; d->m_parent = (KToolBar *) _parent; QToolButton::setTextLabel(txt); - setFocusPolicy( NoFocus ); + setFocusPolicy( Qt::NoFocus ); // connect all of our slots and start trapping events connect(d->m_parent, SIGNAL( modechange()), this, SLOT(modeChange())); connect(this, SIGNAL( clicked() ), this, SLOT( slotClicked() )); connect(this, SIGNAL( pressed() ), this, SLOT( slotPressed() )); connect(this, SIGNAL( released() ), this, SLOT( slotReleased() )); installEventFilter(this); // set our pixmap and do our initial setup - setIconSet( QIconSet( pixmap )); + setIconSet( QIcon( pixmap )); modeChange(); } KToolBarButton::~KToolBarButton() { delete d; d = 0; } void KToolBarButton::modeChange() { QSize mysize; @@ -283,99 +287,99 @@ void KToolBarButton::setIcon( const QString &icon ) if (!strcmp(d->m_parent->name(), "mainToolBar")) /*US QToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet( d->m_iconName, KIcon::MainToolbar, d->m_iconSize )); */ QToolButton::setIconSet( KGlobal::iconLoader()->loadIconSet(d->m_iconName )); else /*US QToolButton::setIconSet(d->m_instance->iconLoader()->loadIconSet( d->m_iconName, KIcon::Toolbar, d->m_iconSize )); */ QToolButton::setIconSet(KGlobal::iconLoader()->loadIconSet(d->m_iconName)); } -void KToolBarButton::setIconSet( const QIconSet &iconset ) +void KToolBarButton::setIconSet( const QIcon &iconset ) { QToolButton::setIconSet( iconset ); } // remove? void KToolBarButton::setPixmap( const QPixmap &pixmap ) { if( pixmap.isNull()) // called by QToolButton { QToolButton::setPixmap( pixmap ); return; } - QIconSet set = iconSet(); - set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Active ); + QIcon set = iconSet(); + set.setPixmap( pixmap, QIcon::Automatic, QIcon::Active ); QToolButton::setIconSet( set ); } void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap ) { - QIconSet set = iconSet(); - set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Normal ); + QIcon set = iconSet(); + set.setPixmap( pixmap, QIcon::Automatic, QIcon::Normal ); QToolButton::setIconSet( set ); } void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap ) { - QIconSet set = iconSet(); - set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Disabled ); + QIcon set = iconSet(); + set.setPixmap( pixmap, QIcon::Automatic, QIcon::Disabled ); QToolButton::setIconSet( set ); } void KToolBarButton::setDefaultIcon( const QString& icon ) { - QIconSet set = iconSet(); + QIcon set = iconSet(); QPixmap pm; if (!strcmp(d->m_parent->name(), "mainToolBar")) pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, d->m_iconSize ); else pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, d->m_iconSize ); - set.setPixmap( pm, QIconSet::Automatic, QIconSet::Normal ); + set.setPixmap( pm, QIcon::Automatic, QIcon::Normal ); QToolButton::setIconSet( set ); } void KToolBarButton::setDisabledIcon( const QString& icon ) { - QIconSet set = iconSet(); + QIcon set = iconSet(); QPixmap pm; if (!strcmp(d->m_parent->name(), "mainToolBar")) pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar, d->m_iconSize ); else pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar, d->m_iconSize ); - set.setPixmap( pm, QIconSet::Automatic, QIconSet::Disabled ); + set.setPixmap( pm, QIcon::Automatic, QIcon::Disabled ); QToolButton::setIconSet( set ); } -QPopupMenu *KToolBarButton::popup() +QMenu *KToolBarButton::popup() { // obsolete // KDE4: remove me return QToolButton::popup(); } -void KToolBarButton::setPopup(QPopupMenu *p, bool) +void KToolBarButton::setPopup(Q3PopupMenu *p, bool) { QToolButton::setPopup(p); QToolButton::setPopupDelay(1); } -void KToolBarButton::setDelayedPopup (QPopupMenu *p, bool) +void KToolBarButton::setDelayedPopup (Q3PopupMenu *p, bool) { QToolButton::setPopup(p); //US QToolButton::setPopupDelay(QApplication::startDragTime()); } void KToolBarButton::leaveEvent(QEvent *) { if( d->m_isRaised || d->m_isActive ) { d->m_isRaised = false; d->m_isActive = false; repaint(false); @@ -442,155 +446,161 @@ bool KToolBarButton::eventFilter(QObject *o, QEvent *ev) { emit doubleClicked(d->m_id); return true; } } return QToolButton::eventFilter(o, ev); } void KToolBarButton::drawButton( QPainter *_painter ) { #ifdef DESKTOP_VERSION - QStyle::SFlags flags = QStyle::Style_Default; - QStyle::SCFlags active = QStyle::SC_None; + QStyle::State flags = QStyle::State_None; + QStyle::SubControls active = QStyle::SC_None; if (isDown()) { - flags |= QStyle::Style_Down; + flags |= QStyle::State_DownArrow; active |= QStyle::SC_ToolButton; } - if (isEnabled()) flags |= QStyle::Style_Enabled; - if (isOn()) flags |= QStyle::Style_On; - if (isEnabled() && d->m_isRaised) flags |= QStyle::Style_Raised; - if (hasFocus()) flags |= QStyle::Style_HasFocus; + if (isEnabled()) flags |= QStyle::State_Enabled; + if (isOn()) flags |= QStyle::State_On; + if (isEnabled() && d->m_isRaised) flags |= QStyle::State_Raised; + if (hasFocus()) flags |= QStyle::State_HasFocus; + + QStyleOptionToolButton qsotb; + qsotb.initFrom(this); + qsotb.state = flags; + qsotb.activeSubControls = active; + qsotb.rect = rect(); + qsotb.palette = palette(); // Draw a styled toolbutton - style().drawComplexControl(QStyle::CC_ToolButton, _painter, this, rect(), - colorGroup(), flags, QStyle::SC_ToolButton, active, QStyleOption()); + style()->drawComplexControl(QStyle::CC_ToolButton, &qsotb, _painter, this); #else style().drawToolButton(_painter, rect().x(), rect().y(), rect().width(), rect().height(), colorGroup()); #endif int dx, dy; QFont tmp_font(KGlobalSettings::toolBarFont()); QFontMetrics fm(tmp_font); QRect textRect; int textFlags = 0; if (d->m_iconText == KToolBar::IconOnly) // icon only { /*US QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); */ - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : - QIconSet::Disabled); + QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, + isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : + QIcon::Disabled); if( !pixmap.isNull()) { dx = ( width() - pixmap.width() ) / 2; dy = ( height() - pixmap.height() ) / 2; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } _painter->drawPixmap( dx, dy, pixmap ); } } else if (d->m_iconText == KToolBar::IconTextRight) // icon and text (if any) { /*US QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); */ - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : - QIconSet::Disabled); + QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, + isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : + QIcon::Disabled); if( !pixmap.isNull()) { dx = 4; dy = ( height() - pixmap.height() ) / 2; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } _painter->drawPixmap( dx, dy, pixmap ); } if (!textLabel().isNull()) { - textFlags = AlignVCenter|AlignLeft; + textFlags = Qt::AlignVCenter|Qt::AlignLeft; if (!pixmap.isNull()) dx = 4 + pixmap.width() + 2; else dx = 4; dy = 0; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } textRect = QRect(dx, dy, width()-dx, height()); } } else if (d->m_iconText == KToolBar::TextOnly) { if (!textLabel().isNull()) { - textFlags = AlignVCenter|AlignLeft; + textFlags = Qt::AlignVCenter|Qt::AlignLeft; dx = (width() - fm.width(textLabel())) / 2; dy = (height() - fm.lineSpacing()) / 2; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); } } else if (d->m_iconText == KToolBar::IconTextBottom) { /*US QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); */ - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) : - QIconSet::Disabled); + QPixmap pixmap = iconSet().pixmap( QIcon::Automatic, + isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) : + QIcon::Disabled); if( !pixmap.isNull()) { dx = (width() - pixmap.width()) / 2; dy = (height() - fm.lineSpacing() - pixmap.height()) / 2; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } _painter->drawPixmap( dx, dy, pixmap ); } if (!textLabel().isNull()) { - textFlags = AlignBottom|AlignHCenter; + textFlags = Qt::AlignBottom|Qt::AlignHCenter; dx = (width() - fm.width(textLabel())) / 2; dy = height() - fm.lineSpacing() - 4; if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ ) { ++dx; ++dy; } textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); } } @@ -601,32 +611,36 @@ void KToolBarButton::drawButton( QPainter *_painter ) if (!isEnabled()) _painter->setPen(palette().disabled().dark()); else if(d->m_isRaised) _painter->setPen(KGlobalSettings::toolBarHighlightColor()); else _painter->setPen( colorGroup().buttonText() ); _painter->drawText(textRect, textFlags, textLabel()); } if (QToolButton::popup()) { #ifdef DESKTOP_VERSION - QStyle::SFlags arrowFlags = QStyle::Style_Default; + QStyle::State arrowFlags = QStyle::State_None; + + if (isDown()) arrowFlags |= QStyle::State_DownArrow; + if (isEnabled()) arrowFlags |= QStyle::State_Enabled; - if (isDown()) arrowFlags |= QStyle::Style_Down; - if (isEnabled()) arrowFlags |= QStyle::Style_Enabled; + QStyleOption qso; + qso.initFrom(this); + qso.state = arrowFlags; + qso.rect = QRect(width()-7, height()-7, 7, 7); + qso.palette = palette(); - style().drawPrimitive(QStyle::PE_ArrowDown, _painter, - QRect(width()-7, height()-7, 7, 7), colorGroup(), - arrowFlags, QStyleOption() ); + style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &qso, _painter); #else style().drawArrow(_painter, Qt::DownArrow, isDown(), width()-7, height()-7, 7, 7, colorGroup(), isEnabled() ); #endif } } void KToolBarButton::paletteChange(const QPalette &) { if(!d->m_isSeparator) { diff --git a/microkde/kdeui/ktoolbarbutton.h b/microkde/kdeui/ktoolbarbutton.h index 9aaa13c..ad02e4e 100644 --- a/microkde/kdeui/ktoolbarbutton.h +++ b/microkde/kdeui/ktoolbarbutton.h @@ -17,33 +17,36 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #ifndef _KTOOLBARBUTTON_H #define _KTOOLBARBUTTON_H #include <qpixmap.h> #include <qtoolbutton.h> -#include <qintdict.h> +#include <q3intdict.h> #include <qstring.h> +//Added by qt3to4: +#include <QEvent> +#include <Q3PopupMenu> #include <kglobal.h> class KToolBar; class KToolBarButtonPrivate; //USclass KInstance; class QEvent; -class QPopupMenu; +class Q3PopupMenu; class QPainter; /** * A toolbar button. This is used internally by @ref KToolBar, use the * KToolBar methods instead. * @internal */ class KToolBarButton : public QToolButton { Q_OBJECT public: @@ -141,25 +144,25 @@ public: virtual void setIcon(const QString &icon); /// @since 3.1 virtual void setIcon( const QPixmap &pixmap ) { QToolButton::setIcon( pixmap ); } /** * Set the pixmaps for this toolbar button from a QIconSet. * If you call this you don't need to call any of the other methods * that set icons or pixmaps. * @param iconset The iconset to use */ - virtual void setIconSet( const QIconSet &iconset ); + virtual void setIconSet( const QIcon &iconset ); #ifndef KDE_NO_COMPAT /** * @deprecated * Set the active icon for this button. The pixmap itself is loaded * internally based on the icon size... .. the disabled and default * pixmaps, however will only be constructed if @ref #generate is * true. This function is preferred over @ref setPixmap * * @param icon The name of the active icon * @param generate If true, then the other icons are automagically * generated from this one @@ -200,51 +203,51 @@ public: /** * Turn this button into a toggle button or disable the toggle * aspects of it. This does not toggle the button itself. * Use @ref toggle() for that. * * @param toggle true or false */ void setToggle(bool toggle = true); /** * Return a pointer to this button's popup menu (if it exists) */ - QPopupMenu *popup(); + QMenu *popup(); /** * Returns the button's id. * @since 3.2 */ int id() const; /** * Give this button a popup menu. There will not be a delay when * you press the button. Use @ref setDelayedPopup if you want that * behavior. * * @param p The new popup menu */ - void setPopup (QPopupMenu *p, bool unused = false); + void setPopup (Q3PopupMenu *p, bool unused = false); /** * Gives this button a delayed popup menu. * * This function allows you to add a delayed popup menu to the button. * The popup menu is then only displayed when the button is pressed and * held down for about half a second. * * @param p the new popup menu */ - void setDelayedPopup(QPopupMenu *p, bool unused = false); + void setDelayedPopup(Q3PopupMenu *p, bool unused = false); /** * Turn this button into a radio button * * @param f true or false */ void setRadio(bool f = true); /** * Toolbar buttons naturally will assume the global styles * concerning icons, icons sizes, etc. You can use this function to * explicitely turn this off, if you like. @@ -294,20 +297,20 @@ protected slots: protected: virtual void virtual_hook( int id, void* data ); private: KToolBarButtonPrivate *d; }; /** * List of @ref KToolBarButton objects. * @internal * @version $Id$ */ -class KToolBarButtonList : public QIntDict<KToolBarButton> +class KToolBarButtonList : public Q3IntDict<KToolBarButton> { public: KToolBarButtonList(); ~KToolBarButtonList() {} }; #endif diff --git a/microkde/kdeui/ktoolbarhandler.cpp b/microkde/kdeui/ktoolbarhandler.cpp index 7b97233..4d3ace7 100644 --- a/microkde/kdeui/ktoolbarhandler.cpp +++ b/microkde/kdeui/ktoolbarhandler.cpp @@ -9,25 +9,27 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ktoolbarhandler.h" -#include <qpopupmenu.h> +#include <q3popupmenu.h> +//Added by qt3to4: +#include <Q3PtrList> #include <kapplication.h> #include <ktoolbar.h> #include <kmainwindow.h> #include <klocale.h> #include <kaction.h> #include <assert.h> namespace { const char *actionListName = "show_menu_and_toolbar_actionlist"; const char *guiDescription = "" @@ -35,25 +37,25 @@ namespace "<MenuBar>" " <Menu name=\"settings\">" " <ActionList name=\"%1\" />" " </Menu>" "</MenuBar>" "</kpartgui>"; const char *resourceFileName = "barhandler.rc"; class BarActionBuilder { public: - BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, QPtrList<KToolBar> &oldToolBarList ) + BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, Q3PtrList<KToolBar> &oldToolBarList ) : m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false ) { /*US QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows(); QPtrListIterator<QDockWindow> dockWindowIt( dockWindows ); for ( ; dockWindowIt.current(); ++dockWindowIt ) { //US KToolBar *toolBar = dynamic_cast<KToolBar *>( dockWindowIt.current() ); KToolBar *toolBar = (KToolBar *)( dockWindowIt.current() ); if ( !toolBar ) continue; @@ -61,71 +63,71 @@ namespace m_needsRebuild = true; m_toolBars.append( toolBar ); } */ if ( !m_needsRebuild ) m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() ); } bool needsRebuild() const { return m_needsRebuild; } - QPtrList<KAction> create() + Q3PtrList<KAction> create() { if ( !m_needsRebuild ) - return QPtrList<KAction>(); + return Q3PtrList<KAction>(); - QPtrListIterator<KToolBar> toolBarIt( m_toolBars ); + Q3PtrListIterator<KToolBar> toolBarIt( m_toolBars ); for ( ; toolBarIt.current(); ++toolBarIt ) handleToolBar( toolBarIt.current() ); - QPtrList<KAction> actions; + Q3PtrList<KAction> actions; if ( m_toolBarActions.count() == 0 ) return actions; if ( m_toolBarActions.count() == 1 ) { m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) ); return m_toolBarActions; } KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" ); - QPtrListIterator<KAction> actionIt( m_toolBarActions ); + Q3PtrListIterator<KAction> actionIt( m_toolBarActions ); for ( ; actionIt.current(); ++actionIt ) menuAction->insert( actionIt.current() ); actions.append( menuAction ); return actions; } - const QPtrList<KToolBar> &toolBars() const { return m_toolBars; } + const Q3PtrList<KToolBar> &toolBars() const { return m_toolBars; } private: void handleToolBar( KToolBar *toolBar ) { KAction *action = new KToggleToolBarAction( toolBar, i18n( "Show %1" ).arg( toolBar->label() ), m_actionCollection, toolBar->name() ); m_toolBarActions.append( action ); } KActionCollection *m_actionCollection; KMainWindow *m_mainWindow; - QPtrList<KToolBar> m_toolBars; - QPtrList<KAction> m_toolBarActions; + Q3PtrList<KToolBar> m_toolBars; + Q3PtrList<KAction> m_toolBarActions; bool m_needsRebuild : 1; }; } using namespace KDEPrivate; ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, const char *name ) : QObject( mainWindow, name ), KXMLGUIClient( mainWindow ) { init( mainWindow ); } @@ -215,39 +217,39 @@ void ToolBarHandler::init( KMainWindow *mainWindow ) if ( domDocument().documentElement().isNull() ) { QString completeDescription = QString::fromLatin1( guiDescription ) .arg( actionListName ); setXML( completeDescription, false*/ /*merge*/ /*); } */ } void ToolBarHandler::connectToActionContainers() { - QPtrListIterator<KAction> actionIt( m_actions ); + Q3PtrListIterator<KAction> actionIt( m_actions ); for ( ; actionIt.current(); ++actionIt ) connectToActionContainer( actionIt.current() ); } void ToolBarHandler::connectToActionContainer( KAction *action ) { uint containerCount = action->containerCount(); for ( uint i = 0; i < containerCount; ++i ) connectToActionContainer( action->container( i ) ); } void ToolBarHandler::connectToActionContainer( QWidget *container ) { //US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container ); - QPopupMenu *popupMenu = (QPopupMenu *)( container ); + Q3PopupMenu *popupMenu = (Q3PopupMenu *)( container ); if ( !popupMenu ) return; connect( popupMenu, SIGNAL( aboutToShow() ), this, SLOT( setupActions() ) ); } //US #include "ktoolbarhandler.moc" /* vim: et sw=4 ts=4 */ diff --git a/microkde/kdeui/ktoolbarhandler.h b/microkde/kdeui/ktoolbarhandler.h index a1340ae..35f0d18 100644 --- a/microkde/kdeui/ktoolbarhandler.h +++ b/microkde/kdeui/ktoolbarhandler.h @@ -11,26 +11,26 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KBARHANDLER_H #define KBARHANDLER_H #include <qobject.h> -#include <qguardedptr.h> -#include <qptrlist.h> +#include <qpointer.h> +#include <q3ptrlist.h> #include <kxmlguiclient.h> #include <kaction.h> class KMainWindow; class KToolBar; namespace KDEPrivate { /// @since 3.1 class ToolBarHandler : public QObject, public KXMLGUIClient { @@ -48,23 +48,23 @@ public slots: private slots: //US void clientAdded( KXMLGUIClient *client ); private: void init( KMainWindow *mainWindow ); void connectToActionContainers(); void connectToActionContainer( KAction *action ); void connectToActionContainer( QWidget *container ); struct Data; Data *d; - QGuardedPtr<KMainWindow> m_mainWindow; - QPtrList<KAction> m_actions; - QPtrList<KToolBar> m_toolBars; + QPointer<KMainWindow> m_mainWindow; + Q3PtrList<KAction> m_actions; + Q3PtrList<KToolBar> m_toolBars; }; } // namespace KDEPrivate #endif // KBARHANDLER_H /* vim: et sw=4 ts=4 */ diff --git a/microkde/kdeui/kxmlguiclient.cpp b/microkde/kdeui/kxmlguiclient.cpp index 073e30b..8740bde 100644 --- a/microkde/kdeui/kxmlguiclient.cpp +++ b/microkde/kdeui/kxmlguiclient.cpp @@ -30,85 +30,87 @@ #include <qdom.h> #include <qtextstream.h> #include <qregexp.h> */ //US #include <kinstance.h> #include <kstandarddirs.h> #include <kdebug.h> #include <kaction.h> #include <kapplication.h> #include <assert.h> +//Added by qt3to4: +#include <Q3PtrList> class KXMLGUIClientPrivate { public: KXMLGUIClientPrivate() { //US m_instance = KGlobal::instance(); //US m_factory = 0L; m_parent = 0L; //US m_builder = 0L; m_actionCollection = 0; } ~KXMLGUIClientPrivate() { } //US KInstance *m_instance; //US QDomDocument m_doc; KActionCollection *m_actionCollection; //US QDomDocument m_buildDocument; //US KXMLGUIFactory *m_factory; KXMLGUIClient *m_parent; //QPtrList<KXMLGUIClient> m_supers; - QPtrList<KXMLGUIClient> m_children; + Q3PtrList<KXMLGUIClient> m_children; //US KXMLGUIBuilder *m_builder; //US QString m_xmlFile; //US QString m_localXMLFile; }; KXMLGUIClient::KXMLGUIClient() { d = new KXMLGUIClientPrivate; } KXMLGUIClient::KXMLGUIClient( KXMLGUIClient *parent ) { d = new KXMLGUIClientPrivate; parent->insertChildClient( this ); } KXMLGUIClient::~KXMLGUIClient() { if ( d->m_parent ) d->m_parent->removeChildClient( this ); - QPtrListIterator<KXMLGUIClient> it( d->m_children ); + Q3PtrListIterator<KXMLGUIClient> it( d->m_children ); for ( ; it.current(); ++it ) { assert( it.current()->d->m_parent == this ); it.current()->d->m_parent = 0; } delete d->m_actionCollection; delete d; } KAction *KXMLGUIClient::action( const char *name ) const { KAction* act = actionCollection()->action( name ); if ( !act ) { - QPtrListIterator<KXMLGUIClient> childIt( d->m_children ); + Q3PtrListIterator<KXMLGUIClient> childIt( d->m_children ); for (; childIt.current(); ++childIt ) { act = childIt.current()->actionCollection()->action( name ); if ( act ) break; } } return act; } KActionCollection *KXMLGUIClient::actionCollection() const { if ( !d->m_actionCollection ) @@ -579,43 +581,43 @@ void KXMLGUIClient::removeChildClient( KXMLGUIClient *child ) d->m_children.removeRef( child ); child->d->m_parent = 0; } /*bool KXMLGUIClient::addSuperClient( KXMLGUIClient *super ) { if ( d->m_supers.contains( super ) ) return false; d->m_supers.append( super ); return true; }*/ -const QPtrList<KXMLGUIClient> *KXMLGUIClient::childClients() +const Q3PtrList<KXMLGUIClient> *KXMLGUIClient::childClients() { return &d->m_children; } /*US void KXMLGUIClient::setClientBuilder( KXMLGUIBuilder *builder ) { d->m_builder = builder; if ( builder ) builder->setBuilderInstance( instance() ); } KXMLGUIBuilder *KXMLGUIClient::clientBuilder() const { return d->m_builder; } */ -void KXMLGUIClient::plugActionList( const QString &name, const QPtrList<KAction> &actionList ) +void KXMLGUIClient::plugActionList( const QString &name, const Q3PtrList<KAction> &actionList ) { /*US if ( !d->m_factory ) return; d->m_factory->plugActionList( this, name, actionList ); */ } void KXMLGUIClient::unplugActionList( const QString &name ) { /*US diff --git a/microkde/kdeui/kxmlguiclient.h b/microkde/kdeui/kxmlguiclient.h index cd74c8e..b9d7b09 100644 --- a/microkde/kdeui/kxmlguiclient.h +++ b/microkde/kdeui/kxmlguiclient.h @@ -12,25 +12,25 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _KXMLGUICLIENT_H #define _KXMLGUICLIENT_H //US #include <qdom.h> -#include <qptrlist.h> +#include <q3ptrlist.h> #include <qmap.h> #include <qstringlist.h> class QWidget; class KAction; class KActionCollection; class KInstance; class KXMLGUIClientPrivate; class KXMLGUIFactory; class KXMLGUIBuilder; @@ -152,25 +152,25 @@ public: * arent argument. */ void insertChildClient( KXMLGUIClient *child ); /** * Removes the given @p child from the client's children list. */ void removeChildClient( KXMLGUIClient *child ); /** * Retrieves a list of all child clients. */ - const QPtrList<KXMLGUIClient> *childClients(); + const Q3PtrList<KXMLGUIClient> *childClients(); /** * A client can have an own @ref KXMLGUIBuilder. * Use this method to assign your builder instance to the client (so that the * @ref KXMLGUIFactory can use it when building the client's GUI) * * Client specific guibuilders are useful if you want to create * custom container widgets for your GUI. */ //US void setClientBuilder( KXMLGUIBuilder *builder ); /** @@ -219,25 +219,25 @@ public: * unplugActionList( "xxx_file_actionlist" ); * plugActionList( "xxx_file_actionlist", file_actions ); * \endcode * every time a file is selected, unselected or ... * * \note You should not call createGUI() after calling this * function. In fact, that would remove the newly added * actionlists again... * \note Forgetting to call unplugActionList() before * plugActionList() would leave the previous actions in the * menu too.. */ - void plugActionList( const QString &name, const QPtrList<KAction> &actionList ); + void plugActionList( const QString &name, const Q3PtrList<KAction> &actionList ); /** * The complement of \ref plugActionList() ... */ void unplugActionList( const QString &name ); //US static QString findMostRecentXMLFile( const QStringList &files, QString &doc ); void addStateActionEnabled(const QString& state, const QString& action); void addStateActionDisabled(const QString& state, const QString& action); |