Commit 3e8c9cb3 authored by Laurent Montel's avatar Laurent Montel 😁

Add missing print preview. Very useful

parent b43920ca
......@@ -97,8 +97,8 @@ void JournalDateView::addJournal( const Akonadi::Item &j )
this, SIGNAL(editIncidence(Akonadi::Item)) );
connect( entry, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(incidenceSelected(Akonadi::Item,QDate)) );
connect( entry, SIGNAL(printJournal(KCalCore::Journal::Ptr)),
SIGNAL(printJournal(KCalCore::Journal::Ptr)) );
connect( entry, SIGNAL(printJournal(KCalCore::Journal::Ptr,bool)),
SIGNAL(printJournal(KCalCore::Journal::Ptr,bool)) );
}
Akonadi::Item::List JournalDateView::journals() const
......@@ -195,6 +195,15 @@ JournalFrame::JournalFrame( const Akonadi::Item &j,
buttonsLayout->addWidget( mPrintButton );
connect( mPrintButton, SIGNAL(clicked()), this, SLOT(printJournal()) );
mPrintPreviewButton = new QPushButton( this );
mPrintPreviewButton->setText( i18n( "Print preview" ) );
mPrintPreviewButton->setObjectName( QLatin1String("printButton") );
mPrintPreviewButton->setIcon( SmallIcon( QLatin1String("document-print-preview") ) );
mPrintPreviewButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
mPrintPreviewButton->setToolTip( i18n( "Print preview this journal entry" ) );
buttonsLayout->addWidget( mPrintPreviewButton );
connect( mPrintPreviewButton, SIGNAL(clicked()), this, SLOT(printPreviewJournal()) );
readJournal( mJournal );
mDirty = false;
setFrameStyle( QFrame::Box );
......@@ -274,7 +283,12 @@ void JournalFrame::setDirty()
void JournalFrame::printJournal()
{
emit printJournal( CalendarSupport::journal( mJournal ) );
emit printJournal( CalendarSupport::journal( mJournal ), false );
}
void JournalFrame::printPreviewJournal()
{
emit printJournal( CalendarSupport::journal( mJournal ), true );
}
void JournalFrame::readJournal( const Akonadi::Item &j )
......
......@@ -67,13 +67,14 @@ class JournalFrame : public QFrame
void deleteItem();
void editItem();
void printJournal();
void printPreviewJournal();
public Q_SLOTS:
void setIncidenceChanger( Akonadi::IncidenceChanger *changer ) { mChanger = changer; }
void setDate( const QDate &date );
Q_SIGNALS:
void printJournal( const KCalCore::Journal::Ptr &);
void printJournal( const KCalCore::Journal::Ptr &, bool preview);
void deleteIncidence( const Akonadi::Item & );
void editIncidence( const Akonadi::Item & );
void incidenceSelected( const Akonadi::Item &, const QDate & );
......@@ -91,6 +92,7 @@ class JournalFrame : public QFrame
QPushButton *mEditButton;
QPushButton *mDeleteButton;
QPushButton *mPrintButton;
QPushButton *mPrintPreviewButton;
bool mDirty;
bool mWriteInProgress;
......@@ -122,7 +124,7 @@ class JournalDateView : public KVBox
void deleteIncidence( const Akonadi::Item &journal );
void newJournal( const QDate & );
void incidenceSelected( const Akonadi::Item &, const QDate & );
void printJournal( const KCalCore::Journal::Ptr &);
void printJournal( const KCalCore::Journal::Ptr &, bool preview);
public Q_SLOTS:
void emitNewJournal();
......
......@@ -82,8 +82,8 @@ void JournalView::appendJournal( const Akonadi::Item &journal, const QDate &dt )
this, SIGNAL(newJournalSignal(QDate)) );
connect( entry, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(incidenceSelected(Akonadi::Item,QDate)) );
connect( entry, SIGNAL(printJournal(KCalCore::Journal::Ptr)),
SIGNAL(printJournal(KCalCore::Journal::Ptr)) );
connect( entry, SIGNAL(printJournal(KCalCore::Journal::Ptr,bool)),
SIGNAL(printJournal(KCalCore::Journal::Ptr,bool)) );
mEntries.insert( dt, entry );
}
......
......@@ -84,7 +84,7 @@ class EVENTVIEWS_EXPORT JournalView : public EventView
void setIncidenceChangerSignal( Akonadi::IncidenceChanger * );
void journalEdited( const Akonadi::Item &journal );
void journalDeleted( const Akonadi::Item &journal );
void printJournal( const KCalCore::Journal::Ptr & );
void printJournal( const KCalCore::Journal::Ptr &, bool preview );
protected:
void clearEntries();
......
......@@ -49,8 +49,8 @@ KOJournalView::KOJournalView( QWidget *parent )
layout->addWidget( mJournalView );
connect( mJournalView, SIGNAL(printJournal(KCalCore::Journal::Ptr)),
SLOT(printJournal(KCalCore::Journal::Ptr)) );
connect( mJournalView, SIGNAL(printJournal(KCalCore::Journal::Ptr,bool)),
SLOT(printJournal(KCalCore::Journal::Ptr,bool)) );
connect( mJournalView, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(incidenceSelected(Akonadi::Item,QDate)) );
......@@ -175,7 +175,7 @@ void KOJournalView::setCalendar( const Akonadi::ETMCalendar::Ptr &calendar )
mJournalView->setCalendar( calendar );
}
void KOJournalView::printJournal( const KCalCore::Journal::Ptr &journal )
void KOJournalView::printJournal( const KCalCore::Journal::Ptr &journal, bool preview )
{
if ( journal ) {
CalendarSupport::CalPrinter printer( this, calendar(), true );
......@@ -189,7 +189,7 @@ void KOJournalView::printJournal( const KCalCore::Journal::Ptr &journal )
const QString ss = styleSheet();
setStyleSheet( QString() );
printer.print( CalendarSupport::CalPrinterBase::Incidence,
dtStart, dtStart, selectedIncidences );
dtStart, dtStart, selectedIncidences, preview );
setStyleSheet( ss );
}
}
......
......@@ -74,7 +74,7 @@ class KOJournalView : public KOrg::BaseView
void changeIncidenceDisplay( const Akonadi::Item &incidence,
Akonadi::IncidenceChanger::ChangeType );
void setIncidenceChanger( Akonadi::IncidenceChanger *changer );
void printJournal( const KCalCore::Journal::Ptr &journal );
void printJournal( const KCalCore::Journal::Ptr &journal, bool preview );
private:
EventViews::JournalView *mJournalView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment