-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 19 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
5 files changed, 30 insertions, 2 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index b2dd266..cf56fcf 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -233,16 +233,18 @@ void KOViewManager::updateWNview() void KOViewManager::showWhatsNextView() { if (!mWhatsNextView) { mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::WhatsNextView"); mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); addView(mWhatsNextView); + connect(this, SIGNAL( printWNV() ), + mWhatsNextView, SLOT( printMe() ) ); } globalFlagBlockAgenda = 1; showView(mWhatsNextView, true ); //mWhatsNextView->updateView(); } void KOViewManager::showListView() diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 26b22be..6f76e2c 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -73,16 +73,18 @@ class KOViewManager : public QObject void addView(KOrg::BaseView *); Incidence *currentSelection(); QDate currentSelectionDate(); KOAgendaView *agendaView() const { return mAgendaView; } + signals: + void printWNV(); public slots: void showWhatsNextView(); void showListView(); void showAgendaView( bool fullScreen = false ); void showDayView(); void showWorkWeekView(); void showWeekView(); void showNextXView(); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 5f14bfa..219f7c3 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -106,17 +106,33 @@ int KOWhatsNextView::currentDateCount() QPtrList<Incidence> KOWhatsNextView::selectedIncidences() { QPtrList<Incidence> eventList; return eventList; } - +void KOWhatsNextView::printMe() +{ +#ifdef DESKTOP_VERSION + QPrinter printer; + if (!printer.setup() ) + return; + QTextBrowser tb; + tb.setFixedSize( 600, 4000 ); + QPainter::redirect ( tb.viewport(), &printer ); + updateView(); + tb.setText( mText ); + tb.show(); + tb.repaint(); + tb.hide(); + KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished.")); +#endif +} void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOWhatsNextView::updateConfig() @@ -669,16 +685,17 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) { mEventViewer = v; } // TODO: Create this function in CalendarView and remove it from here void KOWhatsNextView::showIncidence(const QString &uid) { + if ( !mEventViewer ) { qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); return; } //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); if (uid.startsWith("event:")) { #ifdef DESKTOP_VERSION diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index 9049268..0231cf2 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h @@ -24,16 +24,18 @@ #include <korganizer/baseview.h> class QListView; class QLabel; class KOEventViewerDialog; +#include <qpainter.h> +#include <qwidget.h> class WhatsNextTextBrowser : public QTextBrowser { Q_OBJECT public: WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} void setSource(const QString &); signals: @@ -59,16 +61,17 @@ class KOWhatsNextView : public KOrg::BaseView DateList selectedDates() {DateList q; return q;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); public slots: virtual void updateView(); + void printMe(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void updateConfig(); void changeEventDisplay(Event *, int); protected: bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6bc5b3a..def8431 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -840,17 +840,21 @@ void MainWindow::initActions() action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( printCal() ) ); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), - this, SLOT( printSel() ) ); + this, SLOT( printSel() ) ); + action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); + action->addTo( importMenu ); + connect( action, SIGNAL( activated() ), + mView->viewManager(), SIGNAL( printWNV() ) ); #endif importMenu->insertSeparator(); action = new QAction( "beam all", i18n("Save"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); action = new QAction( "beam all", i18n("Exit (+save)"), 0, this ); |