summaryrefslogtreecommitdiff
blob: ee7f53c9138f680a973922af78871e0d357fe600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Index: contents.cc
===================================================================
RCS file: /home/kde/koffice/kword/contents.cc,v
retrieving revision 1.49.2.1
retrieving revision 1.49.2.2
diff -u -p -r1.49.2.1 -r1.49.2.2
--- kword/contents.cc	18 Oct 2002 16:59:42 -0000	1.49.2.1
+++ kword/contents.cc	20 Dec 2002 12:01:36 -0000	1.49.2.2
@@ -134,7 +134,7 @@ KoTextCursor * KWInsertTOCCommand::remov
     // We start from the end, to avoid the parag shifting problem
     KoTextParag *p = textdoc->lastParag();
     KoTextCursor *posOfTable=0L;
-    KWTextParag *posOfToc=0L;
+    KoTextParag *posOfToc=0L;
 
     while ( p )
     {
@@ -142,8 +142,6 @@ KoTextCursor * KWInsertTOCCommand::remov
         if ( parag->style() && ( parag->style()->name().startsWith( "Contents Head" ) ||
             parag->style()->name() == "Contents Title" ) )
         {
-            posOfToc=parag;
-
             kdDebug() << "KWContents::createContents Deleting paragraph " << p << " " << p->paragId() << endl;
             // This paragraph is part of the TOC -> remove
 
@@ -172,6 +170,7 @@ KoTextCursor * KWInsertTOCCommand::remov
             delete p;
             kdDebug() << "KWInsertTOCCommand::removeTOC " << p << " deleted" << endl;
             p = next;
+            posOfToc = p;
             kdDebug() << "KWInsertTOCCommand::removeTOC prev=" << prev << " p=" << p << endl;
             // Fix parag chain
             if ( prev )
@@ -179,6 +178,8 @@ KoTextCursor * KWInsertTOCCommand::remov
                 prev->setNext( p );
                 if ( p )
                     p->setParagId( prev->paragId() + 1 );
+                else
+                    posOfToc = prev;
             }
             else
             {
@@ -190,6 +191,7 @@ KoTextCursor * KWInsertTOCCommand::remov
                 {
                     textdoc->clear( true ); // recreate empty parag.
                     cursor->setParag( textdoc->firstParag() );
+                    posOfToc = textdoc->firstParag();
                     break;
                 }
             }
@@ -198,12 +200,12 @@ KoTextCursor * KWInsertTOCCommand::remov
         p = p->prev();
     }
     textdoc->invalidate();
-     if(posOfToc)
-     {
+    if(posOfToc)
+    {
          posOfTable=new KoTextCursor( textdoc );
          posOfTable->setParag(posOfToc  );
          posOfTable->setIndex( 0 );//start of parag
-     }
+    }
     // ### TODO propagate parag ID changes.
     return posOfTable;
 }
Index: kwview.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwview.cc,v
retrieving revision 1.822.2.5
retrieving revision 1.822.2.6
diff -u -p -r1.822.2.5 -r1.822.2.6
--- kword/kwview.cc	12 Nov 2002 15:38:17 -0000	1.822.2.5
+++ kword/kwview.cc	24 Dec 2002 15:16:50 -0000	1.822.2.6
@@ -251,12 +251,6 @@ KWView::KWView( KWViewMode* viewMode, QW
 KWView::~KWView()
 {
     clearSelection();
-    //delete special char dlg when we close view
-    if ( m_specialCharDlg )
-    {
-        m_specialCharDlg->closeDialog();
-    }
-
     if ( m_findReplace )
     {
         // Abort any find/replace
@@ -322,8 +316,11 @@ void KWView::clearSelection()
         delete m_spell.kspell;
     }
     delete m_searchEntry;
+    m_searchEntry = 0L;
     delete m_replaceEntry;
-    delete m_specialCharDlg;
+    m_replaceEntry = 0L;
+    if ( m_specialCharDlg )
+        m_specialCharDlg->closeDialog(); // will call slotSpecialCharDlgClosed
 }
 
 
@@ -3079,7 +3076,7 @@ void KWView::slotSpecialCharDlgClosed()
                     this, SLOT(slotSpecialChar(QChar,const QString &)));
         disconnect( m_specialCharDlg, SIGNAL( finished() ),
                     this, SLOT( slotSpecialCharDlgClosed() ) );
-        delete m_specialCharDlg;
+        m_specialCharDlg->deleteLater();
         m_specialCharDlg = 0L;
     }
 }