29 #include <tqpopupmenu.h>
32 #include <tqscrollview.h>
34 #include <tdelocale.h>
39 #include "journalentry.h"
41 #include "kojournalview.h"
42 #include "koglobals.h"
45 KOJournalView::KOJournalView(
Calendar *calendar, TQWidget *parent,
47 : KOrg::
BaseView(calendar, parent, name)
49 TQVBoxLayout*topLayout =
new TQVBoxLayout(
this );
50 topLayout->setAutoAdd(
true);
51 mSV =
new TQScrollView(
this,
"JournalScrollView" );
52 mVBox =
new TQVBox( mSV->viewport() );
53 mSV->setVScrollBarMode( TQScrollView::Auto );
54 mSV->setHScrollBarMode( TQScrollView::AlwaysOff );
55 mSV->setResizePolicy( TQScrollView::AutoOneFit );
56 mSV->addChild( mVBox );
60 KOJournalView::~KOJournalView()
64 void KOJournalView::appendJournal(
Journal*journal,
const TQDate &dt)
66 JournalDateEntry *entry = 0;
67 if ( mEntries.contains( dt ) ) {
70 entry =
new JournalDateEntry(
calendar(), mVBox );
72 entry->setIncidenceChanger( mChanger );
74 connect(
this, TQ_SIGNAL(flushEntries()),
75 entry, TQ_SIGNAL(flushEntries()) );
77 connect(
this, TQ_SIGNAL(setIncidenceChangerSignal(IncidenceChangerBase *)),
78 entry, TQ_SLOT(setIncidenceChanger( IncidenceChangerBase *)) );
80 connect(
this, TQ_SIGNAL(journalEdited(
Journal *)),
81 entry, TQ_SLOT(journalEdited(
Journal *)) );
82 connect(
this, TQ_SIGNAL(journalDeleted(
Journal *)),
83 entry, TQ_SLOT(journalDeleted(
Journal *)) );
85 connect( entry, TQ_SIGNAL(editIncidence(
Incidence *,
const TQDate &)),
87 connect( entry, TQ_SIGNAL(deleteIncidence(
Incidence *)),
90 connect( entry, TQ_SIGNAL(newJournal(
ResourceCalendar *,
const TQString &,
const TQDate &)),
91 this, TQ_SIGNAL(newJournalSignal(
ResourceCalendar *,
const TQString &,
const TQDate &)) );
92 mEntries.insert( dt, entry );
95 if ( entry && journal ) {
96 entry->addJournal( journal );
102 return mEntries.size();
109 Incidence::List eventList;
113 void KOJournalView::clearEntries()
116 TQMap<TQDate, JournalDateEntry*>::Iterator it;
117 for ( it = mEntries.begin(); it != mEntries.end(); ++it ) {
122 void KOJournalView::updateView()
124 TQMap<TQDate, JournalDateEntry*>::Iterator it;
125 for ( it = mEntries.begin(); it != mEntries.end(); ++it ) {
128 Journal::List::Iterator it1;
129 for ( it1 = journals.begin(); it1 != journals.end(); ++it1 ) {
130 it.data()->addJournal( *it1 );
135 void KOJournalView::flushView()
141 void KOJournalView::showDates(
const TQDate &start,
const TQDate &end )
149 Journal::List::ConstIterator it;
152 for ( TQDate d = start; d <= end; d = d.addDays( 1 ) ) {
154 for ( it = jnls.begin(); it != jnls.end(); ++it ) {
155 appendJournal( *it, d );
157 if ( jnls.count() < 1 ) {
159 appendJournal( 0, d );
164 void KOJournalView::showIncidences(
const Incidence::List &incidences,
const TQDate & )
168 Incidence::List::const_iterator it;
169 for ( it = incidences.constBegin(); it != incidences.constEnd(); ++it ) {
170 if ( (*it) && ( (*it)->type() ==
"Journal" ) ) {
173 appendJournal( j, j->
dtStart().date() );
179 CalPrinterBase::PrintType KOJournalView::printType()
181 return CalPrinterBase::Journallist;
184 void KOJournalView::changeIncidenceDisplay(
Incidence *incidence,
int action)
190 case KOGlobals::INCIDENCEADDED:
191 appendJournal( journal, journal->
dtStart().date() );
193 case KOGlobals::INCIDENCEEDITED:
194 emit journalEdited( journal );
196 case KOGlobals::INCIDENCEDELETED:
197 emit journalDeleted( journal );
200 kdDebug(5850) <<
"KOListView::changeIncidenceDisplay(): Illegal action " << action << endl;
205 void KOJournalView::setIncidenceChanger( IncidenceChangerBase *changer )
208 emit setIncidenceChangerSignal( changer );
211 void KOJournalView::newJournal()
213 emit newJournalSignal( 0, TQString(),
214 TQDate::currentDate() );
217 #include "kojournalview.moc"
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
virtual TQDateTime dtStart() const
virtual Incidence::List selectedIncidences()
virtual int currentDateCount()
Return number of currently shown dates.
This class provides an interface for all views being displayed within the main calendar view.
void editIncidenceSignal(Incidence *, const TQDate &)
instructs the receiver to begin editing the incidence specified in some manner.
void deleteIncidenceSignal(Incidence *)
instructs the receiver to delete the Incidence in some manner; some possibilities include automatical...
virtual Calendar * calendar()
Return calendar object of this view.