From 2d00595867197e5b5563d85e871a59a77a23f70f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:38 -0600 Subject: Fix FTBFS --- extra/kde332/kaccelaction.h | 564 ---------------------------------------- extra/kde332/kaccelbase.h | 230 ---------------- extra/kde332/krecentdirs.h | 68 ----- extra/kde332/ktoolbarbutton.h | 315 ---------------------- extra/kde332/tdeaccelaction.h | 564 ++++++++++++++++++++++++++++++++++++++++ extra/kde332/tdeaccelbase.h | 230 ++++++++++++++++ extra/kde332/tderecentdirs.h | 68 +++++ extra/kde332/tdetoolbarbutton.h | 315 ++++++++++++++++++++++ 8 files changed, 1177 insertions(+), 1177 deletions(-) delete mode 100644 extra/kde332/kaccelaction.h delete mode 100644 extra/kde332/kaccelbase.h delete mode 100644 extra/kde332/krecentdirs.h delete mode 100644 extra/kde332/ktoolbarbutton.h create mode 100644 extra/kde332/tdeaccelaction.h create mode 100644 extra/kde332/tdeaccelbase.h create mode 100644 extra/kde332/tderecentdirs.h create mode 100644 extra/kde332/tdetoolbarbutton.h (limited to 'extra/kde332') diff --git a/extra/kde332/kaccelaction.h b/extra/kde332/kaccelaction.h deleted file mode 100644 index 269136c..0000000 --- a/extra/kde332/kaccelaction.h +++ /dev/null @@ -1,564 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2001,2002 Ellis Whitehead - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KACCELACTION_H -#define _KACCELACTION_H - -#include -#include -#include -#include - -#include - -class TDEAccelBase; - -class TQObject; -class TDEConfig; -class TDEConfigBase; - -/** - * @internal - * A TDEAccelAction prepresents an action that can be executed using - * an accelerator key. Each TDEAccelAction has a name, a label, a - * "What's this" string and a TDEShortcut. The user can configure and - * enable/disable them using KKeyDialog. - * - * \code - * 1) TDEAccelAction = "Run Command" - * Default3 = "Alt+F2" - * Default4 = "Meta+Enter;Alt+F2" - * 1) TDEShortcut = "Meta+Enter" - * 1) KKeySequence = "Meta+Enter" - * 1) KKey = "Meta+Enter" - * 1) Meta+Enter - * 2) Meta+Keypad_Enter - * 2) TDEShortcut = "Alt+F2" - * 1) KKeySequence = "Alt+F2" - * 1) Alt+F2 - * 2) TDEAccelAction = "Something" - * Default3 = "" - * Default4 = "" - * 1) TDEShortcut = "Meta+X,Asterisk" - * 1) KKeySequence = "Meta+X,Asterisk" - * 1) KKey = "Meta+X" - * 1) Meta+X - * 2) KKey = "Asterisk" - * 1) Shift+8 (English layout) - * 2) Keypad_Asterisk - * \endcode - * @short An accelerator action - * @see TDEAccel - * @see TDEGlobalAccel - * @see KKeyChooser - * @see KKeyDialog - */ -class TDEAccelAction -{ - public: - /** - * Creates an empty TDEAccelAction. - * @see clear() - */ - TDEAccelAction(); - - /** - * Copy constructor. - */ - TDEAccelAction( const TDEAccelAction& ); - - /** - * Creates a new TDEAccelAction. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param cutDef3 the default shortcut for 3 modifier systems - * @param cutDef4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled true if the accelerator should be enabled - */ - TDEAccelAction( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable, bool bEnabled ); - ~TDEAccelAction(); - - /** - * Clears the accelerator. - */ - void clear(); - - /** - * Re-initialized the TDEAccelAction. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param cutDef3 the default shortcut for 3 modifier systems - * @param cutDef4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled true if the accelerator should be enabled - * @return true if successful, false otherwise - */ - bool init( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable, bool bEnabled ); - - /** - * Copies this TDEAccelAction. - */ - TDEAccelAction& operator=( const TDEAccelAction& ); - - /** - * Returns the name of the accelerator action. - * @return the name of the accelerator action, can be null if not - * set - */ - const TQString& name() const { return m_sName; } - - /** - * Returns the label of the accelerator action. - * @return the label of the accelerator action, can be null if - * not set - */ - const TQString& label() const { return m_sLabel; } - - /** - * Returns the What's This text of the accelerator action. - * @return the What's This text of the accelerator action, can be - * null if not set - */ - const TQString& whatsThis() const { return m_sWhatsThis; } - - /** - * The shortcut that is actually used (may be used configured). - * @return the shortcut of the TDEAccelAction, can be null if not set - * @see shortcutDefault() - */ - const TDEShortcut& shortcut() const { return m_cut; } - - /** - * The default shortcut for this system. - * @return the default shortcut on this system, can be null if not set - * @see shortcut() - * @see shortcutDefault3() - * @see shortcutDefault4() - */ - const TDEShortcut& shortcutDefault() const; - - /** - * The default shortcut for 3 modifier systems. - * @return the default shortcut for 3 modifier systems, can be null - * if not set - * @see shortcutDefault() - * @see shortcutDefault4() - * @see useFourModifierKeys() - */ - const TDEShortcut& shortcutDefault3() const { return m_cutDefault3; } - - /** - * The default shortcut for 4 modifier systems. - * @return the default shortcut for 4 modifier systems, can be null - * if not set - * @see shortcutDefault() - * @see shortcutDefault3() - * @see useFourModifierKeys() - */ - const TDEShortcut& shortcutDefault4() const { return m_cutDefault4; } - - /** - * Returns the receiver of signals. - * @return the receiver of signals (can be 0 if not set) - */ - const TQObject* objSlotPtr() const { return m_pObjSlot; } - - /** - * Returns the slot for the signal. - * @return the slot for the signal - */ - const char* methodSlotPtr() const { return m_psMethodSlot; } - - /** - * Checks whether the user can configure the action. - * @return true if configurable, false otherwise - */ - bool isConfigurable() const { return m_bConfigurable; } - - /** - * Checks whether the action is enabled. - * @return true if enabled, false otherwise - */ - bool isEnabled() const { return m_bEnabled; } - - /** - * Sets the name of the accelerator action. - * @param name the new name - */ - void setName( const TQString& name ); - - /** - * Sets the user-readable label of the accelerator action. - * @param label the new label (i18n!) - */ - void setLabel( const TQString& label ); - - /** - * Sets the What's This text for the accelerator action. - * @param whatsThis the new What's This text (i18n!) - */ - void setWhatsThis( const TQString& whatsThis ); - - /** - * Sets the new shortcut of the accelerator action. - * @param rgCuts the shortcut to set - * @return true if successful, false otherwise - */ - bool setShortcut( const TDEShortcut& rgCuts ); - - /** - * Sets the slot of the accelerator action. - * @param pObjSlot the receiver object of the signal - * @param psMethodSlot the slot for the signal - */ - void setSlot( const TQObject* pObjSlot, const char* psMethodSlot ); - - /** - * Enables or disabled configuring the action. - * @param configurable true to enable configurability, false to disable - */ - void setConfigurable( bool configurable ); - - /** - * Enables or disabled the action. - * @param configurable true to enable the action, false to disable - */ - void setEnabled( bool enable ); - - /** - * Retrieves the id set using setID. - * @return the id of the accelerator action - */ - int getID() const { return m_nIDAccel; } - - /** - * Allows you to set an id that will be used as the action - * signal's argument. - * - * @param n the new id - * @see getID() - */ - void setID( int n ) { m_nIDAccel = n; } - - /** - * Checkes whether the action is connected (emits signals). - * @return true if connected, false otherwise - */ - bool isConnected() const; - - /** - * Sets a key sequence of the action's shortcut. - * @param i the position of the sequence - * @param keySeq the new new sequence - * @return true if successful, false otherwise - * @see TDEShortcut::setSeq() - */ - bool setKeySequence( uint i, const KKeySequence &keySeq ); - - /** - * Clears the action's shortcut. It will not contain any sequences after - * calling this method. - * @see TDEShortcut::clear() - */ - void clearShortcut(); - - /** - * Checks whether the action's shortcut contains the given key sequence. - * @param keySeq the key sequence to check - * @return true if the shortcut contains the given sequence - * @see TDEShortcut::contains() - */ - bool contains( const KKeySequence &keySeq ); - - /** - * Returns the string representation of the action's shortcut. - * @return the string representation of the action's shortcut. - * @see TDEShortcut::toString() - */ - TQString toString() const; - - /** - * @internal - */ - TQString toStringInternal() const; - - /** - * Returns true if four modifier keys will be used. - * @return true if four modifier keys will be used. - */ - static bool useFourModifierKeys(); - - /** - * Selects 3 or 4 modifier default shortcuts. - * @param use true to use 4 modifier shortcuts, false to use - * 3 modifier shortcuts - */ - static void useFourModifierKeys( bool use ); - - protected: - TQString m_sName, - m_sLabel, - m_sWhatsThis; - TDEShortcut m_cut; - TDEShortcut m_cutDefault3, m_cutDefault4; - const TQObject* m_pObjSlot; - const char* m_psMethodSlot; - bool m_bConfigurable, - m_bEnabled; - int m_nIDAccel; - uint m_nConnections; - - void incConnections(); - void decConnections(); - - private: - static int g_bUseFourModifierKeys; - class TDEAccelActionPrivate* d; - - friend class TDEAccelActions; - friend class TDEAccelBase; -}; - -//--------------------------------------------------------------------- -// TDEAccelActions -//--------------------------------------------------------------------- - -/** - * @internal - * This class represents a collection of TDEAccelAction objects. - * - * @short A collection of accelerator actions - * @see TDEAccelAction - */ -class TDEAccelActions -{ - public: - /** - * Creates a new, empty TDEAccelActions object. - */ - TDEAccelActions(); - - /** - * Copy constructor (deep copy). - */ - TDEAccelActions( const TDEAccelActions& ); - virtual ~TDEAccelActions(); - - /** - * Removes all items from this collection. - */ - void clear(); - - /** - * Initializes this object with the given actions. - * It will make a deep copy of all actions. - * @param actions the actions to copy - * @return true if successful, false otherwise - */ - bool init( const TDEAccelActions &actions ); - - /** - * Loads the actions from the given configuration file. - * - * @param config the configuration file to load from - * @param sGroup the group in the configuration file - * @return true if successful, false otherwise - */ - bool init( TDEConfigBase& config, const TQString& sGroup ); - - /** - * Updates the shortcuts of all actions in this object - * with the shortcuts from the given object. - * @param shortcuts the collection that contains the new - * shortcuts - */ - void updateShortcuts( TDEAccelActions &shortcuts ); - - /** - * Retrieves the index of the action with the given name. - * @param sAction the action to search - * @return the index of the action, or -1 if not found - */ - int actionIndex( const TQString& sAction ) const; - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see count() - */ - TDEAccelAction* actionPtr( uint index ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see count() - */ - const TDEAccelAction* actionPtr( uint index ) const; - - /** - * Returns the action with the given name. - * @param aAction the name of the action to search - * @return the TDEAccelAction with the given name, or 0 - * if not found - */ - TDEAccelAction* actionPtr( const TQString& sAction ); - - /** - * Returns the action with the given name. - * @param aAction the name of the action to search - * @return the TDEAccelAction with the given name, or 0 - * if not found - */ - const TDEAccelAction* actionPtr( const TQString& sAction ) const; - - /** - * Returns the action with the given key sequence. - * @param cut the sequence to search for - * @return the TDEAccelAction with the given sequence, or 0 - * if not found - */ - TDEAccelAction* actionPtr( KKeySequence cut ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see actionPtr() - * @see count() - */ - TDEAccelAction& operator []( uint index ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see actionPtr() - * @see count() - */ - const TDEAccelAction& operator []( uint index ) const; - - /** - * Inserts an action into the collection. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param cutDef3 the default shortcut for 3 modifier systems - * @param cutDef4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled true if the accelerator should be enabled - * @return the new action - */ - TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, - const TQObject* pObjSlot = 0, const char* psMethodSlot = 0, - bool bConfigurable = true, bool bEnabled = true ); - - /** - * Inserts an action into the collection. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @return the new action - */ - TDEAccelAction* insert( const TQString& sName, const TQString& sLabel ); - - /** - * Removes the given action. - * @param sAction the name of the action. - * @return true if successful, false otherwise - */ - bool remove( const TQString& sAction ); - - /** - * Loads the actions from the given configuration file. - * - * @param sConfigGroup the group in the configuration file - * @param pConfig the configuration file to load from - * @return true if successful, false otherwise - */ - bool readActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0 ); - - /** - * Writes the actions to the given configuration file. - * - * @param sConfigGroup the group in the configuration file - * @param pConfig the configuration file to save to - * @param bWriteAll true to write all actions - * @param bGlobal true to write to the global configuration file - * @return true if successful, false otherwise - */ - bool writeActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0, - bool bWriteAll = false, bool bGlobal = false ) const; - - /** - * Emit a keycodeChanged signal. - */ - void emitKeycodeChanged(); - - /** - * Returns the number of actions in the collection. - * @return the number of actions - */ - uint count() const; - - protected: - TDEAccelBase* m_pTDEAccelBase; - TDEAccelAction** m_prgActions; - uint m_nSizeAllocated, m_nSize; - - void resize( uint ); - void insertPtr( TDEAccelAction* ); - - private: - class TDEAccelActionsPrivate* d; - - TDEAccelActions( TDEAccelBase* ); - void initPrivate( TDEAccelBase* ); - TDEAccelActions& operator =( TDEAccelActions& ); - - friend class TDEAccelBase; -}; - -#endif // _KACCELACTION_H diff --git a/extra/kde332/kaccelbase.h b/extra/kde332/kaccelbase.h deleted file mode 100644 index ea654cc..0000000 --- a/extra/kde332/kaccelbase.h +++ /dev/null @@ -1,230 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2001 Ellis Whitehead - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KACCELBASE_H -#define _KACCELBASE_H - -#include -#include -#include -#include -#include - -#include "kaccelaction.h" -#include "kkeyserver_x11.h" - -class TQPopupMenu; -class TQWidget; - -//---------------------------------------------------- - -/** - * @internal - * Handle keyboard accelerators. - * - * Allow an user to configure - * key bindings through application configuration files or through the - * KKeyChooser GUI. - * - * A TDEAccel contains a list of accelerator items. Each accelerator item - * consists of an action name and a keyboard code combined with modifiers - * (Shift, Ctrl and Alt.) - * - * For example, "Ctrl+P" could be a shortcut for printing a document. The key - * codes are listed in ckey.h. "Print" could be the action name for printing. - * The action name identifies the key binding in configuration files and the - * KKeyChooser GUI. - * - * When pressed, an accelerator key calls the slot to which it has been - * connected. Accelerator items can be connected so that a key will activate - * two different slots. - * - * A TDEAccel object handles key events sent to its parent widget and to all - * children of this parent widget. - * - * Key binding reconfiguration during run time can be prevented by specifying - * that an accelerator item is not configurable when it is inserted. A special - * group of non-configurable key bindings are known as the - * standard accelerators. - * - * The standard accelerators appear repeatedly in applications for - * standard document actions such as printing and saving. Convenience methods are - * available to insert and connect these accelerators which are configurable on - * a desktop-wide basis. - * - * It is possible for a user to choose to have no key associated with - * an action. - * - * The translated first argument for insertItem() is used only - * in the configuration dialog. - *\code - * TDEAccel *a = new TDEAccel( myWindow ); - * // Insert an action "Scroll Up" which is associated with the "Up" key: - * a->insertItem( i18n("Scroll Up"), "Scroll Up", "Up" ); - * // Insert an action "Scroll Down" which is not associated with any key: - * a->insertItem( i18n("Scroll Down"), "Scroll Down", 0); - * a->connectItem( "Scroll up", myWindow, SLOT( scrollUp() ) ); - * // a->insertStdItem( TDEStdAccel::Print ); //not necessary, since it - * // is done automatially with the - * // connect below! - * a->connectItem(TDEStdAccel::Print, myWindow, SLOT( printDoc() ) ); - * - * a->readSettings(); - *\endcode - * - * If a shortcut has a menu entry as well, you could insert them like - * this. The example is again the TDEStdAccel::Print from above. - * - * \code - * int id; - * id = popup->insertItem("&Print",this, SLOT(printDoc())); - * a->changeMenuAccel(popup, id, TDEStdAccel::Print ); - * \endcode - * - * If you want a somewhat "exotic" name for your standard print action, like - * id = popup->insertItem(i18n("Print &Document"),this, SLOT(printDoc())); - * it might be a good idea to insert the standard action before as - * a->insertStdItem( TDEStdAccel::Print, i18n("Print Document") ) - * as well, so that the user can easily find the corresponding function. - * - * This technique works for other actions as well. Your "scroll up" function - * in a menu could be done with - * - * \code - * id = popup->insertItem(i18n"Scroll &up",this, SLOT(scrollUp())); - * a->changeMenuAccel(popup, id, "Scroll Up" ); - * \endcode - * - * Please keep the order right: First insert all functions in the - * acceleratior, then call a -> readSettings() and @em then build your - * menu structure. - * - * @short Configurable key binding support. - * @version $Id: kaccelbase.h,v 1.26 2003/08/16 19:44:57 coolo Exp $ - */ - -class TDEAccelBase -{ - public: - enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 }; - enum Signal { KEYCODE_CHANGED }; - - TDEAccelBase( int fInitCode ); - virtual ~TDEAccelBase(); - - uint actionCount() const; - TDEAccelActions& actions(); - bool isEnabled() const; - - TDEAccelAction* actionPtr( const TQString& sAction ); - const TDEAccelAction* actionPtr( const TQString& sAction ) const; - TDEAccelAction* actionPtr( const KKey& key ); - TDEAccelAction* actionPtr( const KKeyServer::Key& key ); - - const TQString& configGroup() const { return m_sConfigGroup; } - void setConfigGroup( const TQString& group ); - void setConfigGlobal( bool global ); - virtual void setEnabled( bool bEnabled ) = 0; - bool getAutoUpdate() { return m_bAutoUpdate; } - // return value of AutoUpdate flag before this call. - bool setAutoUpdate( bool bAuto ); - -// Procedures for manipulating Actions. - //void clearActions(); - - TDEAccelAction* insert( const TQString& sName, const TQString& sDesc ); - TDEAccelAction* insert( - const TQString& sAction, const TQString& sDesc, const TQString& sHelp, - const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable = true, bool bEnabled = true ); - bool remove( const TQString& sAction ); - bool setActionSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot ); - - bool updateConnections(); - - bool setShortcut( const TQString& sAction, const TDEShortcut& cut ); - -// Modify individual Action sub-items - bool setActionEnabled( const TQString& sAction, bool bEnable ); - - /** - * Read all key associations from @p config, or (if @p config - * is zero) from the application's configuration file - * TDEGlobal::config(). - * - * The group in which the configuration is stored can be - * set with setConfigGroup(). - */ - void readSettings( TDEConfigBase* pConfig = 0 ); - - /** - * Write the current configurable associations to @p config, - * or (if @p config is zero) to the application's - * configuration file. - */ - void writeSettings( TDEConfigBase* pConfig = 0 ) const; - - TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& ); - - // Protected methods - protected: - void slotRemoveAction( TDEAccelAction* ); - - struct X; - void createKeyList( TQValueVector& rgKeys ); - bool insertConnection( TDEAccelAction* ); - bool removeConnection( TDEAccelAction* ); - - virtual bool emitSignal( Signal ) = 0; - virtual bool connectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; - virtual bool connectKey( const KKeyServer::Key& ) = 0; - virtual bool disconnectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; - virtual bool disconnectKey( const KKeyServer::Key& ) = 0; - - protected: - struct ActionInfo - { - TDEAccelAction* pAction; - uint iSeq, iVariation; - //ActionInfo* pInfoNext; // nil if only one action uses this key. - - ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; } - ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation ) - { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; } - }; - typedef TQMap KKeyToActionMap; - - TDEAccelActions m_rgActions; - KKeyToActionMap m_mapKeyToAction; - TQValueList m_rgActionsNonUnique; - bool m_bNativeKeys; // Use native key codes instead of TQt codes - bool m_bEnabled; - bool m_bConfigIsGlobal; - TQString m_sConfigGroup; - bool m_bAutoUpdate; - TDEAccelAction* mtemp_pActionRemoving; - - private: - TDEAccelBase& operator =( const TDEAccelBase& ); - - friend class TDEAccelActions; -}; - -#endif // _KACCELBASE_H diff --git a/extra/kde332/krecentdirs.h b/extra/kde332/krecentdirs.h deleted file mode 100644 index 4187c1e..0000000 --- a/extra/kde332/krecentdirs.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- - * Copyright (C)2000 Waldo Bastian - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#ifndef __KRECENTDIRS_H -#define __KRECENTDIRS_H - -#include - -/** - * The goal of this class is to make sure that, when the user needs to - * specify a file via the file selection dialog, this dialog will start - * in the directory most likely to contain the desired files. - * - * This works as follows: Each time the file selection dialog is - * shown, the programmer can specify a "file-class". The file-dialog will - * then start with the directory associated with this file-class. When - * the dialog closes, the directory currently shown in the file-dialog - * will be associated with the file-class. - * - * A file-class can either start with ':' or with '::'. If it starts with - * a single ':' the file-class is specific to the current application. - * If the file-class starts with '::' it is global to all applications. - */ -class TDERecentDirs -{ -public: - /** - * Returns a list of directories associated with this file-class. - * The most recently used directory is at the front of the list. - */ - static TQStringList list(const TQString &fileClass); - - /** - * Returns the most recently used directory accociated with this file-class. - */ - static TQString dir(const TQString &fileClass); - - /** - * Associates @p directory with @p fileClass - */ - static void add(const TQString &fileClass, const TQString &directory); -}; - -#endif diff --git a/extra/kde332/ktoolbarbutton.h b/extra/kde332/ktoolbarbutton.h deleted file mode 100644 index 724e26b..0000000 --- a/extra/kde332/ktoolbarbutton.h +++ /dev/null @@ -1,315 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org) - (C) 1997, 1998 Sven Radej (radej@kde.org) - (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) - (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) - (C) 2000 Kurt Granroth (granroth@kde.org) - - 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. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KTOOLBARBUTTON_H -#define _KTOOLBARBUTTON_H - -#include -#include -#include -#include -#include - -class TDEToolBar; -class TDEToolBarButtonPrivate; -class TDEInstance; -class TQEvent; -class TQPopupMenu; -class TQPainter; - -/** - * A toolbar button. This is used internally by TDEToolBar, use the - * TDEToolBar methods instead. - * @internal - */ -class TDEToolBarButton : public TQToolButton -{ - Q_OBJECT - -public: - /** - * Construct a button with an icon loaded by the button itself. - * This will trust the button to load the correct icon with the - * correct size. - * - * @param icon Name of icon to load (may be absolute or relative) - * @param id Id of this button - * @param parent This button's parent - * @param name This button's internal name - * @param txt This button's text (in a tooltip or otherwise) - * @param _instance the instance to use for this button - */ - TDEToolBarButton(const TQString& icon, int id, TQWidget *parent, - const char *name=0L, const TQString &txt=TQString::null, - TDEInstance *_instance = TDEGlobal::instance()); - - /** - * Construct a button with an existing pixmap. It is not - * recommended that you use this as the internal icon loading code - * will almost always get it "right". - * - * @param pixmap Name of icon to load (may be absolute or relative) - * @param id Id of this button - * @param parent This button's parent - * @param name This button's internal name - * @param txt This button's text (in a tooltip or otherwise) - */ - TDEToolBarButton(const TQPixmap& pixmap, int id, TQWidget *parent, - const char *name=0L, const TQString &txt=TQString::null); - - /** - * Construct a separator button - * - * @param parent This button's parent - * @param name This button's internal name - */ - TDEToolBarButton(TQWidget *parent=0L, const char *name=0L); - - /** - * Standard destructor - */ - ~TDEToolBarButton(); - -#ifndef KDE_NO_COMPAT - /** - * @deprecated - * Set the pixmap directly for this button. This pixmap should be - * the active one... the dimmed and disabled pixmaps are constructed - * based on this one. However, don't use this function unless you - * are positive that you don't want to use setIcon. - * - * @param pixmap The active pixmap - */ - // this one is from TQButton, so #ifdef-ing it out doesn't break BC - virtual void setPixmap(const TQPixmap &pixmap) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this pixmap as the default one rather - * then generating it using effects. - * - * @param pixmap The pixmap to use as the default (normal) one - */ - void setDefaultPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this pixmap when disabled one rather then - * generating it using effects. - * - * @param pixmap The pixmap to use when disabled - */ - void setDisabledPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; -#endif - - /** - * Set the text for this button. The text will be either used as a - * tooltip (IconOnly) or will be along side the icon - * - * @param text The button (or tooltip) text - */ - virtual void setText(const TQString &text); - - /** - * Set the icon for this button. The icon will be loaded internally - * with the correct size. This function is preferred over setIconSet - * - * @param icon The name of the icon - */ - virtual void setIcon(const TQString &icon); - - /// @since 3.1 - virtual void setIcon( const TQPixmap &pixmap ) - { TQToolButton::setIcon( pixmap ); } - - /** - * Set the pixmaps for this toolbar button from a TQIconSet. - * 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 TQIconSet &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 generate is - * true. This function is preferred over setPixmap - * - * @param icon The name of the active icon - * @param generate If true, then the other icons are automagically - * generated from this one - */ - KDE_DEPRECATED void setIcon(const TQString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); } - - /** - * @deprecated - * Force the button to use this icon as the default one rather - * then generating it using effects. - * - * @param icon The icon to use as the default (normal) one - */ - void setDefaultIcon(const TQString& icon) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this icon when disabled one rather then - * generating it using effects. - * - * @param icon The icon to use when disabled - */ - void setDisabledIcon(const TQString& icon) KDE_DEPRECATED; -#endif - - /** - * Turn this button on or off - * - * @param flag true or false - */ - void on(bool flag = true); - - /** - * Toggle this button - */ - void toggle(); - - /** - * Turn this button into a toggle button or disable the toggle - * aspects of it. This does not toggle the button itself. - * Use 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) - */ - TQPopupMenu *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 setDelayedPopup if you want that - * behavior. - * - * @param p The new popup menu - * @param unused Has no effect - ignore it. - */ - void setPopup (TQPopupMenu *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 - * @param unused Has no effect - ignore it. - */ - void setDelayedPopup(TQPopupMenu *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 - * explicitly turn this off, if you like. - * - * @param no_style Will disable styles if true - */ - void setNoStyle(bool no_style = true); - -signals: - void clicked(int); - void doubleClicked(int); - void pressed(int); - void released(int); - void toggled(int); - void highlighted(int, bool); - -public slots: - /** - * This slot should be called whenever the toolbar mode has - * potentially changed. This includes such events as text changing, - * orientation changing, etc. - */ - void modeChange(); - virtual void setTextLabel(const TQString&, bool tipToo); - -protected: - void paletteChange(const TQPalette &); - void leaveEvent(TQEvent *e); - void enterEvent(TQEvent *e); - void drawButton(TQPainter *p); - bool eventFilter (TQObject *o, TQEvent *e); - void showMenu(); - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - TQSize minimumSize() const; - - /// @since 3.1 - bool isRaised() const; - /// @since 3.1 - bool isActive() const; - /// @since 3.1 - int iconTextMode() const; - -protected slots: - void slotClicked(); - void slotPressed(); - void slotReleased(); - void slotToggled(); - void slotDelayTimeout(); - -protected: - virtual void virtual_hook( int id, void* data ); -private: - TDEToolBarButtonPrivate *d; -}; - -/** -* List of TDEToolBarButton objects. -* @internal -* @version $Id: ktoolbarbutton.h,v 1.36 2004/03/18 02:50:16 bmeyer Exp $ -*/ -class TDEToolBarButtonList : public TQIntDict -{ -public: - TDEToolBarButtonList(); - ~TDEToolBarButtonList() {} -}; - -#endif diff --git a/extra/kde332/tdeaccelaction.h b/extra/kde332/tdeaccelaction.h new file mode 100644 index 0000000..269136c --- /dev/null +++ b/extra/kde332/tdeaccelaction.h @@ -0,0 +1,564 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001,2002 Ellis Whitehead + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KACCELACTION_H +#define _KACCELACTION_H + +#include +#include +#include +#include + +#include + +class TDEAccelBase; + +class TQObject; +class TDEConfig; +class TDEConfigBase; + +/** + * @internal + * A TDEAccelAction prepresents an action that can be executed using + * an accelerator key. Each TDEAccelAction has a name, a label, a + * "What's this" string and a TDEShortcut. The user can configure and + * enable/disable them using KKeyDialog. + * + * \code + * 1) TDEAccelAction = "Run Command" + * Default3 = "Alt+F2" + * Default4 = "Meta+Enter;Alt+F2" + * 1) TDEShortcut = "Meta+Enter" + * 1) KKeySequence = "Meta+Enter" + * 1) KKey = "Meta+Enter" + * 1) Meta+Enter + * 2) Meta+Keypad_Enter + * 2) TDEShortcut = "Alt+F2" + * 1) KKeySequence = "Alt+F2" + * 1) Alt+F2 + * 2) TDEAccelAction = "Something" + * Default3 = "" + * Default4 = "" + * 1) TDEShortcut = "Meta+X,Asterisk" + * 1) KKeySequence = "Meta+X,Asterisk" + * 1) KKey = "Meta+X" + * 1) Meta+X + * 2) KKey = "Asterisk" + * 1) Shift+8 (English layout) + * 2) Keypad_Asterisk + * \endcode + * @short An accelerator action + * @see TDEAccel + * @see TDEGlobalAccel + * @see KKeyChooser + * @see KKeyDialog + */ +class TDEAccelAction +{ + public: + /** + * Creates an empty TDEAccelAction. + * @see clear() + */ + TDEAccelAction(); + + /** + * Copy constructor. + */ + TDEAccelAction( const TDEAccelAction& ); + + /** + * Creates a new TDEAccelAction. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param cutDef3 the default shortcut for 3 modifier systems + * @param cutDef4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled true if the accelerator should be enabled + */ + TDEAccelAction( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable, bool bEnabled ); + ~TDEAccelAction(); + + /** + * Clears the accelerator. + */ + void clear(); + + /** + * Re-initialized the TDEAccelAction. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param cutDef3 the default shortcut for 3 modifier systems + * @param cutDef4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled true if the accelerator should be enabled + * @return true if successful, false otherwise + */ + bool init( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable, bool bEnabled ); + + /** + * Copies this TDEAccelAction. + */ + TDEAccelAction& operator=( const TDEAccelAction& ); + + /** + * Returns the name of the accelerator action. + * @return the name of the accelerator action, can be null if not + * set + */ + const TQString& name() const { return m_sName; } + + /** + * Returns the label of the accelerator action. + * @return the label of the accelerator action, can be null if + * not set + */ + const TQString& label() const { return m_sLabel; } + + /** + * Returns the What's This text of the accelerator action. + * @return the What's This text of the accelerator action, can be + * null if not set + */ + const TQString& whatsThis() const { return m_sWhatsThis; } + + /** + * The shortcut that is actually used (may be used configured). + * @return the shortcut of the TDEAccelAction, can be null if not set + * @see shortcutDefault() + */ + const TDEShortcut& shortcut() const { return m_cut; } + + /** + * The default shortcut for this system. + * @return the default shortcut on this system, can be null if not set + * @see shortcut() + * @see shortcutDefault3() + * @see shortcutDefault4() + */ + const TDEShortcut& shortcutDefault() const; + + /** + * The default shortcut for 3 modifier systems. + * @return the default shortcut for 3 modifier systems, can be null + * if not set + * @see shortcutDefault() + * @see shortcutDefault4() + * @see useFourModifierKeys() + */ + const TDEShortcut& shortcutDefault3() const { return m_cutDefault3; } + + /** + * The default shortcut for 4 modifier systems. + * @return the default shortcut for 4 modifier systems, can be null + * if not set + * @see shortcutDefault() + * @see shortcutDefault3() + * @see useFourModifierKeys() + */ + const TDEShortcut& shortcutDefault4() const { return m_cutDefault4; } + + /** + * Returns the receiver of signals. + * @return the receiver of signals (can be 0 if not set) + */ + const TQObject* objSlotPtr() const { return m_pObjSlot; } + + /** + * Returns the slot for the signal. + * @return the slot for the signal + */ + const char* methodSlotPtr() const { return m_psMethodSlot; } + + /** + * Checks whether the user can configure the action. + * @return true if configurable, false otherwise + */ + bool isConfigurable() const { return m_bConfigurable; } + + /** + * Checks whether the action is enabled. + * @return true if enabled, false otherwise + */ + bool isEnabled() const { return m_bEnabled; } + + /** + * Sets the name of the accelerator action. + * @param name the new name + */ + void setName( const TQString& name ); + + /** + * Sets the user-readable label of the accelerator action. + * @param label the new label (i18n!) + */ + void setLabel( const TQString& label ); + + /** + * Sets the What's This text for the accelerator action. + * @param whatsThis the new What's This text (i18n!) + */ + void setWhatsThis( const TQString& whatsThis ); + + /** + * Sets the new shortcut of the accelerator action. + * @param rgCuts the shortcut to set + * @return true if successful, false otherwise + */ + bool setShortcut( const TDEShortcut& rgCuts ); + + /** + * Sets the slot of the accelerator action. + * @param pObjSlot the receiver object of the signal + * @param psMethodSlot the slot for the signal + */ + void setSlot( const TQObject* pObjSlot, const char* psMethodSlot ); + + /** + * Enables or disabled configuring the action. + * @param configurable true to enable configurability, false to disable + */ + void setConfigurable( bool configurable ); + + /** + * Enables or disabled the action. + * @param configurable true to enable the action, false to disable + */ + void setEnabled( bool enable ); + + /** + * Retrieves the id set using setID. + * @return the id of the accelerator action + */ + int getID() const { return m_nIDAccel; } + + /** + * Allows you to set an id that will be used as the action + * signal's argument. + * + * @param n the new id + * @see getID() + */ + void setID( int n ) { m_nIDAccel = n; } + + /** + * Checkes whether the action is connected (emits signals). + * @return true if connected, false otherwise + */ + bool isConnected() const; + + /** + * Sets a key sequence of the action's shortcut. + * @param i the position of the sequence + * @param keySeq the new new sequence + * @return true if successful, false otherwise + * @see TDEShortcut::setSeq() + */ + bool setKeySequence( uint i, const KKeySequence &keySeq ); + + /** + * Clears the action's shortcut. It will not contain any sequences after + * calling this method. + * @see TDEShortcut::clear() + */ + void clearShortcut(); + + /** + * Checks whether the action's shortcut contains the given key sequence. + * @param keySeq the key sequence to check + * @return true if the shortcut contains the given sequence + * @see TDEShortcut::contains() + */ + bool contains( const KKeySequence &keySeq ); + + /** + * Returns the string representation of the action's shortcut. + * @return the string representation of the action's shortcut. + * @see TDEShortcut::toString() + */ + TQString toString() const; + + /** + * @internal + */ + TQString toStringInternal() const; + + /** + * Returns true if four modifier keys will be used. + * @return true if four modifier keys will be used. + */ + static bool useFourModifierKeys(); + + /** + * Selects 3 or 4 modifier default shortcuts. + * @param use true to use 4 modifier shortcuts, false to use + * 3 modifier shortcuts + */ + static void useFourModifierKeys( bool use ); + + protected: + TQString m_sName, + m_sLabel, + m_sWhatsThis; + TDEShortcut m_cut; + TDEShortcut m_cutDefault3, m_cutDefault4; + const TQObject* m_pObjSlot; + const char* m_psMethodSlot; + bool m_bConfigurable, + m_bEnabled; + int m_nIDAccel; + uint m_nConnections; + + void incConnections(); + void decConnections(); + + private: + static int g_bUseFourModifierKeys; + class TDEAccelActionPrivate* d; + + friend class TDEAccelActions; + friend class TDEAccelBase; +}; + +//--------------------------------------------------------------------- +// TDEAccelActions +//--------------------------------------------------------------------- + +/** + * @internal + * This class represents a collection of TDEAccelAction objects. + * + * @short A collection of accelerator actions + * @see TDEAccelAction + */ +class TDEAccelActions +{ + public: + /** + * Creates a new, empty TDEAccelActions object. + */ + TDEAccelActions(); + + /** + * Copy constructor (deep copy). + */ + TDEAccelActions( const TDEAccelActions& ); + virtual ~TDEAccelActions(); + + /** + * Removes all items from this collection. + */ + void clear(); + + /** + * Initializes this object with the given actions. + * It will make a deep copy of all actions. + * @param actions the actions to copy + * @return true if successful, false otherwise + */ + bool init( const TDEAccelActions &actions ); + + /** + * Loads the actions from the given configuration file. + * + * @param config the configuration file to load from + * @param sGroup the group in the configuration file + * @return true if successful, false otherwise + */ + bool init( TDEConfigBase& config, const TQString& sGroup ); + + /** + * Updates the shortcuts of all actions in this object + * with the shortcuts from the given object. + * @param shortcuts the collection that contains the new + * shortcuts + */ + void updateShortcuts( TDEAccelActions &shortcuts ); + + /** + * Retrieves the index of the action with the given name. + * @param sAction the action to search + * @return the index of the action, or -1 if not found + */ + int actionIndex( const TQString& sAction ) const; + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see count() + */ + TDEAccelAction* actionPtr( uint index ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see count() + */ + const TDEAccelAction* actionPtr( uint index ) const; + + /** + * Returns the action with the given name. + * @param aAction the name of the action to search + * @return the TDEAccelAction with the given name, or 0 + * if not found + */ + TDEAccelAction* actionPtr( const TQString& sAction ); + + /** + * Returns the action with the given name. + * @param aAction the name of the action to search + * @return the TDEAccelAction with the given name, or 0 + * if not found + */ + const TDEAccelAction* actionPtr( const TQString& sAction ) const; + + /** + * Returns the action with the given key sequence. + * @param cut the sequence to search for + * @return the TDEAccelAction with the given sequence, or 0 + * if not found + */ + TDEAccelAction* actionPtr( KKeySequence cut ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see actionPtr() + * @see count() + */ + TDEAccelAction& operator []( uint index ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see actionPtr() + * @see count() + */ + const TDEAccelAction& operator []( uint index ) const; + + /** + * Inserts an action into the collection. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param cutDef3 the default shortcut for 3 modifier systems + * @param cutDef4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled true if the accelerator should be enabled + * @return the new action + */ + TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, + const TQObject* pObjSlot = 0, const char* psMethodSlot = 0, + bool bConfigurable = true, bool bEnabled = true ); + + /** + * Inserts an action into the collection. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @return the new action + */ + TDEAccelAction* insert( const TQString& sName, const TQString& sLabel ); + + /** + * Removes the given action. + * @param sAction the name of the action. + * @return true if successful, false otherwise + */ + bool remove( const TQString& sAction ); + + /** + * Loads the actions from the given configuration file. + * + * @param sConfigGroup the group in the configuration file + * @param pConfig the configuration file to load from + * @return true if successful, false otherwise + */ + bool readActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0 ); + + /** + * Writes the actions to the given configuration file. + * + * @param sConfigGroup the group in the configuration file + * @param pConfig the configuration file to save to + * @param bWriteAll true to write all actions + * @param bGlobal true to write to the global configuration file + * @return true if successful, false otherwise + */ + bool writeActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0, + bool bWriteAll = false, bool bGlobal = false ) const; + + /** + * Emit a keycodeChanged signal. + */ + void emitKeycodeChanged(); + + /** + * Returns the number of actions in the collection. + * @return the number of actions + */ + uint count() const; + + protected: + TDEAccelBase* m_pTDEAccelBase; + TDEAccelAction** m_prgActions; + uint m_nSizeAllocated, m_nSize; + + void resize( uint ); + void insertPtr( TDEAccelAction* ); + + private: + class TDEAccelActionsPrivate* d; + + TDEAccelActions( TDEAccelBase* ); + void initPrivate( TDEAccelBase* ); + TDEAccelActions& operator =( TDEAccelActions& ); + + friend class TDEAccelBase; +}; + +#endif // _KACCELACTION_H diff --git a/extra/kde332/tdeaccelbase.h b/extra/kde332/tdeaccelbase.h new file mode 100644 index 0000000..ea654cc --- /dev/null +++ b/extra/kde332/tdeaccelbase.h @@ -0,0 +1,230 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Ellis Whitehead + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KACCELBASE_H +#define _KACCELBASE_H + +#include +#include +#include +#include +#include + +#include "kaccelaction.h" +#include "kkeyserver_x11.h" + +class TQPopupMenu; +class TQWidget; + +//---------------------------------------------------- + +/** + * @internal + * Handle keyboard accelerators. + * + * Allow an user to configure + * key bindings through application configuration files or through the + * KKeyChooser GUI. + * + * A TDEAccel contains a list of accelerator items. Each accelerator item + * consists of an action name and a keyboard code combined with modifiers + * (Shift, Ctrl and Alt.) + * + * For example, "Ctrl+P" could be a shortcut for printing a document. The key + * codes are listed in ckey.h. "Print" could be the action name for printing. + * The action name identifies the key binding in configuration files and the + * KKeyChooser GUI. + * + * When pressed, an accelerator key calls the slot to which it has been + * connected. Accelerator items can be connected so that a key will activate + * two different slots. + * + * A TDEAccel object handles key events sent to its parent widget and to all + * children of this parent widget. + * + * Key binding reconfiguration during run time can be prevented by specifying + * that an accelerator item is not configurable when it is inserted. A special + * group of non-configurable key bindings are known as the + * standard accelerators. + * + * The standard accelerators appear repeatedly in applications for + * standard document actions such as printing and saving. Convenience methods are + * available to insert and connect these accelerators which are configurable on + * a desktop-wide basis. + * + * It is possible for a user to choose to have no key associated with + * an action. + * + * The translated first argument for insertItem() is used only + * in the configuration dialog. + *\code + * TDEAccel *a = new TDEAccel( myWindow ); + * // Insert an action "Scroll Up" which is associated with the "Up" key: + * a->insertItem( i18n("Scroll Up"), "Scroll Up", "Up" ); + * // Insert an action "Scroll Down" which is not associated with any key: + * a->insertItem( i18n("Scroll Down"), "Scroll Down", 0); + * a->connectItem( "Scroll up", myWindow, SLOT( scrollUp() ) ); + * // a->insertStdItem( TDEStdAccel::Print ); //not necessary, since it + * // is done automatially with the + * // connect below! + * a->connectItem(TDEStdAccel::Print, myWindow, SLOT( printDoc() ) ); + * + * a->readSettings(); + *\endcode + * + * If a shortcut has a menu entry as well, you could insert them like + * this. The example is again the TDEStdAccel::Print from above. + * + * \code + * int id; + * id = popup->insertItem("&Print",this, SLOT(printDoc())); + * a->changeMenuAccel(popup, id, TDEStdAccel::Print ); + * \endcode + * + * If you want a somewhat "exotic" name for your standard print action, like + * id = popup->insertItem(i18n("Print &Document"),this, SLOT(printDoc())); + * it might be a good idea to insert the standard action before as + * a->insertStdItem( TDEStdAccel::Print, i18n("Print Document") ) + * as well, so that the user can easily find the corresponding function. + * + * This technique works for other actions as well. Your "scroll up" function + * in a menu could be done with + * + * \code + * id = popup->insertItem(i18n"Scroll &up",this, SLOT(scrollUp())); + * a->changeMenuAccel(popup, id, "Scroll Up" ); + * \endcode + * + * Please keep the order right: First insert all functions in the + * acceleratior, then call a -> readSettings() and @em then build your + * menu structure. + * + * @short Configurable key binding support. + * @version $Id: kaccelbase.h,v 1.26 2003/08/16 19:44:57 coolo Exp $ + */ + +class TDEAccelBase +{ + public: + enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 }; + enum Signal { KEYCODE_CHANGED }; + + TDEAccelBase( int fInitCode ); + virtual ~TDEAccelBase(); + + uint actionCount() const; + TDEAccelActions& actions(); + bool isEnabled() const; + + TDEAccelAction* actionPtr( const TQString& sAction ); + const TDEAccelAction* actionPtr( const TQString& sAction ) const; + TDEAccelAction* actionPtr( const KKey& key ); + TDEAccelAction* actionPtr( const KKeyServer::Key& key ); + + const TQString& configGroup() const { return m_sConfigGroup; } + void setConfigGroup( const TQString& group ); + void setConfigGlobal( bool global ); + virtual void setEnabled( bool bEnabled ) = 0; + bool getAutoUpdate() { return m_bAutoUpdate; } + // return value of AutoUpdate flag before this call. + bool setAutoUpdate( bool bAuto ); + +// Procedures for manipulating Actions. + //void clearActions(); + + TDEAccelAction* insert( const TQString& sName, const TQString& sDesc ); + TDEAccelAction* insert( + const TQString& sAction, const TQString& sDesc, const TQString& sHelp, + const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable = true, bool bEnabled = true ); + bool remove( const TQString& sAction ); + bool setActionSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot ); + + bool updateConnections(); + + bool setShortcut( const TQString& sAction, const TDEShortcut& cut ); + +// Modify individual Action sub-items + bool setActionEnabled( const TQString& sAction, bool bEnable ); + + /** + * Read all key associations from @p config, or (if @p config + * is zero) from the application's configuration file + * TDEGlobal::config(). + * + * The group in which the configuration is stored can be + * set with setConfigGroup(). + */ + void readSettings( TDEConfigBase* pConfig = 0 ); + + /** + * Write the current configurable associations to @p config, + * or (if @p config is zero) to the application's + * configuration file. + */ + void writeSettings( TDEConfigBase* pConfig = 0 ) const; + + TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& ); + + // Protected methods + protected: + void slotRemoveAction( TDEAccelAction* ); + + struct X; + void createKeyList( TQValueVector& rgKeys ); + bool insertConnection( TDEAccelAction* ); + bool removeConnection( TDEAccelAction* ); + + virtual bool emitSignal( Signal ) = 0; + virtual bool connectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; + virtual bool connectKey( const KKeyServer::Key& ) = 0; + virtual bool disconnectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; + virtual bool disconnectKey( const KKeyServer::Key& ) = 0; + + protected: + struct ActionInfo + { + TDEAccelAction* pAction; + uint iSeq, iVariation; + //ActionInfo* pInfoNext; // nil if only one action uses this key. + + ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; } + ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation ) + { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; } + }; + typedef TQMap KKeyToActionMap; + + TDEAccelActions m_rgActions; + KKeyToActionMap m_mapKeyToAction; + TQValueList m_rgActionsNonUnique; + bool m_bNativeKeys; // Use native key codes instead of TQt codes + bool m_bEnabled; + bool m_bConfigIsGlobal; + TQString m_sConfigGroup; + bool m_bAutoUpdate; + TDEAccelAction* mtemp_pActionRemoving; + + private: + TDEAccelBase& operator =( const TDEAccelBase& ); + + friend class TDEAccelActions; +}; + +#endif // _KACCELBASE_H diff --git a/extra/kde332/tderecentdirs.h b/extra/kde332/tderecentdirs.h new file mode 100644 index 0000000..4187c1e --- /dev/null +++ b/extra/kde332/tderecentdirs.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- + * Copyright (C)2000 Waldo Bastian + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#ifndef __KRECENTDIRS_H +#define __KRECENTDIRS_H + +#include + +/** + * The goal of this class is to make sure that, when the user needs to + * specify a file via the file selection dialog, this dialog will start + * in the directory most likely to contain the desired files. + * + * This works as follows: Each time the file selection dialog is + * shown, the programmer can specify a "file-class". The file-dialog will + * then start with the directory associated with this file-class. When + * the dialog closes, the directory currently shown in the file-dialog + * will be associated with the file-class. + * + * A file-class can either start with ':' or with '::'. If it starts with + * a single ':' the file-class is specific to the current application. + * If the file-class starts with '::' it is global to all applications. + */ +class TDERecentDirs +{ +public: + /** + * Returns a list of directories associated with this file-class. + * The most recently used directory is at the front of the list. + */ + static TQStringList list(const TQString &fileClass); + + /** + * Returns the most recently used directory accociated with this file-class. + */ + static TQString dir(const TQString &fileClass); + + /** + * Associates @p directory with @p fileClass + */ + static void add(const TQString &fileClass, const TQString &directory); +}; + +#endif diff --git a/extra/kde332/tdetoolbarbutton.h b/extra/kde332/tdetoolbarbutton.h new file mode 100644 index 0000000..724e26b --- /dev/null +++ b/extra/kde332/tdetoolbarbutton.h @@ -0,0 +1,315 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org) + (C) 1997, 1998 Sven Radej (radej@kde.org) + (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) + (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) + (C) 2000 Kurt Granroth (granroth@kde.org) + + 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. + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KTOOLBARBUTTON_H +#define _KTOOLBARBUTTON_H + +#include +#include +#include +#include +#include + +class TDEToolBar; +class TDEToolBarButtonPrivate; +class TDEInstance; +class TQEvent; +class TQPopupMenu; +class TQPainter; + +/** + * A toolbar button. This is used internally by TDEToolBar, use the + * TDEToolBar methods instead. + * @internal + */ +class TDEToolBarButton : public TQToolButton +{ + Q_OBJECT + +public: + /** + * Construct a button with an icon loaded by the button itself. + * This will trust the button to load the correct icon with the + * correct size. + * + * @param icon Name of icon to load (may be absolute or relative) + * @param id Id of this button + * @param parent This button's parent + * @param name This button's internal name + * @param txt This button's text (in a tooltip or otherwise) + * @param _instance the instance to use for this button + */ + TDEToolBarButton(const TQString& icon, int id, TQWidget *parent, + const char *name=0L, const TQString &txt=TQString::null, + TDEInstance *_instance = TDEGlobal::instance()); + + /** + * Construct a button with an existing pixmap. It is not + * recommended that you use this as the internal icon loading code + * will almost always get it "right". + * + * @param pixmap Name of icon to load (may be absolute or relative) + * @param id Id of this button + * @param parent This button's parent + * @param name This button's internal name + * @param txt This button's text (in a tooltip or otherwise) + */ + TDEToolBarButton(const TQPixmap& pixmap, int id, TQWidget *parent, + const char *name=0L, const TQString &txt=TQString::null); + + /** + * Construct a separator button + * + * @param parent This button's parent + * @param name This button's internal name + */ + TDEToolBarButton(TQWidget *parent=0L, const char *name=0L); + + /** + * Standard destructor + */ + ~TDEToolBarButton(); + +#ifndef KDE_NO_COMPAT + /** + * @deprecated + * Set the pixmap directly for this button. This pixmap should be + * the active one... the dimmed and disabled pixmaps are constructed + * based on this one. However, don't use this function unless you + * are positive that you don't want to use setIcon. + * + * @param pixmap The active pixmap + */ + // this one is from TQButton, so #ifdef-ing it out doesn't break BC + virtual void setPixmap(const TQPixmap &pixmap) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this pixmap as the default one rather + * then generating it using effects. + * + * @param pixmap The pixmap to use as the default (normal) one + */ + void setDefaultPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this pixmap when disabled one rather then + * generating it using effects. + * + * @param pixmap The pixmap to use when disabled + */ + void setDisabledPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; +#endif + + /** + * Set the text for this button. The text will be either used as a + * tooltip (IconOnly) or will be along side the icon + * + * @param text The button (or tooltip) text + */ + virtual void setText(const TQString &text); + + /** + * Set the icon for this button. The icon will be loaded internally + * with the correct size. This function is preferred over setIconSet + * + * @param icon The name of the icon + */ + virtual void setIcon(const TQString &icon); + + /// @since 3.1 + virtual void setIcon( const TQPixmap &pixmap ) + { TQToolButton::setIcon( pixmap ); } + + /** + * Set the pixmaps for this toolbar button from a TQIconSet. + * 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 TQIconSet &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 generate is + * true. This function is preferred over setPixmap + * + * @param icon The name of the active icon + * @param generate If true, then the other icons are automagically + * generated from this one + */ + KDE_DEPRECATED void setIcon(const TQString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); } + + /** + * @deprecated + * Force the button to use this icon as the default one rather + * then generating it using effects. + * + * @param icon The icon to use as the default (normal) one + */ + void setDefaultIcon(const TQString& icon) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this icon when disabled one rather then + * generating it using effects. + * + * @param icon The icon to use when disabled + */ + void setDisabledIcon(const TQString& icon) KDE_DEPRECATED; +#endif + + /** + * Turn this button on or off + * + * @param flag true or false + */ + void on(bool flag = true); + + /** + * Toggle this button + */ + void toggle(); + + /** + * Turn this button into a toggle button or disable the toggle + * aspects of it. This does not toggle the button itself. + * Use 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) + */ + TQPopupMenu *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 setDelayedPopup if you want that + * behavior. + * + * @param p The new popup menu + * @param unused Has no effect - ignore it. + */ + void setPopup (TQPopupMenu *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 + * @param unused Has no effect - ignore it. + */ + void setDelayedPopup(TQPopupMenu *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 + * explicitly turn this off, if you like. + * + * @param no_style Will disable styles if true + */ + void setNoStyle(bool no_style = true); + +signals: + void clicked(int); + void doubleClicked(int); + void pressed(int); + void released(int); + void toggled(int); + void highlighted(int, bool); + +public slots: + /** + * This slot should be called whenever the toolbar mode has + * potentially changed. This includes such events as text changing, + * orientation changing, etc. + */ + void modeChange(); + virtual void setTextLabel(const TQString&, bool tipToo); + +protected: + void paletteChange(const TQPalette &); + void leaveEvent(TQEvent *e); + void enterEvent(TQEvent *e); + void drawButton(TQPainter *p); + bool eventFilter (TQObject *o, TQEvent *e); + void showMenu(); + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + TQSize minimumSize() const; + + /// @since 3.1 + bool isRaised() const; + /// @since 3.1 + bool isActive() const; + /// @since 3.1 + int iconTextMode() const; + +protected slots: + void slotClicked(); + void slotPressed(); + void slotReleased(); + void slotToggled(); + void slotDelayTimeout(); + +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEToolBarButtonPrivate *d; +}; + +/** +* List of TDEToolBarButton objects. +* @internal +* @version $Id: ktoolbarbutton.h,v 1.36 2004/03/18 02:50:16 bmeyer Exp $ +*/ +class TDEToolBarButtonList : public TQIntDict +{ +public: + TDEToolBarButtonList(); + ~TDEToolBarButtonList() {} +}; + +#endif -- cgit v1.2.1