-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | kabc/addresseeview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 3532084..93edc59 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,87 +1,91 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.5 ************ | 3 | ********** VERSION 2.1.5 ************ |
4 | 4 | ||
5 | This is the new stable version. | 5 | This is the new stable version. |
6 | Bugfix: | 6 | Bugfix: |
7 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 7 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
8 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 8 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
9 | Added config option to not display completed todos in agenda view. | 9 | Added config option to not display completed todos in agenda view. |
10 | Addressee view is now using the formatted name, if defined. | ||
11 | That makes it possible to display "lastname, firstname" in that view now. | ||
12 | To set the formatted name for all contacts, please use menu: | ||
13 | Edit->Change->Set formatted name. | ||
10 | 14 | ||
11 | ********** VERSION 2.1.4 ************ | 15 | ********** VERSION 2.1.4 ************ |
12 | 16 | ||
13 | Fixed two more bugs in the KA/Pi CSV import dialog: | 17 | Fixed two more bugs in the KA/Pi CSV import dialog: |
14 | Made it possible to read multi-line fields and import it to the "Note" field. | 18 | Made it possible to read multi-line fields and import it to the "Note" field. |
15 | Fixed a problem in mapping custom fields, whatever a custem field is... | 19 | Fixed a problem in mapping custom fields, whatever a custem field is... |
16 | 20 | ||
17 | ********** VERSION 2.1.3 ************ | 21 | ********** VERSION 2.1.3 ************ |
18 | 22 | ||
19 | Changed the menu structure of the alarm applet: | 23 | Changed the menu structure of the alarm applet: |
20 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 24 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
21 | 25 | ||
22 | Fixed several problems in the KA/Pi CSV import dialog: | 26 | Fixed several problems in the KA/Pi CSV import dialog: |
23 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 27 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
24 | 28 | ||
25 | 29 | ||
26 | ********** VERSION 2.1.2 ************ | 30 | ********** VERSION 2.1.2 ************ |
27 | 31 | ||
28 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 32 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
29 | 33 | ||
30 | Fixed a problem when importing data from Outlook with mutiple categories set. | 34 | Fixed a problem when importing data from Outlook with mutiple categories set. |
31 | 35 | ||
32 | Changed display of days in datenavigator: | 36 | Changed display of days in datenavigator: |
33 | Birthdays are now blue, not dark green. | 37 | Birthdays are now blue, not dark green. |
34 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 38 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
35 | When journal view is shown, only holidays are shown and days with journals are blue. | 39 | When journal view is shown, only holidays are shown and days with journals are blue. |
36 | 40 | ||
37 | Added Backup options to global config: | 41 | Added Backup options to global config: |
38 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). | 42 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). |
39 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. | 43 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. |
40 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. | 44 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. |
41 | 45 | ||
42 | ********** VERSION 2.1.1 ************ | 46 | ********** VERSION 2.1.1 ************ |
43 | 47 | ||
44 | Stable release 2.1.1! | 48 | Stable release 2.1.1! |
45 | 49 | ||
46 | KO/Pi: | 50 | KO/Pi: |
47 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 51 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
48 | 52 | ||
49 | ********** VERSION 2.1.0 ************ | 53 | ********** VERSION 2.1.0 ************ |
50 | 54 | ||
51 | Stable release 2.1.0! | 55 | Stable release 2.1.0! |
52 | 56 | ||
53 | Summary of changes/fixes compared to version 2.0.6: | 57 | Summary of changes/fixes compared to version 2.0.6: |
54 | 58 | ||
55 | Many bugs of version 2.0.6 fixed. | 59 | Many bugs of version 2.0.6 fixed. |
56 | Most of them were small bugs, but some of them were important. | 60 | Most of them were small bugs, but some of them were important. |
57 | It is recommended to use version 2.1.0 and not version 2.0.6. | 61 | It is recommended to use version 2.1.0 and not version 2.0.6. |
58 | 62 | ||
59 | Important changes: | 63 | Important changes: |
60 | 64 | ||
61 | Added recurring todos to KO/Pi. | 65 | Added recurring todos to KO/Pi. |
62 | 66 | ||
63 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 67 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
64 | 68 | ||
65 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 69 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
66 | 70 | ||
67 | Datenavigator can now display many months. Very useful on the desktop. | 71 | Datenavigator can now display many months. Very useful on the desktop. |
68 | 72 | ||
69 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 73 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
70 | 74 | ||
71 | Made alarm sound working on Linux desktop. | 75 | Made alarm sound working on Linux desktop. |
72 | 76 | ||
73 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 77 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
74 | 78 | ||
75 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 79 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
76 | 80 | ||
77 | Many other usebility enhancements. | 81 | Many other usebility enhancements. |
78 | Special thanks to Ben for his suggestions! | 82 | Special thanks to Ben for his suggestions! |
79 | 83 | ||
80 | You can find the complete changelog | 84 | You can find the complete changelog |
81 | from version 1.7.7 to 2.1.0 | 85 | from version 1.7.7 to 2.1.0 |
82 | in the source package or on | 86 | in the source package or on |
83 | 87 | ||
84 | http://www.pi-sync.net/html/changelog.html | 88 | http://www.pi-sync.net/html/changelog.html |
85 | 89 | ||
86 | 90 | ||
87 | 91 | ||
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 9118c3d..667a5e2 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -1,539 +1,545 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
40 | #include <qpaintdevicemetrics.h> | 40 | #include <qpaintdevicemetrics.h> |
41 | #include <qprinter.h> | 41 | #include <qprinter.h> |
42 | #include <qpainter.h> | 42 | #include <qpainter.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
46 | #include <qstylesheet.h> | ||
46 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
47 | #include <kabc/addresseeview.h> | 48 | #include <kabc/addresseeview.h> |
48 | 49 | ||
49 | 50 | ||
50 | //US #ifndef DESKTOP_VERSION | 51 | //US #ifndef DESKTOP_VERSION |
51 | //US #include <qtopia/qcopenvelope_qws.h> | 52 | //US #include <qtopia/qcopenvelope_qws.h> |
52 | //US #include <qpe/qpeapplication.h> | 53 | //US #include <qpe/qpeapplication.h> |
53 | //US #endif | 54 | //US #endif |
54 | 55 | ||
55 | //US static int kphoneInstalled = 0; | 56 | //US static int kphoneInstalled = 0; |
56 | 57 | ||
57 | using namespace KABC; | 58 | using namespace KABC; |
58 | 59 | ||
59 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 60 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
60 | : QTextBrowser( parent, name ) | 61 | : QTextBrowser( parent, name ) |
61 | 62 | ||
62 | 63 | ||
63 | { | 64 | { |
64 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 65 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
65 | setLinkUnderline( false ); | 66 | setLinkUnderline( false ); |
66 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 67 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
67 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 68 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
68 | 69 | ||
69 | //US QStyleSheet *sheet = styleSheet(); | 70 | //US QStyleSheet *sheet = styleSheet(); |
70 | //US QStyleSheetItem *link = sheet->item( "a" ); | 71 | //US QStyleSheetItem *link = sheet->item( "a" ); |
71 | //US link->setColor( KGlobalSettings::linkColor() ); | 72 | //US link->setColor( KGlobalSettings::linkColor() ); |
72 | 73 | ||
74 | |||
73 | } | 75 | } |
74 | void AddresseeView::printMe() | 76 | void AddresseeView::printMe() |
75 | { | 77 | { |
76 | #ifdef DESKTOP_VERSION | 78 | #ifdef DESKTOP_VERSION |
77 | QPrinter printer; | 79 | QPrinter printer; |
78 | if (!printer.setup() ) | 80 | if (!printer.setup() ) |
79 | return; | 81 | return; |
80 | QPainter p; | 82 | QPainter p; |
81 | p.begin ( &printer ); | 83 | p.begin ( &printer ); |
82 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 84 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
83 | float dx, dy; | 85 | float dx, dy; |
84 | int wid = (m.width() * 9)/10; | 86 | int wid = (m.width() * 9)/10; |
85 | dx = (float) wid/(float)contentsWidth (); | 87 | dx = (float) wid/(float)contentsWidth (); |
86 | dy = (float)(m.height()) / (float)contentsHeight (); | 88 | dy = (float)(m.height()) / (float)contentsHeight (); |
87 | float scale; | 89 | float scale; |
88 | // scale to fit the width or height of the paper | 90 | // scale to fit the width or height of the paper |
89 | if ( dx < dy ) | 91 | if ( dx < dy ) |
90 | scale = dx; | 92 | scale = dx; |
91 | else | 93 | else |
92 | scale = dy; | 94 | scale = dy; |
93 | p.translate( m.width()/10,0 ); | 95 | p.translate( m.width()/10,0 ); |
94 | p.scale( scale, scale ); | 96 | p.scale( scale, scale ); |
95 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 97 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
96 | p.end(); | 98 | p.end(); |
97 | #endif | 99 | #endif |
98 | } | 100 | } |
99 | void AddresseeView::setSource(const QString& n) | 101 | void AddresseeView::setSource(const QString& n) |
100 | { | 102 | { |
101 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 103 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
102 | 104 | ||
103 | if ( n.left( 6 ) == "mailto" ) | 105 | if ( n.left( 6 ) == "mailto" ) |
104 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 106 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
105 | else if ( n.left( 7 ) == "phoneto" ) | 107 | else if ( n.left( 7 ) == "phoneto" ) |
106 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 108 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
107 | else if ( n.left( 5 ) == "faxto" ) | 109 | else if ( n.left( 5 ) == "faxto" ) |
108 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 110 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
109 | else if ( n.left( 5 ) == "smsto" ) | 111 | else if ( n.left( 5 ) == "smsto" ) |
110 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 112 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
111 | else if ( n.left( 7 ) == "pagerto" ) | 113 | else if ( n.left( 7 ) == "pagerto" ) |
112 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 114 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
113 | else if ( n.left( 5 ) == "sipto" ) | 115 | else if ( n.left( 5 ) == "sipto" ) |
114 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | 116 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); |
115 | 117 | ||
116 | } | 118 | } |
117 | void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | 119 | void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) |
118 | { | 120 | { |
119 | bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); | 121 | bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); |
120 | // mAddressee = addr; | 122 | // mAddressee = addr; |
121 | // clear view | 123 | // clear view |
122 | //setText( QString::null ); | 124 | //setText( QString::null ); |
123 | 125 | ||
124 | if ( mAddressee.isEmpty() ) { | 126 | if ( mAddressee.isEmpty() ) { |
125 | setText( QString::null); | 127 | setText( QString::null); |
126 | return; | 128 | return; |
127 | } | 129 | } |
130 | #if 0 | ||
128 | QString name = ( mAddressee.assembledName().isEmpty() ? | 131 | QString name = ( mAddressee.assembledName().isEmpty() ? |
129 | mAddressee.formattedName() : mAddressee.assembledName() ); | 132 | mAddressee.formattedName() : mAddressee.assembledName() ); |
133 | #endif | ||
134 | |||
135 | QString name = mAddressee.realName(); | ||
130 | 136 | ||
131 | QString dynamicPart; | 137 | QString dynamicPart; |
132 | 138 | ||
133 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); | 139 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); |
134 | QStringList emails = mAddressee.emails(); | 140 | QStringList emails = mAddressee.emails(); |
135 | QStringList::ConstIterator emailIt; | 141 | QStringList::ConstIterator emailIt; |
136 | QString type = i18n( "Email" ); | 142 | QString type = i18n( "Email" ); |
137 | emailIt = emails.begin(); | 143 | emailIt = emails.begin(); |
138 | if ( emailIt != emails.end() ) { | 144 | if ( emailIt != emails.end() ) { |
139 | if ( kemailAvail ) { | 145 | if ( kemailAvail ) { |
140 | dynamicPart += QString( | 146 | dynamicPart += QString( |
141 | "<tr><td align=\"right\"><b>%1</b></td>" | 147 | "<tr><td align=\"right\"><b>%1</b></td>" |
142 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 148 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
143 | .arg( type ) | 149 | .arg( type ) |
144 | .arg( name ) | 150 | .arg( name ) |
145 | .arg( *emailIt ) | 151 | .arg( *emailIt ) |
146 | .arg( *emailIt ); | 152 | .arg( *emailIt ); |
147 | ++emailIt; | 153 | ++emailIt; |
148 | } else { | 154 | } else { |
149 | dynamicPart += QString( | 155 | dynamicPart += QString( |
150 | "<tr><td align=\"right\"><b>%1</b></td>" | 156 | "<tr><td align=\"right\"><b>%1</b></td>" |
151 | "<td align=\"left\">%2</td></tr>" ) | 157 | "<td align=\"left\">%2</td></tr>" ) |
152 | .arg( type ) | 158 | .arg( type ) |
153 | .arg( *emailIt ); | 159 | .arg( *emailIt ); |
154 | ++emailIt; | 160 | ++emailIt; |
155 | } | 161 | } |
156 | } | 162 | } |
157 | if ( mAddressee.birthday().date().isValid() ) { | 163 | if ( mAddressee.birthday().date().isValid() ) { |
158 | dynamicPart += QString( | 164 | dynamicPart += QString( |
159 | "<tr><td align=\"right\"><b>%1</b></td>" | 165 | "<tr><td align=\"right\"><b>%1</b></td>" |
160 | "<td align=\"left\">%2</td></tr>" ) | 166 | "<td align=\"left\">%2</td></tr>" ) |
161 | .arg( i18n ("Birthday") ) | 167 | .arg( i18n ("Birthday") ) |
162 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); | 168 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); |
163 | } | 169 | } |
164 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); | 170 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); |
165 | 171 | ||
166 | for ( ; emailIt != emails.end(); ++emailIt ) { | 172 | for ( ; emailIt != emails.end(); ++emailIt ) { |
167 | if ( kemailAvail ) { | 173 | if ( kemailAvail ) { |
168 | dynamicPart += QString( | 174 | dynamicPart += QString( |
169 | "<tr><td align=\"right\"><b>%1</b></td>" | 175 | "<tr><td align=\"right\"><b>%1</b></td>" |
170 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 176 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
171 | .arg( type ) | 177 | .arg( type ) |
172 | .arg( name ) | 178 | .arg( name ) |
173 | .arg( *emailIt ) | 179 | .arg( *emailIt ) |
174 | .arg( *emailIt ); | 180 | .arg( *emailIt ); |
175 | } else { | 181 | } else { |
176 | dynamicPart += QString( | 182 | dynamicPart += QString( |
177 | "<tr><td align=\"right\"><b>%1</b></td>" | 183 | "<tr><td align=\"right\"><b>%1</b></td>" |
178 | "<td align=\"left\">%2</td></tr>" ) | 184 | "<td align=\"left\">%2</td></tr>" ) |
179 | .arg( type ) | 185 | .arg( type ) |
180 | .arg( *emailIt ); | 186 | .arg( *emailIt ); |
181 | } | 187 | } |
182 | } | 188 | } |
183 | 189 | ||
184 | if ( !mAddressee.url().url().isEmpty() ) { | 190 | if ( !mAddressee.url().url().isEmpty() ) { |
185 | dynamicPart += QString( | 191 | dynamicPart += QString( |
186 | "<tr><td align=\"right\"><b>%1</b></td>" | 192 | "<tr><td align=\"right\"><b>%1</b></td>" |
187 | "<td align=\"left\">%2</td></tr>" ) | 193 | "<td align=\"left\">%2</td></tr>" ) |
188 | .arg( i18n( "Homepage" ) ) | 194 | .arg( i18n( "Homepage" ) ) |
189 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 195 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
190 | .arg( mAddressee.url().url() ); | 196 | .arg( mAddressee.url().url() ); |
191 | //qDebug("AddresseeView::setAddressee has to be verified."); | 197 | //qDebug("AddresseeView::setAddressee has to be verified."); |
192 | } | 198 | } |
193 | 199 | ||
194 | KABC::Address::List addresses = mAddressee.addresses(); | 200 | KABC::Address::List addresses = mAddressee.addresses(); |
195 | KABC::Address::List::ConstIterator addrIt; | 201 | KABC::Address::List::ConstIterator addrIt; |
196 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 202 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
197 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 203 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
198 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 204 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
199 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 205 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
200 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 206 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
201 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 207 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
202 | //qDebug("AddresseeView::setAddressee has to be verified."); | 208 | //qDebug("AddresseeView::setAddressee has to be verified."); |
203 | 209 | ||
204 | dynamicPart += QString( | 210 | dynamicPart += QString( |
205 | "<tr><td align=\"right\"><b>%1</b></td>" | 211 | "<tr><td align=\"right\"><b>%1</b></td>" |
206 | "<td align=\"left\">%2</td></tr>" ) | 212 | "<td align=\"left\">%2</td></tr>" ) |
207 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 213 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
208 | .arg( formattedAddress ); | 214 | .arg( formattedAddress ); |
209 | } else { | 215 | } else { |
210 | 216 | ||
211 | dynamicPart += QString( | 217 | dynamicPart += QString( |
212 | "<tr><td align=\"right\"><b>%1</b></td>" | 218 | "<tr><td align=\"right\"><b>%1</b></td>" |
213 | "<td align=\"left\">%2</td></tr>" ) | 219 | "<td align=\"left\">%2</td></tr>" ) |
214 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 220 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
215 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 221 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
216 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 222 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
217 | 223 | ||
218 | } | 224 | } |
219 | } | 225 | } |
220 | 226 | ||
221 | QString notes; | 227 | QString notes; |
222 | if ( !mAddressee.note().isEmpty() ) { | 228 | if ( !mAddressee.note().isEmpty() ) { |
223 | notes = QString( | 229 | notes = QString( |
224 | "<tr>" | 230 | "<tr>" |
225 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 231 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
226 | "<td align=\"left\">%2</td>" // note | 232 | "<td align=\"left\">%2</td>" // note |
227 | "</tr>" ).arg( i18n( "Notes" ) ) | 233 | "</tr>" ).arg( i18n( "Notes" ) ) |
228 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 234 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
229 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 235 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
230 | //qDebug("AddresseeView::setAddressee has to be verified."); | 236 | //qDebug("AddresseeView::setAddressee has to be verified."); |
231 | } | 237 | } |
232 | 238 | ||
233 | QString aRole = ""; | 239 | QString aRole = ""; |
234 | QString aOrga = ""; | 240 | QString aOrga = ""; |
235 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 241 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
236 | aRole = "<tr>" | 242 | aRole = "<tr>" |
237 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 243 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
238 | "</tr>"; | 244 | "</tr>"; |
239 | } | 245 | } |
240 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 246 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
241 | aOrga = "<tr>" | 247 | aOrga = "<tr>" |
242 | "<td align=\"left\">" + mAddressee.organization() + "</td>" | 248 | "<td align=\"left\">" + mAddressee.organization() + "</td>" |
243 | "</tr>"; | 249 | "</tr>"; |
244 | } | 250 | } |
245 | mText = ""; | 251 | mText = ""; |
246 | QString picString = ""; | 252 | QString picString = ""; |
247 | KABC::Picture picture = mAddressee.photo(); | 253 | KABC::Picture picture = mAddressee.photo(); |
248 | bool picAvailintern = false; | 254 | bool picAvailintern = false; |
249 | bool picAvailUrl = false; | 255 | bool picAvailUrl = false; |
250 | if (! picture.undefined() ) { | 256 | if (! picture.undefined() ) { |
251 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 257 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
252 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 258 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
253 | } | 259 | } |
254 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 260 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
255 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 261 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
256 | if ( picAvailintern ) { | 262 | if ( picAvailintern ) { |
257 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 263 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
258 | } else { | 264 | } else { |
259 | if ( picAvailUrl ) { | 265 | if ( picAvailUrl ) { |
260 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); | 266 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); |
261 | } else { | 267 | } else { |
262 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { | 268 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { |
263 | static bool setDefaultImageChildren = false; | 269 | static bool setDefaultImageChildren = false; |
264 | if ( !setDefaultImageChildren ) { | 270 | if ( !setDefaultImageChildren ) { |
265 | QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); | 271 | QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); |
266 | setDefaultImageChildren = true; | 272 | setDefaultImageChildren = true; |
267 | } | 273 | } |
268 | picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; | 274 | picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; |
269 | 275 | ||
270 | } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { | 276 | } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { |
271 | static bool setDefaultImagepouses = false; | 277 | static bool setDefaultImagepouses = false; |
272 | if ( !setDefaultImagepouses ) { | 278 | if ( !setDefaultImagepouses ) { |
273 | QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); | 279 | QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); |
274 | setDefaultImagepouses = true; | 280 | setDefaultImagepouses = true; |
275 | } | 281 | } |
276 | picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; | 282 | picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; |
277 | } else { | 283 | } else { |
278 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | 284 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); |
279 | if ( gen == "male" ) { | 285 | if ( gen == "male" ) { |
280 | static bool setDefaultImageMale = false; | 286 | static bool setDefaultImageMale = false; |
281 | if ( !setDefaultImageMale ) { | 287 | if ( !setDefaultImageMale ) { |
282 | QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); | 288 | QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); |
283 | setDefaultImageMale = true; | 289 | setDefaultImageMale = true; |
284 | } | 290 | } |
285 | picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; | 291 | picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; |
286 | 292 | ||
287 | } else if ( gen == "female" ) { | 293 | } else if ( gen == "female" ) { |
288 | static bool setDefaultImageFemale = false; | 294 | static bool setDefaultImageFemale = false; |
289 | if ( !setDefaultImageFemale ) { | 295 | if ( !setDefaultImageFemale ) { |
290 | QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); | 296 | QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); |
291 | setDefaultImageFemale = true; | 297 | setDefaultImageFemale = true; |
292 | } | 298 | } |
293 | picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; | 299 | picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; |
294 | 300 | ||
295 | } else { | 301 | } else { |
296 | static bool setDefaultImage = false; | 302 | static bool setDefaultImage = false; |
297 | if ( !setDefaultImage ) { | 303 | if ( !setDefaultImage ) { |
298 | //qDebug("Setting default pixmap "); | 304 | //qDebug("Setting default pixmap "); |
299 | QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); | 305 | QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); |
300 | setDefaultImage = true; | 306 | setDefaultImage = true; |
301 | } | 307 | } |
302 | picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; | 308 | picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; |
303 | } | 309 | } |
304 | } | 310 | } |
305 | } | 311 | } |
306 | } | 312 | } |
307 | mText = QString::fromLatin1( | 313 | mText = QString::fromLatin1( |
308 | "<html>" | 314 | "<html>" |
309 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 315 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
310 | "<table>" | 316 | "<table>" |
311 | "<tr>" | 317 | "<tr>" |
312 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 318 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
313 | "%3" | 319 | "%3" |
314 | "</td>" | 320 | "</td>" |
315 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 321 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
316 | "</tr>" | 322 | "</tr>" |
317 | "%5" // role | 323 | "%5" // role |
318 | "%6" // organization | 324 | "%6" // organization |
319 | "<td colspan=\"2\"> </td>" | 325 | "<td colspan=\"2\"> </td>" |
320 | "%7" // dynamic part | 326 | "%7" // dynamic part |
321 | "%8" // notes | 327 | "%8" // notes |
322 | "</table>" | 328 | "</table>" |
323 | "</body>" | 329 | "</body>" |
324 | "</html>") | 330 | "</html>") |
325 | //US | 331 | //US |
326 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 332 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
327 | //US | 333 | //US |
328 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 334 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
329 | .arg( picString ) | 335 | .arg( picString ) |
330 | .arg( name ) | 336 | .arg( name ) |
331 | .arg( aRole ) | 337 | .arg( aRole ) |
332 | .arg( aOrga ) | 338 | .arg( aOrga ) |
333 | .arg( dynamicPart ) | 339 | .arg( dynamicPart ) |
334 | .arg( notes ); | 340 | .arg( notes ); |
335 | 341 | ||
336 | } else { // no picture! | 342 | } else { // no picture! |
337 | 343 | ||
338 | mText = "<table width=\"100%\">\n"; | 344 | mText = "<table width=\"100%\">\n"; |
339 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 345 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
340 | #ifdef DESKTOP_VERSION | 346 | #ifdef DESKTOP_VERSION |
341 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 347 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
342 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; | 348 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; |
343 | #else | 349 | #else |
344 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; | 350 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; |
345 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; | 351 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; |
346 | #endif | 352 | #endif |
347 | 353 | ||
348 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 354 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
349 | 355 | ||
350 | mText += "<table><td colspan=\"2\"> </td>"; | 356 | mText += "<table><td colspan=\"2\"> </td>"; |
351 | /* | 357 | /* |
352 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 358 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
353 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 359 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
354 | .arg( i18n(" ") ) | 360 | .arg( i18n(" ") ) |
355 | .arg( name ); | 361 | .arg( name ); |
356 | */ | 362 | */ |
357 | if ( ! mAddressee.role().isEmpty() ) | 363 | if ( ! mAddressee.role().isEmpty() ) |
358 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 364 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
359 | "<td align=\"left\">%2</td></tr>" ) | 365 | "<td align=\"left\">%2</td></tr>" ) |
360 | .arg( i18n(" ") ) | 366 | .arg( i18n(" ") ) |
361 | .arg( mAddressee.role()); | 367 | .arg( mAddressee.role()); |
362 | if ( ! mAddressee.organization().isEmpty() ) | 368 | if ( ! mAddressee.organization().isEmpty() ) |
363 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 369 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
364 | "<td align=\"left\">%2</td></tr>" ) | 370 | "<td align=\"left\">%2</td></tr>" ) |
365 | .arg( i18n(" ") ) | 371 | .arg( i18n(" ") ) |
366 | .arg( mAddressee.organization()); | 372 | .arg( mAddressee.organization()); |
367 | mText += dynamicPart; | 373 | mText += dynamicPart; |
368 | mText += notes; | 374 | mText += notes; |
369 | mText += "</table>"; | 375 | mText += "</table>"; |
370 | 376 | ||
371 | } | 377 | } |
372 | 378 | ||
373 | // at last display it... | 379 | // at last display it... |
374 | setText( mText ); | 380 | setText( mText ); |
375 | 381 | ||
376 | } | 382 | } |
377 | 383 | ||
378 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) | 384 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) |
379 | { | 385 | { |
380 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 386 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
381 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 387 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
382 | bool kfaxAvail = eah->isFaxAppAvailable(); | 388 | bool kfaxAvail = eah->isFaxAppAvailable(); |
383 | bool ksmsAvail = eah->isSMSAppAvailable(); | 389 | bool ksmsAvail = eah->isSMSAppAvailable(); |
384 | bool kpagerAvail = eah->isPagerAppAvailable(); | 390 | bool kpagerAvail = eah->isPagerAppAvailable(); |
385 | bool ksipAvail = eah->isSIPAppAvailable(); | 391 | bool ksipAvail = eah->isSIPAppAvailable(); |
386 | QString dynamicPart; | 392 | QString dynamicPart; |
387 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 393 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
388 | QString extension; | 394 | QString extension; |
389 | int phonetype; | 395 | int phonetype; |
390 | QString sms; | 396 | QString sms; |
391 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 397 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
392 | phonetype = (*phoneIt).type(); | 398 | phonetype = (*phoneIt).type(); |
393 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) | 399 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) |
394 | continue; | 400 | continue; |
395 | if (ksmsAvail && | 401 | if (ksmsAvail && |
396 | ( | 402 | ( |
397 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 403 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
398 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 404 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
399 | ) | 405 | ) |
400 | ) | 406 | ) |
401 | { | 407 | { |
402 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 408 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
403 | .arg( (*phoneIt).number() ); | 409 | .arg( (*phoneIt).number() ); |
404 | 410 | ||
405 | } | 411 | } |
406 | else | 412 | else |
407 | sms = ""; | 413 | sms = ""; |
408 | 414 | ||
409 | extension = QString::null; | 415 | extension = QString::null; |
410 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 416 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
411 | if (kfaxAvail) extension = "faxto:"; | 417 | if (kfaxAvail) extension = "faxto:"; |
412 | } | 418 | } |
413 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 419 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
414 | if (kpagerAvail) extension = "pagerto:"; | 420 | if (kpagerAvail) extension = "pagerto:"; |
415 | } | 421 | } |
416 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | 422 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { |
417 | if (ksipAvail) extension = "sipto:"; | 423 | if (ksipAvail) extension = "sipto:"; |
418 | } | 424 | } |
419 | else if (kphoneAvail) { | 425 | else if (kphoneAvail) { |
420 | extension = "phoneto:"; | 426 | extension = "phoneto:"; |
421 | } | 427 | } |
422 | else | 428 | else |
423 | extension = QString::null; | 429 | extension = QString::null; |
424 | 430 | ||
425 | if ( !extension.isEmpty() ) { | 431 | if ( !extension.isEmpty() ) { |
426 | dynamicPart += QString( | 432 | dynamicPart += QString( |
427 | "<tr><td align=\"right\"><b>%1</b></td>" | 433 | "<tr><td align=\"right\"><b>%1</b></td>" |
428 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 434 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
429 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 435 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
430 | .arg( extension ) | 436 | .arg( extension ) |
431 | .arg( (*phoneIt).number() ) | 437 | .arg( (*phoneIt).number() ) |
432 | .arg( (*phoneIt).number() ) | 438 | .arg( (*phoneIt).number() ) |
433 | .arg( sms ); | 439 | .arg( sms ); |
434 | 440 | ||
435 | } else { | 441 | } else { |
436 | dynamicPart += QString( | 442 | dynamicPart += QString( |
437 | "<tr><td align=\"right\"><b>%1</b></td>" | 443 | "<tr><td align=\"right\"><b>%1</b></td>" |
438 | "<td align=\"left\">%2 %3</td></tr>" ) | 444 | "<td align=\"left\">%2 %3</td></tr>" ) |
439 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 445 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
440 | .arg( (*phoneIt).number() ) | 446 | .arg( (*phoneIt).number() ) |
441 | .arg( sms ); | 447 | .arg( sms ); |
442 | } | 448 | } |
443 | } | 449 | } |
444 | return dynamicPart; | 450 | return dynamicPart; |
445 | } | 451 | } |
446 | /* | 452 | /* |
447 | KABC::Addressee AddresseeView::addressee() const | 453 | KABC::Addressee AddresseeView::addressee() const |
448 | { | 454 | { |
449 | return mAddressee; | 455 | return mAddressee; |
450 | } | 456 | } |
451 | */ | 457 | */ |
452 | void AddresseeView::addTag(const QString & tag,const QString & text) | 458 | void AddresseeView::addTag(const QString & tag,const QString & text) |
453 | { | 459 | { |
454 | if ( text.isEmpty() ) | 460 | if ( text.isEmpty() ) |
455 | return; | 461 | return; |
456 | int number=text.contains("\n"); | 462 | int number=text.contains("\n"); |
457 | QString str = "<" + tag + ">"; | 463 | QString str = "<" + tag + ">"; |
458 | QString tmpText=text; | 464 | QString tmpText=text; |
459 | QString tmpStr=str; | 465 | QString tmpStr=str; |
460 | if(number !=-1) | 466 | if(number !=-1) |
461 | { | 467 | { |
462 | if (number > 0) { | 468 | if (number > 0) { |
463 | int pos=0; | 469 | int pos=0; |
464 | QString tmp; | 470 | QString tmp; |
465 | for(int i=0;i<=number;i++) { | 471 | for(int i=0;i<=number;i++) { |
466 | pos=tmpText.find("\n"); | 472 | pos=tmpText.find("\n"); |
467 | tmp=tmpText.left(pos); | 473 | tmp=tmpText.left(pos); |
468 | tmpText=tmpText.right(tmpText.length()-pos-1); | 474 | tmpText=tmpText.right(tmpText.length()-pos-1); |
469 | tmpStr+=tmp+"<br>"; | 475 | tmpStr+=tmp+"<br>"; |
470 | } | 476 | } |
471 | } | 477 | } |
472 | else tmpStr += tmpText; | 478 | else tmpStr += tmpText; |
473 | tmpStr+="</" + tag + ">"; | 479 | tmpStr+="</" + tag + ">"; |
474 | mText.append(tmpStr); | 480 | mText.append(tmpStr); |
475 | } | 481 | } |
476 | else | 482 | else |
477 | { | 483 | { |
478 | str += text + "</" + tag + ">"; | 484 | str += text + "</" + tag + ">"; |
479 | mText.append(str); | 485 | mText.append(str); |
480 | } | 486 | } |
481 | } | 487 | } |
482 | 488 | ||
483 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, | 489 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, |
484 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) | 490 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) |
485 | { | 491 | { |
486 | findButton( Close )->setText( i18n("Cancel Sync")); | 492 | findButton( Close )->setText( i18n("Cancel Sync")); |
487 | findButton( Ok )->setText( i18n("Remote")); | 493 | findButton( Ok )->setText( i18n("Remote")); |
488 | findButton( User1 )->setText( i18n("Local")); | 494 | findButton( User1 )->setText( i18n("Local")); |
489 | QWidget* topframe = new QWidget( this ); | 495 | QWidget* topframe = new QWidget( this ); |
490 | setMainWidget( topframe ); | 496 | setMainWidget( topframe ); |
491 | QBoxLayout* bl; | 497 | QBoxLayout* bl; |
492 | if ( QApplication::desktop()->width() < 640 ) { | 498 | if ( QApplication::desktop()->width() < 640 ) { |
493 | bl = new QVBoxLayout( topframe ); | 499 | bl = new QVBoxLayout( topframe ); |
494 | } else { | 500 | } else { |
495 | bl = new QHBoxLayout( topframe ); | 501 | bl = new QHBoxLayout( topframe ); |
496 | } | 502 | } |
497 | QVBox* subframe = new QVBox( topframe ); | 503 | QVBox* subframe = new QVBox( topframe ); |
498 | bl->addWidget(subframe ); | 504 | bl->addWidget(subframe ); |
499 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); | 505 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); |
500 | if ( takeloc ) | 506 | if ( takeloc ) |
501 | lab->setBackgroundColor(Qt::green.light() ); | 507 | lab->setBackgroundColor(Qt::green.light() ); |
502 | AddresseeView * av = new AddresseeView( subframe ); | 508 | AddresseeView * av = new AddresseeView( subframe ); |
503 | av->setAddressee( loc ); | 509 | av->setAddressee( loc ); |
504 | subframe = new QVBox( topframe ); | 510 | subframe = new QVBox( topframe ); |
505 | bl->addWidget(subframe ); | 511 | bl->addWidget(subframe ); |
506 | lab = new QLabel( i18n("Remote Addressee"), subframe ); | 512 | lab = new QLabel( i18n("Remote Addressee"), subframe ); |
507 | if ( !takeloc ) | 513 | if ( !takeloc ) |
508 | lab->setBackgroundColor(Qt::green.light() ); | 514 | lab->setBackgroundColor(Qt::green.light() ); |
509 | av = new AddresseeView( subframe ); | 515 | av = new AddresseeView( subframe ); |
510 | av->setAddressee( rem ); | 516 | av->setAddressee( rem ); |
511 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 517 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
512 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); | 518 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); |
513 | #ifndef DESKTOP_VERSION | 519 | #ifndef DESKTOP_VERSION |
514 | showMaximized(); | 520 | showMaximized(); |
515 | #else | 521 | #else |
516 | resize ( 640, 400 ); | 522 | resize ( 640, 400 ); |
517 | #endif | 523 | #endif |
518 | } | 524 | } |
519 | 525 | ||
520 | int AddresseeChooser::executeD( bool local ) | 526 | int AddresseeChooser::executeD( bool local ) |
521 | { | 527 | { |
522 | mSyncResult = 3; | 528 | mSyncResult = 3; |
523 | if ( local ) | 529 | if ( local ) |
524 | findButton( User1 )->setFocus(); | 530 | findButton( User1 )->setFocus(); |
525 | else | 531 | else |
526 | findButton( Ok )->setFocus(); | 532 | findButton( Ok )->setFocus(); |
527 | exec(); | 533 | exec(); |
528 | return mSyncResult; | 534 | return mSyncResult; |
529 | } | 535 | } |
530 | void AddresseeChooser::slot_remote() | 536 | void AddresseeChooser::slot_remote() |
531 | { | 537 | { |
532 | mSyncResult = 2; | 538 | mSyncResult = 2; |
533 | accept(); | 539 | accept(); |
534 | } | 540 | } |
535 | void AddresseeChooser::slot_local() | 541 | void AddresseeChooser::slot_local() |
536 | { | 542 | { |
537 | mSyncResult = 1; | 543 | mSyncResult = 1; |
538 | accept(); | 544 | accept(); |
539 | } | 545 | } |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index e134f97..278cab0 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -1,338 +1,342 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> | 3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> |
4 | Tobias Koenig <tokoe@kde.org> | 4 | Tobias Koenig <tokoe@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kcombobox.h> | 34 | #include <kcombobox.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | 37 | ||
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qheader.h> | 41 | #include <qheader.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qradiobutton.h> | 46 | #include <qradiobutton.h> |
47 | #include <qstringlist.h> | 47 | #include <qstringlist.h> |
48 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
49 | 49 | ||
50 | #include "kabcore.h" | 50 | #include "kabcore.h" |
51 | #include "kabprefs.h" | 51 | #include "kabprefs.h" |
52 | 52 | ||
53 | #include "xxportselectdialog.h" | 53 | #include "xxportselectdialog.h" |
54 | 54 | ||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 56 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 58 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 59 | mUseSorting( sort ) |
60 | { | 60 | { |
61 | initGUI(); | 61 | initGUI(); |
62 | 62 | ||
63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
64 | SLOT( filterChanged( int ) ) ); | 64 | SLOT( filterChanged( int ) ) ); |
65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), |
66 | SLOT( categoryClicked( QListViewItem* ) ) ); | 66 | SLOT( categoryClicked( QListViewItem* ) ) ); |
67 | 67 | ||
68 | // setup filters | 68 | // setup filters |
69 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
70 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 70 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
71 | Filter::List::iterator filterIt; | 71 | Filter::List::iterator filterIt; |
72 | #else //KAB_EMBEDDED | 72 | #else //KAB_EMBEDDED |
73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
74 | Filter::List::Iterator filterIt; | 74 | Filter::List::Iterator filterIt; |
75 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
76 | QStringList filters; | 76 | QStringList filters; |
77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
78 | filters.append( (*filterIt).name() ); | 78 | filters.append( (*filterIt).name() ); |
79 | 79 | ||
80 | mFiltersCombo->insertStringList( filters ); | 80 | mFiltersCombo->insertStringList( filters ); |
81 | mUseFilters->setEnabled( filters.count() > 0 ); | 81 | mUseFilters->setEnabled( filters.count() > 0 ); |
82 | 82 | ||
83 | // setup categories | 83 | // setup categories |
84 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 84 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
85 | QStringList::Iterator it; | 85 | QStringList::Iterator it; |
86 | for ( it = categories.begin(); it != categories.end(); ++it ) | 86 | for ( it = categories.begin(); it != categories.end(); ++it ) |
87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); |
88 | mUseCategories->setEnabled( categories.count() > 0 ); | 88 | mUseCategories->setEnabled( categories.count() > 0 ); |
89 | 89 | ||
90 | int count = mCore->selectedUIDs().count(); | 90 | int count = mCore->selectedUIDs().count(); |
91 | mUseSelection->setEnabled( count != 0 ); | 91 | mUseSelection->setEnabled( count != 0 ); |
92 | mUseSelection->setChecked( count > 1 ); | 92 | mUseSelection->setChecked( count > 1 ); |
93 | 93 | ||
94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
96 | 96 | ||
97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
98 | KABC::Field::List::Iterator fieldIt; | 98 | KABC::Field::List::Iterator fieldIt; |
99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
100 | mFieldCombo->insertItem( (*fieldIt)->label() ); | 100 | mFieldCombo->insertItem( (*fieldIt)->label() ); |
101 | } | 101 | } |
102 | 102 | ||
103 | QStringList XXPortSelectDialog::uids() | 103 | QStringList XXPortSelectDialog::uids() |
104 | { | 104 | { |
105 | QStringList uidlist; | 105 | QStringList uidlist; |
106 | KABC::AddresseeList list = contacts(); | 106 | KABC::AddresseeList list = contacts(); |
107 | KABC::Addressee::List::Iterator it; | 107 | KABC::Addressee::List::Iterator it; |
108 | for ( it = list.begin(); it != list.end(); ++it ) | 108 | for ( it = list.begin(); it != list.end(); ++it ) |
109 | uidlist.append((*it).uid()); | 109 | uidlist.append((*it).uid()); |
110 | return uidlist; | 110 | return uidlist; |
111 | } | 111 | } |
112 | void XXPortSelectDialog::tagSelected() | 112 | void XXPortSelectDialog::tagSelected() |
113 | { | 113 | { |
114 | if ( mUseSelection->isChecked() ) { | 114 | if ( mUseSelection->isChecked() ) { |
115 | 115 | ||
116 | QStringList selection = mCore->selectedUIDs(); | 116 | QStringList selection = mCore->selectedUIDs(); |
117 | KABC::AddressBook::Iterator it; | 117 | KABC::AddressBook::Iterator it; |
118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 118 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
119 | if ( selection.findIndex((*it).uid()) >= 0 ) | 119 | if ( selection.findIndex((*it).uid()) >= 0 ) |
120 | (*it).setTagged( true ); | 120 | (*it).setTagged( true ); |
121 | } | 121 | } |
122 | } else if ( mUseFilters->isChecked() ) { | 122 | } else if ( mUseFilters->isChecked() ) { |
123 | // find contacts that can pass selected filter | 123 | // find contacts that can pass selected filter |
124 | Filter::List::Iterator filterIt; | 124 | Filter::List::Iterator filterIt; |
125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 125 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 126 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
127 | break; | 127 | break; |
128 | KABC::AddressBook::Iterator it; | 128 | KABC::AddressBook::Iterator it; |
129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 129 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
130 | if ( (*filterIt).filterAddressee( *it ) ) | 130 | if ( (*filterIt).filterAddressee( *it ) ) |
131 | (*it).setTagged( true ); | 131 | (*it).setTagged( true ); |
132 | } | 132 | } |
133 | } else if ( mUseCategories->isChecked() ) { | 133 | } else if ( mUseCategories->isChecked() ) { |
134 | QStringList categorieList = categories(); | 134 | QStringList categorieList = categories(); |
135 | KABC::AddressBook::Iterator it; | 135 | KABC::AddressBook::Iterator it; |
136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 136 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
137 | QStringList tmp( (*it).categories() ); | 137 | QStringList tmp( (*it).categories() ); |
138 | QStringList::Iterator tmpIt; | 138 | QStringList::Iterator tmpIt; |
139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 139 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
140 | if ( categorieList.contains( *tmpIt ) ) { | 140 | if ( categorieList.contains( *tmpIt ) ) { |
141 | (*it).setTagged( true ); | 141 | (*it).setTagged( true ); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } else { | 145 | } else { |
146 | // create a string list of all entries: | 146 | // create a string list of all entries: |
147 | KABC::AddressBook::Iterator it; | 147 | KABC::AddressBook::Iterator it; |
148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 148 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
149 | (*it).setTagged( true ); | 149 | (*it).setTagged( true ); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | KABC::AddresseeList XXPortSelectDialog::contacts() | 152 | KABC::AddresseeList XXPortSelectDialog::contacts() |
153 | { | 153 | { |
154 | 154 | ||
155 | KABC::AddresseeList list; | 155 | KABC::AddresseeList list; |
156 | if ( mUseSelection->isChecked() ) { | 156 | if ( mUseSelection->isChecked() ) { |
157 | QStringList::Iterator it; | 157 | QStringList::Iterator it; |
158 | QStringList selection = mCore->selectedUIDs(); | 158 | QStringList selection = mCore->selectedUIDs(); |
159 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 159 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 160 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
161 | if ( !addr.isEmpty() ) | 161 | if ( !addr.isEmpty() ) |
162 | list.append( addr ); | 162 | if ( addr.uid().left( 19 ) != QString("last-syncAddressee-") ) |
163 | list.append( addr ); | ||
163 | } | 164 | } |
164 | } else if ( mUseFilters->isChecked() ) { | 165 | } else if ( mUseFilters->isChecked() ) { |
165 | // find contacts that can pass selected filter | 166 | // find contacts that can pass selected filter |
166 | Filter::List::Iterator filterIt; | 167 | Filter::List::Iterator filterIt; |
167 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 168 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
168 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 169 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
169 | break; | 170 | break; |
170 | 171 | ||
171 | KABC::AddressBook::Iterator it; | 172 | KABC::AddressBook::Iterator it; |
172 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 173 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
173 | if ( (*filterIt).filterAddressee( *it ) ) | 174 | if ( (*filterIt).filterAddressee( *it ) ) |
174 | list.append( *it ); | 175 | if ((*it).uid().left( 19 ) != QString("last-syncAddressee-") ) |
176 | list.append( *it ); | ||
175 | } | 177 | } |
176 | } else if ( mUseCategories->isChecked() ) { | 178 | } else if ( mUseCategories->isChecked() ) { |
177 | QStringList categorieList = categories(); | 179 | QStringList categorieList = categories(); |
178 | KABC::AddressBook::Iterator it; | 180 | KABC::AddressBook::Iterator it; |
179 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 181 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
180 | QStringList tmp( (*it).categories() ); | 182 | QStringList tmp( (*it).categories() ); |
181 | QStringList::Iterator tmpIt; | 183 | QStringList::Iterator tmpIt; |
182 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 184 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
183 | if ( categorieList.contains( *tmpIt ) ) { | 185 | if ( categorieList.contains( *tmpIt ) ) { |
184 | list.append( *it ); | 186 | if ((*it).uid().left( 19 ) != QString("last-syncAddressee-") ) |
187 | list.append( *it ); | ||
185 | break; | 188 | break; |
186 | } | 189 | } |
187 | } | 190 | } |
188 | } else { | 191 | } else { |
189 | // create a string list of all entries: | 192 | // create a string list of all entries: |
190 | KABC::AddressBook::Iterator it; | 193 | KABC::AddressBook::Iterator it; |
191 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 194 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
192 | list.append( *it ); | 195 | if ((*it).uid().left( 19 ) != QString("last-syncAddressee-") ) |
196 | list.append( *it ); | ||
193 | } | 197 | } |
194 | 198 | ||
195 | if ( mUseSorting ) { | 199 | if ( mUseSorting ) { |
196 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); | 200 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); |
197 | uint pos = mFieldCombo->currentItem(); | 201 | uint pos = mFieldCombo->currentItem(); |
198 | if ( pos < mFields.count() ) | 202 | if ( pos < mFields.count() ) |
199 | list.sortByField( mFields[ pos ] ); | 203 | list.sortByField( mFields[ pos ] ); |
200 | } | 204 | } |
201 | 205 | ||
202 | return list; | 206 | return list; |
203 | } | 207 | } |
204 | 208 | ||
205 | QStringList XXPortSelectDialog::categories() const | 209 | QStringList XXPortSelectDialog::categories() const |
206 | { | 210 | { |
207 | QStringList list; | 211 | QStringList list; |
208 | 212 | ||
209 | QListViewItemIterator it( mCategoriesView ); | 213 | QListViewItemIterator it( mCategoriesView ); |
210 | for ( ; it.current(); ++it ) { | 214 | for ( ; it.current(); ++it ) { |
211 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 215 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); |
212 | if ( qcli->isOn() ) | 216 | if ( qcli->isOn() ) |
213 | list.append( it.current()->text( 0 ) ); | 217 | list.append( it.current()->text( 0 ) ); |
214 | } | 218 | } |
215 | 219 | ||
216 | return list; | 220 | return list; |
217 | } | 221 | } |
218 | 222 | ||
219 | void XXPortSelectDialog::filterChanged( int ) | 223 | void XXPortSelectDialog::filterChanged( int ) |
220 | { | 224 | { |
221 | mUseFilters->setChecked( true ); | 225 | mUseFilters->setChecked( true ); |
222 | } | 226 | } |
223 | 227 | ||
224 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 228 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) |
225 | { | 229 | { |
226 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 230 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); |
227 | if ( qcli->isOn() ) | 231 | if ( qcli->isOn() ) |
228 | mUseCategories->setChecked( true ); | 232 | mUseCategories->setChecked( true ); |
229 | } | 233 | } |
230 | 234 | ||
231 | void XXPortSelectDialog::slotHelp() | 235 | void XXPortSelectDialog::slotHelp() |
232 | { | 236 | { |
233 | #ifndef KAB_EMBEDDED | 237 | #ifndef KAB_EMBEDDED |
234 | kapp->invokeHelp( "import-and-export" ); | 238 | kapp->invokeHelp( "import-and-export" ); |
235 | #else //KAB_EMBEDDED | 239 | #else //KAB_EMBEDDED |
236 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 240 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
237 | #endif //KAB_EMBEDDED | 241 | #endif //KAB_EMBEDDED |
238 | 242 | ||
239 | } | 243 | } |
240 | 244 | ||
241 | void XXPortSelectDialog::initGUI() | 245 | void XXPortSelectDialog::initGUI() |
242 | { | 246 | { |
243 | QFrame *page = plainPage(); | 247 | QFrame *page = plainPage(); |
244 | 248 | ||
245 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), | 249 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), |
246 | KDialog::spacingHintSmall() ); | 250 | KDialog::spacingHintSmall() ); |
247 | 251 | ||
248 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 252 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
249 | topLayout->addWidget( label ); | 253 | topLayout->addWidget( label ); |
250 | 254 | ||
251 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 255 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); |
252 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 256 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
253 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 257 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
254 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 258 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
255 | 259 | ||
256 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 260 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); |
257 | groupLayout->setAlignment( Qt::AlignTop ); | 261 | groupLayout->setAlignment( Qt::AlignTop ); |
258 | 262 | ||
259 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 263 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
260 | mUseWholeBook->setChecked( true ); | 264 | mUseWholeBook->setChecked( true ); |
261 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 265 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
262 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 266 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
263 | 267 | ||
264 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 268 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
265 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 269 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
266 | "This option is disabled if no contacts are selected." ) ); | 270 | "This option is disabled if no contacts are selected." ) ); |
267 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 271 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
268 | 272 | ||
269 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 273 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
270 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 274 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
271 | "This option is disabled if you haven't defined any filters" ) ); | 275 | "This option is disabled if you haven't defined any filters" ) ); |
272 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 276 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
273 | 277 | ||
274 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 278 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
275 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 279 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
276 | "This option is disabled if you have no categories." ) ); | 280 | "This option is disabled if you have no categories." ) ); |
277 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 281 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
278 | 282 | ||
279 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 283 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
280 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 284 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
281 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 285 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
282 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 286 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
283 | 287 | ||
284 | mCategoriesView = new QListView( mButtonGroup ); | 288 | mCategoriesView = new QListView( mButtonGroup ); |
285 | mCategoriesView->addColumn( "" ); | 289 | mCategoriesView->addColumn( "" ); |
286 | mCategoriesView->header()->hide(); | 290 | mCategoriesView->header()->hide(); |
287 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 291 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
288 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 292 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
289 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 293 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
290 | //if (QApplication::desktop()->height() == 480 ) | 294 | //if (QApplication::desktop()->height() == 480 ) |
291 | // mCategoriesView->setMaximumHeight( 240 ); | 295 | // mCategoriesView->setMaximumHeight( 240 ); |
292 | topLayout->addWidget( mButtonGroup ); | 296 | topLayout->addWidget( mButtonGroup ); |
293 | 297 | ||
294 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 298 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); |
295 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 299 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
296 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 300 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, |
297 | KDialog::spacingHint() ); | 301 | KDialog::spacingHint() ); |
298 | sortLayout->setAlignment( Qt::AlignTop ); | 302 | sortLayout->setAlignment( Qt::AlignTop ); |
299 | 303 | ||
300 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 304 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
301 | sortLayout->addWidget( label, 0, 0 ); | 305 | sortLayout->addWidget( label, 0, 0 ); |
302 | 306 | ||
303 | #ifndef KAB_EMBEDDED | 307 | #ifndef KAB_EMBEDDED |
304 | mFieldCombo = new KComboBox( false, sortingGroup ); | 308 | mFieldCombo = new KComboBox( false, sortingGroup ); |
305 | #else //KAB_EMBEDDED | 309 | #else //KAB_EMBEDDED |
306 | //US Combobox is not editable anyway | 310 | //US Combobox is not editable anyway |
307 | mFieldCombo = new KComboBox( sortingGroup ); | 311 | mFieldCombo = new KComboBox( sortingGroup ); |
308 | #endif //KAB_EMBEDDED | 312 | #endif //KAB_EMBEDDED |
309 | sortLayout->addWidget( mFieldCombo, 0, 1 ); | 313 | sortLayout->addWidget( mFieldCombo, 0, 1 ); |
310 | 314 | ||
311 | label = new QLabel( i18n( "Order:" ), sortingGroup ); | 315 | label = new QLabel( i18n( "Order:" ), sortingGroup ); |
312 | sortLayout->addWidget( label, 1, 0 ); | 316 | sortLayout->addWidget( label, 1, 0 ); |
313 | 317 | ||
314 | #ifndef KAB_EMBEDDED | 318 | #ifndef KAB_EMBEDDED |
315 | mSortTypeCombo = new KComboBox( false, sortingGroup ); | 319 | mSortTypeCombo = new KComboBox( false, sortingGroup ); |
316 | #else //KAB_EMBEDDED | 320 | #else //KAB_EMBEDDED |
317 | //US Combobox is not editable anyway | 321 | //US Combobox is not editable anyway |
318 | mSortTypeCombo = new KComboBox( sortingGroup ); | 322 | mSortTypeCombo = new KComboBox( sortingGroup ); |
319 | #endif //KAB_EMBEDDED | 323 | #endif //KAB_EMBEDDED |
320 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); | 324 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); |
321 | 325 | ||
322 | topLayout->addWidget( sortingGroup ); | 326 | topLayout->addWidget( sortingGroup ); |
323 | 327 | ||
324 | if ( !mUseSorting ) | 328 | if ( !mUseSorting ) |
325 | sortingGroup->hide(); | 329 | sortingGroup->hide(); |
326 | if (QApplication::desktop()->width() <= 640 ) { | 330 | if (QApplication::desktop()->width() <= 640 ) { |
327 | showMaximized(); | 331 | showMaximized(); |
328 | #ifndef DESKTOP_VERSION | 332 | #ifndef DESKTOP_VERSION |
329 | hideButtons(); | 333 | hideButtons(); |
330 | #endif | 334 | #endif |
331 | } | 335 | } |
332 | } | 336 | } |
333 | 337 | ||
334 | #ifndef KAB_EMBEDDED | 338 | #ifndef KAB_EMBEDDED |
335 | #include "xxportselectdialog.moc" | 339 | #include "xxportselectdialog.moc" |
336 | #endif //KAB_EMBEDDED | 340 | #endif //KAB_EMBEDDED |
337 | 341 | ||
338 | 342 | ||