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

List:       kde-commits
Subject:    branches/work/koffice-isi
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2009-05-01 4:43:38
Message-ID: 1241153018.170366.28797.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 961927 by zachmann:

o prepare the import document/slideshow for inclusion into trunk
  activate the feature for kivio
  make it possible to load the imported file also in kivio
  remove unneeded includes
  fix coding style


 M  +4 -0      kivio/src/part/kivio.rc  
 M  +1 -1      kpresenter/part/KPrView.cpp  
 M  +1 -1      kpresenter/part/kpresenter.rc  
 M  +8 -12     libs/kopageapp/KoPADocumentStructureDocker.cpp  
 M  +14 -19    libs/kopageapp/KoPAView.cpp  


--- branches/work/koffice-isi/kivio/src/part/kivio.rc #961926:961927
@@ -39,6 +39,10 @@
             <Action name="view_snaptogrid"/>
             <Action name="view_show_guides"/>
         </Menu>
+        <Menu name="insert"><text>&amp;Insert</text>
+            <Action name="insert_variable"/> <!-- menu -->
+	        <Action name="import_document" />
+        </Menu>
         <Menu name="page">
             <Text>&amp;Page</Text>
             <Action name="page_insertpage"/>
--- branches/work/koffice-isi/kpresenter/part/KPrView.cpp #961926:961927
@@ -61,7 +61,7 @@
 
     // Change strings because in KPresenter it's called slides and not pages
     actionCollection()->action("view_masterpages")->setText(i18n("Show Master \
                Slides"));
-    actionCollection()->action("import_document")->setText(i18n("Import \
Slideshow")); +    actionCollection()->action("import_document")->setText(i18n("Import \
                Slideshow..."));
     actionCollection()->action("page_insertpage")->setText(i18n( "Insert Slide"));
     actionCollection()->action("page_insertpage")->setToolTip(i18n("Insert a new \
                slide after the current one"));
     actionCollection()->action("page_insertpage")->setWhatsThis(i18n("Insert a new \
                slide after the current one"));
--- branches/work/koffice-isi/kpresenter/part/kpresenter.rc #961926:961927
@@ -45,7 +45,7 @@
         </Menu>
         <Menu name="insert"><text>&amp;Insert</text>
             <Action name="insert_variable"/> <!-- menu -->
-	    <Action name="import_document" />
+	        <Action name="import_document" />
         </Menu>
         <Menu name="format"><text>F&amp;ormat</text>
             <Action name="format_masterpage"/> 
--- branches/work/koffice-isi/libs/kopageapp/KoPADocumentStructureDocker.cpp \
#961926:961927 @@ -26,6 +26,7 @@
 #include "KoPAView.h"
 #include "KoPAMasterPage.h"
 #include "KoPAPage.h"
+#include "KoPAOdfPageSaveHelper.h"
 #include "commands/KoPAPageInsertCommand.h"
 #include "commands/KoPAPageDeleteCommand.h"
 
@@ -44,9 +45,7 @@
 #include <kactioncollection.h>
 #include <KoShapeOdfSaveHelper.h>
 #include <KoDrag.h>
-#include "KoPAOdfPageSaveHelper.h"
-#include "KoPAPastePage.h"
-#include "KoShapePaste.h"
+#include <KoShapePaste.h>
 
 #include <KMenu>
 #include <klocale.h>
@@ -55,7 +54,6 @@
 #include <kinputdialog.h>
 #include <kmessagebox.h>
 #include <KConfigGroup>
-#include <kdebug.h>
 
 #include <QtGui/QGridLayout>
 #include <QtGui/QToolButton>
@@ -654,23 +652,22 @@
 
     // separate selected layers and selected shapes
     extractSelectedLayersAndShapes( pages, layers, shapes );
-    
+
     foreach ( KoShape* shape, layers ) {
         // Add layers to shapes
         shapes.append(shape);
     }
