OSSP CVS Repository

ossp - Check-in [4082]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4082
Date: 2003-Feb-25 10:29:31 (local)
2003-Feb-25 09:29:31 (UTC)
User:ms
Branch:
Comment: Hook in number dialog for arbitrary weeks and months user entry, add postscript printing, remove 'both' button, and fix detailed and total calculating algorhythms. This no longer depends on a date-sorted table.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_reportpanel.cpp      1.13 -> 1.14     175 inserted, 140 deleted
ossp-pkg/as/as-gui/as_reportpanel.h      1.6 -> 1.7     6 inserted, 2 deleted

ossp-pkg/as/as-gui/as_reportpanel.cpp 1.13 -> 1.14

--- as_reportpanel.cpp   2003/02/24 17:39:04     1.13
+++ as_reportpanel.cpp   2003/02/25 09:29:31     1.14
@@ -40,10 +40,14 @@
 #include <qwhatsthis.h>
 #include <qtextstream.h>
 #include <qfiledialog.h>
+#include <qprinter.h>
+#include <qpaintdevicemetrics.h>
+#include <qpainter.h>
 #include <qfile.h>
 #include <qdir.h>
 
 #include "as_reportpanel.h"
+#include "as_numdial.h"
 #include "as_table.h"
 #include "as_pref.h"
 #include "as_generic.h"
@@ -63,7 +67,7 @@
 // name 'kszName' and widget flags set to 'Flags'.
 //
 // The dialog will by default be modal, unless you set 'bModal' to
-// true to construct a modal dialog.
+// false to construct a modeless dialog.
 //
 Reportpanel::Reportpanel(TiTable *pTable, Preferences *pPreferences,
                          QWidget *pParent, const char *kszName,
@@ -74,7 +78,7 @@
     if (!kszName)
         this->setName("Reportpanel");
 
-    // Make Panel resizeable
+    // Make panel resizeable
     this->setSizeGripEnabled(true);
     this->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
         (QSizePolicy::SizeType)5, 0, 0, this->sizePolicy().hasHeightForWidth()));
@@ -83,6 +87,7 @@
     m_pReptable = pTable;
 //    m_pReptable->sortColumn(TITRAQ_IDXDATE, true, true);
     m_pReprefs  = pPreferences;
+    m_pPrinter  = new QPrinter;
 
     // Preset number of weeks and months to report
     m_nWeeks = m_pReprefs->getNumber(TITRAQ_PREFREPORTWEEKS, TITRAQ_DEFREPORTWEEKS);
@@ -119,10 +124,6 @@
     m_pMonthlybutt->setPaletteBackgroundColor(QColor(198, 196, 186));
     m_pMonthlybutt->setCursor(QCursor(13));
     m_pMonthlybutt->setToggleButton(true);
-    m_pBothbutt = new QToolButton(m_pWeekmonthgroup, "Bothbutton");
-    m_pBothbutt->setPaletteBackgroundColor(QColor(198, 196, 186));
-    m_pBothbutt->setCursor(QCursor(13));
-    m_pBothbutt->setToggleButton(true);
 
     // Popup for number of weeks
     m_pWeekpop = new QPopupMenu(this);
@@ -134,10 +135,14 @@
     m_pWeekpop->insertItem(trUtf8("Four weeks"), this, SLOT(reportWeeks(int)));
     m_pWeekpop->insertItem(trUtf8("N... weeks"), this, SLOT(reportWeeks(int)));
     m_pWeekpop->setCheckable(true);
-    m_pWeekpop->setItemChecked(m_pWeekpop->idAt(m_nWeeks - 1), true);
     m_pWeeklybutt->setPopup(m_pWeekpop);
     m_pWeeklybutt->setPopupDelay(TITRAQ_POPUPMSECS);
 
