kdeui: format and indent

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-29 18:20:49 +03:00
parent b600997970
commit 45658d0d7c
6 changed files with 250 additions and 281 deletions

View file

@ -29,29 +29,25 @@
#include "kglobalaccel_p.h"
#include "klocale.h"
#include "kmessagebox.h"
#include "kdebug.h"
#include "kicon.h"
#include <QtGui/QApplication>
#include <QtGui/QHBoxLayout>
#include <QtGui/qevent.h>
#include <QtGui/QToolBar>
#include <kdebug.h>
#include "kicon.h"
//---------------------------------------------------------------------
// KActionPrivate
//---------------------------------------------------------------------
void KActionPrivate::init(KAction *q_ptr)
{
q = q_ptr;
globalShortcutEnabled = false;
neverSetGlobalShortcut = true;
QObject::connect(q, SIGNAL(triggered(bool)), q, SLOT(slotTriggered()));
q->setProperty("isShortcutConfigurable", true);
q = q_ptr;
globalShortcutEnabled = false;
neverSetGlobalShortcut = true;
QObject::connect(q, SIGNAL(triggered(bool)), q, SLOT(slotTriggered()));
q->setProperty("isShortcutConfigurable", true);
}
void KActionPrivate::setActiveGlobalShortcutNoEnable(const KShortcut &cut)
@ -63,7 +59,7 @@ void KActionPrivate::setActiveGlobalShortcutNoEnable(const KShortcut &cut)
void KActionPrivate::slotTriggered()
{
emit q->triggered(QApplication::mouseButtons(), QApplication::keyboardModifiers());
emit q->triggered(QApplication::mouseButtons(), QApplication::keyboardModifiers());
}
bool KAction::event(QEvent *event)
@ -72,16 +68,17 @@ bool KAction::event(QEvent *event)
QShortcutEvent *se = static_cast<QShortcutEvent*>(event);
if(se->isAmbiguous()) {
KMessageBox::information(
NULL, // No widget to be seen around here
i18n( "The key sequence '%1' is ambiguous. Use 'Configure Shortcuts'\n"
"from the 'Settings' menu to solve the ambiguity.\n"
"No action will be triggered.",
se->key().toString(QKeySequence::NativeText)),
i18n("Ambiguous shortcut detected"));
NULL, // No widget to be seen around here
i18n(
"The key sequence '%1' is ambiguous. Use 'Configure Shortcuts'\n"
"from the 'Settings' menu to solve the ambiguity.\n"
"No action will be triggered.", se->key().toString(QKeySequence::NativeText)
),
i18n("Ambiguous shortcut detected")
);
return true;
}
}
return QAction::event(event);
}
@ -89,26 +86,28 @@ bool KAction::event(QEvent *event)
//---------------------------------------------------------------------
// KAction
//---------------------------------------------------------------------
KAction::KAction(QObject *parent)
: QWidgetAction(parent), d(new KActionPrivate)
: QWidgetAction(parent),
d(new KActionPrivate())
{
d->init(this);
d->init(this);
}
KAction::KAction(const QString &text, QObject *parent)
: QWidgetAction(parent), d(new KActionPrivate)
: QWidgetAction(parent),
d(new KActionPrivate())
{
d->init(this);
setText(text);
d->init(this);
setText(text);
}
KAction::KAction(const KIcon &icon, const QString &text, QObject *parent)
: QWidgetAction(parent), d(new KActionPrivate)
: QWidgetAction(parent),
d(new KActionPrivate)
{
d->init(this);
setIcon(icon);
setText(text);
d->init(this);
setIcon(icon);
setText(text);
}
KAction::~KAction()
@ -118,7 +117,6 @@ KAction::~KAction()
d->globalShortcutEnabled = false;
KGlobalAccel::self()->d->remove(this, KGlobalAccelPrivate::SetInactive);
}
delete d;
}
@ -127,121 +125,115 @@ bool KAction::isShortcutConfigurable() const
return property("isShortcutConfigurable").toBool();
}
void KAction::setShortcutConfigurable( bool b )
void KAction::setShortcutConfigurable(bool b)
{
setProperty("isShortcutConfigurable", b);
}
KShortcut KAction::shortcut(ShortcutTypes type) const
{
Q_ASSERT(type);
if (type == DefaultShortcut) {
QKeySequence primary = property("defaultPrimaryShortcut").value<QKeySequence>();
QKeySequence secondary = property("defaultAlternateShortcut").value<QKeySequence>();
return KShortcut(primary, secondary);
}
QKeySequence primary = shortcuts().value(0);
QKeySequence secondary = shortcuts().value(1);
return KShortcut(primary, secondary);
}
void KAction::setShortcut( const KShortcut & shortcut, ShortcutTypes type )
{
Q_ASSERT(type);
if (type & DefaultShortcut) {
setProperty("defaultPrimaryShortcut", shortcut.primary());
setProperty("defaultAlternateShortcut", shortcut.alternate());
}
if (type & ActiveShortcut) {
QAction::setShortcuts(shortcut);
}
}
void KAction::setShortcut( const QKeySequence & keySeq, ShortcutTypes type )
{
Q_ASSERT(type);
if (type & DefaultShortcut)
setProperty("defaultPrimaryShortcut", keySeq);
if (type & ActiveShortcut) {
QAction::setShortcut(keySeq);
}
}
void KAction::setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type)
{
setShortcut(KShortcut(shortcuts), type);
}
const KShortcut & KAction::globalShortcut(ShortcutTypes type) const
{
Q_ASSERT(type);
if (type == DefaultShortcut)
return d->defaultGlobalShortcut;
return d->globalShortcut;
}
void KAction::setGlobalShortcut( const KShortcut & shortcut, ShortcutTypes type,
GlobalShortcutLoading load )
{
Q_ASSERT(type);
bool changed = false;
// protect against garbage keycode -1 that Qt sometimes produces for exotic keys;
// at the moment (~mid 2008) Multimedia PlayPause is one of those keys.
int shortcutKeys[8];
for (int i = 0; i < 4; i++) {
shortcutKeys[i] = shortcut.primary()[i];
shortcutKeys[i + 4] = shortcut.alternate()[i];
}
for (int i = 0; i < 8; i++) {
if (shortcutKeys[i] == -1) {
kWarning(283) << "Encountered garbage keycode (keycode = -1) in input, not doing anything.";
return;
Q_ASSERT(type);
if (type == DefaultShortcut) {
QKeySequence primary = property("defaultPrimaryShortcut").value<QKeySequence>();
QKeySequence secondary = property("defaultAlternateShortcut").value<QKeySequence>();
return KShortcut(primary, secondary);
}
}
QKeySequence primary = shortcuts().value(0);
QKeySequence secondary = shortcuts().value(1);
return KShortcut(primary, secondary);
}
if (!d->globalShortcutEnabled) {
changed = true;
if (objectName().isEmpty() || objectName().startsWith(QLatin1String("unnamed-"))) {
kWarning(283) << "Attempt to set global shortcut for action without objectName()."
" Read the setGlobalShortcut() documentation.";
return;
void KAction::setShortcut(const KShortcut &shortcut, ShortcutTypes type)
{
Q_ASSERT(type);
if (type & KAction::DefaultShortcut) {
setProperty("defaultPrimaryShortcut", shortcut.primary());
setProperty("defaultAlternateShortcut", shortcut.alternate());
}
d->globalShortcutEnabled = true;
KGlobalAccel::self()->d->doRegister(this);
}
if (type & ActiveShortcut) {
QAction::setShortcuts(shortcut);
}
}
if ((type & DefaultShortcut) && d->defaultGlobalShortcut != shortcut) {
d->defaultGlobalShortcut = shortcut;
changed = true;
}
void KAction::setShortcut(const QKeySequence &keySeq, ShortcutTypes type)
{
Q_ASSERT(type);
if (type & KAction::DefaultShortcut) {
setProperty("defaultPrimaryShortcut", keySeq);
}
if (type & KAction::ActiveShortcut) {
QAction::setShortcut(keySeq);
}
}
if ((type & ActiveShortcut) && d->globalShortcut != shortcut) {
d->globalShortcut = shortcut;
changed = true;
}
void KAction::setShortcuts(const QList<QKeySequence> &shortcuts, ShortcutTypes type)
{
setShortcut(KShortcut(shortcuts), type);
}
//We want to have updateGlobalShortcuts called on a new action in any case so that
//it will be registered properly. In the case of the first setShortcut() call getting an
//empty shortcut parameter this would not happen...
if (changed || d->neverSetGlobalShortcut) {
KGlobalAccel::self()->d->updateGlobalShortcut(this, type | load);
d->neverSetGlobalShortcut = false;
}
const KShortcut& KAction::globalShortcut(ShortcutTypes type) const
{
Q_ASSERT(type);
if (type == KAction::DefaultShortcut) {
return d->defaultGlobalShortcut;
}
return d->globalShortcut;
}
void KAction::setGlobalShortcut(const KShortcut &shortcut, ShortcutTypes type,
GlobalShortcutLoading load)
{
Q_ASSERT(type);
bool changed = false;
// protect against garbage keycode -1 that Qt sometimes produces for exotic keys;
// at the moment (~mid 2008) Multimedia PlayPause is one of those keys.
int shortcutKeys[8];
for (int i = 0; i < 4; i++) {
shortcutKeys[i] = shortcut.primary()[i];
shortcutKeys[i + 4] = shortcut.alternate()[i];
}
for (int i = 0; i < 8; i++) {
if (shortcutKeys[i] == -1) {
kWarning(283) << "Encountered garbage keycode (keycode = -1) in input, not doing anything.";
return;
}
}
if (!d->globalShortcutEnabled) {
changed = true;
if (objectName().isEmpty() || objectName().startsWith(QLatin1String("unnamed-"))) {
kWarning(283) << "Attempt to set global shortcut for action without objectName()."
" Read the setGlobalShortcut() documentation.";
return;
}
d->globalShortcutEnabled = true;
KGlobalAccel::self()->d->doRegister(this);
}
if ((type & KAction::DefaultShortcut) && d->defaultGlobalShortcut != shortcut) {
d->defaultGlobalShortcut = shortcut;
changed = true;
}
if ((type & KAction::ActiveShortcut) && d->globalShortcut != shortcut) {
d->globalShortcut = shortcut;
changed = true;
}
//We want to have updateGlobalShortcuts called on a new action in any case so that
//it will be registered properly. In the case of the first setShortcut() call getting an
//empty shortcut parameter this would not happen...
if (changed || d->neverSetGlobalShortcut) {
KGlobalAccel::self()->d->updateGlobalShortcut(this, type | load);
d->neverSetGlobalShortcut = false;
}
}
bool KAction::isGlobalShortcutEnabled() const
{
return d->globalShortcutEnabled;
return d->globalShortcutEnabled;
}
@ -256,15 +248,13 @@ void KAction::forgetGlobalShortcut()
}
}
void KAction::setHelpText(const QString& text)
void KAction::setHelpText(const QString &text)
{
setStatusTip(text);
setToolTip(text);
if (whatsThis().isEmpty())
if (whatsThis().isEmpty()) {
setWhatsThis(text);
}
}
/* vim: et sw=2 ts=2
*/
#include "moc_kaction.cpp"

