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) (side-by-side diff)
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) (ignore whitespace changes)
-rw-r--r--korganizer/kojournalview.cpp110
1 files changed, 91 insertions, 19 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,
const char *name)
: KOrg::BaseView(calendar, parent, name)
{
- mEntry = new JournalEntry(calendar,this);
- mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
- QBoxLayout *topLayout = new QVBoxLayout(this);
- topLayout->addWidget(mEntry);
- connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
+ mCalendar = calendar;
+ mTopLayout = new QVBoxLayout(this);
+ getNewEntry();
}
KOJournalView::~KOJournalView()
@@ -57,6 +55,17 @@ int KOJournalView::currentDateCount()
{
return 0;
}
+JournalEntry* KOJournalView::getNewEntry()
+{
+ JournalEntry* Entry = new JournalEntry(mCalendar,this);
+ jEntries.append( Entry );
+ mTopLayout->addWidget(Entry);
+ Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
+ connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
+ connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
+ connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
+ return Entry;
+}
QPtrList<Incidence> KOJournalView::selectedIncidences()
{
@@ -66,33 +75,96 @@ QPtrList<Incidence> KOJournalView::selectedIncidences()
}
void KOJournalView::updateConfig()
{
- mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
+ JournalEntry* mEntry = jEntries.first();
+ while ( mEntry ) {
+ mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
+ mEntry = jEntries.next();
+ }
}
void KOJournalView::updateView()
-{
- mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
+{
+ JournalEntry* mEntry = jEntries.first();
+ while ( mEntry ) {
+ mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
+ mEntry = jEntries.next();
+ }
+ showDates( mDate, QDate() );
}
void KOJournalView::flushView()
-{
- mEntry->flushEntry();
+{
+ JournalEntry* mEntry = jEntries.first();
+ while ( mEntry ) {
+ mEntry->flushEntry();
+ mEntry = jEntries.next();
+ }
}
void KOJournalView::clearList()
{
- mEntry->clear();
+ JournalEntry* mEntry = jEntries.first();
+ while ( mEntry ) {
+ mEntry->clear();
+ mEntry = jEntries.next();
+ }
}
-void KOJournalView::showDates(const QDate &start, const QDate &)
+void KOJournalView::newJournal()
{
-// kdDebug() << "KOJournalView::selectDates()" << endl;
+ Journal* mJournal = new Journal;
+ mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
+ mCalendar->addJournal(mJournal);
+ showDates( mDate, QDate() );
+}
- mEntry->setDate(start);
+void KOJournalView::showOnly ( Journal* j )
+{
+ if ( j == 0 ) {
+ showDates( mDate, QDate() );
+ return;
+ }
+ QPtrList<Journal> jl;
+ jl.append ( j );
+ showList( jl );
+ JournalEntry* mEntry = jEntries.first();
+ mEntry->setShowOnly();
+}
+void KOJournalView::showList(QPtrList<Journal> jl)
+{
+ JournalEntry* mEntry = jEntries.first();
+ JournalEntry* firstEntry = mEntry;
+ int count = jl.count();
+ int iii = 0;
+ while ( iii < count ) {
+ if ( !mEntry ) {
+ mEntry = getNewEntry();
+ mEntry->show();
+ mEntry->setDate(mDate);
+ mEntry->setJournal(jl.at(iii));
+ mEntry = 0;
+ } else {
+ mEntry->setDate(mDate);
+ mEntry->setJournal(jl.at(iii));
+ mEntry->show();
+ mEntry = jEntries.next();
+ }
+ ++iii;
+ }
+ while ( mEntry ) {
+ mEntry->setDate(mDate);
+ mEntry->clear();
+ if ( mEntry != firstEntry )
+ mEntry->hide();
+ else
+ mEntry->show();
+ mEntry = jEntries.next();
+ }
+}
- Journal *j = calendar()->journal(start);
- if (j) mEntry->setJournal(j);
- else mEntry->clear();
-
-// emit incidenceSelected( 0 );
+void KOJournalView::showDates(const QDate &start, const QDate &)
+{
+ mDate = start;
+ QPtrList<Journal> jl = calendar()->journals4Date( start );
+ showList( jl );
}
void KOJournalView::showEvents(QPtrList<Event>)