Bug 118814 - dtd always like set in "configure quanta", "quickstart" selection ignored
Summary: dtd always like set in "configure quanta", "quickstart" selection ignored
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-21 22:22 UTC by plasmagunman
Modified: 2005-12-23 15:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description plasmagunman 2005-12-21 22:22:11 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages
OS:                Linux

in the quick start menu you can select a custom dtd, different from the global one set in "settings"->"configure quanta". the headers will be written correct, but quanta doesn't regard this custom dtd for autocompletion.

e.g.: setting global dtd to html 4 transitional and creating a new file, setting quickstart-dtd to xhtml 1 strict still autocompletes "<ul>" with "<ul><LI></LI></ul>". the upper case letters are not xhtml-compliant.

actually i don't know if that's a serious one, since most people use projects, which seem to have better local-value support.
Comment 1 András Manţia 2005-12-23 15:17:42 UTC
SVN commit 490875 by amantia:

Set the DTEP of the document to the one selected in the Quick Start dialog.
Requires a newly introduced WindowManagerIf::setDtep DCOP method.
Fix the nickname of XHTML 1.0 Basic.

BUG: 118814

 M  +7 -0      ChangeLog  
 M  +1 -1      data/dtep/xhtml-basic/description.rc  
 M  +14 -1     scripts/htmlquickstart.kmdr  
 M  +1 -0      src/dcopwindowmanagerif.h  
 M  +38 -27    src/quanta.cpp  
 M  +6 -0      src/quanta.h  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #490874:490875
