summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kactionclasses.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdeui/kactionclasses.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kactionclasses.cpp111
1 files changed, 56 insertions, 55 deletions
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 );