summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2006-02-24 18:49:56 (UTC)
committer zautrix <zautrix>2006-02-24 18:49:56 (UTC)
commitd7738fdfc685192eb2f8317db6ffad3c246001c8 (patch) (unidiff)
treed9aae6ca97851fd1b53c4d9e74740a5ee2b69ea9 /korganizer
parent987757f168bbae56100f2aff763b865e81ceec18 (diff)
downloadkdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.zip
kdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.tar.gz
kdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.tar.bz2
kapi sync
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.h1
-rw-r--r--korganizer/kojournalview.cpp9
2 files changed, 10 insertions, 0 deletions
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index a69846c..ee17da8 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -35,48 +35,49 @@ class QComboBox;
35class KLineEdit; 35class KLineEdit;
36class KOLocationBox; 36class KOLocationBox;
37 37
38using namespace KCal; 38using namespace KCal;
39 39
40class JournalEntry : public QFrame { 40class JournalEntry : public QFrame {
41 Q_OBJECT 41 Q_OBJECT
42 public: 42 public:
43 JournalEntry(Calendar *,QWidget *parent); 43 JournalEntry(Calendar *,QWidget *parent);
44 virtual ~JournalEntry(); 44 virtual ~JournalEntry();
45 45
46 void setJournal(Journal *, bool saveJournal = true ); 46 void setJournal(Journal *, bool saveJournal = true );
47 Journal *journal() const; 47 Journal *journal() const;
48 48
49 void setDate(const QDate &); 49 void setDate(const QDate &);
50 50
51 void clear(); 51 void clear();
52 52
53 void flushEntry(); 53 void flushEntry();
54 void setShowOnly(); 54 void setShowOnly();
55 QSize sizeHint() const; 55 QSize sizeHint() const;
56 void setVisibleMode( bool b ) { visibleMode = b;} 56 void setVisibleMode( bool b ) { visibleMode = b;}
57 void fillCalendar( int id = 0 ); 57 void fillCalendar( int id = 0 );
58 void resizeEvent(QResizeEvent* e ) ; 58 void resizeEvent(QResizeEvent* e ) ;
59 KTextEdit * editor() {return mEditor;};
59 protected slots: 60 protected slots:
60 void slotSaveTemplate(); 61 void slotSaveTemplate();
61 void slotLoadTemplate(); 62 void slotLoadTemplate();
62 void toggleShowJournal(); 63 void toggleShowJournal();
63 void setVisibleOn(); 64 void setVisibleOn();
64 signals: 65 signals:
65 void deleteJournal(Journal *); 66 void deleteJournal(Journal *);
66 void newJournal(); 67 void newJournal();
67 void showJournalOnly( Journal * ); 68 void showJournalOnly( Journal * );
68 69
69 protected: 70 protected:
70 bool eventFilter( QObject *o, QEvent *e ); 71 bool eventFilter( QObject *o, QEvent *e );
71 72
72 void writeJournal(); 73 void writeJournal();
73 74
74 private: 75 private:
75 int mMaxWidDiff; 76 int mMaxWidDiff;
76 int mDeskWid; 77 int mDeskWid;
77 bool visibleMode; 78 bool visibleMode;
78 bool showOnlyMode; 79 bool showOnlyMode;
79 Calendar *mCalendar; 80 Calendar *mCalendar;
80 Journal *mJournal; 81 Journal *mJournal;
81 QDate mDate; 82 QDate mDate;
82 void keyPressEvent ( QKeyEvent * ) ; 83 void keyPressEvent ( QKeyEvent * ) ;
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index a23a3b2..406df5a 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -16,48 +16,49 @@
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// View of Journal entries 25// View of Journal entries
26 26
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qscrollview.h> 28#include <qscrollview.h>
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qhbox.h> 30#include <qhbox.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qapplication.h> 34#include <qapplication.h>
35 35
36#include <klocale.h> 36#include <klocale.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include "koprefs.h" 38#include "koprefs.h"
39#include <kglobal.h> 39#include <kglobal.h>
40#include <ktextedit.h>
40 41
41#include <libkcal/calendar.h> 42#include <libkcal/calendar.h>
42 43
43#include "journalentry.h" 44#include "journalentry.h"
44 45
45#include "kojournalview.h" 46#include "kojournalview.h"
46using namespace KOrg; 47using namespace KOrg;
47 48
48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 49KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
49 const char *name) 50 const char *name)
50 : KOrg::BaseView(calendar, parent, name) 51 : KOrg::BaseView(calendar, parent, name)
51{ 52{
52 mCalendar = calendar; 53 mCalendar = calendar;
53 QHBox * vb = new QHBox ( this ); 54 QHBox * vb = new QHBox ( this );
54 QPushButton * newJournal = new QPushButton( vb ); 55 QPushButton * newJournal = new QPushButton( vb );
55 QPixmap icon; 56 QPixmap icon;
56 if ( QApplication::desktop()->width() < 321 ) 57 if ( QApplication::desktop()->width() < 321 )
57 icon = SmallIcon("ko16old"); 58 icon = SmallIcon("ko16old");
58 else 59 else
59 icon = SmallIcon("ko24old"); 60 icon = SmallIcon("ko24old");
60 newJournal->setPixmap (icon ) ; 61 newJournal->setPixmap (icon ) ;
61 int size = newJournal->sizeHint().height(); 62 int size = newJournal->sizeHint().height();
62 newJournal->setFixedSize( size, size ); 63 newJournal->setFixedSize( size, size );
63 mDateLabel = new QLabel ( vb ); 64 mDateLabel = new QLabel ( vb );
@@ -156,63 +157,71 @@ void KOJournalView::newJournal()
156void KOJournalView::showOnly ( Journal* j ) 157void KOJournalView::showOnly ( Journal* j )
157{ 158{
158 //qDebug("showOnly %x ", j); 159 //qDebug("showOnly %x ", j);
159 flushView(); 160 flushView();
160 if ( j == 0 ) { 161 if ( j == 0 ) {
161 showDates( mDate, QDate() ); 162 showDates( mDate, QDate() );
162 return; 163 return;
163 } 164 }
164 QPtrList<Journal> jl; 165 QPtrList<Journal> jl;
165 jl.append ( j ); 166 jl.append ( j );
166 showList( jl ); 167 showList( jl );
167 JournalEntry* mEntry = jEntries.first(); 168 JournalEntry* mEntry = jEntries.first();
168 mEntry->setShowOnly(); 169 mEntry->setShowOnly();
169} 170}
170void KOJournalView::showList(QPtrList<Journal> jl) 171void KOJournalView::showList(QPtrList<Journal> jl)
171{ 172{
172 static bool ff = false; 173 static bool ff = false;
173 if ( ff ) return; 174 if ( ff ) return;
174 ff = true; 175 ff = true;
175 //qDebug("KOJournalView::showList %d",jl.count() ); 176 //qDebug("KOJournalView::showList %d",jl.count() );
176 JournalEntry* mEntry = jEntries.first(); 177 JournalEntry* mEntry = jEntries.first();
177 JournalEntry* firstEntry = mEntry; 178 JournalEntry* firstEntry = mEntry;
178 int count = jl.count(); 179 int count = jl.count();
179 int iii = 0; 180 int iii = 0;
181 QWidget* fw = qApp->focusWidget ();
180 while ( iii < count ) { 182 while ( iii < count ) {
181 if ( !mEntry ) { 183 if ( !mEntry ) {
182 mEntry = getNewEntry(); 184 mEntry = getNewEntry();
183 mEntry->setVisibleMode( true ); 185 mEntry->setVisibleMode( true );
184 mEntry->setDate(mDate); 186 mEntry->setDate(mDate);
185 mEntry->setJournal(jl.at(iii), false); 187 mEntry->setJournal(jl.at(iii), false);
186 mEntry->setVisibleMode( true ); 188 mEntry->setVisibleMode( true );
187 mEntry->show(); 189 mEntry->show();
188 mEntry = 0; 190 mEntry = 0;
189 } else { 191 } else {
192 int xxx = -1, yyy = -1;
193 if ( ((QWidget*) mEntry->editor() ) == fw ) {
194 mEntry->editor()->getCursorPosition( &xxx,&yyy);
195 }
190 mEntry->setVisibleMode( true ); 196 mEntry->setVisibleMode( true );
191 mEntry->setDate(mDate); 197 mEntry->setDate(mDate);
192 mEntry->setJournal(jl.at(iii), false); 198 mEntry->setJournal(jl.at(iii), false);
193 mEntry->setVisibleMode( true ); 199 mEntry->setVisibleMode( true );
194 mEntry->show(); 200 mEntry->show();
201 if ( xxx > -1 && yyy > -1 ) {
202 mEntry->editor()->setCursorPosition( xxx, yyy );
203 }
195 mEntry = jEntries.next(); 204 mEntry = jEntries.next();
196 } 205 }
197 ++iii; 206 ++iii;
198 } 207 }
199 while ( mEntry ) { 208 while ( mEntry ) {
200 mEntry->setDate(mDate); 209 mEntry->setDate(mDate);
201 mEntry->clear(); 210 mEntry->clear();
202 if ( mEntry != firstEntry ) { 211 if ( mEntry != firstEntry ) {
203 mEntry->hide(); 212 mEntry->hide();
204 mEntry->setVisibleMode( false ); 213 mEntry->setVisibleMode( false );
205 } 214 }
206 else { 215 else {
207 mEntry->setVisibleMode( true ); 216 mEntry->setVisibleMode( true );
208 mEntry->show(); 217 mEntry->show();
209 } 218 }
210 mEntry = jEntries.next(); 219 mEntry = jEntries.next();
211 } 220 }
212 ff = false; 221 ff = false;
213} 222}
214 223
215void KOJournalView::showDates(const QDate &start, const QDate &) 224void KOJournalView::showDates(const QDate &start, const QDate &)
216{ 225{
217 mDate = start; 226 mDate = start;
218 mDateLabel->setText(KGlobal::locale()->formatDate(mDate)); 227 mDateLabel->setText(KGlobal::locale()->formatDate(mDate));