+    { // Initialize check button correctly
+        int nPosition = (m_nWeeks < m_pWeekpop->count()) ? m_nWeeks : m_pWeekpop->count();
+        m_pWeekpop->setItemChecked(m_pWeekpop->idAt(--nPosition), true);
+    }
+
     // Popup for number of months
     m_pMonthpop = new QPopupMenu(this);
     if (m_pMonthpop == NULL) // Sanity check
@@ -148,14 +153,17 @@
     m_pMonthpop->insertItem(trUtf8("Four months"), this, SLOT(reportMonths(int)));
     m_pMonthpop->insertItem(trUtf8("N... months"), this, SLOT(reportMonths(int)));
     m_pMonthpop->setCheckable(true);
-    m_pMonthpop->setItemChecked(m_pMonthpop->idAt(m_nMonths - 1), true);
     m_pMonthlybutt->setPopup(m_pMonthpop);
     m_pMonthlybutt->setPopupDelay(TITRAQ_POPUPMSECS);
 
+    { // Initialize check button correctly
+        int nPosition = (m_nMonths < m_pMonthpop->count()) ? m_nMonths : m_pMonthpop->count();
+        m_pMonthpop->setItemChecked(m_pMonthpop->idAt(--nPosition), true);
+    }
+
     // Add our tool buttons
     m_pWeekmonthlay->addWidget(m_pWeeklybutt);
     m_pWeekmonthlay->addWidget(m_pMonthlybutt);
-    m_pWeekmonthlay->addWidget(m_pBothbutt);
     m_pToolay->addWidget(m_pWeekmonthgroup);
 
     // Push button suite
@@ -166,17 +174,24 @@
     m_pDismissbutt->setPaletteBackgroundColor(QColor(198, 196, 186));
     m_pDismissbutt->setCursor(QCursor(13));
     m_pDismissbutt->setDefault(true);
+    m_pPrintbutt = new QPushButton(this, "Printbutton");
+    m_pPrintbutt->setPaletteBackgroundColor(QColor(198, 196, 186));
+    m_pPrintbutt->setCursor(QCursor(13));
+#ifdef QT_NO_PRINTER
+    m_pPrintbutt->setEnabled(false);
+#endif
     m_pPushlay->addWidget(m_pSavebutt);
+    m_pPushlay->addWidget(m_pPrintbutt);
     m_pPushlay->addWidget(m_pDismissbutt);
 
     // Connect signals to slots, accept() and reject() are Qt implicit
     connect(m_pWeeklybutt, SIGNAL(clicked(void)), SLOT(reportWeeks(void)));
     connect(m_pMonthlybutt, SIGNAL(clicked(void)), SLOT(reportMonths(void)));
-    connect(m_pBothbutt, SIGNAL(clicked(void)), SLOT(reportBoth(void)));
     connect(m_pDismissbutt, SIGNAL(clicked(void)), SLOT(accept(void)));
     connect(m_pSavebutt, SIGNAL(clicked(void)), SLOT(saveReport(void)));
-    this->textChange();
+    connect(m_pPrintbutt, SIGNAL(clicked(void)), SLOT(printReport(void)));
     this->resize(QSize(464, 332).expandedTo(minimumSizeHint()));
+    this->textChange();
 }
 
 //
@@ -196,10 +211,6 @@
         this->reportMonths(1);
         m_pWeekmonthgroup->setButton(TITRAQ_REPORTMONTH);
         break;
-    case TITRAQ_REPORTBOTH:
-        this->reportBoth(1);
-        m_pWeekmonthgroup->setButton(TITRAQ_REPORTBOTH);
-        break;
     default:
         throw Genexcept("Reportpanel: Modal event loop entered with no report period.");
         break;
@@ -224,23 +235,36 @@
     int nFirstweek, nLastweek;
 
     // Menu index, first item is always 0
