summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/koeditorgeneralevent.cpp17
-rw-r--r--korganizer/koeditorgeneraltodo.cpp12
-rw-r--r--korganizer/ktimeedit.cpp82
-rw-r--r--korganizer/ktimeedit.h3
-rw-r--r--microkde/kdecore/klocale.cpp4
6 files changed, 21 insertions, 102 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index c8293b2..5d8ef41 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -18,4 +18,9 @@ the incoming filter settings can be used.
An example can be found in the SyncHowTo.
+KO/Pi:
+The timeedit input has a pulldown list for times.
+If opened, this pulldown list should now has the right time highlighted.
+
+
********** VERSION 1.9.17 ************
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index fc5be71..30b792b 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -395,21 +395,4 @@ void KOEditorGeneralEvent::emitDateTimeStr()
bool KOEditorGeneralEvent::validateInput()
{
-// kdDebug() << "KOEditorGeneralEvent::validateInput()" << endl;
-
- if (!mNoTimeButton->isChecked()) {
- if (!mStartTimeEdit->inputIsValid()) {
- KMessageBox::sorry( 0,
- i18n("Please specify a valid start time, for example '%1'.")
- .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) );
- return false;
- }
-
- if (!mEndTimeEdit->inputIsValid()) {
- KMessageBox::sorry( 0,
- i18n("Please specify a valid end time, for example '%1'.")
- .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) );
- return false;
- }
- }
if (!mStartDateEdit->inputIsValid()) {
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 7db7da0..158a7d3 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -385,10 +385,4 @@ bool KOEditorGeneralTodo::validateInput()
return false;
}
- if (mTimeButton->isChecked()) {
- if (!mDueTimeEdit->inputIsValid()) {
- KMessageBox::sorry(0,i18n("Please specify a valid due time."));
- return false;
- }
- }
}
@@ -398,10 +392,4 @@ bool KOEditorGeneralTodo::validateInput()
return false;
}
- if (mTimeButton->isChecked()) {
- if (!mStartTimeEdit->inputIsValid()) {
- KMessageBox::sorry(0,i18n("Please specify a valid start time."));
- return false;
- }
- }
}
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index f5a1c50..5222ac9 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -26,4 +26,5 @@
#include <qdatetime.h>
#include <qlineedit.h>
+#include <qlistbox.h>
#include <qapplication.h>
@@ -40,42 +41,4 @@
// Validator for a time value with only hours and minutes (no seconds)
// Mostly locale aware. Author: David Faure <faure@kde.org>
-class KOTimeValidator : public QValidator
-{
-public:
- KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {}
-
- virtual State validate(QString& str, int& /*cursorPos*/) const
- {
- return Acceptable;
- bool ok = false;
- // TODO use KLocale::WithoutSeconds in HEAD
- /*QTime time =*/ KGlobal::locale()->readTime(str, &ok);
- if ( ok )
- return Acceptable;
- // readTime doesn't help knowing when the string is "Intermediate".
- int length = str.length();
- if ( !str ) // empty string?
- return Invalid; // there should always be a ':' in it, right?
- // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...)
- QChar sep = ':';
- // I want to allow "HH:", ":MM" and ":" to make editing easier
- if ( str[0] == sep )
- {
- if ( length == 1 ) // just ":"
- return Intermediate;
- QString minutes = str.mid(1);
- int m = minutes.toInt(&ok);
- if ( ok && m >= 0 && m < 60 )
- return Intermediate;
- } else if ( str.at(str.length()-1) == sep )
- {
- QString hours = str.left(length-1);
- int h = hours.toInt(&ok);
- if ( ok && h >= 0 && h < 24 )
- return Intermediate;
- }
- return Invalid;
- }
-};
// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
@@ -86,5 +49,4 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
{
setInsertionPolicy(NoInsertion);
- setValidator( new KOTimeValidator( this ) );
mFlagKeyPressed = false;
@@ -146,9 +108,5 @@ bool KOTimeEdit::hasTime() const
QTime KOTimeEdit::getTime() const
{
- //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl;
- // TODO use KLocale::WithoutSeconds in HEAD
- QTime time = KGlobal::locale()->readTime(currentText());
- // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl;
- return time;
+ return KGlobal::locale()->readTime(currentText());
}
/*
@@ -166,6 +124,4 @@ void KOTimeEdit::setTime(QTime newTime)
if ( mTime != newTime )
{
- kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl;
-
mTime = newTime;
updateText();
@@ -380,4 +336,5 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
break;
case Key_Backspace:
+ qDebug("+++++++++++back ");
if ( cpos > 0) {
if ( cpos == 3 )
@@ -390,4 +347,5 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
setSelect ( cpos , 1 );
changedText();
+ qDebug("---------back ");
}
break;
@@ -487,5 +445,6 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
void KOTimeEdit::updateText()
{
-// kdDebug(5850) << "KOTimeEdit::updateText() " << endl
+ listBox()->blockSignals( true );
+ blockSignals( true );
QString s = KGlobal::locale()->formatTime(mTime);
// Set the text but without emitting signals, nor losing the cursor position
@@ -493,36 +452,23 @@ void KOTimeEdit::updateText()
line->blockSignals(true);
int pos = line->cursorPosition();
- // qDebug(" settext *%s* ", s.latin1());
- line->setText(s);
- // line->setCursorPosition(pos);
-// line->blockSignals(false);
-
-// kdDebug(5850) << "KOTimeEdit::updateText(): " << s << endl;
-
- if (!mTime.minute() % 15) {
setCurrentItem((mTime.hour()*4)+(mTime.minute()/15));
- }
+ line->setText(s);
line->setCursorPosition(pos);
line->blockSignals(false);
+ blockSignals( false );
+ listBox()->blockSignals( false );
}
-bool KOTimeEdit::inputIsValid() const
-{
- int cursorPos = lineEdit()->cursorPosition();
- QString str = currentText();
- return validator()->validate( str, cursorPos ) == QValidator::Acceptable;
-}
-
void KOTimeEdit::changedText()
{
- //kdDebug(5850) << "KOTimeEdit::changedText()" << endl;
- if ( inputIsValid() )
- {
int pos = lineEdit()->cursorPosition();
mTime = getTime();
- // updateText();
+ blockSignals( true );
+ QString text = lineEdit()->text();
+ setCurrentItem((mTime.hour()*4)+(mTime.minute()/15));
+ lineEdit()->setText(text);
+ blockSignals( false );
emit timeChanged(mTime);
lineEdit()->setCursorPosition(pos);
}
-}
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h
index 7923070..b3d842d 100644
--- a/korganizer/ktimeedit.h
+++ b/korganizer/ktimeedit.h
@@ -59,7 +59,4 @@ class KOTimeEdit : public QComboBox
//QSizePolicy sizePolicy() const;
- /** return true if input is a valid time and false if not */
- bool inputIsValid() const;
-
signals:
/**
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index d7e384c..7f31ab1 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -563,7 +563,7 @@ QTime KLocale::readTime(const QString &intstr, bool *ok) const
{
QTime _time;
- _time = readTime(intstr, true, ok);
+ _time = readTime(intstr, false, ok);
if (_time.isValid()) return _time;
- return readTime(intstr, false, ok);
+ return readTime(intstr, true, ok);
}