diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /korn/keditlistboxman.h | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korn/keditlistboxman.h')
-rw-r--r-- | korn/keditlistboxman.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/korn/keditlistboxman.h b/korn/keditlistboxman.h new file mode 100644 index 000000000..6792ee814 --- /dev/null +++ b/korn/keditlistboxman.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MK_KEDITLISTBOXMAN_H +#define MK_KEDITLISTBOXMAN_H + +#include <keditlistbox.h> + +class KConfig; + +class QString; +class QWidget; + +/** + * This class is a extention on KEditListBox. + * It also handles the configuration. + * @author Mart Kelder (mart.kde@hccnet.nl) + */ +class KEditListBoxManager : public KEditListBox +{ Q_OBJECT +public: + /** + * Constructor: @see KEditListBoxManager::KEditListBoxManager( const QString&, QWidget, const char * name, bool, int ) + */ + KEditListBoxManager( QWidget *parent = 0, const char *name = 0, + bool checkAtEntering=true, int buttons = All ); + + /** + * The save as above, but with other options for KEditListBox. + */ + KEditListBoxManager( const QString& title, QWidget *parent = 0, + const char *name = 0, bool checkAtEntering=true, + int buttons = All ); + + /** + * The save as above, but with other options for KEditListBox. + */ + KEditListBoxManager( const QString& title, + const KEditListBox::CustomEditor &customEditor, + QWidget *parent = 0, const char *name = 0, + bool checkAtEntering = true, int buttons = All ); + + /** + * Destructor + */ + ~KEditListBoxManager(); + + + /** + * Set the KConfig object (required before doing something + * @param config The KConfig-object + */ + void setConfig( KConfig* config ); + /** + * Sets the groupName. groupName should contain at least one %1. + * It is used for makeing groupnames. + * @param name The groupname + */ + void setGroupName( const QString& name ); + + /** + * Sets the subGroupName. subGroupName should contain %1 and %2. + * It is used to execute operations on a group and its subgroups. + * @param name The groupname + */ + void setSubGroupName( const QString& name ); +private: + /** + * This functions is called from and only from the constructor to prevent writing the + * same code for all constructors + */ + void init(); + + /** + * This function reads the names out the config. + */ + void readNames(); +private: + KConfig *_config; //Stores the KConfig-object + QString *_groupName; //Stores the groupName string. + QString *_subGroupName; + int _prevCount; + +private slots: + //These comes directly from the KEditListBox itselfs. + void slotChanged(); + void slotAdded( const QString& ); + void slotRemoved( const QString& ); + + void slotActivated( QListBoxItem* ); +private: + /** + * This private method moves an item. It is called from slotChanged(). + * @param src The number of the source-group. + * @param dest The number of the destanation-group + */ + void moveItem( int src, int dest ); + + /** + * This private functions switch to groups: first^=last; last^=first; first^=last + * @param first the first number of a group. + * @param last the second number of a group (and the last number). + */ + void changeItem( int first, int last ); + + /** + * This function is called if the user change the name of the group + */ + void changedText(); + +signals: + /** + * This signal is emitted when somebody selects an item + * @param text The text of the newly selected item. + */ + void activated( const QString& text ); + + /** + * This signal is emitted when defaults have to be set. + * @param name The name of the object: this is filled in the KEditListBox; + * @param config The configuration in which the config have to be parsed. + * @param index The number of the item. + * this config is already in the right group. + */ + void setDefaults( const QString& name, const int index, KConfig* config ); + + void elementsSwapped( int, int ); + void elementDeleted( int ); + +}; + +#endif //MK_KEDITLISTBOXMAN_H |