-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | kabc/addresseedialog.cpp | 15 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 8 |
3 files changed, 20 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index c4557ef..2aac9ff 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,142 +1,146 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.9 ************ | ||
4 | |||
5 | KO/Pi: | ||
6 | Fixed some problems of the new search options in the search dialog. | ||
3 | 7 | ||
4 | ********** VERSION 2.1.8 ************ | 8 | ********** VERSION 2.1.8 ************ |
5 | 9 | ||
6 | KO/Pi: | 10 | KO/Pi: |
7 | Added info about the completion state of a todo in the ListView/Searchdialog. | 11 | Added info about the completion state of a todo in the ListView/Searchdialog. |
8 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 12 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
9 | Fixed some updating problems when changing the filter. | 13 | Fixed some updating problems when changing the filter. |
10 | 14 | ||
11 | KA/Pi: | 15 | KA/Pi: |
12 | In the addressee selection dialog now the formatted name is shown, if not empty. | 16 | In the addressee selection dialog now the formatted name is shown, if not empty. |
13 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. | 17 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. |
14 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. | 18 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. |
15 | 19 | ||
16 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | 20 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. |
17 | Fixed the sorting for size in the file selector on the Z. | 21 | Fixed the sorting for size in the file selector on the Z. |
18 | 22 | ||
19 | Changed the color selection dialog on the Zaurus to a more user friendly version. | 23 | Changed the color selection dialog on the Zaurus to a more user friendly version. |
20 | 24 | ||
21 | ********** VERSION 2.1.7 ************ | 25 | ********** VERSION 2.1.7 ************ |
22 | 26 | ||
23 | KO/Pi: | 27 | KO/Pi: |
24 | Fixed several problems in the new Resource handling. | 28 | Fixed several problems in the new Resource handling. |
25 | Added more options to the search dialog. | 29 | Added more options to the search dialog. |
26 | Fixed a problem in the Month view. | 30 | Fixed a problem in the Month view. |
27 | Added more options to the dialog when setting a todo to stopped. | 31 | Added more options to the dialog when setting a todo to stopped. |
28 | 32 | ||
29 | Fixed two small problems in KO/Pi Alarm applet. | 33 | Fixed two small problems in KO/Pi Alarm applet. |
30 | 34 | ||
31 | ********** VERSION 2.1.6 ************ | 35 | ********** VERSION 2.1.6 ************ |
32 | 36 | ||
33 | This release is for testing only. | 37 | This release is for testing only. |
34 | 38 | ||
35 | KO/Pi: | 39 | KO/Pi: |
36 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 40 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
37 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 41 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
38 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 42 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
39 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 43 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
40 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 44 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
41 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 45 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
42 | 46 | ||
43 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 47 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
44 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. | 48 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. |
45 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 49 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
46 | 50 | ||
47 | A calendar is enabled in the resource view if the "eye" column is checked. | 51 | A calendar is enabled in the resource view if the "eye" column is checked. |
48 | You can set a calendar to be the default for new items( "+" column ). | 52 | You can set a calendar to be the default for new items( "+" column ). |
49 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 53 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
50 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 54 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
51 | 55 | ||
52 | 56 | ||
53 | ********** VERSION 2.1.5 ************ | 57 | ********** VERSION 2.1.5 ************ |
54 | 58 | ||
55 | This is the new stable version. | 59 | This is the new stable version. |
56 | Bugfix: | 60 | Bugfix: |
57 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 61 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
58 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 62 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
59 | Added config option to not display completed todos in agenda view. | 63 | Added config option to not display completed todos in agenda view. |
60 | Addressee view is now using the formatted name, if defined. | 64 | Addressee view is now using the formatted name, if defined. |
61 | That makes it possible to display "lastname, firstname" in that view now. | 65 | That makes it possible to display "lastname, firstname" in that view now. |
62 | To set the formatted name for all contacts, please use menu: | 66 | To set the formatted name for all contacts, please use menu: |
63 | Edit->Change->Set formatted name. | 67 | Edit->Change->Set formatted name. |
64 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 68 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
65 | 69 | ||
66 | ********** VERSION 2.1.4 ************ | 70 | ********** VERSION 2.1.4 ************ |
67 | 71 | ||
68 | Fixed two more bugs in the KA/Pi CSV import dialog: | 72 | Fixed two more bugs in the KA/Pi CSV import dialog: |
69 | Made it possible to read multi-line fields and import it to the "Note" field. | 73 | Made it possible to read multi-line fields and import it to the "Note" field. |
70 | Fixed a problem in mapping custom fields, whatever a custem field is... | 74 | Fixed a problem in mapping custom fields, whatever a custem field is... |
71 | 75 | ||
72 | ********** VERSION 2.1.3 ************ | 76 | ********** VERSION 2.1.3 ************ |
73 | 77 | ||
74 | Changed the menu structure of the alarm applet: | 78 | Changed the menu structure of the alarm applet: |
75 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 79 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
76 | 80 | ||
77 | Fixed several problems in the KA/Pi CSV import dialog: | 81 | Fixed several problems in the KA/Pi CSV import dialog: |
78 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 82 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
79 | 83 | ||
80 | 84 | ||
81 | ********** VERSION 2.1.2 ************ | 85 | ********** VERSION 2.1.2 ************ |
82 | 86 | ||
83 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 87 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
84 | 88 | ||
85 | Fixed a problem when importing data from Outlook with mutiple categories set. | 89 | Fixed a problem when importing data from Outlook with mutiple categories set. |
86 | 90 | ||
87 | Changed display of days in datenavigator: | 91 | Changed display of days in datenavigator: |
88 | Birthdays are now blue, not dark green. | 92 | Birthdays are now blue, not dark green. |
89 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 93 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
90 | When journal view is shown, only holidays are shown and days with journals are blue. | 94 | When journal view is shown, only holidays are shown and days with journals are blue. |
91 | 95 | ||
92 | Added Backup options to global config: | 96 | Added Backup options to global config: |
93 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). | 97 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). |
94 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. | 98 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. |
95 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. | 99 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. |
96 | 100 | ||
97 | ********** VERSION 2.1.1 ************ | 101 | ********** VERSION 2.1.1 ************ |
98 | 102 | ||
99 | Stable release 2.1.1! | 103 | Stable release 2.1.1! |
100 | 104 | ||
101 | KO/Pi: | 105 | KO/Pi: |
102 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 106 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
103 | 107 | ||
104 | ********** VERSION 2.1.0 ************ | 108 | ********** VERSION 2.1.0 ************ |
105 | 109 | ||
106 | Stable release 2.1.0! | 110 | Stable release 2.1.0! |
107 | 111 | ||
108 | Summary of changes/fixes compared to version 2.0.6: | 112 | Summary of changes/fixes compared to version 2.0.6: |
109 | 113 | ||
110 | Many bugs of version 2.0.6 fixed. | 114 | Many bugs of version 2.0.6 fixed. |
111 | Most of them were small bugs, but some of them were important. | 115 | Most of them were small bugs, but some of them were important. |
112 | It is recommended to use version 2.1.0 and not version 2.0.6. | 116 | It is recommended to use version 2.1.0 and not version 2.0.6. |
113 | 117 | ||
114 | Important changes: | 118 | Important changes: |
115 | 119 | ||
116 | Added recurring todos to KO/Pi. | 120 | Added recurring todos to KO/Pi. |
117 | 121 | ||
118 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 122 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
119 | 123 | ||
120 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 124 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
121 | 125 | ||
122 | Datenavigator can now display many months. Very useful on the desktop. | 126 | Datenavigator can now display many months. Very useful on the desktop. |
123 | 127 | ||
124 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 128 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
125 | 129 | ||
126 | Made alarm sound working on Linux desktop. | 130 | Made alarm sound working on Linux desktop. |
127 | 131 | ||
128 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 132 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
129 | 133 | ||
130 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 134 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
131 | 135 | ||
132 | Many other usebility enhancements. | 136 | Many other usebility enhancements. |
133 | Special thanks to Ben for his suggestions! | 137 | Special thanks to Ben for his suggestions! |
134 | 138 | ||
135 | You can find the complete changelog | 139 | You can find the complete changelog |
136 | from version 1.7.7 to 2.1.0 | 140 | from version 1.7.7 to 2.1.0 |
137 | in the source package or on | 141 | in the source package or on |
138 | 142 | ||
139 | http://www.pi-sync.net/html/changelog.html | 143 | http://www.pi-sync.net/html/changelog.html |
140 | 144 | ||
141 | 145 | ||
142 | 146 | ||
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp index 3e7b72c..9197850 100644 --- a/kabc/addresseedialog.cpp +++ b/kabc/addresseedialog.cpp | |||
@@ -1,360 +1,363 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qgroupbox.h> | 23 | #include <qgroupbox.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobalsettings.h> | 31 | #include <kglobalsettings.h> |
32 | 32 | ||
33 | #include "stdaddressbook.h" | 33 | #include "stdaddressbook.h" |
34 | 34 | ||
35 | #include "addresseedialog.h" | 35 | #include "addresseedialog.h" |
36 | #include "KDGanttMinimizeSplitter.h" | 36 | #include "KDGanttMinimizeSplitter.h" |
37 | //#include "addresseedialog.moc" | 37 | //#include "addresseedialog.moc" |
38 | 38 | ||
39 | using namespace KABC; | 39 | using namespace KABC; |
40 | 40 | ||
41 | AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : | 41 | AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : |
42 | QListViewItem( parent ), | 42 | QListViewItem( parent ), |
43 | mAddressee( addressee ) | 43 | mAddressee( addressee ) |
44 | { | 44 | { |
45 | setText( Name,addressee.realName()); | 45 | setText( Name,addressee.realName()); |
46 | setText( Email, addressee.preferredEmail() ); | 46 | setText( Email, addressee.preferredEmail() ); |
47 | setText( Category, addressee.categories().join(";") ); | 47 | setText( Category, addressee.categories().join(";") ); |
48 | } | 48 | } |
49 | 49 | ||
50 | QString AddresseeItem::key( int column, bool ) const | 50 | QString AddresseeItem::key( int column, bool ) const |
51 | { | 51 | { |
52 | 52 | ||
53 | if (column == Email) { | 53 | if (column == Email) { |
54 | QString value = text(Email); | 54 | QString value = text(Email); |
55 | int val = value.findRev("@"); | 55 | int val = value.findRev("@"); |
56 | return value.mid( val) + value.left( val ); | 56 | return value.mid( val) + value.left( val ); |
57 | } | 57 | } |
58 | return text(column).lower(); | 58 | return text(column).lower(); |
59 | } | 59 | } |
60 | 60 | ||
61 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : | 61 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : |
62 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), | 62 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), |
63 | Ok|Cancel, No, parent ), mMultiple( multiple ) | 63 | Ok|Cancel, No, parent ), mMultiple( multiple ) |
64 | { | 64 | { |
65 | qDebug("NEW AddresseeDialog "); | 65 | qDebug("NEW AddresseeDialog "); |
66 | QWidget *topWidget = plainPage(); | 66 | QWidget *topWidget = plainPage(); |
67 | 67 | ||
68 | QBoxLayout *topLayout = new QHBoxLayout( topWidget ); | 68 | QBoxLayout *topLayout = new QHBoxLayout( topWidget ); |
69 | 69 | ||
70 | 70 | ||
71 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); | 71 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); |
72 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 72 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
73 | 73 | ||
74 | topLayout->addWidget(mMiniSplitter ); | 74 | topLayout->addWidget(mMiniSplitter ); |
75 | 75 | ||
76 | QWidget *listWidget = new QWidget( mMiniSplitter ); | 76 | QWidget *listWidget = new QWidget( mMiniSplitter ); |
77 | 77 | ||
78 | QBoxLayout *listLayout = new QVBoxLayout (listWidget) ; | 78 | QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; |
79 | //topLayout->addLayout( listLayout ); | 79 | //topLayout->addLayout( listLayout ); |
80 | 80 | ||
81 | mAddresseeList = new KListView( listWidget ); | 81 | mAddresseeList = new KListView( listWidget ); |
82 | mAddresseeList->addColumn( i18n("Name") ); | 82 | mAddresseeList->addColumn( i18n("Name") ); |
83 | mAddresseeList->addColumn( i18n("Email") ); | 83 | mAddresseeList->addColumn( i18n("Email") ); |
84 | mAddresseeList->addColumn( i18n("Category") ); | 84 | mAddresseeList->addColumn( i18n("Category") ); |
85 | mAddresseeList->setAllColumnsShowFocus( true ); | 85 | mAddresseeList->setAllColumnsShowFocus( true ); |
86 | mAddresseeList->setFullWidth( true ); | 86 | mAddresseeList->setFullWidth( true ); |
87 | listLayout->addWidget( mAddresseeList ); | 87 | listLayout->addWidget( mAddresseeList ); |
88 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), | 88 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), |
89 | SLOT( slotOk() ) ); | 89 | SLOT( slotOk() ) ); |
90 | 90 | ||
91 | QHBox* searchBox = new QHBox ( listWidget ); | 91 | //QHBox* searchBox = new QHBox ( listWidget ); |
92 | mAddresseeEdit = new QLineEdit( searchBox ); | 92 | mAddresseeEdit = new QLineEdit( listWidget ); |
93 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), | 93 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), |
94 | SLOT( loadAddressBook() ) ); | 94 | SLOT( loadAddressBook() ) ); |
95 | mAddresseeEdit->setFocus(); | 95 | mAddresseeEdit->setFocus(); |
96 | QPushButton *searchButton = new QPushButton( i18n("Search!"), searchBox ); | 96 | QPushButton *searchButton = new QPushButton( i18n("Search!"), listWidget ); |
97 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); | 97 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); |
98 | 98 | ||
99 | listLayout->addWidget( searchBox ); | 99 | QHBoxLayout *searchLayout = new QHBoxLayout (listLayout) ; |
100 | searchLayout->addWidget( mAddresseeEdit ); | ||
101 | searchLayout->addWidget( searchButton ); | ||
102 | //listLayout->addWidget( searchBox ); | ||
100 | 103 | ||
101 | if ( mMultiple ) { | 104 | if ( mMultiple ) { |
102 | //QBoxLayout *selectedLayout = new QVBoxLayout; | 105 | //QBoxLayout *selectedLayout = new QVBoxLayout; |
103 | //topLayout->addLayout( selectedLayout ); | 106 | //topLayout->addLayout( selectedLayout ); |
104 | //topLayout->setSpacing( spacingHint() ); | 107 | //topLayout->setSpacing( spacingHint() ); |
105 | 108 | ||
106 | QVBox *selectedGroup = new QVBox( mMiniSplitter ); | 109 | QVBox *selectedGroup = new QVBox( mMiniSplitter ); |
107 | new QLabel ( i18n("Selected:"), selectedGroup ); | 110 | new QLabel ( i18n("Selected:"), selectedGroup ); |
108 | //selectedLayout->addWidget( selectedGroup ); | 111 | //selectedLayout->addWidget( selectedGroup ); |
109 | 112 | ||
110 | mSelectedList = new KListView( selectedGroup ); | 113 | mSelectedList = new KListView( selectedGroup ); |
111 | mSelectedList->addColumn( i18n("Name") ); | 114 | mSelectedList->addColumn( i18n("Name") ); |
112 | mSelectedList->addColumn( i18n("Email") ); | 115 | mSelectedList->addColumn( i18n("Email") ); |
113 | mSelectedList->setAllColumnsShowFocus( true ); | 116 | mSelectedList->setAllColumnsShowFocus( true ); |
114 | mSelectedList->setFullWidth( true ); | 117 | mSelectedList->setFullWidth( true ); |
115 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), | 118 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), |
116 | // SLOT( removeSelected() ) ); | 119 | // SLOT( removeSelected() ) ); |
117 | connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), | 120 | connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), |
118 | SLOT( removeSelected() ) ); | 121 | SLOT( removeSelected() ) ); |
119 | connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), | 122 | connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), |
120 | SLOT( removeSelected() ) ); | 123 | SLOT( removeSelected() ) ); |
121 | 124 | ||
122 | #if 0 | 125 | #if 0 |
123 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); | 126 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); |
124 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); | 127 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); |
125 | 128 | ||
126 | #endif | 129 | #endif |
127 | connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), | 130 | connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), |
128 | SLOT( addSelected( QListViewItem * ) ) ); | 131 | SLOT( addSelected( QListViewItem * ) ) ); |
129 | connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), | 132 | connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), |
130 | SLOT( selectNextItem( QListViewItem * ) ) ); | 133 | SLOT( selectNextItem( QListViewItem * ) ) ); |
131 | 134 | ||
132 | } | 135 | } |
133 | 136 | ||
134 | mAddressBook = StdAddressBook::self( true ); | 137 | mAddressBook = StdAddressBook::self( true ); |
135 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), | 138 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), |
136 | SLOT( addressBookChanged() ) ); | 139 | SLOT( addressBookChanged() ) ); |
137 | #if 0 | 140 | #if 0 |
138 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), | 141 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), |
139 | SLOT( addressBookChanged() ) ); | 142 | SLOT( addressBookChanged() ) ); |
140 | #endif | 143 | #endif |
141 | loadAddressBook(); | 144 | loadAddressBook(); |
142 | QValueList<int> splitterSize; | 145 | QValueList<int> splitterSize; |
143 | splitterSize.append( ( width() / 5 ) * 3 ); | 146 | splitterSize.append( ( width() / 5 ) * 3 ); |
144 | splitterSize.append( ( width() / 5 ) *2 ); | 147 | splitterSize.append( ( width() / 5 ) *2 ); |
145 | mMiniSplitter->setSizes( splitterSize ); | 148 | mMiniSplitter->setSizes( splitterSize ); |
146 | } | 149 | } |
147 | 150 | ||
148 | AddresseeDialog::~AddresseeDialog() | 151 | AddresseeDialog::~AddresseeDialog() |
149 | { | 152 | { |
150 | qDebug("DELETE AddresseeDialog "); | 153 | qDebug("DELETE AddresseeDialog "); |
151 | } | 154 | } |
152 | 155 | ||
153 | void AddresseeDialog::loadAddressBook() | 156 | void AddresseeDialog::loadAddressBook() |
154 | { | 157 | { |
155 | mAddresseeList->clear(); | 158 | mAddresseeList->clear(); |
156 | mItemDict.clear(); | 159 | mItemDict.clear(); |
157 | if ( mAddresseeEdit->text().isEmpty() ) { | 160 | if ( mAddresseeEdit->text().isEmpty() ) { |
158 | AddressBook::Iterator it; | 161 | AddressBook::Iterator it; |
159 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 162 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
160 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 163 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
161 | continue; | 164 | continue; |
162 | new AddresseeItem( mAddresseeList, (*it) ); | 165 | new AddresseeItem( mAddresseeList, (*it) ); |
163 | } | 166 | } |
164 | return; | 167 | return; |
165 | } | 168 | } |
166 | //mAddresseeEdit->completionObject()->clear(); | 169 | //mAddresseeEdit->completionObject()->clear(); |
167 | QRegExp re; | 170 | QRegExp re; |
168 | re.setWildcard(true); // most people understand these better. | 171 | re.setWildcard(true); // most people understand these better. |
169 | re.setCaseSensitive(false); | 172 | re.setCaseSensitive(false); |
170 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); | 173 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); |
171 | 174 | ||
172 | AddressBook::Iterator it; | 175 | AddressBook::Iterator it; |
173 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 176 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
174 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 177 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
175 | continue; | 178 | continue; |
176 | QString name = (*it).realName(); | 179 | QString name = (*it).realName(); |
177 | name += (*it).preferredEmail(); | 180 | name += (*it).preferredEmail(); |
178 | name += (*it).categories().join(";"); | 181 | name += (*it).categories().join(";"); |
179 | #if QT_VERSION >= 0x030000 | 182 | #if QT_VERSION >= 0x030000 |
180 | if (re.search(name) != -1) | 183 | if (re.search(name) != -1) |
181 | #else | 184 | #else |
182 | if (re.match(name) != -1) | 185 | if (re.match(name) != -1) |
183 | #endif | 186 | #endif |
184 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); | 187 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); |
185 | } | 188 | } |
186 | } | 189 | } |
187 | 190 | ||
188 | void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) | 191 | void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) |
189 | { | 192 | { |
190 | if ( str.isEmpty() ) return; | 193 | if ( str.isEmpty() ) return; |
191 | 194 | ||
192 | mItemDict.insert( str, item ); | 195 | mItemDict.insert( str, item ); |
193 | //mAddresseeEdit->completionObject()->addItem( str ); | 196 | //mAddresseeEdit->completionObject()->addItem( str ); |
194 | } | 197 | } |
195 | 198 | ||
196 | void AddresseeDialog::selectItem( const QString &str ) | 199 | void AddresseeDialog::selectItem( const QString &str ) |
197 | { | 200 | { |
198 | if ( str.isEmpty() ) return; | 201 | if ( str.isEmpty() ) return; |
199 | 202 | ||
200 | QListViewItem *item = mItemDict.find( str ); | 203 | QListViewItem *item = mItemDict.find( str ); |
201 | if ( item ) { | 204 | if ( item ) { |
202 | mAddresseeList->blockSignals( true ); | 205 | mAddresseeList->blockSignals( true ); |
203 | mAddresseeList->setSelected( item, true ); | 206 | mAddresseeList->setSelected( item, true ); |
204 | mAddresseeList->ensureItemVisible( item ); | 207 | mAddresseeList->ensureItemVisible( item ); |
205 | mAddresseeList->blockSignals( false ); | 208 | mAddresseeList->blockSignals( false ); |
206 | } | 209 | } |
207 | } | 210 | } |
208 | 211 | ||
209 | void AddresseeDialog::updateEdit( QListViewItem *item ) | 212 | void AddresseeDialog::updateEdit( QListViewItem *item ) |
210 | { | 213 | { |
211 | mAddresseeEdit->setText( item->text( 0 ) ); | 214 | mAddresseeEdit->setText( item->text( 0 ) ); |
212 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); | 215 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); |
213 | } | 216 | } |
214 | 217 | ||
215 | void AddresseeDialog::selectNextItem( QListViewItem *item ) | 218 | void AddresseeDialog::selectNextItem( QListViewItem *item ) |
216 | { | 219 | { |
217 | addSelected( item ); | 220 | addSelected( item ); |
218 | QListViewItem *next = item->nextSibling(); | 221 | QListViewItem *next = item->nextSibling(); |
219 | if ( next ) { | 222 | if ( next ) { |
220 | next->setSelected( true ); | 223 | next->setSelected( true ); |
221 | item->setSelected( false ); | 224 | item->setSelected( false ); |
222 | mAddresseeList->setCurrentItem( next ); | 225 | mAddresseeList->setCurrentItem( next ); |
223 | } | 226 | } |
224 | } | 227 | } |
225 | void AddresseeDialog::addSelected( QListViewItem *item ) | 228 | void AddresseeDialog::addSelected( QListViewItem *item ) |
226 | { | 229 | { |
227 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 230 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
228 | if ( !addrItem ) return; | 231 | if ( !addrItem ) return; |
229 | 232 | ||
230 | Addressee a = addrItem->addressee(); | 233 | Addressee a = addrItem->addressee(); |
231 | 234 | ||
232 | QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); | 235 | QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); |
233 | if ( !selectedItem ) { | 236 | if ( !selectedItem ) { |
234 | selectedItem = new AddresseeItem( mSelectedList, a ); | 237 | selectedItem = new AddresseeItem( mSelectedList, a ); |
235 | mSelectedDict.insert( a.uid(), selectedItem ); | 238 | mSelectedDict.insert( a.uid(), selectedItem ); |
236 | } | 239 | } |
237 | 240 | ||
238 | } | 241 | } |
239 | 242 | ||
240 | void AddresseeDialog::removeSelected() | 243 | void AddresseeDialog::removeSelected() |
241 | { | 244 | { |
242 | QListViewItem *item = mSelectedList->selectedItem(); | 245 | QListViewItem *item = mSelectedList->selectedItem(); |
243 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 246 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
244 | if ( !addrItem ) return; | 247 | if ( !addrItem ) return; |
245 | QListViewItem *next = item->nextSibling(); | 248 | QListViewItem *next = item->nextSibling(); |
246 | mSelectedDict.remove( addrItem->addressee().uid() ); | 249 | mSelectedDict.remove( addrItem->addressee().uid() ); |
247 | delete addrItem; | 250 | delete addrItem; |
248 | if ( next ) | 251 | if ( next ) |
249 | next->setSelected( true ); | 252 | next->setSelected( true ); |
250 | } | 253 | } |
251 | 254 | ||
252 | Addressee AddresseeDialog::addressee() | 255 | Addressee AddresseeDialog::addressee() |
253 | { | 256 | { |
254 | AddresseeItem *aItem = 0; | 257 | AddresseeItem *aItem = 0; |
255 | 258 | ||
256 | if ( mMultiple ) | 259 | if ( mMultiple ) |
257 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); | 260 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); |
258 | else | 261 | else |
259 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 262 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
260 | 263 | ||
261 | if (aItem) return aItem->addressee(); | 264 | if (aItem) return aItem->addressee(); |
262 | return Addressee(); | 265 | return Addressee(); |
263 | } | 266 | } |
264 | 267 | ||
265 | Addressee::List AddresseeDialog::addressees() | 268 | Addressee::List AddresseeDialog::addressees() |
266 | { | 269 | { |
267 | Addressee::List al; | 270 | Addressee::List al; |
268 | AddresseeItem *aItem = 0; | 271 | AddresseeItem *aItem = 0; |
269 | 272 | ||
270 | if ( mMultiple ) { | 273 | if ( mMultiple ) { |
271 | QListViewItem *item = mSelectedList->firstChild(); | 274 | QListViewItem *item = mSelectedList->firstChild(); |
272 | while( item ) { | 275 | while( item ) { |
273 | aItem = (AddresseeItem *)( item ); | 276 | aItem = (AddresseeItem *)( item ); |
274 | if ( aItem ) al.append( aItem->addressee() ); | 277 | if ( aItem ) al.append( aItem->addressee() ); |
275 | item = item->nextSibling(); | 278 | item = item->nextSibling(); |
276 | } | 279 | } |
277 | } | 280 | } |
278 | else | 281 | else |
279 | { | 282 | { |
280 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 283 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
281 | if (aItem) al.append( aItem->addressee() ); | 284 | if (aItem) al.append( aItem->addressee() ); |
282 | } | 285 | } |
283 | 286 | ||
284 | return al; | 287 | return al; |
285 | } | 288 | } |
286 | 289 | ||
287 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) | 290 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) |
288 | { | 291 | { |
289 | AddresseeDialog *dlg = new AddresseeDialog( parent ); | 292 | AddresseeDialog *dlg = new AddresseeDialog( parent ); |
290 | Addressee addressee; | 293 | Addressee addressee; |
291 | #ifdef DESKTOP_VERSION | 294 | #ifdef DESKTOP_VERSION |
292 | static int geoX = 0; | 295 | static int geoX = 0; |
293 | static int geoY = 0; | 296 | static int geoY = 0; |
294 | static int geoW = 0; | 297 | static int geoW = 0; |
295 | static int geoH = 0; | 298 | static int geoH = 0; |
296 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 299 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
297 | geoX = dlg->geometry().x(); | 300 | geoX = dlg->geometry().x(); |
298 | geoY = dlg->geometry().y(); | 301 | geoY = dlg->geometry().y(); |
299 | geoW = dlg->width(); | 302 | geoW = dlg->width(); |
300 | geoH = dlg->height(); | 303 | geoH = dlg->height(); |
301 | } else { | 304 | } else { |
302 | dlg->show(); | 305 | dlg->show(); |
303 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 306 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
304 | 307 | ||
305 | } | 308 | } |
306 | #endif | 309 | #endif |
307 | int result = dlg->exec(); | 310 | int result = dlg->exec(); |
308 | #ifdef DESKTOP_VERSION | 311 | #ifdef DESKTOP_VERSION |
309 | geoX = dlg->geometry().x(); | 312 | geoX = dlg->geometry().x(); |
310 | geoY = dlg->geometry().y(); | 313 | geoY = dlg->geometry().y(); |
311 | geoW = dlg->width(); | 314 | geoW = dlg->width(); |
312 | geoH = dlg->height(); | 315 | geoH = dlg->height(); |
313 | #endif | 316 | #endif |
314 | if ( result == QDialog::Accepted ) { | 317 | if ( result == QDialog::Accepted ) { |
315 | addressee = dlg->addressee(); | 318 | addressee = dlg->addressee(); |
316 | } | 319 | } |
317 | 320 | ||
318 | delete dlg; | 321 | delete dlg; |
319 | return addressee; | 322 | return addressee; |
320 | } | 323 | } |
321 | 324 | ||
322 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) | 325 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) |
323 | { | 326 | { |
324 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); | 327 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); |
325 | Addressee::List addressees; | 328 | Addressee::List addressees; |
326 | static int geoX = 0; | 329 | static int geoX = 0; |
327 | static int geoY = 0; | 330 | static int geoY = 0; |
328 | static int geoW = 0; | 331 | static int geoW = 0; |
329 | static int geoH = 0; | 332 | static int geoH = 0; |
330 | if ( QApplication::desktop()->width() <= 640 ) | 333 | if ( QApplication::desktop()->width() <= 640 ) |
331 | dlg->showMaximized(); | 334 | dlg->showMaximized(); |
332 | else { | 335 | else { |
333 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 336 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
334 | geoX = dlg->geometry().x(); | 337 | geoX = dlg->geometry().x(); |
335 | geoY = dlg->geometry().y(); | 338 | geoY = dlg->geometry().y(); |
336 | geoW = dlg->width(); | 339 | geoW = dlg->width(); |
337 | geoH = dlg->height(); | 340 | geoH = dlg->height(); |
338 | } else { | 341 | } else { |
339 | dlg->show(); | 342 | dlg->show(); |
340 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 343 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
341 | 344 | ||
342 | } | 345 | } |
343 | } | 346 | } |
344 | int result = dlg->exec(); | 347 | int result = dlg->exec(); |
345 | geoX = dlg->geometry().x(); | 348 | geoX = dlg->geometry().x(); |
346 | geoY = dlg->geometry().y(); | 349 | geoY = dlg->geometry().y(); |
347 | geoW = dlg->width(); | 350 | geoW = dlg->width(); |
348 | geoH = dlg->height(); | 351 | geoH = dlg->height(); |
349 | if ( result == QDialog::Accepted ) { | 352 | if ( result == QDialog::Accepted ) { |
350 | addressees = dlg->addressees(); | 353 | addressees = dlg->addressees(); |
351 | } | 354 | } |
352 | 355 | ||
353 | delete dlg; | 356 | delete dlg; |
354 | return addressees; | 357 | return addressees; |
355 | } | 358 | } |
356 | 359 | ||
357 | void AddresseeDialog::addressBookChanged() | 360 | void AddresseeDialog::addressBookChanged() |
358 | { | 361 | { |
359 | loadAddressBook(); | 362 | loadAddressBook(); |
360 | } | 363 | } |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index a8de297..0713980 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,588 +1,594 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qgroupbox.h> | 27 | #include <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qhbuttongroup.h> | 33 | #include <qhbuttongroup.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkdepim/kdateedit.h> | 37 | #include <libkdepim/kdateedit.h> |
38 | 38 | ||
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "klineedit.h" | 41 | #include "klineedit.h" |
42 | 42 | ||
43 | #include "calendarview.h" | 43 | #include "calendarview.h" |
44 | #include "koviewmanager.h" | 44 | #include "koviewmanager.h" |
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | /* | 58 | /* |
59 | searchLabel = new QLabel(topFrame); | 59 | searchLabel = new QLabel(topFrame); |
60 | searchLabel->setText(i18n("Search for:")); | 60 | searchLabel->setText(i18n("Search for:")); |
61 | subLayout->addWidget(searchLabel); | 61 | subLayout->addWidget(searchLabel); |
62 | */ | 62 | */ |
63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); | 63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); |
64 | //OkButton->setDefault( true ); | 64 | //OkButton->setDefault( true ); |
65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
66 | subLayout->addWidget(OkButton); | 66 | subLayout->addWidget(OkButton); |
67 | searchEdit = new KLineEdit(topFrame); | 67 | searchEdit = new KLineEdit(topFrame); |
68 | subLayout->addWidget(searchEdit); | 68 | subLayout->addWidget(searchEdit); |
69 | 69 | ||
70 | mAddItems = new QRadioButton( "+ ", topFrame ); | 70 | mAddItems = new QRadioButton( "+ ", topFrame ); |
71 | mSubItems = new QRadioButton( "- ", topFrame ); | 71 | mSubItems = new QRadioButton( "- ", topFrame ); |
72 | mRefineItems = new QRadioButton( "< ", topFrame ); | 72 | mRefineItems = new QRadioButton( "< ", topFrame ); |
73 | subLayout->addWidget( mAddItems ); | 73 | subLayout->addWidget( mAddItems ); |
74 | subLayout->addWidget( mSubItems ); | 74 | subLayout->addWidget( mSubItems ); |
75 | subLayout->addWidget( mRefineItems ); | 75 | subLayout->addWidget( mRefineItems ); |
76 | QFont fo ( mAddItems->font() ); | 76 | QFont fo ( mAddItems->font() ); |
77 | fo.setBold( true ); | 77 | fo.setBold( true ); |
78 | fo.setPointSize( fo.pointSize() + 2 ); | 78 | fo.setPointSize( fo.pointSize() + 2 ); |
79 | mAddItems->setFont( fo ); | 79 | mAddItems->setFont( fo ); |
80 | mSubItems->setFont( fo ); | 80 | mSubItems->setFont( fo ); |
81 | mRefineItems->setFont( fo ); | 81 | mRefineItems->setFont( fo ); |
82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); | 82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); |
83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); | 83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); |
84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); | 84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); |
85 | 85 | ||
86 | QPushButton *togButton = new QPushButton( "", topFrame ); | 86 | QPushButton *togButton = new QPushButton( "", topFrame ); |
87 | subLayout->addWidget(togButton); | 87 | subLayout->addWidget(togButton); |
88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); | 88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); |
89 | togButton->setPixmap(SmallIcon("1updownarrow")); | 89 | togButton->setPixmap(SmallIcon("1updownarrow")); |
90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); | 90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); |
91 | 91 | ||
92 | searchEdit->setText("*"); // Find all events by default | 92 | searchEdit->setText("*"); // Find all events by default |
93 | searchEdit->setFocus(); | 93 | searchEdit->setFocus(); |
94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
96 | // Subjects to search | 96 | // Subjects to search |
97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
98 | // topFrame); | 98 | // topFrame); |
99 | 99 | ||
100 | incidenceGroup = new QHBox( topFrame ); | 100 | incidenceGroup = new QHBox( topFrame ); |
101 | layout->addWidget(incidenceGroup); | 101 | layout->addWidget(incidenceGroup); |
102 | 102 | ||
103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
104 | //mSearchEvent->setChecked(true); | 104 | //mSearchEvent->setChecked(true); |
105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
107 | 107 | ||
108 | subjectGroup = new QHBox( topFrame ); | 108 | subjectGroup = new QHBox( topFrame ); |
109 | layout->addWidget(subjectGroup); | 109 | layout->addWidget(subjectGroup); |
110 | 110 | ||
111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
112 | mSummaryCheck->setChecked(true); | 112 | mSummaryCheck->setChecked(true); |
113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
115 | 115 | ||
116 | attendeeGroup = new QHBox( topFrame ); | 116 | attendeeGroup = new QHBox( topFrame ); |
117 | layout->addWidget(attendeeGroup ); | 117 | layout->addWidget(attendeeGroup ); |
118 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 118 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
121 | // Date range | 121 | // Date range |
122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
123 | // topFrame); | 123 | // topFrame); |
124 | // layout->addWidget(rangeGroup); | 124 | // layout->addWidget(rangeGroup); |
125 | 125 | ||
126 | QWidget *rangeWidget = new QWidget(topFrame); | 126 | QWidget *rangeWidget = new QWidget(topFrame); |
127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
129 | mStartDate = new KDateEdit(rangeWidget); | 129 | mStartDate = new KDateEdit(rangeWidget); |
130 | rangeLayout->addWidget(mStartDate); | 130 | rangeLayout->addWidget(mStartDate); |
131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
132 | mEndDate = new KDateEdit(rangeWidget); | 132 | mEndDate = new KDateEdit(rangeWidget); |
133 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 133 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
134 | rangeLayout->addWidget(mEndDate); | 134 | rangeLayout->addWidget(mEndDate); |
135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
136 | rangeLayout->addWidget( (QWidget*)wt ); | 136 | rangeLayout->addWidget( (QWidget*)wt ); |
137 | layout->addWidget(rangeWidget); | 137 | layout->addWidget(rangeWidget); |
138 | // Results list view | 138 | // Results list view |
139 | listView = new KOListView(mCalendar,topFrame); | 139 | listView = new KOListView(mCalendar,topFrame); |
140 | layout->addWidget(listView); | 140 | layout->addWidget(listView); |
141 | listView->showCompletedTodos(); | 141 | listView->showCompletedTodos(); |
142 | //layout->setStretchFactor( listView, 333 ); | 142 | //layout->setStretchFactor( listView, 333 ); |
143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
144 | //listView->setMaximumHeight( 50 ); | 144 | //listView->setMaximumHeight( 50 ); |
145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
147 | 147 | ||
148 | setCaption( i18n("KO/Pi Find: ")); | 148 | setCaption( i18n("KO/Pi Find: ")); |
149 | #ifdef DESKTOP_VERSION | 149 | #ifdef DESKTOP_VERSION |
150 | OkButton = new QPushButton( i18n("Close"), this ); | 150 | OkButton = new QPushButton( i18n("Close"), this ); |
151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | 154 | ||
155 | SearchDialog::~SearchDialog() | 155 | SearchDialog::~SearchDialog() |
156 | { | 156 | { |
157 | 157 | ||
158 | } | 158 | } |
159 | void SearchDialog::slot_add( bool b ) | 159 | void SearchDialog::slot_add( bool b ) |
160 | { | 160 | { |
161 | if ( b ) { | 161 | if ( b ) { |
162 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 162 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
164 | setCaption( i18n("Matching items will be added to list")); | 164 | setCaption( i18n("Matching items will be added to list")); |
165 | } else | 165 | } else |
166 | setCaption( i18n("List will be cleared before search")); | 166 | setCaption( i18n("List will be cleared before search")); |
167 | } | 167 | } |
168 | void SearchDialog::slot_sub( bool b) | 168 | void SearchDialog::slot_sub( bool b) |
169 | { | 169 | { |
170 | if ( b ) { | 170 | if ( b ) { |
171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
172 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 172 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
173 | setCaption( i18n("Matching items will be removed from list")); | 173 | setCaption( i18n("Matching items will be removed from list")); |
174 | } else | 174 | } else |
175 | setCaption( i18n("List will be cleared before search")); | 175 | setCaption( i18n("List will be cleared before search")); |
176 | } | 176 | } |
177 | void SearchDialog::slot_refine( bool b) | 177 | void SearchDialog::slot_refine( bool b) |
178 | { | 178 | { |
179 | if ( b ) { | 179 | if ( b ) { |
180 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 180 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
181 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 181 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
182 | setCaption( i18n("Search on displayed list only")); | 182 | setCaption( i18n("Search on displayed list only")); |
183 | } else | 183 | } else |
184 | setCaption( i18n("List will be cleared before search")); | 184 | setCaption( i18n("List will be cleared before search")); |
185 | } | 185 | } |
186 | void SearchDialog::toggleCheckboxes() | 186 | void SearchDialog::toggleCheckboxes() |
187 | { | 187 | { |
188 | if ( incidenceGroup->isVisible() ) { | 188 | if ( incidenceGroup->isVisible() ) { |
189 | incidenceGroup->hide() ; | 189 | incidenceGroup->hide() ; |
190 | subjectGroup->hide() ; | 190 | subjectGroup->hide() ; |
191 | attendeeGroup->hide() ; | 191 | attendeeGroup->hide() ; |
192 | } else { | 192 | } else { |
193 | incidenceGroup->show() ; | 193 | incidenceGroup->show() ; |
194 | subjectGroup->show() ; | 194 | subjectGroup->show() ; |
195 | attendeeGroup->show() ; | 195 | attendeeGroup->show() ; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | void SearchDialog::raiseAndSelect() | 198 | void SearchDialog::raiseAndSelect() |
199 | { | 199 | { |
200 | 200 | ||
201 | static int currentState = 0; | 201 | static int currentState = 0; |
202 | 202 | ||
203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
204 | currentState = 0; | 204 | currentState = 0; |
205 | int newState = 0; | 205 | int newState = 0; |
206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
207 | newState = VIEW_J_VIEW; | 207 | newState = VIEW_J_VIEW; |
208 | } | 208 | } |
209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
210 | newState = VIEW_T_VIEW; | 210 | newState = VIEW_T_VIEW; |
211 | } | 211 | } |
212 | else { | 212 | else { |
213 | newState = VIEW_A_VIEW; | 213 | newState = VIEW_A_VIEW; |
214 | } | 214 | } |
215 | if ( newState != currentState ) { | 215 | if ( newState != currentState ) { |
216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
217 | if ( ! mSearchJournal->isChecked() ) { | 217 | if ( ! mSearchJournal->isChecked() ) { |
218 | mSearchJournal->setChecked( true ); | 218 | mSearchJournal->setChecked( true ); |
219 | mSearchTodo->setChecked( false ); | 219 | mSearchTodo->setChecked( false ); |
220 | mSearchEvent->setChecked( false ); | 220 | mSearchEvent->setChecked( false ); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 223 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
224 | if ( ! mSearchTodo->isChecked() ) { | 224 | if ( ! mSearchTodo->isChecked() ) { |
225 | mSearchTodo->setChecked( true ); | 225 | mSearchTodo->setChecked( true ); |
226 | mSearchJournal->setChecked( false ); | 226 | mSearchJournal->setChecked( false ); |
227 | mSearchEvent->setChecked( false ); | 227 | mSearchEvent->setChecked( false ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | else { | 230 | else { |
231 | if ( ! mSearchEvent->isChecked() ) { | 231 | if ( ! mSearchEvent->isChecked() ) { |
232 | mSearchEvent->setChecked( true ); | 232 | mSearchEvent->setChecked( true ); |
233 | mSearchJournal->setChecked( false ); | 233 | mSearchJournal->setChecked( false ); |
234 | mSearchTodo->setChecked( false ); | 234 | mSearchTodo->setChecked( false ); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
238 | currentState = newState; | 238 | currentState = newState; |
239 | raise(); | 239 | raise(); |
240 | } | 240 | } |
241 | void SearchDialog::setFocusToList() | 241 | void SearchDialog::setFocusToList() |
242 | { | 242 | { |
243 | listView->resetFocus(); | 243 | listView->resetFocus(); |
244 | } | 244 | } |
245 | void SearchDialog::accept() | 245 | void SearchDialog::accept() |
246 | { | 246 | { |
247 | doSearch(); | 247 | doSearch(); |
248 | } | 248 | } |
249 | void SearchDialog::updateList() | 249 | void SearchDialog::updateList() |
250 | { | 250 | { |
251 | //listView->updateList(); | 251 | //listView->updateList(); |
252 | if ( isVisible() ) { | 252 | if ( isVisible() ) { |
253 | updateView(); | 253 | updateView(); |
254 | //qDebug("SearchDialog::updated "); | 254 | //qDebug("SearchDialog::updated "); |
255 | } | 255 | } |
256 | else { | 256 | else { |
257 | listView->clear(); | 257 | listView->clear(); |
258 | //qDebug("SearchDialog::cleared "); | 258 | //qDebug("SearchDialog::cleared "); |
259 | 259 | ||
260 | } | 260 | } |
261 | } | 261 | } |
262 | void SearchDialog::searchTextChanged( const QString &_text ) | 262 | void SearchDialog::searchTextChanged( const QString &_text ) |
263 | { | 263 | { |
264 | #if 0 | 264 | #if 0 |
265 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 265 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
266 | #endif | 266 | #endif |
267 | } | 267 | } |
268 | 268 | ||
269 | void SearchDialog::doSearch() | 269 | void SearchDialog::doSearch() |
270 | { | 270 | { |
271 | QRegExp re; | 271 | QRegExp re; |
272 | 272 | ||
273 | re.setWildcard(true); // most people understand these better. | 273 | re.setWildcard(true); // most people understand these better. |
274 | re.setCaseSensitive(false); | 274 | re.setCaseSensitive(false); |
275 | QString st = searchEdit->text(); | 275 | QString st = searchEdit->text(); |
276 | if ( st.right(1) != "*") | 276 | if ( st.right(1) != "*") |
277 | st += "*"; | 277 | st += "*"; |
278 | re.setPattern(st); | 278 | re.setPattern(st); |
279 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 279 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
280 | KMessageBox::sorry(this, | 280 | KMessageBox::sorry(this, |
281 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 281 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
282 | return; | 282 | return; |
283 | } | 283 | } |
284 | if (!re.isValid() ) { | 284 | if (!re.isValid() ) { |
285 | KMessageBox::sorry(this, | 285 | KMessageBox::sorry(this, |
286 | i18n("Invalid search expression,\ncannot perform " | 286 | i18n("Invalid search expression,\ncannot perform " |
287 | "the search.\nPlease enter a search expression\n" | 287 | "the search.\nPlease enter a search expression\n" |
288 | "using the wildcard characters\n '*' and '?'" | 288 | "using the wildcard characters\n '*' and '?'" |
289 | "where needed.")); | 289 | "where needed.")); |
290 | return; | 290 | return; |
291 | } | 291 | } |
292 | search(re); | 292 | search(re); |
293 | listView->setStartDate( mStartDate->date() ); | 293 | listView->setStartDate( mStartDate->date() ); |
294 | listView->showEvents(mMatchedEvents); | 294 | listView->showEvents(mMatchedEvents); |
295 | listView->addTodos(mMatchedTodos); | 295 | listView->addTodos(mMatchedTodos); |
296 | listView->addJournals(mMatchedJournals); | 296 | listView->addJournals(mMatchedJournals); |
297 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 297 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
298 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 298 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
299 | } else { | 299 | } else { |
300 | QString mess; | 300 | QString mess; |
301 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 301 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
302 | setCaption( i18n("KO/Pi Find: ") + mess); | 302 | setCaption( i18n("KO/Pi Find: ") + mess); |
303 | 303 | ||
304 | } | 304 | } |
305 | searchEdit->setFocus(); | 305 | searchEdit->setFocus(); |
306 | } | 306 | } |
307 | void SearchDialog::updateConfig() | 307 | void SearchDialog::updateConfig() |
308 | { | 308 | { |
309 | listView->updateConfig(); | 309 | listView->updateConfig(); |
310 | } | 310 | } |
311 | void SearchDialog::updateView() | 311 | void SearchDialog::updateView() |
312 | { | 312 | { |
313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 313 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
314 | QRegExp re; | 314 | QRegExp re; |
315 | re.setWildcard(true); // most people understand these better. | 315 | re.setWildcard(true); // most people understand these better. |
316 | re.setCaseSensitive(false); | 316 | re.setCaseSensitive(false); |
317 | QString st = searchEdit->text(); | 317 | QString st = searchEdit->text(); |
318 | if ( st.right(1) != "*") | 318 | if ( st.right(1) != "*") |
319 | st += "*"; | 319 | st += "*"; |
320 | re.setPattern(st); | 320 | re.setPattern(st); |
321 | if (re.isValid()) { | 321 | if (re.isValid()) { |
322 | search(re); | 322 | search(re); |
323 | } else { | 323 | } else { |
324 | mMatchedEvents.clear(); | 324 | mMatchedEvents.clear(); |
325 | mMatchedTodos.clear(); | 325 | mMatchedTodos.clear(); |
326 | mMatchedJournals.clear(); | 326 | mMatchedJournals.clear(); |
327 | } | 327 | } |
328 | listView->setStartDate( mStartDate->date() ); | 328 | listView->setStartDate( mStartDate->date() ); |
329 | listView->showEvents(mMatchedEvents); | 329 | listView->showEvents(mMatchedEvents); |
330 | listView->addTodos(mMatchedTodos); | 330 | listView->addTodos(mMatchedTodos); |
331 | listView->addJournals(mMatchedJournals); | 331 | listView->addJournals(mMatchedJournals); |
332 | } | 332 | } |
333 | 333 | ||
334 | void SearchDialog::search(const QRegExp &re) | 334 | void SearchDialog::search(const QRegExp &re) |
335 | { | 335 | { |
336 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 336 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
337 | mEndDate->date(), | 337 | mEndDate->date(), |
338 | false /*mInclusiveCheck->isChecked()*/ ); | 338 | false /*mInclusiveCheck->isChecked()*/ ); |
339 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 339 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
340 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; | 340 | if ( mRefineItems->isChecked() ) events = mMatchedEvents; |
341 | mMatchedEvents.clear(); | 341 | mMatchedEvents.clear(); |
342 | } | 342 | } |
343 | if ( mSearchEvent->isChecked() ) { | 343 | if ( mSearchEvent->isChecked() ) { |
344 | Event *ev; | 344 | Event *ev; |
345 | for(ev=events.first();ev;ev=events.next()) { | 345 | for(ev=events.first();ev;ev=events.next()) { |
346 | if (mSummaryCheck->isChecked()) { | 346 | if (mSummaryCheck->isChecked()) { |
347 | #if QT_VERSION >= 0x030000 | 347 | #if QT_VERSION >= 0x030000 |
348 | if (re.search(ev->summary()) != -1) | 348 | if (re.search(ev->summary()) != -1) |
349 | #else | 349 | #else |
350 | if (re.match(ev->summary()) != -1) | 350 | if (re.match(ev->summary()) != -1) |
351 | #endif | 351 | #endif |
352 | { | 352 | { |
353 | if ( mSubItems->isChecked() ) | 353 | if ( mSubItems->isChecked() ) |
354 | mMatchedEvents.remove(ev); | 354 | mMatchedEvents.remove(ev); |
355 | else { | 355 | else { |
356 | if ( !mMatchedEvents.contains( ev ) ) | 356 | if ( !mMatchedEvents.contains( ev ) ) |
357 | mMatchedEvents.append(ev); | 357 | mMatchedEvents.append(ev); |
358 | } | 358 | } |
359 | continue; | 359 | continue; |
360 | } | 360 | } |
361 | #if QT_VERSION >= 0x030000 | 361 | #if QT_VERSION >= 0x030000 |
362 | if (re.search(ev->location()) != -1) | 362 | if (re.search(ev->location()) != -1) |
363 | #else | 363 | #else |
364 | if (re.match(ev->location()) != -1) | 364 | if (re.match(ev->location()) != -1) |
365 | #endif | 365 | #endif |
366 | { | 366 | { |
367 | if ( mSubItems->isChecked() ) | 367 | if ( mSubItems->isChecked() ) |
368 | mMatchedEvents.remove(ev); | 368 | mMatchedEvents.remove(ev); |
369 | else{ | 369 | else{ |
370 | if ( !mMatchedEvents.contains( ev ) ) | 370 | if ( !mMatchedEvents.contains( ev ) ) |
371 | mMatchedEvents.append(ev); | 371 | mMatchedEvents.append(ev); |
372 | } | 372 | } |
373 | continue; | 373 | continue; |
374 | } | 374 | } |
375 | } | 375 | } |
376 | if (mDescriptionCheck->isChecked()) { | 376 | if (mDescriptionCheck->isChecked()) { |
377 | #if QT_VERSION >= 0x030000 | 377 | #if QT_VERSION >= 0x030000 |
378 | if (re.search(ev->description()) != -1) | 378 | if (re.search(ev->description()) != -1) |
379 | #else | 379 | #else |
380 | if (re.match(ev->description()) != -1) | 380 | if (re.match(ev->description()) != -1) |
381 | #endif | 381 | #endif |
382 | { | 382 | { |
383 | if ( mSubItems->isChecked() ) | 383 | if ( mSubItems->isChecked() ) |
384 | mMatchedEvents.remove(ev); | 384 | mMatchedEvents.remove(ev); |
385 | else{ | 385 | else{ |
386 | if ( !mMatchedEvents.contains( ev ) ) | 386 | if ( !mMatchedEvents.contains( ev ) ) |
387 | mMatchedEvents.append(ev); | 387 | mMatchedEvents.append(ev); |
388 | } | 388 | } |
389 | continue; | 389 | continue; |
390 | } | 390 | } |
391 | } | 391 | } |
392 | if (mCategoryCheck->isChecked()) { | 392 | if (mCategoryCheck->isChecked()) { |
393 | #if QT_VERSION >= 0x030000 | 393 | #if QT_VERSION >= 0x030000 |
394 | if (re.search(ev->categoriesStr()) != -1) | 394 | if (re.search(ev->categoriesStr()) != -1) |
395 | #else | 395 | #else |
396 | if (re.match(ev->categoriesStr()) != -1) | 396 | if (re.match(ev->categoriesStr()) != -1) |
397 | #endif | 397 | #endif |
398 | { | 398 | { |
399 | 399 | ||
400 | if ( mSubItems->isChecked() ) | 400 | if ( mSubItems->isChecked() ) |
401 | mMatchedEvents.remove(ev); | 401 | mMatchedEvents.remove(ev); |
402 | else{ | 402 | else{ |
403 | if ( !mMatchedEvents.contains( ev ) ) | 403 | if ( !mMatchedEvents.contains( ev ) ) |
404 | mMatchedEvents.append(ev); | 404 | mMatchedEvents.append(ev); |
405 | } | 405 | } |
406 | continue; | 406 | continue; |
407 | } | 407 | } |
408 | } | 408 | } |
409 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 409 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
410 | QPtrList<Attendee> tmpAList = ev->attendees(); | 410 | QPtrList<Attendee> tmpAList = ev->attendees(); |
411 | Attendee *a; | 411 | Attendee *a; |
412 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 412 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
413 | if (mSearchAName->isChecked()) { | 413 | if (mSearchAName->isChecked()) { |
414 | #if QT_VERSION >= 0x030000 | 414 | #if QT_VERSION >= 0x030000 |
415 | if (re.search(a->name()) != -1) | 415 | if (re.search(a->name()) != -1) |
416 | #else | 416 | #else |
417 | if (re.match(a->name()) != -1) | 417 | if (re.match(a->name()) != -1) |
418 | #endif | 418 | #endif |
419 | { | 419 | { |
420 | if ( mSubItems->isChecked() ) | 420 | if ( mSubItems->isChecked() ) |
421 | mMatchedEvents.remove(ev); | 421 | mMatchedEvents.remove(ev); |
422 | else{ | 422 | else{ |
423 | if ( !mMatchedEvents.contains( ev ) ) | 423 | if ( !mMatchedEvents.contains( ev ) ) |
424 | mMatchedEvents.append(ev); | 424 | mMatchedEvents.append(ev); |
425 | } | 425 | } |
426 | break; | 426 | break; |
427 | } | 427 | } |
428 | } | 428 | } |
429 | if (mSearchAEmail->isChecked()) { | 429 | if (mSearchAEmail->isChecked()) { |
430 | #if QT_VERSION >= 0x030000 | 430 | #if QT_VERSION >= 0x030000 |
431 | if (re.search(a->email()) != -1) | 431 | if (re.search(a->email()) != -1) |
432 | #else | 432 | #else |
433 | if (re.match(a->email()) != -1) | 433 | if (re.match(a->email()) != -1) |
434 | #endif | 434 | #endif |
435 | { | 435 | { |
436 | if ( mSubItems->isChecked() ) | 436 | if ( mSubItems->isChecked() ) |
437 | mMatchedEvents.remove(ev); | 437 | mMatchedEvents.remove(ev); |
438 | else{ | 438 | else{ |
439 | if ( !mMatchedEvents.contains( ev ) ) | 439 | if ( !mMatchedEvents.contains( ev ) ) |
440 | mMatchedEvents.append(ev); | 440 | mMatchedEvents.append(ev); |
441 | } | 441 | } |
442 | break; | 442 | break; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | } | 448 | } |
449 | QPtrList<Todo> todos = mCalendar->todos( ); | 449 | QPtrList<Todo> todos = mCalendar->todos( ); |
450 | 450 | ||
451 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 451 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
452 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; | 452 | if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; |
453 | mMatchedTodos.clear(); | 453 | mMatchedTodos.clear(); |
454 | } | 454 | } |
455 | 455 | ||
456 | if ( mSearchTodo->isChecked() ) { | 456 | if ( mSearchTodo->isChecked() ) { |
457 | Todo *tod; | 457 | Todo *tod; |
458 | for(tod=todos.first();tod;tod=todos.next()) { | 458 | for(tod=todos.first();tod;tod=todos.next()) { |
459 | if (mSummaryCheck->isChecked()) { | 459 | if (mSummaryCheck->isChecked()) { |
460 | #if QT_VERSION >= 0x030000 | 460 | #if QT_VERSION >= 0x030000 |
461 | if (re.search(tod->summary()) != -1) | 461 | if (re.search(tod->summary()) != -1) |
462 | #else | 462 | #else |
463 | if (re.match(tod->summary()) != -1) | 463 | if (re.match(tod->summary()) != -1) |
464 | #endif | 464 | #endif |
465 | { | 465 | { |
466 | if ( mSubItems->isChecked() ) | 466 | if ( mSubItems->isChecked() ) |
467 | mMatchedTodos.remove(tod); | 467 | mMatchedTodos.remove(tod); |
468 | else if (!mMatchedTodos.contains( tod )) | 468 | else if (!mMatchedTodos.contains( tod )) |
469 | mMatchedTodos.append(tod); | 469 | mMatchedTodos.append(tod); |
470 | continue; | 470 | continue; |
471 | } | 471 | } |
472 | } | 472 | } |
473 | if (mDescriptionCheck->isChecked()) { | 473 | if (mDescriptionCheck->isChecked()) { |
474 | #if QT_VERSION >= 0x030000 | 474 | #if QT_VERSION >= 0x030000 |
475 | if (re.search(tod->description()) != -1) | 475 | if (re.search(tod->description()) != -1) |
476 | #else | 476 | #else |
477 | if (re.match(tod->description()) != -1) | 477 | if (re.match(tod->description()) != -1) |
478 | #endif | 478 | #endif |
479 | { | 479 | { |
480 | if ( mSubItems->isChecked() ) | 480 | if ( mSubItems->isChecked() ) |
481 | mMatchedTodos.remove(tod); | 481 | mMatchedTodos.remove(tod); |
482 | else if (!mMatchedTodos.contains( tod )) | 482 | else if (!mMatchedTodos.contains( tod )) |
483 | mMatchedTodos.append(tod); | 483 | mMatchedTodos.append(tod); |
484 | continue; | 484 | continue; |
485 | } | 485 | } |
486 | } | 486 | } |
487 | if (mCategoryCheck->isChecked()) { | 487 | if (mCategoryCheck->isChecked()) { |
488 | #if QT_VERSION >= 0x030000 | 488 | #if QT_VERSION >= 0x030000 |
489 | if (re.search(tod->categoriesStr()) != -1) | 489 | if (re.search(tod->categoriesStr()) != -1) |
490 | #else | 490 | #else |
491 | if (re.match(tod->categoriesStr()) != -1) | 491 | if (re.match(tod->categoriesStr()) != -1) |
492 | #endif | 492 | #endif |
493 | { | 493 | { |
494 | if ( mSubItems->isChecked() ) | 494 | if ( mSubItems->isChecked() ) |
495 | mMatchedTodos.remove(tod); | 495 | mMatchedTodos.remove(tod); |
496 | else if (!mMatchedTodos.contains( tod )) | 496 | else if (!mMatchedTodos.contains( tod )) |
497 | mMatchedTodos.append(tod); | 497 | mMatchedTodos.append(tod); |
498 | continue; | 498 | continue; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 501 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
502 | QPtrList<Attendee> tmpAList = tod->attendees(); | 502 | QPtrList<Attendee> tmpAList = tod->attendees(); |
503 | Attendee *a; | 503 | Attendee *a; |
504 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 504 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
505 | if (mSearchAName->isChecked()) { | 505 | if (mSearchAName->isChecked()) { |
506 | #if QT_VERSION >= 0x030000 | 506 | #if QT_VERSION >= 0x030000 |
507 | if (re.search(a->name()) != -1) | 507 | if (re.search(a->name()) != -1) |
508 | #else | 508 | #else |
509 | if (re.match(a->name()) != -1) | 509 | if (re.match(a->name()) != -1) |
510 | #endif | 510 | #endif |
511 | { | 511 | { |
512 | if ( mSubItems->isChecked() ) | 512 | if ( mSubItems->isChecked() ) |
513 | mMatchedTodos.remove(tod); | 513 | mMatchedTodos.remove(tod); |
514 | else if (!mMatchedTodos.contains( tod )) | 514 | else if (!mMatchedTodos.contains( tod )) |
515 | mMatchedTodos.append(tod); | 515 | mMatchedTodos.append(tod); |
516 | break; | 516 | break; |
517 | } | 517 | } |
518 | } | 518 | } |
519 | if (mSearchAEmail->isChecked()) { | 519 | if (mSearchAEmail->isChecked()) { |
520 | #if QT_VERSION >= 0x030000 | 520 | #if QT_VERSION >= 0x030000 |
521 | if (re.search(a->email()) != -1) | 521 | if (re.search(a->email()) != -1) |
522 | #else | 522 | #else |
523 | if (re.match(a->email()) != -1) | 523 | if (re.match(a->email()) != -1) |
524 | #endif | 524 | #endif |
525 | { | 525 | { |
526 | if ( mSubItems->isChecked() ) | 526 | if ( mSubItems->isChecked() ) |
527 | mMatchedTodos.remove(tod); | 527 | mMatchedTodos.remove(tod); |
528 | else if (!mMatchedTodos.contains( tod )) | 528 | else if (!mMatchedTodos.contains( tod )) |
529 | mMatchedTodos.append(tod); | 529 | mMatchedTodos.append(tod); |
530 | break; | 530 | break; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | } | 533 | } |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | QPtrList<Journal> journals = mCalendar->journals( ); | 538 | QPtrList<Journal> journals = mCalendar->journals( ); |
539 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { | 539 | if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { |
540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; | 540 | if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; |
541 | mMatchedJournals.clear(); | 541 | mMatchedJournals.clear(); |
542 | } | 542 | } |
543 | if (mSearchJournal->isChecked() ) { | 543 | if (mSearchJournal->isChecked() ) { |
544 | Journal* journ; | 544 | Journal* journ; |
545 | 545 | ||
546 | for(journ=journals.first();journ;journ=journals.next()) { | 546 | for(journ=journals.first();journ;journ=journals.next()) { |
547 | if ( journ->dtStart().date() <= mEndDate->date() | 547 | if ( journ->dtStart().date() <= mEndDate->date() |
548 | &&journ->dtStart().date() >= mStartDate->date()) { | 548 | &&journ->dtStart().date() >= mStartDate->date()) { |
549 | #if QT_VERSION >= 0x030000 | 549 | #if QT_VERSION >= 0x030000 |
550 | if (re.search(journ->description()) != -1) | 550 | if (re.search(journ->description()) != -1) |
551 | #else | 551 | #else |
552 | if (re.match(journ->description()) != -1) | 552 | if (re.match(journ->description()) != -1) |
553 | #endif | 553 | #endif |
554 | { | 554 | { |
555 | if ( mSubItems->isChecked() ) | 555 | if ( mSubItems->isChecked() ) |
556 | mMatchedJournals.remove(journ); | 556 | mMatchedJournals.remove(journ); |
557 | else if (!mMatchedJournals.contains( journ )) | 557 | else if (!mMatchedJournals.contains( journ )) |
558 | mMatchedJournals.append(journ); | 558 | mMatchedJournals.append(journ); |
559 | continue; | 559 | continue; |
560 | } | 560 | } |
561 | } | 561 | } |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { | |
565 | qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); | ||
566 | if ( mRefineItems->isChecked() ) | ||
567 | mRefineItems->setChecked( false ); | ||
568 | else if ( mSubItems->isChecked() ) | ||
569 | mSubItems->setChecked( false ); | ||
570 | } | ||
565 | } | 571 | } |
566 | 572 | ||
567 | void SearchDialog::keyPressEvent ( QKeyEvent *e) | 573 | void SearchDialog::keyPressEvent ( QKeyEvent *e) |
568 | { | 574 | { |
569 | switch ( e->key() ) { | 575 | switch ( e->key() ) { |
570 | case Qt::Key_Escape: | 576 | case Qt::Key_Escape: |
571 | close(); | 577 | close(); |
572 | break; | 578 | break; |
573 | case Qt::Key_F: | 579 | case Qt::Key_F: |
574 | if ( e->state() == Qt::ControlButton ) { | 580 | if ( e->state() == Qt::ControlButton ) { |
575 | 581 | ||
576 | } | 582 | } |
577 | break; | 583 | break; |
578 | case Qt::Key_Return: | 584 | case Qt::Key_Return: |
579 | case Qt::Key_Enter: | 585 | case Qt::Key_Enter: |
580 | doSearch(); | 586 | doSearch(); |
581 | break; | 587 | break; |
582 | 588 | ||
583 | default: | 589 | default: |
584 | e->ignore(); | 590 | e->ignore(); |
585 | } | 591 | } |
586 | } | 592 | } |
587 | 593 | ||
588 | //mMatchedJournals; | 594 | //mMatchedJournals; |