-    int nIndex = m_pWeekpop->indexOf(nMenuid);
+    int nIndex = m_pWeekpop->indexOf(nMenuid);      // Corresponds to weeks
+    int nLastid = 0;                                // Last menu id selected
+
+    if (m_nWeeks < m_pWeekpop->count())
+        nLastid = m_pWeekpop->idAt(m_nWeeks - 1);   // Probably not last item
+    else
+        nLastid = m_pWeekpop->idAt(m_pWeekpop->count() - 1); // Last item selected
 
     // Set the button in case from a menu selection
     m_pWeekmonthgroup->setButton(TITRAQ_REPORTWEEK);
 
     // Update m_nWeeks only if user prefers a different number
     if (nIndex >= 0) {
-        int nLastid = m_pWeekpop->idAt(m_nWeeks - 1);
-        m_nWeeks = nIndex + 1;
-        m_pWeekpop->setItemChecked(nLastid, false);
-        m_pWeekpop->setItemChecked(nMenuid, true);
-    }
-
-    // User selected N... to indicate an arbitrary number
-    if (nIndex == m_pWeekpop->count() - 1) {
-        Prototype Unimp;
-        Unimp.doMbox();
+        // User selected N... to indicate an arbitrary number
+        if (nIndex == m_pWeekpop->count() - 1) {
+            Numdial Weeksinput;
+            Weeksinput.setNum(m_nWeeks);
+            if (Weeksinput.exec() == QDialog::Accepted) {
+                m_nWeeks = Weeksinput.getNum();
+                m_pWeekpop->setItemChecked(nLastid, false);
+                m_pWeekpop->setItemChecked(nMenuid, true);
+            }
+            else
+                return;
+        }
+        else { // User selected a preset menu item such as '2 weeks'
+            m_nWeeks = nIndex + 1;
+            m_pWeekpop->setItemChecked(nLastid, false);
+            m_pWeekpop->setItemChecked(nMenuid, true);
+        }
     }
 
     // Clear data window
@@ -276,23 +300,36 @@
     QString Firstmonth, Lastmonth;
 
     // Menu index, first item is always 0
-    int nIndex = m_pMonthpop->indexOf(nMenuid);
+    int nIndex = m_pMonthpop->indexOf(nMenuid);     // Corresponds to months
+    int nLastid = 0;                                // Last menu id selected
+
+    if (m_nMonths < m_pMonthpop->count())
+        nLastid = m_pMonthpop->idAt(m_nMonths - 1); // Probably not last item
+    else
+        nLastid = m_pMonthpop->idAt(m_pMonthpop->count() - 1); // Last item selected
 
     // Set the button in case from a menu selection
     m_pWeekmonthgroup->setButton(TITRAQ_REPORTMONTH);
 
     // Update m_nMonths only if user prefers a different number
     if (nIndex >= 0) {
-        int nLastid = m_pMonthpop->idAt(m_nMonths - 1);
-        m_nMonths = nIndex + 1;
-        m_pMonthpop->setItemChecked(nLastid, false);
-        m_pMonthpop->setItemChecked(nMenuid, true);
-    }
-
-    // User selected N... to indicate an arbitrary number
-    if (nIndex == m_pMonthpop->count() - 1) {
-        Prototype Unimp;
-        Unimp.doMbox();
+        // User selected N... to indicate an arbitrary number
+        if (nIndex == m_pMonthpop->count() - 1) {
+            Numdial Monthsinput;
+            Monthsinput.setNum(m_nMonths);
+            if (Monthsinput.exec() == QDialog::Accepted) {
+                m_nMonths = Monthsinput.getNum();
+                m_pMonthpop->setItemChecked(nLastid, false);
+                m_pMonthpop->setItemChecked(nMenuid, true);
+            }
+            else
+                return;
+        }
+        else { // User selected a preset menu item such as '2 months'
+            m_nMonths = nIndex + 1;
+            m_pMonthpop->setItemChecked(nLastid, false);
+            m_pMonthpop->setItemChecked(nMenuid, true);
+        }
     }
 
     // Clear data window
@@ -322,18 +359,6 @@
 }
 
 //
