summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp7
-rw-r--r--korganizer/journalentry.h2
-rw-r--r--korganizer/kojournalview.cpp11
-rw-r--r--korganizer/kojournalview.h1
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 @@
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#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;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("ko16old");
else
icon = SmallIcon("ko24old");
@@ -108,26 +109,30 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
QBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->addWidget(vb);
topLayout->addWidget(mEditor);
mEditor->installEventFilter(this);
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 );
if ( fileName.length() == 0 )
return;
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 {
JournalEntry(Calendar *,QWidget *parent);
virtual ~JournalEntry();
void setJournal(Journal *);
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 *);
void newJournal();
void showJournalOnly( Journal * );
protected:
bool eventFilter( QObject *o, QEvent *e );
void writeJournal();
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
@@ -16,57 +16,64 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
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>
#include "journalentry.h"
#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;
}
QPtrList<Incidence> KOJournalView::selectedIncidences()
{
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
void showDates( const QDate &start, const QDate &end );
void showEvents(QPtrList<Event> eventList);
void changeEventDisplay(Event *, int);
private:
void showList(QPtrList<Journal> jl);
Calendar *mCalendar;
JournalEntry* getNewEntry();
QPtrList<JournalEntry> jEntries;
void keyPressEvent ( QKeyEvent * ) ;
QBoxLayout *mTopLayout;
+ QWidget *parWid;
QDate mDate;
};
#endif