[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/kraft/src
From:       Klaas Freitag <freitag () suse ! de>
Date:       2006-11-27 20:46:56
Message-ID: 1164660416.716644.22168.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 608542 by freitag:

- some renamings to meaningfull names
- proper html escaping
- bugfix for new templates that were not appended into the catalog




 M  +1 -1      catalogselection.cpp  
 M  +3 -1      docpostcard.cpp  
 M  +3 -3      flostempldialog.cpp  
 M  +4 -2      flostempldialog.h  
 M  +1 -1      katalog.cpp  
 M  +1 -1      katalogman.cpp  
 M  +1 -1      katalogman.h  
 M  +6 -6      portalview.cpp  
 M  +11 -0     templkatalog.cpp  
 M  +1 -0      templkatalog.h  
 M  +6 -2      templkatalogview.cpp  


--- trunk/playground/office/kraft/src/catalogselection.cpp #608541:608542
@@ -69,7 +69,7 @@
 
 void CatalogSelection::setupCatalogList()
 {
-  QStringList katalogNames = KatalogMan::self()->allKatalogs();
+  QStringList katalogNames = KatalogMan::self()->allKatalogNames();
   mCatalogSelector->insertStringList( katalogNames );
   slotSelectCatalog( katalogNames[0] );
 }
--- trunk/playground/office/kraft/src/docpostcard.cpp #608541:608542
@@ -17,6 +17,8 @@
 
 #include "docpostcard.h"
 
+#include <qstylesheet.h>
+
 #include <klocale.h>
 #include <kglobal.h>
 #include <kurl.h>
@@ -43,7 +45,7 @@
 
 QString DocPostCard::htmlify( const QString& str ) const
 {
-  QStringList li = QStringList::split( "\n", str );
+  QStringList li = QStringList::split( "\n", QStyleSheet::escape( str ) );
   return "<p>" + li.join( "</p><p>" ) + "</p>";
 }
 
--- trunk/playground/office/kraft/src/flostempldialog.cpp #608541:608542
@@ -68,7 +68,7 @@
 {
     if( ! t ) return;
     m_template = t;
-    m_newTemplate = newTempl;
+    m_templateIsNew = newTempl;
 
     m_katalog = KatalogMan::self()->getKatalog(katalogname);
 
@@ -264,7 +264,7 @@
 	       }
         }
 
-        /* Zeit zählen */
+        /* count time */
         bool c = m_addTime->isChecked();
         if( c != m_template->hasTimeslice() ) {
             m_template->setHasTimeslice(c);
@@ -332,7 +332,7 @@
 
     d_calcTempl::reject();
 
-    if ( m_newTemplate ) {
+    if ( m_templateIsNew ) {
       // remove the listview item if it was created newly
       emit editRejected();
     }
--- trunk/playground/office/kraft/src/flostempldialog.h #608541:608542
@@ -56,7 +56,9 @@
     ~FlosTemplDialog();
 
     void setTemplate( FloskelTemplate* t, const QString&, bool );
-
+    bool templateIsNew() {
+      return m_templateIsNew;
+    };
 signals:
     void takeMaterialAnswer(const QString&);
     void editAccepted( FloskelTemplate* );
@@ -118,7 +120,7 @@
     ZeitCalcDialog *m_timePartDialog;
     MatCalcDialog *m_matPartDialog;
     CalcPart *m_cpChange;
-    bool m_newTemplate;
+    bool m_templateIsNew;
 };
 
 #endif
--- trunk/playground/office/kraft/src/katalog.cpp #608541:608542
@@ -61,7 +61,7 @@
 }
 
 /**
- * virtuelle Ladeklasse fr Kataloge. Muss berschrieben werden.
+ * virtuell load method for catalogs. Must be overwritten.
  */
 int Katalog::load()
 {
--- trunk/playground/office/kraft/src/katalogman.cpp #608541:608542
@@ -51,7 +51,7 @@
   delete m_katalogDict;
 }
 
-QStringList KatalogMan::allKatalogs()
+QStringList KatalogMan::allKatalogNames()
 {
 
   QStringList list;
--- trunk/playground/office/kraft/src/katalogman.h #608541:608542
@@ -40,7 +40,7 @@
     ~KatalogMan();
     static KatalogMan *self();
 
-    QStringList allKatalogs();
+    QStringList allKatalogNames();
     Katalog* getKatalog(const QString&);
     void registerKatalog( Katalog* );
     QString catalogTypeString( const QString& catName );
--- trunk/playground/office/kraft/src/portalview.cpp #608541:608542
@@ -75,10 +75,10 @@
 
 void PortalView::fillCatalogDetails()
 {
-    QStringList katalogNamen = KatalogMan::self()->allKatalogs();
+    QStringList katalogNamen = KatalogMan::self()->allKatalogNames();
     QString html;
 
-    html = "<h2>" + i18n("Available Catalogs") + "</h2>";
+    html = "<qt><h2>" + i18n("Available Catalogs") + "</h2>";
     html += "<p align=\"center\"><table width=\"80%\" border=\"0\">";
 
     for(QStringList::ConstIterator namesIt = katalogNamen.begin();
@@ -88,7 +88,7 @@
         html += printKatLine( katName );
     }
 
-    html += "</table></p>";
+    html += "</table></p></qt>";
 
     mCatalogBrowser->setText( html );
 }
@@ -100,7 +100,7 @@
 
 QString PortalView::printKatLine( const QString& name ) const
 {
-    QString urlName(name); //  = KURL::encode_string(name);
+    QString urlName = QStyleSheet::escape( name );
 
     kdDebug() << "Converted Katalog name: " << urlName << endl;
     QString html;
@@ -112,7 +112,7 @@
             name+"&action=open\">";
     html += i18n("Open");
     html += "</td>";
-
+#if 0
     html += "<td align=\"center\"><a href=\"http://localhost/katalog.cgi?kat="+
             name+"&action=xml\">";
     html += i18n("XML Export");
@@ -122,7 +122,7 @@
             name+"&action=delete\">";
     html += i18n("Remove");
     html += "</td>";
-
+#endif
     html += "</tr>\n";
     return html;
 }
--- trunk/playground/office/kraft/src/templkatalog.cpp #608541:608542
@@ -107,6 +107,17 @@
     return cnt;
 }
 
+int TemplKatalog::addNewTemplate( FloskelTemplate *tmpl )
+{
+  int re = -1;
+
+  if ( tmpl ) {
+    m_flosList.append( tmpl );
+    re = m_flosList.count();
+  }
+  return re;
+}
+
 int TemplKatalog::loadCalcParts( FloskelTemplate *flos )
 {
     int cnt = 0;
--- trunk/playground/office/kraft/src/templkatalog.h #608541:608542
@@ -50,6 +50,7 @@
     /** get the amount of entries in a chapter or the entire catalog */
     int getEntriesPerChapter( const QString& chapter = QString() );
 
+    int addNewTemplate( FloskelTemplate *tmpl );
 public slots:
     void writeXMLFile();
 private:
--- trunk/playground/office/kraft/src/templkatalogview.cpp #608541:608542
@@ -109,7 +109,7 @@
     if( parentItem ) {
       // try to find out which catalog is open/actual
       QString name = parentItem->text(0);
-      Katalog *k = KatalogMan::self()->getKatalog(m_katalogName);
+      Katalog *k = getKatalog( m_katalogName );
       if( k ) {
         kdDebug() << "setting catalog name " << name << endl;
         flosTempl->setChapterID(k->chapterID(name));
@@ -176,7 +176,10 @@
     TemplKatalogListView *templListView = static_cast<TemplKatalogListView*>(listview);
 
     if(m_flosDialog ){
-
+      if ( m_flosDialog->templateIsNew() ) {
+         TemplKatalog *k = static_cast<TemplKatalog*>( getKatalog( m_katalogName ) );
+        if ( k ) k->addNewTemplate( templ );
+      }
     }
 
     if( m_editListViewItem ) {
@@ -185,6 +188,7 @@
       templListView->slFreshupItem( m_editListViewItem, templ, true );
       templListView->ensureItemVisible( m_editListViewItem );
     }
+
     m_editListViewItem = 0;
     delete m_flosDialog;
     m_flosDialog = 0;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic