-rw-r--r-- | korganizer/journalentry.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 7f6f221..5269af7 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -128,16 +128,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mCalendarBox->setMaximumWidth( maxwid/2 ); } //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(vb); topLayout->addWidget(mEditor); mEditor->installEventFilter(this); + installEventFilter(this); + mTitle->installEventFilter(this); + setFocusPolicy (QWidget::NoFocus); + connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); mTitle->load( KOLocationBox::SUMMARYJOURNAL ); mTitle->lineEdit ()->setText(""); } JournalEntry::~JournalEntry() @@ -306,22 +310,30 @@ void JournalEntry::clear() mEditor->setText(""); mTitle->load( KOLocationBox::SUMMARYJOURNAL ); mTitle->lineEdit ()->setText(""); } bool JournalEntry::eventFilter( QObject *o, QEvent *e ) { // kdDebug() << "JournalEntry::event received " << e->type() << endl; - + if ( isVisible() ) { + mEditor->setFocusPolicy (QWidget::StrongFocus); + mTitle->setFocusPolicy (QWidget::StrongFocus); + } else { + mEditor->setFocusPolicy (QWidget::NoFocus); + mTitle->setFocusPolicy (QWidget::NoFocus); + } if ( e->type() == QEvent::FocusOut ) { writeJournal(); } if ( e->type() == QEvent::KeyPress ) { - QKeyEvent * k = (QKeyEvent *) e; + QKeyEvent * k = (QKeyEvent *) e; + if ( !isVisible() ) + return true; if ( k->state() == Qt::ControlButton ) { k->ignore(); //return true; } } return QFrame::eventFilter( o, e ); // standard event processing } |