-// Makes a new monthly report of so many weeks and months
-//
-void Reportpanel::reportBoth(int nMenuid)
-{
-    // Set the button in case we arrived from a menu selection
-    m_pWeekmonthgroup->setButton(TITRAQ_REPORTBOTH);
-
-    // Placeholder text until we figure out what to do with this
-    m_pBrowser->setText(trUtf8("The 'both' feature is not working yet."));
-}
-
-//
 // Writes a report header to the display window
 //
 void Reportpanel::writeHeader(int nWeeknum)
@@ -429,13 +454,13 @@
 //
 QString Reportpanel::getWeekdetails(QDate Dayref, int nWeeks)
 {
-    QString Data, Tempstring; // Output string
-    int nRows      = m_pReptable->numRows();
-    int nIter      = nRows - 1;
-    int nFirstrow  = 0;
-    int nLastrow   = 0;
+    QString Data;       // Output string
+    QString Tempstring; // Temp churning
+    int nRows = m_pReptable->numRows();
 
+    // Find range boundaries
     Q_ASSERT(nWeeks > 0);
+    QDate Tempdate;
     QDate Firstday;
     QDate Lastday;
     Firstday = Dayref.addDays(Dayref.dayOfWeek() * -1 + 1);
@@ -446,28 +471,23 @@
     Data  = trUtf8("\nDate       Hours Account details\n");
     Data += QString("---------- ----- ----------------------------------------\n");
 
-    // Find data starting the week in question
-    while (QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) >= Firstday)
-        nIter--;
-    nFirstrow = ++nIter; // The first row to operate on
-
-    // Find data ending the week in question
-    while (nIter < nRows && QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) <  Lastday)
-        nIter++;
-    nLastrow = nIter - 1; // The last row to operate on
-
     // Build the long week data string
-    for (nIter = nLastrow; nIter >= nFirstrow; nIter--) {
-        Tempstring = m_pReptable->text(nIter, TITRAQ_IDXDATE);
-        if (!Tempstring.isEmpty())
-            Data += Tempstring;
-        Tempstring = m_pReptable->text(nIter, TITRAQ_IDXAMOUNT);
-        if (!Tempstring.isEmpty())
-            Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+    for (int nIter = nRows - 1; nIter >= 0; nIter--) {
+        // Work on this tuple only if it within the reporting range
         Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
-        if (!Tempstring.isEmpty())
-            Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
-        Data += QString("\n"); // Finish off line
+        Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate);
+        if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) {
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXDATE);
+            if (!Tempstring.isEmpty())
+                Data += Tempstring;
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXAMOUNT);
+            if (!Tempstring.isEmpty())
+                Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
+            if (!Tempstring.isEmpty())
+                Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+            Data += QString("\n"); // Finish off line
+        }
     }
 
     return Data;
@@ -486,11 +506,10 @@
 
     QString Totals;                         // Data totals to return for writing
     QString Tempstring;                     // Temporary processing string
-    int nRows      = m_pReptable->numRows();
-    int nIter      = nRows - 1;
-    int nFirstrow  = 0;
-    int nLastrow   = 0;
+    QDate   Tempdate;                       // Temporary processing date
+    int     nRows = m_pReptable->numRows();
 
+    // Find range boundaries
     Q_ASSERT(nWeeks > 0);
     QDate Firstday;
     QDate Lastday;
@@ -498,20 +517,12 @@
     Firstday = Firstday.addDays((nWeeks - 1) * -7);
     Lastday  = Firstday.addDays(7 * nWeeks);
 
-    // Find data starting the week in question
-    while (QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) >= Firstday)
-        nIter--;
-    nFirstrow = ++nIter; // The first row to operate on
-
-    // Find data ending the week in question
-    while (nIter < nRows && QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) <  Lastday)
-        nIter++;
-    nLastrow = nIter - 1; // The last row to operate on
-
     // Parse the table for interesting values
