-rw-r--r-- | korganizer/journalentry.cpp | 7 | ||||
-rw-r--r-- | korganizer/journalentry.h | 2 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 11 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 1 |
4 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 7274849..0b923ad 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -47,24 +47,25 @@ | |||
47 | #include <libkcal/calendarresources.h> | 47 | #include <libkcal/calendarresources.h> |
48 | #include <libkcal/resourcecalendar.h> | 48 | #include <libkcal/resourcecalendar.h> |
49 | #include <kresources/resourceselectdialog.h> | 49 | #include <kresources/resourceselectdialog.h> |
50 | 50 | ||
51 | #include "journalentry.h" | 51 | #include "journalentry.h" |
52 | //#include "journalentry.moc" | 52 | //#include "journalentry.moc" |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 56 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
57 | QFrame(parent) | 57 | QFrame(parent) |
58 | { | 58 | { |
59 | heiHint = QApplication::desktop()->height() / 5 ; | ||
59 | showOnlyMode = false; | 60 | showOnlyMode = false; |
60 | mCalendar = calendar; | 61 | mCalendar = calendar; |
61 | mJournal = 0; | 62 | mJournal = 0; |
62 | mDirty = false; | 63 | mDirty = false; |
63 | 64 | ||
64 | QHBox * vb = new QHBox ( this ); | 65 | QHBox * vb = new QHBox ( this ); |
65 | QPushButton * newJournal = new QPushButton( vb ); | 66 | QPushButton * newJournal = new QPushButton( vb ); |
66 | QIconSet icon; | 67 | QIconSet icon; |
67 | if ( QApplication::desktop()->width() < 321 ) | 68 | if ( QApplication::desktop()->width() < 321 ) |
68 | icon = SmallIcon("ko16old"); | 69 | icon = SmallIcon("ko16old"); |
69 | else | 70 | else |
70 | icon = SmallIcon("ko24old"); | 71 | icon = SmallIcon("ko24old"); |
@@ -108,26 +109,30 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
108 | QBoxLayout *topLayout = new QVBoxLayout(this); | 109 | QBoxLayout *topLayout = new QVBoxLayout(this); |
109 | topLayout->addWidget(vb); | 110 | topLayout->addWidget(vb); |
110 | topLayout->addWidget(mEditor); | 111 | topLayout->addWidget(mEditor); |
111 | mEditor->installEventFilter(this); | 112 | mEditor->installEventFilter(this); |
112 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 113 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
113 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 114 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
114 | connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); | 115 | connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); |
115 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 116 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
116 | } | 117 | } |
117 | 118 | ||
118 | JournalEntry::~JournalEntry() | 119 | JournalEntry::~JournalEntry() |
119 | { | 120 | { |
121 | qDebug("JournalEntry::~JournalEntry() "); | ||
122 | } | ||
123 | QSize JournalEntry::sizeHint() const | ||
124 | { | ||
125 | return QSize ( 240, heiHint ); | ||
120 | } | 126 | } |
121 | |||
122 | void JournalEntry::slotSaveTemplate() | 127 | void JournalEntry::slotSaveTemplate() |
123 | { | 128 | { |
124 | QString fileName =locateLocal( "templates", "journals" ); | 129 | QString fileName =locateLocal( "templates", "journals" ); |
125 | QDir t_dir; | 130 | QDir t_dir; |
126 | if ( !t_dir.exists(fileName) ) | 131 | if ( !t_dir.exists(fileName) ) |
127 | t_dir.mkdir ( fileName ); | 132 | t_dir.mkdir ( fileName ); |
128 | fileName += "/journal"; | 133 | fileName += "/journal"; |
129 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 134 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
130 | if ( fileName.length() == 0 ) | 135 | if ( fileName.length() == 0 ) |
131 | return; | 136 | return; |
132 | 137 | ||
133 | QFile fileIn( fileName ); | 138 | QFile fileIn( fileName ); |
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index 85ad5df..b0e9cc7 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -40,41 +40,43 @@ class JournalEntry : public QFrame { | |||
40 | JournalEntry(Calendar *,QWidget *parent); | 40 | JournalEntry(Calendar *,QWidget *parent); |
41 | virtual ~JournalEntry(); | 41 | virtual ~JournalEntry(); |
42 | 42 | ||
43 | void setJournal(Journal *); | 43 | void setJournal(Journal *); |
44 | Journal *journal() const; | 44 | Journal *journal() const; |
45 | 45 | ||
46 | void setDate(const QDate &); | 46 | void setDate(const QDate &); |
47 | 47 | ||
48 | void clear(); | 48 | void clear(); |
49 | 49 | ||
50 | void flushEntry(); | 50 | void flushEntry(); |
51 | void setShowOnly() {showOnlyMode = true;} | 51 | void setShowOnly() {showOnlyMode = true;} |
52 | QSize sizeHint() const; | ||
52 | 53 | ||
53 | protected slots: | 54 | protected slots: |
54 | void slotSaveTemplate(); | 55 | void slotSaveTemplate(); |
55 | void slotLoadTemplate(); | 56 | void slotLoadTemplate(); |
56 | void setDirty(); | 57 | void setDirty(); |
57 | void toggleShowJournal(); | 58 | void toggleShowJournal(); |
58 | signals: | 59 | signals: |
59 | void deleteJournal(Journal *); | 60 | void deleteJournal(Journal *); |
60 | void newJournal(); | 61 | void newJournal(); |
61 | void showJournalOnly( Journal * ); | 62 | void showJournalOnly( Journal * ); |
62 | 63 | ||
63 | protected: | 64 | protected: |
64 | bool eventFilter( QObject *o, QEvent *e ); | 65 | bool eventFilter( QObject *o, QEvent *e ); |
65 | 66 | ||
66 | void writeJournal(); | 67 | void writeJournal(); |
67 | 68 | ||
68 | private: | 69 | private: |
69 | bool showOnlyMode; | 70 | bool showOnlyMode; |
70 | Calendar *mCalendar; | 71 | Calendar *mCalendar; |
71 | Journal *mJournal; | 72 | Journal *mJournal; |
72 | QDate mDate; | 73 | QDate mDate; |
73 | void keyPressEvent ( QKeyEvent * ) ; | 74 | void keyPressEvent ( QKeyEvent * ) ; |
74 | QLabel *mTitleLabel; | 75 | QLabel *mTitleLabel; |
75 | KTextEdit *mEditor; | 76 | KTextEdit *mEditor; |
77 | int heiHint; | ||
76 | 78 | ||
77 | bool mDirty; | 79 | bool mDirty; |
78 | }; | 80 | }; |
79 | 81 | ||
80 | #endif | 82 | #endif |
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index fae59d6..9e354d3 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -16,57 +16,64 @@ | |||
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 <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
29 | 30 | ||
30 | #include <klocale.h> | 31 | #include <klocale.h> |
31 | #include <kdebug.h> | 32 | #include <kdebug.h> |
32 | #include "koprefs.h" | 33 | #include "koprefs.h" |
33 | 34 | ||
34 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
35 | 36 | ||
36 | #include "journalentry.h" | 37 | #include "journalentry.h" |
37 | 38 | ||
38 | #include "kojournalview.h" | 39 | #include "kojournalview.h" |
39 | using namespace KOrg; | 40 | using namespace KOrg; |
40 | 41 | ||
41 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, | 42 | KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, |
42 | const char *name) | 43 | const char *name) |
43 | : KOrg::BaseView(calendar, parent, name) | 44 | : KOrg::BaseView(calendar, parent, name) |
44 | { | 45 | { |
45 | mCalendar = calendar; | 46 | mCalendar = calendar; |
46 | mTopLayout = new QVBoxLayout(this); | 47 | QScrollView * sv = new QScrollView( this ); |
48 | QHBoxLayout * hbl = new QHBoxLayout( this ); | ||
49 | hbl->addWidget( sv ); | ||
50 | parWid = new QWidget( sv->viewport() ); | ||
51 | sv->addChild(parWid); | ||
52 | sv->setResizePolicy( QScrollView:: AutoOneFit ); | ||
53 | mTopLayout = new QVBoxLayout(parWid); | ||
47 | getNewEntry(); | 54 | getNewEntry(); |
48 | } | 55 | } |
49 | 56 | ||
50 | KOJournalView::~KOJournalView() | 57 | KOJournalView::~KOJournalView() |
51 | { | 58 | { |
52 | } | 59 | } |
53 | 60 | ||
54 | int KOJournalView::currentDateCount() | 61 | int KOJournalView::currentDateCount() |
55 | { | 62 | { |
56 | return 0; | 63 | return 0; |
57 | } | 64 | } |
58 | JournalEntry* KOJournalView::getNewEntry() | 65 | JournalEntry* KOJournalView::getNewEntry() |
59 | { | 66 | { |
60 | JournalEntry* Entry = new JournalEntry(mCalendar,this); | 67 | JournalEntry* Entry = new JournalEntry(mCalendar,parWid); |
61 | jEntries.append( Entry ); | 68 | jEntries.append( Entry ); |
62 | mTopLayout->addWidget(Entry); | 69 | mTopLayout->addWidget(Entry); |
63 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 70 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
64 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; | 71 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; |
65 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; | 72 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; |
66 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; | 73 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; |
67 | return Entry; | 74 | return Entry; |
68 | } | 75 | } |
69 | 76 | ||
70 | QPtrList<Incidence> KOJournalView::selectedIncidences() | 77 | QPtrList<Incidence> KOJournalView::selectedIncidences() |
71 | { | 78 | { |
72 | QPtrList<Incidence> eventList; | 79 | QPtrList<Incidence> eventList; |
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index aabf11c..0437d95 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h | |||
@@ -60,17 +60,18 @@ class KOJournalView : public KOrg::BaseView | |||
60 | void showDates( const QDate &start, const QDate &end ); | 60 | void showDates( const QDate &start, const QDate &end ); |
61 | void showEvents(QPtrList<Event> eventList); | 61 | void showEvents(QPtrList<Event> eventList); |
62 | 62 | ||
63 | void changeEventDisplay(Event *, int); | 63 | void changeEventDisplay(Event *, int); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | void showList(QPtrList<Journal> jl); | 66 | void showList(QPtrList<Journal> jl); |
67 | Calendar *mCalendar; | 67 | Calendar *mCalendar; |
68 | JournalEntry* getNewEntry(); | 68 | JournalEntry* getNewEntry(); |
69 | QPtrList<JournalEntry> jEntries; | 69 | QPtrList<JournalEntry> jEntries; |
70 | void keyPressEvent ( QKeyEvent * ) ; | 70 | void keyPressEvent ( QKeyEvent * ) ; |
71 | QBoxLayout *mTopLayout; | 71 | QBoxLayout *mTopLayout; |
72 | QWidget *parWid; | ||
72 | QDate mDate; | 73 | QDate mDate; |
73 | 74 | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | #endif | 77 | #endif |