summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-02-21 12:28:31 (UTC)
committer zautrix <zautrix>2005-02-21 12:28:31 (UTC)
commitb4ebc9c227f986369fe9b0193158f3893a29df08 (patch) (side-by-side diff)
tree6f117a4927fae9142b036751509925b3641b9c3f /libkdepim
parentbb74ffa01010ca364e101e05a6b3e090ae363a0e (diff)
downloadkdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.zip
kdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.tar.gz
kdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.tar.bz2
search fixes
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kdateedit.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 2c78ea3..946fc0d 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -69,33 +69,33 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
mDateButton = new QPushButton(this);
mDateButton->setPixmap(pixmap);
mDateFrame = new QVBox(0,0,WType_Popup);
// mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
mDateFrame->setLineWidth(3);
mDateFrame->hide();
mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate());
connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate)));
connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide()));
connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker()));
-
+ mDateButton->setFocusPolicy( QWidget::NoFocus );
//mDateFrame->resize( 400, 300 );
}
connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed()));
connect(mDateEdit,SIGNAL(textChanged(const QString &)),
SLOT(textChanged(const QString &)));
// Create the keyword list. This will be used to match against when the user
// enters information.
mKeywordMap[i18n("tomorrow")] = 1;
mKeywordMap[i18n("today")] = 0;
mKeywordMap[i18n("yesterday")] = -1;
/*
* This loop uses some math tricks to figure out the offset in days
* to the next date the given day of the week occurs. There
@@ -104,33 +104,33 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
* which means the new day is already passed (so we need to find the
* day in the next week).
*/
QString dayName;
int currentDay = QDate::currentDate().dayOfWeek();
for (int i = 1; i <= 7; ++i)
{
dayName = KGlobal::locale()->weekDayName(i).lower();
if (i >= currentDay)
mKeywordMap[dayName] = i - currentDay;
else
mKeywordMap[dayName] = 7 - currentDay + i;
}
mTextChanged = false;
mHandleInvalid = false;
- QWidget::setTabOrder( mDateEdit, mDateButton );
+ // QWidget::setTabOrder( mDateEdit, mDateButton );
}
KDateEdit::~KDateEdit()
{
delete mDateFrame;
}
void KDateEdit::clear()
{
bool b = mDateEdit->signalsBlocked();
mDateEdit->blockSignals(true);
mDateEdit->setText("");
mDateEdit->blockSignals(b);
}
void KDateEdit::setDate(QDate newDate)
{
if (!newDate.isValid() && !mHandleInvalid)
@@ -449,36 +449,38 @@ QDate KDateEdit::readDate() const
if (mKeywordMap.contains(text.lower()))
{
date = QDate::currentDate().addDays(mKeywordMap[text.lower()]);
}
else
{
date = KGlobal::locale()->readDate(text);
}
return date;
}
bool KDateEdit::eventFilter(QObject *, QEvent *e)
{
// We only process the focus out event if the text has changed
// since we got focus
- if ((e->type() == QEvent::FocusOut) && mTextChanged)
+ if ((e->type() == QEvent::FocusOut) )
{
- lineEnterPressed();
- mTextChanged = false;
+ if ( mTextChanged ) {
+ lineEnterPressed();
+ mTextChanged = false;
+ }
}
// switch dateFormShort by double klick with mouse
else if (e->type() == QEvent::MouseButtonDblClick)
{
toggleDateFormat();
}
else if (e->type() == QEvent::FocusIn)
{
maxDay = readDate().day();
}
return false;
}
void KDateEdit::toggleDateFormat()
{
dateFormShort = ! dateFormShort;