author | zautrix <zautrix> | 2005-02-21 12:28:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-21 12:28:31 (UTC) |
commit | b4ebc9c227f986369fe9b0193158f3893a29df08 (patch) (unidiff) | |
tree | 6f117a4927fae9142b036751509925b3641b9c3f | |
parent | bb74ffa01010ca364e101e05a6b3e090ae363a0e (diff) | |
download | kdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.zip kdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.tar.gz kdepimpi-b4ebc9c227f986369fe9b0193158f3893a29df08.tar.bz2 |
search fixes
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 6 | ||||
-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 20 | ||||
-rw-r--r-- | libkdepim/kdateedit.cpp | 12 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 27 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 3179845..1073fe7 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1269,32 +1269,38 @@ | |||
1269 | { "High clock skew!","Großer Uhrzeitunterschied!" }, | 1269 | { "High clock skew!","Großer Uhrzeitunterschied!" }, |
1270 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, | 1270 | { "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, |
1271 | { "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, | 1271 | { "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, |
1272 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, | 1272 | { "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, |
1273 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, | 1273 | { "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, |
1274 | { "List week view","Listenwochenansicht" }, | 1274 | { "List week view","Listenwochenansicht" }, |
1275 | { "List week","Listenwochenansicht" }, | 1275 | { "List week","Listenwochenansicht" }, |
1276 | { "Next Week","Nächste Woche" }, | 1276 | { "Next Week","Nächste Woche" }, |
1277 | { "Previous Week","Vorherige Woche" }, | 1277 | { "Previous Week","Vorherige Woche" }, |
1278 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, | 1278 | { "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, |
1279 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, | 1279 | { "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, |
1280 | { "Details","Details" }, | 1280 | { "Details","Details" }, |
1281 | { "Created time","Erstellt Zeit" }, | 1281 | { "Created time","Erstellt Zeit" }, |
1282 | { "Last modified time","Geändert Zeit" }, | 1282 | { "Last modified time","Geändert Zeit" }, |
1283 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, | 1283 | { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, |
1284 | { "View Options","Anzeige Optionen" }, | 1284 | { "View Options","Anzeige Optionen" }, |
1285 | { "<b>Created: ","<b>Erstellt am: " }, | 1285 | { "<b>Created: ","<b>Erstellt am: " }, |
1286 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, | 1286 | { "<b>Last modified: ","<b>Zuletzt geändert am: " }, |
1287 | { "Journal: ","Journal: " }, | 1287 | { "Journal: ","Journal: " }, |
1288 | { "yearly","jährlich" }, | 1288 | { "yearly","jährlich" }, |
1289 | { "(%1) ","%1-" }, | 1289 | { "(%1) ","%1-" }, |
1290 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, | 1290 | { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, |
1291 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, | 1291 | { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, |
1292 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, | 1292 | { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, |
1293 | { "Summary/Loc.","Titel/Ort" }, | ||
1294 | { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, | ||
1295 | { "","" }, | ||
1296 | { "","" }, | ||
1297 | { "","" }, | ||
1298 | { "","" }, | ||
1293 | { "","" }, | 1299 | { "","" }, |
1294 | { "","" }, | 1300 | { "","" }, |
1295 | { "","" }, | 1301 | { "","" }, |
1296 | { "","" }, | 1302 | { "","" }, |
1297 | { "","" }, | 1303 | { "","" }, |
1298 | { "","" }, | 1304 | { "","" }, |
1299 | { "","" }, | 1305 | { "","" }, |
1300 | 1306 | ||
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index 05f61c4..5d85cb3 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm | |||
@@ -1,27 +1,27 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 2.0.9 | 3 | Version: 2.0.10 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
10 | 10 | ||
11 | %description | 11 | %description |
12 | This package contains the platform-independent PIM programs from | 12 | This package contains the platform-independent PIM programs from |
13 | www.pi-sync.net, compiled for SuSE 9.2: | 13 | www.pi-sync.net, compiled for SuSE 9.2: |
14 | KTimeTacker/Pi | 14 | KTimeTacker/Pi |
15 | KPhone/Pi | 15 | KPhone/Pi |
16 | KAddressbook/Pi | 16 | KAddressbook/Pi |
17 | KOrganizer/Pi | 17 | KOrganizer/Pi |
18 | PasswordManager/Pi | 18 | PasswordManager/Pi |
19 | KOPieMail/Pi | 19 | KOPieMail/Pi |
20 | 20 | ||
21 | These applications do not need anything from the KDE-desktop | 21 | These applications do not need anything from the KDE-desktop |
22 | at all to run on Linux. However, there is a dependency from | 22 | at all to run on Linux. However, there is a dependency from |
23 | two KDE libs, because a small command line program is included | 23 | two KDE libs, because a small command line program is included |
24 | to make it possible to sync with the KDE-desktop applications. | 24 | to make it possible to sync with the KDE-desktop applications. |
25 | 25 | ||
26 | These applications are independent from the KDE-desktop | 26 | These applications are independent from the KDE-desktop |
27 | environment. That means, nothing of your existing | 27 | environment. That means, nothing of your existing |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 3a95978..3fd9740 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -59,49 +59,49 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | |||
59 | 59 | ||
60 | searchEdit = new QLineEdit(topFrame); | 60 | searchEdit = new QLineEdit(topFrame); |
61 | subLayout->addWidget(searchEdit); | 61 | subLayout->addWidget(searchEdit); |
62 | searchEdit->setText("*"); // Find all events by default | 62 | searchEdit->setText("*"); // Find all events by default |
63 | searchEdit->setFocus(); | 63 | searchEdit->setFocus(); |
64 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 64 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
65 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 65 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
66 | // Subjects to search | 66 | // Subjects to search |
67 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 67 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
68 | // topFrame); | 68 | // topFrame); |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | QHBox *incidenceGroup = new QHBox( topFrame ); | 72 | QHBox *incidenceGroup = new QHBox( topFrame ); |
73 | layout->addWidget(incidenceGroup); | 73 | layout->addWidget(incidenceGroup); |
74 | 74 | ||
75 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 75 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
76 | mSearchEvent->setChecked(true); | 76 | mSearchEvent->setChecked(true); |
77 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 77 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
78 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 78 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
79 | 79 | ||
80 | QHBox *subjectGroup = new QHBox( topFrame ); | 80 | QHBox *subjectGroup = new QHBox( topFrame ); |
81 | layout->addWidget(subjectGroup); | 81 | layout->addWidget(subjectGroup); |
82 | 82 | ||
83 | mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); | 83 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
84 | mSummaryCheck->setChecked(true); | 84 | mSummaryCheck->setChecked(true); |
85 | mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); | 85 | mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); |
86 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 86 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
87 | 87 | ||
88 | QHBox *attendeeGroup = new QHBox( topFrame ); | 88 | QHBox *attendeeGroup = new QHBox( topFrame ); |
89 | layout->addWidget(attendeeGroup ); | 89 | layout->addWidget(attendeeGroup ); |
90 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 90 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
91 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 91 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
92 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 92 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
93 | // Date range | 93 | // Date range |
94 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 94 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
95 | // topFrame); | 95 | // topFrame); |
96 | // layout->addWidget(rangeGroup); | 96 | // layout->addWidget(rangeGroup); |
97 | 97 | ||
98 | QWidget *rangeWidget = new QWidget(topFrame); | 98 | QWidget *rangeWidget = new QWidget(topFrame); |
99 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); | 99 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); |
100 | 100 | ||
101 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 101 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
102 | mStartDate = new KDateEdit(rangeWidget); | 102 | mStartDate = new KDateEdit(rangeWidget); |
103 | rangeLayout->addWidget(mStartDate); | 103 | rangeLayout->addWidget(mStartDate); |
104 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 104 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
105 | mEndDate = new KDateEdit(rangeWidget); | 105 | mEndDate = new KDateEdit(rangeWidget); |
106 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 106 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
107 | rangeLayout->addWidget(mEndDate); | 107 | rangeLayout->addWidget(mEndDate); |
@@ -164,106 +164,110 @@ void SearchDialog::searchTextChanged( const QString &_text ) | |||
164 | void SearchDialog::doSearch() | 164 | void SearchDialog::doSearch() |
165 | { | 165 | { |
166 | QRegExp re; | 166 | QRegExp re; |
167 | 167 | ||
168 | re.setWildcard(true); // most people understand these better. | 168 | re.setWildcard(true); // most people understand these better. |
169 | re.setCaseSensitive(false); | 169 | re.setCaseSensitive(false); |
170 | re.setPattern(searchEdit->text()); | 170 | re.setPattern(searchEdit->text()); |
171 | if (!re.isValid() ) { | 171 | if (!re.isValid() ) { |
172 | KMessageBox::sorry(this, | 172 | KMessageBox::sorry(this, |
173 | i18n("Invalid search expression,\ncannot perform " | 173 | i18n("Invalid search expression,\ncannot perform " |
174 | "the search.\nPlease enter a search expression\n" | 174 | "the search.\nPlease enter a search expression\n" |
175 | "using the wildcard characters\n '*' and '?'" | 175 | "using the wildcard characters\n '*' and '?'" |
176 | "where needed.")); | 176 | "where needed.")); |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | 179 | ||
180 | search(re); | 180 | search(re); |
181 | 181 | ||
182 | listView->setStartDate( mStartDate->date() ); | 182 | listView->setStartDate( mStartDate->date() ); |
183 | listView->showEvents(mMatchedEvents); | 183 | listView->showEvents(mMatchedEvents); |
184 | listView->addTodos(mMatchedTodos); | 184 | listView->addTodos(mMatchedTodos); |
185 | listView->addJournals(mMatchedJournals); | 185 | listView->addJournals(mMatchedJournals); |
186 | 186 | ||
187 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 187 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
188 | KMessageBox::information(this, | 188 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
189 | i18n("No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.")); | ||
190 | #ifndef DESKTOP_VERSION | ||
191 | setCaption(i18n("Click OK to search ->")); | ||
192 | #else | ||
193 | setCaption(i18n("KO/Pi Find ")); | ||
194 | #endif | ||
195 | } else { | 189 | } else { |
196 | QString mess; | 190 | QString mess; |
197 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 191 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
198 | setCaption( i18n("KO/Pi Find: ") + mess); | 192 | setCaption( i18n("KO/Pi Find: ") + mess); |
199 | 193 | ||
200 | } | 194 | } |
195 | searchEdit->setFocus(); | ||
201 | } | 196 | } |
202 | void SearchDialog::updateConfig() | 197 | void SearchDialog::updateConfig() |
203 | { | 198 | { |
204 | listView->updateConfig(); | 199 | listView->updateConfig(); |
205 | } | 200 | } |
206 | void SearchDialog::updateView() | 201 | void SearchDialog::updateView() |
207 | { | 202 | { |
208 | 203 | ||
209 | QRegExp re; | 204 | QRegExp re; |
210 | re.setWildcard(true); // most people understand these better. | 205 | re.setWildcard(true); // most people understand these better. |
211 | re.setCaseSensitive(false); | 206 | re.setCaseSensitive(false); |
212 | re.setPattern(searchEdit->text()); | 207 | re.setPattern(searchEdit->text()); |
213 | if (re.isValid()) { | 208 | if (re.isValid()) { |
214 | search(re); | 209 | search(re); |
215 | } else { | 210 | } else { |
216 | mMatchedEvents.clear(); | 211 | mMatchedEvents.clear(); |
217 | mMatchedTodos.clear(); | 212 | mMatchedTodos.clear(); |
218 | mMatchedJournals.clear(); | 213 | mMatchedJournals.clear(); |
219 | } | 214 | } |
220 | listView->setStartDate( mStartDate->date() ); | 215 | listView->setStartDate( mStartDate->date() ); |
221 | listView->showEvents(mMatchedEvents); | 216 | listView->showEvents(mMatchedEvents); |
222 | listView->addTodos(mMatchedTodos); | 217 | listView->addTodos(mMatchedTodos); |
223 | listView->addJournals(mMatchedJournals); | 218 | listView->addJournals(mMatchedJournals); |
224 | } | 219 | } |
225 | 220 | ||
226 | void SearchDialog::search(const QRegExp &re) | 221 | void SearchDialog::search(const QRegExp &re) |
227 | { | 222 | { |
228 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 223 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
229 | mEndDate->date(), | 224 | mEndDate->date(), |
230 | false /*mInclusiveCheck->isChecked()*/ ); | 225 | false /*mInclusiveCheck->isChecked()*/ ); |
231 | 226 | ||
232 | mMatchedEvents.clear(); | 227 | mMatchedEvents.clear(); |
233 | if ( mSearchEvent->isChecked() ) { | 228 | if ( mSearchEvent->isChecked() ) { |
234 | Event *ev; | 229 | Event *ev; |
235 | for(ev=events.first();ev;ev=events.next()) { | 230 | for(ev=events.first();ev;ev=events.next()) { |
236 | if (mSummaryCheck->isChecked()) { | 231 | if (mSummaryCheck->isChecked()) { |
237 | #if QT_VERSION >= 0x030000 | 232 | #if QT_VERSION >= 0x030000 |
238 | if (re.search(ev->summary()) != -1) | 233 | if (re.search(ev->summary()) != -1) |
239 | #else | 234 | #else |
240 | if (re.match(ev->summary()) != -1) | 235 | if (re.match(ev->summary()) != -1) |
241 | #endif | 236 | #endif |
242 | { | 237 | { |
243 | mMatchedEvents.append(ev); | 238 | mMatchedEvents.append(ev); |
244 | continue; | 239 | continue; |
245 | } | 240 | } |
241 | #if QT_VERSION >= 0x030000 | ||
242 | if (re.search(ev->location()) != -1) | ||
243 | #else | ||
244 | if (re.match(ev->location()) != -1) | ||
245 | #endif | ||
246 | { | ||
247 | mMatchedEvents.append(ev); | ||
248 | continue; | ||
249 | } | ||
246 | } | 250 | } |
247 | if (mDescriptionCheck->isChecked()) { | 251 | if (mDescriptionCheck->isChecked()) { |
248 | #if QT_VERSION >= 0x030000 | 252 | #if QT_VERSION >= 0x030000 |
249 | if (re.search(ev->description()) != -1) | 253 | if (re.search(ev->description()) != -1) |
250 | #else | 254 | #else |
251 | if (re.match(ev->description()) != -1) | 255 | if (re.match(ev->description()) != -1) |
252 | #endif | 256 | #endif |
253 | { | 257 | { |
254 | mMatchedEvents.append(ev); | 258 | mMatchedEvents.append(ev); |
255 | continue; | 259 | continue; |
256 | } | 260 | } |
257 | } | 261 | } |
258 | if (mCategoryCheck->isChecked()) { | 262 | if (mCategoryCheck->isChecked()) { |
259 | #if QT_VERSION >= 0x030000 | 263 | #if QT_VERSION >= 0x030000 |
260 | if (re.search(ev->categoriesStr()) != -1) | 264 | if (re.search(ev->categoriesStr()) != -1) |
261 | #else | 265 | #else |
262 | if (re.match(ev->categoriesStr()) != -1) | 266 | if (re.match(ev->categoriesStr()) != -1) |
263 | #endif | 267 | #endif |
264 | { | 268 | { |
265 | mMatchedEvents.append(ev); | 269 | mMatchedEvents.append(ev); |
266 | continue; | 270 | continue; |
267 | } | 271 | } |
268 | } | 272 | } |
269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 273 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 2c78ea3..946fc0d 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -61,84 +61,84 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) | |||
61 | mDateEdit->setPalette( palette ); | 61 | mDateEdit->setPalette( palette ); |
62 | 62 | ||
63 | if ( withoutDP ) { | 63 | if ( withoutDP ) { |
64 | mDateFrame = 0; | 64 | mDateFrame = 0; |
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 | 71 | ||
72 | mDateFrame = new QVBox(0,0,WType_Popup); | 72 | mDateFrame = new QVBox(0,0,WType_Popup); |
73 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 73 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
74 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 74 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
75 | mDateFrame->setLineWidth(3); | 75 | mDateFrame->setLineWidth(3); |
76 | mDateFrame->hide(); | 76 | mDateFrame->hide(); |
77 | 77 | ||
78 | mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); | 78 | mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); |
79 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); | 79 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); |
80 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); | 80 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); |
81 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); | 81 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); |
82 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); | 82 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); |
83 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); | 83 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); |
84 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); | 84 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); |
85 | 85 | mDateButton->setFocusPolicy( QWidget::NoFocus ); | |
86 | //mDateFrame->resize( 400, 300 ); | 86 | //mDateFrame->resize( 400, 300 ); |
87 | 87 | ||
88 | } | 88 | } |
89 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); | 89 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); |
90 | connect(mDateEdit,SIGNAL(textChanged(const QString &)), | 90 | connect(mDateEdit,SIGNAL(textChanged(const QString &)), |
91 | SLOT(textChanged(const QString &))); | 91 | SLOT(textChanged(const QString &))); |
92 | 92 | ||
93 | // Create the keyword list. This will be used to match against when the user | 93 | // Create the keyword list. This will be used to match against when the user |
94 | // enters information. | 94 | // enters information. |
95 | mKeywordMap[i18n("tomorrow")] = 1; | 95 | mKeywordMap[i18n("tomorrow")] = 1; |
96 | mKeywordMap[i18n("today")] = 0; | 96 | mKeywordMap[i18n("today")] = 0; |
97 | mKeywordMap[i18n("yesterday")] = -1; | 97 | mKeywordMap[i18n("yesterday")] = -1; |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * This loop uses some math tricks to figure out the offset in days | 100 | * This loop uses some math tricks to figure out the offset in days |
101 | * to the next date the given day of the week occurs. There | 101 | * to the next date the given day of the week occurs. There |
102 | * are two cases, that the new day is >= the current day, which means | 102 | * are two cases, that the new day is >= the current day, which means |
103 | * the new day has not occured yet or that the new day < the current day, | 103 | * the new day has not occured yet or that the new day < the current day, |
104 | * which means the new day is already passed (so we need to find the | 104 | * which means the new day is already passed (so we need to find the |
105 | * day in the next week). | 105 | * day in the next week). |
106 | */ | 106 | */ |
107 | QString dayName; | 107 | QString dayName; |
108 | int currentDay = QDate::currentDate().dayOfWeek(); | 108 | int currentDay = QDate::currentDate().dayOfWeek(); |
109 | for (int i = 1; i <= 7; ++i) | 109 | for (int i = 1; i <= 7; ++i) |
110 | { | 110 | { |
111 | dayName = KGlobal::locale()->weekDayName(i).lower(); | 111 | dayName = KGlobal::locale()->weekDayName(i).lower(); |
112 | if (i >= currentDay) | 112 | if (i >= currentDay) |
113 | mKeywordMap[dayName] = i - currentDay; | 113 | mKeywordMap[dayName] = i - currentDay; |
114 | else | 114 | else |
115 | mKeywordMap[dayName] = 7 - currentDay + i; | 115 | mKeywordMap[dayName] = 7 - currentDay + i; |
116 | } | 116 | } |
117 | 117 | ||
118 | mTextChanged = false; | 118 | mTextChanged = false; |
119 | mHandleInvalid = false; | 119 | mHandleInvalid = false; |
120 | QWidget::setTabOrder( mDateEdit, mDateButton ); | 120 | // QWidget::setTabOrder( mDateEdit, mDateButton ); |
121 | } | 121 | } |
122 | 122 | ||
123 | KDateEdit::~KDateEdit() | 123 | KDateEdit::~KDateEdit() |
124 | { | 124 | { |
125 | delete mDateFrame; | 125 | delete mDateFrame; |
126 | } | 126 | } |
127 | void KDateEdit::clear() | 127 | void KDateEdit::clear() |
128 | { | 128 | { |
129 | bool b = mDateEdit->signalsBlocked(); | 129 | bool b = mDateEdit->signalsBlocked(); |
130 | mDateEdit->blockSignals(true); | 130 | mDateEdit->blockSignals(true); |
131 | mDateEdit->setText(""); | 131 | mDateEdit->setText(""); |
132 | mDateEdit->blockSignals(b); | 132 | mDateEdit->blockSignals(b); |
133 | } | 133 | } |
134 | void KDateEdit::setDate(QDate newDate) | 134 | void KDateEdit::setDate(QDate newDate) |
135 | { | 135 | { |
136 | if (!newDate.isValid() && !mHandleInvalid) | 136 | if (!newDate.isValid() && !mHandleInvalid) |
137 | return; | 137 | return; |
138 | if ( readDate() == newDate ) | 138 | if ( readDate() == newDate ) |
139 | return; | 139 | return; |
140 | QString dateString = ""; | 140 | QString dateString = ""; |
141 | if(newDate.isValid()) | 141 | if(newDate.isValid()) |
142 | dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); | 142 | dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); |
143 | 143 | ||
144 | mTextChanged = false; | 144 | mTextChanged = false; |
@@ -441,52 +441,54 @@ bool KDateEdit::inputIsValid() | |||
441 | return readDate().isValid(); | 441 | return readDate().isValid(); |
442 | } | 442 | } |
443 | 443 | ||
444 | QDate KDateEdit::readDate() const | 444 | QDate KDateEdit::readDate() const |
445 | { | 445 | { |
446 | QString text = mDateEdit->text(); | 446 | QString text = mDateEdit->text(); |
447 | QDate date; | 447 | QDate date; |
448 | 448 | ||
449 | if (mKeywordMap.contains(text.lower())) | 449 | if (mKeywordMap.contains(text.lower())) |
450 | { | 450 | { |
451 | date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); | 451 | date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); |
452 | } | 452 | } |
453 | else | 453 | else |
454 | { | 454 | { |
455 | date = KGlobal::locale()->readDate(text); | 455 | date = KGlobal::locale()->readDate(text); |
456 | } | 456 | } |
457 | 457 | ||
458 | return date; | 458 | return date; |
459 | } | 459 | } |
460 | 460 | ||
461 | bool KDateEdit::eventFilter(QObject *, QEvent *e) | 461 | bool KDateEdit::eventFilter(QObject *, QEvent *e) |
462 | { | 462 | { |
463 | // We only process the focus out event if the text has changed | 463 | // We only process the focus out event if the text has changed |
464 | // since we got focus | 464 | // since we got focus |
465 | if ((e->type() == QEvent::FocusOut) && mTextChanged) | 465 | if ((e->type() == QEvent::FocusOut) ) |
466 | { | 466 | { |
467 | lineEnterPressed(); | 467 | if ( mTextChanged ) { |
468 | mTextChanged = false; | 468 | lineEnterPressed(); |
469 | mTextChanged = false; | ||
470 | } | ||
469 | } | 471 | } |
470 | // switch dateFormShort by double klick with mouse | 472 | // switch dateFormShort by double klick with mouse |
471 | else if (e->type() == QEvent::MouseButtonDblClick) | 473 | else if (e->type() == QEvent::MouseButtonDblClick) |
472 | { | 474 | { |
473 | toggleDateFormat(); | 475 | toggleDateFormat(); |
474 | } | 476 | } |
475 | else if (e->type() == QEvent::FocusIn) | 477 | else if (e->type() == QEvent::FocusIn) |
476 | { | 478 | { |
477 | maxDay = readDate().day(); | 479 | maxDay = readDate().day(); |
478 | } | 480 | } |
479 | 481 | ||
480 | return false; | 482 | return false; |
481 | } | 483 | } |
482 | void KDateEdit::toggleDateFormat() | 484 | void KDateEdit::toggleDateFormat() |
483 | { | 485 | { |
484 | dateFormShort = ! dateFormShort; | 486 | dateFormShort = ! dateFormShort; |
485 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); | 487 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); |
486 | 488 | ||
487 | } | 489 | } |
488 | 490 | ||
489 | void KDateEdit::textChanged(const QString &) | 491 | void KDateEdit::textChanged(const QString &) |
490 | { | 492 | { |
491 | if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { | 493 | if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { |
492 | QDate date; //invalid date | 494 | QDate date; //invalid date |
@@ -1 +1 @@ | |||
version = "2.0.9"; | version = "2.0.10"; | ||