summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -35,48 +35,49 @@
#include <qpushbutton.h>
#include <qapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <ktextedit.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include "koprefs.h"
#include <libkcal/journal.h>
#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");
newJournal->setIconSet (icon ) ;
int size = newJournal->sizeHint().height();
newJournal->setFixedSize( size, size );
QPushButton * toggleJournal = new QPushButton( vb );
icon = SmallIcon("1updownarrow");
toggleJournal->setIconSet (icon ) ;
//int size = toggleJournal->sizeHint().height();
toggleJournal->setFixedSize( size * 2 /3 , size );
@@ -96,50 +97,54 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileimport16");
else
icon = SmallIcon("fileimport");
loadTemplate->setIconSet (icon ) ;
loadTemplate->setFixedSize( size, size );
mEditor = new KTextEdit(this);
connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
#endif
mEditor->setWordWrap( KTextEdit::WidgetWidth );
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 );
if (!fileIn.open( IO_WriteOnly ) ) {
KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
.arg( fileName ) );
return;
}
// QString text;
QTextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << mEditor->text();
fileIn.close();
}
void JournalEntry::slotLoadTemplate()
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index 85ad5df..b0e9cc7 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -28,53 +28,55 @@
#include <qframe.h>
#include <libkcal/calendar.h>
class QLabel;
class KTextEdit;
using namespace KCal;
class JournalEntry : public QFrame {
Q_OBJECT
public:
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
@@ -4,81 +4,88 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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;
return eventList;
}
void KOJournalView::updateConfig()
{
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
mEntry = jEntries.next();
}
}
void KOJournalView::updateView()
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index aabf11c..0437d95 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -48,29 +48,30 @@ class KOJournalView : public KOrg::BaseView
virtual QPtrList<Incidence> selectedIncidences();
DateList selectedDates()
{DateList q;
return q;};
signals:
void deleteJournal(Journal *);
public slots:
void showOnly ( Journal* );
void newJournal();
void updateView();
void flushView();
void updateConfig();
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