aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-19 10:40:19 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-19 10:40:19 (GMT)
commit6ad6841e9844ef59772b8a417fb2bb5f390cb5d2 (patch)
tree498d0cfca0ccfa3342ff0e958323aea31604ff3c
parent5bf99370ec0ee3dbe2b3e33351d8216029efc6da (diff)
more cleanup of API, less hacks to get a view if we only have a document
-rw-r--r--autotests/src/bug286887.cpp2
-rw-r--r--autotests/src/bug313759.cpp2
-rw-r--r--autotests/src/bug313769.cpp2
-rw-r--r--autotests/src/bug317111.cpp2
-rw-r--r--autotests/src/katedocument_test.cpp18
-rw-r--r--autotests/src/katefoldingtest.cpp4
-rw-r--r--autotests/src/kateview_test.cpp12
-rw-r--r--autotests/src/kte_documentcursor.cpp4
-rw-r--r--autotests/src/messagetest.cpp16
-rw-r--r--autotests/src/movingcursor_test.cpp8
-rw-r--r--autotests/src/movingrange_test.cpp8
-rw-r--r--autotests/src/plaintextsearch_test.cpp2
-rw-r--r--autotests/src/range_test.cpp6
-rw-r--r--autotests/src/regexpsearch_test.cpp8
-rw-r--r--autotests/src/revision_test.cpp4
-rw-r--r--autotests/src/script_test_base.cpp2
-rw-r--r--autotests/src/scriptdocument_test.cpp2
-rw-r--r--autotests/src/scripting_test.cpp1
-rw-r--r--autotests/src/searchbar_test.cpp36
-rw-r--r--autotests/src/templatehandler_test.cpp2
-rw-r--r--autotests/src/undomanager_test.cpp2
-rw-r--r--autotests/src/vimode_test.cpp2
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/data/katepart.desktop2
-rw-r--r--src/document/katedocument.cpp20
-rw-r--r--src/document/katedocument.h14
-rw-r--r--src/document/katedocumenthelpers.cpp45
-rw-r--r--src/document/katedocumenthelpers.h61
-rw-r--r--src/include/ktexteditor/document.h16
-rw-r--r--src/include/ktexteditor/editor.h1
-rw-r--r--src/include/ktexteditor/view.h16
-rw-r--r--src/printing/kateprinter.cpp19
-rw-r--r--src/printing/kateprinter.h6
-rw-r--r--src/printing/printpainter.cpp8
-rw-r--r--src/printing/printpainter.h4
-rw-r--r--src/utils/katecmds.cpp2
-rw-r--r--src/utils/katefactory.cpp20
-rw-r--r--src/utils/kateglobal.cpp2
-rw-r--r--src/view/kateview.cpp45
-rw-r--r--src/view/kateview.h11
-rw-r--r--src/view/kateviewinternal.cpp5
41 files changed, 141 insertions, 302 deletions
diff --git a/autotests/src/bug286887.cpp b/autotests/src/bug286887.cpp
index 7ff7631..c8928c9 100644
--- a/autotests/src/bug286887.cpp
+++ b/autotests/src/bug286887.cpp
@@ -49,7 +49,7 @@ void BugTest::cleanupTestCase()
void BugTest::ctrlShiftLeft()
{
- KateDocument doc(false, false, false);
+ KateDocument doc(false, false);
// view must be visible...
KateView *view = static_cast<KateView *>(doc.createView(0));
diff --git a/autotests/src/bug313759.cpp b/autotests/src/bug313759.cpp
index e45d5f2..669f73b 100644
--- a/autotests/src/bug313759.cpp
+++ b/autotests/src/bug313759.cpp
@@ -54,7 +54,7 @@ void BugTest::tryCrash()
{
// set up document and view
KMainWindow *toplevel = new KMainWindow();
- KateDocument *doc = new KateDocument(true, false, false, toplevel);
+ KateDocument *doc = new KateDocument(true, false, toplevel);
KateView *view = static_cast<KateView *>(doc->createView(0));
bool outputWasCustomised = false;
TestScriptEnv *env = new TestScriptEnv(doc, outputWasCustomised);
diff --git a/autotests/src/bug313769.cpp b/autotests/src/bug313769.cpp
index 84e7aa4..ead5c0c 100644
--- a/autotests/src/bug313769.cpp
+++ b/autotests/src/bug313769.cpp
@@ -52,7 +52,7 @@ void BugTest::cleanupTestCase()
void BugTest::tryCrash()
{
- KateDocument doc(false, false, false);
+ KateDocument doc(false, false);
const QUrl url = QUrl::fromLocalFile(QLatin1String(TEST_DATA_DIR"bug313769.cpp"));
doc.openUrl(url);
doc.discardDataRecovery();
diff --git a/autotests/src/bug317111.cpp b/autotests/src/bug317111.cpp
index 950d7eb..87a7d90 100644
--- a/autotests/src/bug317111.cpp
+++ b/autotests/src/bug317111.cpp
@@ -54,7 +54,7 @@ void BugTest::tryCrash()
{
// set up document and view
KMainWindow *toplevel = new KMainWindow();
- KateDocument *doc = new KateDocument(true, false, false, toplevel);
+ KateDocument *doc = new KateDocument(true, false, toplevel);
KateView *view = static_cast<KateView *>(doc->createView(0));
bool outputWasCustomised = false;
TestScriptEnv *env = new TestScriptEnv(doc, outputWasCustomised);
diff --git a/autotests/src/katedocument_test.cpp b/autotests/src/katedocument_test.cpp
index 3160103..1b7232f 100644
--- a/autotests/src/katedocument_test.cpp
+++ b/autotests/src/katedocument_test.cpp
@@ -100,7 +100,7 @@ KateDocumentTest::~KateDocumentTest()
// see also: http://bugs.kde.org/show_bug.cgi?id=168534
void KateDocumentTest::testWordWrap()
{
- KateDocument doc(false, false, false);
+ KateDocument doc(false, false);
doc.setWordWrap(true);
doc.setWordWrapAt(80);
@@ -134,7 +134,7 @@ void KateDocumentTest::testWordWrap()
void KateDocumentTest::testReplaceQStringList()
{
- KateDocument doc(false, false, false);
+ KateDocument doc(false, false);
doc.setWordWrap(false);
doc.setText(QLatin1String("asdf\n"
"foo\n"
@@ -149,7 +149,7 @@ void KateDocumentTest::testReplaceQStringList()
void KateDocumentTest::testMovingInterfaceSignals()
{
- KateDocument *doc = new KateDocument(false, false, false);
+ KateDocument *doc = new KateDocument;
QSignalSpy aboutToDeleteSpy(doc, SIGNAL(aboutToDeleteMovingInterfaceContent(KTextEditor::Document*)));
QSignalSpy aboutToInvalidateSpy(doc, SIGNAL(aboutToInvalidateMovingInterfaceContent(KTextEditor::Document*)));
@@ -186,7 +186,7 @@ void KateDocumentTest::testSetTextPerformance()
Q_ASSERT(columns % (rangeLength + rangeGap) == 0);
- KateDocument doc(false, false, false);
+ KateDocument doc;
MovingRangeInvalidator invalidator;
connect(&doc, SIGNAL(aboutToInvalidateMovingInterfaceContent(KTextEditor::Document*)),
&invalidator, SLOT(aboutToInvalidateMovingInterfaceContent()));
@@ -233,7 +233,7 @@ void KateDocumentTest::testRemoveTextPerformance()
const int lines = 5000;
const int columns = 80;
- KateDocument doc(false, false, false);
+ KateDocument doc;
QString text;
const QString line = QString().fill('a', columns);
@@ -264,7 +264,7 @@ void KateDocumentTest::testRemoveTextPerformance()
void KateDocumentTest::testForgivingApiUsage()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
QVERIFY(doc.isEmpty());
QVERIFY(doc.replaceText(Range(0, 0, 100, 100), "asdf"));
@@ -304,7 +304,7 @@ public Q_SLOTS:
void KateDocumentTest::testRemoveMultipleLines()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("line1\n"
"line2\n"
@@ -318,7 +318,7 @@ void KateDocumentTest::testRemoveMultipleLines()
void KateDocumentTest::testInsertNewline()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("this is line\n"
"this is line2\n");
@@ -338,7 +338,7 @@ void KateDocumentTest::testDigest()
const QByteArray fileDigest = QByteArray::fromHex("ff6e0fddece03adeb8f902e8c540735a");
// make sure, Kate::TextBuffer and KateDocument::createDigest() equal
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.openUrl(QUrl::fromLocalFile(QLatin1String(TEST_DATA_DIR"md5checksum.txt")));
const QByteArray bufferDigest(doc.digest());
QVERIFY(doc.createDigest());
diff --git a/autotests/src/katefoldingtest.cpp b/autotests/src/katefoldingtest.cpp
index 1d8a0c7..3fdc798 100644
--- a/autotests/src/katefoldingtest.cpp
+++ b/autotests/src/katefoldingtest.cpp
@@ -59,7 +59,7 @@ void KateFoldingTest::cleanupTestCase()
// Buggy behavior: the cursor is hidden, and moving the hidden cursor crashes kate
void KateFoldingTest::testCrash311866()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
const QUrl url = QUrl::fromLocalFile(QLatin1String(TEST_DATA_DIR"bug311866.cpp"));
doc.openUrl(url);
doc.setHighlightingMode("C++");
@@ -89,7 +89,7 @@ void KateFoldingTest::testCrash311866()
// See https://bugs.kde.org/show_bug.cgi?id=295632
void KateFoldingTest::testBug295632()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
QString text = "oooossssssss\n"
"{\n"
"\n"
diff --git a/autotests/src/kateview_test.cpp b/autotests/src/kateview_test.cpp
index d9d13fa..92491d4 100644
--- a/autotests/src/kateview_test.cpp
+++ b/autotests/src/kateview_test.cpp
@@ -65,7 +65,7 @@ void KateViewTest::testReloadMultipleViews()
stream << flush;
file.close();
- KateDocument doc(false, false, false);
+ KateDocument doc;
QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName())));
QCOMPARE(doc.highlightingMode(), QString("C++"));
@@ -81,7 +81,7 @@ void KateViewTest::testReloadMultipleViews()
void KateViewTest::testLowerCaseBlockSelection()
{
// testcase for https://bugs.kde.org/show_bug.cgi?id=258480
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("nY\nnYY\n");
KateView *view1 = new KateView(&doc, 0);
@@ -118,7 +118,7 @@ void KateViewTest::testFolding()
stream << flush;
file.close();
- KateDocument doc(false, false, false);
+ KateDocument doc;
QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName())));
QCOMPARE(doc.highlightingMode(), QString("C++"));
@@ -162,7 +162,7 @@ void KateViewTest::testBug287291()
stream << flush;
file.close();
- KateDocument doc(false, false, false);
+ KateDocument doc;
QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName())));
QCOMPARE(doc.highlightingMode(), QString("C++"));
@@ -229,7 +229,7 @@ void KateViewTest::testSelection()
stream << flush;
file.close();
- KateDocument doc(false, false, false);
+ KateDocument doc;
QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName())));
KateView *view = new KateView(&doc, 0);
@@ -294,7 +294,7 @@ void KateViewTest::testSelection()
void KateViewTest::testKillline()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.insertLines(0, QStringList()
<< "foo"
<< "bar"
diff --git a/autotests/src/kte_documentcursor.cpp b/autotests/src/kte_documentcursor.cpp
index e787dc4..b382683 100644
--- a/autotests/src/kte_documentcursor.cpp
+++ b/autotests/src/kte_documentcursor.cpp
@@ -63,7 +63,7 @@ void DocumentCursorTest::cleanupTestCase()
// - gotoPreviousLine
void DocumentCursorTest::testConvenienceApi()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("\n"
"1\n"
"22\n"
@@ -123,7 +123,7 @@ void DocumentCursorTest::testConvenienceApi()
void DocumentCursorTest::testOperators()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("--oo--\n"
"--oo--\n"
"--oo--");
diff --git a/autotests/src/messagetest.cpp b/autotests/src/messagetest.cpp
index 00fe605..d3c7c3e 100644
--- a/autotests/src/messagetest.cpp
+++ b/autotests/src/messagetest.cpp
@@ -43,7 +43,7 @@ void MessageTest::cleanupTestCase()
void MessageTest::testPostMessage()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -71,7 +71,7 @@ void MessageTest::testPostMessage()
void MessageTest::testAutoHide()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -103,7 +103,7 @@ void MessageTest::testAutoHide()
void MessageTest::testAutoHideAfterUserInteraction()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -146,7 +146,7 @@ void MessageTest::testAutoHideAfterUserInteraction()
void MessageTest::testMessageQueue()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -203,7 +203,7 @@ void MessageTest::testMessageQueue()
void MessageTest::testPriority()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -264,7 +264,7 @@ void MessageTest::testPriority()
void MessageTest::testCreateView()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
//
// - first post a message
@@ -307,7 +307,7 @@ void MessageTest::testCreateView()
void MessageTest::testHideView()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
@@ -353,7 +353,7 @@ void MessageTest::testHideView()
void MessageTest::testHideViewAfterUserInteraction()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView *view = static_cast<KateView *>(doc.createView(0));
view->show();
diff --git a/autotests/src/movingcursor_test.cpp b/autotests/src/movingcursor_test.cpp
index df47975..2bef034 100644
--- a/autotests/src/movingcursor_test.cpp
+++ b/autotests/src/movingcursor_test.cpp
@@ -54,7 +54,7 @@ MovingCursorTest::~MovingCursorTest()
// - MovingCursor with MoveOnInsert
void MovingCursorTest::testMovingCursor()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
MovingCursor *invalid = doc.newMovingCursor(Cursor::invalid());
MovingCursor *moveOnInsert = doc.newMovingCursor(Cursor(0, 0), MovingCursor::MoveOnInsert);
MovingCursor *stayOnInsert = doc.newMovingCursor(Cursor(0, 0), MovingCursor::StayOnInsert);
@@ -124,7 +124,7 @@ void MovingCursorTest::testMovingCursor()
// - gotoPreviousLine
void MovingCursorTest::testConvenienceApi()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("\n"
"1\n"
"22\n"
@@ -184,7 +184,7 @@ void MovingCursorTest::testConvenienceApi()
void MovingCursorTest::testOperators()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("--oo--\n"
"--oo--\n"
"--oo--");
@@ -329,7 +329,7 @@ void MovingCursorTest::testOperators()
void MovingCursorTest::testInvalidMovingCursor()
{
- KateDocument *doc = new KateDocument(false, false, false);
+ KateDocument *doc = new KateDocument;
// add invalid MovingCursor. Inserts c into KateBuffer::m_invalidCursors
MovingCursor *c = doc->newMovingCursor(Cursor(-1, -1));
diff --git a/autotests/src/movingrange_test.cpp b/autotests/src/movingrange_test.cpp
index 2857846..993ec4e 100644
--- a/autotests/src/movingrange_test.cpp
+++ b/autotests/src/movingrange_test.cpp
@@ -152,7 +152,7 @@ MovingRangeTest::~MovingRangeTest()
// - RangeFeedback::rangeEmpty
void MovingRangeTest::testFeedbackEmptyRange()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// the range created below will span the 'x' characters
QString text("..xxxx\n"
"xxxx..");
@@ -220,7 +220,7 @@ void MovingRangeTest::testFeedbackEmptyRange()
// - RangeFeedback::rangeInvalid
void MovingRangeTest::testFeedbackInvalidRange()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// the range created below will span the 'x' characters
QString text("..xxxx\n"
"xxxx..");
@@ -290,7 +290,7 @@ void MovingRangeTest::testFeedbackInvalidRange()
// - RangeFeedback::caretExitedRange
void MovingRangeTest::testFeedbackCaret()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// the range created below will span the 'x' characters
QString text("..xxxx\n"
"xxxx..");
@@ -406,7 +406,7 @@ void MovingRangeTest::testFeedbackCaret()
// - RangeFeedback::mouseExitedRange
void MovingRangeTest::testFeedbackMouse()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// the range created below will span the 'x' characters
QString text("..xxxx\n"
"xxxx..");
diff --git a/autotests/src/plaintextsearch_test.cpp b/autotests/src/plaintextsearch_test.cpp
index 02b9694..19bfa58 100644
--- a/autotests/src/plaintextsearch_test.cpp
+++ b/autotests/src/plaintextsearch_test.cpp
@@ -78,7 +78,7 @@ PlainTextSearchTest::~PlainTextSearchTest()
void PlainTextSearchTest::init()
{
- m_doc = new KateDocument(false, false, false, 0, this);
+ m_doc = new KateDocument(false, false, 0, this);
m_search = new KatePlainTextSearch(m_doc, Qt::CaseSensitive, false);
}
diff --git a/autotests/src/range_test.cpp b/autotests/src/range_test.cpp
index ee3cb36..84ad0fd 100644
--- a/autotests/src/range_test.cpp
+++ b/autotests/src/range_test.cpp
@@ -94,7 +94,7 @@ void RangeTest::testTextEditorRange()
void RangeTest::testTextRange()
{
// test text range
- KateDocument doc(false, false, false);
+ KateDocument doc;
KTextEditor::MovingRange *complexRange = doc.newMovingRange(KTextEditor::Range());
KTextEditor::Range range = *complexRange;
rangeCheck(range);
@@ -103,7 +103,7 @@ void RangeTest::testTextRange()
void RangeTest::testInsertText()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// Multi-line insert
KTextEditor::MovingCursor *cursor1 = doc.newMovingCursor(KTextEditor::Cursor(), KTextEditor::MovingCursor::StayOnInsert);
@@ -129,7 +129,7 @@ void RangeTest::testInsertText()
void RangeTest::testCornerCaseInsertion()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// lock first revision
doc.lockRevision(0);
diff --git a/autotests/src/regexpsearch_test.cpp b/autotests/src/regexpsearch_test.cpp
index 9c340ef..d4c8711 100644
--- a/autotests/src/regexpsearch_test.cpp
+++ b/autotests/src/regexpsearch_test.cpp
@@ -245,7 +245,7 @@ void RegExpSearchTest::testAnchoredRegexp()
QFETCH(bool, backwards);
QFETCH(Range, expected);
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("fe fe fe");
KateRegExpSearch searcher(&doc, Qt::CaseInsensitive);
@@ -263,7 +263,7 @@ void RegExpSearchTest::testAnchoredRegexp()
void RegExpSearchTest::testSearchForward()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText(" \\piinfercong");
KateRegExpSearch search(&doc, Qt::CaseSensitive);
@@ -274,7 +274,7 @@ void RegExpSearchTest::testSearchForward()
void RegExpSearchTest::testSearchBackwardInSelection()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("foobar foo bar foo bar foo");
KateRegExpSearch search(&doc, Qt::CaseSensitive);
@@ -285,7 +285,7 @@ void RegExpSearchTest::testSearchBackwardInSelection()
void RegExpSearchTest::test()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("\\newcommand{\\piReductionOut}");
KateRegExpSearch search(&doc, Qt::CaseSensitive);
diff --git a/autotests/src/revision_test.cpp b/autotests/src/revision_test.cpp
index 424ab69..38dc08f 100644
--- a/autotests/src/revision_test.cpp
+++ b/autotests/src/revision_test.cpp
@@ -68,7 +68,7 @@ RevisionTest::~RevisionTest()
// - transformCursor()
void RevisionTest::testTransformCursor()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
// initial saved revision of unsaved document is -1
QVERIFY(doc.lastSavedRevision() == -1);
@@ -123,7 +123,7 @@ void RevisionTest::testTransformCursor()
// - transformRange()
void RevisionTest::testTransformRange()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
QCOMPARE(doc.revision(), (qint64) 0);
diff --git a/autotests/src/script_test_base.cpp b/autotests/src/script_test_base.cpp
index 2e2dee6..29fbca0 100644
--- a/autotests/src/script_test_base.cpp
+++ b/autotests/src/script_test_base.cpp
@@ -58,7 +58,7 @@ void ScriptTestBase::initTestCase()
{
m_msgHandler = qInstallMessageHandler(noDebugMessageOutput);
m_toplevel = new QMainWindow();
- m_document = new KateDocument(true, false, false, m_toplevel);
+ m_document = new KateDocument(true, false, m_toplevel);
m_view = static_cast<KateView *>(m_document->widget());
m_env = new TestScriptEnv(m_document, m_outputWasCustomised);
}
diff --git a/autotests/src/scriptdocument_test.cpp b/autotests/src/scriptdocument_test.cpp
index f2f3722..f783cc4 100644
--- a/autotests/src/scriptdocument_test.cpp
+++ b/autotests/src/scriptdocument_test.cpp
@@ -78,7 +78,7 @@ ScriptDocumentTest::~ScriptDocumentTest()
void ScriptDocumentTest::init()
{
- m_doc = new KateDocument(false, false, false, 0, this);
+ m_doc = new KateDocument;
m_view = m_doc->createView(0);
m_scriptDoc = new KateScriptDocument(this);
m_scriptDoc->setDocument(m_doc);
diff --git a/autotests/src/scripting_test.cpp b/autotests/src/scripting_test.cpp
index bd4e1bf..ca2ccc9 100644
--- a/autotests/src/scripting_test.cpp
+++ b/autotests/src/scripting_test.cpp
@@ -25,7 +25,6 @@
#include "kateview.h"
#include "katedocument.h"
-#include "katedocumenthelpers.h"
#include "kateconfig.h"
#include "katecmd.h"
#include "kateglobal.h"
diff --git a/autotests/src/searchbar_test.cpp b/autotests/src/searchbar_test.cpp
index 7acfd88..74cbc20 100644
--- a/autotests/src/searchbar_test.cpp
+++ b/autotests/src/searchbar_test.cpp
@@ -71,7 +71,7 @@ void SearchBarTest::cleanupTestCase()
void SearchBarTest::testFindNextIncremental()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
doc.setText("a a a b b");
KateView view(&doc, 0);
@@ -106,7 +106,7 @@ void SearchBarTest::testFindNextIncremental()
void SearchBarTest::testSetMatchCaseIncremental()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -140,7 +140,7 @@ void SearchBarTest::testSetMatchCaseIncremental()
void SearchBarTest::testSetMatchCasePower()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -181,7 +181,7 @@ void SearchBarTest::testSetMatchCasePower()
void SearchBarTest::testSetSelectionOnlyPower()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -230,7 +230,7 @@ void SearchBarTest::testSetSearchPattern()
QFETCH(bool, power);
QFETCH(int, numMatches2);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -254,7 +254,7 @@ void SearchBarTest::testSetSearchPattern()
void SearchBarTest::testSetSelectionOnly()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -290,7 +290,7 @@ void SearchBarTest::testFindAll()
QFETCH(int, numMatches2);
QFETCH(int, numMatches4);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -326,7 +326,7 @@ void SearchBarTest::testFindAll()
void SearchBarTest::testReplaceAll()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -381,7 +381,7 @@ void SearchBarTest::testFindSelectionForward()
QFETCH(Range, selectionRange);
QFETCH(Range, match);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -418,7 +418,7 @@ void SearchBarTest::testRemoveWithSelectionForward()
QFETCH(Range, selectionRange);
QFETCH(Range, match);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -452,7 +452,7 @@ void SearchBarTest::testRemoveInSelectionForward()
QFETCH(Range, selectionRange);
QFETCH(Range, match);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -497,7 +497,7 @@ void SearchBarTest::testReplaceWithDoubleSelecion()
QFETCH(QString, result);
QFETCH(Range, match);
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -516,7 +516,7 @@ void SearchBarTest::testReplaceWithDoubleSelecion()
void SearchBarTest::testReplaceDollar()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
@@ -535,7 +535,7 @@ void SearchBarTest::testReplaceDollar()
void SearchBarTest::testSearchHistoryIncremental()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig *const config = view.config();
config->patternHistoryModel()->setStringList(QStringList());
@@ -555,7 +555,7 @@ void SearchBarTest::testSearchHistoryIncremental()
QCOMPARE(bar.m_incUi->pattern->findText("bar"), 0);
QCOMPARE(bar.m_incUi->pattern->findText("foo"), 1);
- KateDocument doc2(false, false, false);
+ KateDocument doc2;
KateView view2(&doc2, 0);
KateViewConfig *const config2 = view2.config();
KateSearchBar bar2(false, &view2, config2);
@@ -572,7 +572,7 @@ void SearchBarTest::testSearchHistoryIncremental()
void SearchBarTest::testSearchHistoryPower()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig *const config = view.config();
config->patternHistoryModel()->setStringList(QStringList());
@@ -600,7 +600,7 @@ void SearchBarTest::testSearchHistoryPower()
QCOMPARE(bar.m_powerUi->pattern->findText("foo"), 1);
QCOMPARE(bar.m_powerUi->pattern->count(), 2);
- KateDocument doc2(false, false, false);
+ KateDocument doc2;
KateView view2(&doc2, 0);
KateViewConfig *const config2 = view2.config();
KateSearchBar bar2(true, &view2, config2);
@@ -612,7 +612,7 @@ void SearchBarTest::testSearchHistoryPower()
// Make sure Kate doesn't replace anything outside selection in block mode (see bug 253191)
void SearchBarTest::testReplaceInBlockMode()
{
- KateDocument doc(false, false, false);
+ KateDocument doc;
KateView view(&doc, 0);
KateViewConfig config(&view);
diff --git a/autotests/src/templatehandler_test.cpp b/autotests/src/templatehandler_test.cpp
index 7239957..26d4be3 100644
--- a/autotests/src/templatehandler_test.cpp
+++ b/autotests/src/templatehandler_test.cpp
@@ -38,7 +38,7 @@ void TemplateHandlerTest::testUndo()
initialValues.insert("type", "int");
initialValues.insert("index", "i");
- KateDocument doc(false, false, false, 0, this);
+ KateDocument doc(false, false, 0, this);
KateView view(&doc, 0);
view.insertTemplateTextImplementation(Cursor(0, 0), snippet, initialValues, 0);
diff --git a/autotests/src/undomanager_test.cpp b/autotests/src/undomanager_test.cpp
index f361961..be19844 100644
--- a/autotests/src/undomanager_test.cpp
+++ b/autotests/src/undomanager_test.cpp
@@ -34,7 +34,7 @@ class UndoManagerTest::TestDocument : public KateDocument
{
public:
TestDocument()
- : KateDocument(false, false, false, 0, 0)
+ : KateDocument(false, false, 0, 0)
{}
};
diff --git a/autotests/src/vimode_test.cpp b/autotests/src/vimode_test.cpp
index e575845..daee734 100644
--- a/autotests/src/vimode_test.cpp
+++ b/autotests/src/vimode_test.cpp
@@ -295,7 +295,7 @@ void ViModeTest::init()
delete kate_view;
delete kate_document;
- kate_document = new KateDocument(false, false, false, 0, NULL);
+ kate_document = new KateDocument(false, false, 0, NULL);
kate_view = new KateView(kate_document, mainWindow);
mainWindowLayout->addWidget(kate_view);
kate_view->config()->setViInputMode(true);
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fee14e8..2c2f821 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -80,7 +80,6 @@ dialogs/katedialogs.cpp
# document (THE document, buffer, lines/cursors/..., CORE STUFF)
document/katedocument.cpp
-document/katedocumenthelpers.cpp
document/katebuffer.cpp
# undo
diff --git a/src/data/katepart.desktop b/src/data/katepart.desktop
index b4b2d9d..4c6578c 100644
--- a/src/data/katepart.desktop
+++ b/src/data/katepart.desktop
@@ -53,7 +53,7 @@ Name[zh_CN]=嵌入式高级文本编辑器
Name[zh_TW]=嵌入式進階文字編輯器
X-KDE-Library=katepart
Icon=accessories-text-editor
-X-KDE-ServiceTypes=KParts/ReadOnlyPart,Browser/View,KParts/ReadWritePart,KTextEditor/Document
+X-KDE-ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart,KTextEditor/Document
Type=Service
InitialPreference=8
MimeType=text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-patch;text/x-adasrc;text/x-chdr;text/x-csrc;text/css;application/x-desktop;text/x-patch;text/x-fortran;text/html;text/x-java;text/x-tex;text/x-makefile;text/x-objcsrc;text/x-pascal;application/x-perl;application/x-perl;application/x-php;text/vnd.wap.wml;text/x-python;application/x-ruby;text/sgml;application/xml;model/vrml;
diff --git a/src/document/katedocument.cpp b/src/document/katedocument.cpp
index 234fd03..1014e70 100644
--- a/src/document/katedocument.cpp
+++ b/src/document/katedocument.cpp
@@ -31,9 +31,7 @@
#include "kateview.h"
#include "kateautoindent.h"
#include "katetextline.h"
-#include "katedocumenthelpers.h"
#include "katehighlighthelpers.h"
-#include "printing/kateprinter.h"
#include "katerenderer.h"
#include "kateregexp.h"
#include "kateplaintextsearch.h"
@@ -105,12 +103,11 @@ inline bool isBracket(const QChar &c)
//
// KateDocument Constructor
//
-KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
+KateDocument::KateDocument(bool bSingleViewMode,
bool bReadOnly, QWidget *parentWidget,
QObject *parent)
: KTextEditor::Document(parent),
m_bSingleViewMode(bSingleViewMode),
- m_bBrowserView(bBrowserView),
m_bReadOnly(bReadOnly),
m_activeView(0),
editSessionNumber(0),
@@ -162,8 +159,6 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
// swap file
m_swapfile = (config()->swapFileMode() == KateDocumentConfig::DisableSwapFile) ? 0L : new Kate::SwapFile(this);
- new KateBrowserExtension(this); // deleted by QObject memory management
-
// important, fill in the config into the indenter we use...
m_indenter->updateConfig();
@@ -1946,19 +1941,6 @@ uint KateDocument::editableMarks() const
}
//END
-//BEGIN KTextEditor::PrintInterface stuff
-bool KateDocument::print()
-{
- return KatePrinter::print(this);
-}
-
-void KateDocument::printPreview()
-{
- KatePrinter::printPreview(this);
-}
-
-//END
-
//BEGIN KTextEditor::DocumentInfoInterface (### unfinished)
QString KateDocument::mimeType()
{
diff --git a/src/document/katedocument.h b/src/document/katedocument.h
index 0a93a73..9884ae6 100644
--- a/src/document/katedocument.h
+++ b/src/document/katedocument.h
@@ -110,7 +110,7 @@ class KTEXTEDITOR_EXPORT KateDocument : public KTextEditor::Document,
friend class KateBuffer;
public:
- explicit KateDocument(bool bSingleViewMode = false, bool bBrowserView = false, bool bReadOnly = false,
+ explicit KateDocument(bool bSingleViewMode = false, bool bReadOnly = false,
QWidget *parentWidget = 0, QObject * = 0);
~KateDocument();
@@ -137,10 +137,6 @@ public:
{
return m_bReadOnly;
}
- bool browserView() const
- {
- return m_bBrowserView;
- }
bool singleViewMode() const
{
return m_bSingleViewMode;
@@ -149,7 +145,6 @@ public:
private:
// only to make part work, don't change it !
const bool m_bSingleViewMode;
- const bool m_bBrowserView;
const bool m_bReadOnly;
//
@@ -526,13 +521,6 @@ private:
uint m_editableMarks;
//
- // KTextEditor::PrintInterface
- //
-public Q_SLOTS:
- virtual bool print();
- virtual void printPreview();
-
- //
// KTextEditor::DocumentInfoInterface ( ### unfinished )
//
public:
diff --git a/src/document/katedocumenthelpers.cpp b/src/document/katedocumenthelpers.cpp
deleted file mode 100644
index fa975e3..0000000
--- a/src/document/katedocumenthelpers.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* This file is part of the KDE libraries and the Kate part.
- *
- * Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org>
- * Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
- * Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
- *
- * 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.
- */
-
-#include "katedocumenthelpers.h"
-
-#include "katedocument.h"
-#include "kateview.h"
-
-namespace KTextEditor
-{
-class View;
-}
-
-KateBrowserExtension::KateBrowserExtension(KateDocument *doc)
- : KParts::BrowserExtension(doc),
- m_doc(doc)
-{
- setObjectName(QLatin1String("katepartbrowserextension"));
- emit enableAction("print", true);
-}
-
-void KateBrowserExtension::print()
-{
- m_doc->print();
-}
-
diff --git a/src/document/katedocumenthelpers.h b/src/document/katedocumenthelpers.h
deleted file mode 100644
index be801bb..0000000
--- a/src/document/katedocumenthelpers.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This file is part of the KDE libraries and the Kate part.
- *
- * Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org>
- * Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
- * Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
- *
- * 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 __KATE_DOCUMENT_HELPERS__
-#define __KATE_DOCUMENT_HELPERS__
-
-#include <KParts/BrowserExtension>
-
-#include <QStringList>
-#include <QPointer>
-
-class KateDocument;
-
-/**
- * Interface for embedding KateDocument into a browser
- */
-class KateBrowserExtension : public KParts::BrowserExtension
-{
- Q_OBJECT
-
-public:
- /**
- * Constructor
- * @param doc parent document
- */
- explicit KateBrowserExtension(KateDocument *doc);
-
-public Q_SLOTS:
- /**
- * print the current file
- */
- void print();
-
-private:
- /**
- * parent document
- */
- KateDocument *m_doc;
-};
-
-#endif
-
diff --git a/src/include/ktexteditor/document.h b/src/include/ktexteditor/document.h
index 100dc21..7ec701e 100644
--- a/src/include/ktexteditor/document.h
+++ b/src/include/ktexteditor/document.h
@@ -816,22 +816,6 @@ Q_SIGNALS:
*/
void highlightingModeChanged(KTextEditor::Document *document);
- /*
- * Access to print routines
- */
-public:
- /**
- * Print the document. This should result in showing the print dialog.
- *
- * @returns true if document was printed
- */
- virtual bool print() = 0;
-
- /**
- * Shows the print preview dialog/
- */
- virtual void printPreview() = 0;
-
private:
class DocumentPrivate *const d;
diff --git a/src/include/ktexteditor/editor.h b/src/include/ktexteditor/editor.h
index 59d343a..0ef3aec 100644
--- a/src/include/ktexteditor/editor.h
+++ b/src/include/ktexteditor/editor.h
@@ -236,4 +236,3 @@ private:
}
#endif
-
diff --git a/src/include/ktexteditor/view.h b/src/include/ktexteditor/view.h
index d5a2f95..83266a4 100644
--- a/src/include/ktexteditor/view.h
+++ b/src/include/ktexteditor/view.h
@@ -590,6 +590,22 @@ public:
*/
virtual bool insertText(const QString &text);
+ /*
+ * Access to print routines
+ */
+public:
+ /**
+ * Print the document. This should result in showing the print dialog.
+ *
+ * @returns true if document was printed
+ */
+ virtual bool print() = 0;
+
+ /**
+ * Shows the print preview dialog/
+ */
+ virtual void printPreview() = 0;
+
private:
class ViewPrivate *const d;
};
diff --git a/src/printing/kateprinter.cpp b/src/printing/kateprinter.cpp
index 4b750f3..bc61840 100644
--- a/src/printing/kateprinter.cpp
+++ b/src/printing/kateprinter.cpp
@@ -24,6 +24,7 @@
#include "kateconfig.h"
#include "katedocument.h"
+#include "kateview.h"
#include <KConfigGroup>
#include <KSharedConfig>
@@ -44,7 +45,7 @@ class KatePrinterPrivate : public QObject
{
Q_OBJECT
public:
- KatePrinterPrivate(KateDocument *doc);
+ KatePrinterPrivate(KateView *view);
~KatePrinterPrivate();
bool print(QPrinter *printer);
@@ -53,14 +54,16 @@ public Q_SLOTS:
void paint(QPrinter *printer);
private:
+ KateView *m_view;
KateDocument *m_doc;
PrintPainter *m_painter;
};
-KatePrinterPrivate::KatePrinterPrivate(KateDocument *doc)
+KatePrinterPrivate::KatePrinterPrivate(KateView *view)
: QObject()
- , m_doc(doc)
- , m_painter(new PrintPainter(doc))
+ , m_view (view)
+ , m_doc(m_view->doc())
+ , m_painter(new PrintPainter(m_view))
{
}
@@ -139,17 +142,17 @@ void KatePrinterPrivate::paint(QPrinter *printer)
//BEGIN KatePrinter
-bool KatePrinter::print(KateDocument *doc)
+bool KatePrinter::print(KateView *view)
{
QPrinter printer;
- KatePrinterPrivate p(doc);
+ KatePrinterPrivate p(view);
return p.print(&printer);
}
-bool KatePrinter::printPreview(KateDocument *doc)
+bool KatePrinter::printPreview(KateView *view)
{
QPrinter printer;
- KatePrinterPrivate p(doc);
+ KatePrinterPrivate p(view);
QPrintPreviewDialog preview(&printer);
QObject::connect(&preview, SIGNAL(paintRequested(QPrinter*)), &p, SLOT(paint(QPrinter*)));
return preview.exec();
diff --git a/src/printing/kateprinter.h b/src/printing/kateprinter.h
index b7dcd5f..ecb00f5 100644
--- a/src/printing/kateprinter.h
+++ b/src/printing/kateprinter.h
@@ -23,12 +23,12 @@
#ifndef __KATE_PRINTER_H__
#define __KATE_PRINTER_H__
-class KateDocument;
+class KateView;
namespace KatePrinter
{
-bool print(KateDocument *doc);
-bool printPreview(KateDocument *doc);
+bool print(KateView *doc);
+bool printPreview(KateView *doc);
};
#endif
diff --git a/src/printing/printpainter.cpp b/src/printing/printpainter.cpp
index 401b291..7a86176 100644
--- a/src/printing/printpainter.cpp
+++ b/src/printing/printpainter.cpp
@@ -26,6 +26,7 @@
#include "katedocument.h"
#include "katebuffer.h"
#include "katerenderer.h"
+#include "kateview.h"
#include "kateconfig.h"
#include "katehighlight.h"
#include "katepartdebug.h"
@@ -82,8 +83,9 @@ public:
KTextEditor::Range selectionRange;
};
-PrintPainter::PrintPainter(KateDocument *doc)
- : m_doc(doc)
+PrintPainter::PrintPainter(KateView *view)
+ : m_view (view)
+ , m_doc(m_view->doc())
, m_colorScheme()
, m_printGuide(false)
, m_printLineNumbers(false)
@@ -106,7 +108,7 @@ PrintPainter::PrintPainter(KateDocument *doc)
{
m_folding = new Kate::TextFolding(m_doc->buffer());
- m_renderer = new KateRenderer(m_doc, *m_folding, m_doc->activeKateView());
+ m_renderer = new KateRenderer(m_doc, *m_folding, m_view);
m_renderer->config()->setSchema(m_colorScheme);
m_renderer->setPrinterFriendly(true);
diff --git a/src/printing/printpainter.h b/src/printing/printpainter.h
index 23a6f41..635f495 100644
--- a/src/printing/printpainter.h
+++ b/src/printing/printpainter.h
@@ -28,6 +28,7 @@
#include <QFont>
class KateDocument;
+class KateView;
class KateRenderer;
class QPrinter;
class QPainter;
@@ -49,7 +50,7 @@ class PageLayout;
class PrintPainter
{
public:
- PrintPainter(KateDocument *doc);
+ PrintPainter(KateView *view);
~PrintPainter();
void paint(QPrinter *printer) const;
@@ -128,6 +129,7 @@ private:
void configure(const QPrinter *printer, PageLayout &layout) const;
private:
+ KateView *m_view;
KateDocument *m_doc;
QString m_colorScheme;
diff --git a/src/utils/katecmds.cpp b/src/utils/katecmds.cpp
index c38c4bd..d219aaf 100644
--- a/src/utils/katecmds.cpp
+++ b/src/utils/katecmds.cpp
@@ -322,7 +322,7 @@ bool KateCommands::CoreCommands::exec(KTextEditor::View *view,
}
return true;
} else if (cmd == QLatin1String("print")) {
- v->doc()->print();
+ v->print();
return true;
}
diff --git a/src/utils/katefactory.cpp b/src/utils/katefactory.cpp
index 04f2525..3ecb4ab 100644
--- a/src/utils/katefactory.cpp
+++ b/src/utils/katefactory.cpp
@@ -64,29 +64,17 @@ public:
* \param keyword A string that uniquely identifies the plugin. If a KService is used this
* keyword is read from the X-KDE-PluginKeyword entry in the .desktop file.
*/
- virtual QObject *create(const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword)
+ virtual QObject *create(const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &, const QString &)
{
- Q_UNUSED(args);
-
- /**
- * if keyword == KTextEditor/Editor, we shall return our kate global instance!
- */
- if (keyword == QLatin1String("KTextEditor/Editor")) {
- return KateGlobal::self();
- }
-
- QByteArray classname(iface);
+ QByteArray classname (iface);
// default to the kparts::* behavior of having one single widget() if the user don't requested a pure document
bool bWantSingleView = (classname != "KTextEditor::Document");
- // does user want browserview?
- bool bWantBrowserView = (classname == "Browser/View");
-
// should we be readonly?
- bool bWantReadOnly = (bWantBrowserView || (classname == "KParts::ReadOnlyPart"));
+ bool bWantReadOnly = (classname == "KParts::ReadOnlyPart");
- KParts::ReadWritePart *part = new KateDocument(bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, parent);
+ KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantReadOnly, parentWidget, parent);
part->setReadWrite(!bWantReadOnly);
return part;
diff --git a/src/utils/kateglobal.cpp b/src/utils/kateglobal.cpp
index 8775c3e..837ce61 100644
--- a/src/utils/kateglobal.cpp
+++ b/src/utils/kateglobal.cpp
@@ -241,7 +241,7 @@ KateGlobal::~KateGlobal()
KTextEditor::Document *KateGlobal::createDocument(QObject *parent)
{
- KateDocument *doc = new KateDocument(false, false, false, 0, parent);
+ KateDocument *doc = new KateDocument(false, false, 0, parent);
emit documentCreated(this, doc);
diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp
index d5f1f02..9377bc6 100644
--- a/src/view/kateview.cpp
+++ b/src/view/kateview.cpp
@@ -24,14 +24,12 @@
//BEGIN includes
#include "kateview.h"
-#include "kateview.moc"
#include "kateviewinternal.h"
#include "kateviewhelpers.h"
#include "katerenderer.h"
#include "katedocument.h"
#include "kateundomanager.h"
-#include "katedocumenthelpers.h"
#include "kateglobal.h"
#include "kateviglobal.h"
#include "katehighlight.h"
@@ -59,6 +57,7 @@
#include "katemessagewidget.h"
#include "katetemplatehandler.h"
#include "katepartdebug.h"
+#include "printing/kateprinter.h"
#include <ktexteditor/messageinterface.h>
@@ -313,11 +312,6 @@ void KateView::setupConnections()
connect(m_doc, SIGNAL(annotationModelChanged(KTextEditor::AnnotationModel*,KTextEditor::AnnotationModel*)),
m_viewInternal->m_leftBorder, SLOT(annotationModelChanged(KTextEditor::AnnotationModel*,KTextEditor::AnnotationModel*)));
-
- if (m_doc->browserView()) {
- connect(this, SIGNAL(dropEventPass(QDropEvent*)),
- this, SLOT(slotDropEventPass(QDropEvent*)));
- }
}
void KateView::setupActions()
@@ -901,7 +895,7 @@ void KateView::setupEditActions()
connect(a, SIGNAL(triggered(bool)), SLOT(shiftToMatchingBracket()));
m_editActions << a;
- // anders: shortcuts doing any changes should not be created in browserextension
+ // anders: shortcuts doing any changes should not be created in read-only mode
if (!m_doc->readOnly()) {
a = ac->addAction(QLatin1String("transpose_char"));
a->setText(i18n("Transpose Characters"));
@@ -1253,28 +1247,6 @@ void KateView::slotUpdateUndo()
m_editRedo->setEnabled(m_doc->isReadWrite() && m_doc->redoCount() > 0);
}
-void KateView::slotDropEventPass(QDropEvent *ev)
-{
- const QList<QUrl> lstDragURLs = ev->mimeData()->urls();
- bool ok = !lstDragURLs.isEmpty();
-
- KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(doc());
- if (ok && ext) {
- emit ext->openUrlRequest(lstDragURLs.first());
- }
-}
-
-void KateView::contextMenuEvent(QContextMenuEvent *ev)
-{
- if (!m_doc || !m_doc->browserExtension()) {
- return;
- }
- KParts::OpenUrlArguments args;
- args.setMimeType(QLatin1String("text/plain"));
- emit m_doc->browserExtension()->popupMenu(ev->globalPos(), m_doc->url(), S_IFREG, args);
- ev->accept();
-}
-
bool KateView::setCursorPositionInternal(const KTextEditor::Cursor &position, uint tabwidth, bool calledExternally)
{
Kate::TextLine l = m_doc->kateTextLine(position.line());
@@ -3390,3 +3362,16 @@ void KateView::createHighlights()
}
} while (matches.first().isValid());
}
+
+//BEGIN KTextEditor::PrintInterface stuff
+bool KateView::print()
+{
+ return KatePrinter::print(this);
+}
+
+void KateView::printPreview()
+{
+ KatePrinter::printPreview(this);
+}
+
+//END
diff --git a/src/view/kateview.h b/src/view/kateview.h
index 31e86d7..22d9ea4 100644
--- a/src/view/kateview.h
+++ b/src/view/kateview.h
@@ -596,13 +596,9 @@ public:
public:
void slotTextInserted(KTextEditor::View *view, const KTextEditor::Cursor &position, const QString &text);
-protected:
- void contextMenuEvent(QContextMenuEvent *);
-
private Q_SLOTS:
void slotGotFocus();
void slotLostFocus();
- void slotDropEventPass(QDropEvent *ev);
void slotSaveCanceled(const QString &error);
void slotConfigDialog();
void exportHtmlToClipboard ();
@@ -930,6 +926,13 @@ private:
* The main window responsible for this view, if any
*/
QPointer<KTextEditor::MainWindow> m_mainWindow;
+
+ //
+ // KTextEditor::PrintInterface
+ //
+public Q_SLOTS:
+ virtual bool print();
+ virtual void printPreview();
};
/**
diff --git a/src/view/kateviewinternal.cpp b/src/view/kateviewinternal.cpp
index abbb9a3..c28e545 100644
--- a/src/view/kateviewinternal.cpp
+++ b/src/view/kateviewinternal.cpp
@@ -2519,11 +2519,6 @@ void KateViewInternal::contextMenuEvent(QContextMenuEvent *e)
QPoint p = e->pos();
- if (doc()->browserView()) {
- m_view->contextMenuEvent(e);
- return;
- }
-
if (e->reason() == QContextMenuEvent::Keyboard) {
makeVisible(m_displayCursor, 0);
p = cursorCoordinates(false);