From 6cc5f72b33f1d281de3e1bf809b1b5e77d5c96cf Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:43 -0600 Subject: Fix FTBFS --- karm/kaccelmenuwatch.cpp | 113 -------------------------------------------- karm/kaccelmenuwatch.h | 114 --------------------------------------------- karm/tdeaccelmenuwatch.cpp | 113 ++++++++++++++++++++++++++++++++++++++++++++ karm/tdeaccelmenuwatch.h | 114 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 227 insertions(+), 227 deletions(-) delete mode 100644 karm/kaccelmenuwatch.cpp delete mode 100644 karm/kaccelmenuwatch.h create mode 100644 karm/tdeaccelmenuwatch.cpp create mode 100644 karm/tdeaccelmenuwatch.h (limited to 'karm') diff --git a/karm/kaccelmenuwatch.cpp b/karm/kaccelmenuwatch.cpp deleted file mode 100644 index 4b5952848..000000000 --- a/karm/kaccelmenuwatch.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -* kaccelmenuwatch.cpp -- Implementation of class TDEAccelMenuWatch. -* Author: Sirtaj Singh Kang -* Generated: Thu Jan 7 15:05:26 EST 1999 -*/ - -#include -#include - -#include "kaccelmenuwatch.h" - -TDEAccelMenuWatch::TDEAccelMenuWatch( TDEAccel *accel, TQObject *parent ) - : TQObject( parent ), - _accel( accel ), - _menu ( 0 ) -{ - _accList.setAutoDelete( true ); - _menuList.setAutoDelete( false ); -} - -void TDEAccelMenuWatch::setMenu( TQPopupMenu *menu ) -{ - assert( menu ); - - // we use _menuList to ensure that the signal is - // connected only once per menu. - - if ( !_menuList.findRef( menu ) ) { - _menuList.append( menu ); - connect( menu, TQT_SIGNAL(destroyed()), this, TQT_SLOT(removeDeadMenu()) ); - } - - _menu = menu; -} - -void TDEAccelMenuWatch::connectAccel( int itemId, const char *action ) -{ - AccelItem *item = newAccelItem( _menu, itemId, StringAccel ) ; - item->action = TQString::fromLocal8Bit( action ); -} - -void TDEAccelMenuWatch::connectAccel( int itemId, TDEStdAccel::StdAccel accel ) -{ - AccelItem *item = newAccelItem( _menu, itemId, StdAccel ) ; - item->stdAction = accel; -} - -void TDEAccelMenuWatch::updateMenus() -{ - assert( _accel != 0 ); - - TQPtrListIterator iter( _accList ); - AccelItem *item; - - for( ; (item = iter.current()) ; ++iter ) { - // These setAccel calls were converted from all changeMenuAccel calls - // as descibed in KDE3PORTING.html - switch( item->type ) { - case StringAccel: - item->menu->setAccel( _accel->shortcut( item->action ).keyCodeQt(), item->itemId ); - break; - case StdAccel: - item->menu->setAccel( TDEStdAccel::shortcut( item->stdAction ).keyCodeQt(), item->itemId ); - break; - default: - break; - } - } - -} - -void TDEAccelMenuWatch::removeDeadMenu() -{ - TQPopupMenu *sdr = (TQPopupMenu *) sender(); - assert( sdr ); - - if ( !_menuList.findRef( sdr ) ) - return; - - // remove all accels - - AccelItem *accel; - for ( accel = _accList.first(); accel; accel = _accList.next() ) - { -loop: - if( accel && accel->menu == sdr ) { - _accList.remove(); - accel = _accList.current(); - goto loop; - } - } - - // remove from menu list - _menuList.remove( sdr ); - - return; -} - -TDEAccelMenuWatch::AccelItem *TDEAccelMenuWatch::newAccelItem( TQPopupMenu *, - int itemId, AccelType type ) -{ - AccelItem *item = new AccelItem; - - item->menu = _menu; - item->itemId = itemId; - item->type = type; - - _accList.append( item ); - - return item; -} - -#include "kaccelmenuwatch.moc" diff --git a/karm/kaccelmenuwatch.h b/karm/kaccelmenuwatch.h deleted file mode 100644 index 388cd06f5..000000000 --- a/karm/kaccelmenuwatch.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -* kaccelmenuwatch.h -- Declaration of class TDEAccelMenuWatch. -* Generated by newclass on Thu Jan 7 15:05:26 EST 1999. -*/ -#ifndef KARM_K_ACCEL_MENU_WATCH_H -#define KARM_K_ACCEL_MENU_WATCH_H - -#include -#include - -#include - -class TQPopupMenu; - -/** - * Easy updating of menu accels when changing a TDEAccel object. - * - * Since a TDEAccel object does not keep track of menu items to which it - * is connected, we normally have to manually call - * TDEAccel::changeMenuAccel() again for each update of the TDEAccel object. - * - * With TDEAccelMenuWatch you provide the kaccel object and the menu - * items to which it connects, and if you update the kaccel you just have - * to call TDEAccelMenuWatch::updateMenus() and the menu items will be updated. - * - * It is safe to delete menus that have connections handled by this class. - * On deletion of a menu, all associated accelerators will be deleted. - * - * Note that you _have_ to call TDEAccelMenuWatch::updateMenus() after you - * connect the * accelerators, as they are not activated till then. - * - * @author Sirtaj Singh Kang (taj@kde.org) - */ - -class TDEAccelMenuWatch : public TQObject -{ - Q_OBJECT - - - private: - enum AccelType { StdAccel, StringAccel }; - - typedef struct AccelItem { - TQPopupMenu *menu; - int itemId; - - AccelType type; - - // only one of these is used at a time - TQString action; - TDEStdAccel::StdAccel stdAction; - } AccelItem; - - TDEAccel *_accel; - TQPtrList _accList; - TQPtrList _menuList; - - TQPopupMenu *_menu; - - TDEAccelMenuWatch::AccelItem *newAccelItem( TQPopupMenu *menu, - int itemId, AccelType type ); - - public: - /** - * TDEAccelMenuWatch Constructor - */ - TDEAccelMenuWatch( TDEAccel *accel, TQObject *parent = 0 ); - - /** - * TDEAccelMenuWatch Destructor - */ - virtual ~TDEAccelMenuWatch() {} - - /** - * Set the menu on which connectAccel calls will operate. - * All subsequent calls to connectAccel will be associated - * with this menu. You can call this function any number of - * times, so multiple menus can be handled. - */ - void setMenu( TQPopupMenu *menu ); - - /** - * Return the last menu set with TDEAccelMenuWatch::setMenu(TQPopupMenu*), - * or 0 if none has been set. - */ - TQPopupMenu *currentMenu() const { return _menu; } - - /** - * Connect the menu item identified to currentMenu()/id to - * the accelerator action. - */ - void connectAccel( int itemId, const char *action ); - - /** - * Same as above, but connects to standard accelerators. - */ - void connectAccel( int itemId, TDEStdAccel::StdAccel ); - - public slots: - /** - * Updates all menu accelerators. Call this after all accelerators - * have been connected or the kaccel object has been updated. - */ - void updateMenus(); - - private slots: - void removeDeadMenu(); - - private: - TDEAccelMenuWatch& operator=( const TDEAccelMenuWatch& ); - TDEAccelMenuWatch( const TDEAccelMenuWatch& ); -}; - -#endif // KARM_K_ACCEL_MENU_WATCH_H diff --git a/karm/tdeaccelmenuwatch.cpp b/karm/tdeaccelmenuwatch.cpp new file mode 100644 index 000000000..4b5952848 --- /dev/null +++ b/karm/tdeaccelmenuwatch.cpp @@ -0,0 +1,113 @@ +/* +* kaccelmenuwatch.cpp -- Implementation of class TDEAccelMenuWatch. +* Author: Sirtaj Singh Kang +* Generated: Thu Jan 7 15:05:26 EST 1999 +*/ + +#include +#include + +#include "kaccelmenuwatch.h" + +TDEAccelMenuWatch::TDEAccelMenuWatch( TDEAccel *accel, TQObject *parent ) + : TQObject( parent ), + _accel( accel ), + _menu ( 0 ) +{ + _accList.setAutoDelete( true ); + _menuList.setAutoDelete( false ); +} + +void TDEAccelMenuWatch::setMenu( TQPopupMenu *menu ) +{ + assert( menu ); + + // we use _menuList to ensure that the signal is + // connected only once per menu. + + if ( !_menuList.findRef( menu ) ) { + _menuList.append( menu ); + connect( menu, TQT_SIGNAL(destroyed()), this, TQT_SLOT(removeDeadMenu()) ); + } + + _menu = menu; +} + +void TDEAccelMenuWatch::connectAccel( int itemId, const char *action ) +{ + AccelItem *item = newAccelItem( _menu, itemId, StringAccel ) ; + item->action = TQString::fromLocal8Bit( action ); +} + +void TDEAccelMenuWatch::connectAccel( int itemId, TDEStdAccel::StdAccel accel ) +{ + AccelItem *item = newAccelItem( _menu, itemId, StdAccel ) ; + item->stdAction = accel; +} + +void TDEAccelMenuWatch::updateMenus() +{ + assert( _accel != 0 ); + + TQPtrListIterator iter( _accList ); + AccelItem *item; + + for( ; (item = iter.current()) ; ++iter ) { + // These setAccel calls were converted from all changeMenuAccel calls + // as descibed in KDE3PORTING.html + switch( item->type ) { + case StringAccel: + item->menu->setAccel( _accel->shortcut( item->action ).keyCodeQt(), item->itemId ); + break; + case StdAccel: + item->menu->setAccel( TDEStdAccel::shortcut( item->stdAction ).keyCodeQt(), item->itemId ); + break; + default: + break; + } + } + +} + +void TDEAccelMenuWatch::removeDeadMenu() +{ + TQPopupMenu *sdr = (TQPopupMenu *) sender(); + assert( sdr ); + + if ( !_menuList.findRef( sdr ) ) + return; + + // remove all accels + + AccelItem *accel; + for ( accel = _accList.first(); accel; accel = _accList.next() ) + { +loop: + if( accel && accel->menu == sdr ) { + _accList.remove(); + accel = _accList.current(); + goto loop; + } + } + + // remove from menu list + _menuList.remove( sdr ); + + return; +} + +TDEAccelMenuWatch::AccelItem *TDEAccelMenuWatch::newAccelItem( TQPopupMenu *, + int itemId, AccelType type ) +{ + AccelItem *item = new AccelItem; + + item->menu = _menu; + item->itemId = itemId; + item->type = type; + + _accList.append( item ); + + return item; +} + +#include "kaccelmenuwatch.moc" diff --git a/karm/tdeaccelmenuwatch.h b/karm/tdeaccelmenuwatch.h new file mode 100644 index 000000000..388cd06f5 --- /dev/null +++ b/karm/tdeaccelmenuwatch.h @@ -0,0 +1,114 @@ +/* +* kaccelmenuwatch.h -- Declaration of class TDEAccelMenuWatch. +* Generated by newclass on Thu Jan 7 15:05:26 EST 1999. +*/ +#ifndef KARM_K_ACCEL_MENU_WATCH_H +#define KARM_K_ACCEL_MENU_WATCH_H + +#include +#include + +#include + +class TQPopupMenu; + +/** + * Easy updating of menu accels when changing a TDEAccel object. + * + * Since a TDEAccel object does not keep track of menu items to which it + * is connected, we normally have to manually call + * TDEAccel::changeMenuAccel() again for each update of the TDEAccel object. + * + * With TDEAccelMenuWatch you provide the kaccel object and the menu + * items to which it connects, and if you update the kaccel you just have + * to call TDEAccelMenuWatch::updateMenus() and the menu items will be updated. + * + * It is safe to delete menus that have connections handled by this class. + * On deletion of a menu, all associated accelerators will be deleted. + * + * Note that you _have_ to call TDEAccelMenuWatch::updateMenus() after you + * connect the * accelerators, as they are not activated till then. + * + * @author Sirtaj Singh Kang (taj@kde.org) + */ + +class TDEAccelMenuWatch : public TQObject +{ + Q_OBJECT + + + private: + enum AccelType { StdAccel, StringAccel }; + + typedef struct AccelItem { + TQPopupMenu *menu; + int itemId; + + AccelType type; + + // only one of these is used at a time + TQString action; + TDEStdAccel::StdAccel stdAction; + } AccelItem; + + TDEAccel *_accel; + TQPtrList _accList; + TQPtrList _menuList; + + TQPopupMenu *_menu; + + TDEAccelMenuWatch::AccelItem *newAccelItem( TQPopupMenu *menu, + int itemId, AccelType type ); + + public: + /** + * TDEAccelMenuWatch Constructor + */ + TDEAccelMenuWatch( TDEAccel *accel, TQObject *parent = 0 ); + + /** + * TDEAccelMenuWatch Destructor + */ + virtual ~TDEAccelMenuWatch() {} + + /** + * Set the menu on which connectAccel calls will operate. + * All subsequent calls to connectAccel will be associated + * with this menu. You can call this function any number of + * times, so multiple menus can be handled. + */ + void setMenu( TQPopupMenu *menu ); + + /** + * Return the last menu set with TDEAccelMenuWatch::setMenu(TQPopupMenu*), + * or 0 if none has been set. + */ + TQPopupMenu *currentMenu() const { return _menu; } + + /** + * Connect the menu item identified to currentMenu()/id to + * the accelerator action. + */ + void connectAccel( int itemId, const char *action ); + + /** + * Same as above, but connects to standard accelerators. + */ + void connectAccel( int itemId, TDEStdAccel::StdAccel ); + + public slots: + /** + * Updates all menu accelerators. Call this after all accelerators + * have been connected or the kaccel object has been updated. + */ + void updateMenus(); + + private slots: + void removeDeadMenu(); + + private: + TDEAccelMenuWatch& operator=( const TDEAccelMenuWatch& ); + TDEAccelMenuWatch( const TDEAccelMenuWatch& ); +}; + +#endif // KARM_K_ACCEL_MENU_WATCH_H -- cgit v1.2.1