summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-07 20:23:54 (UTC)
committer zautrix <zautrix>2005-06-07 20:23:54 (UTC)
commit041729646fdaabd2ed69b4fc77c839efa81a7d2e (patch) (side-by-side diff)
tree82c78d5c25d18a79a8ae76aabf75ea40b91c26f2 /korganizer
parentaa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4 (diff)
downloadkdepimpi-041729646fdaabd2ed69b4fc77c839efa81a7d2e.zip
kdepimpi-041729646fdaabd2ed69b4fc77c839efa81a7d2e.tar.gz
kdepimpi-041729646fdaabd2ed69b4fc77c839efa81a7d2e.tar.bz2
print list added to kopi
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp82
-rw-r--r--korganizer/kolistview.h3
2 files changed, 85 insertions, 0 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bc52281..7022e02 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -36,2 +36,4 @@
#include <qregexp.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
@@ -65,2 +67,3 @@
#include "kolistview.h"
+#include "koeventviewer.h"
@@ -282,3 +285,14 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
SLOT(deleteAll()),true);
+#ifdef DESKTOP_VERSION
+ mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ i18n("Hide all selected"),this,
+ SLOT(hideAll()),true);
+#endif
+ mPopupMenu->insertSeparator();
+#ifdef DESKTOP_VERSION
+ mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ i18n("Print complete list"),this,
+ SLOT(printList()),true);
mPopupMenu->insertSeparator();
+#endif
QPopupMenu * exportPO = new QPopupMenu ( this );
@@ -724,2 +738,23 @@ void KOListView::writeToFile( bool iCal )
}
+void KOListView::hideAll()
+{
+ QPtrList<QListViewItem> delSel ;
+ QListViewItem *item = mListView->firstChild ();
+ while ( item ) {
+ if ( item->isSelected() ) {
+ delSel.append(item);
+ }
+ item = item->nextSibling();
+ }
+ item = delSel.first() ;
+ while ( item ) {
+ QListViewItem * del = item;
+ item = delSel.next();
+ delete del;
+ }
+}
+void KOListView::printList()
+{
+ mListView->printList();
+}
void KOListView::deleteAll()
@@ -1289 +1324,48 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
+#define protected public
+#include <qheader.h>
+#undef protected
+void KOListViewListView::printList()
+{
+#ifdef DESKTOP_VERSION
+ KOPrintPrefs pp ( this );
+ if (!pp.exec() )
+ return;
+ int scaleval = pp.printMode() ;
+
+ QPrinter printer;
+ if (!printer.setup() )
+ return;
+ clearSelection ();
+ QPainter p;
+ p.begin ( &printer );
+ QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ float dx, dy;
+ int wid = (m.width() * 9)/10;
+ dx = (float) wid/(float)contentsWidth ();
+ dy = (float)(m.height()) / (float)contentsHeight ();
+ float scale;
+ // scale to fit the width or height of the paper
+ if ( dx < dy )
+ scale = dx;
+ else
+ scale = dy;
+
+ p.translate( m.width()/10,m.width()/10 );
+ if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
+ p.scale( scale, scale );
+ }
+
+ int cou = header()->count();
+ int iii;
+ QRect rect ( 0,0,0, header()->height());
+ for ( iii = 0; iii < cou; ++iii ) {
+ rect.setLeft ( header()->sectionPos( iii ) );
+ rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
+ header()->paintSection ( & p, header()->mapToIndex (iii), rect );
+ }
+ p.translate( 0, header()->height());
+ drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
+ p.end();
+#endif
+}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index f4d6879..c25592d 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -218,2 +218,3 @@ class KOListViewListView : public KListView
bool hasMultiSelection(QListViewItem*);
+ void printList();
signals:
@@ -268,2 +269,4 @@ class KOListView : public KOEventView
public slots:
+ void hideAll();
+ void printList();
void resetFocus();