KEditToolbar Class Reference

`#include <kedittoolbar.h>`

Inheritance diagram for KEditToolbar:

## Signals

void | newToolbarConfig ()
Signals inherited from KDialogBase
void | helpClicked ()
void | defaultClicked ()
void | user3Clicked ()
void | user2Clicked ()
void | user1Clicked ()
void | applyClicked ()
void | tryClicked ()
void | okClicked ()
void | yesClicked ()
void | noClicked ()
void | cancelClicked ()
void | closeClicked ()
void | apply ()
void | backgroundChanged ()
void | hidden ()
void | finished ()
void | aboutToShowDetails ()
void | aboutToShowPage (QWidget *page)
Signals inherited from KDialog
void | layoutHintChanged ()

## Public Member Functions

| KEditToolbar (KActionCollection *collection, const QString &xmlfile=QString::null, bool global=true, QWidget *parent=0, const char *name=0)
| KEditToolbar (const QString &defaultToolbar, KActionCollection *collection, const QString &xmlfile=QString::null, bool global=true, QWidget *parent=0, const char *name=0)
| KEditToolbar (KXMLGUIFactory *factory, QWidget *parent=0, const char *name=0)
| KEditToolbar (const QString &defaultToolbar, KXMLGUIFactory *factory, QWidget *parent=0, const char *name=0)
| ~KEditToolbar ()
Public Member Functions inherited from KDialogBase
| KDialogBase (QWidget *parent=0, const char *name=0, bool modal=true, const QString &caption=QString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (int dialogFace, const QString &caption, int buttonMask, ButtonCode defaultButton, QWidget *parent=0, const char *name=0, bool modal=true, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (KDialogBase::DialogType dialogFace, WFlags f, QWidget *parent=0, const char *name=0, bool modal=true, const QString &caption=QString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (const QString &caption, int buttonMask=Yes|No|Cancel, ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel, QWidget *parent=0, const char *name=0, bool modal=true, bool separator=false, const KGuiItem &yes=KStdGuiItem::yes(), const KGuiItem &no=KStdGuiItem::no(), const KGuiItem &cancel=KStdGuiItem::cancel())
| ~KDialogBase ()
void | setButtonBoxOrientation (int orientation)
void | setEscapeButton (ButtonCode id)
virtual void | adjustSize ()
virtual QSize | sizeHint () const
virtual QSize | minimumSizeHint () const
QFrame * | plainPage ()
QFrame * | addPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QFrame * | addPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QVBox * | addVBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QVBox * | addVBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QHBox * | addHBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QHBox * | addHBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QGrid * | addGridPage (int n, Orientation dir, const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QGrid * | addGridPage (int n, Orientation dir, const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
void | setFolderIcon (const QStringList &path, const QPixmap &pixmap)
QFrame * | makeMainWidget ()
QVBox * | makeVBoxMainWidget ()
QHBox * | makeHBoxMainWidget ()
QGrid * | makeGridMainWidget (int n, Orientation dir)
void | enableButtonSeparator (bool state)
void | showButton (ButtonCode id, bool state)
void | showButtonOK (bool state)
void | showButtonApply (bool state)
void | showButtonCancel (bool state)
bool | showPage (int index)
int | activePageIndex () const
int | pageIndex (QWidget *widget) const
void | setMainWidget (QWidget *widget)
QWidget * | mainWidget ()
void | disableResize ()
void | setInitialSize (const QSize &s, bool noResize=false)
void | incInitialSize (const QSize &s, bool noResize=false)
QSize | configDialogSize (const QString &groupName) const
QSize | configDialogSize (KConfig &config, const QString &groupName) const
void | saveDialogSize (const QString &groupName, bool global=false)
void | saveDialogSize (KConfig &config, const QString &groupName, bool global=false) const
void | setButtonOK (const KGuiItem &item=KStdGuiItem::ok())
void | setButtonOKText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonApply (const KGuiItem &item=KStdGuiItem::apply())
void | setButtonApplyText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonCancel (const KGuiItem &item=KStdGuiItem::cancel())
void | setButtonCancelText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonText (ButtonCode id, const QString &text)
void | setButtonTip (ButtonCode id, const QString &text)
void | setButtonWhatsThis (ButtonCode id, const QString &text)
void | setButtonGuiItem (ButtonCode id, const KGuiItem &item)
void | setTreeListAutoResize (bool state)
void | setShowIconsInTreeList (bool state)
void | setRootIsDecorated (bool state)
void | unfoldTreeList (bool persist=false)
void | addWidgetBelowList (QWidget *widget)
void | addButtonBelowList (const QString &text, QObject *recv, const char *slot)
void | addButtonBelowList (const KGuiItem &guiitem, QObject *recv, const char *slot)
void | setIconListAllVisible (bool state)
void | showTile (bool state)
void | getBorderWidths (int &ulx, int &uly, int &lrx, int &lry) const KDE_DEPRECATED
QRect | getContentsRect () const KDE_DEPRECATED
QSize | calculateSize (int w, int h) const
QString | helpLinkText () const
QPushButton * | actionButton (ButtonCode id)
Public Member Functions inherited from KDialog
| KDialog (QWidget *parent=0, const char *name=0, bool modal=false, WFlags f=0)

## Static Public Member Functions

static void | setDefaultToolbar (const char *toolbarName)
Static Public Member Functions inherited from KDialogBase
static bool | haveBackgroundTile ()
static const QPixmap * | backgroundTile ()
static const QPixmap * | getBackgroundTile () KDE_DEPRECATED
static void | setBackgroundTile (const QPixmap *pix)
Static Public Member Functions inherited from KDialog
static int | marginHint ()
static int | spacingHint ()
static void | resizeLayout (QWidget *widget, int margin, int spacing)
static void | resizeLayout (QLayoutItem *lay, int margin, int spacing)
static void | centerOnScreen (QWidget *widget, int screen=-1)
static bool | avoidArea (QWidget *widget, const QRect &area, int screen=-1)

## Protected Slots

virtual void | slotOk ()
virtual void | slotApply ()
void | acceptOK (bool b)
void | slotDefault ()
Protected Slots inherited from KDialogBase
virtual void | slotHelp ()
virtual void | slotDefault ()
virtual void | slotDetails ()
virtual void | slotUser3 ()
virtual void | slotUser2 ()
virtual void | slotUser1 ()
virtual void | slotOk ()
virtual void | slotApply ()
virtual void | slotTry ()
virtual void | slotYes ()
virtual void | slotNo ()
virtual void | slotCancel ()
virtual void | slotClose ()
virtual void | applyPressed ()
void | updateGeometry ()
void | slotDelayedDestruct ()

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)
Protected Member Functions inherited from KDialogBase
virtual void | keyPressEvent (QKeyEvent *e)
virtual void | hideEvent (QHideEvent *)
virtual void | closeEvent (QCloseEvent *e)

## Additional Inherited Members

Public Types inherited from KDialogBase
enum | ButtonCode { Help = 0x00000001, Default = 0x00000002, Ok = 0x00000004, Apply = 0x00000008, Try = 0x00000010, Cancel = 0x00000020, Close = 0x00000040, User1 = 0x00000080, User2 = 0x00000100, User3 = 0x00000200, No = 0x00000080, Yes = 0x00000100, Details = 0x00000400, Filler = 0x40000000, Stretch = 0x80000000, NoDefault }
enum | ActionButtonStyle { ActionStyle0 =0, ActionStyle1, ActionStyle2, ActionStyle3, ActionStyle4, ActionStyleMAX }
enum | DialogType { TreeList = KJanusWidget::TreeList, Tabbed = KJanusWidget::Tabbed, Plain = KJanusWidget::Plain, Swallow = KJanusWidget::Swallow, IconList = KJanusWidget::IconList }
Public Slots inherited from KDialogBase
void | enableButton (ButtonCode id, bool state)
void | enableButtonOK (bool state)
void | enableButtonApply (bool state)
void | enableButtonCancel (bool state)
void | enableLinkedHelp (bool state)
void | delayedDestruct ()
void | setHelpLinkText (const QString &text)
void | setHelp (const QString &anchor, const QString &appname=QString::null)
void | helpClickedSlot (const QString &)
void | setDetails (bool showDetails)
void | setDetailsWidget (QWidget *detailsWidget)
void | updateBackground ()
void | cancel ()
Public Slots inherited from KDialog
virtual void | polish ()
virtual void | setCaption (const QString &caption)
virtual void | setPlainCaption (const QString &caption)

## Detailed Description

A dialog used to customize or configure toolbars.

This dialog only works if your application uses the XML UI framework for creating menus and toolbars. It depends on the XML files to describe the toolbar layouts and it requires the actions to determine which buttons are active.

Typically, you would include the KStdAction::configureToolbars() standard action in your application. In your slot to this action, you would have something like so:

KEditToolbar dlg(actionCollection());
if (dlg.exec())
{
createGUI();
}

That code snippet also takes care of redrawing the menu and toolbars if you have made any changes.

If you are using KMainWindow's settings methods (either save/apply manually or autoSaveSettings), you should write something like:

void MyClass::slotConfigureToolbars()
{
saveMainWindowSettings( KGlobal::config(), "MainWindow" );
KEditToolbar dlg(actionCollection());
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig()));
dlg.exec();
}
void MyClass::slotNewToolbarConfig() // This is called when OK, Apply or Defaults is clicked
{
...if you use any action list, use plugActionList on each here...
createGUI();
applyMainWindowSettings( KGlobal::config(), "MainWindow" );
}

Note that the procedure is a bit different for KParts applications. In this case, you need only pass along a pointer to your application's KXMLGUIFactory object. The editor will take care of finding all of the action collections and XML files. The editor aims to be semi-intelligent about where it assigns any modifications. In other words, it will not write out part specific changes to your shell's XML file.

An example would be:

saveMainWindowSettings( KGlobal::config(), "MainWindow" );
KEditToolbar dlg(factory());
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig()));
dlg.exec();
void MyClass::slotNewToolbarConfig() // This is called when OK, Apply or Defaults is clicked
{
...if you use any action list, use plugActionList on each here...
// Do NOT call createGUI()!
applyMainWindowSettings( KGlobal::config(), "MainWindow" );
}

