-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | kabc/addresseedialog.cpp | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index e0bd3f3..eaf4b56 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,128 +1,134 @@ | |||
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 | 3 | ||
4 | ********** VERSION 2.1.8 ************ | 4 | ********** VERSION 2.1.8 ************ |
5 | 5 | ||
6 | KO/Pi: | ||
7 | Added info about the completion sate 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. | ||
9 | |||
10 | KA/Pi: | ||
11 | In the addressee selection dialog now the formatted name is shown, if not empty. | ||
6 | 12 | ||
7 | ********** VERSION 2.1.7 ************ | 13 | ********** VERSION 2.1.7 ************ |
8 | 14 | ||
9 | KO/Pi: | 15 | KO/Pi: |
10 | Fixed several problems in the new Resource handling. | 16 | Fixed several problems in the new Resource handling. |
11 | Added more options to the search dialog. | 17 | Added more options to the search dialog. |
12 | Fixed a problem in the Month view. | 18 | Fixed a problem in the Month view. |
13 | Added more options to the dialog when setting a todo to stopped. | 19 | Added more options to the dialog when setting a todo to stopped. |
14 | 20 | ||
15 | Fixed two small problems in KO/PiAlarm applet. | 21 | Fixed two small problems in KO/PiAlarm applet. |
16 | 22 | ||
17 | ********** VERSION 2.1.6 ************ | 23 | ********** VERSION 2.1.6 ************ |
18 | 24 | ||
19 | This release is for testing only. | 25 | This release is for testing only. |
20 | 26 | ||
21 | KO/Pi: | 27 | KO/Pi: |
22 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 28 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
23 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 29 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
24 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 30 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
25 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 31 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
26 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 32 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
27 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 33 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
28 | 34 | ||
29 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 35 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
30 | 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. | 36 | 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. |
31 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 37 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
32 | 38 | ||
33 | A calendar is enabled in the resource view if the "eye" column is checked. | 39 | A calendar is enabled in the resource view if the "eye" column is checked. |
34 | You can set a calendar to be the default for new items( "+" column ). | 40 | You can set a calendar to be the default for new items( "+" column ). |
35 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 41 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
36 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 42 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
37 | 43 | ||
38 | 44 | ||
39 | ********** VERSION 2.1.5 ************ | 45 | ********** VERSION 2.1.5 ************ |
40 | 46 | ||
41 | This is the new stable version. | 47 | This is the new stable version. |
42 | Bugfix: | 48 | Bugfix: |
43 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 49 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
44 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 50 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
45 | Added config option to not display completed todos in agenda view. | 51 | Added config option to not display completed todos in agenda view. |
46 | Addressee view is now using the formatted name, if defined. | 52 | Addressee view is now using the formatted name, if defined. |
47 | That makes it possible to display "lastname, firstname" in that view now. | 53 | That makes it possible to display "lastname, firstname" in that view now. |
48 | To set the formatted name for all contacts, please use menu: | 54 | To set the formatted name for all contacts, please use menu: |
49 | Edit->Change->Set formatted name. | 55 | Edit->Change->Set formatted name. |
50 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 56 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
51 | 57 | ||
52 | ********** VERSION 2.1.4 ************ | 58 | ********** VERSION 2.1.4 ************ |
53 | 59 | ||
54 | Fixed two more bugs in the KA/Pi CSV import dialog: | 60 | Fixed two more bugs in the KA/Pi CSV import dialog: |
55 | Made it possible to read multi-line fields and import it to the "Note" field. | 61 | Made it possible to read multi-line fields and import it to the "Note" field. |
56 | Fixed a problem in mapping custom fields, whatever a custem field is... | 62 | Fixed a problem in mapping custom fields, whatever a custem field is... |
57 | 63 | ||
58 | ********** VERSION 2.1.3 ************ | 64 | ********** VERSION 2.1.3 ************ |
59 | 65 | ||
60 | Changed the menu structure of the alarm applet: | 66 | Changed the menu structure of the alarm applet: |
61 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 67 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
62 | 68 | ||
63 | Fixed several problems in the KA/Pi CSV import dialog: | 69 | Fixed several problems in the KA/Pi CSV import dialog: |
64 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 70 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
65 | 71 | ||
66 | 72 | ||
67 | ********** VERSION 2.1.2 ************ | 73 | ********** VERSION 2.1.2 ************ |
68 | 74 | ||
69 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 75 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
70 | 76 | ||
71 | Fixed a problem when importing data from Outlook with mutiple categories set. | 77 | Fixed a problem when importing data from Outlook with mutiple categories set. |
72 | 78 | ||
73 | Changed display of days in datenavigator: | 79 | Changed display of days in datenavigator: |
74 | Birthdays are now blue, not dark green. | 80 | Birthdays are now blue, not dark green. |
75 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 81 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
76 | When journal view is shown, only holidays are shown and days with journals are blue. | 82 | When journal view is shown, only holidays are shown and days with journals are blue. |
77 | 83 | ||
78 | Added Backup options to global config: | 84 | Added Backup options to global config: |
79 | 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 ). | 85 | 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 ). |
80 | 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. | 86 | 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. |
81 | 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. | 87 | 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. |
82 | 88 | ||
83 | ********** VERSION 2.1.1 ************ | 89 | ********** VERSION 2.1.1 ************ |
84 | 90 | ||
85 | Stable release 2.1.1! | 91 | Stable release 2.1.1! |
86 | 92 | ||
87 | KO/Pi: | 93 | KO/Pi: |
88 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 94 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
89 | 95 | ||
90 | ********** VERSION 2.1.0 ************ | 96 | ********** VERSION 2.1.0 ************ |
91 | 97 | ||
92 | Stable release 2.1.0! | 98 | Stable release 2.1.0! |
93 | 99 | ||
94 | Summary of changes/fixes compared to version 2.0.6: | 100 | Summary of changes/fixes compared to version 2.0.6: |
95 | 101 | ||
96 | Many bugs of version 2.0.6 fixed. | 102 | Many bugs of version 2.0.6 fixed. |
97 | Most of them were small bugs, but some of them were important. | 103 | Most of them were small bugs, but some of them were important. |
98 | It is recommended to use version 2.1.0 and not version 2.0.6. | 104 | It is recommended to use version 2.1.0 and not version 2.0.6. |
99 | 105 | ||
100 | Important changes: | 106 | Important changes: |
101 | 107 | ||
102 | Added recurring todos to KO/Pi. | 108 | Added recurring todos to KO/Pi. |
103 | 109 | ||
104 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 110 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
105 | 111 | ||
106 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 112 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
107 | 113 | ||
108 | Datenavigator can now display many months. Very useful on the desktop. | 114 | Datenavigator can now display many months. Very useful on the desktop. |
109 | 115 | ||
110 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 116 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
111 | 117 | ||
112 | Made alarm sound working on Linux desktop. | 118 | Made alarm sound working on Linux desktop. |
113 | 119 | ||
114 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 120 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
115 | 121 | ||
116 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 122 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
117 | 123 | ||
118 | Many other usebility enhancements. | 124 | Many other usebility enhancements. |
119 | Special thanks to Ben for his suggestions! | 125 | Special thanks to Ben for his suggestions! |
120 | 126 | ||
121 | You can find the complete changelog | 127 | You can find the complete changelog |
122 | from version 1.7.7 to 2.1.0 | 128 | from version 1.7.7 to 2.1.0 |
123 | in the source package or on | 129 | in the source package or on |
124 | 130 | ||
125 | http://www.pi-sync.net/html/changelog.html | 131 | http://www.pi-sync.net/html/changelog.html |
126 | 132 | ||
127 | 133 | ||
128 | 134 | ||
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp index 19b52bb..e89584d 100644 --- a/kabc/addresseedialog.cpp +++ b/kabc/addresseedialog.cpp | |||
@@ -1,353 +1,348 @@ | |||
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 | QString name = addressee.familyName()+", "+ addressee.givenName(); | 45 | setText( Name,addressee.realName()); |
46 | if ( name.length() == 2 ) | ||
47 | name = addressee.organization(); | ||
48 | setText( Name,name); | ||
49 | setText( Email, addressee.preferredEmail() ); | 46 | setText( Email, addressee.preferredEmail() ); |
50 | } | 47 | } |
51 | 48 | ||
52 | QString AddresseeItem::key( int column, bool ) const | 49 | QString AddresseeItem::key( int column, bool ) const |
53 | { | 50 | { |
54 | 51 | ||
55 | if (column == Email) { | 52 | if (column == Email) { |
56 | QString value = text(Email); | 53 | QString value = text(Email); |
57 | int val = value.findRev("@"); | 54 | int val = value.findRev("@"); |
58 | return value.mid( val) + value.left( val ); | 55 | return value.mid( val) + value.left( val ); |
59 | } | 56 | } |
60 | return text(column).lower(); | 57 | return text(column).lower(); |
61 | } | 58 | } |
62 | 59 | ||
63 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : | 60 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : |
64 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), | 61 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), |
65 | Ok|Cancel, No, parent ), mMultiple( multiple ) | 62 | Ok|Cancel, No, parent ), mMultiple( multiple ) |
66 | { | 63 | { |
67 | qDebug("NEW AddresseeDialog "); | 64 | qDebug("NEW AddresseeDialog "); |
68 | QWidget *topWidget = plainPage(); | 65 | QWidget *topWidget = plainPage(); |
69 | 66 | ||
70 | QBoxLayout *topLayout = new QHBoxLayout( topWidget ); | 67 | QBoxLayout *topLayout = new QHBoxLayout( topWidget ); |
71 | 68 | ||
72 | 69 | ||
73 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); | 70 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); |
74 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 71 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
75 | 72 | ||
76 | topLayout->addWidget(mMiniSplitter ); | 73 | topLayout->addWidget(mMiniSplitter ); |
77 | 74 | ||
78 | QWidget *listWidget = new QWidget( mMiniSplitter ); | 75 | QWidget *listWidget = new QWidget( mMiniSplitter ); |
79 | 76 | ||
80 | QBoxLayout *listLayout = new QVBoxLayout (listWidget) ; | 77 | QBoxLayout *listLayout = new QVBoxLayout (listWidget) ; |
81 | //topLayout->addLayout( listLayout ); | 78 | //topLayout->addLayout( listLayout ); |
82 | 79 | ||
83 | mAddresseeList = new KListView( listWidget ); | 80 | mAddresseeList = new KListView( listWidget ); |
84 | mAddresseeList->addColumn( i18n("Name") ); | 81 | mAddresseeList->addColumn( i18n("Name") ); |
85 | mAddresseeList->addColumn( i18n("Email") ); | 82 | mAddresseeList->addColumn( i18n("Email") ); |
86 | mAddresseeList->setAllColumnsShowFocus( true ); | 83 | mAddresseeList->setAllColumnsShowFocus( true ); |
87 | mAddresseeList->setFullWidth( true ); | 84 | mAddresseeList->setFullWidth( true ); |
88 | listLayout->addWidget( mAddresseeList ); | 85 | listLayout->addWidget( mAddresseeList ); |
89 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), | 86 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), |
90 | SLOT( slotOk() ) ); | 87 | SLOT( slotOk() ) ); |
91 | 88 | ||
92 | mAddresseeEdit = new QLineEdit( listWidget ); | 89 | mAddresseeEdit = new QLineEdit( listWidget ); |
93 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), | 90 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), |
94 | SLOT( loadAddressBook() ) ); | 91 | SLOT( loadAddressBook() ) ); |
95 | mAddresseeEdit->setFocus(); | 92 | mAddresseeEdit->setFocus(); |
96 | 93 | ||
97 | listLayout->addWidget( mAddresseeEdit ); | 94 | listLayout->addWidget( mAddresseeEdit ); |
98 | 95 | ||
99 | if ( mMultiple ) { | 96 | if ( mMultiple ) { |
100 | //QBoxLayout *selectedLayout = new QVBoxLayout; | 97 | //QBoxLayout *selectedLayout = new QVBoxLayout; |
101 | //topLayout->addLayout( selectedLayout ); | 98 | //topLayout->addLayout( selectedLayout ); |
102 | //topLayout->setSpacing( spacingHint() ); | 99 | //topLayout->setSpacing( spacingHint() ); |
103 | 100 | ||
104 | QVBox *selectedGroup = new QVBox( mMiniSplitter ); | 101 | QVBox *selectedGroup = new QVBox( mMiniSplitter ); |
105 | new QLabel ( i18n("Selected:"), selectedGroup ); | 102 | new QLabel ( i18n("Selected:"), selectedGroup ); |
106 | //selectedLayout->addWidget( selectedGroup ); | 103 | //selectedLayout->addWidget( selectedGroup ); |
107 | 104 | ||
108 | mSelectedList = new KListView( selectedGroup ); | 105 | mSelectedList = new KListView( selectedGroup ); |
109 | mSelectedList->addColumn( i18n("Name") ); | 106 | mSelectedList->addColumn( i18n("Name") ); |
110 | mSelectedList->addColumn( i18n("Email") ); | 107 | mSelectedList->addColumn( i18n("Email") ); |
111 | mSelectedList->setAllColumnsShowFocus( true ); | 108 | mSelectedList->setAllColumnsShowFocus( true ); |
112 | mSelectedList->setFullWidth( true ); | 109 | mSelectedList->setFullWidth( true ); |
113 | connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), | 110 | connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), |
114 | SLOT( removeSelected() ) ); | 111 | SLOT( removeSelected() ) ); |
115 | 112 | ||
116 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); | 113 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); |
117 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); | 114 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); |
118 | 115 | ||
119 | connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), | 116 | connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), |
120 | SLOT( addSelected( QListViewItem * ) ) ); | 117 | SLOT( addSelected( QListViewItem * ) ) ); |
121 | connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), | 118 | connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), |
122 | SLOT( selectNextItem( QListViewItem * ) ) ); | 119 | SLOT( selectNextItem( QListViewItem * ) ) ); |
123 | 120 | ||
124 | } | 121 | } |
125 | 122 | ||
126 | mAddressBook = StdAddressBook::self( true ); | 123 | mAddressBook = StdAddressBook::self( true ); |
127 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), | 124 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), |
128 | SLOT( addressBookChanged() ) ); | 125 | SLOT( addressBookChanged() ) ); |
129 | #if 0 | 126 | #if 0 |
130 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), | 127 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), |
131 | SLOT( addressBookChanged() ) ); | 128 | SLOT( addressBookChanged() ) ); |
132 | #endif | 129 | #endif |
133 | loadAddressBook(); | 130 | loadAddressBook(); |
134 | QValueList<int> splitterSize; | 131 | QValueList<int> splitterSize; |
135 | splitterSize.append( ( width() / 5 ) * 3 ); | 132 | splitterSize.append( ( width() / 5 ) * 3 ); |
136 | splitterSize.append( ( width() / 5 ) *2 ); | 133 | splitterSize.append( ( width() / 5 ) *2 ); |
137 | mMiniSplitter->setSizes( splitterSize ); | 134 | mMiniSplitter->setSizes( splitterSize ); |
138 | } | 135 | } |
139 | 136 | ||
140 | AddresseeDialog::~AddresseeDialog() | 137 | AddresseeDialog::~AddresseeDialog() |
141 | { | 138 | { |
142 | qDebug("DELETE AddresseeDialog "); | 139 | qDebug("DELETE AddresseeDialog "); |
143 | } | 140 | } |
144 | 141 | ||
145 | void AddresseeDialog::loadAddressBook() | 142 | void AddresseeDialog::loadAddressBook() |
146 | { | 143 | { |
147 | mAddresseeList->clear(); | 144 | mAddresseeList->clear(); |
148 | mItemDict.clear(); | 145 | mItemDict.clear(); |
149 | if ( mAddresseeEdit->text().isEmpty() ) { | 146 | if ( mAddresseeEdit->text().isEmpty() ) { |
150 | AddressBook::Iterator it; | 147 | AddressBook::Iterator it; |
151 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 148 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
152 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 149 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
153 | continue; | 150 | continue; |
154 | new AddresseeItem( mAddresseeList, (*it) ); | 151 | new AddresseeItem( mAddresseeList, (*it) ); |
155 | } | 152 | } |
156 | return; | 153 | return; |
157 | } | 154 | } |
158 | //mAddresseeEdit->completionObject()->clear(); | 155 | //mAddresseeEdit->completionObject()->clear(); |
159 | QRegExp re; | 156 | QRegExp re; |
160 | re.setWildcard(true); // most people understand these better. | 157 | re.setWildcard(true); // most people understand these better. |
161 | re.setCaseSensitive(false); | 158 | re.setCaseSensitive(false); |
162 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); | 159 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); |
163 | 160 | ||
164 | AddressBook::Iterator it; | 161 | AddressBook::Iterator it; |
165 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 162 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
166 | 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-") ) |
167 | continue; | 164 | continue; |
168 | QString name = (*it).familyName()+", "+ (*it).givenName(); | 165 | QString name = (*it).realName(); |
169 | if ( name.length() == 2 ) | ||
170 | name = (*it).realName(); | ||
171 | name += (*it).preferredEmail(); | 166 | name += (*it).preferredEmail(); |
172 | #if QT_VERSION >= 0x030000 | 167 | #if QT_VERSION >= 0x030000 |
173 | if (re.search(name) != -1) | 168 | if (re.search(name) != -1) |
174 | #else | 169 | #else |
175 | if (re.match(name) != -1) | 170 | if (re.match(name) != -1) |
176 | #endif | 171 | #endif |
177 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); | 172 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); |
178 | } | 173 | } |
179 | } | 174 | } |
180 | 175 | ||
181 | void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) | 176 | void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) |
182 | { | 177 | { |
183 | if ( str.isEmpty() ) return; | 178 | if ( str.isEmpty() ) return; |
184 | 179 | ||
185 | mItemDict.insert( str, item ); | 180 | mItemDict.insert( str, item ); |
186 | //mAddresseeEdit->completionObject()->addItem( str ); | 181 | //mAddresseeEdit->completionObject()->addItem( str ); |
187 | } | 182 | } |
188 | 183 | ||
189 | void AddresseeDialog::selectItem( const QString &str ) | 184 | void AddresseeDialog::selectItem( const QString &str ) |
190 | { | 185 | { |
191 | if ( str.isEmpty() ) return; | 186 | if ( str.isEmpty() ) return; |
192 | 187 | ||
193 | QListViewItem *item = mItemDict.find( str ); | 188 | QListViewItem *item = mItemDict.find( str ); |
194 | if ( item ) { | 189 | if ( item ) { |
195 | mAddresseeList->blockSignals( true ); | 190 | mAddresseeList->blockSignals( true ); |
196 | mAddresseeList->setSelected( item, true ); | 191 | mAddresseeList->setSelected( item, true ); |
197 | mAddresseeList->ensureItemVisible( item ); | 192 | mAddresseeList->ensureItemVisible( item ); |
198 | mAddresseeList->blockSignals( false ); | 193 | mAddresseeList->blockSignals( false ); |
199 | } | 194 | } |
200 | } | 195 | } |
201 | 196 | ||
202 | void AddresseeDialog::updateEdit( QListViewItem *item ) | 197 | void AddresseeDialog::updateEdit( QListViewItem *item ) |
203 | { | 198 | { |
204 | mAddresseeEdit->setText( item->text( 0 ) ); | 199 | mAddresseeEdit->setText( item->text( 0 ) ); |
205 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); | 200 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); |
206 | } | 201 | } |
207 | 202 | ||
208 | void AddresseeDialog::selectNextItem( QListViewItem *item ) | 203 | void AddresseeDialog::selectNextItem( QListViewItem *item ) |
209 | { | 204 | { |
210 | addSelected( item ); | 205 | addSelected( item ); |
211 | QListViewItem *next = item->nextSibling(); | 206 | QListViewItem *next = item->nextSibling(); |
212 | if ( next ) { | 207 | if ( next ) { |
213 | next->setSelected( true ); | 208 | next->setSelected( true ); |
214 | item->setSelected( false ); | 209 | item->setSelected( false ); |
215 | mAddresseeList->setCurrentItem( next ); | 210 | mAddresseeList->setCurrentItem( next ); |
216 | } | 211 | } |
217 | } | 212 | } |
218 | void AddresseeDialog::addSelected( QListViewItem *item ) | 213 | void AddresseeDialog::addSelected( QListViewItem *item ) |
219 | { | 214 | { |
220 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 215 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
221 | if ( !addrItem ) return; | 216 | if ( !addrItem ) return; |
222 | 217 | ||
223 | Addressee a = addrItem->addressee(); | 218 | Addressee a = addrItem->addressee(); |
224 | 219 | ||
225 | QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); | 220 | QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); |
226 | if ( !selectedItem ) { | 221 | if ( !selectedItem ) { |
227 | selectedItem = new AddresseeItem( mSelectedList, a ); | 222 | selectedItem = new AddresseeItem( mSelectedList, a ); |
228 | mSelectedDict.insert( a.uid(), selectedItem ); | 223 | mSelectedDict.insert( a.uid(), selectedItem ); |
229 | } | 224 | } |
230 | 225 | ||
231 | } | 226 | } |
232 | 227 | ||
233 | void AddresseeDialog::removeSelected() | 228 | void AddresseeDialog::removeSelected() |
234 | { | 229 | { |
235 | QListViewItem *item = mSelectedList->selectedItem(); | 230 | QListViewItem *item = mSelectedList->selectedItem(); |
236 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 231 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
237 | if ( !addrItem ) return; | 232 | if ( !addrItem ) return; |
238 | QListViewItem *next = item->nextSibling(); | 233 | QListViewItem *next = item->nextSibling(); |
239 | mSelectedDict.remove( addrItem->addressee().uid() ); | 234 | mSelectedDict.remove( addrItem->addressee().uid() ); |
240 | delete addrItem; | 235 | delete addrItem; |
241 | if ( next ) | 236 | if ( next ) |
242 | next->setSelected( true ); | 237 | next->setSelected( true ); |
243 | } | 238 | } |
244 | 239 | ||
245 | Addressee AddresseeDialog::addressee() | 240 | Addressee AddresseeDialog::addressee() |
246 | { | 241 | { |
247 | AddresseeItem *aItem = 0; | 242 | AddresseeItem *aItem = 0; |
248 | 243 | ||
249 | if ( mMultiple ) | 244 | if ( mMultiple ) |
250 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); | 245 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); |
251 | else | 246 | else |
252 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 247 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
253 | 248 | ||
254 | if (aItem) return aItem->addressee(); | 249 | if (aItem) return aItem->addressee(); |
255 | return Addressee(); | 250 | return Addressee(); |
256 | } | 251 | } |
257 | 252 | ||
258 | Addressee::List AddresseeDialog::addressees() | 253 | Addressee::List AddresseeDialog::addressees() |
259 | { | 254 | { |
260 | Addressee::List al; | 255 | Addressee::List al; |
261 | AddresseeItem *aItem = 0; | 256 | AddresseeItem *aItem = 0; |
262 | 257 | ||
263 | if ( mMultiple ) { | 258 | if ( mMultiple ) { |
264 | QListViewItem *item = mSelectedList->firstChild(); | 259 | QListViewItem *item = mSelectedList->firstChild(); |
265 | while( item ) { | 260 | while( item ) { |
266 | aItem = (AddresseeItem *)( item ); | 261 | aItem = (AddresseeItem *)( item ); |
267 | if ( aItem ) al.append( aItem->addressee() ); | 262 | if ( aItem ) al.append( aItem->addressee() ); |
268 | item = item->nextSibling(); | 263 | item = item->nextSibling(); |
269 | } | 264 | } |
270 | } | 265 | } |
271 | else | 266 | else |
272 | { | 267 | { |
273 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 268 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
274 | if (aItem) al.append( aItem->addressee() ); | 269 | if (aItem) al.append( aItem->addressee() ); |
275 | } | 270 | } |
276 | 271 | ||
277 | return al; | 272 | return al; |
278 | } | 273 | } |
279 | 274 | ||
280 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) | 275 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) |
281 | { | 276 | { |
282 | AddresseeDialog *dlg = new AddresseeDialog( parent ); | 277 | AddresseeDialog *dlg = new AddresseeDialog( parent ); |
283 | Addressee addressee; | 278 | Addressee addressee; |
284 | #ifdef DESKTOP_VERSION | 279 | #ifdef DESKTOP_VERSION |
285 | static int geoX = 0; | 280 | static int geoX = 0; |
286 | static int geoY = 0; | 281 | static int geoY = 0; |
287 | static int geoW = 0; | 282 | static int geoW = 0; |
288 | static int geoH = 0; | 283 | static int geoH = 0; |
289 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 284 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
290 | geoX = dlg->geometry().x(); | 285 | geoX = dlg->geometry().x(); |
291 | geoY = dlg->geometry().y(); | 286 | geoY = dlg->geometry().y(); |
292 | geoW = dlg->width(); | 287 | geoW = dlg->width(); |
293 | geoH = dlg->height(); | 288 | geoH = dlg->height(); |
294 | } else { | 289 | } else { |
295 | dlg->show(); | 290 | dlg->show(); |
296 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 291 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
297 | 292 | ||
298 | } | 293 | } |
299 | #endif | 294 | #endif |
300 | int result = dlg->exec(); | 295 | int result = dlg->exec(); |
301 | #ifdef DESKTOP_VERSION | 296 | #ifdef DESKTOP_VERSION |
302 | geoX = dlg->geometry().x(); | 297 | geoX = dlg->geometry().x(); |
303 | geoY = dlg->geometry().y(); | 298 | geoY = dlg->geometry().y(); |
304 | geoW = dlg->width(); | 299 | geoW = dlg->width(); |
305 | geoH = dlg->height(); | 300 | geoH = dlg->height(); |
306 | #endif | 301 | #endif |
307 | if ( result == QDialog::Accepted ) { | 302 | if ( result == QDialog::Accepted ) { |
308 | addressee = dlg->addressee(); | 303 | addressee = dlg->addressee(); |
309 | } | 304 | } |
310 | 305 | ||
311 | delete dlg; | 306 | delete dlg; |
312 | return addressee; | 307 | return addressee; |
313 | } | 308 | } |
314 | 309 | ||
315 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) | 310 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) |
316 | { | 311 | { |
317 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); | 312 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); |
318 | Addressee::List addressees; | 313 | Addressee::List addressees; |
319 | static int geoX = 0; | 314 | static int geoX = 0; |
320 | static int geoY = 0; | 315 | static int geoY = 0; |
321 | static int geoW = 0; | 316 | static int geoW = 0; |
322 | static int geoH = 0; | 317 | static int geoH = 0; |
323 | if ( QApplication::desktop()->width() <= 640 ) | 318 | if ( QApplication::desktop()->width() <= 640 ) |
324 | dlg->showMaximized(); | 319 | dlg->showMaximized(); |
325 | else { | 320 | else { |
326 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 321 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
327 | geoX = dlg->geometry().x(); | 322 | geoX = dlg->geometry().x(); |
328 | geoY = dlg->geometry().y(); | 323 | geoY = dlg->geometry().y(); |
329 | geoW = dlg->width(); | 324 | geoW = dlg->width(); |
330 | geoH = dlg->height(); | 325 | geoH = dlg->height(); |
331 | } else { | 326 | } else { |
332 | dlg->show(); | 327 | dlg->show(); |
333 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 328 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
334 | 329 | ||
335 | } | 330 | } |
336 | } | 331 | } |
337 | int result = dlg->exec(); | 332 | int result = dlg->exec(); |
338 | geoX = dlg->geometry().x(); | 333 | geoX = dlg->geometry().x(); |
339 | geoY = dlg->geometry().y(); | 334 | geoY = dlg->geometry().y(); |
340 | geoW = dlg->width(); | 335 | geoW = dlg->width(); |
341 | geoH = dlg->height(); | 336 | geoH = dlg->height(); |
342 | if ( result == QDialog::Accepted ) { | 337 | if ( result == QDialog::Accepted ) { |
343 | addressees = dlg->addressees(); | 338 | addressees = dlg->addressees(); |
344 | } | 339 | } |
345 | 340 | ||
346 | delete dlg; | 341 | delete dlg; |
347 | return addressees; | 342 | return addressees; |
348 | } | 343 | } |
349 | 344 | ||
350 | void AddresseeDialog::addressBookChanged() | 345 | void AddresseeDialog::addressBookChanged() |
351 | { | 346 | { |
352 | loadAddressBook(); | 347 | loadAddressBook(); |
353 | } | 348 | } |