summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-05 23:13:10 (UTC)
committer zautrix <zautrix>2005-01-05 23:13:10 (UTC)
commit0618fbee69bfde7f7f3c4a54b5cc45dac446abd3 (patch) (side-by-side diff)
tree5fa2e93328b3429a22e0a712f45bdc91e3da1f07 /korganizer
parented3b1be69915eaff3bfad542fd50bb18624c323e (diff)
downloadkdepimpi-0618fbee69bfde7f7f3c4a54b5cc45dac446abd3.zip
kdepimpi-0618fbee69bfde7f7f3c4a54b5cc45dac446abd3.tar.gz
kdepimpi-0618fbee69bfde7f7f3c4a54b5cc45dac446abd3.tar.bz2
added wnv printing
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/koviewmanager.h2
-rw-r--r--korganizer/kowhatsnextview.cpp19
-rw-r--r--korganizer/kowhatsnextview.h3
-rw-r--r--korganizer/mainwindow.cpp4
5 files changed, 29 insertions, 1 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index b2dd266..cf56fcf 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -217,48 +217,50 @@ void KOViewManager::updateView()
void KOViewManager::updateView(const QDate &start, const QDate &end)
{
// kdDebug() << "KOViewManager::updateView()" << endl;
if (mCurrentView) mCurrentView->showDates(start, end);
if (mTodoView) mTodoView->updateView();
}
void KOViewManager::updateWNview()
{
if ( mCurrentView == mWhatsNextView && mWhatsNextView )
mWhatsNextView->updateView();
}
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()
{
if (!mListView) {
mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
addView(mListView);
connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
connect( mListView, SIGNAL( signalNewEvent() ),
mMainView, SLOT( newEvent() ) );
connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 26b22be..6f76e2c 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -57,48 +57,50 @@ class KOViewManager : public QObject
void readSettings(KConfig *config);
void writeSettings(KConfig *config);
bool showsNextDays();
/** Read which view was shown last from config file */
void readCurrentView(KConfig *);
/** Write which view is currently shown to config file */
void writeCurrentView(KConfig *);
KOrg::BaseView *currentView();
void setDocumentId( const QString & );
void updateView();
void updateView( const QDate &start, const QDate &end );
void raiseCurrentView( bool fullScreen = false );
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();
void showMonthView();
void showTodoView();
void showJournalView();
void showTimeSpanView();
private:
CalendarView *mMainView;
int mCurrentAgendaView;
KOAgendaView *mAgendaView;
KOListView *mListView;
KOMonthView *mMonthView;
KOTodoView *mTodoView;
KOWhatsNextView *mWhatsNextView;
KOJournalView *mJournalView;
KOTimeSpanView *mTimeSpanView;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 5f14bfa..219f7c3 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -90,49 +90,65 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
}
KOWhatsNextView::~KOWhatsNextView()
{
}
int KOWhatsNextView::maxDatesHint()
{
return 0;
}
int KOWhatsNextView::currentDateCount()
{
return 0;
}
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()
{
setFont( KOPrefs::instance()->mWhatsNextFont );
updateView();
}
void KOWhatsNextView::showEvent ( QShowEvent * e )
{
//qDebug("KOWhatsNextView::showEvent ");
restartTimer();
QWidget::showEvent ( e );
}
void KOWhatsNextView::hideEvent ( QHideEvent * e)
{
//qDebug(" KOWhatsNextView::hideEvent");
mTimer->stop();
QWidget::hideEvent ( e );
@@ -653,48 +669,49 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
if (!((Todo*)to)->isCompleted())
appendTodo( to, ind , true );
}
return true;
}
/*
void KOWhatsNextView::createEventViewer()
{
if (!mEventViewer) {
mEventViewer = new KOEventViewerDialog(this);
}
}
*/
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
Event *event = calendar()->event(uid.mid(8));
#else
Event *event = calendar()->event(uid.mid(6));
#endif
//qDebug("event %d uid %s ", event, uid.mid(6).latin1());
if (!event) return;
//createEventViewer();
mEventViewer->setEvent(event);
} else if (uid.startsWith("todo:")) {
#ifdef DESKTOP_VERSION
Todo *todo = calendar()->todo(uid.mid(7));
#else
Todo *todo = calendar()->todo(uid.mid(5));
#endif
if (!todo) return;
//createEventViewer();
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 9049268..0231cf2 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -8,83 +8,86 @@
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOWHATSNEXTVIEW_H
#define KOWHATSNEXTVIEW_H
#include <qtextbrowser.h>
#include <qtimer.h>
#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:
void showIncidence(const QString &uid);
};
/**
This class provides a view of the next events and todos
*/
class KOWhatsNextView : public KOrg::BaseView
{
Q_OBJECT
public:
KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOWhatsNextView();
virtual int maxDatesHint();
virtual int currentDateCount();
void setEventViewer(KOEventViewerDialog* v );
virtual QPtrList<Incidence> selectedIncidences();
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 );
void appendDay( int i, QDate date );
QDate mEventDate;
virtual void showEvent ( QShowEvent * );
virtual void hideEvent ( QHideEvent * );
private slots:
void showIncidence(const QString &);
void restartTimer();
private:
//void createEventViewer();
QTimer* mTimer;
QTextBrowser *mView;
QString mText;
// QLabel *mDateLabel;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 6bc5b3a..def8431 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -825,48 +825,52 @@ void MainWindow::initActions()
connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
#else
importMenu->insertSeparator();
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
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() ) );
+ 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 );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
//menuBar->insertItem( "Configure",configureMenu );
//configureMenu->insertItem( "Toolbar",configureToolBarMenu );
icon = loadPixmap( "korganizer/korganizer" );
action = new QAction( "Whats New", i18n("What's new?"), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( whatsNew() ) );
action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( features() ) );
action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );