Bug 109815

Summary: CSS Editor can only be invoked once on new files
Product: quanta Reporter: Linus McCabe <linus>
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 Linus McCabe 2005-07-29 07:36:39 UTC
Version:           SVN (using KDE KDE 3.4.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

1) Create new file
2) change to Style tab, click "Insert CSS"
3) add some CSS in the editor, press OK
4) Press "Insert CSS" again when back in editor -> "The CSS Editor cannot be invoked here"
Comment 1 Linus McCabe 2005-07-29 07:37:41 UTC
Oh, forgot to say, if you save the file and reopen it, it works again...

/LInus
Comment 2 Jens Herden 2005-09-04 16:21:53 UTC
I tried to understand this but I can not. What do you mean by "1) Create new file"? Is it an empty file or a new html file from the wizard?

When you create a new empty file the type is what you have set in the configuration, default is HTML. From your description of the toolbars I can assume that Quanta uses an HTML doctype. 
So the real bug for me is that you can invoke the CSS editor for an empty HTML file.

If you change the doctype to CSS it works as expected here, you can use the CSS editor everywhere. If you have HTML the cursor must be at the right position so that the CSS editor can be invoked in the right mode. Either for the tag or the document.  
Comment 3 András Manţia 2005-09-14 17:18:06 UTC
SVN commit 460635 by amantia:

Jens is right, CSS editor should not be invoked in an empty HTML file.

BUG: 109815

 M  +1 -0      ChangeLog  
 M  +3 -3      src/quanta.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #460634:460635
@@ -26,6 +26,7 @@
         - create empty description files for scripts that don't have one
         - fix loading order of the project view files
         - save the content entered in a new file in the VPL editor [#111278]
+        - do not allow invocation of the CSS editor in an empty non-CSS document [#109815]
 
  - improvements:
         - md5sum based file changed detection
--- branches/KDE/3.5/kdewebdev/quanta/src/quanta.cpp #460634:460635
@@ -4455,8 +4455,8 @@
     }
     delete dlg;
 
-  } else if (!node || fullDocument.isEmpty() ||
-      w->currentDTD(true)->name == "text/css") //empty document or pure CSS file, invoke the selector editor
+  } else
+  if (!node || w->currentDTD(true)->name == "text/css") 
   {
         kdDebug(24000) << "[CSS editor] This is a pure CSS document";
 
@@ -4513,7 +4513,7 @@
     }
     delete dlg;
    } else
-   KMessageBox::sorry(this, i18n("The CSS Editor cannot be invoked here.\nTry to invoke it on a tag or on a style section."));
+     KMessageBox::sorry(this, i18n("The CSS Editor cannot be invoked here.\nTry to invoke it on a tag or on a style section."));
 }
 
 /** for <a href=mailto> tag  */