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

List:       kde-commits
Subject:    extragear/graphics/kipi-plugins/printwizard (silent)
From:       Angelo Naselli <anaselli () linux ! it>
Date:       2008-11-08 22:54:31
Message-ID: 1226184871.936554.32434.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 881748 by anaselli:

SVN_SILENT: another little step on

 M  +2 -8      plugin_printwizard.cpp  
 M  +38 -10    wizard.cpp  
 M  +1 -0      wizard.h  


--- trunk/extragear/graphics/kipi-plugins/printwizard/plugin_printwizard.cpp \
#881747:881748 @@ -32,25 +32,22 @@
 }
 
 // Qt includes.
-
 #include <QWidget>
 
 // KDE includes.
-
 #include <kaction.h>
 #include <kactioncollection.h>
 #include <kapplication.h>
 #include <kgenericfactory.h>
 #include <kmessagebox.h>
+#include <kstandarddirs.h>
 
 // LibKIPI includes.
-
 #include <libkipi/imagecollection.h>
 #include <libkipi/interface.h>
 #include <libkipi/plugin.h>
 
 // Local includes
-
 #include "wizard.h"
 
 K_PLUGIN_FACTORY( PrintAssistantFactory, registerPlugin<Plugin_PrintWizard>(); )
@@ -111,13 +108,10 @@
 
     QWidget* parent=QApplication::activeWindow();
     KIPIPrintWizardPlugin::Wizard printWizard(parent, m_interface);
-    if (printWizard.exec()==QDialog::Rejected) return;
-#if 0
     KStandardDirs dir;
     QString tempPath = dir.saveLocation("tmp", "kipi-printwizardplugin-" + \
QString::number(getpid()) + "/");  printWizard.print(fileList, tempPath);
-    printWizard.exec();
-#endif
+    if (printWizard.exec()==QDialog::Rejected) return;
 }
 
 KIPI::Category Plugin_PrintWizard::category( KAction* action ) const
--- trunk/extragear/graphics/kipi-plugins/printwizard/wizard.cpp #881747:881748
@@ -104,6 +104,7 @@
   QList<TPhotoSize*> m_photoSizes;
   int m_currentPreviewPage;
   int m_currentCropPhoto;
+  QString      m_tempPath;
 };
 
 enum OutputIDs
@@ -249,6 +250,33 @@
   return p;
 }
 
+void Wizard::print( KUrl::List fileList, QString tempPath)
+{
+  for(unsigned int i=0; i < d->m_photos.count(); i++)
+    if (d->m_photos.at(i))
+      delete d->m_photos.at(i);
+  d->m_photos.clear();
+  d->mPhotoPage->ListPrintOrder->clear();
+
+  for(unsigned int i=0; i < fileList.count(); i++)
+  {
+    TPhoto *photo = new TPhoto(150);
+    photo->filename = fileList[i];
+    d->m_photos.append(photo);
+    // load the print order listbox
+    d->mPhotoPage->ListPrintOrder->addItem(photo->filename.fileName());
+  }
+  d->mPhotoPage->ListPrintOrder->setCurrentItem(0);
+
+  d->m_tempPath = tempPath;
+  d->mPhotoPage->LblPhotoCount->setText(QString::number(d->m_photos.count()));
+
+  d->mCropPage->BtnCropPrev->setEnabled(false);
+
+  if (d->m_photos.count() == 1)
+    d->mCropPage->BtnCropNext->setEnabled(false);
+}
+
 // TODO page layout configurable (using XML?)
 void Wizard::initPhotoSizes(PageSize pageSize)
 {
@@ -670,7 +698,7 @@
   // load the photo sizes into the listbox
   d->mPhotoPage->ListPhotoSizes->clear();
   QList<TPhotoSize*>::iterator it;
-  for (it = d->m_photoSizes.begin(); it != d->m_photoSizes.end(); it++)
+  for (it = d->m_photoSizes.begin(); it != d->m_photoSizes.end(); ++it)
   {
     TPhotoSize *s = static_cast<TPhotoSize*>(*it);
     if (s) d->mPhotoPage->ListPhotoSizes->addItem(s->label);
@@ -695,8 +723,8 @@
     if (dpi > maxDPI)
       maxDPI = dpi;
     // iterate to the next position
-    it++;
-    layout = static_cast<QRect*>(*it);
+    ++it;
+    layout = (it == layouts.end()) ? 0 : static_cast<QRect*>(*it);
     if (layout == 0)
     {
       break;
@@ -859,7 +887,7 @@
 
   QList<QRect*>::iterator it = layouts.begin();
   QRect *srcPage = static_cast<QRect*>(*it);
-  it++;
+  ++it;
   QRect *layout = static_cast<QRect*>(*it);
 
   // scale the page size to best fit the painter
@@ -1028,8 +1056,8 @@
     } // caption
 
     // iterate to the next position
-    it++;
-    layout = static_cast<QRect*>(*it);
+    ++it;
+    layout = it == layouts.end() ? 0 : static_cast<QRect*>(*it);
     if (layout == 0)
     {
       current++;
@@ -1054,7 +1082,7 @@
 
   QList<QRect*>::iterator it = layouts.begin();
   QRect *srcPage = static_cast<QRect*>(*it);
-  it++;
+  ++it;
   QRect *layout = static_cast<QRect*>(*it);
 
   // scale the page size to best fit the painter
@@ -1220,8 +1248,8 @@
     } // caption
 
     // iterate to the next position
-    it++;
-    layout = static_cast<QRect*>(*it);
+    ++it;
+    layout = (it == layouts.end()) ? 0 : static_cast<QRect*>(*it);
     if (layout == 0)
     {
       current++;
@@ -1268,7 +1296,7 @@
   unsigned int current = 0;
   
   QList<TPhoto*>::iterator it;
-  for (it = d->m_photos.begin(); it != d->m_photos.end(); it++)
+  for (it = d->m_photos.begin(); it != d->m_photos.end(); ++it)
   {
     TPhoto *photo = static_cast<TPhoto*>(*it);
 
--- trunk/extragear/graphics/kipi-plugins/printwizard/wizard.h #881747:881748
@@ -55,6 +55,7 @@
     public:
       Wizard(QWidget* parent, KIPI::Interface*);
       ~Wizard();
+      void print( KUrl::List fileList, QString tempPath);
 
     protected slots:
       virtual void accept();


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

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