[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] /: Replaced KUndoStack with KUndoActions namespace
From: Tobias Koenig <tokoe () kde ! org>
Date: 2013-03-02 22:19:02
Message-ID: 20130302221902.29FA0A604F () git ! kde ! org
[Download RAW message or body]
Git commit 25bed4eaec5370ea7878482b35358842e1e4c0ec by Tobias Koenig.
Committed on 02/03/2013 at 23:11.
Pushed by tokoe into branch 'frameworks'.
Replaced KUndoStack with KUndoActions namespace
Moved original KUndoStack to kde4support
M +1 -0 KDE5PORTING.html
M +1 -1 includes/CMakeLists.txt
A +1 -0 includes/KUndoActions
D +0 -1 includes/KUndoStack
M +2 -2 kdeui/CMakeLists.txt
C +10 -15 kdeui/util/kundoactions.cpp [from: kdeui/util/kundostack.cpp - 078% \
similarity] A +58 -0 kdeui/util/kundoactions.h [License: LGPL (v2+)]
M +2 -0 staging/kde4support/src/CMakeLists.txt
R +0 -0 staging/kde4support/src/kdeui/kundostack.cpp [from: \
kdeui/util/kundostack.cpp - 100% similarity] R +0 -0 \
staging/kde4support/src/kdeui/kundostack.h [from: kdeui/util/kundostack.h - 100% \
similarity]
http://commits.kde.org/kdelibs/25bed4eaec5370ea7878482b35358842e1e4c0ec
diff --git a/KDE5PORTING.html b/KDE5PORTING.html
index f86a80d..e8f54608 100644
--- a/KDE5PORTING.html
+++ b/KDE5PORTING.html
@@ -308,6 +308,7 @@ A script is available in \
kdesdk/scripts/kf5/convert-kstandarddirs.pl to port som </li>
<li>KAction global shortcut handling logic moved to KGlobalAccel. So the \
KAction::globalShortcutChanged signal was removed and a new corresponding \
KGlobalAccel::globalShortcutChanged has been added. The signal semantics have not \
changed. </li>
+<li>KUndoStack: Use QUndoStack with KUndoActions::createUndoAction() and \
KUndoActions::createRedoAction() instead</li> </ul>
<h4 align="right"><a href="#TOC">Return to the Table of Contents</a></h4>
diff --git a/includes/CMakeLists.txt b/includes/CMakeLists.txt
index f48de3e..bab99c9 100644
--- a/includes/CMakeLists.txt
+++ b/includes/CMakeLists.txt
@@ -437,7 +437,7 @@ install( FILES
KTypeListLength
KTzfileTimeZone
KTzfileTimeZoneSource
- KUndoStack
+ KUndoActions
KUniqueApplication
KUriFilter
KUriFilterData
diff --git a/includes/KUndoActions b/includes/KUndoActions
new file mode 100644
index 0000000..35d267a
--- /dev/null
+++ b/includes/KUndoActions
@@ -0,0 +1 @@
+#include "../kundoactions.h"
diff --git a/includes/KUndoStack b/includes/KUndoStack
deleted file mode 100644
index 18c4a5e..0000000
--- a/includes/KUndoStack
+++ /dev/null
@@ -1 +0,0 @@
-#include "../kundostack.h"
diff --git a/kdeui/CMakeLists.txt b/kdeui/CMakeLists.txt
index d84fb1e..5ec9461 100644
--- a/kdeui/CMakeLists.txt
+++ b/kdeui/CMakeLists.txt
@@ -225,7 +225,7 @@ set(kdeui_LIB_SRCS
util/kpassivepopupmessagehandler.cpp
util/kpixmapcache.cpp
util/kpixmapprovider.cpp
- util/kundostack.cpp
+ util/kundoactions.cpp
util/kpixmapsequence.cpp
util/kpixmapsequenceoverlaypainter.cpp
util/kpixmapsequencewidget.cpp
@@ -567,7 +567,7 @@ install( FILES
util/kimagecache.h
util/kwallet.h
util/kxerrorhandler.h
- util/kundostack.h
+ util/kundoactions.h
util/kpixmapsequence.h
util/kpixmapsequenceoverlaypainter.h
util/kpixmapsequencewidget.h
diff --git a/kdeui/util/kundostack.cpp b/kdeui/util/kundoactions.cpp
similarity index 78%
copy from kdeui/util/kundostack.cpp
copy to kdeui/util/kundoactions.cpp
index 8610896..2f34a20 100644
--- a/kdeui/util/kundostack.cpp
+++ b/kdeui/util/kundoactions.cpp
@@ -17,27 +17,23 @@
Boston, MA 02110-1301, USA.
*/
-#include "kundostack.h"
+#include "kundoactions.h"
#include <QAction>
#include <QKeySequence>
#include <QList>
+#include <QUndoStack>
-#include <kstandardaction.h>
-#include <kstandardshortcut.h>
#include <kactioncollection.h>
#include <klocalizedstring.h>
+#include <kstandardaction.h>
+#include <kstandardshortcut.h>
-KUndoStack::KUndoStack(QObject* parent)
-: QUndoStack(parent)
-{
-}
-
-QAction* KUndoStack::createRedoAction(KActionCollection* actionCollection, const \
QString& actionName) +QAction *KUndoActions::createRedoAction(QUndoStack *undoStack, \
KActionCollection *actionCollection, const QString &actionName) {
- QAction* action = QUndoStack::createRedoAction(actionCollection);
+ QAction *action = undoStack->createRedoAction(actionCollection);
- if(actionName.isEmpty()) {
+ if (actionName.isEmpty()) {
action->setObjectName(KStandardAction::name(KStandardAction::Redo));
} else {
action->setObjectName(actionName);
@@ -52,11 +48,11 @@ QAction* KUndoStack::createRedoAction(KActionCollection* \
actionCollection, const return action;
}
-QAction* KUndoStack::createUndoAction(KActionCollection* actionCollection, const \
QString& actionName) +QAction *KUndoActions::createUndoAction(QUndoStack* undoStack, \
KActionCollection* actionCollection, const QString& actionName) {
- QAction* action = QUndoStack::createUndoAction(actionCollection);
+ QAction *action = undoStack->createUndoAction(actionCollection);
- if(actionName.isEmpty()) {
+ if (actionName.isEmpty()) {
action->setObjectName(KStandardAction::name(KStandardAction::Undo));
} else {
action->setObjectName(actionName);
@@ -70,4 +66,3 @@ QAction* KUndoStack::createUndoAction(KActionCollection* \
actionCollection, const
return action;
}
-
diff --git a/kdeui/util/kundoactions.h b/kdeui/util/kundoactions.h
new file mode 100644
index 0000000..274915a
--- /dev/null
+++ b/kdeui/util/kundoactions.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project
+ Copyright (C) 2006 Peter Simonsson <peter.simonsson@gmail.com>
+
+ 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 KUNDOACTIONS_H
+#define KUNDOACTIONS_H
+
+#include <kdeui_export.h>
+
+#include <QString>
+
+class KActionCollection;
+class QAction;
+class QUndoStack;
+
+/**
+ * Provides functions that creates undo/redo actions for a QUndoStack with KDE's \
default icons and shortcuts. + * See QUndoStack for more information.
+ *
+ * @since 5.0
+ */
+namespace KUndoActions
+{
+ /**
+ * Creates an redo action with the default shortcut and icon and adds it to @p \
actionCollection + * @param undoStack the QUndoStack the action triggers the redo \
on + * @param actionCollection the KActionCollection that should be the parent of \
the action + * @param actionName the created action's object name, empty string \
will set it to the KDE default + * @return the created action.
+ */
+ KDEUI_EXPORT QAction *createRedoAction(QUndoStack *undoStack, KActionCollection \
*actionCollection, const QString &actionName = QString()); +
+ /**
+ * Creates an undo action with the default KDE shortcut and icon and adds it to \
@p actionCollection + * @param undoStack the QUndoStack the action triggers the \
undo on + * @param actionCollection the KActionCollection that should be the \
parent of the action + * @param actionName the created action's object name, \
empty string will set it to the KDE default + * @return the created action.
+ */
+ KDEUI_EXPORT QAction *createUndoAction(QUndoStack *undoStack, KActionCollection \
*actionCollection, const QString &actionName = QString()); +}
+
+#endif
diff --git a/staging/kde4support/src/CMakeLists.txt \
b/staging/kde4support/src/CMakeLists.txt index 9664b8c..746674c 100644
--- a/staging/kde4support/src/CMakeLists.txt
+++ b/staging/kde4support/src/CMakeLists.txt
@@ -52,6 +52,7 @@ set(libkde4support_SRCS
kdeui/kmessagebox_queued.cpp
kdeui/kmessageboxmessagehandler.cpp
kdeui/kpushbutton.cpp
+ kdeui/kundostack.cpp
)
if (Q_OS_WIN)
@@ -146,6 +147,7 @@ install(FILES
kdeui/kmessagebox_queued.h
kdeui/kmessageboxmessagehandler.h
kdeui/kpushbutton.h
+ kdeui/kundostack.h
${CMAKE_CURRENT_BINARY_DIR}/kde4support_export.h
${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
diff --git a/kdeui/util/kundostack.cpp b/staging/kde4support/src/kdeui/kundostack.cpp
similarity index 100%
rename from kdeui/util/kundostack.cpp
rename to staging/kde4support/src/kdeui/kundostack.cpp
diff --git a/kdeui/util/kundostack.h b/staging/kde4support/src/kdeui/kundostack.h
similarity index 100%
rename from kdeui/util/kundostack.h
rename to staging/kde4support/src/kdeui/kundostack.h
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic