summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show 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;
class KLineEdit;
class KOLocationBox;
using namespace KCal;
class JournalEntry : public QFrame {
Q_OBJECT
public:
JournalEntry(Calendar *,QWidget *parent);
virtual ~JournalEntry();
void setJournal(Journal *, bool saveJournal = true );
Journal *journal() const;
void setDate(const QDate &);
void clear();
void flushEntry();
void setShowOnly();
QSize sizeHint() const;
void setVisibleMode( bool b ) { visibleMode = b;}
void fillCalendar( int id = 0 );
void resizeEvent(QResizeEvent* e ) ;
+ KTextEdit * editor() {return mEditor;};
protected slots:
void slotSaveTemplate();
void slotLoadTemplate();
void toggleShowJournal();
void setVisibleOn();
signals:
void deleteJournal(Journal *);
void newJournal();
void showJournalOnly( Journal * );
protected:
bool eventFilter( QObject *o, QEvent *e );
void writeJournal();
private:
int mMaxWidDiff;
int mDeskWid;
bool visibleMode;
bool showOnlyMode;
Calendar *mCalendar;
Journal *mJournal;
QDate mDate;
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 @@
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 <qhbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include <klocale.h>
#include <kdebug.h>
#include "koprefs.h"
#include <kglobal.h>
+#include <ktextedit.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;
QHBox * vb = new QHBox ( this );
QPushButton * newJournal = new QPushButton( vb );
QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("ko16old");
else
icon = SmallIcon("ko24old");
newJournal->setPixmap (icon ) ;
int size = newJournal->sizeHint().height();
newJournal->setFixedSize( size, size );
mDateLabel = new QLabel ( vb );
@@ -156,63 +157,71 @@ void KOJournalView::newJournal()
void KOJournalView::showOnly ( Journal* j )
{
//qDebug("showOnly %x ", j);
flushView();
if ( j == 0 ) {
showDates( mDate, QDate() );
return;
}
QPtrList<Journal> jl;
jl.append ( j );
showList( jl );
JournalEntry* mEntry = jEntries.first();
mEntry->setShowOnly();
}
void KOJournalView::showList(QPtrList<Journal> jl)
{
static bool ff = false;
if ( ff ) return;
ff = true;
//qDebug("KOJournalView::showList %d",jl.count() );
JournalEntry* mEntry = jEntries.first();
JournalEntry* firstEntry = mEntry;
int count = jl.count();
int iii = 0;
+ QWidget* fw = qApp->focusWidget ();
while ( iii < count ) {
if ( !mEntry ) {
mEntry = getNewEntry();
mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
mEntry = 0;
} else {
+ int xxx = -1, yyy = -1;
+ if ( ((QWidget*) mEntry->editor() ) == fw ) {
+ mEntry->editor()->getCursorPosition( &xxx,&yyy);
+ }
mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
+ if ( xxx > -1 && yyy > -1 ) {
+ mEntry->editor()->setCursorPosition( xxx, yyy );
+ }
mEntry = jEntries.next();
}
++iii;
}
while ( mEntry ) {
mEntry->setDate(mDate);
mEntry->clear();
if ( mEntry != firstEntry ) {
mEntry->hide();
mEntry->setVisibleMode( false );
}
else {
mEntry->setVisibleMode( true );
mEntry->show();
}
mEntry = jEntries.next();
}
ff = false;
}
void KOJournalView::showDates(const QDate &start, const QDate &)
{
mDate = start;
mDateLabel->setText(KGlobal::locale()->formatDate(mDate));