Exemple #1
0
QAction *KUndo2QStack::createRedoAction(QObject *parent) const
{
    KUndo2Action *result = new KUndo2Action(i18n("Redo %1"), i18nc("Default text for redo action", "Redo"), parent);
    result->setEnabled(canRedo());
    result->setPrefixedText(redoText());
    connect(this, SIGNAL(canRedoChanged(bool)),
            result, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(redoTextChanged(QString)),
            result, SLOT(setPrefixedText(QString)));
    connect(result, SIGNAL(triggered()), this, SLOT(redo()));
    return result;
}
Exemple #2
0
QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) const
{
    QString pref = prefix.isEmpty() ? tr("Redo") : prefix;
    QUndoAction *result = new QUndoAction(pref, parent);
    result->setEnabled(canRedo());
    result->setPrefixedText(redoText());
    connect(this, SIGNAL(canRedoChanged(bool)),
            result, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(redoTextChanged(QString)),
            result, SLOT(setPrefixedText(QString)));
    connect(result, SIGNAL(triggered()), this, SLOT(redo()));
    return result;
}
Exemple #3
0
QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) const
{
    QUndoAction *result = new QUndoAction(prefix, parent);
    if (prefix.isEmpty())
        result->setTextFormat(tr("Redo %1"), tr("Redo", "Default text for redo action"));

    result->setEnabled(canRedo());
    result->setPrefixedText(redoText());
    connect(this, SIGNAL(canRedoChanged(bool)),
            result, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(redoTextChanged(QString)),
            result, SLOT(setPrefixedText(QString)));
    connect(result, SIGNAL(triggered()), this, SLOT(redo()));
    return result;
}
Exemple #4
0
KAction* Editor::createUndoAction(KActionCollection *actionCollection)
{
	UndoAction *action = new UndoAction(i18n("Undo"), actionCollection);
	
	action->setEnabled(canUndo());
	action->setPrefixedText(undoText());
	
	connect(this, SIGNAL(canUndoChanged(bool)), action, SLOT(setEnabled(bool)));
	connect(this, SIGNAL(undoTextChanged(QString)), action, SLOT(setPrefixedText(QString)));
	connect(action, SIGNAL(triggered()), this, SLOT(undo()));

	action->setIcon(KIcon("edit-undo"));
	action->setIconText(i18n("Undo"));
	action->setShortcuts(KStandardShortcut::undo());

	actionCollection->addAction(KStandardAction::name(KStandardAction::Undo), action);

	return action;
}