-rw-r--r-- | libkdepim/kdateedit.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 3d9e690..bf38479 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -65,12 +65,15 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) | |||
65 | mDateButton = 0; | 65 | mDateButton = 0; |
66 | mDatePicker = 0; | 66 | mDatePicker = 0; |
67 | } else { | 67 | } else { |
68 | QPixmap pixmap = SmallIcon("smallcal"); | 68 | QPixmap pixmap = SmallIcon("smallcal"); |
69 | mDateButton = new QPushButton(this); | 69 | mDateButton = new QPushButton(this); |
70 | mDateButton->setPixmap(pixmap); | 70 | mDateButton->setPixmap(pixmap); |
71 | QPixmap pixmap2 = SmallIcon("today_small"); | ||
72 | QPushButton* nowButton = new QPushButton(this); | ||
73 | nowButton->setPixmap(pixmap2); | ||
71 | 74 | ||
72 | mDateFrame = new QVBox(0,0,WType_Popup); | 75 | mDateFrame = new QVBox(0,0,WType_Popup); |
73 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 76 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
74 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 77 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
75 | mDateFrame->setLineWidth(3); | 78 | mDateFrame->setLineWidth(3); |
76 | mDateFrame->hide(); | 79 | mDateFrame->hide(); |
@@ -79,12 +82,13 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) | |||
79 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); | 82 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); |
80 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); | 83 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); |
81 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); | 84 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); |
82 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); | 85 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); |
83 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); | 86 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); |
84 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); | 87 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); |
88 | connect(nowButton,SIGNAL(clicked()),SLOT(goToNow())); | ||
85 | mDateButton->setFocusPolicy( QWidget::NoFocus ); | 89 | mDateButton->setFocusPolicy( QWidget::NoFocus ); |
86 | mDateButton->setAutoDefault( false ); | 90 | mDateButton->setAutoDefault( false ); |
87 | //mDateFrame->resize( 400, 300 ); | 91 | //mDateFrame->resize( 400, 300 ); |
88 | 92 | ||
89 | } | 93 | } |
90 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); | 94 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); |
@@ -129,12 +133,17 @@ void KDateEdit::clear() | |||
129 | { | 133 | { |
130 | bool b = mDateEdit->signalsBlocked(); | 134 | bool b = mDateEdit->signalsBlocked(); |
131 | mDateEdit->blockSignals(true); | 135 | mDateEdit->blockSignals(true); |
132 | mDateEdit->setText(""); | 136 | mDateEdit->setText(""); |
133 | mDateEdit->blockSignals(b); | 137 | mDateEdit->blockSignals(b); |
134 | } | 138 | } |
139 | void KDateEdit::goToNow() | ||
140 | { | ||
141 | setDate(QDate::currentDate() ); | ||
142 | emit setTimeTo( QTime::currentTime() ); | ||
143 | } | ||
135 | void KDateEdit::setDate(QDate newDate) | 144 | void KDateEdit::setDate(QDate newDate) |
136 | { | 145 | { |
137 | if (!newDate.isValid() && !mHandleInvalid) | 146 | if (!newDate.isValid() && !mHandleInvalid) |
138 | return; | 147 | return; |
139 | if ( readDate() == newDate ) | 148 | if ( readDate() == newDate ) |
140 | return; | 149 | return; |