summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--kabc/addresseedialog.cpp7
-rw-r--r--kaddressbook/kabcore.cpp14
3 files changed, 17 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 21664de..b6472d7 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,166 +1,168 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.10 ************ 3********** VERSION 2.1.10 ************
4 4
5KO/Pi: 5KO/Pi:
6Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. 6Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file.
7When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted.
7 8
8KA/Pi: 9KA/Pi:
9Fixed two problems in csv export. 10Fixed two problems in csv export.
11Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi.
10 12
11********** VERSION 2.1.9 ************ 13********** VERSION 2.1.9 ************
12 14
13KO/Pi: 15KO/Pi:
14Fixed some problems of the new search options in the search dialog. 16Fixed some problems of the new search options in the search dialog.
15Fixed some problems in the new resource config options. 17Fixed some problems in the new resource config options.
16Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. 18Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page.
17Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: 19Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown:
18Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. 20Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup.
19 21
20Fixed a problem in recurrence range in syncing with DTM. 22Fixed a problem in recurrence range in syncing with DTM.
21 23
22KA/Pi: 24KA/Pi:
23Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) 25Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...)
24 26
25PwM/Pi: 27PwM/Pi:
26Added "sec" to the timeout config settings to make it clear the timeout values are seconds. 28Added "sec" to the timeout config settings to make it clear the timeout values are seconds.
27 29
28********** VERSION 2.1.8 ************ 30********** VERSION 2.1.8 ************
29 31
30KO/Pi: 32KO/Pi:
31Added info about the completion state of a todo in the ListView/Searchdialog. 33Added info about the completion state of a todo in the ListView/Searchdialog.
32If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. 34If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
33Fixed some updating problems when changing the filter. 35Fixed some updating problems when changing the filter.
34 36
35KA/Pi: 37KA/Pi:
36In the addressee selection dialog now the formatted name is shown, if not empty. 38In the addressee selection dialog now the formatted name is shown, if not empty.
37Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. 39Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category.
38Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. 40Now in the addressee selection dialog a selected contact is remove with a single click from the selected list.
39 41
40Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. 42Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
41Fixed the sorting for size in the file selector on the Z. 43Fixed the sorting for size in the file selector on the Z.
42 44
43Changed the color selection dialog on the Zaurus to a more user friendly version. 45Changed the color selection dialog on the Zaurus to a more user friendly version.
44 46
45********** VERSION 2.1.7 ************ 47********** VERSION 2.1.7 ************
46 48
47KO/Pi: 49KO/Pi:
48Fixed several problems in the new Resource handling. 50Fixed several problems in the new Resource handling.
49Added more options to the search dialog. 51Added more options to the search dialog.
50Fixed a problem in the Month view. 52Fixed a problem in the Month view.
51Added more options to the dialog when setting a todo to stopped. 53Added more options to the dialog when setting a todo to stopped.
52 54
53Fixed two small problems in KO/Pi Alarm applet. 55Fixed two small problems in KO/Pi Alarm applet.
54 56
55********** VERSION 2.1.6 ************ 57********** VERSION 2.1.6 ************
56 58
57This release is for testing only. 59This release is for testing only.
58 60
59KO/Pi: 61KO/Pi:
60Added to the list view (the list view is used in search dialog as well) the possibility to print it. 62Added to the list view (the list view is used in search dialog as well) the possibility to print it.
61Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. 63Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
62Added to the list view the possibility to add all subtodos of selected todos to an export/beam. 64Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
63Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. 65Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
64Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. 66Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
65Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. 67Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
66 68
67Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. 69Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars.
68In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. 70In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later.
69Now on every sync the set of calendars is synced which are enabled in the resource view. 71Now on every sync the set of calendars is synced which are enabled in the resource view.
70 72
71A calendar is enabled in the resource view if the "eye" column is checked. 73A calendar is enabled in the resource view if the "eye" column is checked.
72You can set a calendar to be the default for new items( "+" column ). 74You can set a calendar to be the default for new items( "+" column ).
73You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. 75You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly.
74To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... 76To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ...
75 77
76 78
77********** VERSION 2.1.5 ************ 79********** VERSION 2.1.5 ************
78 80
79This is the new stable version. 81This is the new stable version.
80Bugfix: 82Bugfix:
81Fixed a problem with agenda popup on the desktop in KO/Pi. 83Fixed a problem with agenda popup on the desktop in KO/Pi.
82Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. 84Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
83Added config option to not display completed todos in agenda view. 85Added config option to not display completed todos in agenda view.
84Addressee view is now using the formatted name, if defined. 86Addressee view is now using the formatted name, if defined.
85That makes it possible to display "lastname, firstname" in that view now. 87That makes it possible to display "lastname, firstname" in that view now.
86To set the formatted name for all contacts, please use menu: 88To set the formatted name for all contacts, please use menu:
87Edit->Change->Set formatted name. 89Edit->Change->Set formatted name.
88Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. 90Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
89 91
90********** VERSION 2.1.4 ************ 92********** VERSION 2.1.4 ************
91 93
92Fixed two more bugs in the KA/Pi CSV import dialog: 94Fixed two more bugs in the KA/Pi CSV import dialog:
93Made it possible to read multi-line fields and import it to the "Note" field. 95Made it possible to read multi-line fields and import it to the "Note" field.
94Fixed a problem in mapping custom fields, whatever a custem field is... 96Fixed a problem in mapping custom fields, whatever a custem field is...
95 97
96********** VERSION 2.1.3 ************ 98********** VERSION 2.1.3 ************
97 99
98Changed the menu structure of the alarm applet: 100Changed the menu structure of the alarm applet:
99Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". 101Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
100 102
101Fixed several problems in the KA/Pi CSV import dialog: 103Fixed several problems in the KA/Pi CSV import dialog:
102Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. 104Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
103 105
104 106
105********** VERSION 2.1.2 ************ 107********** VERSION 2.1.2 ************
106 108
107Fixed a problem closing the alarm dialog on Zaurus with "OK" button. 109Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
108 110
109Fixed a problem when importing data from Outlook with mutiple categories set. 111Fixed a problem when importing data from Outlook with mutiple categories set.
110 112
111Changed display of days in datenavigator: 113Changed display of days in datenavigator:
112Birthdays are now blue, not dark green. 114Birthdays are now blue, not dark green.
113When todo view is shown, no birtdays are shown and days with due todos are shown blue. 115When todo view is shown, no birtdays are shown and days with due todos are shown blue.
114When journal view is shown, only holidays are shown and days with journals are blue. 116When journal view is shown, only holidays are shown and days with journals are blue.
115 117
116Added Backup options to global config: 118Added Backup options to global config:
117You 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 ). 119You 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 ).
118It 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. 120It 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.
119The 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. 121The 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.
120 122
121********** VERSION 2.1.1 ************ 123********** VERSION 2.1.1 ************
122 124
123Stable release 2.1.1! 125Stable release 2.1.1!
124 126
125KO/Pi: 127KO/Pi:
126Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. 128Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
127 129
128********** VERSION 2.1.0 ************ 130********** VERSION 2.1.0 ************
129 131
130Stable release 2.1.0! 132Stable release 2.1.0!
131 133
132Summary of changes/fixes compared to version 2.0.6: 134Summary of changes/fixes compared to version 2.0.6:
133 135
134Many bugs of version 2.0.6 fixed. 136Many bugs of version 2.0.6 fixed.
135Most of them were small bugs, but some of them were important. 137Most of them were small bugs, but some of them were important.
136It is recommended to use version 2.1.0 and not version 2.0.6. 138It is recommended to use version 2.1.0 and not version 2.0.6.
137 139
138Important changes: 140Important changes:
139 141
140Added recurring todos to KO/Pi. 142Added recurring todos to KO/Pi.
141 143
142Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. 144Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
143 145
144Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 146Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
145 147
146Datenavigator can now display many months. Very useful on the desktop. 148Datenavigator can now display many months. Very useful on the desktop.
147 149
148KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. 150KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
149 151
150Made alarm sound working on Linux desktop. 152Made alarm sound working on Linux desktop.
151 153
152Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. 154Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
153 155
154Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. 156Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
155 157
156Many other usebility enhancements. 158Many other usebility enhancements.
157Special thanks to Ben for his suggestions! 159Special thanks to Ben for his suggestions!
158 160
159You can find the complete changelog 161You can find the complete changelog
160from version 1.7.7 to 2.1.0 162from version 1.7.7 to 2.1.0
161in the source package or on 163in the source package or on
162 164
163http://www.pi-sync.net/html/changelog.html 165http://www.pi-sync.net/html/changelog.html
164 166
165 167
166 168
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 9197850..0cf75a0 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -1,363 +1,368 @@
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
39using namespace KABC; 39using namespace KABC;
40 40
41AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : 41AddresseeItem::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
50QString AddresseeItem::key( int column, bool ) const 50QString 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
61AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : 61AddresseeDialog::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
66 QWidget *topWidget = plainPage(); 67 QWidget *topWidget = plainPage();
67 68
68 QBoxLayout *topLayout = new QHBoxLayout( topWidget ); 69 QBoxLayout *topLayout = new QHBoxLayout( topWidget );
69 70
70 71
71 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); 72 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget);
72 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 73 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
73 74
74 topLayout->addWidget(mMiniSplitter ); 75 topLayout->addWidget(mMiniSplitter );
75 76
76 QWidget *listWidget = new QWidget( mMiniSplitter ); 77 QWidget *listWidget = new QWidget( mMiniSplitter );
77 78
78 QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; 79 QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
79 //topLayout->addLayout( listLayout ); 80 //topLayout->addLayout( listLayout );
80 81
81 mAddresseeList = new KListView( listWidget ); 82 mAddresseeList = new KListView( listWidget );
82 mAddresseeList->addColumn( i18n("Name") ); 83 mAddresseeList->addColumn( i18n("Name") );
83 mAddresseeList->addColumn( i18n("Email") ); 84 mAddresseeList->addColumn( i18n("Email") );
84 mAddresseeList->addColumn( i18n("Category") ); 85 mAddresseeList->addColumn( i18n("Category") );
85 mAddresseeList->setAllColumnsShowFocus( true ); 86 mAddresseeList->setAllColumnsShowFocus( true );
86 mAddresseeList->setFullWidth( true ); 87 mAddresseeList->setFullWidth( true );
87 listLayout->addWidget( mAddresseeList ); 88 listLayout->addWidget( mAddresseeList );
88 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), 89 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
89 SLOT( slotOk() ) ); 90 SLOT( slotOk() ) );
90 91
91 //QHBox* searchBox = new QHBox ( listWidget ); 92 //QHBox* searchBox = new QHBox ( listWidget );
92 mAddresseeEdit = new QLineEdit( listWidget ); 93 mAddresseeEdit = new QLineEdit( listWidget );
93 connect( mAddresseeEdit, SIGNAL( returnPressed() ), 94 connect( mAddresseeEdit, SIGNAL( returnPressed() ),
94 SLOT( loadAddressBook() ) ); 95 SLOT( loadAddressBook() ) );
95 mAddresseeEdit->setFocus(); 96 mAddresseeEdit->setFocus();
96 QPushButton *searchButton = new QPushButton( i18n("Search!"), listWidget ); 97 QPushButton *searchButton = new QPushButton( i18n("Search!"), listWidget );
97 connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); 98 connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) );
98 99
99 QHBoxLayout *searchLayout = new QHBoxLayout (listLayout) ; 100 QHBoxLayout *searchLayout = new QHBoxLayout (listLayout) ;
100 searchLayout->addWidget( mAddresseeEdit ); 101 searchLayout->addWidget( mAddresseeEdit );
101 searchLayout->addWidget( searchButton ); 102 searchLayout->addWidget( searchButton );
102 //listLayout->addWidget( searchBox ); 103 //listLayout->addWidget( searchBox );
103 104
104 if ( mMultiple ) { 105 if ( mMultiple ) {
105 //QBoxLayout *selectedLayout = new QVBoxLayout; 106 //QBoxLayout *selectedLayout = new QVBoxLayout;
106 //topLayout->addLayout( selectedLayout ); 107 //topLayout->addLayout( selectedLayout );
107 //topLayout->setSpacing( spacingHint() ); 108 //topLayout->setSpacing( spacingHint() );
108 109
109 QVBox *selectedGroup = new QVBox( mMiniSplitter ); 110 QVBox *selectedGroup = new QVBox( mMiniSplitter );
110 new QLabel ( i18n("Selected:"), selectedGroup ); 111 new QLabel ( i18n("Selected:"), selectedGroup );
111 //selectedLayout->addWidget( selectedGroup ); 112 //selectedLayout->addWidget( selectedGroup );
112 113
113 mSelectedList = new KListView( selectedGroup ); 114 mSelectedList = new KListView( selectedGroup );
114 mSelectedList->addColumn( i18n("Name") ); 115 mSelectedList->addColumn( i18n("Name") );
115 mSelectedList->addColumn( i18n("Email") ); 116 mSelectedList->addColumn( i18n("Email") );
116 mSelectedList->setAllColumnsShowFocus( true ); 117 mSelectedList->setAllColumnsShowFocus( true );
117 mSelectedList->setFullWidth( true ); 118 mSelectedList->setFullWidth( true );
118 //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), 119 //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
119 // SLOT( removeSelected() ) ); 120 // SLOT( removeSelected() ) );
120 connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), 121 connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ),
121 SLOT( removeSelected() ) ); 122 SLOT( removeSelected() ) );
122 connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), 123 connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ),
123 SLOT( removeSelected() ) ); 124 SLOT( removeSelected() ) );
124 125
125#if 0 126#if 0
126 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); 127 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
127 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); 128 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
128 129
129#endif 130#endif
130 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), 131 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
131 SLOT( addSelected( QListViewItem * ) ) ); 132 SLOT( addSelected( QListViewItem * ) ) );
132 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), 133 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
133 SLOT( selectNextItem( QListViewItem * ) ) ); 134 SLOT( selectNextItem( QListViewItem * ) ) );
134 135
135 } 136 }
136 137
137 mAddressBook = StdAddressBook::self( true ); 138 mAddressBook = StdAddressBook::self( true );
138 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), 139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
139 SLOT( addressBookChanged() ) ); 140 SLOT( addressBookChanged() ) );
140#if 0 141#if 0
141 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), 142 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
142 SLOT( addressBookChanged() ) ); 143 SLOT( addressBookChanged() ) );
143#endif 144#endif
144 loadAddressBook(); 145 loadAddressBook();
145 QValueList<int> splitterSize; 146 QValueList<int> splitterSize;
146 splitterSize.append( ( width() / 5 ) * 3 ); 147 splitterSize.append( ( width() / 5 ) * 3 );
147 splitterSize.append( ( width() / 5 ) *2 ); 148 splitterSize.append( ( width() / 5 ) *2 );
148 mMiniSplitter->setSizes( splitterSize ); 149 mMiniSplitter->setSizes( splitterSize );
149} 150}
150 151
151AddresseeDialog::~AddresseeDialog() 152AddresseeDialog::~AddresseeDialog()
152{ 153{
153 qDebug("DELETE AddresseeDialog "); 154 qDebug("DELETE AddresseeDialog ");
154} 155}
155 156
156void AddresseeDialog::loadAddressBook() 157void AddresseeDialog::loadAddressBook()
157{ 158{
158 mAddresseeList->clear(); 159 mAddresseeList->clear();
159 mItemDict.clear(); 160 mItemDict.clear();
160 if ( mAddresseeEdit->text().isEmpty() ) { 161 if ( mAddresseeEdit->text().isEmpty() ) {
161 AddressBook::Iterator it; 162 AddressBook::Iterator it;
162 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 163 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
163 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 164 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
164 continue; 165 continue;
165 new AddresseeItem( mAddresseeList, (*it) ); 166 new AddresseeItem( mAddresseeList, (*it) );
166 } 167 }
167 return; 168 return;
168 } 169 }
169 //mAddresseeEdit->completionObject()->clear(); 170 //mAddresseeEdit->completionObject()->clear();
170 QRegExp re; 171 QRegExp re;
171 re.setWildcard(true); // most people understand these better. 172 re.setWildcard(true); // most people understand these better.
172 re.setCaseSensitive(false); 173 re.setCaseSensitive(false);
173 re.setPattern( "*"+ mAddresseeEdit->text() + "*"); 174 re.setPattern( "*"+ mAddresseeEdit->text() + "*");
174 175
175 AddressBook::Iterator it; 176 AddressBook::Iterator it;
176 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 177 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
177 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 178 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
178 continue; 179 continue;
179 QString name = (*it).realName(); 180 QString name = (*it).realName();
180 name += (*it).preferredEmail(); 181 name += (*it).preferredEmail();
181 name += (*it).categories().join(";"); 182 name += (*it).categories().join(";");
182#if QT_VERSION >= 0x030000 183#if QT_VERSION >= 0x030000
183 if (re.search(name) != -1) 184 if (re.search(name) != -1)
184#else 185#else
185 if (re.match(name) != -1) 186 if (re.match(name) != -1)
186#endif 187#endif
187 AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); 188 AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) );
188 } 189 }
189} 190}
190 191
191void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) 192void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item )
192{ 193{
193 if ( str.isEmpty() ) return; 194 if ( str.isEmpty() ) return;
194 195
195 mItemDict.insert( str, item ); 196 mItemDict.insert( str, item );
196 //mAddresseeEdit->completionObject()->addItem( str ); 197 //mAddresseeEdit->completionObject()->addItem( str );
197} 198}
198 199
199void AddresseeDialog::selectItem( const QString &str ) 200void AddresseeDialog::selectItem( const QString &str )
200{ 201{
201 if ( str.isEmpty() ) return; 202 if ( str.isEmpty() ) return;
202 203
203 QListViewItem *item = mItemDict.find( str ); 204 QListViewItem *item = mItemDict.find( str );
204 if ( item ) { 205 if ( item ) {
205 mAddresseeList->blockSignals( true ); 206 mAddresseeList->blockSignals( true );
206 mAddresseeList->setSelected( item, true ); 207 mAddresseeList->setSelected( item, true );
207 mAddresseeList->ensureItemVisible( item ); 208 mAddresseeList->ensureItemVisible( item );
208 mAddresseeList->blockSignals( false ); 209 mAddresseeList->blockSignals( false );
209 } 210 }
210} 211}
211 212
212void AddresseeDialog::updateEdit( QListViewItem *item ) 213void AddresseeDialog::updateEdit( QListViewItem *item )
213{ 214{
214 mAddresseeEdit->setText( item->text( 0 ) ); 215 mAddresseeEdit->setText( item->text( 0 ) );
215 mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); 216 mAddresseeEdit->setSelection( 0, item->text( 0 ).length() );
216} 217}
217 218
218void AddresseeDialog::selectNextItem( QListViewItem *item ) 219void AddresseeDialog::selectNextItem( QListViewItem *item )
219{ 220{
220 addSelected( item ); 221 addSelected( item );
221 QListViewItem *next = item->nextSibling(); 222 QListViewItem *next = item->nextSibling();
222 if ( next ) { 223 if ( next ) {
223 next->setSelected( true ); 224 next->setSelected( true );
224 item->setSelected( false ); 225 item->setSelected( false );
225 mAddresseeList->setCurrentItem( next ); 226 mAddresseeList->setCurrentItem( next );
226 } 227 }
227} 228}
228void AddresseeDialog::addSelected( QListViewItem *item ) 229void AddresseeDialog::addSelected( QListViewItem *item )
229{ 230{
230 AddresseeItem *addrItem = (AddresseeItem *)( item ); 231 AddresseeItem *addrItem = (AddresseeItem *)( item );
231 if ( !addrItem ) return; 232 if ( !addrItem ) return;
232 233
233 Addressee a = addrItem->addressee(); 234 Addressee a = addrItem->addressee();
234 235
235 QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); 236 QListViewItem *selectedItem = mSelectedDict.find( a.uid() );
236 if ( !selectedItem ) { 237 if ( !selectedItem ) {
237 selectedItem = new AddresseeItem( mSelectedList, a ); 238 selectedItem = new AddresseeItem( mSelectedList, a );
238 mSelectedDict.insert( a.uid(), selectedItem ); 239 mSelectedDict.insert( a.uid(), selectedItem );
239 } 240 }
240 241
241} 242}
242 243
243void AddresseeDialog::removeSelected() 244void AddresseeDialog::removeSelected()
244{ 245{
245 QListViewItem *item = mSelectedList->selectedItem(); 246 QListViewItem *item = mSelectedList->selectedItem();
246 AddresseeItem *addrItem = (AddresseeItem *)( item ); 247 AddresseeItem *addrItem = (AddresseeItem *)( item );
247 if ( !addrItem ) return; 248 if ( !addrItem ) return;
248 QListViewItem *next = item->nextSibling(); 249 QListViewItem *next = item->nextSibling();
249 mSelectedDict.remove( addrItem->addressee().uid() ); 250 mSelectedDict.remove( addrItem->addressee().uid() );
250 delete addrItem; 251 delete addrItem;
251 if ( next ) 252 if ( next )
252 next->setSelected( true ); 253 next->setSelected( true );
253} 254}
254 255
255Addressee AddresseeDialog::addressee() 256Addressee AddresseeDialog::addressee()
256{ 257{
257 AddresseeItem *aItem = 0; 258 AddresseeItem *aItem = 0;
258 259
259 if ( mMultiple ) 260 if ( mMultiple )
260 aItem = (AddresseeItem *)( mSelectedList->firstChild() ); 261 aItem = (AddresseeItem *)( mSelectedList->firstChild() );
261 else 262 else
262 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); 263 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
263 264
264 if (aItem) return aItem->addressee(); 265 if (aItem) return aItem->addressee();
265 return Addressee(); 266 return Addressee();
266} 267}
267 268
268Addressee::List AddresseeDialog::addressees() 269Addressee::List AddresseeDialog::addressees()
269{ 270{
270 Addressee::List al; 271 Addressee::List al;
271 AddresseeItem *aItem = 0; 272 AddresseeItem *aItem = 0;
272 273
273 if ( mMultiple ) { 274 if ( mMultiple ) {
274 QListViewItem *item = mSelectedList->firstChild(); 275 QListViewItem *item = mSelectedList->firstChild();
275 while( item ) { 276 while( item ) {
276 aItem = (AddresseeItem *)( item ); 277 aItem = (AddresseeItem *)( item );
277 if ( aItem ) al.append( aItem->addressee() ); 278 if ( aItem ) al.append( aItem->addressee() );
278 item = item->nextSibling(); 279 item = item->nextSibling();
279 } 280 }
280 } 281 }
281 else 282 else
282 { 283 {
283 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); 284 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
284 if (aItem) al.append( aItem->addressee() ); 285 if (aItem) al.append( aItem->addressee() );
285 } 286 }
286 287
287 return al; 288 return al;
288} 289}
289 290
290Addressee AddresseeDialog::getAddressee( QWidget *parent ) 291Addressee AddresseeDialog::getAddressee( QWidget *parent )
291{ 292{
292 AddresseeDialog *dlg = new AddresseeDialog( parent ); 293 AddresseeDialog *dlg = new AddresseeDialog( parent );
293 Addressee addressee; 294 Addressee addressee;
294#ifdef DESKTOP_VERSION 295#ifdef DESKTOP_VERSION
295 static int geoX = 0; 296 static int geoX = 0;
296 static int geoY = 0; 297 static int geoY = 0;
297 static int geoW = 0; 298 static int geoW = 0;
298 static int geoH = 0; 299 static int geoH = 0;
299 if ( !geoX && ! geoY && !geoW &&!geoH ) { 300 if ( !geoX && ! geoY && !geoW &&!geoH ) {
300 geoX = dlg->geometry().x(); 301 geoX = dlg->geometry().x();
301 geoY = dlg->geometry().y(); 302 geoY = dlg->geometry().y();
302 geoW = dlg->width(); 303 geoW = dlg->width();
303 geoH = dlg->height(); 304 geoH = dlg->height();
304 } else { 305 } else {
305 dlg->show(); 306 dlg->show();
306 dlg->setGeometry(geoX , geoY,geoW , geoH ); 307 dlg->setGeometry(geoX , geoY,geoW , geoH );
307 308
308 } 309 }
309#endif 310#endif
310 int result = dlg->exec(); 311 int result = dlg->exec();
311#ifdef DESKTOP_VERSION 312#ifdef DESKTOP_VERSION
312 geoX = dlg->geometry().x(); 313 geoX = dlg->geometry().x();
313 geoY = dlg->geometry().y(); 314 geoY = dlg->geometry().y();
314 geoW = dlg->width(); 315 geoW = dlg->width();
315 geoH = dlg->height(); 316 geoH = dlg->height();
316#endif 317#endif
317 if ( result == QDialog::Accepted ) { 318 if ( result == QDialog::Accepted ) {
318 addressee = dlg->addressee(); 319 addressee = dlg->addressee();
319 } 320 }
320 321
321 delete dlg; 322 delete dlg;
322 return addressee; 323 return addressee;
323} 324}
324 325
325Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) 326Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
326{ 327{
327 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
328 Addressee::List addressees; 328 Addressee::List addressees;
329 static bool running = false;
330 if ( running ) return addressees;
331 running = true;
332 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
329 static int geoX = 0; 333 static int geoX = 0;
330 static int geoY = 0; 334 static int geoY = 0;
331 static int geoW = 0; 335 static int geoW = 0;
332 static int geoH = 0; 336 static int geoH = 0;
333 if ( QApplication::desktop()->width() <= 640 ) 337 if ( QApplication::desktop()->width() <= 640 )
334 dlg->showMaximized(); 338 dlg->showMaximized();
335 else { 339 else {
336 if ( !geoX && ! geoY && !geoW &&!geoH ) { 340 if ( !geoX && ! geoY && !geoW &&!geoH ) {
337 geoX = dlg->geometry().x(); 341 geoX = dlg->geometry().x();
338 geoY = dlg->geometry().y(); 342 geoY = dlg->geometry().y();
339 geoW = dlg->width(); 343 geoW = dlg->width();
340 geoH = dlg->height(); 344 geoH = dlg->height();
341 } else { 345 } else {
342 dlg->show(); 346 dlg->show();
343 dlg->setGeometry(geoX , geoY,geoW , geoH ); 347 dlg->setGeometry(geoX , geoY,geoW , geoH );
344 348
345 } 349 }
346 } 350 }
347 int result = dlg->exec(); 351 int result = dlg->exec();
348 geoX = dlg->geometry().x(); 352 geoX = dlg->geometry().x();
349 geoY = dlg->geometry().y(); 353 geoY = dlg->geometry().y();
350 geoW = dlg->width(); 354 geoW = dlg->width();
351 geoH = dlg->height(); 355 geoH = dlg->height();
352 if ( result == QDialog::Accepted ) { 356 if ( result == QDialog::Accepted ) {
353 addressees = dlg->addressees(); 357 addressees = dlg->addressees();
354 } 358 }
355 359
356 delete dlg; 360 delete dlg;
361 running = false;
357 return addressees; 362 return addressees;
358} 363}
359 364
360void AddresseeDialog::addressBookChanged() 365void AddresseeDialog::addressBookChanged()
361{ 366{
362 loadAddressBook(); 367 loadAddressBook();
363} 368}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b107e2d..3715786 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2163,821 +2163,825 @@ void KABCore::addActionsManually()
2163 mb->insertItem( i18n("Synchronize"), syncMenu ); 2163 mb->insertItem( i18n("Synchronize"), syncMenu );
2164#else 2164#else
2165 mb->insertItem( i18n("Sync"), syncMenu ); 2165 mb->insertItem( i18n("Sync"), syncMenu );
2166#endif 2166#endif
2167 //mb->insertItem( i18n("&Change"), changeMenu ); 2167 //mb->insertItem( i18n("&Change"), changeMenu );
2168 mb->insertItem( i18n("&Help"), helpMenu ); 2168 mb->insertItem( i18n("&Help"), helpMenu );
2169 mIncSearchWidget = new IncSearchWidget( tb ); 2169 mIncSearchWidget = new IncSearchWidget( tb );
2170 // tb->insertWidget(-1, 0, mIncSearchWidget); 2170 // tb->insertWidget(-1, 0, mIncSearchWidget);
2171#ifndef DESKTOP_VERSION 2171#ifndef DESKTOP_VERSION
2172 } else { 2172 } else {
2173 //US setup toolbar 2173 //US setup toolbar
2174 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2174 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2175 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2175 QPopupMenu *popupBarTB = new QPopupMenu( this );
2176 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2176 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2177 tb->insertWidget(-1, 0, menuBarTB); 2177 tb->insertWidget(-1, 0, menuBarTB);
2178 mIncSearchWidget = new IncSearchWidget( tb ); 2178 mIncSearchWidget = new IncSearchWidget( tb );
2179 tb->enableMoving(false); 2179 tb->enableMoving(false);
2180 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2180 popupBarTB->insertItem( i18n("&File"), fileMenu );
2181 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2181 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2182 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2182 popupBarTB->insertItem( i18n("&View"), viewMenu );
2183 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2183 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2184 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2184 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2185 mViewManager->getFilterAction()->plug ( popupBarTB); 2185 mViewManager->getFilterAction()->plug ( popupBarTB);
2186 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2186 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2187 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2187 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2188 if (QApplication::desktop()->width() > 320 ) { 2188 if (QApplication::desktop()->width() > 320 ) {
2189 // mViewManager->getFilterAction()->plug ( tb); 2189 // mViewManager->getFilterAction()->plug ( tb);
2190 } 2190 }
2191 } 2191 }
2192#endif 2192#endif
2193 mIncSearchWidget->setSize(); 2193 mIncSearchWidget->setSize();
2194 // mActionQuit->plug ( mMainWindow->toolBar()); 2194 // mActionQuit->plug ( mMainWindow->toolBar());
2195 2195
2196 2196
2197 2197
2198 //US Now connect the actions with the menue entries. 2198 //US Now connect the actions with the menue entries.
2199#ifdef DESKTOP_VERSION 2199#ifdef DESKTOP_VERSION
2200 mActionPrint->plug( fileMenu ); 2200 mActionPrint->plug( fileMenu );
2201 mActionPrintDetails->plug( fileMenu ); 2201 mActionPrintDetails->plug( fileMenu );
2202 fileMenu->insertSeparator(); 2202 fileMenu->insertSeparator();
2203#endif 2203#endif
2204 mActionMail->plug( fileMenu ); 2204 mActionMail->plug( fileMenu );
2205 fileMenu->insertSeparator(); 2205 fileMenu->insertSeparator();
2206 2206
2207 mActionNewContact->plug( editMenu ); 2207 mActionNewContact->plug( editMenu );
2208 mActionNewContact->plug( tb ); 2208 mActionNewContact->plug( tb );
2209 2209
2210 mActionEditAddressee->plug( editMenu ); 2210 mActionEditAddressee->plug( editMenu );
2211 editMenu->insertSeparator(); 2211 editMenu->insertSeparator();
2212 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2212 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2213 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2213 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2214 mActionEditAddressee->plug( tb ); 2214 mActionEditAddressee->plug( tb );
2215 2215
2216 // fileMenu->insertSeparator(); 2216 // fileMenu->insertSeparator();
2217 mActionSave->plug( fileMenu ); 2217 mActionSave->plug( fileMenu );
2218 fileMenu->insertItem( "&Import", ImportMenu ); 2218 fileMenu->insertItem( "&Import", ImportMenu );
2219 fileMenu->insertItem( "&Export", ExportMenu ); 2219 fileMenu->insertItem( "&Export", ExportMenu );
2220 editMenu->insertItem( i18n("&Change"), changeMenu ); 2220 editMenu->insertItem( i18n("&Change"), changeMenu );
2221 editMenu->insertSeparator(); 2221 editMenu->insertSeparator();
2222#ifndef DESKTOP_VERSION 2222#ifndef DESKTOP_VERSION
2223 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2223 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2224#endif 2224#endif
2225#if 0 2225#if 0
2226 // PENDING fix MailVCard 2226 // PENDING fix MailVCard
2227 fileMenu->insertSeparator(); 2227 fileMenu->insertSeparator();
2228 mActionMailVCard->plug( fileMenu ); 2228 mActionMailVCard->plug( fileMenu );
2229#endif 2229#endif
2230#ifndef DESKTOP_VERSION 2230#ifndef DESKTOP_VERSION
2231 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2231 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2232 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2232 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2233 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2233 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2234#endif 2234#endif
2235 fileMenu->insertSeparator(); 2235 fileMenu->insertSeparator();
2236 mActionQuit->plug( fileMenu ); 2236 mActionQuit->plug( fileMenu );
2237#ifdef _OL_IMPORT_ 2237#ifdef _OL_IMPORT_
2238 mActionImportOL->plug( ImportMenu ); 2238 mActionImportOL->plug( ImportMenu );
2239#endif 2239#endif
2240 // edit menu 2240 // edit menu
2241 mActionUndo->plug( editMenu ); 2241 mActionUndo->plug( editMenu );
2242 mActionRedo->plug( editMenu ); 2242 mActionRedo->plug( editMenu );
2243 editMenu->insertSeparator(); 2243 editMenu->insertSeparator();
2244 mActionCut->plug( editMenu ); 2244 mActionCut->plug( editMenu );
2245 mActionCopy->plug( editMenu ); 2245 mActionCopy->plug( editMenu );
2246 mActionPaste->plug( editMenu ); 2246 mActionPaste->plug( editMenu );
2247 mActionDelete->plug( editMenu ); 2247 mActionDelete->plug( editMenu );
2248 editMenu->insertSeparator(); 2248 editMenu->insertSeparator();
2249 mActionSelectAll->plug( editMenu ); 2249 mActionSelectAll->plug( editMenu );
2250 2250
2251 mActionSetFormattedName->plug( changeMenu ); 2251 mActionSetFormattedName->plug( changeMenu );
2252 mActionRemoveVoice->plug( changeMenu ); 2252 mActionRemoveVoice->plug( changeMenu );
2253 // settingsmings menu 2253 // settingsmings menu
2254//US special menuentry to configure the addressbook resources. On KDE 2254//US special menuentry to configure the addressbook resources. On KDE
2255// you do that through the control center !!! 2255// you do that through the control center !!!
2256 // settingsMenu->insertSeparator(); 2256 // settingsMenu->insertSeparator();
2257 2257
2258 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2258 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2259 mActionConfigGlobal->plug( settingsMenu, 1 ); 2259 mActionConfigGlobal->plug( settingsMenu, 1 );
2260 mActionConfigResources->plug( settingsMenu,2 ); 2260 mActionConfigResources->plug( settingsMenu,2 );
2261 settingsMenu->insertSeparator(3); 2261 settingsMenu->insertSeparator(3);
2262 2262
2263 if ( mIsPart ) { 2263 if ( mIsPart ) {
2264 //US not implemented yet 2264 //US not implemented yet
2265 //mActionConfigShortcuts->plug( settingsMenu ); 2265 //mActionConfigShortcuts->plug( settingsMenu );
2266 //mActionConfigureToolbars->plug( settingsMenu ); 2266 //mActionConfigureToolbars->plug( settingsMenu );
2267 2267
2268 } else { 2268 } else {
2269 //US not implemented yet 2269 //US not implemented yet
2270 //mActionKeyBindings->plug( settingsMenu ); 2270 //mActionKeyBindings->plug( settingsMenu );
2271 } 2271 }
2272 2272
2273 mActionEditCategories->plug( settingsMenu ); 2273 mActionEditCategories->plug( settingsMenu );
2274 mActionManageCategories->plug( settingsMenu ); 2274 mActionManageCategories->plug( settingsMenu );
2275 mActionJumpBar->plug( viewMenu,0 ); 2275 mActionJumpBar->plug( viewMenu,0 );
2276 mActionDetails->plug( viewMenu,0 ); 2276 mActionDetails->plug( viewMenu,0 );
2277 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2277 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2278 mActionDetails->plug( tb ); 2278 mActionDetails->plug( tb );
2279 settingsMenu->insertSeparator(); 2279 settingsMenu->insertSeparator();
2280#ifndef DESKTOP_VERSION 2280#ifndef DESKTOP_VERSION
2281 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2281 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2282 settingsMenu->insertSeparator(); 2282 settingsMenu->insertSeparator();
2283#endif 2283#endif
2284 2284
2285 mActionWhoAmI->plug( settingsMenu ); 2285 mActionWhoAmI->plug( settingsMenu );
2286 //mActionEditCategories->plug( changeMenu ); 2286 //mActionEditCategories->plug( changeMenu );
2287 mActionCategories->plug( changeMenu ); 2287 mActionCategories->plug( changeMenu );
2288 //mActionManageCategories->plug( changeMenu ); 2288 //mActionManageCategories->plug( changeMenu );
2289 2289
2290 //mActionCategories->plug( settingsMenu ); 2290 //mActionCategories->plug( settingsMenu );
2291 2291
2292 2292
2293 mActionWN->plug( helpMenu ); 2293 mActionWN->plug( helpMenu );
2294 mActionStorageHowto->plug( helpMenu ); 2294 mActionStorageHowto->plug( helpMenu );
2295 mActionSyncHowto->plug( helpMenu ); 2295 mActionSyncHowto->plug( helpMenu );
2296 mActionKdeSyncHowto->plug( helpMenu ); 2296 mActionKdeSyncHowto->plug( helpMenu );
2297 mActionMultiSyncHowto->plug( helpMenu ); 2297 mActionMultiSyncHowto->plug( helpMenu );
2298 mActionFaq->plug( helpMenu ); 2298 mActionFaq->plug( helpMenu );
2299 mActionLicence->plug( helpMenu ); 2299 mActionLicence->plug( helpMenu );
2300 mActionAboutKAddressbook->plug( helpMenu ); 2300 mActionAboutKAddressbook->plug( helpMenu );
2301 2301
2302 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2302 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2303 2303
2304 mActionSave->plug( tb ); 2304 mActionSave->plug( tb );
2305 mViewManager->getFilterAction()->plug ( tb); 2305 mViewManager->getFilterAction()->plug ( tb);
2306 //LR hide filteraction on started in 480x640 2306 //LR hide filteraction on started in 480x640
2307 if (QApplication::desktop()->width() == 480 ) { 2307 if (QApplication::desktop()->width() == 480 ) {
2308 mViewManager->getFilterAction()->setComboWidth( 0 ); 2308 mViewManager->getFilterAction()->setComboWidth( 0 );
2309 } 2309 }
2310 mActionUndo->plug( tb ); 2310 mActionUndo->plug( tb );
2311 mActionDelete->plug( tb ); 2311 mActionDelete->plug( tb );
2312 mActionRedo->plug( tb ); 2312 mActionRedo->plug( tb );
2313 } else { 2313 } else {
2314 mActionSave->plug( tb ); 2314 mActionSave->plug( tb );
2315 tb->enableMoving(false); 2315 tb->enableMoving(false);
2316 } 2316 }
2317 //mActionQuit->plug ( tb ); 2317 //mActionQuit->plug ( tb );
2318 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2318 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2319 2319
2320 //US link the searchwidget first to this. 2320 //US link the searchwidget first to this.
2321 // The real linkage to the toolbar happens later. 2321 // The real linkage to the toolbar happens later.
2322//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2322//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2323//US tb->insertItem( mIncSearchWidget ); 2323//US tb->insertItem( mIncSearchWidget );
2324/*US 2324/*US
2325 mIncSearchWidget = new IncSearchWidget( tb ); 2325 mIncSearchWidget = new IncSearchWidget( tb );
2326 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2326 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2327 SLOT( incrementalSearch( const QString& ) ) ); 2327 SLOT( incrementalSearch( const QString& ) ) );
2328 2328
2329 mJumpButtonBar = new JumpButtonBar( this, this ); 2329 mJumpButtonBar = new JumpButtonBar( this, this );
2330 2330
2331//US topLayout->addWidget( mJumpButtonBar ); 2331//US topLayout->addWidget( mJumpButtonBar );
2332 this->layout()->add( mJumpButtonBar ); 2332 this->layout()->add( mJumpButtonBar );
2333*/ 2333*/
2334 2334
2335#endif //KAB_EMBEDDED 2335#endif //KAB_EMBEDDED
2336 2336
2337 mActionExport2phone->plug( ExportMenu ); 2337 mActionExport2phone->plug( ExportMenu );
2338 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2338 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2339 syncManager->fillSyncMenu(); 2339 syncManager->fillSyncMenu();
2340 2340
2341} 2341}
2342void KABCore::showLicence() 2342void KABCore::showLicence()
2343{ 2343{
2344 KApplication::showLicence(); 2344 KApplication::showLicence();
2345} 2345}
2346 2346
2347void KABCore::manageCategories( ) 2347void KABCore::manageCategories( )
2348{ 2348{
2349 KABCatPrefs* cp = new KABCatPrefs(); 2349 KABCatPrefs* cp = new KABCatPrefs();
2350 cp->show(); 2350 cp->show();
2351 int w =cp->sizeHint().width() ; 2351 int w =cp->sizeHint().width() ;
2352 int h = cp->sizeHint().height() ; 2352 int h = cp->sizeHint().height() ;
2353 int dw = QApplication::desktop()->width(); 2353 int dw = QApplication::desktop()->width();
2354 int dh = QApplication::desktop()->height(); 2354 int dh = QApplication::desktop()->height();
2355 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2355 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2356 if ( !cp->exec() ) { 2356 if ( !cp->exec() ) {
2357 delete cp; 2357 delete cp;
2358 return; 2358 return;
2359 } 2359 }
2360 int count = 0; 2360 int count = 0;
2361 int cc = 0; 2361 int cc = 0;
2362 message( i18n("Please wait, processing categories...")); 2362 message( i18n("Please wait, processing categories..."));
2363 if ( cp->addCat() ) { 2363 if ( cp->addCat() ) {
2364 KABC::AddressBook::Iterator it; 2364 KABC::AddressBook::Iterator it;
2365 QStringList catList = KABPrefs::instance()->mCustomCategories; 2365 QStringList catList = KABPrefs::instance()->mCustomCategories;
2366 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2366 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2367 ++cc; 2367 ++cc;
2368 if ( cc %10 == 0) 2368 if ( cc %10 == 0)
2369 message(i18n("Processing contact #%1").arg(cc)); 2369 message(i18n("Processing contact #%1").arg(cc));
2370 QStringList catIncList = (*it).categories(); 2370 QStringList catIncList = (*it).categories();
2371 int i; 2371 int i;
2372 for( i = 0; i< catIncList.count(); ++i ) { 2372 for( i = 0; i< catIncList.count(); ++i ) {
2373 if ( !catList.contains (catIncList[i])) { 2373 if ( !catList.contains (catIncList[i])) {
2374 catList.append( catIncList[i] ); 2374 catList.append( catIncList[i] );
2375 //qDebug("add cat %s ", catIncList[i].latin1()); 2375 //qDebug("add cat %s ", catIncList[i].latin1());
2376 ++count; 2376 ++count;
2377 } 2377 }
2378 } 2378 }
2379 } 2379 }
2380 catList.sort(); 2380 catList.sort();
2381 KABPrefs::instance()->mCustomCategories = catList; 2381 KABPrefs::instance()->mCustomCategories = catList;
2382 KABPrefs::instance()->writeConfig(); 2382 KABPrefs::instance()->writeConfig();
2383 message(QString::number( count )+ i18n(" categories added to list! ")); 2383 message(QString::number( count )+ i18n(" categories added to list! "));
2384 } else { 2384 } else {
2385 QStringList catList = KABPrefs::instance()->mCustomCategories; 2385 QStringList catList = KABPrefs::instance()->mCustomCategories;
2386 QStringList catIncList; 2386 QStringList catIncList;
2387 QStringList newCatList; 2387 QStringList newCatList;
2388 KABC::AddressBook::Iterator it; 2388 KABC::AddressBook::Iterator it;
2389 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2389 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2390 ++cc; 2390 ++cc;
2391 if ( cc %10 == 0) 2391 if ( cc %10 == 0)
2392 message(i18n("Processing contact #%1").arg(cc)); 2392 message(i18n("Processing contact #%1").arg(cc));
2393 QStringList catIncList = (*it).categories(); 2393 QStringList catIncList = (*it).categories();
2394 int i; 2394 int i;
2395 if ( catIncList.count() ) { 2395 if ( catIncList.count() ) {
2396 newCatList.clear(); 2396 newCatList.clear();
2397 for( i = 0; i< catIncList.count(); ++i ) { 2397 for( i = 0; i< catIncList.count(); ++i ) {
2398 if ( catList.contains (catIncList[i])) { 2398 if ( catList.contains (catIncList[i])) {
2399 newCatList.append( catIncList[i] ); 2399 newCatList.append( catIncList[i] );
2400 } 2400 }
2401 } 2401 }
2402 newCatList.sort(); 2402 newCatList.sort();
2403 (*it).setCategories( newCatList ); 2403 (*it).setCategories( newCatList );
2404 mAddressBook->insertAddressee( (*it) ); 2404 mAddressBook->insertAddressee( (*it) );
2405 } 2405 }
2406 } 2406 }
2407 setModified( true ); 2407 setModified( true );
2408 mViewManager->refreshView(); 2408 mViewManager->refreshView();
2409 message( i18n("Removing categories done!")); 2409 message( i18n("Removing categories done!"));
2410 } 2410 }
2411 delete cp; 2411 delete cp;
2412} 2412}
2413void KABCore::removeVoice() 2413void KABCore::removeVoice()
2414{ 2414{
2415 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2415 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2416 return; 2416 return;
2417 XXPortSelectDialog dlg( this, false, this ); 2417 XXPortSelectDialog dlg( this, false, this );
2418 if ( !dlg.exec() ) 2418 if ( !dlg.exec() )
2419 return; 2419 return;
2420 mAddressBook->setUntagged(); 2420 mAddressBook->setUntagged();
2421 dlg.tagSelected(); 2421 dlg.tagSelected();
2422 message(i18n("Removing voice..."), false ); 2422 message(i18n("Removing voice..."), false );
2423 KABC::AddressBook::Iterator it; 2423 KABC::AddressBook::Iterator it;
2424 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2424 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2425 if ( (*it).tagged() ) { 2425 if ( (*it).tagged() ) {
2426 (*it).removeVoice(); 2426 (*it).removeVoice();
2427 } 2427 }
2428 } 2428 }
2429 message(i18n("Refreshing view...") ); 2429 message(i18n("Refreshing view...") );
2430 qApp->processEvents(); 2430 qApp->processEvents();
2431 mViewManager->refreshView( "" ); 2431 mViewManager->refreshView( "" );
2432 Addressee add; 2432 Addressee add;
2433 mDetails->setAddressee( add ); 2433 mDetails->setAddressee( add );
2434 message(i18n("Remove voice completed!") ); 2434 message(i18n("Remove voice completed!") );
2435 2435
2436 2436
2437 2437
2438} 2438}
2439 2439
2440void KABCore::setFormattedName() 2440void KABCore::setFormattedName()
2441{ 2441{
2442 KABFormatPrefs setpref; 2442 KABFormatPrefs setpref;
2443 if ( !setpref.exec() ) { 2443 if ( !setpref.exec() ) {
2444 return; 2444 return;
2445 } 2445 }
2446 XXPortSelectDialog dlg( this, false, this ); 2446 XXPortSelectDialog dlg( this, false, this );
2447 if ( !dlg.exec() ) 2447 if ( !dlg.exec() )
2448 return; 2448 return;
2449 mAddressBook->setUntagged(); 2449 mAddressBook->setUntagged();
2450 dlg.tagSelected(); 2450 dlg.tagSelected();
2451 int count = 0; 2451 int count = 0;
2452 KABC::AddressBook::Iterator it; 2452 KABC::AddressBook::Iterator it;
2453 bool modified = false; 2453 bool modified = false;
2454 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2454 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2455 if ( (*it).tagged() ) { 2455 if ( (*it).tagged() ) {
2456 if ( (*it).uid().left( 2 ) == "la" ) 2456 if ( (*it).uid().left( 2 ) == "la" )
2457 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) 2457 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") )
2458 continue; 2458 continue;
2459 ++count; 2459 ++count;
2460 if ( count %10 == 0 ) 2460 if ( count %10 == 0 )
2461 message(i18n("Changing contact #%1").arg( count ) ); 2461 message(i18n("Changing contact #%1").arg( count ) );
2462 qApp->processEvents(); 2462 qApp->processEvents();
2463 QString fName; 2463 QString fName;
2464 if ( setpref.simple->isChecked() ) 2464 if ( setpref.simple->isChecked() )
2465 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2465 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2466 else if ( setpref.full->isChecked() ) 2466 else if ( setpref.full->isChecked() )
2467 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2467 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2468 else if ( setpref.reverse->isChecked() ) 2468 else if ( setpref.reverse->isChecked() )
2469 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2469 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2470 else 2470 else
2471 fName = (*it).organization(); 2471 fName = (*it).organization();
2472 if ( setpref.setCompany->isChecked() ) 2472 if ( setpref.setCompany->isChecked() )
2473 if ( fName.isEmpty() || fName =="," ) 2473 if ( fName.isEmpty() || fName =="," )
2474 fName = (*it).organization(); 2474 fName = (*it).organization();
2475 (*it).setFormattedName( fName ); 2475 (*it).setFormattedName( fName );
2476 (*it).setChanged( true ); 2476 (*it).setChanged( true );
2477 modified = true; 2477 modified = true;
2478 (*it).setRevision( QDateTime::currentDateTime() ); 2478 (*it).setRevision( QDateTime::currentDateTime() );
2479 } 2479 }
2480 } 2480 }
2481 message(i18n("Refreshing view...") ); 2481 message(i18n("Refreshing view...") );
2482 qApp->processEvents(); 2482 qApp->processEvents();
2483 if ( modified ) 2483 if ( modified )
2484 setModified( true ); 2484 setModified( true );
2485 Addressee add; 2485 Addressee add;
2486 mDetails->setAddressee( add ); 2486 mDetails->setAddressee( add );
2487 if ( count == 0 ) 2487 if ( count == 0 )
2488 message(i18n("No contact changed!") ); 2488 message(i18n("No contact changed!") );
2489 else 2489 else
2490 message(i18n("%1 contacts changed!").arg( count ) ); 2490 message(i18n("%1 contacts changed!").arg( count ) );
2491} 2491}
2492 2492
2493void KABCore::clipboardDataChanged() 2493void KABCore::clipboardDataChanged()
2494{ 2494{
2495 2495
2496 if ( mReadWrite ) 2496 if ( mReadWrite )
2497 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2497 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2498 2498
2499} 2499}
2500 2500
2501void KABCore::updateActionMenu() 2501void KABCore::updateActionMenu()
2502{ 2502{
2503 UndoStack *undo = UndoStack::instance(); 2503 UndoStack *undo = UndoStack::instance();
2504 RedoStack *redo = RedoStack::instance(); 2504 RedoStack *redo = RedoStack::instance();
2505 2505
2506 if ( undo->isEmpty() ) 2506 if ( undo->isEmpty() )
2507 mActionUndo->setText( i18n( "Undo" ) ); 2507 mActionUndo->setText( i18n( "Undo" ) );
2508 else 2508 else
2509 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2509 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2510 2510
2511 mActionUndo->setEnabled( !undo->isEmpty() ); 2511 mActionUndo->setEnabled( !undo->isEmpty() );
2512 2512
2513 if ( !redo->top() ) 2513 if ( !redo->top() )
2514 mActionRedo->setText( i18n( "Redo" ) ); 2514 mActionRedo->setText( i18n( "Redo" ) );
2515 else 2515 else
2516 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2516 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2517 2517
2518 mActionRedo->setEnabled( !redo->isEmpty() ); 2518 mActionRedo->setEnabled( !redo->isEmpty() );
2519} 2519}
2520 2520
2521void KABCore::configureKeyBindings() 2521void KABCore::configureKeyBindings()
2522{ 2522{
2523#ifndef KAB_EMBEDDED 2523#ifndef KAB_EMBEDDED
2524 KKeyDialog::configure( actionCollection(), true ); 2524 KKeyDialog::configure( actionCollection(), true );
2525#else //KAB_EMBEDDED 2525#else //KAB_EMBEDDED
2526 qDebug("KABCore::configureKeyBindings() not implemented"); 2526 qDebug("KABCore::configureKeyBindings() not implemented");
2527#endif //KAB_EMBEDDED 2527#endif //KAB_EMBEDDED
2528} 2528}
2529 2529
2530#ifdef KAB_EMBEDDED 2530#ifdef KAB_EMBEDDED
2531void KABCore::configureResources() 2531void KABCore::configureResources()
2532{ 2532{
2533 KRES::KCMKResources dlg( this, "" , 0 ); 2533 KRES::KCMKResources dlg( this, "" , 0 );
2534 2534
2535 if ( !dlg.exec() ) 2535 if ( !dlg.exec() )
2536 return; 2536 return;
2537 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2537 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2538} 2538}
2539#endif //KAB_EMBEDDED 2539#endif //KAB_EMBEDDED
2540 2540
2541 2541
2542/* this method will be called through the QCop interface from Ko/Pi to select addresses 2542/* this method will be called through the QCop interface from Ko/Pi to select addresses
2543 * for the attendees list of an event. 2543 * for the attendees list of an event.
2544 */ 2544 */
2545void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2545void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2546{ 2546{
2547 2547 qDebug("KABCore::requestForNameEmailUidList ");
2548 bool ok = false; 2548 bool ok = false;
2549 mEmailSourceChannel = sourceChannel; 2549 mEmailSourceChannel = sourceChannel;
2550 mEmailSourceUID = uid; 2550 mEmailSourceUID = uid;
2551 callContactdialog(); 2551 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2552 //callContactdialog();
2552#if 0 2553#if 0
2553 int wid = uid.toInt( &ok ); 2554 int wid = uid.toInt( &ok );
2554 qDebug("UID %s ", uid.latin1()); 2555 qDebug("UID %s ", uid.latin1());
2555 if ( ok ) { 2556 if ( ok ) {
2556 if ( wid != QApplication::desktop()->width() ) { 2557 if ( wid != QApplication::desktop()->width() ) {
2557 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2558 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2558 message( i18n("Resizing, please wait...") ); 2559 message( i18n("Resizing, please wait...") );
2559 mMainWindow->showMinimized(); 2560 mMainWindow->showMinimized();
2560 /* 2561 /*
2561 { 2562 {
2562 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2563 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2563 } 2564 }
2564 */ 2565 */
2565 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2566 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2566 return; 2567 return;
2567 } 2568 }
2568 2569
2569 } else { 2570 } else {
2570 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2571 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2571 } 2572 }
2572 callContactdialog(); 2573 callContactdialog();
2573 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2574 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2574#endif 2575#endif
2575} 2576}
2576void KABCore::resizeAndCallContactdialog() 2577void KABCore::resizeAndCallContactdialog()
2577{ 2578{
2578 updateMainWindow(); 2579 updateMainWindow();
2579 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); 2580 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2580} 2581}
2581 2582
2582void KABCore::callContactdialog() 2583void KABCore::callContactdialog()
2583{ 2584{
2584 QStringList nameList; 2585 static bool running = false;
2586 if (running) return;
2587 running = true;
2588 QStringList nameList;
2585 QStringList emailList; 2589 QStringList emailList;
2586 QStringList uidList; 2590 QStringList uidList;
2587 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); 2591 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
2588 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2592 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2589 uint i=0; 2593 uint i=0;
2590 for (i=0; i < list.count(); i++) 2594 for (i=0; i < list.count(); i++)
2591 { 2595 {
2592 nameList.append(list[i].realName()); 2596 nameList.append(list[i].realName());
2593 emailList.append(list[i].preferredEmail()); 2597 emailList.append(list[i].preferredEmail());
2594 uidList.append(list[i].uid()); 2598 uidList.append(list[i].uid());
2595 } 2599 }
2596 QString uid = mEmailSourceUID; 2600 QString uid = mEmailSourceUID;
2597 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2601 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2598 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2602 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2599 2603 running = false;
2600} 2604}
2601/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2605/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2602 * to put them into the calendar. 2606 * to put them into the calendar.
2603 */ 2607 */
2604void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2608void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2605{ 2609{
2606 // qDebug("KABCore::requestForBirthdayList"); 2610 // qDebug("KABCore::requestForBirthdayList");
2607 QStringList birthdayList; 2611 QStringList birthdayList;
2608 QStringList anniversaryList; 2612 QStringList anniversaryList;
2609 QStringList realNameList; 2613 QStringList realNameList;
2610 QStringList preferredEmailList; 2614 QStringList preferredEmailList;
2611 QStringList assembledNameList; 2615 QStringList assembledNameList;
2612 QStringList uidList; 2616 QStringList uidList;
2613 2617
2614 KABC::AddressBook::Iterator it; 2618 KABC::AddressBook::Iterator it;
2615 2619
2616 int count = 0; 2620 int count = 0;
2617 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2621 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2618 ++count; 2622 ++count;
2619 } 2623 }
2620 QProgressBar bar(count,0 ); 2624 QProgressBar bar(count,0 );
2621 int w = 300; 2625 int w = 300;
2622 if ( QApplication::desktop()->width() < 320 ) 2626 if ( QApplication::desktop()->width() < 320 )
2623 w = 220; 2627 w = 220;
2624 int h = bar.sizeHint().height() ; 2628 int h = bar.sizeHint().height() ;
2625 int dw = QApplication::desktop()->width(); 2629 int dw = QApplication::desktop()->width();
2626 int dh = QApplication::desktop()->height(); 2630 int dh = QApplication::desktop()->height();
2627 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2631 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2628 bar.show(); 2632 bar.show();
2629 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2633 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2630 qApp->processEvents(); 2634 qApp->processEvents();
2631 2635
2632 QDate bday; 2636 QDate bday;
2633 QString anni; 2637 QString anni;
2634 QString formattedbday; 2638 QString formattedbday;
2635 2639
2636 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2640 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2637 { 2641 {
2638 if ( ! bar.isVisible() ) 2642 if ( ! bar.isVisible() )
2639 return; 2643 return;
2640 bar.setProgress( count++ ); 2644 bar.setProgress( count++ );
2641 qApp->processEvents(); 2645 qApp->processEvents();
2642 bday = (*it).birthday().date(); 2646 bday = (*it).birthday().date();
2643 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2647 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2644 2648
2645 if ( bday.isValid() || !anni.isEmpty()) 2649 if ( bday.isValid() || !anni.isEmpty())
2646 { 2650 {
2647 if (bday.isValid()) 2651 if (bday.isValid())
2648 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2652 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2649 else 2653 else
2650 formattedbday = "NOTVALID"; 2654 formattedbday = "NOTVALID";
2651 if (anni.isEmpty()) 2655 if (anni.isEmpty())
2652 anni = "INVALID"; 2656 anni = "INVALID";
2653 2657
2654 birthdayList.append(formattedbday); 2658 birthdayList.append(formattedbday);
2655 anniversaryList.append(anni); //should be ISODate 2659 anniversaryList.append(anni); //should be ISODate
2656 realNameList.append((*it).realName()); 2660 realNameList.append((*it).realName());
2657 preferredEmailList.append((*it).preferredEmail()); 2661 preferredEmailList.append((*it).preferredEmail());
2658 assembledNameList.append((*it).assembledName()); 2662 assembledNameList.append((*it).assembledName());
2659 uidList.append((*it).uid()); 2663 uidList.append((*it).uid());
2660 2664
2661 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2665 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2662 } 2666 }
2663 } 2667 }
2664 2668
2665 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2669 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2666 2670
2667} 2671}
2668 2672
2669/* this method will be called through the QCop interface from other apps to show details of a contact. 2673/* this method will be called through the QCop interface from other apps to show details of a contact.
2670 */ 2674 */
2671void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2675void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2672{ 2676{
2673 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2677 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2674 2678
2675 QString foundUid = QString::null; 2679 QString foundUid = QString::null;
2676 if ( ! uid.isEmpty() ) { 2680 if ( ! uid.isEmpty() ) {
2677 Addressee adrr = mAddressBook->findByUid( uid ); 2681 Addressee adrr = mAddressBook->findByUid( uid );
2678 if ( !adrr.isEmpty() ) { 2682 if ( !adrr.isEmpty() ) {
2679 foundUid = uid; 2683 foundUid = uid;
2680 } 2684 }
2681 if ( email == "sendbacklist" ) { 2685 if ( email == "sendbacklist" ) {
2682 //qDebug("ssssssssssssssssssssssend "); 2686 //qDebug("ssssssssssssssssssssssend ");
2683 QStringList nameList; 2687 QStringList nameList;
2684 QStringList emailList; 2688 QStringList emailList;
2685 QStringList uidList; 2689 QStringList uidList;
2686 nameList.append(adrr.realName()); 2690 nameList.append(adrr.realName());
2687 emailList = adrr.emails(); 2691 emailList = adrr.emails();
2688 uidList.append( adrr.preferredEmail()); 2692 uidList.append( adrr.preferredEmail());
2689 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2693 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2690 return; 2694 return;
2691 } 2695 }
2692 2696
2693 } 2697 }
2694 2698
2695 if ( email == "sendbacklist" ) 2699 if ( email == "sendbacklist" )
2696 return; 2700 return;
2697 if (foundUid.isEmpty()) 2701 if (foundUid.isEmpty())
2698 { 2702 {
2699 //find the uid of the person first 2703 //find the uid of the person first
2700 Addressee::List namelist; 2704 Addressee::List namelist;
2701 Addressee::List emaillist; 2705 Addressee::List emaillist;
2702 2706
2703 if (!name.isEmpty()) 2707 if (!name.isEmpty())
2704 namelist = mAddressBook->findByName( name ); 2708 namelist = mAddressBook->findByName( name );
2705 2709
2706 if (!email.isEmpty()) 2710 if (!email.isEmpty())
2707 emaillist = mAddressBook->findByEmail( email ); 2711 emaillist = mAddressBook->findByEmail( email );
2708 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2712 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2709 //check if we have a match in Namelist and Emaillist 2713 //check if we have a match in Namelist and Emaillist
2710 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2714 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2711 foundUid = emaillist[0].uid(); 2715 foundUid = emaillist[0].uid();
2712 } 2716 }
2713 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2717 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2714 foundUid = namelist[0].uid(); 2718 foundUid = namelist[0].uid();
2715 else 2719 else
2716 { 2720 {
2717 for (int i = 0; i < namelist.count(); i++) 2721 for (int i = 0; i < namelist.count(); i++)
2718 { 2722 {
2719 for (int j = 0; j < emaillist.count(); j++) 2723 for (int j = 0; j < emaillist.count(); j++)
2720 { 2724 {
2721 if (namelist[i] == emaillist[j]) 2725 if (namelist[i] == emaillist[j])
2722 { 2726 {
2723 foundUid = namelist[i].uid(); 2727 foundUid = namelist[i].uid();
2724 } 2728 }
2725 } 2729 }
2726 } 2730 }
2727 } 2731 }
2728 } 2732 }
2729 else 2733 else
2730 { 2734 {
2731 foundUid = uid; 2735 foundUid = uid;
2732 } 2736 }
2733 2737
2734 if (!foundUid.isEmpty()) 2738 if (!foundUid.isEmpty())
2735 { 2739 {
2736 2740
2737 // raise Ka/Pi if it is in the background 2741 // raise Ka/Pi if it is in the background
2738#ifndef DESKTOP_VERSION 2742#ifndef DESKTOP_VERSION
2739#ifndef KORG_NODCOP 2743#ifndef KORG_NODCOP
2740 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2744 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2741#endif 2745#endif
2742#endif 2746#endif
2743 2747
2744 mMainWindow->showMaximized(); 2748 mMainWindow->showMaximized();
2745 mMainWindow-> raise(); 2749 mMainWindow-> raise();
2746 2750
2747 mViewManager->setSelected( "", false); 2751 mViewManager->setSelected( "", false);
2748 mViewManager->refreshView( "" ); 2752 mViewManager->refreshView( "" );
2749 mViewManager->setSelected( foundUid, true ); 2753 mViewManager->setSelected( foundUid, true );
2750 mViewManager->refreshView( foundUid ); 2754 mViewManager->refreshView( foundUid );
2751 2755
2752 if ( !mMultipleViewsAtOnce ) 2756 if ( !mMultipleViewsAtOnce )
2753 { 2757 {
2754 setDetailsVisible( true ); 2758 setDetailsVisible( true );
2755 mActionDetails->setChecked(true); 2759 mActionDetails->setChecked(true);
2756 } 2760 }
2757 } 2761 }
2758} 2762}
2759void KABCore::storagehowto() 2763void KABCore::storagehowto()
2760{ 2764{
2761 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 2765 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
2762} 2766}
2763void KABCore::whatsnew() 2767void KABCore::whatsnew()
2764{ 2768{
2765 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2769 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2766} 2770}
2767void KABCore::synchowto() 2771void KABCore::synchowto()
2768{ 2772{
2769 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2773 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2770} 2774}
2771void KABCore::kdesynchowto() 2775void KABCore::kdesynchowto()
2772{ 2776{
2773 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2777 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2774} 2778}
2775void KABCore::multisynchowto() 2779void KABCore::multisynchowto()
2776{ 2780{
2777 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2781 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2778} 2782}
2779void KABCore::faq() 2783void KABCore::faq()
2780{ 2784{
2781 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2785 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2782} 2786}
2783 2787
2784#include <libkcal/syncdefines.h> 2788#include <libkcal/syncdefines.h>
2785 2789
2786KABC::Addressee KABCore::getLastSyncAddressee() 2790KABC::Addressee KABCore::getLastSyncAddressee()
2787{ 2791{
2788 Addressee lse; 2792 Addressee lse;
2789 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2793 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2790 2794
2791 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2795 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2792 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2796 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2793 if (lse.isEmpty()) { 2797 if (lse.isEmpty()) {
2794 qDebug("KA: Creating new last-syncAddressee "); 2798 qDebug("KA: Creating new last-syncAddressee ");
2795 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2799 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2796 QString sum = ""; 2800 QString sum = "";
2797 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2801 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2798 sum = "E: "; 2802 sum = "E: ";
2799 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2803 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2800 lse.setRevision( mLastAddressbookSync ); 2804 lse.setRevision( mLastAddressbookSync );
2801 lse.setCategories( i18n("SyncEvent") ); 2805 lse.setCategories( i18n("SyncEvent") );
2802 mAddressBook->insertAddressee( lse ); 2806 mAddressBook->insertAddressee( lse );
2803 } 2807 }
2804 return lse; 2808 return lse;
2805} 2809}
2806int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2810int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2807{ 2811{
2808 2812
2809 //void setZaurusId(int id); 2813 //void setZaurusId(int id);
2810 // int zaurusId() const; 2814 // int zaurusId() const;
2811 // void setZaurusUid(int id); 2815 // void setZaurusUid(int id);
2812 // int zaurusUid() const; 2816 // int zaurusUid() const;
2813 // void setZaurusStat(int id); 2817 // void setZaurusStat(int id);
2814 // int zaurusStat() const; 2818 // int zaurusStat() const;
2815 // 0 equal 2819 // 0 equal
2816 // 1 take local 2820 // 1 take local
2817 // 2 take remote 2821 // 2 take remote
2818 // 3 cancel 2822 // 3 cancel
2819 QDateTime lastSync = mLastAddressbookSync; 2823 QDateTime lastSync = mLastAddressbookSync;
2820 QDateTime localMod = local->revision(); 2824 QDateTime localMod = local->revision();
2821 QDateTime remoteMod = remote->revision(); 2825 QDateTime remoteMod = remote->revision();
2822 2826
2823 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2827 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2824 2828
2825 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2829 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2826 bool remCh, locCh; 2830 bool remCh, locCh;
2827 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2831 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2828 //if ( remCh ) 2832 //if ( remCh )
2829 // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2833 // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2830 locCh = ( localMod > mLastAddressbookSync ); 2834 locCh = ( localMod > mLastAddressbookSync );
2831 //qDebug("cahnged rem %d loc %d",remCh, locCh ); 2835 //qDebug("cahnged rem %d loc %d",remCh, locCh );
2832 if ( !remCh && ! locCh ) { 2836 if ( !remCh && ! locCh ) {
2833 //qDebug("both not changed "); 2837 //qDebug("both not changed ");
2834 lastSync = localMod.addDays(1); 2838 lastSync = localMod.addDays(1);
2835 if ( mode <= SYNC_PREF_ASK ) 2839 if ( mode <= SYNC_PREF_ASK )
2836 return 0; 2840 return 0;
2837 } else { 2841 } else {
2838 if ( locCh ) { 2842 if ( locCh ) {
2839 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2843 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2840 lastSync = localMod.addDays( -1 ); 2844 lastSync = localMod.addDays( -1 );
2841 if ( !remCh ) 2845 if ( !remCh )
2842 remoteMod =( lastSync.addDays( -1 ) ); 2846 remoteMod =( lastSync.addDays( -1 ) );
2843 } else { 2847 } else {
2844 //qDebug(" not loc changed "); 2848 //qDebug(" not loc changed ");
2845 lastSync = localMod.addDays( 1 ); 2849 lastSync = localMod.addDays( 1 );
2846 if ( remCh ) { 2850 if ( remCh ) {
2847 //qDebug("rem changed "); 2851 //qDebug("rem changed ");
2848 remoteMod =( lastSync.addDays( 1 ) ); 2852 remoteMod =( lastSync.addDays( 1 ) );
2849 } 2853 }
2850 2854
2851 } 2855 }
2852 } 2856 }
2853 full = true; 2857 full = true;
2854 if ( mode < SYNC_PREF_ASK ) 2858 if ( mode < SYNC_PREF_ASK )
2855 mode = SYNC_PREF_ASK; 2859 mode = SYNC_PREF_ASK;
2856 } else { 2860 } else {
2857 if ( localMod == remoteMod ) 2861 if ( localMod == remoteMod )
2858 return 0; 2862 return 0;
2859 2863
2860 } 2864 }
2861 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2865 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2862 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2866 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2863 //full = true; //debug only 2867 //full = true; //debug only
2864 if ( full ) { 2868 if ( full ) {
2865 bool equ = ( (*local) == (*remote) ); 2869 bool equ = ( (*local) == (*remote) );
2866 if ( equ ) { 2870 if ( equ ) {
2867 //qDebug("equal "); 2871 //qDebug("equal ");
2868 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2872 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2869 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2873 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2870 } 2874 }
2871 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2875 if ( mode < SYNC_PREF_FORCE_LOCAL )
2872 return 0; 2876 return 0;
2873 2877
2874 }//else //debug only 2878 }//else //debug only
2875 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2879 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2876 } 2880 }
2877 int result; 2881 int result;
2878 bool localIsNew; 2882 bool localIsNew;
2879 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2883 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2880 2884
2881 if ( full && mode < SYNC_PREF_NEWEST ) 2885 if ( full && mode < SYNC_PREF_NEWEST )
2882 mode = SYNC_PREF_ASK; 2886 mode = SYNC_PREF_ASK;
2883 2887
2884 switch( mode ) { 2888 switch( mode ) {
2885 case SYNC_PREF_LOCAL: 2889 case SYNC_PREF_LOCAL:
2886 if ( lastSync > remoteMod ) 2890 if ( lastSync > remoteMod )
2887 return 1; 2891 return 1;
2888 if ( lastSync > localMod ) 2892 if ( lastSync > localMod )
2889 return 2; 2893 return 2;
2890 return 1; 2894 return 1;
2891 break; 2895 break;
2892 case SYNC_PREF_REMOTE: 2896 case SYNC_PREF_REMOTE:
2893 if ( lastSync > localMod ) 2897 if ( lastSync > localMod )
2894 return 2; 2898 return 2;
2895 if ( lastSync > remoteMod ) 2899 if ( lastSync > remoteMod )
2896 return 1; 2900 return 1;
2897 return 2; 2901 return 2;
2898 break; 2902 break;
2899 case SYNC_PREF_NEWEST: 2903 case SYNC_PREF_NEWEST:
2900 if ( localMod > remoteMod ) 2904 if ( localMod > remoteMod )
2901 return 1; 2905 return 1;
2902 else 2906 else
2903 return 2; 2907 return 2;
2904 break; 2908 break;
2905 case SYNC_PREF_ASK: 2909 case SYNC_PREF_ASK:
2906 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2910 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2907 if ( lastSync > remoteMod && lastSync > localMod) 2911 if ( lastSync > remoteMod && lastSync > localMod)
2908 return 0; 2912 return 0;
2909 if ( lastSync > remoteMod ) 2913 if ( lastSync > remoteMod )
2910 return 1; 2914 return 1;
2911 if ( lastSync > localMod ) { 2915 if ( lastSync > localMod ) {
2912 return 2; 2916 return 2;
2913 } 2917 }
2914 localIsNew = localMod >= remoteMod; 2918 localIsNew = localMod >= remoteMod;
2915 //qDebug("conflict! ************************************** "); 2919 //qDebug("conflict! ************************************** ");
2916 { 2920 {
2917 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2921 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2918 result = acd.executeD(localIsNew); 2922 result = acd.executeD(localIsNew);
2919 return result; 2923 return result;
2920 } 2924 }
2921 break; 2925 break;
2922 case SYNC_PREF_FORCE_LOCAL: 2926 case SYNC_PREF_FORCE_LOCAL:
2923 return 1; 2927 return 1;
2924 break; 2928 break;
2925 case SYNC_PREF_FORCE_REMOTE: 2929 case SYNC_PREF_FORCE_REMOTE:
2926 return 2; 2930 return 2;
2927 break; 2931 break;
2928 2932
2929 default: 2933 default:
2930 // SYNC_PREF_TAKE_BOTH not implemented 2934 // SYNC_PREF_TAKE_BOTH not implemented
2931 break; 2935 break;
2932 } 2936 }
2933 return 0; 2937 return 0;
2934} 2938}
2935 2939
2936 2940
2937bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2941bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2938{ 2942{
2939 bool syncOK = true; 2943 bool syncOK = true;
2940 int addedAddressee = 0; 2944 int addedAddressee = 0;
2941 int addedAddresseeR = 0; 2945 int addedAddresseeR = 0;
2942 int deletedAddresseeR = 0; 2946 int deletedAddresseeR = 0;
2943 int deletedAddresseeL = 0; 2947 int deletedAddresseeL = 0;
2944 int changedLocal = 0; 2948 int changedLocal = 0;
2945 int changedRemote = 0; 2949 int changedRemote = 0;
2946 int filteredIN = 0; 2950 int filteredIN = 0;
2947 int filteredOUT = 0; 2951 int filteredOUT = 0;
2948 2952
2949 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2953 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2950 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2954 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2951 2955
2952 //QPtrList<Addressee> el = local->rawAddressees(); 2956 //QPtrList<Addressee> el = local->rawAddressees();
2953 Addressee addresseeR; 2957 Addressee addresseeR;
2954 QString uid; 2958 QString uid;
2955 int take; 2959 int take;
2956 Addressee addresseeL; 2960 Addressee addresseeL;
2957 Addressee addresseeRSync; 2961 Addressee addresseeRSync;
2958 Addressee addresseeLSync; 2962 Addressee addresseeLSync;
2959 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2963 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2960 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2964 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2961 bool fullDateRange = false; 2965 bool fullDateRange = false;
2962 local->resetTempSyncStat(); 2966 local->resetTempSyncStat();
2963 mLastAddressbookSync = QDateTime::currentDateTime(); 2967 mLastAddressbookSync = QDateTime::currentDateTime();
2964 if ( syncManager->syncWithDesktop() ) { 2968 if ( syncManager->syncWithDesktop() ) {
2965 // remote->removeSyncInfo( QString());//remove all info 2969 // remote->removeSyncInfo( QString());//remove all info
2966 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2970 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2967 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2971 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2968 qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2972 qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2969 } else { 2973 } else {
2970 qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); 2974 qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime ");
2971 } 2975 }
2972 } 2976 }
2973 QDateTime modifiedCalendar = mLastAddressbookSync; 2977 QDateTime modifiedCalendar = mLastAddressbookSync;
2974 addresseeLSync = getLastSyncAddressee(); 2978 addresseeLSync = getLastSyncAddressee();
2975 qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2979 qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1());
2976 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2980 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2977 if ( !addresseeR.isEmpty() ) { 2981 if ( !addresseeR.isEmpty() ) {
2978 addresseeRSync = addresseeR; 2982 addresseeRSync = addresseeR;
2979 remote->removeAddressee(addresseeR ); 2983 remote->removeAddressee(addresseeR );
2980 2984
2981 } else { 2985 } else {
2982 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2986 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2983 addresseeRSync = addresseeLSync ; 2987 addresseeRSync = addresseeLSync ;