Bug 108060

Summary: printing doesn't allow page selection
Product: [Applications] kst Reporter: George Staikos <staikos>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description George Staikos 2005-06-24 15:27:55 UTC
In the printing dialog it should be possible to specify which page, pages, or 
page range to print.  The print dialog supports this but we are not working 
with it properly.  A page should correspond to a plot window/tab, in order.
Comment 1 Nicolas Brisset 2005-06-24 15:32:35 UTC
I used this in the past, and I don't remember any particular problem, except that all pages were generated, and then only selected pages sent to the printer. In the end, the result was OK but in some cases it took much longer than it should have...
Comment 2 George Staikos 2005-06-24 16:03:15 UTC
On Friday 24 June 2005 09:32, Nicolas Brisset wrote:
> ------- Additional Comments From nicolas.brisset eurocopter com  2005-06-24
> 15:32 ------- I used this in the past, and I don't remember any particular
> problem, except that all pages were generated, and then only selected pages
> sent to the printer. In the end, the result was OK but in some cases it
> took much longer than it should have...


   "Current" is not selectable.  For PDF and Postscript, "Range" is also not 
selectable but I guess that's a kdeprint limitation?  Anyway this was 
reported to me, and I'm filing on behalf of others.
Comment 3 Andrew Walker 2005-07-20 23:49:12 UTC
SVN commit 437079 by arwalker:

BUG:108060 No longer use deprecated methods. Allow user to select current page. Use application side page selection for efficiency with KDE version 3.3 and above.

 M  +27 -6     kst.cpp  


--- trunk/extragear/graphics/kst/kst/kst.cpp #437078:437079
@@ -1190,9 +1190,11 @@
 }
 
 void KstApp::slotFilePrint() {
+  KstViewWindow *currentWin = dynamic_cast<KstViewWindow*>(activeWindow());
   KstViewWindow *win;
+  int currentPage = 0;  
   int pages = 0;
-
+  
   KMdiIterator<KMdiChildView*> *it = createIterator();
   if (it) {
     while (it->currentItem()) {
@@ -1200,6 +1202,9 @@
       if (win && !win->view()->children().isEmpty()) {
         pages++;
       }
+      if (win == currentWin) {
+        currentPage = pages;
+      }
       it->next();
     }
     deleteIterator(it);
@@ -1208,7 +1213,7 @@
   if (pages > 0) {
     KPrinter printer;
     KstSettings *ks = KstSettings::globalSettings();
-
+        
     printer.setOption("kde-pagesize", ks->printing.pageSize);
     printer.setOption("kde-orientation", ks->printing.orientation);
     printer.setOption("kst-plot-datetime-footer", ks->printing.plotDateTimeFooter);
@@ -1231,6 +1236,8 @@
 
     printer.setFromTo(0, 0);
     printer.setMinMax(1, pages);
+    printer.setCurrentPage(currentPage);
+    printer.setPageSelection(KPrinter::ApplicationSide);
 
     pages = 0;
     printer.addDialogPage(new KstPrintOptionsPage);
@@ -1238,9 +1245,9 @@
       QPainter paint(&printer);
       QPaintDeviceMetrics metrics(&printer);
       QSize size(metrics.width(), metrics.height());
-      int iFromPage = printer.fromPage();
-      int iToPage = printer.toPage();
-      bool datetimeFooter, maintainAspectRatio, monochrome;
+      bool datetimeFooter;
+      bool maintainAspectRatio;
+      bool monochrome;
       int lineAdjust;
       // additional monochrome options
       bool enhanceReadability;
@@ -1327,6 +1334,17 @@
 
       ks->save();
 
+#if KDE_VERSION <= KDE_MAKE_VERSION(3,3,0)
+      int iFromPage = printer.fromPage();
+      int iToPage = printer.toPage();
+      
+      if (iFromPage == 0 && iToPage == 0) {
+        printer.setPageSelection(KPrinter::SystemSide);
+      }
+#else
+      QValueList<int> pageList = printer.pageList();
+#endif
+      
       it = createIterator();
       if (it) {
         bool firstPage = true;
@@ -1334,12 +1352,15 @@
           win = dynamic_cast<KstViewWindow*>(it->currentItem());
           if (win && !win->view()->children().isEmpty()) {
             pages++;
+#if KDE_VERSION <= KDE_MAKE_VERSION(3,3,0)
             if ((iFromPage == 0 && iToPage == 0) ||
                 (iFromPage <= pages && iToPage >= pages)) {
+#else
+            if (pageList.contains(pages)) {                   
+#endif
               if (!firstPage && !printer.newPage()) {
                 break;
               }
-
               KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(win->view());
               if (tlv) {
                 if (lineAdjust != 0) {
Comment 4 Andrew Walker 2005-07-20 23:50:09 UTC
SVN commit 437080 by arwalker:

CCBUG:108060 Modify KDE version requirement.

 M  +2 -2      kst.cpp  


--- trunk/extragear/graphics/kst/kst/kst.cpp #437079:437080
@@ -1334,7 +1334,7 @@
 
       ks->save();
 
-#if KDE_VERSION <= KDE_MAKE_VERSION(3,3,0)
+#if KDE_VERSION < KDE_MAKE_VERSION(3,3,0)
       int iFromPage = printer.fromPage();
       int iToPage = printer.toPage();
       
@@ -1352,7 +1352,7 @@
           win = dynamic_cast<KstViewWindow*>(it->currentItem());
           if (win && !win->view()->children().isEmpty()) {
             pages++;
-#if KDE_VERSION <= KDE_MAKE_VERSION(3,3,0)
+#if KDE_VERSION < KDE_MAKE_VERSION(3,3,0)
             if ((iFromPage == 0 && iToPage == 0) ||
                 (iFromPage <= pages && iToPage >= pages)) {
 #else
Comment 5 Peter Kümmel 2010-08-14 14:40:40 UTC
Change version to 1.x