Author
  Kurt Granroth granr.nosp@m.oth@.nosp@m.kde.o.nosp@m.rg

Version

Id
  kedittoolbar.h 465272 2005-09-29 09:47:40Z mueller

Definition at line 110 of file kedittoolbar.h.

## Constructor & Destructor Documentation

KEditToolbar::KEditToolbar | ( | KActionCollection * | collection,
|  | const QString & | xmlfile = `QString::null`,
|  | bool | global = `true`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) |  |

Constructor for apps that do not use components.

This is the only entry point to this class. You must pass along your collection of actions (some of which appear in your toolbars). The other two parameters are optional.

The second parameter, xmlfile(), is the name (absolute or relative) of your application's UI resource file. If it is left blank, then the resource file: share/apps/appname/appnameui.rc is used. This is the same resource file that is used by the default createGUI() function in KMainWindow so you're usually pretty safe in leaving it blank.

The third parameter, global(), controls whether or not the global resource file is used. If this is `true`, then you may edit all of the actions in your toolbars – global ones and local one. If it is `false`, then you may edit only your application's entries. The only time you should set this to false is if your application does not use the global resource file at all (very rare).

Parameters

  collection | The collection of actions to work on.
  xmlfile | The application's local resource file.
  global | If `true`, then the global resource file will also be parsed.
  parent | The parent of the dialog.
  name | An internal name.