-    
-    if( !shapes.empty() ) {
+
+    if ( !shapes.empty() ) {
         // Copy Shapes or Layers
         KoShapeOdfSaveHelper saveHelper(shapes);
         KoDrag drag;
         drag.setOdf(KoOdf::mimeType(KoOdf::Text), saveHelper);
         drag.addToClipboard();
-
         return;
     }
-    
-    if( !pages.empty() ) {        
+
+    if ( !pages.empty() ) {
         // Copy Pages
         KoPAOdfPageSaveHelper saveHelper( m_doc, pages );
         KoDrag drag;
@@ -688,8 +685,7 @@
         KoCanvasBase* canvas = \
KoToolManager::instance()->activeCanvasController()->canvas();  KoShapeManager * \
shapeManager = canvas->shapeManager();  int zIndex = 0;
-        foreach (KoShape *shape, shapeManager->shapes())
-        {
+        foreach (KoShape *shape, shapeManager->shapes()) {
             zIndex = qMax(zIndex, shape->zIndex());
         }
         KoShapePaste paste(canvas, zIndex + 1, \
                shapeManager->selection()->activeLayer());
--- branches/work/koffice-isi/libs/kopageapp/KoPAView.cpp #961926:961927
@@ -51,7 +51,7 @@
 #include <KoShapeDeleteCommand.h>
 #include <KoCutController.h>
 #include <KoCopyController.h>
-#include "KoFilterManager.h"
+#include <KoFilterManager.h>
 
 #include "KoPADocumentStructureDocker.h"
 #include "KoShapeTraversal.h"
@@ -67,10 +67,7 @@
 #include "commands/KoPAChangeMasterPageCommand.h"
 #include "dialogs/KoPAMasterPageDialog.h"
 
-#include <KoStore.h>
-#include "KoShapeOdfSaveHelper.h"
-#include "KoFileDialog.h"
-
+#include <kfiledialog.h>
 #include <kdebug.h>
 #include <klocale.h>
 #include <kicon.h>
@@ -81,13 +78,6 @@
 #include <kparts/event.h>
 #include <kparts/partmanager.h>
 
-#include <KoXmlNS.h>
-#include <KoOdfReadStore.h>
-#include <KoOdfLoadingContext.h>
-#include "KoPALoadingContext.h"
-#include <QBuffer>
-#include <KoXmlWriter.h>
-#include <KoEmbeddedDocumentSaver.h>
 #include <kio/netaccess.h>
 
 KoPAView::KoPAView( KoPADocument *document, QWidget *parent )
@@ -289,7 +279,7 @@
         actionMenu->addAction(action);
     actionCollection()->addAction("insert_variable", actionMenu);
 
-    KAction * am = new KAction(i18n("Import document"), this);
+    KAction * am = new KAction(i18n("Import Document..."), this);
     actionCollection()->addAction("import_document", am);
     connect(am, SIGNAL(triggered()), this, SLOT(importDocument()));
 
@@ -298,8 +288,6 @@
 
 void KoPAView::importDocument()
 {
-    KoPAPastePage kpapp( m_doc,m_activePage );
-
     KFileDialog *dialog = new KFileDialog( \
KUrl("kfiledialog:///OpenDialog"),QString(), this );  dialog->setObjectName( "file \
dialog" );  dialog->setMode( KFile::File );
@@ -309,7 +297,12 @@
     else {
         dialog->setCaption(i18n("Import Document"));
     }
-    const QStringList mimeFilter = KoFilterManager::mimeFilter( \
KoDocument::readNativeFormatMimeType(), KoFilterManager::Import,                     \
KoDocument::readExtraNativeMimeTypes() ); +
+    // TODO make it possible to select also other supported types (then the default \
format) here. +    // this needs to go via the filters to get the file in the correct \
format. +    // For now we only support the native mime type
+    const QStringList mimeFilter = KoFilterManager::mimeFilter( \
KoDocument::readNativeFormatMimeType(m_doc->componentData()), KoFilterManager::Import \
/*, +                                                                \
KoDocument::readExtraNativeMimeTypes()*/ );  dialog->setMimeFilter( mimeFilter );
     if (dialog->exec() == QDialog::Accepted) {
         KUrl url(dialog->selectedUrl());
@@ -320,10 +313,12 @@
             QByteArray ba;
             ba = file.readAll();
 
+            // TODO we need to set the correct mime type as otherwise it does not \
find the correct tag when loading  QMimeData data;
-            data.setData( KoOdf::mimeType( KoOdf::Presentation ), ba);
-            KoPAPastePage paste(m_doc,m_activePage);
-            paste.paste( KoOdf::Presentation, &data );
+            data.setData( KoOdf::mimeType( m_doc->documentType() ), ba);
+            KoPAPastePage paste( m_doc,m_activePage );
+            // TODO tz: there should be feedback if there was an error reading the \
file. +            paste.paste( m_doc->documentType(), &data );
         }
         else {
             kWarning() << "open document" << url.prettyUrl() << "failed";


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

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