summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/journalentry.cpp61
-rw-r--r--korganizer/journalentry.h5
-rw-r--r--korganizer/kojournalview.cpp110
-rw-r--r--korganizer/kojournalview.h10
-rw-r--r--korganizer/koviewmanager.cpp7
-rw-r--r--korganizer/koviewmanager.h1
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp14
-rw-r--r--libkcal/calendarlocal.h1
10 files changed, 173 insertions, 38 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a62145a..697093e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -464,4 +464,5 @@ void CalendarView::init()
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 467 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
467 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 468 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index c19a5ca..7274849 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -57,4 +57,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
57 QFrame(parent) 57 QFrame(parent)
58{ 58{
59 showOnlyMode = false;
59 mCalendar = calendar; 60 mCalendar = calendar;
60 mJournal = 0; 61 mJournal = 0;
@@ -62,7 +63,28 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
62 63
63 QHBox * vb = new QHBox ( this ); 64 QHBox * vb = new QHBox ( this );
65 QPushButton * newJournal = new QPushButton( vb );
66 QIconSet icon;
67 if ( QApplication::desktop()->width() < 321 )
68 icon = SmallIcon("ko16old");
69 else
70 icon = SmallIcon("ko24old");
71 newJournal->setIconSet (icon ) ;
72 int size = newJournal->sizeHint().height();
73 newJournal->setFixedSize( size, size );
74
75
76 QPushButton * toggleJournal = new QPushButton( vb );
77 icon = SmallIcon("1updownarrow");
78 toggleJournal->setIconSet (icon ) ;
79 //int size = toggleJournal->sizeHint().height();
80 toggleJournal->setFixedSize( size * 2 /3 , size );
81
82
83
84 mTitleLabel = new QLabel(i18n("Title"),vb);
85 mTitleLabel->setMargin(2);
86 mTitleLabel->setAlignment(AlignCenter);
64 QPushButton * loadTemplate = new QPushButton( vb ); 87 QPushButton * loadTemplate = new QPushButton( vb );
65 QPushButton * saveTemplate = new QPushButton( vb ); 88 QPushButton * saveTemplate = new QPushButton( vb );
66 QIconSet icon;
67 if ( QApplication::desktop()->width() < 321 ) 89 if ( QApplication::desktop()->width() < 321 )
68 icon = SmallIcon("fileexport16"); 90 icon = SmallIcon("fileexport16");
@@ -70,5 +92,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
70 icon = SmallIcon("fileexport"); 92 icon = SmallIcon("fileexport");
71 saveTemplate->setIconSet (icon ) ; 93 saveTemplate->setIconSet (icon ) ;
72 int size = saveTemplate->sizeHint().height(); 94 //size = saveTemplate->sizeHint().height();
73 saveTemplate->setFixedSize( size, size ); 95 saveTemplate->setFixedSize( size, size );
74 if ( QApplication::desktop()->width() < 321 ) 96 if ( QApplication::desktop()->width() < 321 )
@@ -78,9 +100,4 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
78 loadTemplate->setIconSet (icon ) ; 100 loadTemplate->setIconSet (icon ) ;
79 loadTemplate->setFixedSize( size, size ); 101 loadTemplate->setFixedSize( size, size );
80
81 mTitleLabel = new QLabel(i18n("Title"),vb);
82 mTitleLabel->setMargin(2);
83 mTitleLabel->setAlignment(AlignCenter);
84
85 mEditor = new KTextEdit(this); 102 mEditor = new KTextEdit(this);
86 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); 103 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
@@ -95,4 +112,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
95 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 112 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
96 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 113 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
114 connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) );
115 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
97} 116}
98 117
@@ -152,10 +171,22 @@ void JournalEntry::slotLoadTemplate()
152void JournalEntry::setDate(const QDate &date) 171void JournalEntry::setDate(const QDate &date)
153{ 172{
173 showOnlyMode = false;
174 mDate = date;
154 writeJournal(); 175 writeJournal();
176 int id = mCalendar->defaultCalendar();
177 if ( id == 1 ) {
178 mTitleLabel->setText(KGlobal::locale()->formatDate(date));
179 } else {
180 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
181 mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")");
182 }
183}
155 184
156 mTitleLabel->setText(KGlobal::locale()->formatDate(date)); 185void JournalEntry::toggleShowJournal()
157 186{
158 187 if ( showOnlyMode )
159 mDate = date; 188 emit showJournalOnly( 0 );
189 else
190 emit showJournalOnly( mJournal );
160} 191}
161 192
@@ -167,5 +198,11 @@ void JournalEntry::setJournal(Journal *journal)
167 198
168 mEditor->setText(mJournal->description()); 199 mEditor->setText(mJournal->description());
169 200 int id = mJournal->calID();
201 if ( id > 1 ) {
202 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
203 mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")");
204 } else {
205 mTitleLabel->setText(KGlobal::locale()->formatDate(mDate));
206 }
170 mDirty = false; 207 mDirty = false;
171} 208}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index f1a1fef..85ad5df 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -49,4 +49,5 @@ class JournalEntry : public QFrame {
49 49
50 void flushEntry(); 50 void flushEntry();
51 void setShowOnly() {showOnlyMode = true;}
51 52
52 protected slots: 53 protected slots:
@@ -54,6 +55,9 @@ class JournalEntry : public QFrame {
54 void slotLoadTemplate(); 55 void slotLoadTemplate();
55 void setDirty(); 56 void setDirty();
57 void toggleShowJournal();
56 signals: 58 signals:
57 void deleteJournal(Journal *); 59 void deleteJournal(Journal *);
60 void newJournal();
61 void showJournalOnly( Journal * );
58 62
59 protected: 63 protected:
@@ -63,4 +67,5 @@ class JournalEntry : public QFrame {
63 67
64 private: 68 private:
69 bool showOnlyMode;
65 Calendar *mCalendar; 70 Calendar *mCalendar;
66 Journal *mJournal; 71 Journal *mJournal;
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index bc16037..fae59d6 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -43,9 +43,7 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
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
@@ -58,4 +56,15 @@ int KOJournalView::currentDateCount()
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()
@@ -67,31 +76,94 @@ QPtrList<Incidence> KOJournalView::selectedIncidences()
67void KOJournalView::updateConfig() 76void KOJournalView::updateConfig()
68{ 77{
69 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 78 JournalEntry* mEntry = jEntries.first();
79 while ( mEntry ) {
80 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
81 mEntry = jEntries.next();
82 }
70} 83}
71void KOJournalView::updateView() 84void KOJournalView::updateView()
72{ 85{
73 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 86 JournalEntry* mEntry = jEntries.first();
87 while ( mEntry ) {
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{
78 mEntry->flushEntry(); 96 JournalEntry* mEntry = jEntries.first();
97 while ( mEntry ) {
98 mEntry->flushEntry();
99 mEntry = jEntries.next();
100 }
79} 101}
80 102
81void KOJournalView::clearList() 103void KOJournalView::clearList()
82{ 104{
83 mEntry->clear(); 105 JournalEntry* mEntry = jEntries.first();
106 while ( mEntry ) {
107 mEntry->clear();
108 mEntry = jEntries.next();
109 }
84} 110}
85void KOJournalView::showDates(const QDate &start, const QDate &) 111void KOJournalView::newJournal()
86{ 112{
87// kdDebug() << "KOJournalView::selectDates()" << endl; 113 Journal* mJournal = new Journal;
114 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
115 mCalendar->addJournal(mJournal);
116 showDates( mDate, QDate() );
117}
88 118
89 mEntry->setDate(start); 119void KOJournalView::showOnly ( Journal* j )
120{
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}
90 162
91 Journal *j = calendar()->journal(start); 163void KOJournalView::showDates(const QDate &start, const QDate &)
92 if (j) mEntry->setJournal(j); 164{
93 else mEntry->clear(); 165 mDate = start;
94 166 QPtrList<Journal> jl = calendar()->journals4Date( start );
95// emit incidenceSelected( 0 ); 167 showList( jl );
96} 168}
97 169
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 445f940..aabf11c 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -25,4 +25,5 @@
25 25
26#include <korganizer/baseview.h> 26#include <korganizer/baseview.h>
27#include <qlayout.h>
27 28
28class JournalEntry; 29class JournalEntry;
@@ -52,4 +53,6 @@ class KOJournalView : public KOrg::BaseView
52 void deleteJournal(Journal *); 53 void deleteJournal(Journal *);
53 public slots: 54 public slots:
55 void showOnly ( Journal* );
56 void newJournal();
54 void updateView(); 57 void updateView();
55 void flushView(); 58 void flushView();
@@ -61,6 +64,11 @@ class KOJournalView : public KOrg::BaseView
61 64
62 private: 65 private:
63 JournalEntry *mEntry; 66 void showList(QPtrList<Journal> jl);
67 Calendar *mCalendar;
68 JournalEntry* getNewEntry();
69 QPtrList<JournalEntry> jEntries;
64 void keyPressEvent ( QKeyEvent * ) ; 70 void keyPressEvent ( QKeyEvent * ) ;
71 QBoxLayout *mTopLayout;
72 QDate mDate;
65 73
66}; 74};
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 5d9af6d..7b307f7 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -111,4 +111,5 @@ void KOViewManager::readSettings(KConfig *config)
111} 111}
112 112
113
113void KOViewManager::showDateView( int view, QDate date) 114void KOViewManager::showDateView( int view, QDate date)
114{ 115{
@@ -283,4 +284,10 @@ void KOViewManager::resetDateSilent( QDate date , int days )
283 mMainView->dateNavigator()->blockSignals( false ); 284 mMainView->dateNavigator()->blockSignals( false );
284} 285}
286void KOViewManager::setDefaultCalendar(int)
287{
288 if ( mJournalView && mCurrentView == mJournalView )
289 mJournalView->updateView();
290}
291
285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 292void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
286{ 293{
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 838583b..d5a8e3b 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -84,4 +84,5 @@ class KOViewManager : public QObject
84 void signalAgendaView( bool ); 84 void signalAgendaView( bool );
85 public slots: 85 public slots:
86 void setDefaultCalendar(int);
86 void slotprintWNV(); 87 void slotprintWNV();
87 void showNextView(); 88 void showNextView();
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2efa355..4652fe5 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -244,4 +244,5 @@ public:
244 */ 244 */
245 virtual Journal *journal( const QDate & ) = 0; 245 virtual Journal *journal( const QDate & ) = 0;
246 virtual QPtrList<Journal> journals4Date( const QDate & ) = 0;
246 /** 247 /**
247 Return Journal with given UID. 248 Return Journal with given UID.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 418bfca..ca64e66 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -777,10 +777,5 @@ QPtrList<Event> CalendarLocal::rawEvents()
777bool CalendarLocal::addJournal(Journal *journal) 777bool CalendarLocal::addJournal(Journal *journal)
778{ 778{
779 if ( journal->dtStart().isValid()) 779 mJournalList.append(journal);
780 kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl;
781 else
782 kdDebug(5800) << "Adding Journal without a DTSTART" << endl;
783
784 mJournalList.append(journal);
785 780
786 journal->registerObserver( this ); 781 journal->registerObserver( this );
@@ -802,4 +797,11 @@ void CalendarLocal::deleteJournal( Journal *journal )
802} 797}
803 798
799QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
800{
801 QPtrList<Journal> el;
802 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
803 if ( it->calEnabled() && it->dtStart().date() == date) el.append( it );
804 return el;
805}
804Journal *CalendarLocal::journal( const QDate &date ) 806Journal *CalendarLocal::journal( const QDate &date )
805{ 807{
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index d32597f..98d16a3 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -132,4 +132,5 @@ class CalendarLocal : public Calendar
132 */ 132 */
133 Journal *journal( const QDate & ); 133 Journal *journal( const QDate & );
134 QPtrList<Journal> journals4Date( const QDate & );
134 /** 135 /**
135 Return Journal with given UID. 136 Return Journal with given UID.