-    for (nIter = nLastrow; nIter >= nFirstrow; nIter--) {
+    for (int nIter = 0; nIter < nRows; nIter++) {
+        // Work on this tuple only if it within the reporting range
         Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
-        if (!Tempstring.isEmpty()) {
+        Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate);
+        if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) {
             string Convstring = Tempstring;         // Convert to string (can't cast?)
             QTime Intable = QTime::fromString(m_pReptable->text(nIter, TITRAQ_IDXAMOUNT), Qt::ISODate);
             int nTothours = QString(Hashtasks[Convstring]).section(':', 0, 0).toInt() + Intable.hour();
@@ -545,11 +556,12 @@
 //
 QString Reportpanel::getMonthdetails(QDate Dayref, int nMonths)
 {
-    QString Data, Tempstring; // Output string
-    int nRows      = m_pReptable->numRows();
-    int nIter      = nRows - 1;
-    int nFirstrow  = 0;
-    int nLastrow   = 0;
+    QString Data;       // Output string
+    QString Tempstring; // Temp churning
+    QDate Tempdate;     // For comparing
+    QDate Firstday;     // Minimum boundary
+    QDate Lastday;      // Maximum boundary
+    int nRows = m_pReptable->numRows();
 
     // Find range boundaries
     Q_ASSERT(nMonths > 0);
@@ -557,35 +569,30 @@
     int nMonth = (Dayref.addMonths(nMonths * -1).month() + 12) % 12 + 1;
     if (nMonth > Dayref.month())
         nYear--;
-    QDate Firstday = QDate(nYear, nMonth, 1);
-    QDate Lastday  = QDate(Dayref.year(), Dayref.month(), Dayref.daysInMonth());
+    Firstday = QDate(nYear, nMonth, 1);
+    Lastday  = QDate(Dayref.year(), Dayref.month(), Dayref.daysInMonth());
 
     // Write some quick header text to the outgoing string
     Data  = trUtf8("\nDate       Hours Account details\n");
     Data += QString("---------- ----- ----------------------------------------\n");
 
-    // Find data starting the week in question
-    while (QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) >= Firstday)
-        nIter--;
-    nFirstrow = ++nIter; // The first row to operate on
-
-    // Find data ending the week in question
-    while (nIter < nRows && QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) <  Lastday)
-        nIter++;
-    nLastrow = nIter - 1; // The last row to operate on
-
     // Build the long week data string
-    for (nIter = nLastrow; nIter >= nFirstrow; nIter--) {
-        Tempstring = m_pReptable->text(nIter, TITRAQ_IDXDATE);
-        if (!Tempstring.isEmpty())
-            Data += Tempstring;
-        Tempstring = m_pReptable->text(nIter, TITRAQ_IDXAMOUNT);
-        if (!Tempstring.isEmpty())
-            Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+    for (int nIter = nRows - 1; nIter >= 0; nIter--) {
+        // Work on this tuple only if it within the reporting range
         Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
-        if (!Tempstring.isEmpty())
-            Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
-        Data += trUtf8("\n"); // Finish off line
+        Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate);
+        if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) {
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXDATE);
+            if (!Tempstring.isEmpty())
+                Data += Tempstring;
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXAMOUNT);
+            if (!Tempstring.isEmpty())
+                Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+            Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
+            if (!Tempstring.isEmpty())
+                Data += QString(TITRAQ_SEPARATORTOK) + Tempstring;
+            Data += trUtf8("\n"); // Finish off line
+        }
     }
 
     return Data;
@@ -604,10 +611,8 @@
 
     QString Totals;                         // Data totals to return for writing
     QString Tempstring;                     // Temporary processing string
-    int nRows      = m_pReptable->numRows();
-    int nIter      = nRows - 1;
-    int nFirstrow  = 0;
-    int nLastrow   = 0;
+    QDate   Tempdate;                       // Temporary processing date
+    int     nRows = m_pReptable->numRows();
 
     // Find range boundaries
     Q_ASSERT(nMonths > 0);
