author | zautrix <zautrix> | 2004-11-08 22:16:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-08 22:16:36 (UTC) |
commit | d92ceb39af0bf0c655b68cb166dfea44cd688f1c (patch) (unidiff) | |
tree | b79b985969e4b6db6d4b1acacec6a62c8105e559 /kaddressbook | |
parent | 4e06ab7da7f56f579010e93b1b9009ed9fd6a33e (diff) | |
download | kdepimpi-d92ceb39af0bf0c655b68cb166dfea44cd688f1c.zip kdepimpi-d92ceb39af0bf0c655b68cb166dfea44cd688f1c.tar.gz kdepimpi-d92ceb39af0bf0c655b68cb166dfea44cd688f1c.tar.bz2 |
orientation change fix for kapi
-rw-r--r-- | kaddressbook/kabcore.cpp | 27 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 27 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7be5db8..7acf1ee 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,1165 +1,1190 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*s | 24 | /*s |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
43 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qvbox.h> | 53 | #include <qvbox.h> |
54 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 58 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 61 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 65 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
73 | 73 | ||
74 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
82 | 82 | ||
83 | #include <kapplication.h> | 83 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 118 | #include "xxportselectdialog.h" |
119 | 119 | ||
120 | 120 | ||
121 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
123 | 123 | ||
124 | #include <picture.h> | 124 | #include <picture.h> |
125 | #include <resource.h> | 125 | #include <resource.h> |
126 | 126 | ||
127 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 128 | #include <qmap.h> |
129 | #include <qdir.h> | 129 | #include <qdir.h> |
130 | #include <qfile.h> | 130 | #include <qfile.h> |
131 | #include <qvbox.h> | 131 | #include <qvbox.h> |
132 | #include <qlayout.h> | 132 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
137 | 137 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
141 | 141 | ||
142 | 142 | ||
143 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 144 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 151 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 152 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 153 | #include "addresseeconfig.h" |
154 | #include <kcmultidialog.h> | 154 | #include <kcmultidialog.h> |
155 | 155 | ||
156 | #ifdef _WIN32_ | 156 | #ifdef _WIN32_ |
157 | 157 | ||
158 | #include "kaimportoldialog.h" | 158 | #include "kaimportoldialog.h" |
159 | #else | 159 | #else |
160 | #include <unistd.h> | 160 | #include <unistd.h> |
161 | #endif | 161 | #endif |
162 | // sync includes | 162 | // sync includes |
163 | #include <libkdepim/ksyncprofile.h> | 163 | #include <libkdepim/ksyncprofile.h> |
164 | #include <libkdepim/ksyncprefsdialog.h> | 164 | #include <libkdepim/ksyncprefsdialog.h> |
165 | 165 | ||
166 | 166 | ||
167 | class KABCatPrefs : public QDialog | 167 | class KABCatPrefs : public QDialog |
168 | { | 168 | { |
169 | public: | 169 | public: |
170 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 170 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
171 | QDialog( parent, name, true ) | 171 | QDialog( parent, name, true ) |
172 | { | 172 | { |
173 | setCaption( i18n("Manage new Categories") ); | 173 | setCaption( i18n("Manage new Categories") ); |
174 | QVBoxLayout* lay = new QVBoxLayout( this ); | 174 | QVBoxLayout* lay = new QVBoxLayout( this ); |
175 | lay->setSpacing( 3 ); | 175 | lay->setSpacing( 3 ); |
176 | lay->setMargin( 3 ); | 176 | lay->setMargin( 3 ); |
177 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 177 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
178 | lay->addWidget( lab ); | 178 | lay->addWidget( lab ); |
179 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 179 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
180 | lay->addWidget( format ); | 180 | lay->addWidget( format ); |
181 | format->setExclusive ( true ) ; | 181 | format->setExclusive ( true ) ; |
182 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 182 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
183 | new QRadioButton(i18n("Remove from addressees"), format ); | 183 | new QRadioButton(i18n("Remove from addressees"), format ); |
184 | addCatBut->setChecked( true ); | 184 | addCatBut->setChecked( true ); |
185 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 185 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
186 | lay->addWidget( ok ); | 186 | lay->addWidget( ok ); |
187 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 187 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
188 | lay->addWidget( cancel ); | 188 | lay->addWidget( cancel ); |
189 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 189 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
190 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 190 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
191 | resize( 200, 200 ); | 191 | resize( 200, 200 ); |
192 | } | 192 | } |
193 | 193 | ||
194 | bool addCat() { return addCatBut->isChecked(); } | 194 | bool addCat() { return addCatBut->isChecked(); } |
195 | private: | 195 | private: |
196 | QRadioButton* addCatBut; | 196 | QRadioButton* addCatBut; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | 199 | ||
200 | 200 | ||
201 | class KAex2phonePrefs : public QDialog | 201 | class KAex2phonePrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Export to phone options") ); | 207 | setCaption( i18n("Export to phone options") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel *lab; | 211 | QLabel *lab; |
212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
213 | lab->setAlignment (AlignHCenter ); | 213 | lab->setAlignment (AlignHCenter ); |
214 | QHBox* temphb; | 214 | QHBox* temphb; |
215 | temphb = new QHBox( this ); | 215 | temphb = new QHBox( this ); |
216 | new QLabel( i18n("I/O device: "), temphb ); | 216 | new QLabel( i18n("I/O device: "), temphb ); |
217 | mPhoneDevice = new QLineEdit( temphb); | 217 | mPhoneDevice = new QLineEdit( temphb); |
218 | lay->addWidget( temphb ); | 218 | lay->addWidget( temphb ); |
219 | temphb = new QHBox( this ); | 219 | temphb = new QHBox( this ); |
220 | new QLabel( i18n("Connection: "), temphb ); | 220 | new QLabel( i18n("Connection: "), temphb ); |
221 | mPhoneConnection = new QLineEdit( temphb); | 221 | mPhoneConnection = new QLineEdit( temphb); |
222 | lay->addWidget( temphb ); | 222 | lay->addWidget( temphb ); |
223 | temphb = new QHBox( this ); | 223 | temphb = new QHBox( this ); |
224 | new QLabel( i18n("Model(opt.): "), temphb ); | 224 | new QLabel( i18n("Model(opt.): "), temphb ); |
225 | mPhoneModel = new QLineEdit( temphb); | 225 | mPhoneModel = new QLineEdit( temphb); |
226 | lay->addWidget( temphb ); | 226 | lay->addWidget( temphb ); |
227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
228 | // lay->addWidget( mWriteToSim ); | 228 | // lay->addWidget( mWriteToSim ); |
229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
230 | lab->setAlignment (AlignHCenter ); | 230 | lab->setAlignment (AlignHCenter ); |
231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
232 | lay->addWidget( ok ); | 232 | lay->addWidget( ok ); |
233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
234 | lay->addWidget( cancel ); | 234 | lay->addWidget( cancel ); |
235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
237 | resize( 220, 240 ); | 237 | resize( 220, 240 ); |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | public: | 241 | public: |
242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
243 | QCheckBox* mWriteToSim; | 243 | QCheckBox* mWriteToSim; |
244 | }; | 244 | }; |
245 | 245 | ||
246 | 246 | ||
247 | bool pasteWithNewUid = true; | 247 | bool pasteWithNewUid = true; |
248 | 248 | ||
249 | #ifdef KAB_EMBEDDED | 249 | #ifdef KAB_EMBEDDED |
250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
254 | #else //KAB_EMBEDDED | 254 | #else //KAB_EMBEDDED |
255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
258 | mReadWrite( readWrite ), mModified( false ) | 258 | mReadWrite( readWrite ), mModified( false ) |
259 | #endif //KAB_EMBEDDED | 259 | #endif //KAB_EMBEDDED |
260 | { | 260 | { |
261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
262 | // syncManager->setBlockSave(false); | 262 | // syncManager->setBlockSave(false); |
263 | mMiniSplitter = 0; | ||
263 | mExtensionBarSplitter = 0; | 264 | mExtensionBarSplitter = 0; |
264 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 265 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
265 | mAddressBook = KABC::StdAddressBook::self(); | 266 | mAddressBook = KABC::StdAddressBook::self(); |
266 | KABC::StdAddressBook::setAutomaticSave( false ); | 267 | KABC::StdAddressBook::setAutomaticSave( false ); |
267 | 268 | ||
268 | #ifndef KAB_EMBEDDED | 269 | #ifndef KAB_EMBEDDED |
269 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
270 | #endif //KAB_EMBEDDED | 271 | #endif //KAB_EMBEDDED |
271 | 272 | ||
272 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
273 | SLOT( addressBookChanged() ) ); | 274 | SLOT( addressBookChanged() ) ); |
274 | 275 | ||
275 | #if 0 | 276 | #if 0 |
276 | // LP moved to addressbook init method | 277 | // LP moved to addressbook init method |
277 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
278 | "X-Department", "KADDRESSBOOK" ); | 279 | "X-Department", "KADDRESSBOOK" ); |
279 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
280 | "X-Profession", "KADDRESSBOOK" ); | 281 | "X-Profession", "KADDRESSBOOK" ); |
281 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
282 | "X-AssistantsName", "KADDRESSBOOK" ); | 283 | "X-AssistantsName", "KADDRESSBOOK" ); |
283 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
284 | "X-ManagersName", "KADDRESSBOOK" ); | 285 | "X-ManagersName", "KADDRESSBOOK" ); |
285 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
286 | "X-SpousesName", "KADDRESSBOOK" ); | 287 | "X-SpousesName", "KADDRESSBOOK" ); |
287 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
288 | "X-Office", "KADDRESSBOOK" ); | 289 | "X-Office", "KADDRESSBOOK" ); |
289 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
290 | "X-IMAddress", "KADDRESSBOOK" ); | 291 | "X-IMAddress", "KADDRESSBOOK" ); |
291 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
292 | "X-Anniversary", "KADDRESSBOOK" ); | 293 | "X-Anniversary", "KADDRESSBOOK" ); |
293 | 294 | ||
294 | //US added this field to become compatible with Opie/qtopia addressbook | 295 | //US added this field to become compatible with Opie/qtopia addressbook |
295 | // values can be "female" or "male" or "". An empty field represents undefined. | 296 | // values can be "female" or "male" or "". An empty field represents undefined. |
296 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
297 | "X-Gender", "KADDRESSBOOK" ); | 298 | "X-Gender", "KADDRESSBOOK" ); |
298 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
299 | "X-Children", "KADDRESSBOOK" ); | 300 | "X-Children", "KADDRESSBOOK" ); |
300 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
301 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
302 | #endif | 303 | #endif |
303 | initGUI(); | 304 | initGUI(); |
304 | 305 | ||
305 | mIncSearchWidget->setFocus(); | 306 | mIncSearchWidget->setFocus(); |
306 | 307 | ||
307 | 308 | ||
308 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
309 | SLOT( setContactSelected( const QString& ) ) ); | 310 | SLOT( setContactSelected( const QString& ) ) ); |
310 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
311 | SLOT( executeContact( const QString& ) ) ); | 312 | SLOT( executeContact( const QString& ) ) ); |
312 | 313 | ||
313 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
314 | SLOT( deleteContacts( ) ) ); | 315 | SLOT( deleteContacts( ) ) ); |
315 | connect( mViewManager, SIGNAL( modified() ), | 316 | connect( mViewManager, SIGNAL( modified() ), |
316 | SLOT( setModified() ) ); | 317 | SLOT( setModified() ) ); |
317 | 318 | ||
318 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
319 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
320 | 321 | ||
321 | connect( mXXPortManager, SIGNAL( modified() ), | 322 | connect( mXXPortManager, SIGNAL( modified() ), |
322 | SLOT( setModified() ) ); | 323 | SLOT( setModified() ) ); |
323 | 324 | ||
324 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
325 | SLOT( incrementalSearch( const QString& ) ) ); | 326 | SLOT( incrementalSearch( const QString& ) ) ); |
326 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
327 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 328 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
328 | 329 | ||
329 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
330 | SLOT( sendMail( const QString& ) ) ); | 331 | SLOT( sendMail( const QString& ) ) ); |
331 | 332 | ||
332 | 333 | ||
333 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
336 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
337 | 338 | ||
338 | 339 | ||
339 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
340 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
341 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
342 | 343 | ||
343 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 344 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
344 | SLOT( browse( const QString& ) ) ); | 345 | SLOT( browse( const QString& ) ) ); |
345 | 346 | ||
346 | 347 | ||
347 | mAddressBookService = new KAddressBookService( this ); | 348 | mAddressBookService = new KAddressBookService( this ); |
348 | 349 | ||
349 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
350 | 351 | ||
351 | mMessageTimer = new QTimer( this ); | 352 | mMessageTimer = new QTimer( this ); |
352 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
353 | mEditorDialog = 0; | 354 | mEditorDialog = 0; |
354 | createAddresseeEditorDialog( this ); | 355 | createAddresseeEditorDialog( this ); |
355 | setModified( false ); | 356 | setModified( false ); |
356 | mBRdisabled = false; | 357 | mBRdisabled = false; |
357 | #ifndef DESKTOP_VERSION | 358 | #ifndef DESKTOP_VERSION |
358 | infrared = 0; | 359 | infrared = 0; |
359 | #endif | 360 | #endif |
360 | //toggleBeamReceive( ); | 361 | //toggleBeamReceive( ); |
361 | 362 | ||
362 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
363 | QTimer::singleShot( 1, this , SLOT ( updateToolBar())); | 364 | QTimer::singleShot( 1000, this , SLOT ( updateToolBar())); |
364 | } | 365 | } |
365 | 366 | ||
366 | void KABCore::updateToolBar() | 367 | void KABCore::updateToolBar() |
367 | { | 368 | { |
368 | mMainWindow->toolBar()->repaint(); | 369 | mMainWindow->toolBar()->repaint(); |
369 | } | 370 | } |
370 | KABCore::~KABCore() | 371 | KABCore::~KABCore() |
371 | { | 372 | { |
372 | // save(); | 373 | // save(); |
373 | //saveSettings(); | 374 | //saveSettings(); |
374 | //KABPrefs::instance()->writeConfig(); | 375 | //KABPrefs::instance()->writeConfig(); |
375 | delete AddresseeConfig::instance(); | 376 | delete AddresseeConfig::instance(); |
376 | mAddressBook = 0; | 377 | mAddressBook = 0; |
377 | KABC::StdAddressBook::close(); | 378 | KABC::StdAddressBook::close(); |
378 | 379 | ||
379 | delete syncManager; | 380 | delete syncManager; |
380 | #ifndef DESKTOP_VERSION | 381 | #ifndef DESKTOP_VERSION |
381 | if ( infrared ) | 382 | if ( infrared ) |
382 | delete infrared; | 383 | delete infrared; |
383 | #endif | 384 | #endif |
384 | } | 385 | } |
385 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
386 | { | 387 | { |
387 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
388 | if ( cmsg == "setDocument(QString)" ) { | 389 | if ( cmsg == "setDocument(QString)" ) { |
389 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
390 | QString fileName; | 391 | QString fileName; |
391 | stream >> fileName; | 392 | stream >> fileName; |
392 | recieve( fileName ); | 393 | recieve( fileName ); |
393 | return; | 394 | return; |
394 | } | 395 | } |
395 | } | 396 | } |
396 | void KABCore::toggleBeamReceive( ) | 397 | void KABCore::toggleBeamReceive( ) |
397 | { | 398 | { |
398 | if ( mBRdisabled ) | 399 | if ( mBRdisabled ) |
399 | return; | 400 | return; |
400 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
401 | if ( infrared ) { | 402 | if ( infrared ) { |
402 | qDebug("AB disable BeamReceive "); | 403 | qDebug("AB disable BeamReceive "); |
403 | delete infrared; | 404 | delete infrared; |
404 | infrared = 0; | 405 | infrared = 0; |
405 | mActionBR->setChecked(false); | 406 | mActionBR->setChecked(false); |
406 | return; | 407 | return; |
407 | } | 408 | } |
408 | qDebug("AB enable BeamReceive "); | 409 | qDebug("AB enable BeamReceive "); |
409 | mActionBR->setChecked(true); | 410 | mActionBR->setChecked(true); |
410 | 411 | ||
411 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
412 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
413 | #endif | 414 | #endif |
414 | } | 415 | } |
415 | 416 | ||
416 | 417 | ||
417 | void KABCore::disableBR(bool b) | 418 | void KABCore::disableBR(bool b) |
418 | { | 419 | { |
419 | #ifndef DESKTOP_VERSION | 420 | #ifndef DESKTOP_VERSION |
420 | if ( b ) { | 421 | if ( b ) { |
421 | if ( infrared ) { | 422 | if ( infrared ) { |
422 | toggleBeamReceive( ); | 423 | toggleBeamReceive( ); |
423 | } | 424 | } |
424 | mBRdisabled = true; | 425 | mBRdisabled = true; |
425 | } else { | 426 | } else { |
426 | if ( mBRdisabled ) { | 427 | if ( mBRdisabled ) { |
427 | mBRdisabled = false; | 428 | mBRdisabled = false; |
428 | //toggleBeamReceive( ); | 429 | //toggleBeamReceive( ); |
429 | } | 430 | } |
430 | } | 431 | } |
431 | #endif | 432 | #endif |
432 | 433 | ||
433 | } | 434 | } |
434 | void KABCore::recieve( QString fn ) | 435 | void KABCore::recieve( QString fn ) |
435 | { | 436 | { |
436 | //qDebug("KABCore::recieve "); | 437 | //qDebug("KABCore::recieve "); |
437 | int count = mAddressBook->importFromFile( fn, true ); | 438 | int count = mAddressBook->importFromFile( fn, true ); |
438 | if ( count ) | 439 | if ( count ) |
439 | setModified( true ); | 440 | setModified( true ); |
440 | mViewManager->refreshView(); | 441 | mViewManager->refreshView(); |
441 | message(i18n("%1 contact(s) received!").arg( count )); | 442 | message(i18n("%1 contact(s) received!").arg( count )); |
442 | topLevelWidget()->showMaximized(); | 443 | topLevelWidget()->showMaximized(); |
443 | topLevelWidget()->raise(); | 444 | topLevelWidget()->raise(); |
444 | } | 445 | } |
445 | void KABCore::restoreSettings() | 446 | void KABCore::restoreSettings() |
446 | { | 447 | { |
447 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
448 | 449 | ||
449 | bool state; | 450 | bool state; |
450 | 451 | ||
451 | if (mMultipleViewsAtOnce) | 452 | if (mMultipleViewsAtOnce) |
452 | state = KABPrefs::instance()->mDetailsPageVisible; | 453 | state = KABPrefs::instance()->mDetailsPageVisible; |
453 | else | 454 | else |
454 | state = false; | 455 | state = false; |
455 | 456 | ||
456 | mActionDetails->setChecked( state ); | 457 | mActionDetails->setChecked( state ); |
457 | setDetailsVisible( state ); | 458 | setDetailsVisible( state ); |
458 | 459 | ||
459 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 460 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
460 | 461 | ||
461 | mActionJumpBar->setChecked( state ); | 462 | mActionJumpBar->setChecked( state ); |
462 | setJumpButtonBarVisible( state ); | 463 | setJumpButtonBarVisible( state ); |
463 | /*US | 464 | /*US |
464 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
465 | if ( splitterSize.count() == 0 ) { | 466 | if ( splitterSize.count() == 0 ) { |
466 | splitterSize.append( width() / 2 ); | 467 | splitterSize.append( width() / 2 ); |
467 | splitterSize.append( width() / 2 ); | 468 | splitterSize.append( width() / 2 ); |
468 | } | 469 | } |
469 | mMiniSplitter->setSizes( splitterSize ); | 470 | mMiniSplitter->setSizes( splitterSize ); |
470 | if ( mExtensionBarSplitter ) { | 471 | if ( mExtensionBarSplitter ) { |
471 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
472 | if ( splitterSize.count() == 0 ) { | 473 | if ( splitterSize.count() == 0 ) { |
473 | splitterSize.append( width() / 2 ); | 474 | splitterSize.append( width() / 2 ); |
474 | splitterSize.append( width() / 2 ); | 475 | splitterSize.append( width() / 2 ); |
475 | } | 476 | } |
476 | mExtensionBarSplitter->setSizes( splitterSize ); | 477 | mExtensionBarSplitter->setSizes( splitterSize ); |
477 | 478 | ||
478 | } | 479 | } |
479 | */ | 480 | */ |
480 | mViewManager->restoreSettings(); | 481 | mViewManager->restoreSettings(); |
481 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
482 | mExtensionManager->restoreSettings(); | 483 | mExtensionManager->restoreSettings(); |
483 | #ifdef DESKTOP_VERSION | 484 | #ifdef DESKTOP_VERSION |
484 | int wid = width(); | 485 | int wid = width(); |
485 | if ( wid < 10 ) | 486 | if ( wid < 10 ) |
486 | wid = 400; | 487 | wid = 400; |
487 | #else | 488 | #else |
488 | int wid = QApplication::desktop()->width(); | 489 | int wid = QApplication::desktop()->width(); |
489 | if ( wid < 640 ) | 490 | if ( wid < 640 ) |
490 | wid = QApplication::desktop()->height(); | 491 | wid = QApplication::desktop()->height(); |
491 | #endif | 492 | #endif |
492 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
493 | if ( true /*splitterSize.count() == 0*/ ) { | 494 | if ( true /*splitterSize.count() == 0*/ ) { |
494 | splitterSize.append( wid / 2 ); | 495 | splitterSize.append( wid / 2 ); |
495 | splitterSize.append( wid / 2 ); | 496 | splitterSize.append( wid / 2 ); |
496 | } | 497 | } |
497 | mMiniSplitter->setSizes( splitterSize ); | 498 | mMiniSplitter->setSizes( splitterSize ); |
498 | if ( mExtensionBarSplitter ) { | 499 | if ( mExtensionBarSplitter ) { |
499 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 500 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
500 | if ( true /*splitterSize.count() == 0*/ ) { | 501 | if ( true /*splitterSize.count() == 0*/ ) { |
501 | splitterSize.append( wid / 2 ); | 502 | splitterSize.append( wid / 2 ); |
502 | splitterSize.append( wid / 2 ); | 503 | splitterSize.append( wid / 2 ); |
503 | } | 504 | } |
504 | mExtensionBarSplitter->setSizes( splitterSize ); | 505 | mExtensionBarSplitter->setSizes( splitterSize ); |
505 | 506 | ||
506 | } | 507 | } |
507 | 508 | ||
508 | 509 | ||
509 | } | 510 | } |
510 | 511 | ||
511 | void KABCore::saveSettings() | 512 | void KABCore::saveSettings() |
512 | { | 513 | { |
513 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 514 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
514 | if ( mExtensionBarSplitter ) | 515 | if ( mExtensionBarSplitter ) |
515 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 516 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
516 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 517 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
517 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 518 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
518 | #ifndef KAB_EMBEDDED | 519 | #ifndef KAB_EMBEDDED |
519 | 520 | ||
520 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 521 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
521 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 522 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
522 | #endif //KAB_EMBEDDED | 523 | #endif //KAB_EMBEDDED |
523 | mExtensionManager->saveSettings(); | 524 | mExtensionManager->saveSettings(); |
524 | mViewManager->saveSettings(); | 525 | mViewManager->saveSettings(); |
525 | 526 | ||
526 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 527 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
527 | } | 528 | } |
528 | 529 | ||
529 | KABC::AddressBook *KABCore::addressBook() const | 530 | KABC::AddressBook *KABCore::addressBook() const |
530 | { | 531 | { |
531 | return mAddressBook; | 532 | return mAddressBook; |
532 | } | 533 | } |
533 | 534 | ||
534 | KConfig *KABCore::config() | 535 | KConfig *KABCore::config() |
535 | { | 536 | { |
536 | #ifndef KAB_EMBEDDED | 537 | #ifndef KAB_EMBEDDED |
537 | return KABPrefs::instance()->config(); | 538 | return KABPrefs::instance()->config(); |
538 | #else //KAB_EMBEDDED | 539 | #else //KAB_EMBEDDED |
539 | return KABPrefs::instance()->getConfig(); | 540 | return KABPrefs::instance()->getConfig(); |
540 | #endif //KAB_EMBEDDED | 541 | #endif //KAB_EMBEDDED |
541 | } | 542 | } |
542 | 543 | ||
543 | KActionCollection *KABCore::actionCollection() const | 544 | KActionCollection *KABCore::actionCollection() const |
544 | { | 545 | { |
545 | return mGUIClient->actionCollection(); | 546 | return mGUIClient->actionCollection(); |
546 | } | 547 | } |
547 | 548 | ||
548 | KABC::Field *KABCore::currentSearchField() const | 549 | KABC::Field *KABCore::currentSearchField() const |
549 | { | 550 | { |
550 | if (mIncSearchWidget) | 551 | if (mIncSearchWidget) |
551 | return mIncSearchWidget->currentField(); | 552 | return mIncSearchWidget->currentField(); |
552 | else | 553 | else |
553 | return 0; | 554 | return 0; |
554 | } | 555 | } |
555 | 556 | ||
556 | QStringList KABCore::selectedUIDs() const | 557 | QStringList KABCore::selectedUIDs() const |
557 | { | 558 | { |
558 | return mViewManager->selectedUids(); | 559 | return mViewManager->selectedUids(); |
559 | } | 560 | } |
560 | 561 | ||
561 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 562 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
562 | { | 563 | { |
563 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 564 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
564 | 565 | ||
565 | QPtrList<KRES::Resource> kresResources; | 566 | QPtrList<KRES::Resource> kresResources; |
566 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 567 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
567 | KABC::Resource *resource; | 568 | KABC::Resource *resource; |
568 | while ( ( resource = resIt.current() ) != 0 ) { | 569 | while ( ( resource = resIt.current() ) != 0 ) { |
569 | ++resIt; | 570 | ++resIt; |
570 | if ( !resource->readOnly() ) { | 571 | if ( !resource->readOnly() ) { |
571 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 572 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
572 | if ( res ) | 573 | if ( res ) |
573 | kresResources.append( res ); | 574 | kresResources.append( res ); |
574 | } | 575 | } |
575 | } | 576 | } |
576 | 577 | ||
577 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 578 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
578 | return static_cast<KABC::Resource*>( res ); | 579 | return static_cast<KABC::Resource*>( res ); |
579 | } | 580 | } |
580 | 581 | ||
581 | #ifndef KAB_EMBEDDED | 582 | #ifndef KAB_EMBEDDED |
582 | KAboutData *KABCore::createAboutData() | 583 | KAboutData *KABCore::createAboutData() |
583 | #else //KAB_EMBEDDED | 584 | #else //KAB_EMBEDDED |
584 | void KABCore::createAboutData() | 585 | void KABCore::createAboutData() |
585 | #endif //KAB_EMBEDDED | 586 | #endif //KAB_EMBEDDED |
586 | { | 587 | { |
587 | #ifndef KAB_EMBEDDED | 588 | #ifndef KAB_EMBEDDED |
588 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 589 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
589 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 590 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
590 | KAboutData::License_GPL_V2, | 591 | KAboutData::License_GPL_V2, |
591 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 592 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
592 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 593 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
593 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 594 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
594 | about->addAuthor( "Cornelius Schumacher", | 595 | about->addAuthor( "Cornelius Schumacher", |
595 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 596 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
596 | "schumacher@kde.org" ); | 597 | "schumacher@kde.org" ); |
597 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 598 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
598 | "mpilone@slac.com" ); | 599 | "mpilone@slac.com" ); |
599 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 600 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
600 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 601 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
601 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 602 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
602 | "michel@klaralvdalens-datakonsult.se" ); | 603 | "michel@klaralvdalens-datakonsult.se" ); |
603 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 604 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
604 | "hansen@kde.org" ); | 605 | "hansen@kde.org" ); |
605 | 606 | ||
606 | return about; | 607 | return about; |
607 | #endif //KAB_EMBEDDED | 608 | #endif //KAB_EMBEDDED |
608 | 609 | ||
609 | QString version; | 610 | QString version; |
610 | #include <../version> | 611 | #include <../version> |
611 | QMessageBox::about( this, "About KAddressbook/Pi", | 612 | QMessageBox::about( this, "About KAddressbook/Pi", |
612 | "KAddressbook/Platform-independent\n" | 613 | "KAddressbook/Platform-independent\n" |
613 | "(KA/Pi) " +version + " - " + | 614 | "(KA/Pi) " +version + " - " + |
614 | #ifdef DESKTOP_VERSION | 615 | #ifdef DESKTOP_VERSION |
615 | "Desktop Edition\n" | 616 | "Desktop Edition\n" |
616 | #else | 617 | #else |
617 | "PDA-Edition\n" | 618 | "PDA-Edition\n" |
618 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 619 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
619 | #endif | 620 | #endif |
620 | 621 | ||
621 | "(c) 2004 Ulf Schenk\n" | 622 | "(c) 2004 Ulf Schenk\n" |
622 | "(c) 2004 Lutz Rogowski\n" | 623 | "(c) 2004 Lutz Rogowski\n" |
623 | "(c) 1997-2003, The KDE PIM Team\n" | 624 | "(c) 1997-2003, The KDE PIM Team\n" |
624 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 625 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
625 | "Don Sanders Original author\n" | 626 | "Don Sanders Original author\n" |
626 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 627 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
627 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 628 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
628 | "Greg Stern DCOP interface\n" | 629 | "Greg Stern DCOP interface\n" |
629 | "Mark Westcot Contact pinning\n" | 630 | "Mark Westcot Contact pinning\n" |
630 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 631 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
631 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 632 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
632 | #ifdef _WIN32_ | 633 | #ifdef _WIN32_ |
633 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 634 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
634 | #endif | 635 | #endif |
635 | ); | 636 | ); |
636 | } | 637 | } |
637 | 638 | ||
638 | void KABCore::setContactSelected( const QString &uid ) | 639 | void KABCore::setContactSelected( const QString &uid ) |
639 | { | 640 | { |
640 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 641 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
641 | if ( !mDetails->isHidden() ) | 642 | if ( !mDetails->isHidden() ) |
642 | mDetails->setAddressee( addr ); | 643 | mDetails->setAddressee( addr ); |
643 | 644 | ||
644 | if ( !addr.isEmpty() ) { | 645 | if ( !addr.isEmpty() ) { |
645 | emit contactSelected( addr.formattedName() ); | 646 | emit contactSelected( addr.formattedName() ); |
646 | KABC::Picture pic = addr.photo(); | 647 | KABC::Picture pic = addr.photo(); |
647 | if ( pic.isIntern() ) { | 648 | if ( pic.isIntern() ) { |
648 | //US emit contactSelected( pic.data() ); | 649 | //US emit contactSelected( pic.data() ); |
649 | //US instead use: | 650 | //US instead use: |
650 | QPixmap px; | 651 | QPixmap px; |
651 | if (pic.data().isNull() != true) | 652 | if (pic.data().isNull() != true) |
652 | { | 653 | { |
653 | px.convertFromImage(pic.data()); | 654 | px.convertFromImage(pic.data()); |
654 | } | 655 | } |
655 | 656 | ||
656 | emit contactSelected( px ); | 657 | emit contactSelected( px ); |
657 | } | 658 | } |
658 | } | 659 | } |
659 | 660 | ||
660 | 661 | ||
661 | mExtensionManager->setSelectionChanged(); | 662 | mExtensionManager->setSelectionChanged(); |
662 | 663 | ||
663 | // update the actions | 664 | // update the actions |
664 | bool selected = !uid.isEmpty(); | 665 | bool selected = !uid.isEmpty(); |
665 | 666 | ||
666 | if ( mReadWrite ) { | 667 | if ( mReadWrite ) { |
667 | mActionCut->setEnabled( selected ); | 668 | mActionCut->setEnabled( selected ); |
668 | mActionPaste->setEnabled( selected ); | 669 | mActionPaste->setEnabled( selected ); |
669 | } | 670 | } |
670 | 671 | ||
671 | mActionCopy->setEnabled( selected ); | 672 | mActionCopy->setEnabled( selected ); |
672 | mActionDelete->setEnabled( selected ); | 673 | mActionDelete->setEnabled( selected ); |
673 | mActionEditAddressee->setEnabled( selected ); | 674 | mActionEditAddressee->setEnabled( selected ); |
674 | mActionMail->setEnabled( selected ); | 675 | mActionMail->setEnabled( selected ); |
675 | mActionMailVCard->setEnabled( selected ); | 676 | mActionMailVCard->setEnabled( selected ); |
676 | //if (mActionBeam) | 677 | //if (mActionBeam) |
677 | //mActionBeam->setEnabled( selected ); | 678 | //mActionBeam->setEnabled( selected ); |
678 | 679 | ||
679 | if (mActionBeamVCard) | 680 | if (mActionBeamVCard) |
680 | mActionBeamVCard->setEnabled( selected ); | 681 | mActionBeamVCard->setEnabled( selected ); |
681 | 682 | ||
682 | mActionWhoAmI->setEnabled( selected ); | 683 | mActionWhoAmI->setEnabled( selected ); |
683 | } | 684 | } |
684 | 685 | ||
685 | void KABCore::sendMail() | 686 | void KABCore::sendMail() |
686 | { | 687 | { |
687 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
688 | } | 689 | } |
689 | 690 | ||
690 | void KABCore::sendMail( const QString& emaillist ) | 691 | void KABCore::sendMail( const QString& emaillist ) |
691 | { | 692 | { |
692 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
693 | if (emaillist.contains(",") > 0) | 694 | if (emaillist.contains(",") > 0) |
694 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
695 | else | 696 | else |
696 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
697 | } | 698 | } |
698 | 699 | ||
699 | 700 | ||
700 | 701 | ||
701 | void KABCore::mailVCard() | 702 | void KABCore::mailVCard() |
702 | { | 703 | { |
703 | QStringList uids = mViewManager->selectedUids(); | 704 | QStringList uids = mViewManager->selectedUids(); |
704 | if ( !uids.isEmpty() ) | 705 | if ( !uids.isEmpty() ) |
705 | mailVCard( uids ); | 706 | mailVCard( uids ); |
706 | } | 707 | } |
707 | 708 | ||
708 | void KABCore::mailVCard( const QStringList& uids ) | 709 | void KABCore::mailVCard( const QStringList& uids ) |
709 | { | 710 | { |
710 | QStringList urls; | 711 | QStringList urls; |
711 | 712 | ||
712 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
713 | 714 | ||
714 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
715 | 716 | ||
716 | 717 | ||
717 | 718 | ||
718 | QDir().mkdir( dirName, true ); | 719 | QDir().mkdir( dirName, true ); |
719 | 720 | ||
720 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
721 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 722 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
722 | 723 | ||
723 | if ( a.isEmpty() ) | 724 | if ( a.isEmpty() ) |
724 | continue; | 725 | continue; |
725 | 726 | ||
726 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
727 | 728 | ||
728 | QString fileName = dirName + "/" + name; | 729 | QString fileName = dirName + "/" + name; |
729 | 730 | ||
730 | QFile outFile(fileName); | 731 | QFile outFile(fileName); |
731 | 732 | ||
732 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
733 | KABC::VCardConverter converter; | 734 | KABC::VCardConverter converter; |
734 | QString vcard; | 735 | QString vcard; |
735 | 736 | ||
736 | converter.addresseeToVCard( a, vcard ); | 737 | converter.addresseeToVCard( a, vcard ); |
737 | 738 | ||
738 | QTextStream t( &outFile ); // use a text stream | 739 | QTextStream t( &outFile ); // use a text stream |
739 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 740 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
740 | t << vcard; | 741 | t << vcard; |
741 | 742 | ||
742 | outFile.close(); | 743 | outFile.close(); |
743 | 744 | ||
744 | urls.append( fileName ); | 745 | urls.append( fileName ); |
745 | } | 746 | } |
746 | } | 747 | } |
747 | 748 | ||
748 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
749 | 750 | ||
750 | 751 | ||
751 | /*US | 752 | /*US |
752 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 753 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
753 | QString::null, // subject | 754 | QString::null, // subject |
754 | QString::null, // body | 755 | QString::null, // body |
755 | QString::null, | 756 | QString::null, |
756 | urls ); // attachments | 757 | urls ); // attachments |
757 | */ | 758 | */ |
758 | 759 | ||
759 | } | 760 | } |
760 | 761 | ||
761 | /** | 762 | /** |
762 | Beams the "WhoAmI contact. | 763 | Beams the "WhoAmI contact. |
763 | */ | 764 | */ |
764 | void KABCore::beamMySelf() | 765 | void KABCore::beamMySelf() |
765 | { | 766 | { |
766 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
767 | if (!a.isEmpty()) | 768 | if (!a.isEmpty()) |
768 | { | 769 | { |
769 | QStringList uids; | 770 | QStringList uids; |
770 | uids << a.uid(); | 771 | uids << a.uid(); |
771 | 772 | ||
772 | beamVCard(uids); | 773 | beamVCard(uids); |
773 | } else { | 774 | } else { |
774 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
775 | 776 | ||
776 | 777 | ||
777 | } | 778 | } |
778 | } | 779 | } |
780 | void KABCore::resizeEvent(QResizeEvent* e ) | ||
781 | { | ||
782 | if ( !mMiniSplitter ) | ||
783 | return; | ||
784 | if ( QApplication::desktop()->width() >= 480 ) { | ||
785 | int fac = QApplication::desktop()->width()/QApplication::desktop()->height(); | ||
786 | if ( fac > 0 ) { // e.g. 640x480 | ||
787 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | ||
788 | mMiniSplitter->setOrientation( Qt::Horizontal); | ||
789 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
790 | if ( QApplication::desktop()->width() <= 640 ) | ||
791 | topLevelWidget()->showMaximized(); | ||
792 | } | ||
793 | } else {// e.g. 480x640 | ||
794 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | ||
795 | mMiniSplitter->setOrientation( Qt::Vertical ); | ||
796 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | ||
797 | if ( QApplication::desktop()->width() <= 640 ) | ||
798 | topLevelWidget()->showMaximized(); | ||
799 | } | ||
800 | } | ||
801 | } | ||
779 | 802 | ||
803 | } | ||
780 | void KABCore::export2phone() | 804 | void KABCore::export2phone() |
781 | { | 805 | { |
806 | |||
782 | QStringList uids; | 807 | QStringList uids; |
783 | XXPortSelectDialog dlg( this, false, this ); | 808 | XXPortSelectDialog dlg( this, false, this ); |
784 | if ( dlg.exec() ) | 809 | if ( dlg.exec() ) |
785 | uids = dlg.uids(); | 810 | uids = dlg.uids(); |
786 | else | 811 | else |
787 | return; | 812 | return; |
788 | if ( uids.isEmpty() ) | 813 | if ( uids.isEmpty() ) |
789 | return; | 814 | return; |
790 | // qDebug("count %d ", uids.count()); | 815 | // qDebug("count %d ", uids.count()); |
791 | 816 | ||
792 | KAex2phonePrefs ex2phone; | 817 | KAex2phonePrefs ex2phone; |
793 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 818 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
794 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 819 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
795 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 820 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
796 | 821 | ||
797 | if ( !ex2phone.exec() ) { | 822 | if ( !ex2phone.exec() ) { |
798 | return; | 823 | return; |
799 | } | 824 | } |
800 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 825 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
801 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 826 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
802 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 827 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
803 | 828 | ||
804 | 829 | ||
805 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 830 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
806 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 831 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
807 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 832 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
808 | 833 | ||
809 | QString fileName = getPhoneFile(); | 834 | QString fileName = getPhoneFile(); |
810 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 835 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
811 | return; | 836 | return; |
812 | 837 | ||
813 | message(i18n("Exporting to phone...")); | 838 | message(i18n("Exporting to phone...")); |
814 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 839 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
815 | 840 | ||
816 | } | 841 | } |
817 | QString KABCore::getPhoneFile() | 842 | QString KABCore::getPhoneFile() |
818 | { | 843 | { |
819 | #ifdef DESKTOP_VERSION | 844 | #ifdef DESKTOP_VERSION |
820 | return locateLocal("tmp", "phonefile.vcf"); | 845 | return locateLocal("tmp", "phonefile.vcf"); |
821 | #else | 846 | #else |
822 | return "/tmp/phonefile.vcf"; | 847 | return "/tmp/phonefile.vcf"; |
823 | #endif | 848 | #endif |
824 | 849 | ||
825 | } | 850 | } |
826 | void KABCore::writeToPhone( ) | 851 | void KABCore::writeToPhone( ) |
827 | { | 852 | { |
828 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 853 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
829 | message(i18n("Export to phone finished!")); | 854 | message(i18n("Export to phone finished!")); |
830 | else | 855 | else |
831 | qDebug(i18n("Error exporting to phone")); | 856 | qDebug(i18n("Error exporting to phone")); |
832 | } | 857 | } |
833 | void KABCore::beamVCard() | 858 | void KABCore::beamVCard() |
834 | { | 859 | { |
835 | QStringList uids = mViewManager->selectedUids(); | 860 | QStringList uids = mViewManager->selectedUids(); |
836 | if ( !uids.isEmpty() ) | 861 | if ( !uids.isEmpty() ) |
837 | beamVCard( uids ); | 862 | beamVCard( uids ); |
838 | } | 863 | } |
839 | 864 | ||
840 | 865 | ||
841 | void KABCore::beamVCard(const QStringList& uids) | 866 | void KABCore::beamVCard(const QStringList& uids) |
842 | { | 867 | { |
843 | 868 | ||
844 | // LR: we should use the /tmp dir on the Zaurus, | 869 | // LR: we should use the /tmp dir on the Zaurus, |
845 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 870 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
846 | 871 | ||
847 | #ifdef DESKTOP_VERSION | 872 | #ifdef DESKTOP_VERSION |
848 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 873 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
849 | #else | 874 | #else |
850 | QString fileName = "/tmp/kapibeamfile.vcf"; | 875 | QString fileName = "/tmp/kapibeamfile.vcf"; |
851 | #endif | 876 | #endif |
852 | 877 | ||
853 | KABC::VCardConverter converter; | 878 | KABC::VCardConverter converter; |
854 | QString description; | 879 | QString description; |
855 | QString datastream; | 880 | QString datastream; |
856 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 881 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
857 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 882 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
858 | 883 | ||
859 | if ( a.isEmpty() ) | 884 | if ( a.isEmpty() ) |
860 | continue; | 885 | continue; |
861 | 886 | ||
862 | if (description.isEmpty()) | 887 | if (description.isEmpty()) |
863 | description = a.formattedName(); | 888 | description = a.formattedName(); |
864 | 889 | ||
865 | QString vcard; | 890 | QString vcard; |
866 | converter.addresseeToVCard( a, vcard ); | 891 | converter.addresseeToVCard( a, vcard ); |
867 | int start = 0; | 892 | int start = 0; |
868 | int next; | 893 | int next; |
869 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 894 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
870 | int semi = vcard.find(";", next); | 895 | int semi = vcard.find(";", next); |
871 | int dopp = vcard.find(":", next); | 896 | int dopp = vcard.find(":", next); |
872 | int sep; | 897 | int sep; |
873 | if ( semi < dopp && semi >= 0 ) | 898 | if ( semi < dopp && semi >= 0 ) |
874 | sep = semi ; | 899 | sep = semi ; |
875 | else | 900 | else |
876 | sep = dopp; | 901 | sep = dopp; |
877 | datastream +=vcard.mid( start, next - start); | 902 | datastream +=vcard.mid( start, next - start); |
878 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 903 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
879 | start = sep; | 904 | start = sep; |
880 | } | 905 | } |
881 | datastream += vcard.mid( start,vcard.length() ); | 906 | datastream += vcard.mid( start,vcard.length() ); |
882 | } | 907 | } |
883 | #ifndef DESKTOP_VERSION | 908 | #ifndef DESKTOP_VERSION |
884 | QFile outFile(fileName); | 909 | QFile outFile(fileName); |
885 | if ( outFile.open(IO_WriteOnly) ) { | 910 | if ( outFile.open(IO_WriteOnly) ) { |
886 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 911 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
887 | QTextStream t( &outFile ); // use a text stream | 912 | QTextStream t( &outFile ); // use a text stream |
888 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 913 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
889 | t.setEncoding( QTextStream::Latin1 ); | 914 | t.setEncoding( QTextStream::Latin1 ); |
890 | t <<datastream.latin1(); | 915 | t <<datastream.latin1(); |
891 | outFile.close(); | 916 | outFile.close(); |
892 | Ir *ir = new Ir( this ); | 917 | Ir *ir = new Ir( this ); |
893 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 918 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
894 | ir->send( fileName, description, "text/x-vCard" ); | 919 | ir->send( fileName, description, "text/x-vCard" ); |
895 | } else { | 920 | } else { |
896 | qDebug("Error open temp beam file "); | 921 | qDebug("Error open temp beam file "); |
897 | return; | 922 | return; |
898 | } | 923 | } |
899 | #endif | 924 | #endif |
900 | 925 | ||
901 | } | 926 | } |
902 | 927 | ||
903 | void KABCore::beamDone( Ir *ir ) | 928 | void KABCore::beamDone( Ir *ir ) |
904 | { | 929 | { |
905 | #ifndef DESKTOP_VERSION | 930 | #ifndef DESKTOP_VERSION |
906 | delete ir; | 931 | delete ir; |
907 | #endif | 932 | #endif |
908 | topLevelWidget()->raise(); | 933 | topLevelWidget()->raise(); |
909 | message( i18n("Beaming finished!") ); | 934 | message( i18n("Beaming finished!") ); |
910 | } | 935 | } |
911 | 936 | ||
912 | 937 | ||
913 | void KABCore::browse( const QString& url ) | 938 | void KABCore::browse( const QString& url ) |
914 | { | 939 | { |
915 | #ifndef KAB_EMBEDDED | 940 | #ifndef KAB_EMBEDDED |
916 | kapp->invokeBrowser( url ); | 941 | kapp->invokeBrowser( url ); |
917 | #else //KAB_EMBEDDED | 942 | #else //KAB_EMBEDDED |
918 | qDebug("KABCore::browse must be fixed"); | 943 | qDebug("KABCore::browse must be fixed"); |
919 | #endif //KAB_EMBEDDED | 944 | #endif //KAB_EMBEDDED |
920 | } | 945 | } |
921 | 946 | ||
922 | void KABCore::selectAllContacts() | 947 | void KABCore::selectAllContacts() |
923 | { | 948 | { |
924 | mViewManager->setSelected( QString::null, true ); | 949 | mViewManager->setSelected( QString::null, true ); |
925 | } | 950 | } |
926 | 951 | ||
927 | void KABCore::deleteContacts() | 952 | void KABCore::deleteContacts() |
928 | { | 953 | { |
929 | QStringList uidList = mViewManager->selectedUids(); | 954 | QStringList uidList = mViewManager->selectedUids(); |
930 | deleteContacts( uidList ); | 955 | deleteContacts( uidList ); |
931 | } | 956 | } |
932 | 957 | ||
933 | void KABCore::deleteContacts( const QStringList &uids ) | 958 | void KABCore::deleteContacts( const QStringList &uids ) |
934 | { | 959 | { |
935 | if ( uids.count() > 0 ) { | 960 | if ( uids.count() > 0 ) { |
936 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 961 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
937 | UndoStack::instance()->push( command ); | 962 | UndoStack::instance()->push( command ); |
938 | RedoStack::instance()->clear(); | 963 | RedoStack::instance()->clear(); |
939 | 964 | ||
940 | // now if we deleted anything, refresh | 965 | // now if we deleted anything, refresh |
941 | setContactSelected( QString::null ); | 966 | setContactSelected( QString::null ); |
942 | setModified( true ); | 967 | setModified( true ); |
943 | } | 968 | } |
944 | } | 969 | } |
945 | 970 | ||
946 | void KABCore::copyContacts() | 971 | void KABCore::copyContacts() |
947 | { | 972 | { |
948 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 973 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
949 | 974 | ||
950 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 975 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
951 | 976 | ||
952 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 977 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
953 | 978 | ||
954 | QClipboard *cb = QApplication::clipboard(); | 979 | QClipboard *cb = QApplication::clipboard(); |
955 | cb->setText( clipText ); | 980 | cb->setText( clipText ); |
956 | } | 981 | } |
957 | 982 | ||
958 | void KABCore::cutContacts() | 983 | void KABCore::cutContacts() |
959 | { | 984 | { |
960 | QStringList uidList = mViewManager->selectedUids(); | 985 | QStringList uidList = mViewManager->selectedUids(); |
961 | 986 | ||
962 | //US if ( uidList.size() > 0 ) { | 987 | //US if ( uidList.size() > 0 ) { |
963 | if ( uidList.count() > 0 ) { | 988 | if ( uidList.count() > 0 ) { |
964 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 989 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
965 | UndoStack::instance()->push( command ); | 990 | UndoStack::instance()->push( command ); |
966 | RedoStack::instance()->clear(); | 991 | RedoStack::instance()->clear(); |
967 | 992 | ||
968 | setModified( true ); | 993 | setModified( true ); |
969 | } | 994 | } |
970 | } | 995 | } |
971 | 996 | ||
972 | void KABCore::pasteContacts() | 997 | void KABCore::pasteContacts() |
973 | { | 998 | { |
974 | QClipboard *cb = QApplication::clipboard(); | 999 | QClipboard *cb = QApplication::clipboard(); |
975 | 1000 | ||
976 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1001 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
977 | 1002 | ||
978 | pasteContacts( list ); | 1003 | pasteContacts( list ); |
979 | } | 1004 | } |
980 | 1005 | ||
981 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1006 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
982 | { | 1007 | { |
983 | KABC::Resource *resource = requestResource( this ); | 1008 | KABC::Resource *resource = requestResource( this ); |
984 | KABC::Addressee::List::Iterator it; | 1009 | KABC::Addressee::List::Iterator it; |
985 | for ( it = list.begin(); it != list.end(); ++it ) | 1010 | for ( it = list.begin(); it != list.end(); ++it ) |
986 | (*it).setResource( resource ); | 1011 | (*it).setResource( resource ); |
987 | 1012 | ||
988 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1013 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
989 | UndoStack::instance()->push( command ); | 1014 | UndoStack::instance()->push( command ); |
990 | RedoStack::instance()->clear(); | 1015 | RedoStack::instance()->clear(); |
991 | 1016 | ||
992 | setModified( true ); | 1017 | setModified( true ); |
993 | } | 1018 | } |
994 | 1019 | ||
995 | void KABCore::setWhoAmI() | 1020 | void KABCore::setWhoAmI() |
996 | { | 1021 | { |
997 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1022 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
998 | 1023 | ||
999 | if ( addrList.count() > 1 ) { | 1024 | if ( addrList.count() > 1 ) { |
1000 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1025 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1001 | return; | 1026 | return; |
1002 | } | 1027 | } |
1003 | 1028 | ||
1004 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1029 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1005 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1030 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1006 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1031 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1007 | } | 1032 | } |
1008 | void KABCore::editCategories() | 1033 | void KABCore::editCategories() |
1009 | { | 1034 | { |
1010 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1035 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1011 | dlg.exec(); | 1036 | dlg.exec(); |
1012 | } | 1037 | } |
1013 | void KABCore::setCategories() | 1038 | void KABCore::setCategories() |
1014 | { | 1039 | { |
1015 | 1040 | ||
1016 | QStringList uids; | 1041 | QStringList uids; |
1017 | XXPortSelectDialog dlgx( this, false, this ); | 1042 | XXPortSelectDialog dlgx( this, false, this ); |
1018 | if ( dlgx.exec() ) | 1043 | if ( dlgx.exec() ) |
1019 | uids = dlgx.uids(); | 1044 | uids = dlgx.uids(); |
1020 | else | 1045 | else |
1021 | return; | 1046 | return; |
1022 | if ( uids.isEmpty() ) | 1047 | if ( uids.isEmpty() ) |
1023 | return; | 1048 | return; |
1024 | // qDebug("count %d ", uids.count()); | 1049 | // qDebug("count %d ", uids.count()); |
1025 | 1050 | ||
1026 | 1051 | ||
1027 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1052 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1028 | if ( !dlg.exec() ) { | 1053 | if ( !dlg.exec() ) { |
1029 | message( i18n("Setting categories cancelled") ); | 1054 | message( i18n("Setting categories cancelled") ); |
1030 | return; | 1055 | return; |
1031 | } | 1056 | } |
1032 | bool merge = false; | 1057 | bool merge = false; |
1033 | QString msg = i18n( "Merge with existing categories?" ); | 1058 | QString msg = i18n( "Merge with existing categories?" ); |
1034 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1059 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1035 | merge = true; | 1060 | merge = true; |
1036 | 1061 | ||
1037 | message( i18n("Setting categories ... please wait!") ); | 1062 | message( i18n("Setting categories ... please wait!") ); |
1038 | QStringList categories = dlg.selectedCategories(); | 1063 | QStringList categories = dlg.selectedCategories(); |
1039 | 1064 | ||
1040 | //QStringList uids = mViewManager->selectedUids(); | 1065 | //QStringList uids = mViewManager->selectedUids(); |
1041 | QStringList::Iterator it; | 1066 | QStringList::Iterator it; |
1042 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1067 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1043 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1068 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1044 | if ( !addr.isEmpty() ) { | 1069 | if ( !addr.isEmpty() ) { |
1045 | if ( !merge ) | 1070 | if ( !merge ) |
1046 | addr.setCategories( categories ); | 1071 | addr.setCategories( categories ); |
1047 | else { | 1072 | else { |
1048 | QStringList addrCategories = addr.categories(); | 1073 | QStringList addrCategories = addr.categories(); |
1049 | QStringList::Iterator catIt; | 1074 | QStringList::Iterator catIt; |
1050 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1075 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1051 | if ( !addrCategories.contains( *catIt ) ) | 1076 | if ( !addrCategories.contains( *catIt ) ) |
1052 | addrCategories.append( *catIt ); | 1077 | addrCategories.append( *catIt ); |
1053 | } | 1078 | } |
1054 | addr.setCategories( addrCategories ); | 1079 | addr.setCategories( addrCategories ); |
1055 | } | 1080 | } |
1056 | mAddressBook->insertAddressee( addr ); | 1081 | mAddressBook->insertAddressee( addr ); |
1057 | } | 1082 | } |
1058 | } | 1083 | } |
1059 | 1084 | ||
1060 | if ( uids.count() > 0 ) | 1085 | if ( uids.count() > 0 ) |
1061 | setModified( true ); | 1086 | setModified( true ); |
1062 | message( i18n("Setting categories completed!") ); | 1087 | message( i18n("Setting categories completed!") ); |
1063 | } | 1088 | } |
1064 | 1089 | ||
1065 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1090 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1066 | { | 1091 | { |
1067 | mIncSearchWidget->setFields( fields ); | 1092 | mIncSearchWidget->setFields( fields ); |
1068 | } | 1093 | } |
1069 | 1094 | ||
1070 | void KABCore::incrementalSearch( const QString& text ) | 1095 | void KABCore::incrementalSearch( const QString& text ) |
1071 | { | 1096 | { |
1072 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1097 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1073 | } | 1098 | } |
1074 | 1099 | ||
1075 | void KABCore::setModified() | 1100 | void KABCore::setModified() |
1076 | { | 1101 | { |
1077 | setModified( true ); | 1102 | setModified( true ); |
1078 | } | 1103 | } |
1079 | 1104 | ||
1080 | void KABCore::setModifiedWOrefresh() | 1105 | void KABCore::setModifiedWOrefresh() |
1081 | { | 1106 | { |
1082 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1107 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1083 | mModified = true; | 1108 | mModified = true; |
1084 | mActionSave->setEnabled( mModified ); | 1109 | mActionSave->setEnabled( mModified ); |
1085 | #ifdef DESKTOP_VERSION | 1110 | #ifdef DESKTOP_VERSION |
1086 | mDetails->refreshView(); | 1111 | mDetails->refreshView(); |
1087 | #endif | 1112 | #endif |
1088 | 1113 | ||
1089 | } | 1114 | } |
1090 | void KABCore::setModified( bool modified ) | 1115 | void KABCore::setModified( bool modified ) |
1091 | { | 1116 | { |
1092 | mModified = modified; | 1117 | mModified = modified; |
1093 | mActionSave->setEnabled( mModified ); | 1118 | mActionSave->setEnabled( mModified ); |
1094 | 1119 | ||
1095 | if ( modified ) | 1120 | if ( modified ) |
1096 | mJumpButtonBar->recreateButtons(); | 1121 | mJumpButtonBar->recreateButtons(); |
1097 | 1122 | ||
1098 | mViewManager->refreshView(); | 1123 | mViewManager->refreshView(); |
1099 | mDetails->refreshView(); | 1124 | mDetails->refreshView(); |
1100 | 1125 | ||
1101 | } | 1126 | } |
1102 | 1127 | ||
1103 | bool KABCore::modified() const | 1128 | bool KABCore::modified() const |
1104 | { | 1129 | { |
1105 | return mModified; | 1130 | return mModified; |
1106 | } | 1131 | } |
1107 | 1132 | ||
1108 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1133 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1109 | { | 1134 | { |
1110 | 1135 | ||
1111 | Command *command = 0; | 1136 | Command *command = 0; |
1112 | QString uid; | 1137 | QString uid; |
1113 | 1138 | ||
1114 | // check if it exists already | 1139 | // check if it exists already |
1115 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1140 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1116 | if ( origAddr.isEmpty() ) | 1141 | if ( origAddr.isEmpty() ) |
1117 | command = new PwNewCommand( mAddressBook, addr ); | 1142 | command = new PwNewCommand( mAddressBook, addr ); |
1118 | else { | 1143 | else { |
1119 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1144 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1120 | uid = addr.uid(); | 1145 | uid = addr.uid(); |
1121 | } | 1146 | } |
1122 | 1147 | ||
1123 | UndoStack::instance()->push( command ); | 1148 | UndoStack::instance()->push( command ); |
1124 | RedoStack::instance()->clear(); | 1149 | RedoStack::instance()->clear(); |
1125 | 1150 | ||
1126 | setModified( true ); | 1151 | setModified( true ); |
1127 | } | 1152 | } |
1128 | 1153 | ||
1129 | void KABCore::newContact() | 1154 | void KABCore::newContact() |
1130 | { | 1155 | { |
1131 | 1156 | ||
1132 | 1157 | ||
1133 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1158 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1134 | 1159 | ||
1135 | QPtrList<KRES::Resource> kresResources; | 1160 | QPtrList<KRES::Resource> kresResources; |
1136 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1161 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1137 | KABC::Resource *resource; | 1162 | KABC::Resource *resource; |
1138 | while ( ( resource = it.current() ) != 0 ) { | 1163 | while ( ( resource = it.current() ) != 0 ) { |
1139 | ++it; | 1164 | ++it; |
1140 | if ( !resource->readOnly() ) { | 1165 | if ( !resource->readOnly() ) { |
1141 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1166 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1142 | if ( res ) | 1167 | if ( res ) |
1143 | kresResources.append( res ); | 1168 | kresResources.append( res ); |
1144 | } | 1169 | } |
1145 | } | 1170 | } |
1146 | 1171 | ||
1147 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1172 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1148 | resource = static_cast<KABC::Resource*>( res ); | 1173 | resource = static_cast<KABC::Resource*>( res ); |
1149 | 1174 | ||
1150 | if ( resource ) { | 1175 | if ( resource ) { |
1151 | KABC::Addressee addr; | 1176 | KABC::Addressee addr; |
1152 | addr.setResource( resource ); | 1177 | addr.setResource( resource ); |
1153 | mEditorDialog->setAddressee( addr ); | 1178 | mEditorDialog->setAddressee( addr ); |
1154 | KApplication::execDialog ( mEditorDialog ); | 1179 | KApplication::execDialog ( mEditorDialog ); |
1155 | 1180 | ||
1156 | } else | 1181 | } else |
1157 | return; | 1182 | return; |
1158 | 1183 | ||
1159 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1184 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1160 | 1185 | ||
1161 | 1186 | ||
1162 | } | 1187 | } |
1163 | 1188 | ||
1164 | void KABCore::addEmail( QString aStr ) | 1189 | void KABCore::addEmail( QString aStr ) |
1165 | { | 1190 | { |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 0a52838..fe2d3a2 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,513 +1,514 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | class AddressBook; | 42 | class AddressBook; |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 46 | class KAboutData; |
47 | class KConfig; | 47 | class KConfig; |
48 | 48 | ||
49 | class KAddressBookService; | 49 | class KAddressBookService; |
50 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
51 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
52 | class KAddressBookMain; | 52 | class KAddressBookMain; |
53 | //US class QAction; | 53 | //US class QAction; |
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | class KCMultiDialog; | 55 | class KCMultiDialog; |
56 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
57 | class ExtensionManager; | 57 | class ExtensionManager; |
58 | class XXPortManager; | 58 | class XXPortManager; |
59 | class JumpButtonBar; | 59 | class JumpButtonBar; |
60 | class IncSearchWidget; | 60 | class IncSearchWidget; |
61 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
62 | class KAction; | 62 | class KAction; |
63 | class KActionCollection; | 63 | class KActionCollection; |
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | Saves the global settings. | 99 | Saves the global settings. |
100 | */ | 100 | */ |
101 | void saveSettings(); | 101 | void saveSettings(); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | Returns a pointer to the StdAddressBook of the application. | 104 | Returns a pointer to the StdAddressBook of the application. |
105 | */ | 105 | */ |
106 | KABC::AddressBook *addressBook() const; | 106 | KABC::AddressBook *addressBook() const; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | Returns a pointer to the KConfig object of the application. | 109 | Returns a pointer to the KConfig object of the application. |
110 | */ | 110 | */ |
111 | static KConfig *config(); | 111 | static KConfig *config(); |
112 | 112 | ||
113 | /** | 113 | /** |
114 | Returns a pointer to the global KActionCollection object. So | 114 | Returns a pointer to the global KActionCollection object. So |
115 | other classes can register their actions easily. | 115 | other classes can register their actions easily. |
116 | */ | 116 | */ |
117 | KActionCollection *actionCollection() const; | 117 | KActionCollection *actionCollection() const; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | Returns the current search field of the Incremental Search Widget. | 120 | Returns the current search field of the Incremental Search Widget. |
121 | */ | 121 | */ |
122 | KABC::Field *currentSearchField() const; | 122 | KABC::Field *currentSearchField() const; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | Returns the uid list of the currently selected contacts. | 125 | Returns the uid list of the currently selected contacts. |
126 | */ | 126 | */ |
127 | QStringList selectedUIDs() const; | 127 | QStringList selectedUIDs() const; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | Displays the ResourceSelectDialog and returns the selected | 130 | Displays the ResourceSelectDialog and returns the selected |
131 | resource or a null pointer if no resource was selected by | 131 | resource or a null pointer if no resource was selected by |
132 | the user. | 132 | the user. |
133 | */ | 133 | */ |
134 | KABC::Resource *requestResource( QWidget *parent ); | 134 | KABC::Resource *requestResource( QWidget *parent ); |
135 | 135 | ||
136 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
137 | static KAboutData *createAboutData(); | 137 | static KAboutData *createAboutData(); |
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
143 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
144 | 144 | ||
145 | public slots: | 145 | public slots: |
146 | #ifdef KAB_EMBEDDED | 146 | #ifdef KAB_EMBEDDED |
147 | void createAboutData(); | 147 | void createAboutData(); |
148 | #endif //KAB_EMBEDDED | 148 | #endif //KAB_EMBEDDED |
149 | void setDetailsToggle(); | 149 | void setDetailsToggle(); |
150 | 150 | ||
151 | void showLicence(); | 151 | void showLicence(); |
152 | void faq(); | 152 | void faq(); |
153 | void whatsnew() ; | 153 | void whatsnew() ; |
154 | void synchowto() ; | 154 | void synchowto() ; |
155 | void multisynchowto() ; | 155 | void multisynchowto() ; |
156 | void kdesynchowto() ; | 156 | void kdesynchowto() ; |
157 | void writeToPhone(); | 157 | void writeToPhone(); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Is called whenever a contact is selected in the view. | 160 | Is called whenever a contact is selected in the view. |
161 | */ | 161 | */ |
162 | void setContactSelected( const QString &uid ); | 162 | void setContactSelected( const QString &uid ); |
163 | 163 | ||
164 | /** | 164 | /** |
165 | Opens the preferred mail composer with all selected contacts as | 165 | Opens the preferred mail composer with all selected contacts as |
166 | arguments. | 166 | arguments. |
167 | */ | 167 | */ |
168 | void sendMail(); | 168 | void sendMail(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Opens the preferred mail composer with the given contacts as | 171 | Opens the preferred mail composer with the given contacts as |
172 | arguments. | 172 | arguments. |
173 | */ | 173 | */ |
174 | void sendMail( const QString& email ); | 174 | void sendMail( const QString& email ); |
175 | 175 | ||
176 | 176 | ||
177 | void mailVCard(); | 177 | void mailVCard(); |
178 | void mailVCard(const QStringList& uids); | 178 | void mailVCard(const QStringList& uids); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Beams the "WhoAmI contact. | 181 | Beams the "WhoAmI contact. |
182 | */ | 182 | */ |
183 | void beamMySelf(); | 183 | void beamMySelf(); |
184 | 184 | ||
185 | void beamVCard(); | 185 | void beamVCard(); |
186 | void export2phone(); | 186 | void export2phone(); |
187 | void beamVCard(const QStringList& uids); | 187 | void beamVCard(const QStringList& uids); |
188 | void beamDone( Ir *ir ); | 188 | void beamDone( Ir *ir ); |
189 | 189 | ||
190 | 190 | ||
191 | /** | 191 | /** |
192 | Starts the preferred web browser with the given URL as argument. | 192 | Starts the preferred web browser with the given URL as argument. |
193 | */ | 193 | */ |
194 | void browse( const QString& url ); | 194 | void browse( const QString& url ); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | Select all contacts in the view. | 197 | Select all contacts in the view. |
198 | */ | 198 | */ |
199 | void selectAllContacts(); | 199 | void selectAllContacts(); |
200 | 200 | ||
201 | /** | 201 | /** |
202 | Deletes all selected contacts from the address book. | 202 | Deletes all selected contacts from the address book. |
203 | */ | 203 | */ |
204 | void deleteContacts(); | 204 | void deleteContacts(); |
205 | 205 | ||
206 | /** | 206 | /** |
207 | Deletes given contacts from the address book. | 207 | Deletes given contacts from the address book. |
208 | 208 | ||
209 | @param uids The uids of the contacts, which shall be deleted. | 209 | @param uids The uids of the contacts, which shall be deleted. |
210 | */ | 210 | */ |
211 | void deleteContacts( const QStringList &uids ); | 211 | void deleteContacts( const QStringList &uids ); |
212 | 212 | ||
213 | /** | 213 | /** |
214 | Copys the selected contacts into clipboard for later pasting. | 214 | Copys the selected contacts into clipboard for later pasting. |
215 | */ | 215 | */ |
216 | void copyContacts(); | 216 | void copyContacts(); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | Cuts the selected contacts and stores them for later pasting. | 219 | Cuts the selected contacts and stores them for later pasting. |
220 | */ | 220 | */ |
221 | void cutContacts(); | 221 | void cutContacts(); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | Paste contacts from clipboard into the address book. | 224 | Paste contacts from clipboard into the address book. |
225 | */ | 225 | */ |
226 | void pasteContacts(); | 226 | void pasteContacts(); |
227 | 227 | ||
228 | /** | 228 | /** |
229 | Paste given contacts into the address book. | 229 | Paste given contacts into the address book. |
230 | 230 | ||
231 | @param list The list of addressee, which shall be pasted. | 231 | @param list The list of addressee, which shall be pasted. |
232 | */ | 232 | */ |
233 | void pasteContacts( KABC::Addressee::List &list ); | 233 | void pasteContacts( KABC::Addressee::List &list ); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Sets the whoAmI contact, that is used by many other programs to | 236 | Sets the whoAmI contact, that is used by many other programs to |
237 | get personal information about the current user. | 237 | get personal information about the current user. |
238 | */ | 238 | */ |
239 | void setWhoAmI(); | 239 | void setWhoAmI(); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
243 | selected contacts. | 243 | selected contacts. |
244 | */ | 244 | */ |
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | 246 | void manageCategories(); |
247 | void editCategories(); | 247 | void editCategories(); |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Sets the field list of the Incremental Search Widget. | 250 | Sets the field list of the Incremental Search Widget. |
251 | */ | 251 | */ |
252 | void setSearchFields( const KABC::Field::List &fields ); | 252 | void setSearchFields( const KABC::Field::List &fields ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | Search with the current search field for a contact, that matches | 255 | Search with the current search field for a contact, that matches |
256 | the given text, and selects it in the view. | 256 | the given text, and selects it in the view. |
257 | */ | 257 | */ |
258 | void incrementalSearch( const QString& text ); | 258 | void incrementalSearch( const QString& text ); |
259 | 259 | ||
260 | /** | 260 | /** |
261 | Marks the address book as modified. | 261 | Marks the address book as modified. |
262 | */ | 262 | */ |
263 | void setModified(); | 263 | void setModified(); |
264 | /** | 264 | /** |
265 | Marks the address book as modified without refreshing the view. | 265 | Marks the address book as modified without refreshing the view. |
266 | */ | 266 | */ |
267 | void setModifiedWOrefresh(); | 267 | void setModifiedWOrefresh(); |
268 | 268 | ||
269 | /** | 269 | /** |
270 | Marks the address book as modified concerning the argument. | 270 | Marks the address book as modified concerning the argument. |
271 | */ | 271 | */ |
272 | void setModified( bool modified ); | 272 | void setModified( bool modified ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Returns whether the address book is modified. | 275 | Returns whether the address book is modified. |
276 | */ | 276 | */ |
277 | bool modified() const; | 277 | bool modified() const; |
278 | 278 | ||
279 | /** | 279 | /** |
280 | Called whenever an contact is modified in the contact editor | 280 | Called whenever an contact is modified in the contact editor |
281 | dialog or the quick edit. | 281 | dialog or the quick edit. |
282 | */ | 282 | */ |
283 | void contactModified( const KABC::Addressee &addr ); | 283 | void contactModified( const KABC::Addressee &addr ); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | DCOP METHODS. | 286 | DCOP METHODS. |
287 | */ | 287 | */ |
288 | void addEmail( QString addr ); | 288 | void addEmail( QString addr ); |
289 | void importVCard( const KURL& url, bool showPreview ); | 289 | void importVCard( const KURL& url, bool showPreview ); |
290 | void importVCard( const QString& vCard, bool showPreview ); | 290 | void importVCard( const QString& vCard, bool showPreview ); |
291 | void newContact(); | 291 | void newContact(); |
292 | QString getNameByPhone( const QString& phone ); | 292 | QString getNameByPhone( const QString& phone ); |
293 | /** | 293 | /** |
294 | END DCOP METHODS | 294 | END DCOP METHODS |
295 | */ | 295 | */ |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Saves the contents of the AddressBook back to disk. | 298 | Saves the contents of the AddressBook back to disk. |
299 | */ | 299 | */ |
300 | void save(); | 300 | void save(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Undos the last command using the undo stack. | 303 | Undos the last command using the undo stack. |
304 | */ | 304 | */ |
305 | void undo(); | 305 | void undo(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Redos the last command that was undone, using the redo stack. | 308 | Redos the last command that was undone, using the redo stack. |
309 | */ | 309 | */ |
310 | void redo(); | 310 | void redo(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 313 | Shows the edit dialog for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 314 | the method will try to find a selected addressee in the view. |
315 | */ | 315 | */ |
316 | void editContact( const QString &uid /*US = QString::null*/ ); | 316 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 317 | //US added a second method without defaultparameter |
318 | void editContact2(); | 318 | void editContact2(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Launches the ldap search dialog. | 332 | Launches the ldap search dialog. |
333 | */ | 333 | */ |
334 | void openLDAPDialog(); | 334 | void openLDAPDialog(); |
335 | 335 | ||
336 | /** | 336 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 337 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 338 | dialog and do the printing. |
339 | */ | 339 | */ |
340 | void print(); | 340 | void print(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 343 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 344 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 345 | void addGUIClient( KXMLGUIClient *client ); |
346 | 346 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 350 | ||
351 | 351 | ||
352 | signals: | 352 | signals: |
353 | void contactSelected( const QString &name ); | 353 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 354 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 355 | public slots: |
356 | void recieve(QString cmsg ); | 356 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 357 | void getFile( bool success ); |
358 | void syncFileRequest(); | 358 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 359 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 360 | void setDetailsToState(); |
361 | // void slotSyncMenu( int ); | 361 | // void slotSyncMenu( int ); |
362 | private slots: | 362 | private slots: |
363 | void updateToolBar(); | 363 | void updateToolBar(); |
364 | void receive( const QCString& cmsg, const QByteArray& data ); | 364 | void receive( const QCString& cmsg, const QByteArray& data ); |
365 | void toggleBeamReceive( ); | 365 | void toggleBeamReceive( ); |
366 | void disableBR(bool); | 366 | void disableBR(bool); |
367 | void setJumpButtonBarVisible( bool visible ); | 367 | void setJumpButtonBarVisible( bool visible ); |
368 | void setCaptionBack(); | 368 | void setCaptionBack(); |
369 | void importFromOL(); | 369 | void importFromOL(); |
370 | void extensionModified( const KABC::Addressee::List &list ); | 370 | void extensionModified( const KABC::Addressee::List &list ); |
371 | void extensionChanged( int id ); | 371 | void extensionChanged( int id ); |
372 | void clipboardDataChanged(); | 372 | void clipboardDataChanged(); |
373 | void updateActionMenu(); | 373 | void updateActionMenu(); |
374 | void configureKeyBindings(); | 374 | void configureKeyBindings(); |
375 | void removeVoice(); | 375 | void removeVoice(); |
376 | #ifdef KAB_EMBEDDED | 376 | #ifdef KAB_EMBEDDED |
377 | void configureResources(); | 377 | void configureResources(); |
378 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
379 | 379 | ||
380 | void slotEditorDestroyed( const QString &uid ); | 380 | void slotEditorDestroyed( const QString &uid ); |
381 | void configurationChanged(); | 381 | void configurationChanged(); |
382 | void addressBookChanged(); | 382 | void addressBookChanged(); |
383 | 383 | ||
384 | private: | 384 | private: |
385 | void resizeEvent(QResizeEvent* e ); | ||
385 | bool mBRdisabled; | 386 | bool mBRdisabled; |
386 | #ifndef DESKTOP_VERSION | 387 | #ifndef DESKTOP_VERSION |
387 | QCopChannel* infrared; | 388 | QCopChannel* infrared; |
388 | #endif | 389 | #endif |
389 | QTimer *mMessageTimer; | 390 | QTimer *mMessageTimer; |
390 | void initGUI(); | 391 | void initGUI(); |
391 | void initActions(); | 392 | void initActions(); |
392 | QString getPhoneFile(); | 393 | QString getPhoneFile(); |
393 | 394 | ||
394 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 395 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
395 | const char *name = 0 ); | 396 | const char *name = 0 ); |
396 | 397 | ||
397 | KXMLGUIClient *mGUIClient; | 398 | KXMLGUIClient *mGUIClient; |
398 | 399 | ||
399 | KABC::AddressBook *mAddressBook; | 400 | KABC::AddressBook *mAddressBook; |
400 | 401 | ||
401 | ViewManager *mViewManager; | 402 | ViewManager *mViewManager; |
402 | // QSplitter *mDetailsSplitter; | 403 | // QSplitter *mDetailsSplitter; |
403 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 404 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
404 | ViewContainer *mDetails; | 405 | ViewContainer *mDetails; |
405 | KDGanttMinimizeSplitter* mMiniSplitter; | 406 | KDGanttMinimizeSplitter* mMiniSplitter; |
406 | XXPortManager *mXXPortManager; | 407 | XXPortManager *mXXPortManager; |
407 | JumpButtonBar *mJumpButtonBar; | 408 | JumpButtonBar *mJumpButtonBar; |
408 | IncSearchWidget *mIncSearchWidget; | 409 | IncSearchWidget *mIncSearchWidget; |
409 | ExtensionManager *mExtensionManager; | 410 | ExtensionManager *mExtensionManager; |
410 | 411 | ||
411 | KCMultiDialog *mConfigureDialog; | 412 | KCMultiDialog *mConfigureDialog; |
412 | 413 | ||
413 | #ifndef KAB_EMBEDDED | 414 | #ifndef KAB_EMBEDDED |
414 | LDAPSearchDialog *mLdapSearchDialog; | 415 | LDAPSearchDialog *mLdapSearchDialog; |
415 | #endif //KAB_EMBEDDED | 416 | #endif //KAB_EMBEDDED |
416 | // QDict<AddresseeEditorDialog> mEditorDict; | 417 | // QDict<AddresseeEditorDialog> mEditorDict; |
417 | AddresseeEditorDialog *mEditorDialog; | 418 | AddresseeEditorDialog *mEditorDialog; |
418 | bool mReadWrite; | 419 | bool mReadWrite; |
419 | bool mModified; | 420 | bool mModified; |
420 | bool mIsPart; | 421 | bool mIsPart; |
421 | bool mMultipleViewsAtOnce; | 422 | bool mMultipleViewsAtOnce; |
422 | 423 | ||
423 | 424 | ||
424 | //US file menu | 425 | //US file menu |
425 | KAction *mActionMail; | 426 | KAction *mActionMail; |
426 | KAction *mActionBeam; | 427 | KAction *mActionBeam; |
427 | KToggleAction *mActionBR; | 428 | KToggleAction *mActionBR; |
428 | KAction *mActionExport2phone; | 429 | KAction *mActionExport2phone; |
429 | KAction* mActionPrint; | 430 | KAction* mActionPrint; |
430 | KAction* mActionNewContact; | 431 | KAction* mActionNewContact; |
431 | KAction *mActionSave; | 432 | KAction *mActionSave; |
432 | KAction *mActionEditAddressee; | 433 | KAction *mActionEditAddressee; |
433 | KAction *mActionMailVCard; | 434 | KAction *mActionMailVCard; |
434 | KAction *mActionBeamVCard; | 435 | KAction *mActionBeamVCard; |
435 | 436 | ||
436 | KAction *mActionQuit; | 437 | KAction *mActionQuit; |
437 | 438 | ||
438 | //US edit menu | 439 | //US edit menu |
439 | KAction *mActionCopy; | 440 | KAction *mActionCopy; |
440 | KAction *mActionCut; | 441 | KAction *mActionCut; |
441 | KAction *mActionPaste; | 442 | KAction *mActionPaste; |
442 | KAction *mActionSelectAll; | 443 | KAction *mActionSelectAll; |
443 | KAction *mActionUndo; | 444 | KAction *mActionUndo; |
444 | KAction *mActionRedo; | 445 | KAction *mActionRedo; |
445 | KAction *mActionDelete; | 446 | KAction *mActionDelete; |
446 | 447 | ||
447 | //US settings menu | 448 | //US settings menu |
448 | KAction *mActionConfigResources; | 449 | KAction *mActionConfigResources; |
449 | KAction *mActionConfigKAddressbook; | 450 | KAction *mActionConfigKAddressbook; |
450 | KAction *mActionConfigShortcuts; | 451 | KAction *mActionConfigShortcuts; |
451 | KAction *mActionConfigureToolbars; | 452 | KAction *mActionConfigureToolbars; |
452 | KAction *mActionKeyBindings; | 453 | KAction *mActionKeyBindings; |
453 | KToggleAction *mActionJumpBar; | 454 | KToggleAction *mActionJumpBar; |
454 | KToggleAction *mActionDetails; | 455 | KToggleAction *mActionDetails; |
455 | KAction *mActionWhoAmI; | 456 | KAction *mActionWhoAmI; |
456 | KAction *mActionCategories; | 457 | KAction *mActionCategories; |
457 | KAction *mActionEditCategories; | 458 | KAction *mActionEditCategories; |
458 | KAction *mActionManageCategories; | 459 | KAction *mActionManageCategories; |
459 | KAction *mActionAboutKAddressbook; | 460 | KAction *mActionAboutKAddressbook; |
460 | KAction *mActionLicence; | 461 | KAction *mActionLicence; |
461 | KAction *mActionFaq; | 462 | KAction *mActionFaq; |
462 | KAction *mActionWN; | 463 | KAction *mActionWN; |
463 | KAction *mActionSyncHowto; | 464 | KAction *mActionSyncHowto; |
464 | KAction *mActionKdeSyncHowto; | 465 | KAction *mActionKdeSyncHowto; |
465 | KAction *mActionMultiSyncHowto; | 466 | KAction *mActionMultiSyncHowto; |
466 | 467 | ||
467 | KAction *mActionDeleteView; | 468 | KAction *mActionDeleteView; |
468 | 469 | ||
469 | QPopupMenu *viewMenu; | 470 | QPopupMenu *viewMenu; |
470 | QPopupMenu *filterMenu; | 471 | QPopupMenu *filterMenu; |
471 | QPopupMenu *settingsMenu; | 472 | QPopupMenu *settingsMenu; |
472 | QPopupMenu *changeMenu; | 473 | QPopupMenu *changeMenu; |
473 | //US QAction *mActionSave; | 474 | //US QAction *mActionSave; |
474 | QPopupMenu *ImportMenu; | 475 | QPopupMenu *ImportMenu; |
475 | QPopupMenu *ExportMenu; | 476 | QPopupMenu *ExportMenu; |
476 | //LR additional methods | 477 | //LR additional methods |
477 | KAction *mActionRemoveVoice; | 478 | KAction *mActionRemoveVoice; |
478 | KAction * mActionImportOL; | 479 | KAction * mActionImportOL; |
479 | 480 | ||
480 | #ifndef KAB_EMBEDDED | 481 | #ifndef KAB_EMBEDDED |
481 | KAddressBookService *mAddressBookService; | 482 | KAddressBookService *mAddressBookService; |
482 | #endif //KAB_EMBEDDED | 483 | #endif //KAB_EMBEDDED |
483 | 484 | ||
484 | class KABCorePrivate; | 485 | class KABCorePrivate; |
485 | KABCorePrivate *d; | 486 | KABCorePrivate *d; |
486 | //US bool mBlockSaveFlag; | 487 | //US bool mBlockSaveFlag; |
487 | 488 | ||
488 | #ifdef KAB_EMBEDDED | 489 | #ifdef KAB_EMBEDDED |
489 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 490 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
490 | #endif //KAB_EMBEDDED | 491 | #endif //KAB_EMBEDDED |
491 | 492 | ||
492 | //this are the overwritten callbackmethods from the syncinterface | 493 | //this are the overwritten callbackmethods from the syncinterface |
493 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 494 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
494 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 495 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
495 | virtual void removeSyncInfo( QString syncProfile); | 496 | virtual void removeSyncInfo( QString syncProfile); |
496 | bool syncPhone(); | 497 | bool syncPhone(); |
497 | void message( QString m ); | 498 | void message( QString m ); |
498 | 499 | ||
499 | // LR ******************************* | 500 | // LR ******************************* |
500 | // sync stuff! | 501 | // sync stuff! |
501 | QString sentSyncFile(); | 502 | QString sentSyncFile(); |
502 | QPopupMenu *syncMenu; | 503 | QPopupMenu *syncMenu; |
503 | KSyncManager* syncManager; | 504 | KSyncManager* syncManager; |
504 | int mGlobalSyncMode; | 505 | int mGlobalSyncMode; |
505 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 506 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
506 | KABC::Addressee getLastSyncAddressee(); | 507 | KABC::Addressee getLastSyncAddressee(); |
507 | QDateTime mLastAddressbookSync; | 508 | QDateTime mLastAddressbookSync; |
508 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 509 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
509 | // ********************* | 510 | // ********************* |
510 | 511 | ||
511 | }; | 512 | }; |
512 | 513 | ||
513 | #endif | 514 | #endif |