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

List:       kde-commits
Subject:    KDE/kdepim/kjots
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2008-11-30 22:52:24
Message-ID: 1228085544.737417.32448.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 891015 by skelly:

Disable the ignored page range option of QPrintDialog and enable the Selection option.

BUG: 158888




 M  +17 -5     kjotscomponent.cpp  


--- trunk/KDE/kdepim/kjots/kjotscomponent.cpp #891014:891015
@@ -38,6 +38,7 @@
 #include <QLabel>
 #include <QGridLayout>
 #include <QTextFrame>
+#include <QTextDocumentFragment>
 #include <QFont>
 
 #include <QFrame>
@@ -1285,13 +1286,24 @@
     //are before I setup the printer?
 
     QPrintDialog printDialog(printer, this);
+
+    QAbstractPrintDialog::PrintDialogOptions options = printDialog.enabledOptions();
+    options &= ~QAbstractPrintDialog::PrintPageRange;
+    if (activeEditor()->textCursor().hasSelection())
+      options |= QAbstractPrintDialog::PrintSelection;
+    printDialog.setEnabledOptions(options);
+
     printDialog.setWindowTitle(i18n("Send To Printer"));
-    if (printDialog.exec()) {
+    if (printDialog.exec() == QDialog::Accepted) {
         QTextDocument printDocument;
-        QTextCursor printCursor ( &printDocument );
-
-        foreach ( KJotsEntry *entry, bookshelf->selected() ) {
-            entry->generatePrintData ( &printCursor );
+        if ( printer->printRange() == QPrinter::Selection )
+        {
+            printDocument.setHtml( activeEditor()->textCursor().selection().toHtml() );
+        } else {
+            QTextCursor printCursor ( &printDocument );
+            foreach ( KJotsEntry *entry, bookshelf->selected() ) {
+                entry->generatePrintData ( &printCursor );
+            }
         }
 
         QPainter p(printer);
[prev in list] [next in list] [prev in thread] [next in thread] 

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