@@ -618,20 +623,12 @@
     QDate Firstday = QDate(nYear, nMonth, 1);
     QDate Lastday  = QDate(Dayref.year(), Dayref.month(), Dayref.daysInMonth());
 
-    // Find data starting the week in question
-    while (QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) >= Firstday)
-        nIter--;
-    nFirstrow = ++nIter; // The first row to operate on
-
-    // Find data ending the week in question
-    while (nIter < nRows && QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate) <  Lastday)
-        nIter++;
-    nLastrow = nIter - 1; // The last row to operate on
-
     // Parse the table for interesting values
-    for (nIter = nLastrow; nIter >= nFirstrow; nIter--) {
+    for (int nIter = 0; nIter < nRows; nIter++) {
+        // Work on this tuple only if it within the reporting range
         Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK);
-        if (!Tempstring.isEmpty()) {
+        Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate);
+        if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) {
             string Convstring = Tempstring;         // Convert to string (can't cast?)
             QTime Intable = QTime::fromString(m_pReptable->text(nIter, TITRAQ_IDXAMOUNT), Qt::ISODate);
             int nTothours = QString(Hashtasks[Convstring]).section(':', 0, 0).toInt() + Intable.hour();
@@ -697,19 +694,60 @@
 }
 
 //
+// Prints the currently displayed local report
+//
+void Reportpanel::printReport(void)
+{
+#ifndef QT_NO_PRINTER
+    if (m_pPrinter->setup(this)) {      // Opens printer dialog
+        m_pPrinter->setFullPage(true);  // Set our own margins
+        QPainter Paint;                 // Our painter (for pages)
+        Paint.begin(m_pPrinter);        // Paint on printer
+        Paint.setFont(m_pBrowser->font());
+        QFontMetrics Fontmetrics = Paint.fontMetrics();
+        QPaintDeviceMetrics Devmetrics(m_pPrinter); // Need width/height of printer surface
+        const int knMargin = Devmetrics.logicalDpiX() / 2;  // Half-inch margin
+        int nYpos   = knMargin;                             // Y position for each line
+        int nPageno = 1;                                    // The starting page number
+
+        for (int nIter = 0; nIter < m_pBrowser->lines() && !m_pPrinter->aborted(); nIter++) {
+            // See if there is some space on this page to paint on
+            if (nYpos + Fontmetrics.lineSpacing() > Devmetrics.height() - knMargin) {
+//                QString Printmsg(trUtf8("Printing page "))
+//                    + QString::number(++nPageno) + QString("...");
+//                m_pStatus()->message(Printmsg);             // Not in scope (crap)
+                if (!m_pPrinter->newPage()) // Start new page
+                    break;                  // Some error
+                nYpos = knMargin;           // Back to top of page
+            }
+            Paint.drawText(knMargin, nYpos, Devmetrics.width() - 2 * knMargin,
+                Fontmetrics.lineSpacing(), Qt::ExpandTabs, m_pBrowser->text(nIter));
+            nYpos += Fontmetrics.lineSpacing();
+        }
+        Paint.end(); // Send job to printer
+//        m_pStatus()->message(trUtf8("Printing completed"), 2000); // Not in scope
+    }
+//    m_pStatusBar()->message(trUtf8("Printing completed"), 2000);  // Not in scope
+#endif
+}
+
+//
 // Sets the strings of the subwidgets using the current language
 //
 void Reportpanel::textChange(void)
 {
-    this->setCaption(trUtf8("AS local report", "Local report using weekly data or monthly data or both."));
+    this->setCaption(trUtf8("AS local report", "Local report using weekly or monthly data."));
 
     // Top level push buttons associated with accept and save slots
     m_pDismissbutt->setText(trUtf8("Dismiss", "Comment for Dismissbutton"));
     QToolTip::add(m_pDismissbutt, trUtf8("Closes the report panel", "Comment for tooltip Dismissbutton"));
-    QWhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the report panel", "Comment for whatsThis Dsimissbutton"));
+    QWhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the report panel", "Comment for whatsThis Dismissbutton"));
     m_pSavebutt->setText(trUtf8("Save", "Comment for Savebutton"));
-    QToolTip::add(m_pSavebutt, trUtf8("Saves the report panel text", "Comment for tooltip Savebutton"));
-    QWhatsThis::add(m_pSavebutt, trUtf8("The save button saves the report panel text to a file", "Comment for whatsThis Savebutton"));
+    QToolTip::add(m_pSavebutt, trUtf8("Saves the report text", "Comment for tooltip Savebutton"));
+    QWhatsThis::add(m_pSavebutt, trUtf8("The save button saves the report text to a file", "Comment for whatsThis Savebutton"));
+    m_pPrintbutt->setText(trUtf8("Print", "Comment for Printbutton"));
+    QToolTip::add(m_pPrintbutt, trUtf8("Print the report text", "Comment for tooltip Printbutton"));
+    QWhatsThis::add(m_pPrintbutt, trUtf8("The print button prints the report text to a file", "Comment for whatsThis Printbutton"));
 
     // Inner tool buttons for new local report generation
     m_pWeeklybutt->setText(trUtf8("Weekly", "Comment for Weeklybutt"));
@@ -718,8 +756,5 @@
     m_pMonthlybutt->setText(trUtf8("Monthly", "Comment for Monthlybutt"));
     QToolTip::add(m_pMonthlybutt, trUtf8("Hold down for options", "Comment for tooltip Monthlybutt"));
     QWhatsThis::add(m_pMonthlybutt, trUtf8("The Monthly button makes a new monthly report.\nHold this button down to specify how many months.", "Comment for whatsThis Monthlybutt"));
-    m_pBothbutt->setText(trUtf8("Both", "Comment for Bothbutt"));
-    QToolTip::add(m_pBothbutt, trUtf8("Report with both week data and month data", "Comment for tooltip Bothbutt"));
-    QWhatsThis::add(m_pBothbutt, trUtf8("The both button makes a new report with both weekly and monthly items mixed in. Hold this button down to specify how many weeks mixed of data.", "Comment for whatsThis Bothbutt"));
 }
 } // namespace AS