View file

@ -208,24 +208,24 @@ class KIcon;
*/
class KDEUI_EXPORT KAction : public QWidgetAction
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY( KShortcut shortcut READ shortcut WRITE setShortcut )
Q_PROPERTY( bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable )
Q_PROPERTY( KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut )
Q_PROPERTY( bool globalShortcutEnabled READ isGlobalShortcutEnabled )
Q_FLAGS( ShortcutType )
Q_PROPERTY(KShortcut shortcut READ shortcut WRITE setShortcut)
Q_PROPERTY(bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable)
Q_PROPERTY(KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut)
Q_PROPERTY(bool globalShortcutEnabled READ isGlobalShortcutEnabled)
Q_FLAGS(ShortcutType)
public:
/**
* An enumeration about the two types of shortcuts in a KAction
*/
enum ShortcutType {
/// The shortcut will immediately become active but may be reset to "default".
ActiveShortcut = 0x1,
/// The shortcut is a default shortcut - it becomes active when somebody decides to
/// reset shortcuts to default.
DefaultShortcut = 0x2
/// The shortcut will immediately become active but may be reset to "default".
ActiveShortcut = 0x1,
/// The shortcut is a default shortcut - it becomes active when somebody decides to
/// reset shortcuts to default.
DefaultShortcut = 0x2
};
Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
@ -235,12 +235,12 @@ public:
//This enum will be ORed with ShortcutType in calls to KGlobalAccel, so it must not contain
//any value equal to a value in ShortcutType.
enum GlobalShortcutLoading {
/// Look up the action in global settings (using its main component's name and text())
/// and set the shortcut as saved there.
/// @see setGlobalShortcut()
Autoloading = 0x0,
/// Prevent autoloading of saved global shortcut for action
NoAutoloading = 0x4
/// Look up the action in global settings (using its main component's name and text())
/// and set the shortcut as saved there.
/// @see setGlobalShortcut()
Autoloading = 0x0,
/// Prevent autoloading of saved global shortcut for action
NoAutoloading = 0x4
};
/**
* Constructs an action.
@ -266,7 +266,7 @@ public:
* @param text The text that will be displayed.
* @param parent The parent for this action.
*/
KAction(const KIcon& icon, const QString& text, QObject *parent);
KAction(const KIcon &icon, const QString& text, QObject *parent);
/**
* Standard destructor
@ -288,7 +288,7 @@ public:
*
* @since 4.3
*/
void setHelpText(const QString& text);
void setHelpText(const QString &text);
/**
* Get the shortcut for this action.
@ -313,7 +313,7 @@ public:
* \param type type of shortcut to be set: active shortcut,
* default shortcut, or both (the default).
*/
void setShortcut(const KShortcut& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
void setShortcut(const KShortcut &shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
/**
* \overload void setShortcut(const KShortcut& shortcut)
@ -327,7 +327,7 @@ public:
* \param type type of shortcut to be set: active shortcut,
* default shortcut, or both (default argument value).
*/
void setShortcut(const QKeySequence& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
void setShortcut(const QKeySequence &shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
/**
* \overload void setShortcuts(const QList\<QKeySequence\>& shortcuts).
@ -341,7 +341,7 @@ public:
* \param type type of shortcut to be set: active shortcut,
* default shortcut, or both (default argument value).
*/
void setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
void setShortcuts(const QList<QKeySequence> &shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
/**
* Returns true if this action's shortcut is configurable.
@ -406,7 +406,7 @@ public:
* \note the default shortcut will never be influenced by autoloading - it will be set as given.
* \sa globalShortcut()
*/
void setGlobalShortcut(const KShortcut& shortcut, ShortcutTypes type =
void setGlobalShortcut(const KShortcut &shortcut, ShortcutTypes type =
ShortcutTypes(ActiveShortcut | DefaultShortcut),
GlobalShortcutLoading loading = Autoloading);
@ -437,7 +437,7 @@ public:
/**
* @reimp
*/
bool event(QEvent*);
bool event(QEvent *event);
Q_SIGNALS:

View file

@ -27,30 +27,32 @@ class KAction;
class KActionPrivate
{
public:
KActionPrivate()
: componentData(KGlobal::mainComponent()), globalShortcutEnabled(false), q(0)
{
public:
KActionPrivate()
: componentData(KGlobal::mainComponent()),
globalShortcutEnabled(false),
q(nullptr)
{
}
void slotTriggered();
void init(KAction *q_ptr);
void setActiveGlobalShortcutNoEnable(const KShortcut &cut);
void maybeSetComponentData(const KComponentData &kcd)
{
if (neverSetGlobalShortcut) {
componentData = kcd;
}
}
void slotTriggered();
KComponentData componentData; //this is **way** more lightweight than it looks
KShortcut globalShortcut, defaultGlobalShortcut;
void init(KAction *q_ptr);
void setActiveGlobalShortcutNoEnable(const KShortcut &cut);
void maybeSetComponentData(const KComponentData &kcd)
{
if (neverSetGlobalShortcut) {
componentData = kcd;
}
}
KComponentData componentData; //this is **way** more lightweight than it looks
KShortcut globalShortcut, defaultGlobalShortcut;
bool globalShortcutEnabled : 1;
bool neverSetGlobalShortcut : 1;
KAction *q;
bool globalShortcutEnabled : 1;
bool neverSetGlobalShortcut : 1;
KAction *q;
};
#endif

View file

@ -22,11 +22,9 @@
#include "kaction.h"
struct KActionCategoryPrivate
{
KActionCategoryPrivate( KActionCategory *host );
{
KActionCategoryPrivate(KActionCategory *host);
//! Our host
KActionCategory *q;
@ -37,109 +35,95 @@ struct KActionCategoryPrivate
//! List of actions
QList<QAction*> actions;
}; // class KActionCategoryPrivate
}; // class KActionCategoryPrivate
KActionCategory::KActionCategory(const QString &text, KActionCollection *parent)
: QObject(parent)
,d( new KActionCategoryPrivate(this) )
{
: QObject(parent),
d(new KActionCategoryPrivate(this))
{
d->text = text;
}
}
KActionCategory::~KActionCategory()
{
{
delete d;
}
}
const QList<QAction*> KActionCategory::actions() const
{
{
return d->actions;
}
}
QAction * KActionCategory::addAction(const QString &name, QAction *action)
{
QAction* KActionCategory::addAction(const QString &name, QAction *action)
{
collection()->addAction(name, action);
addAction(action);
return action;
}
}
KAction * KActionCategory::addAction(const QString &name, KAction *action)
{
KAction* KActionCategory::addAction(const QString &name, KAction *action)
{
collection()->addAction(name, action);
addAction(action);
return action;
}
}
KAction * KActionCategory::addAction(
KStandardAction::StandardAction actionType,
const QObject *receiver,
const char *member)
{
KAction* KActionCategory::addAction(KStandardAction::StandardAction actionType,
const QObject *receiver,
const char *member)
{
KAction *action = collection()->addAction(actionType, receiver, member);
addAction(action);
return action;
}
}
KAction * KActionCategory::addAction(
KStandardAction::StandardAction actionType,
const QString &name,
const QObject *receiver,
const char *member)
{
KAction* KActionCategory::addAction(KStandardAction::StandardAction actionType,
const QString &name,
const QObject *receiver,
const char *member)
{
KAction *action = collection()->addAction(actionType, name, receiver, member);
addAction(action);
return action;
}
}
KAction *KActionCategory::addAction(
const QString &name,
const QObject *receiver,
const char *member)
{
KAction *KActionCategory::addAction(const QString &name,
const QObject *receiver,
const char *member)
{
KAction *action = collection()->addAction(name, receiver, member);
addAction(action);
return action;
}
}
void KActionCategory::addAction(QAction *action)
{
{
// Only add the action if wasn't added earlier.
if (!d->actions.contains(action))
{
if (!d->actions.contains(action)) {
d->actions.append(action);
}
}
}
KActionCollection * KActionCategory::collection() const
{
{
return qobject_cast<KActionCollection*>(parent());
}
}
QString KActionCategory::text() const
{
{
return d->text;
}
}
void KActionCategory::setText(const QString &text)
{
{
d->text = text;
}
}
void KActionCategory::unlistAction(QAction *action)
{
{
// ATTENTION:
// This method is called from KActionCollection with an QObject formerly
// known as a QAction during _k_actionDestroyed(). So don't do fancy stuff
@ -149,16 +133,18 @@ void KActionCategory::unlistAction(QAction *action)
int index = d->actions.indexOf(action);
// Action not found.
if (index==-1) return;
if (index==-1) {
return;
}
// Remove the action
d->actions.takeAt(index);
}
}
KActionCategoryPrivate::KActionCategoryPrivate( KActionCategory *host )
: q(host)
{}
{
}
#include "moc_kactioncategory.cpp"

View file

@ -21,9 +21,10 @@
#ifndef KACTIONCATEGORY_H
#define KACTIONCATEGORY_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QObject>
#include <QString>
#include <QList>
#include <QAction>
#include "kstandardaction.h"
#include "kactioncollection.h"
@ -32,10 +33,6 @@
class KAction;
struct KActionCategoryPrivate;
#include <QAction>
/**
* Categorize actions for KShortcutsEditor.
*
@ -93,17 +90,16 @@ struct KActionCategoryPrivate;
* \endcode
*/
class KDEUI_EXPORT KActionCategory : public QObject
{
{
Q_OBJECT
Q_PROPERTY( QString text READ text WRITE setText )
Q_PROPERTY(QString text READ text WRITE setText)
public:
/**
* Default constructor
*/
explicit KActionCategory(const QString &text, KActionCollection *parent=NULL);
explicit KActionCategory(const QString &text, KActionCollection *parent = nullptr);
/**
* Destructor
@ -119,36 +115,32 @@ public:
* corresponding method of KActionCollection.
*/
//@{
QAction * addAction(const QString &name, QAction *action);
QAction* addAction(const QString &name, QAction *action);
KAction * addAction(const QString &name, KAction *action);
KAction* addAction(const QString &name, KAction *action);
KAction * addAction(
KStandardAction::StandardAction actionType,
const QObject *receiver = NULL,
const char *member = NULL);
KAction* addAction(KStandardAction::StandardAction actionType,
const QObject *receiver = nullptr,
const char *member = nullptr);
KAction * addAction(
KStandardAction::StandardAction actionType,
const QString &name,
const QObject *receiver = NULL,
const char *member = NULL);
KAction* addAction(KStandardAction::StandardAction actionType,
const QString &name,
const QObject *receiver = nullptr,
const char *member = nullptr);
KAction *addAction(
const QString &name,
const QObject *receiver = NULL,
const char *member = NULL);
KAction* addAction(const QString &name,
const QObject *receiver = nullptr,
const char *member = nullptr);
template<class ActionType>
ActionType *add(
const QString &name,
const QObject *receiver = NULL,
const char *member = NULL)
{
ActionType* add(const QString &name,
const QObject *receiver = nullptr,
const char *member = nullptr)
{
ActionType *action = collection()->add<ActionType>(name, receiver, member);
addAction(action);
return action;
}
}
//@}
@ -160,7 +152,7 @@ public:
/**
* The action collection this category is associated with.
*/
KActionCollection * collection() const;
KActionCollection* collection() const;
/**
* The action categorys descriptive text
@ -170,10 +162,9 @@ public:
/**
* Set the action categorys descriptive text.
*/
void setText(const QString& text);
void setText(const QString &text);
private:
/**
* Remove \action from this category if found.
*/
@ -192,4 +183,4 @@ private:
};
#endif /* #ifndef KACTIONCATEGORY_H */
#endif // KACTIONCATEGORY_H

View file

@ -299,7 +299,7 @@ void KFindDialog::showEvent(QShowEvent *e)
{
if (!d->initialShowDone) {
d->initialShowDone = true; // only once
kDebug() << "showEvent\n";
kDebug() << "showEvent";
if (!d->findStrings.isEmpty()) {
setFindHistory(d->findStrings);
}
@ -497,7 +497,7 @@ void KFindDialog::KFindDialogPrivate::_k_showPatterns()
class RegExpAction : public QAction
{
public:
public:
RegExpAction(QObject *parent, const QString &text, const QString &regExp, int cursor)
: QAction(text, parent), mRegExp(regExp), mCursor(cursor)
{
@ -576,9 +576,9 @@ void KFindDialog::KFindDialogPrivate::_k_showPlaceholders()
void KFindDialog::KFindDialogPrivate::_k_slotPlaceholdersAboutToShow()
{
placeholders->clear();
placeholders->addAction( new PlaceHolderAction(placeholders, i18n("Complete Match"), 0));
placeholders->addAction(new PlaceHolderAction(placeholders, i18n("Complete Match"), 0));
QRegExp r( q->pattern() );
QRegExp r(q->pattern());
uint n = r.captureCount();
for (uint i = 0; i < n; i++) {
placeholders->addAction(