[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kword/part
From: Thomas Zander <zander () kde ! org>
Date: 2010-08-29 21:02:32
Message-ID: 20100829210233.0C533AC883 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1169679 by zander:
Add new command to add a new page style
M +1 -0 CMakeLists.txt
M +7 -0 KWPageManager.cpp
M +2 -0 KWPageManager.h
A commands/KWNewPageStyleCommand.cpp tests/TestPageCommands.h#1169678 \
[License: LGPL (v2+)] A commands/KWNewPageStyleCommand.h [License: \
LGPL (v2+)] M +17 -0 tests/TestPageCommands.cpp
M +1 -0 tests/TestPageCommands.h
--- trunk/koffice/kword/part/CMakeLists.txt #1169678:1169679
@@ -61,6 +61,7 @@
commands/KWPagePropertiesCommand.cpp
commands/KWPageInsertCommand.cpp
commands/KWPageRemoveCommand.cpp
+ commands/KWNewPageStyleCommand.cpp
commands/KWFrameDeleteCommand.cpp
commands/KWFrameCreateCommand.cpp
commands/KWCreateOutlineCommand.cpp
--- trunk/koffice/kword/part/KWPageManager.cpp #1169678:1169679
@@ -431,6 +431,13 @@
return pagestyle;
}
+void KWPageManager::removePageStyle(const KWPageStyle &pageStyle)
+{
+ KWPageStyle style = d->pageStyles.value(pageStyle.name());
+ if (style == pageStyle)
+ d->pageStyles.remove(pageStyle.name());
+}
+
KWPageStyle KWPageManager::defaultPageStyle() const
{
return d->defaultPageStyle;
--- trunk/koffice/kword/part/KWPageManager.h #1169678:1169679
@@ -188,6 +188,8 @@
*/
KWPageStyle addPageStyle(const QString &name);
+ void removePageStyle(const KWPageStyle &pageStyle);
+
/**
* Returns all pagestyles.
* // TODO only return a qlist of styles, they have a their name in them alraedy
--- trunk/koffice/kword/part/tests/TestPageCommands.cpp #1169678:1169679
@@ -23,6 +23,7 @@
#include <commands/KWPageInsertCommand.h>
#include <commands/KWPageRemoveCommand.h>
#include <commands/KWPagePropertiesCommand.h>
+#include <commands/KWNewPageStyleCommand.h>
#include <frames/KWTextFrame.h>
#include <frames/KWTextFrameSet.h>
#include <KoTextShapeData.h>
@@ -572,5 +573,21 @@
// test for page side etc.
}
+void TestPageCommands::testNewPageStyleCommand()
+{
+ KWDocument document;
+ KWPageManager *manager = document.pageManager();
+
+ KWPageStyle style("pagestyle1");
+ KWNewPageStyleCommand cmd(&document, style);
+
+ QCOMPARE(manager->pageStyle("pagestyle1").isValid(), false);
+ cmd.redo();
+ QVERIFY(manager->pageStyle("pagestyle1").isValid());
+ QCOMPARE(manager->pageStyle("pagestyle1"), style);
+ cmd.undo();
+ QCOMPARE(manager->pageStyle("pagestyle1").isValid(), false);
+}
+
QTEST_KDEMAIN(TestPageCommands, GUI)
#include <TestPageCommands.moc>
--- trunk/koffice/kword/part/tests/TestPageCommands.h #1169678:1169679
@@ -38,6 +38,7 @@
void testRemovePageCommand4();
void testPagePropertiesCommand();
void testMakePageSpread();
+ void testNewPageStyleCommand();
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic