summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-12 22:23:02 (UTC)
committer zautrix <zautrix>2005-11-12 22:23:02 (UTC)
commit9e47202fd38512cc523c09cf8878f4c5d836e777 (patch) (side-by-side diff)
treefa35760dc12d7176e3c2e63c22c6482601f7e59d
parentf1b53f2c08c2ce384f663ae6f0a818104db8c53e (diff)
downloadkdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.zip
kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.gz
kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp16
-rw-r--r--korganizer/kolistview.cpp3
2 files changed, 16 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 7f6f221..5269af7 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -112,48 +112,52 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
widwid = size/2+1;
toggleJournal->setFixedSize( widwid , size );
mTitle->setFixedHeight( size+4);
mCalendarBox->setFixedHeight( size+4);
mEditor = new KTextEdit(this);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
#endif
mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
mDeskWid = QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
} else {
mTitle->setMaximumWidth( (maxwid/4)*3);
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()
{
//qDebug("JournalEntry::~JournalEntry() ");
}
void JournalEntry::resizeEvent(QResizeEvent* e )
{
#ifndef DESKTOP_VERSION
if ( mDeskWid != QApplication::desktop()->width() ) {
mDeskWid == QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
}
else {
mTitle->setMaximumWidth( (maxwid/4)*3);
@@ -290,54 +294,62 @@ void JournalEntry::setJournal(Journal *journal, bool saveJournal )
mEditor->setText(mJournal->description());
mTitle->setEnabled (!journal->isReadOnly() );
mEditor->setReadOnly ( journal->isReadOnly() );
mCalendarBox->setEnabled (!journal->isReadOnly() );
fillCalendar( mJournal->calID() );
}
Journal *JournalEntry::journal() const
{
return mJournal;
}
void JournalEntry::clear()
{
mJournal = 0;
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
}
void JournalEntry::writeJournal()
{
if ( !visibleMode ) return;
if ( !mTitle->isEnabled() ) return;
if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
if ( mJournal ) {
Journal* j = mJournal;
mJournal = 0;
bool conf = KOPrefs::instance()->mConfirm;
KOPrefs::instance()->mConfirm = false;
emit deleteJournal(j);
KOPrefs::instance()->mConfirm = conf;
}
return;
}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 4fc1194..b378330 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1272,49 +1272,50 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
if ( ci ){
if ( e->state() == ShiftButton )
ci->setSelected( false );
else
ci->setSelected( true );
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else {
emit currentChanged( ci );
}
}
}
e->accept();
}
break;
default:
e->ignore();
}
}
KOListViewListView::KOListViewListView(KOListView * lv )
: KListView( lv, "kolistlistview", false )
{
- mYMousePos = 0;
+ mYMousePos = 0;
+ setAllColumnsShowFocus( true );
mPopupTimer = new QTimer(this);
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
setSelectionMode( QListView::Multi );
setMultiSelection( true);
}
bool KOListViewListView::hasMultiSelection(QListViewItem* item)
{
QListViewItem *qitem = firstChild ();
while ( qitem ) {
if ( qitem->isSelected() && item != qitem )
return true;
qitem = qitem->nextSibling();
}
return false;
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
QListViewItem *item = itemAt(vp);
if (!item) {