-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 @@ -51,16 +51,17 @@ #include "journalentry.h" //#include "journalentry.moc" #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : QFrame(parent) { + heiHint = QApplication::desktop()->height() / 5 ; showOnlyMode = false; mCalendar = calendar; mJournal = 0; mDirty = false; QHBox * vb = new QHBox ( this ); QPushButton * newJournal = new QPushButton( vb ); QIconSet icon; @@ -112,18 +113,22 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); } JournalEntry::~JournalEntry() { + qDebug("JournalEntry::~JournalEntry() "); +} +QSize JournalEntry::sizeHint() const +{ + return QSize ( 240, heiHint ); } - void JournalEntry::slotSaveTemplate() { QString fileName =locateLocal( "templates", "journals" ); QDir t_dir; if ( !t_dir.exists(fileName) ) t_dir.mkdir ( fileName ); fileName += "/journal"; fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index 85ad5df..b0e9cc7 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -44,16 +44,17 @@ class JournalEntry : public QFrame { Journal *journal() const; void setDate(const QDate &); void clear(); void flushEntry(); void setShowOnly() {showOnlyMode = true;} + QSize sizeHint() const; protected slots: void slotSaveTemplate(); void slotLoadTemplate(); void setDirty(); void toggleShowJournal(); signals: void deleteJournal(Journal *); @@ -68,13 +69,14 @@ class JournalEntry : public QFrame { private: bool showOnlyMode; Calendar *mCalendar; Journal *mJournal; QDate mDate; void keyPressEvent ( QKeyEvent * ) ; QLabel *mTitleLabel; KTextEdit *mEditor; + int heiHint; bool mDirty; }; #endif diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index fae59d6..9e354d3 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -20,16 +20,17 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ // // View of Journal entries #include <qlayout.h> +#include <qscrollview.h> #include <qpopupmenu.h> #include <klocale.h> #include <kdebug.h> #include "koprefs.h" #include <libkcal/calendar.h> @@ -38,31 +39,37 @@ #include "kojournalview.h" using namespace KOrg; KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { mCalendar = calendar; - mTopLayout = new QVBoxLayout(this); + QScrollView * sv = new QScrollView( this ); + QHBoxLayout * hbl = new QHBoxLayout( this ); + hbl->addWidget( sv ); + parWid = new QWidget( sv->viewport() ); + sv->addChild(parWid); + sv->setResizePolicy( QScrollView:: AutoOneFit ); + mTopLayout = new QVBoxLayout(parWid); getNewEntry(); } KOJournalView::~KOJournalView() { } int KOJournalView::currentDateCount() { return 0; } JournalEntry* KOJournalView::getNewEntry() { - JournalEntry* Entry = new JournalEntry(mCalendar,this); + JournalEntry* Entry = new JournalEntry(mCalendar,parWid); 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; } diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index aabf11c..0437d95 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -64,13 +64,14 @@ class KOJournalView : public KOrg::BaseView private: void showList(QPtrList<Journal> jl); Calendar *mCalendar; JournalEntry* getNewEntry(); QPtrList<JournalEntry> jEntries; void keyPressEvent ( QKeyEvent * ) ; QBoxLayout *mTopLayout; + QWidget *parWid; QDate mDate; }; #endif |