ossp-pkg/as/as-gui/as_reportpanel.h 1.6 -> 1.7

--- as_reportpanel.h     2003/02/21 23:44:36     1.6
+++ as_reportpanel.h     2003/02/25 09:29:31     1.7
@@ -47,6 +47,7 @@
 class QToolButton;
 class QButtonGroup;
 class QPopupMenu;
+class QPrinter;
 
 namespace AS {
 
@@ -63,10 +64,10 @@
     QButtonGroup *m_pWeekmonthgroup;
     QToolButton  *m_pWeeklybutt;
     QToolButton  *m_pMonthlybutt;
-    QToolButton  *m_pBothbutt;
     QTextEdit    *m_pBrowser;
     QPushButton  *m_pSavebutt;
     QPushButton  *m_pDismissbutt;
+    QPushButton  *m_pPrintbutt;
 
 protected:
     QVBoxLayout *m_pFormlay;
@@ -82,16 +83,19 @@
     int          m_nMonths;
     TiTable     *m_pReptable;
     Preferences *m_pReprefs;
+#ifndef QT_NO_PRINTER
+    QPrinter    *m_pPrinter;
+#endif
 
 public slots:
     int exec(void);
 
 protected slots:
     virtual void saveReport(void);
+    virtual void printReport(void);
     virtual void textChange(void);
     virtual void reportWeeks(int nMenuid = -1);
     virtual void reportMonths(int nMenuid = -1);
-    virtual void reportBoth(int nMenuid = -1);
 
 private:
     void writeHeader(int);

CVSTrac 2.0.1