[Kst] branches/work/kst/1.1/kst/kst

George Staikos staikos at kde.org
Thu Jul 21 00:56:46 CEST 2005


SVN commit 437103 by staikos:

backport fix for page selection


 M  +24 -3     kst.cpp  


--- branches/work/kst/1.1/kst/kst/kst.cpp #437102:437103
@@ -1100,9 +1100,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()) {
@@ -1110,6 +1112,9 @@
       if (win && !win->view()->children().isEmpty()) {
         pages++;
       }
+      if (win == currentWin) {
+        currentPage = pages;
+      }
       it->next();
     }
     deleteIterator(it);
@@ -1118,7 +1123,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);
@@ -1127,6 +1132,8 @@
     printer.setOption("kst-plot-monochrome", ks->printing.monochrome);
     printer.setFromTo(0, 0);
     printer.setMinMax(1, pages);
+    printer.setCurrentPage(currentPage);
+    printer.setPageSelection(KPrinter::ApplicationSide);
 
     pages = 0;
     printer.addDialogPage(new KstPrintOptionsPage);
@@ -1151,6 +1158,17 @@
       ks->printing.monochrome = printer.option("kst-plot-monochrome");
       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;
@@ -1158,12 +1176,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) {


More information about the Kst mailing list