Bug 66988

Summary: Quanta: Redirection in preview of unsaved files does not work as expected
Product: quanta Reporter: Ben Burton <bab>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ben Burton 2003-11-01 11:29:08 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    Debian testing/unstable Packages
OS:          Linux

Received through the Debian BTS (#201969).

When I create a new file in the editor and do not save it, the preview
function shows a wrong document.

Example: The newly created file is:

<html>
<head>
<meta http-equiv="refresh" content="5; otherpage.html">
</head>
<body>
foo
</body>
</html>

When I click on preview (and have not saved the file before), the page
is shown as expected, and switched to the otherpage.html after 5
seconds.

When I disable the preview and enable it a second time, the
otherpage.html is shown immediately.

Thanks!
Comment 1 András Manţia 2003-11-06 15:34:12 UTC
Subject: quanta/quanta

CVS commit by amantia: 

Preview widget is always cleared. Otherwise it causes nothing but trouble. Fixes #66988.

CCMAIL: 66988-done@bugs.kde.org


  M +6 -21     quanta.cpp   1.390
  M +1 -3      quanta.h   1.180
  M +1 -1      quanta_init.cpp   1.383
  M +1 -1      quantadoc.cpp   1.124


--- quanta/quanta/quanta.cpp  #1.389:1.390
@@ -594,15 +594,7 @@ void QuantaApp::slotStatusMsg(const QStr
 }
 
-/** Repaint preview */
-void QuantaApp::slotViewRepaint()
-{
-  repaintPreview( true );
-}
-
 /** repaint preview */
-void QuantaApp::repaintPreview( bool clear )
+void QuantaApp::slotRepaintPreview()
 {
-  static QString oldtext = "";
-
   WHTMLPart *part = m_htmlPart;
   QWidgetStack *s = widgetStackOfHtmlPart();
@@ -615,9 +607,4 @@ void QuantaApp::repaintPreview( bool cle
   previewCopyMade = false;
 
-  if ( clear )
- {
-    oldtext = "";
-  }
-
   KHTMLView *html = part->view();
   int xOffset = html->contentsX(), yOffset = html->contentsY();
@@ -672,10 +659,9 @@ void QuantaApp::repaintPreview( bool cle
       url = m_project->urlWithPrefix(url);
 
-      part->begin(url, xOffset, yOffset );
-      part->openURL( url );
+      part->begin(url, xOffset, yOffset);
+      part->openURL(url);
     } else  //the document is Untitled, preview the text from it
     {
       QString text = w->editIf->text();
-      if ( text == oldtext ) return;
       if ( text.isEmpty() )
       {
@@ -685,5 +671,4 @@ void QuantaApp::repaintPreview( bool cle
       {
       }
-      oldtext = text;
       part->begin( projectBaseURL(), xOffset, yOffset );
       part->write( text );
@@ -941,5 +926,5 @@ void QuantaApp::slotUpdateStatus(QWidget
   if (s->id(s->visibleWidget()) == 1)
   {
-   repaintPreview(true);
+    slotRepaintPreview();
   }
   #ifdef BUILD_KAFKAPART
@@ -1302,5 +1287,5 @@ void QuantaApp::slotOptions()
     m_htmlPart->end();
 
-    repaintPreview(true);
+    slotRepaintPreview();
     reparse(true);
 
@@ -1373,5 +1358,5 @@ void QuantaApp::slotShowPreview()
     }
     slotShowPreviewWidget(true);
-    repaintPreview(false);
+    slotRepaintPreview();
     m_previewVisible = true;
   } else

--- quanta/quanta/quanta.h  #1.179:1.180
@@ -246,11 +246,9 @@ public slots:
 
   /** repaint preview */
-  void repaintPreview( bool clear = false);
+  void slotRepaintPreview();
   /** show preview ( F6 )*/
   void slotShowPreview();
   void slotShowPreviewWidget(bool show);
   void slotShowProjectTree();
-  /** Repaint preview ( slot ) */
-  void slotViewRepaint();
 
   void slotShowBottDock(bool force = false);

--- quanta/quanta/quanta_init.cpp  #1.382:1.383
@@ -1938,5 +1938,5 @@ void QuantaApp::initActions()
     (void) new KAction( i18n( "&Reload Preview" ), "reload",
                         KStdAccel::shortcut(KStdAccel::Reload).keyCodeQt(),
-                        this, SLOT( slotViewRepaint() ),
+                        this, SLOT(slotRepaintPreview()),
                         ac, "reload" );
 

--- quanta/quanta/quantadoc.cpp  #1.123:1.124
@@ -175,5 +175,5 @@ void QuantaDoc::openDocument(const KURL&
       quantaApp->fileRecent->addURL( w->url() );
 
-      quantaApp->repaintPreview();
+      quantaApp->slotRepaintPreview();
 
       w->kate_view->setIconBorder(qConfig.iconBar);