Definition at line 378 of file kedittoolbar.cpp.

KEditToolbar::KEditToolbar | ( | KXMLGUIFactory * | factory,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) |  |

Constructor for KParts based apps.

The main parameter, factory(), is a pointer to the XML GUI factory object for your application. It contains a list of all of the GUI clients (along with the action collections and xml files) and the toolbar editor uses that.

Use this like so:

KEditToolbar edit(factory());
if ( edit.exec() )
...

Parameters

  factory | Your application's factory object
  parent | The usual parent for the dialog.
  name | An internal name.

Some people seem tempted to use this also in non-KParts apps, using KMainWindow::guiFactory(). This works, but only if setting conserveMemory to false when calling KMainWindow::createGUI()! If not, use the other KEditToolbar constructor.

Definition at line 401 of file kedittoolbar.cpp.

KEditToolbar::KEditToolbar | ( | const QString & | defaultToolbar,
|  | KXMLGUIFactory * | factory,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) |  |

Constructor for KParts based apps, which has an extra argument specifying the toolbar to be shown.

Parameters

  defaultToolbar | The toolbar with this name will appear for editing.
  factory | Your application's factory object
  parent | The usual parent for the dialog.
  name | An internal name.

Since
  3.2

Definition at line 409 of file kedittoolbar.cpp.

KEditToolbar::~KEditToolbar | ( |  | ) |

destructor

Definition at line 434 of file kedittoolbar.cpp.

## Member Function Documentation

void KEditToolbar::acceptOK | ( | bool | b | ) |

protected slot

should OK really save?

Definition at line 439 of file kedittoolbar.cpp.

void KEditToolbar::newToolbarConfig | ( |  | ) |

signal

Signal emitted when 'apply' or 'ok' is clicked or toolbars were resetted.

Connect to it, to plug action lists and to call applyMainWindowSettings (see sample code in this class's documentation)

void KEditToolbar::setDefaultToolbar | ( | const char * | toolbarName | ) |

static

Sets the default toolbar, which will be auto-selected when the constructor without the defaultToolbar argument is used.

Parameters

  toolbarName | the name of the toolbar

Since
  3.3

Definition at line 535 of file kedittoolbar.cpp.

void KEditToolbar::slotApply | ( |  | ) |

protected virtual slot

idem

Definition at line 528 of file kedittoolbar.cpp.

void KEditToolbar::slotDefault | ( |  | ) |

protected slot

Set toolbars to default value.

Definition at line 445 of file kedittoolbar.cpp.

void KEditToolbar::slotOk | ( | void |  | ) |

protected virtual slot

Overridden in order to save any changes made to the toolbars.

Definition at line 510 of file kedittoolbar.cpp.

The documentation for this class was generated from the following files:

- kedittoolbar.h
- kedittoolbar.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys