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

List:       koffice
Subject:    patch: KPresenter saving/loading + web
From:       Werner Trobin <wtrobin () mandrakesoft ! com>
Date:       2000-08-30 10:20:30
[Download RAW message or body]

Hi!

The handling of KPresenter's autoforms was messy. It only
saved absolute paths (which broke on other machines, of
course)! Therefore I fixed saving and added a workaround
for loading.

Another thing is that the navigation pixmaps for web-
presentations was missing. I decided that it's the best
to add a resource dir instead of concattenating paths ;)

Cristian: This also fixes the Autoforms bug in your old
presentations. I'm still working on the pixmap stuff,
because this is a bit tricky ;)

-- 
Werner Trobin - wtrobin@mandrakesoft.com
["kpresenter.diff" (text/plain)]

Index: kpautoformobject.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/kpautoformobject.cc,v
retrieving revision 1.29
diff -b -u -p -r1.29 kpautoformobject.cc
--- kpautoformobject.cc	2000/08/26 18:14:56	1.29
+++ kpautoformobject.cc	2000/08/30 10:11:07
@@ -20,6 +20,7 @@
 #include "kpautoformobject.h"
 #include "kpresenter_utils.h"
 #include "kpgradient.h"
+#include <kpresenter_factory.h>
 
 #include <qpointarray.h>
 #include <qlist.h>
@@ -162,10 +163,15 @@ void KPAutoformObject::save( QTextStream
     out << indent << "<PRESNUM value=\"" << presNum << "\"/>" << endl;
     out << indent << "<ANGLE value=\"" << angle << "\"/>" << endl;
 
-    QString afDir = locate( "autoforms", "" );
-    int len = afDir.length();
-    QString str = filename;
-    str = str.remove( 0, len );
+    QStringList afDirs = KPresenterFactory::global()->dirs()->resourceDirs("autoforms");
+    QValueList<QString>::ConstIterator it=afDirs.begin();
+    QString str;
+    for( ; it!=afDirs.end(); ++it) {
+        if(filename.startsWith(*it)) {
+            str=filename.mid((*it).length());
+            break;
+        }
+    }
     out << indent << "<FILENAME value=\"" << str << "\"/>" << endl;
     out << indent << "<FILLTYPE value=\"" << static_cast<int>( fillType ) << "\"/>" << endl;
     out << indent << "<GRADIENT red1=\"" << gColor1.red() << "\" green1=\"" << gColor1.green()
@@ -366,8 +372,12 @@ void KPAutoformObject::load( KOMLParser&
                 if ( ( *it ).m_strName == "value" )
                 {
                     filename = ( *it ).m_strValue;
-                    // huh? (Werner)
-                    QString afDir = locate( "autoforms", filename );
+                    // workaround for a bug in the old file format
+                    if(filename[0]=='/') {
+                        kdDebug() << "rubbish ahead! cleaning up..." << endl;
+                        filename=filename.mid(filename.findRev('/', filename.findRev('/')-1)+1);
+                    }
+                    filename = locate("autoforms", filename, KPresenterFactory::global());
                     atfInterp.load( filename );
                 }
             }
@@ -750,9 +760,3 @@ void KPAutoformObject::paint( QPainter* 
 
     }
 }
-
-
-
-
-
-
Index: kpresenter_factory.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/kpresenter_factory.cc,v
retrieving revision 1.26
diff -b -u -p -r1.26 kpresenter_factory.cc
--- kpresenter_factory.cc	2000/06/28 05:52:37	1.26
+++ kpresenter_factory.cc	2000/08/30 10:11:07
@@ -93,6 +93,8 @@ KInstance* KPresenterFactory::global()
 				        KStandardDirs::kde_default("data") + "kpresenter/templates/");
       s_global->dirs()->addResourceType("autoforms",
 				        KStandardDirs::kde_default("data") + "kpresenter/autoforms/");
+      s_global->dirs()->addResourceType("slideshow",
+                                        KStandardDirs::kde_default("data") + "kpresenter/slideshow/");
       // Tell the iconloader about share/apps/koffice/icons
       s_global->iconLoader()->addAppDir("koffice");
     }
Index: webpresentation.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/webpresentation.cc,v
retrieving revision 1.33
diff -b -u -p -r1.33 webpresentation.cc
--- webpresentation.cc	2000/08/06 14:34:07	1.33
+++ webpresentation.cc	2000/08/30 10:11:12
@@ -175,9 +175,9 @@ void KPWebPresentation::initCreation( KP
 
     while ( pics[ index ] ) {
         filename = pics[index] + format;
-        system( QString( "cp %1 %2/pics/%3" ).
-                arg( locate( "appdata", "slideshow/" + filename ) ).
-                arg( path ).arg( filename ).latin1() );
+        system( QFile::encodeName( QString( "cp %1 %2/pics/%3" ).
+                arg( locate( "slideshow", filename, KPresenterFactory::global() ) ).
+                arg( path ).arg( filename ) ) );
         p = progressBar->value();
         progressBar->setValue( ++p );
         kapp->processEvents();
@@ -284,7 +284,7 @@ void KPWebPresentation::createSlidesHTML
         if ( !email.isEmpty() )
             html += "</A>";
 
-        html += " - created with <A HREF=\"http://koffice.kde.org/kpresenter.html\">KPresenter</A>\n";
+        html += " - created with <A HREF=\"http://www.koffice.org/kpresenter/\">KPresenter</A>\n";
         html += "  </CENTER><HR noshade>\n";
         html += "</BODY></HTML>\n";
 



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

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