[Kst] [Bug 108060] printing doesn't allow page selection

Andrew Walker arwalker at sumusltd.com
Wed Jul 20 23:49:13 CEST 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=108060         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2005-07-20 23:49 -------
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) {


More information about the Kst mailing list