summaryrefslogtreecommitdiffabout
path: root/korganizer/kojournalview.cpp
authorzautrix <zautrix>2005-06-29 10:36:31 (UTC)
committer zautrix <zautrix>2005-06-29 10:36:31 (UTC)
commitb7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff)
treeb521090cfc8eb6c8c6a6f6f8167c83058ea1361b /korganizer/kojournalview.cpp
parentf226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff)
downloadkdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2
journal fixxx
Diffstat (limited to 'korganizer/kojournalview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kojournalview.cpp98
1 files changed, 85 insertions, 13 deletions
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index bc16037..fae59d6 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -42,11 +42,9 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
42 const char *name) 42 const char *name)
43 : KOrg::BaseView(calendar, parent, name) 43 : KOrg::BaseView(calendar, parent, name)
44{ 44{
45 mEntry = new JournalEntry(calendar,this); 45 mCalendar = calendar;
46 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 46 mTopLayout = new QVBoxLayout(this);
47 QBoxLayout *topLayout = new QVBoxLayout(this); 47 getNewEntry();
48 topLayout->addWidget(mEntry);
49 connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
50} 48}
51 49
52KOJournalView::~KOJournalView() 50KOJournalView::~KOJournalView()
@@ -57,6 +55,17 @@ int KOJournalView::currentDateCount()
57{ 55{
58 return 0; 56 return 0;
59} 57}
58JournalEntry* KOJournalView::getNewEntry()
59{
60 JournalEntry* Entry = new JournalEntry(mCalendar,this);
61 jEntries.append( Entry );
62 mTopLayout->addWidget(Entry);
63 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
64 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
65 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
66 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
67 return Entry;
68}
60 69
61QPtrList<Incidence> KOJournalView::selectedIncidences() 70QPtrList<Incidence> KOJournalView::selectedIncidences()
62{ 71{
@@ -66,33 +75,96 @@ QPtrList<Incidence> KOJournalView::selectedIncidences()
66} 75}
67void KOJournalView::updateConfig() 76void KOJournalView::updateConfig()
68{ 77{
78 JournalEntry* mEntry = jEntries.first();
79 while ( mEntry ) {
69 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 80 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
81 mEntry = jEntries.next();
82 }
70} 83}
71void KOJournalView::updateView() 84void KOJournalView::updateView()
72{ 85{
86 JournalEntry* mEntry = jEntries.first();
87 while ( mEntry ) {
73 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 88 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
89 mEntry = jEntries.next();
90 }
91 showDates( mDate, QDate() );
74} 92}
75 93
76void KOJournalView::flushView() 94void KOJournalView::flushView()
77{ 95{
96 JournalEntry* mEntry = jEntries.first();
97 while ( mEntry ) {
78 mEntry->flushEntry(); 98 mEntry->flushEntry();
99 mEntry = jEntries.next();
100 }
79} 101}
80 102
81void KOJournalView::clearList() 103void KOJournalView::clearList()
82{ 104{
105 JournalEntry* mEntry = jEntries.first();
106 while ( mEntry ) {
83 mEntry->clear(); 107 mEntry->clear();
108 mEntry = jEntries.next();
84} 109}
85void KOJournalView::showDates(const QDate &start, const QDate &) 110}
111void KOJournalView::newJournal()
86{ 112{
87// kdDebug() << "KOJournalView::selectDates()" << endl; 113 Journal* mJournal = new Journal;
88 114 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
89 mEntry->setDate(start); 115 mCalendar->addJournal(mJournal);
116 showDates( mDate, QDate() );
117}
90 118
91 Journal *j = calendar()->journal(start); 119void KOJournalView::showOnly ( Journal* j )
92 if (j) mEntry->setJournal(j); 120{
93 else mEntry->clear(); 121 if ( j == 0 ) {
122 showDates( mDate, QDate() );
123 return;
124 }
125 QPtrList<Journal> jl;
126 jl.append ( j );
127 showList( jl );
128 JournalEntry* mEntry = jEntries.first();
129 mEntry->setShowOnly();
130}
131void KOJournalView::showList(QPtrList<Journal> jl)
132{
133 JournalEntry* mEntry = jEntries.first();
134 JournalEntry* firstEntry = mEntry;
135 int count = jl.count();
136 int iii = 0;
137 while ( iii < count ) {
138 if ( !mEntry ) {
139 mEntry = getNewEntry();
140 mEntry->show();
141 mEntry->setDate(mDate);
142 mEntry->setJournal(jl.at(iii));
143 mEntry = 0;
144 } else {
145 mEntry->setDate(mDate);
146 mEntry->setJournal(jl.at(iii));
147 mEntry->show();
148 mEntry = jEntries.next();
149 }
150 ++iii;
151 }
152 while ( mEntry ) {
153 mEntry->setDate(mDate);
154 mEntry->clear();
155 if ( mEntry != firstEntry )
156 mEntry->hide();
157 else
158 mEntry->show();
159 mEntry = jEntries.next();
160 }
161}
94 162
95// emit incidenceSelected( 0 ); 163void KOJournalView::showDates(const QDate &start, const QDate &)
164{
165 mDate = start;
166 QPtrList<Journal> jl = calendar()->journals4Date( start );
167 showList( jl );
96} 168}
97 169
98void KOJournalView::showEvents(QPtrList<Event>) 170void KOJournalView::showEvents(QPtrList<Event>)