@@ -8,7 +8,14 @@
         - don't loose the comment closing character when formatting the XML code [#118453]
         - insert valid img tag for XHTML documents [#118805]
         - don't show the Pages tab in DTEP editing dialog more than once [#118840]
+        - set the DTEP of the document to the one selected in the Quick Start dialog [#118814]
 
+ - improvements:
+        - add XHTML 1.1 and XHTML 1.0 Basic to the quickstart dialog [#118813]
+        - new DCOP interfaces/methods:
+            - WindowManagerIf::setDtep
+
+
 Version 3.5 (Release date: 29-11-2005; Started 04-03-2004):
  - bugfixes:
         - don't crash when Smart Tag Insertion is enabled and some tags are inserted to an
--- branches/KDE/3.5/kdewebdev/quanta/data/dtep/xhtml-basic/description.rc #490874:490875
@@ -1,6 +1,6 @@
 [General]
 Name = -//W3C//DTD XHTML Basic 1.0//EN
-NickName = XHTML Basic 1.0
+NickName = XHTML 1.0 Basic
 URL = http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd
 DoctypeString = html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"
 DefaultExtension = html
--- branches/KDE/3.5/kdewebdev/quanta/scripts/htmlquickstart.kmdr #490874:490875
@@ -160,7 +160,20 @@
 echo '@CBPHPFooter'
 echo '&lt;/body&gt;'
 echo '&lt;/html&gt;'
-</string>
+
+quanta=`dcop quanta-@parentPid`
+if [ -z "$quanta" ]; then
+    quanta=`dcop quanta`
+    if [ ! -z "$quanta" ]; then
+       quantadcop=quanta
+    fi
+else
+    quantadcop=quanta-@parentPid
+fi
+
+if [ ! -z "$quantadcop" ]; then
+  dcop $quantadcop WindowManagerIf setDtep "@DTEPselect.text" false
+fi</string>
                 </stringlist>
             </property>
             <grid>
--- branches/KDE/3.5/kdewebdev/quanta/src/dcopwindowmanagerif.h #490874:490875
@@ -34,6 +34,7 @@
   virtual void newDebuggerPosition(const QString &file, int lineNumber) = 0;
   virtual void openFile(const QString &file, int lineNumber, int columnNumber) = 0;
   virtual QString saveCurrentFile() = 0;
+  virtual void setDtep(const QString& dtepName, bool convert) = 0;
   virtual QString documentFolderForURL(const QString &url) = 0;
   virtual QString urlWithPreviewPrefix(const QString &url) = 0;
   virtual void addFileToProject(const QString &url) = 0;
--- branches/KDE/3.5/kdewebdev/quanta/src/quanta.cpp #490874:490875
@@ -3001,6 +3001,43 @@
   dlg.exec();
 }
 
+void QuantaApp::setDtep(const QString& dtepName, bool convert)
+{
+  Document *w = ViewManager::ref()->activeDocument();
+  if (w)
+  {
+    QString dtep = DTDs::ref()->getDTDNameFromNickName(dtepName);
+    if (!DTDs::ref()->find(dtep))
+      return;
+    w->setDTDIdentifier(dtep);
+    const DTDStruct *dtd = DTDs::ref()->find(w->getDTDIdentifier());
+    if (convert && dtd->family == Xml)
+    {
+      Tag *tag = 0L;
+      w->findDTDName(&tag);
+      if (tag)
+      {
+        int bLine, bCol, eLine, eCol;
+        tag->beginPos(bLine,bCol);
+        tag->endPos(eLine,eCol);
+        w->editIf->removeText(bLine, bCol, eLine, eCol+1);
+        w->viewCursorIf->setCursorPositionReal((uint)bLine, (uint)bCol);
+        w->insertText("<!DOCTYPE" + dtd->doctypeStr +">");
+        delete tag;
+      } else
+      {
+        w->viewCursorIf->setCursorPositionReal(0,0);
+        w->insertText("<!DOCTYPE" + dtd->doctypeStr + ">\n");
+      }
+    }
+    slotLoadToolbarForDTD(w->getDTDIdentifier());
+    QuantaView *view = ViewManager::ref()->activeView();
+    if (view)
+      view->activated();
+    reparse(true);
+  }
+}
+
 void QuantaApp::slotChangeDTD()
 {
   Document *w = ViewManager::ref()->activeDocument();
@@ -3013,8 +3050,6 @@
     int pos = -1;
     int defaultIndex = 0;
 
-    Tag *tag = 0L;
-    w->findDTDName(&tag);
     QString oldDtdName = w->getDTDIdentifier();
     QString defaultDocType = Project::ref()->defaultDTD();
     QStringList lst = DTDs::ref()->nickNameList(true);
@@ -3039,32 +3074,8 @@
     dtdWidget->adjustSize();
     if (dlg.exec())
     {
-      w->setDTDIdentifier(DTDs::ref()->getDTDNameFromNickName(dtdWidget->dtdCombo->currentText()));
-      const DTDStruct *dtd = DTDs::ref()->find(w->getDTDIdentifier());
-      if (dtdWidget->convertDTD->isChecked() && dtd->family == Xml)
-      {
-        if (tag)
-        {
-          int bLine, bCol, eLine, eCol;
-          tag->beginPos(bLine,bCol);
-          tag->endPos(eLine,eCol);
-          w->editIf->removeText(bLine, bCol, eLine, eCol+1);
-          w->viewCursorIf->setCursorPositionReal((uint)bLine, (uint)bCol);
-          w->insertText("<!DOCTYPE" + dtd->doctypeStr +">");
-          delete tag;
-        } else
-        {
-          w->viewCursorIf->setCursorPositionReal(0,0);
-          w->insertText("<!DOCTYPE" + dtd->doctypeStr + ">\n");
-        }
-      }
+      setDtep(dtdWidget->dtdCombo->currentText(), dtdWidget->convertDTD->isChecked());
     }
-
-    slotLoadToolbarForDTD(w->getDTDIdentifier());
-    QuantaView *view = ViewManager::ref()->activeView();
-    if (view)
-      view->activated();
-    reparse(true);
   }
 }
 
--- branches/KDE/3.5/kdewebdev/quanta/src/quanta.h #490874:490875
@@ -151,6 +151,12 @@
   /** Return the list of opened URLs and their editor interface numbers*/
   QStringList openedURLs() const;
   QString saveCurrentFile();
+  /**
+   * Sets the DTEP for the current document.
+   * @param dtepName the name (nickname or full name) of the DTEP
+   * @param convert  if true, converts the !DOCTYPE line to the new DTEP
+   */
+  void setDtep(const QString& dtepName, bool convert);
   QStringList tagAreas(const QString& name, bool includeCoordinates, bool skipFoundContent) const;
   QString documentFolderForURL(const QString &url);
   QString urlWithPreviewPrefix(const QString &url);