author | zautrix <zautrix> | 2004-10-20 10:24:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 10:24:19 (UTC) |
commit | f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28 (patch) (unidiff) | |
tree | c0f67de8a80dc20d80612d7b4b27ebc6ca30f1ca | |
parent | b3662915cb2c966ed7b5c563b8e840ae5b82d4e6 (diff) | |
download | kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.zip kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.tar.gz kdepimpi-f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28.tar.bz2 |
fixed br for kapi
-rw-r--r-- | kaddressbook/kabcore.cpp | 64 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 11 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.h | 1 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 7 |
5 files changed, 77 insertions, 18 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 11eeabc..980e436 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,714 +1,766 @@ | |||
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 | 118 | ||
119 | 119 | ||
120 | #include <kresources/selectdialog.h> | 120 | #include <kresources/selectdialog.h> |
121 | #include <kmessagebox.h> | 121 | #include <kmessagebox.h> |
122 | 122 | ||
123 | #include <picture.h> | 123 | #include <picture.h> |
124 | #include <resource.h> | 124 | #include <resource.h> |
125 | 125 | ||
126 | //US#include <qsplitter.h> | 126 | //US#include <qsplitter.h> |
127 | #include <qmap.h> | 127 | #include <qmap.h> |
128 | #include <qdir.h> | 128 | #include <qdir.h> |
129 | #include <qfile.h> | 129 | #include <qfile.h> |
130 | #include <qvbox.h> | 130 | #include <qvbox.h> |
131 | #include <qlayout.h> | 131 | #include <qlayout.h> |
132 | #include <qclipboard.h> | 132 | #include <qclipboard.h> |
133 | #include <qtextstream.h> | 133 | #include <qtextstream.h> |
134 | 134 | ||
135 | #include <libkdepim/categoryselectdialog.h> | 135 | #include <libkdepim/categoryselectdialog.h> |
136 | #include <kabc/vcardconverter.h> | 136 | #include <kabc/vcardconverter.h> |
137 | 137 | ||
138 | 138 | ||
139 | #include "addresseeutil.h" | 139 | #include "addresseeutil.h" |
140 | #include "undocmds.h" | 140 | #include "undocmds.h" |
141 | #include "addresseeeditordialog.h" | 141 | #include "addresseeeditordialog.h" |
142 | #include "viewmanager.h" | 142 | #include "viewmanager.h" |
143 | #include "details/detailsviewcontainer.h" | 143 | #include "details/detailsviewcontainer.h" |
144 | #include "kabprefs.h" | 144 | #include "kabprefs.h" |
145 | #include "xxportmanager.h" | 145 | #include "xxportmanager.h" |
146 | #include "incsearchwidget.h" | 146 | #include "incsearchwidget.h" |
147 | #include "jumpbuttonbar.h" | 147 | #include "jumpbuttonbar.h" |
148 | #include "extensionmanager.h" | 148 | #include "extensionmanager.h" |
149 | #include "addresseeconfig.h" | 149 | #include "addresseeconfig.h" |
150 | #include <kcmultidialog.h> | 150 | #include <kcmultidialog.h> |
151 | 151 | ||
152 | #ifdef _WIN32_ | 152 | #ifdef _WIN32_ |
153 | 153 | ||
154 | #include "kaimportoldialog.h" | 154 | #include "kaimportoldialog.h" |
155 | #else | 155 | #else |
156 | #include <unistd.h> | 156 | #include <unistd.h> |
157 | #endif | 157 | #endif |
158 | // sync includes | 158 | // sync includes |
159 | #include <libkdepim/ksyncprofile.h> | 159 | #include <libkdepim/ksyncprofile.h> |
160 | #include <libkdepim/ksyncprefsdialog.h> | 160 | #include <libkdepim/ksyncprefsdialog.h> |
161 | 161 | ||
162 | class KAex2phonePrefs : public QDialog | 162 | class KAex2phonePrefs : public QDialog |
163 | { | 163 | { |
164 | public: | 164 | public: |
165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
166 | QDialog( parent, name, true ) | 166 | QDialog( parent, name, true ) |
167 | { | 167 | { |
168 | setCaption( i18n("Export to phone options") ); | 168 | setCaption( i18n("Export to phone options") ); |
169 | QVBoxLayout* lay = new QVBoxLayout( this ); | 169 | QVBoxLayout* lay = new QVBoxLayout( this ); |
170 | lay->setSpacing( 3 ); | 170 | lay->setSpacing( 3 ); |
171 | lay->setMargin( 3 ); | 171 | lay->setMargin( 3 ); |
172 | QLabel *lab; | 172 | QLabel *lab; |
173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
174 | lab->setAlignment (AlignHCenter ); | 174 | lab->setAlignment (AlignHCenter ); |
175 | QHBox* temphb; | 175 | QHBox* temphb; |
176 | temphb = new QHBox( this ); | 176 | temphb = new QHBox( this ); |
177 | new QLabel( i18n("I/O device: "), temphb ); | 177 | new QLabel( i18n("I/O device: "), temphb ); |
178 | mPhoneDevice = new QLineEdit( temphb); | 178 | mPhoneDevice = new QLineEdit( temphb); |
179 | lay->addWidget( temphb ); | 179 | lay->addWidget( temphb ); |
180 | temphb = new QHBox( this ); | 180 | temphb = new QHBox( this ); |
181 | new QLabel( i18n("Connection: "), temphb ); | 181 | new QLabel( i18n("Connection: "), temphb ); |
182 | mPhoneConnection = new QLineEdit( temphb); | 182 | mPhoneConnection = new QLineEdit( temphb); |
183 | lay->addWidget( temphb ); | 183 | lay->addWidget( temphb ); |
184 | temphb = new QHBox( this ); | 184 | temphb = new QHBox( this ); |
185 | new QLabel( i18n("Model(opt.): "), temphb ); | 185 | new QLabel( i18n("Model(opt.): "), temphb ); |
186 | mPhoneModel = new QLineEdit( temphb); | 186 | mPhoneModel = new QLineEdit( temphb); |
187 | lay->addWidget( temphb ); | 187 | lay->addWidget( temphb ); |
188 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 188 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
189 | // lay->addWidget( mWriteToSim ); | 189 | // lay->addWidget( mWriteToSim ); |
190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
191 | lab->setAlignment (AlignHCenter ); | 191 | lab->setAlignment (AlignHCenter ); |
192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
193 | lay->addWidget( ok ); | 193 | lay->addWidget( ok ); |
194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
195 | lay->addWidget( cancel ); | 195 | lay->addWidget( cancel ); |
196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
198 | resize( 220, 240 ); | 198 | resize( 220, 240 ); |
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | public: | 202 | public: |
203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
204 | QCheckBox* mWriteToSim; | 204 | QCheckBox* mWriteToSim; |
205 | }; | 205 | }; |
206 | 206 | ||
207 | 207 | ||
208 | bool pasteWithNewUid = true; | 208 | bool pasteWithNewUid = true; |
209 | 209 | ||
210 | #ifdef KAB_EMBEDDED | 210 | #ifdef KAB_EMBEDDED |
211 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 211 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
212 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 212 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
213 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 213 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
214 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 214 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
215 | #else //KAB_EMBEDDED | 215 | #else //KAB_EMBEDDED |
216 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 216 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
217 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 217 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
218 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 218 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
219 | mReadWrite( readWrite ), mModified( false ) | 219 | mReadWrite( readWrite ), mModified( false ) |
220 | #endif //KAB_EMBEDDED | 220 | #endif //KAB_EMBEDDED |
221 | { | 221 | { |
222 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 222 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
223 | // syncManager->setBlockSave(false); | 223 | // syncManager->setBlockSave(false); |
224 | mExtensionBarSplitter = 0; | 224 | mExtensionBarSplitter = 0; |
225 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 225 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
226 | mAddressBook = KABC::StdAddressBook::self(); | 226 | mAddressBook = KABC::StdAddressBook::self(); |
227 | KABC::StdAddressBook::setAutomaticSave( false ); | 227 | KABC::StdAddressBook::setAutomaticSave( false ); |
228 | 228 | ||
229 | #ifndef KAB_EMBEDDED | 229 | #ifndef KAB_EMBEDDED |
230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
231 | #endif //KAB_EMBEDDED | 231 | #endif //KAB_EMBEDDED |
232 | 232 | ||
233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
234 | SLOT( addressBookChanged() ) ); | 234 | SLOT( addressBookChanged() ) ); |
235 | 235 | ||
236 | #if 0 | 236 | #if 0 |
237 | // LP moved to addressbook init method | 237 | // LP moved to addressbook init method |
238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
239 | "X-Department", "KADDRESSBOOK" ); | 239 | "X-Department", "KADDRESSBOOK" ); |
240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
241 | "X-Profession", "KADDRESSBOOK" ); | 241 | "X-Profession", "KADDRESSBOOK" ); |
242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
243 | "X-AssistantsName", "KADDRESSBOOK" ); | 243 | "X-AssistantsName", "KADDRESSBOOK" ); |
244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
245 | "X-ManagersName", "KADDRESSBOOK" ); | 245 | "X-ManagersName", "KADDRESSBOOK" ); |
246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
247 | "X-SpousesName", "KADDRESSBOOK" ); | 247 | "X-SpousesName", "KADDRESSBOOK" ); |
248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
249 | "X-Office", "KADDRESSBOOK" ); | 249 | "X-Office", "KADDRESSBOOK" ); |
250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
251 | "X-IMAddress", "KADDRESSBOOK" ); | 251 | "X-IMAddress", "KADDRESSBOOK" ); |
252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
253 | "X-Anniversary", "KADDRESSBOOK" ); | 253 | "X-Anniversary", "KADDRESSBOOK" ); |
254 | 254 | ||
255 | //US added this field to become compatible with Opie/qtopia addressbook | 255 | //US added this field to become compatible with Opie/qtopia addressbook |
256 | // values can be "female" or "male" or "". An empty field represents undefined. | 256 | // values can be "female" or "male" or "". An empty field represents undefined. |
257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
258 | "X-Gender", "KADDRESSBOOK" ); | 258 | "X-Gender", "KADDRESSBOOK" ); |
259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
260 | "X-Children", "KADDRESSBOOK" ); | 260 | "X-Children", "KADDRESSBOOK" ); |
261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
263 | #endif | 263 | #endif |
264 | initGUI(); | 264 | initGUI(); |
265 | 265 | ||
266 | mIncSearchWidget->setFocus(); | 266 | mIncSearchWidget->setFocus(); |
267 | 267 | ||
268 | 268 | ||
269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
270 | SLOT( setContactSelected( const QString& ) ) ); | 270 | SLOT( setContactSelected( const QString& ) ) ); |
271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
272 | SLOT( executeContact( const QString& ) ) ); | 272 | SLOT( executeContact( const QString& ) ) ); |
273 | 273 | ||
274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
275 | SLOT( deleteContacts( ) ) ); | 275 | SLOT( deleteContacts( ) ) ); |
276 | connect( mViewManager, SIGNAL( modified() ), | 276 | connect( mViewManager, SIGNAL( modified() ), |
277 | SLOT( setModified() ) ); | 277 | SLOT( setModified() ) ); |
278 | 278 | ||
279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
281 | 281 | ||
282 | connect( mXXPortManager, SIGNAL( modified() ), | 282 | connect( mXXPortManager, SIGNAL( modified() ), |
283 | SLOT( setModified() ) ); | 283 | SLOT( setModified() ) ); |
284 | 284 | ||
285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
286 | SLOT( incrementalSearch( const QString& ) ) ); | 286 | SLOT( incrementalSearch( const QString& ) ) ); |
287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
288 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 288 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
289 | 289 | ||
290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
291 | SLOT( sendMail( const QString& ) ) ); | 291 | SLOT( sendMail( const QString& ) ) ); |
292 | 292 | ||
293 | 293 | ||
294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
295 | 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&))); | 295 | 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&))); |
296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
297 | 297 | ||
298 | 298 | ||
299 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
302 | 302 | ||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | mMessageTimer = new QTimer( this ); | 311 | mMessageTimer = new QTimer( this ); |
312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
313 | mEditorDialog = 0; | 313 | mEditorDialog = 0; |
314 | createAddresseeEditorDialog( this ); | 314 | createAddresseeEditorDialog( this ); |
315 | setModified( false ); | 315 | setModified( false ); |
316 | mBRdisabled = 0; | ||
317 | #ifndef DESKTOP_VERSION | ||
318 | infrared = 0; | ||
319 | #endif | ||
320 | toggleBeamReceive( ); | ||
316 | } | 321 | } |
317 | 322 | ||
318 | KABCore::~KABCore() | 323 | KABCore::~KABCore() |
319 | { | 324 | { |
320 | // save(); | 325 | // save(); |
321 | //saveSettings(); | 326 | //saveSettings(); |
322 | //KABPrefs::instance()->writeConfig(); | 327 | //KABPrefs::instance()->writeConfig(); |
323 | delete AddresseeConfig::instance(); | 328 | delete AddresseeConfig::instance(); |
324 | mAddressBook = 0; | 329 | mAddressBook = 0; |
325 | KABC::StdAddressBook::close(); | 330 | KABC::StdAddressBook::close(); |
326 | 331 | ||
327 | delete syncManager; | 332 | delete syncManager; |
333 | if ( infrared ) | ||
334 | delete infrared; | ||
335 | } | ||
336 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | ||
337 | { | ||
338 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
339 | if ( cmsg == "setDocument(QString)" ) { | ||
340 | QDataStream stream( data, IO_ReadOnly ); | ||
341 | QString fileName; | ||
342 | stream >> fileName; | ||
343 | recieve( fileName ); | ||
344 | return; | ||
345 | } | ||
346 | } | ||
347 | void KABCore::toggleBeamReceive( ) | ||
348 | { | ||
349 | if ( mBRdisabled ) | ||
350 | return; | ||
351 | #ifndef DESKTOP_VERSION | ||
352 | if ( infrared ) { | ||
353 | qDebug("AB disable BeamReceive "); | ||
354 | delete infrared; | ||
355 | infrared = 0; | ||
356 | mActionBR->setChecked(false); | ||
357 | return; | ||
358 | } | ||
359 | qDebug("AB enable BeamReceive "); | ||
360 | mActionBR->setChecked(true); | ||
328 | 361 | ||
362 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | ||
363 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | ||
364 | #endif | ||
329 | } | 365 | } |
330 | 366 | ||
367 | |||
368 | void KABCore::disableBR(bool b) | ||
369 | { | ||
370 | if ( b ) { | ||
371 | if ( infrared ) { | ||
372 | toggleBeamReceive( ); | ||
373 | mBRdisabled = true; | ||
374 | } | ||
375 | } else { | ||
376 | if ( mBRdisabled ) { | ||
377 | mBRdisabled = false; | ||
378 | toggleBeamReceive( ); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | } | ||
331 | void KABCore::recieve( QString fn ) | 383 | void KABCore::recieve( QString fn ) |
332 | { | 384 | { |
333 | //qDebug("KABCore::recieve "); | 385 | //qDebug("KABCore::recieve "); |
334 | int count = mAddressBook->importFromFile( fn, true ); | 386 | int count = mAddressBook->importFromFile( fn, true ); |
335 | mViewManager->refreshView(); | 387 | mViewManager->refreshView(); |
336 | message(i18n("%1 contact(s) received!").arg( count )); | 388 | message(i18n("%1 contact(s) received!").arg( count )); |
337 | topLevelWidget()->showMaximized(); | 389 | topLevelWidget()->showMaximized(); |
338 | topLevelWidget()->raise(); | 390 | topLevelWidget()->raise(); |
339 | } | 391 | } |
340 | void KABCore::restoreSettings() | 392 | void KABCore::restoreSettings() |
341 | { | 393 | { |
342 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 394 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
343 | 395 | ||
344 | bool state; | 396 | bool state; |
345 | 397 | ||
346 | if (mMultipleViewsAtOnce) | 398 | if (mMultipleViewsAtOnce) |
347 | state = KABPrefs::instance()->mDetailsPageVisible; | 399 | state = KABPrefs::instance()->mDetailsPageVisible; |
348 | else | 400 | else |
349 | state = false; | 401 | state = false; |
350 | 402 | ||
351 | mActionDetails->setChecked( state ); | 403 | mActionDetails->setChecked( state ); |
352 | setDetailsVisible( state ); | 404 | setDetailsVisible( state ); |
353 | 405 | ||
354 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 406 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
355 | 407 | ||
356 | mActionJumpBar->setChecked( state ); | 408 | mActionJumpBar->setChecked( state ); |
357 | setJumpButtonBarVisible( state ); | 409 | setJumpButtonBarVisible( state ); |
358 | /*US | 410 | /*US |
359 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 411 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
360 | if ( splitterSize.count() == 0 ) { | 412 | if ( splitterSize.count() == 0 ) { |
361 | splitterSize.append( width() / 2 ); | 413 | splitterSize.append( width() / 2 ); |
362 | splitterSize.append( width() / 2 ); | 414 | splitterSize.append( width() / 2 ); |
363 | } | 415 | } |
364 | mMiniSplitter->setSizes( splitterSize ); | 416 | mMiniSplitter->setSizes( splitterSize ); |
365 | if ( mExtensionBarSplitter ) { | 417 | if ( mExtensionBarSplitter ) { |
366 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 418 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
367 | if ( splitterSize.count() == 0 ) { | 419 | if ( splitterSize.count() == 0 ) { |
368 | splitterSize.append( width() / 2 ); | 420 | splitterSize.append( width() / 2 ); |
369 | splitterSize.append( width() / 2 ); | 421 | splitterSize.append( width() / 2 ); |
370 | } | 422 | } |
371 | mExtensionBarSplitter->setSizes( splitterSize ); | 423 | mExtensionBarSplitter->setSizes( splitterSize ); |
372 | 424 | ||
373 | } | 425 | } |
374 | */ | 426 | */ |
375 | mViewManager->restoreSettings(); | 427 | mViewManager->restoreSettings(); |
376 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 428 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
377 | mExtensionManager->restoreSettings(); | 429 | mExtensionManager->restoreSettings(); |
378 | #ifdef DESKTOP_VERSION | 430 | #ifdef DESKTOP_VERSION |
379 | int wid = width(); | 431 | int wid = width(); |
380 | if ( wid < 10 ) | 432 | if ( wid < 10 ) |
381 | wid = 400; | 433 | wid = 400; |
382 | #else | 434 | #else |
383 | int wid = QApplication::desktop()->width(); | 435 | int wid = QApplication::desktop()->width(); |
384 | if ( wid < 640 ) | 436 | if ( wid < 640 ) |
385 | wid = QApplication::desktop()->height(); | 437 | wid = QApplication::desktop()->height(); |
386 | #endif | 438 | #endif |
387 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 439 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
388 | if ( true /*splitterSize.count() == 0*/ ) { | 440 | if ( true /*splitterSize.count() == 0*/ ) { |
389 | splitterSize.append( wid / 2 ); | 441 | splitterSize.append( wid / 2 ); |
390 | splitterSize.append( wid / 2 ); | 442 | splitterSize.append( wid / 2 ); |
391 | } | 443 | } |
392 | mMiniSplitter->setSizes( splitterSize ); | 444 | mMiniSplitter->setSizes( splitterSize ); |
393 | if ( mExtensionBarSplitter ) { | 445 | if ( mExtensionBarSplitter ) { |
394 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 446 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
395 | if ( true /*splitterSize.count() == 0*/ ) { | 447 | if ( true /*splitterSize.count() == 0*/ ) { |
396 | splitterSize.append( wid / 2 ); | 448 | splitterSize.append( wid / 2 ); |
397 | splitterSize.append( wid / 2 ); | 449 | splitterSize.append( wid / 2 ); |
398 | } | 450 | } |
399 | mExtensionBarSplitter->setSizes( splitterSize ); | 451 | mExtensionBarSplitter->setSizes( splitterSize ); |
400 | 452 | ||
401 | } | 453 | } |
402 | 454 | ||
403 | 455 | ||
404 | } | 456 | } |
405 | 457 | ||
406 | void KABCore::saveSettings() | 458 | void KABCore::saveSettings() |
407 | { | 459 | { |
408 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 460 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
409 | if ( mExtensionBarSplitter ) | 461 | if ( mExtensionBarSplitter ) |
410 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 462 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
411 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 463 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
412 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 464 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
413 | #ifndef KAB_EMBEDDED | 465 | #ifndef KAB_EMBEDDED |
414 | 466 | ||
415 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 467 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
416 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 468 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
417 | #endif //KAB_EMBEDDED | 469 | #endif //KAB_EMBEDDED |
418 | mExtensionManager->saveSettings(); | 470 | mExtensionManager->saveSettings(); |
419 | mViewManager->saveSettings(); | 471 | mViewManager->saveSettings(); |
420 | 472 | ||
421 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 473 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
422 | } | 474 | } |
423 | 475 | ||
424 | KABC::AddressBook *KABCore::addressBook() const | 476 | KABC::AddressBook *KABCore::addressBook() const |
425 | { | 477 | { |
426 | return mAddressBook; | 478 | return mAddressBook; |
427 | } | 479 | } |
428 | 480 | ||
429 | KConfig *KABCore::config() | 481 | KConfig *KABCore::config() |
430 | { | 482 | { |
431 | #ifndef KAB_EMBEDDED | 483 | #ifndef KAB_EMBEDDED |
432 | return KABPrefs::instance()->config(); | 484 | return KABPrefs::instance()->config(); |
433 | #else //KAB_EMBEDDED | 485 | #else //KAB_EMBEDDED |
434 | return KABPrefs::instance()->getConfig(); | 486 | return KABPrefs::instance()->getConfig(); |
435 | #endif //KAB_EMBEDDED | 487 | #endif //KAB_EMBEDDED |
436 | } | 488 | } |
437 | 489 | ||
438 | KActionCollection *KABCore::actionCollection() const | 490 | KActionCollection *KABCore::actionCollection() const |
439 | { | 491 | { |
440 | return mGUIClient->actionCollection(); | 492 | return mGUIClient->actionCollection(); |
441 | } | 493 | } |
442 | 494 | ||
443 | KABC::Field *KABCore::currentSearchField() const | 495 | KABC::Field *KABCore::currentSearchField() const |
444 | { | 496 | { |
445 | if (mIncSearchWidget) | 497 | if (mIncSearchWidget) |
446 | return mIncSearchWidget->currentField(); | 498 | return mIncSearchWidget->currentField(); |
447 | else | 499 | else |
448 | return 0; | 500 | return 0; |
449 | } | 501 | } |
450 | 502 | ||
451 | QStringList KABCore::selectedUIDs() const | 503 | QStringList KABCore::selectedUIDs() const |
452 | { | 504 | { |
453 | return mViewManager->selectedUids(); | 505 | return mViewManager->selectedUids(); |
454 | } | 506 | } |
455 | 507 | ||
456 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 508 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
457 | { | 509 | { |
458 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 510 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
459 | 511 | ||
460 | QPtrList<KRES::Resource> kresResources; | 512 | QPtrList<KRES::Resource> kresResources; |
461 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 513 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
462 | KABC::Resource *resource; | 514 | KABC::Resource *resource; |
463 | while ( ( resource = resIt.current() ) != 0 ) { | 515 | while ( ( resource = resIt.current() ) != 0 ) { |
464 | ++resIt; | 516 | ++resIt; |
465 | if ( !resource->readOnly() ) { | 517 | if ( !resource->readOnly() ) { |
466 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 518 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
467 | if ( res ) | 519 | if ( res ) |
468 | kresResources.append( res ); | 520 | kresResources.append( res ); |
469 | } | 521 | } |
470 | } | 522 | } |
471 | 523 | ||
472 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 524 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
473 | return static_cast<KABC::Resource*>( res ); | 525 | return static_cast<KABC::Resource*>( res ); |
474 | } | 526 | } |
475 | 527 | ||
476 | #ifndef KAB_EMBEDDED | 528 | #ifndef KAB_EMBEDDED |
477 | KAboutData *KABCore::createAboutData() | 529 | KAboutData *KABCore::createAboutData() |
478 | #else //KAB_EMBEDDED | 530 | #else //KAB_EMBEDDED |
479 | void KABCore::createAboutData() | 531 | void KABCore::createAboutData() |
480 | #endif //KAB_EMBEDDED | 532 | #endif //KAB_EMBEDDED |
481 | { | 533 | { |
482 | #ifndef KAB_EMBEDDED | 534 | #ifndef KAB_EMBEDDED |
483 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 535 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
484 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 536 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
485 | KAboutData::License_GPL_V2, | 537 | KAboutData::License_GPL_V2, |
486 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 538 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
487 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 539 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
488 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 540 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
489 | about->addAuthor( "Cornelius Schumacher", | 541 | about->addAuthor( "Cornelius Schumacher", |
490 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 542 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
491 | "schumacher@kde.org" ); | 543 | "schumacher@kde.org" ); |
492 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 544 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
493 | "mpilone@slac.com" ); | 545 | "mpilone@slac.com" ); |
494 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 546 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
495 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 547 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
496 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 548 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
497 | "michel@klaralvdalens-datakonsult.se" ); | 549 | "michel@klaralvdalens-datakonsult.se" ); |
498 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 550 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
499 | "hansen@kde.org" ); | 551 | "hansen@kde.org" ); |
500 | 552 | ||
501 | return about; | 553 | return about; |
502 | #endif //KAB_EMBEDDED | 554 | #endif //KAB_EMBEDDED |
503 | 555 | ||
504 | QString version; | 556 | QString version; |
505 | #include <../version> | 557 | #include <../version> |
506 | QMessageBox::about( this, "About KAddressbook/Pi", | 558 | QMessageBox::about( this, "About KAddressbook/Pi", |
507 | "KAddressbook/Platform-independent\n" | 559 | "KAddressbook/Platform-independent\n" |
508 | "(KA/Pi) " +version + " - " + | 560 | "(KA/Pi) " +version + " - " + |
509 | #ifdef DESKTOP_VERSION | 561 | #ifdef DESKTOP_VERSION |
510 | "Desktop Edition\n" | 562 | "Desktop Edition\n" |
511 | #else | 563 | #else |
512 | "PDA-Edition\n" | 564 | "PDA-Edition\n" |
513 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 565 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
514 | #endif | 566 | #endif |
515 | 567 | ||
516 | "(c) 2004 Ulf Schenk\n" | 568 | "(c) 2004 Ulf Schenk\n" |
517 | "(c) 2004 Lutz Rogowski\n" | 569 | "(c) 2004 Lutz Rogowski\n" |
518 | "(c) 1997-2003, The KDE PIM Team\n" | 570 | "(c) 1997-2003, The KDE PIM Team\n" |
519 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 571 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
520 | "Don Sanders Original author\n" | 572 | "Don Sanders Original author\n" |
521 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 573 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
522 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 574 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
523 | "Greg Stern DCOP interface\n" | 575 | "Greg Stern DCOP interface\n" |
524 | "Mark Westcot Contact pinning\n" | 576 | "Mark Westcot Contact pinning\n" |
525 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 577 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
526 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 578 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
527 | #ifdef _WIN32_ | 579 | #ifdef _WIN32_ |
528 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 580 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
529 | #endif | 581 | #endif |
530 | ); | 582 | ); |
531 | } | 583 | } |
532 | 584 | ||
533 | void KABCore::setContactSelected( const QString &uid ) | 585 | void KABCore::setContactSelected( const QString &uid ) |
534 | { | 586 | { |
535 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 587 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
536 | if ( !mDetails->isHidden() ) | 588 | if ( !mDetails->isHidden() ) |
537 | mDetails->setAddressee( addr ); | 589 | mDetails->setAddressee( addr ); |
538 | 590 | ||
539 | if ( !addr.isEmpty() ) { | 591 | if ( !addr.isEmpty() ) { |
540 | emit contactSelected( addr.formattedName() ); | 592 | emit contactSelected( addr.formattedName() ); |
541 | KABC::Picture pic = addr.photo(); | 593 | KABC::Picture pic = addr.photo(); |
542 | if ( pic.isIntern() ) { | 594 | if ( pic.isIntern() ) { |
543 | //US emit contactSelected( pic.data() ); | 595 | //US emit contactSelected( pic.data() ); |
544 | //US instead use: | 596 | //US instead use: |
545 | QPixmap px; | 597 | QPixmap px; |
546 | if (pic.data().isNull() != true) | 598 | if (pic.data().isNull() != true) |
547 | { | 599 | { |
548 | px.convertFromImage(pic.data()); | 600 | px.convertFromImage(pic.data()); |
549 | } | 601 | } |
550 | 602 | ||
551 | emit contactSelected( px ); | 603 | emit contactSelected( px ); |
552 | } | 604 | } |
553 | } | 605 | } |
554 | 606 | ||
555 | 607 | ||
556 | mExtensionManager->setSelectionChanged(); | 608 | mExtensionManager->setSelectionChanged(); |
557 | 609 | ||
558 | // update the actions | 610 | // update the actions |
559 | bool selected = !uid.isEmpty(); | 611 | bool selected = !uid.isEmpty(); |
560 | 612 | ||
561 | if ( mReadWrite ) { | 613 | if ( mReadWrite ) { |
562 | mActionCut->setEnabled( selected ); | 614 | mActionCut->setEnabled( selected ); |
563 | mActionPaste->setEnabled( selected ); | 615 | mActionPaste->setEnabled( selected ); |
564 | } | 616 | } |
565 | 617 | ||
566 | mActionCopy->setEnabled( selected ); | 618 | mActionCopy->setEnabled( selected ); |
567 | mActionDelete->setEnabled( selected ); | 619 | mActionDelete->setEnabled( selected ); |
568 | mActionEditAddressee->setEnabled( selected ); | 620 | mActionEditAddressee->setEnabled( selected ); |
569 | mActionMail->setEnabled( selected ); | 621 | mActionMail->setEnabled( selected ); |
570 | mActionMailVCard->setEnabled( selected ); | 622 | mActionMailVCard->setEnabled( selected ); |
571 | //if (mActionBeam) | 623 | //if (mActionBeam) |
572 | //mActionBeam->setEnabled( selected ); | 624 | //mActionBeam->setEnabled( selected ); |
573 | 625 | ||
574 | if (mActionBeamVCard) | 626 | if (mActionBeamVCard) |
575 | mActionBeamVCard->setEnabled( selected ); | 627 | mActionBeamVCard->setEnabled( selected ); |
576 | 628 | ||
577 | mActionExport2phone->setEnabled( selected ); | 629 | mActionExport2phone->setEnabled( selected ); |
578 | mActionWhoAmI->setEnabled( selected ); | 630 | mActionWhoAmI->setEnabled( selected ); |
579 | mActionCategories->setEnabled( selected ); | 631 | mActionCategories->setEnabled( selected ); |
580 | } | 632 | } |
581 | 633 | ||
582 | void KABCore::sendMail() | 634 | void KABCore::sendMail() |
583 | { | 635 | { |
584 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 636 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
585 | } | 637 | } |
586 | 638 | ||
587 | void KABCore::sendMail( const QString& emaillist ) | 639 | void KABCore::sendMail( const QString& emaillist ) |
588 | { | 640 | { |
589 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 641 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
590 | if (emaillist.contains(",") > 0) | 642 | if (emaillist.contains(",") > 0) |
591 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 643 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
592 | else | 644 | else |
593 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 645 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
594 | } | 646 | } |
595 | 647 | ||
596 | 648 | ||
597 | 649 | ||
598 | void KABCore::mailVCard() | 650 | void KABCore::mailVCard() |
599 | { | 651 | { |
600 | QStringList uids = mViewManager->selectedUids(); | 652 | QStringList uids = mViewManager->selectedUids(); |
601 | if ( !uids.isEmpty() ) | 653 | if ( !uids.isEmpty() ) |
602 | mailVCard( uids ); | 654 | mailVCard( uids ); |
603 | } | 655 | } |
604 | 656 | ||
605 | void KABCore::mailVCard( const QStringList& uids ) | 657 | void KABCore::mailVCard( const QStringList& uids ) |
606 | { | 658 | { |
607 | QStringList urls; | 659 | QStringList urls; |
608 | 660 | ||
609 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 661 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
610 | 662 | ||
611 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 663 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
612 | 664 | ||
613 | 665 | ||
614 | 666 | ||
615 | QDir().mkdir( dirName, true ); | 667 | QDir().mkdir( dirName, true ); |
616 | 668 | ||
617 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 669 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
618 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 670 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
619 | 671 | ||
620 | if ( a.isEmpty() ) | 672 | if ( a.isEmpty() ) |
621 | continue; | 673 | continue; |
622 | 674 | ||
623 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 675 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
624 | 676 | ||
625 | QString fileName = dirName + "/" + name; | 677 | QString fileName = dirName + "/" + name; |
626 | 678 | ||
627 | QFile outFile(fileName); | 679 | QFile outFile(fileName); |
628 | 680 | ||
629 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 681 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
630 | KABC::VCardConverter converter; | 682 | KABC::VCardConverter converter; |
631 | QString vcard; | 683 | QString vcard; |
632 | 684 | ||
633 | converter.addresseeToVCard( a, vcard ); | 685 | converter.addresseeToVCard( a, vcard ); |
634 | 686 | ||
635 | QTextStream t( &outFile ); // use a text stream | 687 | QTextStream t( &outFile ); // use a text stream |
636 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 688 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
637 | t << vcard; | 689 | t << vcard; |
638 | 690 | ||
639 | outFile.close(); | 691 | outFile.close(); |
640 | 692 | ||
641 | urls.append( fileName ); | 693 | urls.append( fileName ); |
642 | } | 694 | } |
643 | } | 695 | } |
644 | 696 | ||
645 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 697 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
646 | 698 | ||
647 | 699 | ||
648 | /*US | 700 | /*US |
649 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 701 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
650 | QString::null, // subject | 702 | QString::null, // subject |
651 | QString::null, // body | 703 | QString::null, // body |
652 | QString::null, | 704 | QString::null, |
653 | urls ); // attachments | 705 | urls ); // attachments |
654 | */ | 706 | */ |
655 | 707 | ||
656 | } | 708 | } |
657 | 709 | ||
658 | /** | 710 | /** |
659 | Beams the "WhoAmI contact. | 711 | Beams the "WhoAmI contact. |
660 | */ | 712 | */ |
661 | void KABCore::beamMySelf() | 713 | void KABCore::beamMySelf() |
662 | { | 714 | { |
663 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 715 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
664 | if (!a.isEmpty()) | 716 | if (!a.isEmpty()) |
665 | { | 717 | { |
666 | QStringList uids; | 718 | QStringList uids; |
667 | uids << a.uid(); | 719 | uids << a.uid(); |
668 | 720 | ||
669 | beamVCard(uids); | 721 | beamVCard(uids); |
670 | } else { | 722 | } else { |
671 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 723 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
672 | 724 | ||
673 | 725 | ||
674 | } | 726 | } |
675 | } | 727 | } |
676 | 728 | ||
677 | void KABCore::export2phone() | 729 | void KABCore::export2phone() |
678 | { | 730 | { |
679 | 731 | ||
680 | KAex2phonePrefs ex2phone; | 732 | KAex2phonePrefs ex2phone; |
681 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 733 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
682 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 734 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
683 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 735 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
684 | 736 | ||
685 | if ( !ex2phone.exec() ) { | 737 | if ( !ex2phone.exec() ) { |
686 | return; | 738 | return; |
687 | } | 739 | } |
688 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 740 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
689 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 741 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
690 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 742 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
691 | 743 | ||
692 | 744 | ||
693 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 745 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
694 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 746 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
695 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 747 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
696 | 748 | ||
697 | QStringList uids = mViewManager->selectedUids(); | 749 | QStringList uids = mViewManager->selectedUids(); |
698 | if ( uids.isEmpty() ) | 750 | if ( uids.isEmpty() ) |
699 | return; | 751 | return; |
700 | 752 | ||
701 | QString fileName = getPhoneFile(); | 753 | QString fileName = getPhoneFile(); |
702 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 754 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
703 | return; | 755 | return; |
704 | 756 | ||
705 | message(i18n("Exporting to phone...")); | 757 | message(i18n("Exporting to phone...")); |
706 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 758 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
707 | 759 | ||
708 | } | 760 | } |
709 | QString KABCore::getPhoneFile() | 761 | QString KABCore::getPhoneFile() |
710 | { | 762 | { |
711 | #ifdef DESKTOP_VERSION | 763 | #ifdef DESKTOP_VERSION |
712 | return locateLocal("tmp", "phonefile.vcf"); | 764 | return locateLocal("tmp", "phonefile.vcf"); |
713 | #else | 765 | #else |
714 | return "/tmp/phonefile.vcf"; | 766 | return "/tmp/phonefile.vcf"; |
@@ -1403,938 +1455,946 @@ void KABCore::print() | |||
1403 | #ifndef KAB_EMBEDDED | 1455 | #ifndef KAB_EMBEDDED |
1404 | KPrinter printer; | 1456 | KPrinter printer; |
1405 | if ( !printer.setup( this ) ) | 1457 | if ( !printer.setup( this ) ) |
1406 | return; | 1458 | return; |
1407 | 1459 | ||
1408 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1460 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1409 | mViewManager->selectedUids(), this ); | 1461 | mViewManager->selectedUids(), this ); |
1410 | 1462 | ||
1411 | wizard.exec(); | 1463 | wizard.exec(); |
1412 | #else //KAB_EMBEDDED | 1464 | #else //KAB_EMBEDDED |
1413 | qDebug("KABCore::print() finsih method"); | 1465 | qDebug("KABCore::print() finsih method"); |
1414 | #endif //KAB_EMBEDDED | 1466 | #endif //KAB_EMBEDDED |
1415 | 1467 | ||
1416 | } | 1468 | } |
1417 | 1469 | ||
1418 | 1470 | ||
1419 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1471 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1420 | { | 1472 | { |
1421 | if ( mGUIClient ) | 1473 | if ( mGUIClient ) |
1422 | mGUIClient->insertChildClient( client ); | 1474 | mGUIClient->insertChildClient( client ); |
1423 | else | 1475 | else |
1424 | KMessageBox::error( this, "no KXMLGUICLient"); | 1476 | KMessageBox::error( this, "no KXMLGUICLient"); |
1425 | } | 1477 | } |
1426 | 1478 | ||
1427 | 1479 | ||
1428 | void KABCore::configurationChanged() | 1480 | void KABCore::configurationChanged() |
1429 | { | 1481 | { |
1430 | mExtensionManager->reconfigure(); | 1482 | mExtensionManager->reconfigure(); |
1431 | } | 1483 | } |
1432 | 1484 | ||
1433 | void KABCore::addressBookChanged() | 1485 | void KABCore::addressBookChanged() |
1434 | { | 1486 | { |
1435 | /*US | 1487 | /*US |
1436 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1488 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1437 | while ( it.current() ) { | 1489 | while ( it.current() ) { |
1438 | if ( it.current()->dirty() ) { | 1490 | if ( it.current()->dirty() ) { |
1439 | QString text = i18n( "Data has been changed externally. Unsaved " | 1491 | QString text = i18n( "Data has been changed externally. Unsaved " |
1440 | "changes will be lost." ); | 1492 | "changes will be lost." ); |
1441 | KMessageBox::information( this, text ); | 1493 | KMessageBox::information( this, text ); |
1442 | } | 1494 | } |
1443 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1495 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1444 | ++it; | 1496 | ++it; |
1445 | } | 1497 | } |
1446 | */ | 1498 | */ |
1447 | if (mEditorDialog) | 1499 | if (mEditorDialog) |
1448 | { | 1500 | { |
1449 | if (mEditorDialog->dirty()) | 1501 | if (mEditorDialog->dirty()) |
1450 | { | 1502 | { |
1451 | QString text = i18n( "Data has been changed externally. Unsaved " | 1503 | QString text = i18n( "Data has been changed externally. Unsaved " |
1452 | "changes will be lost." ); | 1504 | "changes will be lost." ); |
1453 | KMessageBox::information( this, text ); | 1505 | KMessageBox::information( this, text ); |
1454 | } | 1506 | } |
1455 | QString currentuid = mEditorDialog->addressee().uid(); | 1507 | QString currentuid = mEditorDialog->addressee().uid(); |
1456 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1508 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1457 | } | 1509 | } |
1458 | mViewManager->refreshView(); | 1510 | mViewManager->refreshView(); |
1459 | // mDetails->refreshView(); | 1511 | // mDetails->refreshView(); |
1460 | 1512 | ||
1461 | 1513 | ||
1462 | } | 1514 | } |
1463 | 1515 | ||
1464 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1516 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1465 | const char *name ) | 1517 | const char *name ) |
1466 | { | 1518 | { |
1467 | 1519 | ||
1468 | if ( mEditorDialog == 0 ) { | 1520 | if ( mEditorDialog == 0 ) { |
1469 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1521 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1470 | name ? name : "editorDialog" ); | 1522 | name ? name : "editorDialog" ); |
1471 | 1523 | ||
1472 | 1524 | ||
1473 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1525 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1474 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1526 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1475 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1527 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1476 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1528 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1477 | } | 1529 | } |
1478 | 1530 | ||
1479 | return mEditorDialog; | 1531 | return mEditorDialog; |
1480 | } | 1532 | } |
1481 | 1533 | ||
1482 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1534 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1483 | { | 1535 | { |
1484 | //mEditorDict.remove( uid ); | 1536 | //mEditorDict.remove( uid ); |
1485 | } | 1537 | } |
1486 | 1538 | ||
1487 | void KABCore::initGUI() | 1539 | void KABCore::initGUI() |
1488 | { | 1540 | { |
1489 | #ifndef KAB_EMBEDDED | 1541 | #ifndef KAB_EMBEDDED |
1490 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1542 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1491 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1543 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1492 | 1544 | ||
1493 | mExtensionBarSplitter = new QSplitter( this ); | 1545 | mExtensionBarSplitter = new QSplitter( this ); |
1494 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1546 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1495 | 1547 | ||
1496 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1548 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1497 | 1549 | ||
1498 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1550 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1499 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1551 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1500 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1552 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1501 | SLOT( incrementalSearch( const QString& ) ) ); | 1553 | SLOT( incrementalSearch( const QString& ) ) ); |
1502 | 1554 | ||
1503 | mViewManager = new ViewManager( this, viewSpace ); | 1555 | mViewManager = new ViewManager( this, viewSpace ); |
1504 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1556 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1505 | 1557 | ||
1506 | mDetails = new ViewContainer( mDetailsSplitter ); | 1558 | mDetails = new ViewContainer( mDetailsSplitter ); |
1507 | 1559 | ||
1508 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1560 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1509 | 1561 | ||
1510 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1562 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1511 | 1563 | ||
1512 | topLayout->addWidget( mExtensionBarSplitter ); | 1564 | topLayout->addWidget( mExtensionBarSplitter ); |
1513 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1565 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1514 | topLayout->addWidget( mJumpButtonBar ); | 1566 | topLayout->addWidget( mJumpButtonBar ); |
1515 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1567 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1516 | 1568 | ||
1517 | mXXPortManager = new XXPortManager( this, this ); | 1569 | mXXPortManager = new XXPortManager( this, this ); |
1518 | 1570 | ||
1519 | #else //KAB_EMBEDDED | 1571 | #else //KAB_EMBEDDED |
1520 | //US initialize viewMenu before settingup viewmanager. | 1572 | //US initialize viewMenu before settingup viewmanager. |
1521 | // Viewmanager needs this menu to plugin submenues. | 1573 | // Viewmanager needs this menu to plugin submenues. |
1522 | viewMenu = new QPopupMenu( this ); | 1574 | viewMenu = new QPopupMenu( this ); |
1523 | settingsMenu = new QPopupMenu( this ); | 1575 | settingsMenu = new QPopupMenu( this ); |
1524 | //filterMenu = new QPopupMenu( this ); | 1576 | //filterMenu = new QPopupMenu( this ); |
1525 | ImportMenu = new QPopupMenu( this ); | 1577 | ImportMenu = new QPopupMenu( this ); |
1526 | ExportMenu = new QPopupMenu( this ); | 1578 | ExportMenu = new QPopupMenu( this ); |
1527 | syncMenu = new QPopupMenu( this ); | 1579 | syncMenu = new QPopupMenu( this ); |
1528 | changeMenu= new QPopupMenu( this ); | 1580 | changeMenu= new QPopupMenu( this ); |
1529 | 1581 | ||
1530 | //US since we have no splitter for the embedded system, setup | 1582 | //US since we have no splitter for the embedded system, setup |
1531 | // a layout with two frames. One left and one right. | 1583 | // a layout with two frames. One left and one right. |
1532 | 1584 | ||
1533 | QBoxLayout *topLayout; | 1585 | QBoxLayout *topLayout; |
1534 | 1586 | ||
1535 | // = new QHBoxLayout( this ); | 1587 | // = new QHBoxLayout( this ); |
1536 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1588 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1537 | 1589 | ||
1538 | // QWidget *mainBox = new QWidget( this ); | 1590 | // QWidget *mainBox = new QWidget( this ); |
1539 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1591 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1540 | 1592 | ||
1541 | #ifdef DESKTOP_VERSION | 1593 | #ifdef DESKTOP_VERSION |
1542 | topLayout = new QHBoxLayout( this ); | 1594 | topLayout = new QHBoxLayout( this ); |
1543 | 1595 | ||
1544 | 1596 | ||
1545 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1597 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1546 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1598 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1547 | 1599 | ||
1548 | topLayout->addWidget(mMiniSplitter ); | 1600 | topLayout->addWidget(mMiniSplitter ); |
1549 | 1601 | ||
1550 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1602 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1551 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1603 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1552 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1604 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1553 | mDetails = new ViewContainer( mMiniSplitter ); | 1605 | mDetails = new ViewContainer( mMiniSplitter ); |
1554 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1606 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1555 | #else | 1607 | #else |
1556 | if ( QApplication::desktop()->width() > 480 ) { | 1608 | if ( QApplication::desktop()->width() > 480 ) { |
1557 | topLayout = new QHBoxLayout( this ); | 1609 | topLayout = new QHBoxLayout( this ); |
1558 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1610 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1559 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1611 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1560 | } else { | 1612 | } else { |
1561 | 1613 | ||
1562 | topLayout = new QHBoxLayout( this ); | 1614 | topLayout = new QHBoxLayout( this ); |
1563 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1615 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1564 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1616 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1565 | } | 1617 | } |
1566 | 1618 | ||
1567 | topLayout->addWidget(mMiniSplitter ); | 1619 | topLayout->addWidget(mMiniSplitter ); |
1568 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1620 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1569 | mDetails = new ViewContainer( mMiniSplitter ); | 1621 | mDetails = new ViewContainer( mMiniSplitter ); |
1570 | 1622 | ||
1571 | 1623 | ||
1572 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1624 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1573 | #endif | 1625 | #endif |
1574 | //eh->hide(); | 1626 | //eh->hide(); |
1575 | // topLayout->addWidget(mExtensionManager ); | 1627 | // topLayout->addWidget(mExtensionManager ); |
1576 | 1628 | ||
1577 | 1629 | ||
1578 | /*US | 1630 | /*US |
1579 | #ifndef KAB_NOSPLITTER | 1631 | #ifndef KAB_NOSPLITTER |
1580 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1632 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1581 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1633 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1582 | topLayout->setSpacing( 10 ); | 1634 | topLayout->setSpacing( 10 ); |
1583 | 1635 | ||
1584 | mDetailsSplitter = new QSplitter( this ); | 1636 | mDetailsSplitter = new QSplitter( this ); |
1585 | 1637 | ||
1586 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1638 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1587 | 1639 | ||
1588 | mViewManager = new ViewManager( this, viewSpace ); | 1640 | mViewManager = new ViewManager( this, viewSpace ); |
1589 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1641 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1590 | 1642 | ||
1591 | mDetails = new ViewContainer( mDetailsSplitter ); | 1643 | mDetails = new ViewContainer( mDetailsSplitter ); |
1592 | 1644 | ||
1593 | topLayout->addWidget( mDetailsSplitter ); | 1645 | topLayout->addWidget( mDetailsSplitter ); |
1594 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1646 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1595 | #else //KAB_NOSPLITTER | 1647 | #else //KAB_NOSPLITTER |
1596 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1648 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1597 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1649 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1598 | topLayout->setSpacing( 10 ); | 1650 | topLayout->setSpacing( 10 ); |
1599 | 1651 | ||
1600 | // mDetailsSplitter = new QSplitter( this ); | 1652 | // mDetailsSplitter = new QSplitter( this ); |
1601 | 1653 | ||
1602 | QVBox *viewSpace = new QVBox( this ); | 1654 | QVBox *viewSpace = new QVBox( this ); |
1603 | 1655 | ||
1604 | mViewManager = new ViewManager( this, viewSpace ); | 1656 | mViewManager = new ViewManager( this, viewSpace ); |
1605 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1657 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1606 | 1658 | ||
1607 | mDetails = new ViewContainer( this ); | 1659 | mDetails = new ViewContainer( this ); |
1608 | 1660 | ||
1609 | topLayout->addWidget( viewSpace ); | 1661 | topLayout->addWidget( viewSpace ); |
1610 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1662 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1611 | topLayout->addWidget( mDetails ); | 1663 | topLayout->addWidget( mDetails ); |
1612 | #endif //KAB_NOSPLITTER | 1664 | #endif //KAB_NOSPLITTER |
1613 | */ | 1665 | */ |
1614 | 1666 | ||
1615 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1667 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1616 | syncManager->setBlockSave(false); | 1668 | syncManager->setBlockSave(false); |
1617 | 1669 | ||
1618 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1670 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1619 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1671 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1620 | syncManager->setDefaultFileName( sentSyncFile()); | 1672 | syncManager->setDefaultFileName( sentSyncFile()); |
1621 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1673 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1622 | 1674 | ||
1623 | #endif //KAB_EMBEDDED | 1675 | #endif //KAB_EMBEDDED |
1624 | initActions(); | 1676 | initActions(); |
1625 | 1677 | ||
1626 | #ifdef KAB_EMBEDDED | 1678 | #ifdef KAB_EMBEDDED |
1627 | addActionsManually(); | 1679 | addActionsManually(); |
1628 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1680 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1629 | mXXPortManager = new XXPortManager( this, this ); | 1681 | mXXPortManager = new XXPortManager( this, this ); |
1630 | 1682 | ||
1631 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1683 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1632 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1684 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1633 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1685 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1634 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1686 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1635 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1687 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1636 | // mIncSearchWidget->hide(); | 1688 | // mIncSearchWidget->hide(); |
1637 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1689 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1638 | SLOT( incrementalSearch( const QString& ) ) ); | 1690 | SLOT( incrementalSearch( const QString& ) ) ); |
1639 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1691 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1640 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1692 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1641 | 1693 | ||
1642 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1694 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1643 | 1695 | ||
1644 | topLayout->addWidget( mJumpButtonBar ); | 1696 | topLayout->addWidget( mJumpButtonBar ); |
1645 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1697 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1646 | 1698 | ||
1647 | // mMainWindow->getIconToolBar()->raise(); | 1699 | // mMainWindow->getIconToolBar()->raise(); |
1648 | 1700 | ||
1649 | #endif //KAB_EMBEDDED | 1701 | #endif //KAB_EMBEDDED |
1650 | 1702 | ||
1651 | } | 1703 | } |
1652 | void KABCore::initActions() | 1704 | void KABCore::initActions() |
1653 | { | 1705 | { |
1654 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1706 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1655 | 1707 | ||
1656 | #ifndef KAB_EMBEDDED | 1708 | #ifndef KAB_EMBEDDED |
1657 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1709 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1658 | SLOT( clipboardDataChanged() ) ); | 1710 | SLOT( clipboardDataChanged() ) ); |
1659 | #endif //KAB_EMBEDDED | 1711 | #endif //KAB_EMBEDDED |
1660 | 1712 | ||
1661 | // file menu | 1713 | // file menu |
1662 | if ( mIsPart ) { | 1714 | if ( mIsPart ) { |
1663 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1715 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1664 | SLOT( sendMail() ), actionCollection(), | 1716 | SLOT( sendMail() ), actionCollection(), |
1665 | "kaddressbook_mail" ); | 1717 | "kaddressbook_mail" ); |
1666 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1718 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1667 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1719 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1668 | 1720 | ||
1669 | } else { | 1721 | } else { |
1670 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1722 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1671 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1723 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1672 | } | 1724 | } |
1673 | 1725 | ||
1674 | 1726 | ||
1675 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1727 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1676 | SLOT( save() ), actionCollection(), "file_sync" ); | 1728 | SLOT( save() ), actionCollection(), "file_sync" ); |
1677 | 1729 | ||
1678 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1730 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1679 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1731 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1680 | 1732 | ||
1681 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1733 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1682 | this, SLOT( mailVCard() ), | 1734 | this, SLOT( mailVCard() ), |
1683 | actionCollection(), "file_mail_vcard"); | 1735 | actionCollection(), "file_mail_vcard"); |
1684 | 1736 | ||
1685 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1737 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, |
1686 | SLOT( export2phone() ), actionCollection(), | 1738 | SLOT( export2phone() ), actionCollection(), |
1687 | "kaddressbook_ex2phone" ); | 1739 | "kaddressbook_ex2phone" ); |
1688 | 1740 | ||
1689 | mActionBeamVCard = 0; | 1741 | mActionBeamVCard = 0; |
1690 | mActionBeam = 0; | 1742 | mActionBeam = 0; |
1691 | 1743 | ||
1692 | #ifndef DESKTOP_VERSION | 1744 | #ifndef DESKTOP_VERSION |
1693 | if ( Ir::supported() ) { | 1745 | if ( Ir::supported() ) { |
1694 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1746 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1695 | SLOT( beamVCard() ), actionCollection(), | 1747 | SLOT( beamVCard() ), actionCollection(), |
1696 | "kaddressbook_beam_vcard" ); | 1748 | "kaddressbook_beam_vcard" ); |
1697 | 1749 | ||
1698 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1750 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1699 | SLOT( beamMySelf() ), actionCollection(), | 1751 | SLOT( beamMySelf() ), actionCollection(), |
1700 | "kaddressbook_beam_myself" ); | 1752 | "kaddressbook_beam_myself" ); |
1701 | } | 1753 | } |
1702 | #endif | 1754 | #endif |
1703 | 1755 | ||
1704 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1756 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1705 | this, SLOT( editContact2() ), | 1757 | this, SLOT( editContact2() ), |
1706 | actionCollection(), "file_properties" ); | 1758 | actionCollection(), "file_properties" ); |
1707 | 1759 | ||
1708 | #ifdef KAB_EMBEDDED | 1760 | #ifdef KAB_EMBEDDED |
1709 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1761 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1710 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1762 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1711 | mMainWindow, SLOT( exit() ), | 1763 | mMainWindow, SLOT( exit() ), |
1712 | actionCollection(), "quit" ); | 1764 | actionCollection(), "quit" ); |
1713 | #endif //KAB_EMBEDDED | 1765 | #endif //KAB_EMBEDDED |
1714 | 1766 | ||
1715 | // edit menu | 1767 | // edit menu |
1716 | if ( mIsPart ) { | 1768 | if ( mIsPart ) { |
1717 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1769 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1718 | SLOT( copyContacts() ), actionCollection(), | 1770 | SLOT( copyContacts() ), actionCollection(), |
1719 | "kaddressbook_copy" ); | 1771 | "kaddressbook_copy" ); |
1720 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1772 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1721 | SLOT( cutContacts() ), actionCollection(), | 1773 | SLOT( cutContacts() ), actionCollection(), |
1722 | "kaddressbook_cut" ); | 1774 | "kaddressbook_cut" ); |
1723 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1775 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1724 | SLOT( pasteContacts() ), actionCollection(), | 1776 | SLOT( pasteContacts() ), actionCollection(), |
1725 | "kaddressbook_paste" ); | 1777 | "kaddressbook_paste" ); |
1726 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1778 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1727 | SLOT( selectAllContacts() ), actionCollection(), | 1779 | SLOT( selectAllContacts() ), actionCollection(), |
1728 | "kaddressbook_select_all" ); | 1780 | "kaddressbook_select_all" ); |
1729 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1781 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1730 | SLOT( undo() ), actionCollection(), | 1782 | SLOT( undo() ), actionCollection(), |
1731 | "kaddressbook_undo" ); | 1783 | "kaddressbook_undo" ); |
1732 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1784 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1733 | this, SLOT( redo() ), actionCollection(), | 1785 | this, SLOT( redo() ), actionCollection(), |
1734 | "kaddressbook_redo" ); | 1786 | "kaddressbook_redo" ); |
1735 | } else { | 1787 | } else { |
1736 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1788 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1737 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1789 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1738 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1790 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1739 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1791 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1740 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1792 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1741 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1793 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1742 | } | 1794 | } |
1743 | 1795 | ||
1744 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1796 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1745 | Key_Delete, this, SLOT( deleteContacts() ), | 1797 | Key_Delete, this, SLOT( deleteContacts() ), |
1746 | actionCollection(), "edit_delete" ); | 1798 | actionCollection(), "edit_delete" ); |
1747 | 1799 | ||
1748 | mActionUndo->setEnabled( false ); | 1800 | mActionUndo->setEnabled( false ); |
1749 | mActionRedo->setEnabled( false ); | 1801 | mActionRedo->setEnabled( false ); |
1750 | 1802 | ||
1751 | // settings menu | 1803 | // settings menu |
1752 | #ifdef KAB_EMBEDDED | 1804 | #ifdef KAB_EMBEDDED |
1753 | //US special menuentry to configure the addressbook resources. On KDE | 1805 | //US special menuentry to configure the addressbook resources. On KDE |
1754 | // you do that through the control center !!! | 1806 | // you do that through the control center !!! |
1755 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1807 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1756 | SLOT( configureResources() ), actionCollection(), | 1808 | SLOT( configureResources() ), actionCollection(), |
1757 | "kaddressbook_configure_resources" ); | 1809 | "kaddressbook_configure_resources" ); |
1758 | #endif //KAB_EMBEDDED | 1810 | #endif //KAB_EMBEDDED |
1759 | 1811 | ||
1760 | if ( mIsPart ) { | 1812 | if ( mIsPart ) { |
1761 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1813 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1762 | SLOT( openConfigDialog() ), actionCollection(), | 1814 | SLOT( openConfigDialog() ), actionCollection(), |
1763 | "kaddressbook_configure" ); | 1815 | "kaddressbook_configure" ); |
1764 | 1816 | ||
1765 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1817 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1766 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1818 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1767 | "kaddressbook_configure_shortcuts" ); | 1819 | "kaddressbook_configure_shortcuts" ); |
1768 | #ifdef KAB_EMBEDDED | 1820 | #ifdef KAB_EMBEDDED |
1769 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1821 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1770 | mActionConfigureToolbars->setEnabled( false ); | 1822 | mActionConfigureToolbars->setEnabled( false ); |
1771 | #endif //KAB_EMBEDDED | 1823 | #endif //KAB_EMBEDDED |
1772 | 1824 | ||
1773 | } else { | 1825 | } else { |
1774 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1826 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1775 | 1827 | ||
1776 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1828 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1777 | } | 1829 | } |
1778 | 1830 | ||
1779 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1831 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1780 | actionCollection(), "options_show_jump_bar" ); | 1832 | actionCollection(), "options_show_jump_bar" ); |
1781 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1833 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1782 | 1834 | ||
1783 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1835 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1784 | actionCollection(), "options_show_details" ); | 1836 | actionCollection(), "options_show_details" ); |
1785 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1837 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1786 | 1838 | ||
1839 | |||
1840 | mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this, | ||
1841 | SLOT( toggleBeamReceive() ), actionCollection(), | ||
1842 | "kaddressbook_beam_rec" ); | ||
1843 | |||
1844 | |||
1787 | // misc | 1845 | // misc |
1788 | // only enable LDAP lookup if we can handle the protocol | 1846 | // only enable LDAP lookup if we can handle the protocol |
1789 | #ifndef KAB_EMBEDDED | 1847 | #ifndef KAB_EMBEDDED |
1790 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1848 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1791 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1849 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1792 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1850 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1793 | "ldap_lookup" ); | 1851 | "ldap_lookup" ); |
1794 | } | 1852 | } |
1795 | #else //KAB_EMBEDDED | 1853 | #else //KAB_EMBEDDED |
1796 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1854 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1797 | #endif //KAB_EMBEDDED | 1855 | #endif //KAB_EMBEDDED |
1798 | 1856 | ||
1799 | 1857 | ||
1800 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1858 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1801 | SLOT( setWhoAmI() ), actionCollection(), | 1859 | SLOT( setWhoAmI() ), actionCollection(), |
1802 | "set_personal" ); | 1860 | "set_personal" ); |
1803 | 1861 | ||
1804 | 1862 | ||
1805 | 1863 | ||
1806 | 1864 | ||
1807 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1865 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1808 | SLOT( setCategories() ), actionCollection(), | 1866 | SLOT( setCategories() ), actionCollection(), |
1809 | "edit_set_categories" ); | 1867 | "edit_set_categories" ); |
1810 | 1868 | ||
1811 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1869 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1812 | SLOT( removeVoice() ), actionCollection(), | 1870 | SLOT( removeVoice() ), actionCollection(), |
1813 | "remove_voice" ); | 1871 | "remove_voice" ); |
1814 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1872 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1815 | SLOT( importFromOL() ), actionCollection(), | 1873 | SLOT( importFromOL() ), actionCollection(), |
1816 | "import_OL" ); | 1874 | "import_OL" ); |
1817 | #ifdef KAB_EMBEDDED | 1875 | #ifdef KAB_EMBEDDED |
1818 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1876 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1819 | this, SLOT( showLicence() ), actionCollection(), | 1877 | this, SLOT( showLicence() ), actionCollection(), |
1820 | "licence_about_data" ); | 1878 | "licence_about_data" ); |
1821 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1879 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1822 | this, SLOT( faq() ), actionCollection(), | 1880 | this, SLOT( faq() ), actionCollection(), |
1823 | "faq_about_data" ); | 1881 | "faq_about_data" ); |
1824 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1882 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1825 | this, SLOT( whatsnew() ), actionCollection(), | 1883 | this, SLOT( whatsnew() ), actionCollection(), |
1826 | "wn" ); | 1884 | "wn" ); |
1827 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1885 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1828 | this, SLOT( synchowto() ), actionCollection(), | 1886 | this, SLOT( synchowto() ), actionCollection(), |
1829 | "sync" ); | 1887 | "sync" ); |
1830 | 1888 | ||
1831 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1889 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1832 | this, SLOT( createAboutData() ), actionCollection(), | 1890 | this, SLOT( createAboutData() ), actionCollection(), |
1833 | "kaddressbook_about_data" ); | 1891 | "kaddressbook_about_data" ); |
1834 | #endif //KAB_EMBEDDED | 1892 | #endif //KAB_EMBEDDED |
1835 | 1893 | ||
1836 | clipboardDataChanged(); | 1894 | clipboardDataChanged(); |
1837 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1895 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1838 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1896 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1839 | } | 1897 | } |
1840 | 1898 | ||
1841 | //US we need this function, to plug all actions into the correct menues. | 1899 | //US we need this function, to plug all actions into the correct menues. |
1842 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1900 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1843 | void KABCore::addActionsManually() | 1901 | void KABCore::addActionsManually() |
1844 | { | 1902 | { |
1845 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1903 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1846 | 1904 | ||
1847 | #ifdef KAB_EMBEDDED | 1905 | #ifdef KAB_EMBEDDED |
1848 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1906 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1849 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1907 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1850 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1908 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1851 | 1909 | ||
1852 | KToolBar* tb = mMainWindow->toolBar(); | 1910 | KToolBar* tb = mMainWindow->toolBar(); |
1853 | 1911 | ||
1854 | #ifdef DESKTOP_VERSION | 1912 | #ifdef DESKTOP_VERSION |
1855 | QMenuBar* mb = mMainWindow->menuBar(); | 1913 | QMenuBar* mb = mMainWindow->menuBar(); |
1856 | 1914 | ||
1857 | //US setup menubar. | 1915 | //US setup menubar. |
1858 | //Disable the following block if you do not want to have a menubar. | 1916 | //Disable the following block if you do not want to have a menubar. |
1859 | mb->insertItem( "&File", fileMenu ); | 1917 | mb->insertItem( "&File", fileMenu ); |
1860 | mb->insertItem( "&Edit", editMenu ); | 1918 | mb->insertItem( "&Edit", editMenu ); |
1861 | mb->insertItem( "&View", viewMenu ); | 1919 | mb->insertItem( "&View", viewMenu ); |
1862 | mb->insertItem( "&Settings", settingsMenu ); | 1920 | mb->insertItem( "&Settings", settingsMenu ); |
1863 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 1921 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1864 | mb->insertItem( "&Change selected", changeMenu ); | 1922 | mb->insertItem( "&Change selected", changeMenu ); |
1865 | mb->insertItem( "&Help", helpMenu ); | 1923 | mb->insertItem( "&Help", helpMenu ); |
1866 | mIncSearchWidget = new IncSearchWidget( tb ); | 1924 | mIncSearchWidget = new IncSearchWidget( tb ); |
1867 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1925 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1868 | 1926 | ||
1869 | #else | 1927 | #else |
1870 | //US setup toolbar | 1928 | //US setup toolbar |
1871 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1929 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1872 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1930 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1873 | menuBarTB->insertItem( "ME", popupBarTB); | 1931 | menuBarTB->insertItem( "ME", popupBarTB); |
1874 | tb->insertWidget(-1, 0, menuBarTB); | 1932 | tb->insertWidget(-1, 0, menuBarTB); |
1875 | mIncSearchWidget = new IncSearchWidget( tb ); | 1933 | mIncSearchWidget = new IncSearchWidget( tb ); |
1876 | 1934 | ||
1877 | tb->enableMoving(false); | 1935 | tb->enableMoving(false); |
1878 | popupBarTB->insertItem( "&File", fileMenu ); | 1936 | popupBarTB->insertItem( "&File", fileMenu ); |
1879 | popupBarTB->insertItem( "&Edit", editMenu ); | 1937 | popupBarTB->insertItem( "&Edit", editMenu ); |
1880 | popupBarTB->insertItem( "&View", viewMenu ); | 1938 | popupBarTB->insertItem( "&View", viewMenu ); |
1881 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1939 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1882 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1940 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
1883 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1941 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1884 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1942 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1885 | popupBarTB->insertItem( "&Help", helpMenu ); | 1943 | popupBarTB->insertItem( "&Help", helpMenu ); |
1886 | if (QApplication::desktop()->width() > 320 ) { | 1944 | if (QApplication::desktop()->width() > 320 ) { |
1887 | // mViewManager->getFilterAction()->plug ( tb); | 1945 | // mViewManager->getFilterAction()->plug ( tb); |
1888 | } | 1946 | } |
1889 | #endif | 1947 | #endif |
1890 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1948 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1891 | 1949 | ||
1892 | 1950 | ||
1893 | 1951 | ||
1894 | //US Now connect the actions with the menue entries. | 1952 | //US Now connect the actions with the menue entries. |
1895 | mActionPrint->plug( fileMenu ); | 1953 | mActionPrint->plug( fileMenu ); |
1896 | mActionMail->plug( fileMenu ); | 1954 | mActionMail->plug( fileMenu ); |
1897 | fileMenu->insertSeparator(); | 1955 | fileMenu->insertSeparator(); |
1898 | 1956 | ||
1899 | mActionNewContact->plug( fileMenu ); | 1957 | mActionNewContact->plug( fileMenu ); |
1900 | mActionNewContact->plug( tb ); | 1958 | mActionNewContact->plug( tb ); |
1901 | 1959 | ||
1902 | mActionEditAddressee->plug( fileMenu ); | 1960 | mActionEditAddressee->plug( fileMenu ); |
1903 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1961 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1904 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1962 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1905 | mActionEditAddressee->plug( tb ); | 1963 | mActionEditAddressee->plug( tb ); |
1906 | 1964 | ||
1907 | fileMenu->insertSeparator(); | 1965 | fileMenu->insertSeparator(); |
1908 | mActionSave->plug( fileMenu ); | 1966 | mActionSave->plug( fileMenu ); |
1909 | fileMenu->insertItem( "&Import", ImportMenu ); | 1967 | fileMenu->insertItem( "&Import", ImportMenu ); |
1910 | fileMenu->insertItem( "&Export", ExportMenu ); | 1968 | fileMenu->insertItem( "&Export", ExportMenu ); |
1911 | fileMenu->insertSeparator(); | 1969 | fileMenu->insertSeparator(); |
1912 | mActionMailVCard->plug( fileMenu ); | 1970 | mActionMailVCard->plug( fileMenu ); |
1913 | #ifndef DESKTOP_VERSION | 1971 | #ifndef DESKTOP_VERSION |
1914 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1972 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1915 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1973 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1916 | #endif | 1974 | #endif |
1917 | fileMenu->insertSeparator(); | 1975 | fileMenu->insertSeparator(); |
1918 | mActionQuit->plug( fileMenu ); | 1976 | mActionQuit->plug( fileMenu ); |
1919 | #ifdef _WIN32_ | 1977 | #ifdef _WIN32_ |
1920 | mActionImportOL->plug( ImportMenu ); | 1978 | mActionImportOL->plug( ImportMenu ); |
1921 | #endif | 1979 | #endif |
1922 | // edit menu | 1980 | // edit menu |
1923 | mActionUndo->plug( editMenu ); | 1981 | mActionUndo->plug( editMenu ); |
1924 | mActionRedo->plug( editMenu ); | 1982 | mActionRedo->plug( editMenu ); |
1925 | editMenu->insertSeparator(); | 1983 | editMenu->insertSeparator(); |
1926 | mActionCut->plug( editMenu ); | 1984 | mActionCut->plug( editMenu ); |
1927 | mActionCopy->plug( editMenu ); | 1985 | mActionCopy->plug( editMenu ); |
1928 | mActionPaste->plug( editMenu ); | 1986 | mActionPaste->plug( editMenu ); |
1929 | mActionDelete->plug( editMenu ); | 1987 | mActionDelete->plug( editMenu ); |
1930 | editMenu->insertSeparator(); | 1988 | editMenu->insertSeparator(); |
1931 | mActionSelectAll->plug( editMenu ); | 1989 | mActionSelectAll->plug( editMenu ); |
1932 | 1990 | ||
1933 | mActionRemoveVoice->plug( changeMenu ); | 1991 | mActionRemoveVoice->plug( changeMenu ); |
1934 | // settings menu | 1992 | // settings menu |
1935 | //US special menuentry to configure the addressbook resources. On KDE | 1993 | //US special menuentry to configure the addressbook resources. On KDE |
1936 | // you do that through the control center !!! | 1994 | // you do that through the control center !!! |
1937 | mActionConfigResources->plug( settingsMenu ); | 1995 | mActionConfigResources->plug( settingsMenu ); |
1938 | settingsMenu->insertSeparator(); | 1996 | settingsMenu->insertSeparator(); |
1939 | 1997 | ||
1940 | mActionConfigKAddressbook->plug( settingsMenu ); | 1998 | mActionConfigKAddressbook->plug( settingsMenu ); |
1941 | 1999 | ||
1942 | if ( mIsPart ) { | 2000 | if ( mIsPart ) { |
1943 | mActionConfigShortcuts->plug( settingsMenu ); | 2001 | mActionConfigShortcuts->plug( settingsMenu ); |
1944 | mActionConfigureToolbars->plug( settingsMenu ); | 2002 | mActionConfigureToolbars->plug( settingsMenu ); |
1945 | 2003 | ||
1946 | } else { | 2004 | } else { |
1947 | mActionKeyBindings->plug( settingsMenu ); | 2005 | mActionKeyBindings->plug( settingsMenu ); |
1948 | } | 2006 | } |
1949 | 2007 | ||
1950 | settingsMenu->insertSeparator(); | 2008 | settingsMenu->insertSeparator(); |
1951 | 2009 | ||
1952 | mActionJumpBar->plug( settingsMenu ); | 2010 | mActionJumpBar->plug( settingsMenu ); |
1953 | mActionDetails->plug( settingsMenu ); | 2011 | mActionDetails->plug( settingsMenu ); |
1954 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2012 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1955 | mActionDetails->plug( tb ); | 2013 | mActionDetails->plug( tb ); |
1956 | settingsMenu->insertSeparator(); | 2014 | settingsMenu->insertSeparator(); |
2015 | mActionBR->plug(settingsMenu ); | ||
2016 | settingsMenu->insertSeparator(); | ||
1957 | 2017 | ||
1958 | mActionWhoAmI->plug( settingsMenu ); | 2018 | mActionWhoAmI->plug( settingsMenu ); |
1959 | mActionCategories->plug( settingsMenu ); | 2019 | mActionCategories->plug( settingsMenu ); |
1960 | 2020 | ||
1961 | 2021 | ||
1962 | mActionWN->plug( helpMenu ); | 2022 | mActionWN->plug( helpMenu ); |
1963 | mActionSyncHowto->plug( helpMenu ); | 2023 | mActionSyncHowto->plug( helpMenu ); |
1964 | mActionLicence->plug( helpMenu ); | 2024 | mActionLicence->plug( helpMenu ); |
1965 | mActionFaq->plug( helpMenu ); | 2025 | mActionFaq->plug( helpMenu ); |
1966 | mActionAboutKAddressbook->plug( helpMenu ); | 2026 | mActionAboutKAddressbook->plug( helpMenu ); |
1967 | 2027 | ||
1968 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2028 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1969 | 2029 | ||
1970 | mActionSave->plug( tb ); | 2030 | mActionSave->plug( tb ); |
1971 | mViewManager->getFilterAction()->plug ( tb); | 2031 | mViewManager->getFilterAction()->plug ( tb); |
1972 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2032 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1973 | mActionUndo->plug( tb ); | 2033 | mActionUndo->plug( tb ); |
1974 | mActionDelete->plug( tb ); | 2034 | mActionDelete->plug( tb ); |
1975 | mActionRedo->plug( tb ); | 2035 | mActionRedo->plug( tb ); |
1976 | } | 2036 | } |
1977 | } | 2037 | } |
1978 | //mActionQuit->plug ( tb ); | 2038 | //mActionQuit->plug ( tb ); |
1979 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2039 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1980 | 2040 | ||
1981 | //US link the searchwidget first to this. | 2041 | //US link the searchwidget first to this. |
1982 | // The real linkage to the toolbar happens later. | 2042 | // The real linkage to the toolbar happens later. |
1983 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2043 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1984 | //US tb->insertItem( mIncSearchWidget ); | 2044 | //US tb->insertItem( mIncSearchWidget ); |
1985 | /*US | 2045 | /*US |
1986 | mIncSearchWidget = new IncSearchWidget( tb ); | 2046 | mIncSearchWidget = new IncSearchWidget( tb ); |
1987 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2047 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1988 | SLOT( incrementalSearch( const QString& ) ) ); | 2048 | SLOT( incrementalSearch( const QString& ) ) ); |
1989 | 2049 | ||
1990 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2050 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1991 | 2051 | ||
1992 | //US topLayout->addWidget( mJumpButtonBar ); | 2052 | //US topLayout->addWidget( mJumpButtonBar ); |
1993 | this->layout()->add( mJumpButtonBar ); | 2053 | this->layout()->add( mJumpButtonBar ); |
1994 | */ | 2054 | */ |
1995 | 2055 | ||
1996 | #endif //KAB_EMBEDDED | 2056 | #endif //KAB_EMBEDDED |
1997 | 2057 | ||
1998 | mActionExport2phone->plug( ExportMenu ); | 2058 | mActionExport2phone->plug( ExportMenu ); |
1999 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2059 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2000 | syncManager->fillSyncMenu(); | 2060 | syncManager->fillSyncMenu(); |
2001 | 2061 | ||
2002 | } | 2062 | } |
2003 | void KABCore::showLicence() | 2063 | void KABCore::showLicence() |
2004 | { | 2064 | { |
2005 | KApplication::showLicence(); | 2065 | KApplication::showLicence(); |
2006 | } | 2066 | } |
2007 | void KABCore::removeVoice() | 2067 | void KABCore::removeVoice() |
2008 | { | 2068 | { |
2009 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2069 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2010 | return; | 2070 | return; |
2011 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2071 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2012 | KABC::Addressee::List::Iterator it; | 2072 | KABC::Addressee::List::Iterator it; |
2013 | for ( it = list.begin(); it != list.end(); ++it ) { | 2073 | for ( it = list.begin(); it != list.end(); ++it ) { |
2014 | 2074 | ||
2015 | if ( (*it).removeVoice() ) | 2075 | if ( (*it).removeVoice() ) |
2016 | contactModified((*it) ); | 2076 | contactModified((*it) ); |
2017 | } | 2077 | } |
2018 | } | 2078 | } |
2019 | 2079 | ||
2020 | 2080 | ||
2021 | 2081 | ||
2022 | void KABCore::clipboardDataChanged() | 2082 | void KABCore::clipboardDataChanged() |
2023 | { | 2083 | { |
2024 | 2084 | ||
2025 | if ( mReadWrite ) | 2085 | if ( mReadWrite ) |
2026 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2086 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2027 | 2087 | ||
2028 | } | 2088 | } |
2029 | 2089 | ||
2030 | void KABCore::updateActionMenu() | 2090 | void KABCore::updateActionMenu() |
2031 | { | 2091 | { |
2032 | UndoStack *undo = UndoStack::instance(); | 2092 | UndoStack *undo = UndoStack::instance(); |
2033 | RedoStack *redo = RedoStack::instance(); | 2093 | RedoStack *redo = RedoStack::instance(); |
2034 | 2094 | ||
2035 | if ( undo->isEmpty() ) | 2095 | if ( undo->isEmpty() ) |
2036 | mActionUndo->setText( i18n( "Undo" ) ); | 2096 | mActionUndo->setText( i18n( "Undo" ) ); |
2037 | else | 2097 | else |
2038 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2098 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2039 | 2099 | ||
2040 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2100 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2041 | 2101 | ||
2042 | if ( !redo->top() ) | 2102 | if ( !redo->top() ) |
2043 | mActionRedo->setText( i18n( "Redo" ) ); | 2103 | mActionRedo->setText( i18n( "Redo" ) ); |
2044 | else | 2104 | else |
2045 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2105 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2046 | 2106 | ||
2047 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2107 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2048 | } | 2108 | } |
2049 | 2109 | ||
2050 | void KABCore::configureKeyBindings() | 2110 | void KABCore::configureKeyBindings() |
2051 | { | 2111 | { |
2052 | #ifndef KAB_EMBEDDED | 2112 | #ifndef KAB_EMBEDDED |
2053 | KKeyDialog::configure( actionCollection(), true ); | 2113 | KKeyDialog::configure( actionCollection(), true ); |
2054 | #else //KAB_EMBEDDED | 2114 | #else //KAB_EMBEDDED |
2055 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2115 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2056 | #endif //KAB_EMBEDDED | 2116 | #endif //KAB_EMBEDDED |
2057 | } | 2117 | } |
2058 | 2118 | ||
2059 | #ifdef KAB_EMBEDDED | 2119 | #ifdef KAB_EMBEDDED |
2060 | void KABCore::configureResources() | 2120 | void KABCore::configureResources() |
2061 | { | 2121 | { |
2062 | KRES::KCMKResources dlg( this, "" , 0 ); | 2122 | KRES::KCMKResources dlg( this, "" , 0 ); |
2063 | 2123 | ||
2064 | if ( !dlg.exec() ) | 2124 | if ( !dlg.exec() ) |
2065 | return; | 2125 | return; |
2066 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2126 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2067 | } | 2127 | } |
2068 | #endif //KAB_EMBEDDED | 2128 | #endif //KAB_EMBEDDED |
2069 | 2129 | ||
2070 | 2130 | ||
2071 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2131 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2072 | * for the attendees list of an event. | 2132 | * for the attendees list of an event. |
2073 | */ | 2133 | */ |
2074 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2134 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2075 | { | 2135 | { |
2076 | QStringList nameList; | 2136 | QStringList nameList; |
2077 | QStringList emailList; | 2137 | QStringList emailList; |
2078 | QStringList uidList; | 2138 | QStringList uidList; |
2079 | 2139 | ||
2080 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2140 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2081 | uint i=0; | 2141 | uint i=0; |
2082 | for (i=0; i < list.count(); i++) | 2142 | for (i=0; i < list.count(); i++) |
2083 | { | 2143 | { |
2084 | nameList.append(list[i].realName()); | 2144 | nameList.append(list[i].realName()); |
2085 | emailList.append(list[i].preferredEmail()); | 2145 | emailList.append(list[i].preferredEmail()); |
2086 | uidList.append(list[i].uid()); | 2146 | uidList.append(list[i].uid()); |
2087 | } | 2147 | } |
2088 | 2148 | ||
2089 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2149 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2090 | 2150 | ||
2091 | } | 2151 | } |
2092 | 2152 | ||
2093 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2153 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2094 | * to put them into the calendar. | 2154 | * to put them into the calendar. |
2095 | */ | 2155 | */ |
2096 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2156 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2097 | { | 2157 | { |
2098 | // qDebug("KABCore::requestForBirthdayList"); | 2158 | // qDebug("KABCore::requestForBirthdayList"); |
2099 | QStringList birthdayList; | 2159 | QStringList birthdayList; |
2100 | QStringList anniversaryList; | 2160 | QStringList anniversaryList; |
2101 | QStringList realNameList; | 2161 | QStringList realNameList; |
2102 | QStringList preferredEmailList; | 2162 | QStringList preferredEmailList; |
2103 | QStringList assembledNameList; | 2163 | QStringList assembledNameList; |
2104 | QStringList uidList; | 2164 | QStringList uidList; |
2105 | 2165 | ||
2106 | KABC::AddressBook::Iterator it; | 2166 | KABC::AddressBook::Iterator it; |
2107 | 2167 | ||
2108 | int count = 0; | 2168 | int count = 0; |
2109 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2169 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2110 | ++count; | 2170 | ++count; |
2111 | } | 2171 | } |
2112 | QProgressBar bar(count,0 ); | 2172 | QProgressBar bar(count,0 ); |
2113 | int w = 300; | 2173 | int w = 300; |
2114 | if ( QApplication::desktop()->width() < 320 ) | 2174 | if ( QApplication::desktop()->width() < 320 ) |
2115 | w = 220; | 2175 | w = 220; |
2116 | int h = bar.sizeHint().height() ; | 2176 | int h = bar.sizeHint().height() ; |
2117 | int dw = QApplication::desktop()->width(); | 2177 | int dw = QApplication::desktop()->width(); |
2118 | int dh = QApplication::desktop()->height(); | 2178 | int dh = QApplication::desktop()->height(); |
2119 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2179 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2120 | bar.show(); | 2180 | bar.show(); |
2121 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2181 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2122 | qApp->processEvents(); | 2182 | qApp->processEvents(); |
2123 | 2183 | ||
2124 | QDate bday; | 2184 | QDate bday; |
2125 | QString anni; | 2185 | QString anni; |
2126 | QString formattedbday; | 2186 | QString formattedbday; |
2127 | 2187 | ||
2128 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2188 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2129 | { | 2189 | { |
2130 | if ( ! bar.isVisible() ) | 2190 | if ( ! bar.isVisible() ) |
2131 | return; | 2191 | return; |
2132 | bar.setProgress( count++ ); | 2192 | bar.setProgress( count++ ); |
2133 | qApp->processEvents(); | 2193 | qApp->processEvents(); |
2134 | bday = (*it).birthday().date(); | 2194 | bday = (*it).birthday().date(); |
2135 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2195 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2136 | 2196 | ||
2137 | if ( bday.isValid() || !anni.isEmpty()) | 2197 | if ( bday.isValid() || !anni.isEmpty()) |
2138 | { | 2198 | { |
2139 | if (bday.isValid()) | 2199 | if (bday.isValid()) |
2140 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2200 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2141 | else | 2201 | else |
2142 | formattedbday = "NOTVALID"; | 2202 | formattedbday = "NOTVALID"; |
2143 | if (anni.isEmpty()) | 2203 | if (anni.isEmpty()) |
2144 | anni = "INVALID"; | 2204 | anni = "INVALID"; |
2145 | 2205 | ||
2146 | birthdayList.append(formattedbday); | 2206 | birthdayList.append(formattedbday); |
2147 | anniversaryList.append(anni); //should be ISODate | 2207 | anniversaryList.append(anni); //should be ISODate |
2148 | realNameList.append((*it).realName()); | 2208 | realNameList.append((*it).realName()); |
2149 | preferredEmailList.append((*it).preferredEmail()); | 2209 | preferredEmailList.append((*it).preferredEmail()); |
2150 | assembledNameList.append((*it).assembledName()); | 2210 | assembledNameList.append((*it).assembledName()); |
2151 | uidList.append((*it).uid()); | 2211 | uidList.append((*it).uid()); |
2152 | 2212 | ||
2153 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2213 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2154 | } | 2214 | } |
2155 | } | 2215 | } |
2156 | 2216 | ||
2157 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2217 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2158 | 2218 | ||
2159 | } | 2219 | } |
2160 | 2220 | ||
2161 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2221 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2162 | */ | 2222 | */ |
2163 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2223 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2164 | { | 2224 | { |
2165 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2225 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2166 | 2226 | ||
2167 | QString foundUid = QString::null; | 2227 | QString foundUid = QString::null; |
2168 | if ( ! uid.isEmpty() ) { | 2228 | if ( ! uid.isEmpty() ) { |
2169 | Addressee adrr = mAddressBook->findByUid( uid ); | 2229 | Addressee adrr = mAddressBook->findByUid( uid ); |
2170 | if ( !adrr.isEmpty() ) { | 2230 | if ( !adrr.isEmpty() ) { |
2171 | foundUid = uid; | 2231 | foundUid = uid; |
2172 | } | 2232 | } |
2173 | if ( email == "sendbacklist" ) { | 2233 | if ( email == "sendbacklist" ) { |
2174 | //qDebug("ssssssssssssssssssssssend "); | 2234 | //qDebug("ssssssssssssssssssssssend "); |
2175 | QStringList nameList; | 2235 | QStringList nameList; |
2176 | QStringList emailList; | 2236 | QStringList emailList; |
2177 | QStringList uidList; | 2237 | QStringList uidList; |
2178 | nameList.append(adrr.realName()); | 2238 | nameList.append(adrr.realName()); |
2179 | emailList = adrr.emails(); | 2239 | emailList = adrr.emails(); |
2180 | uidList.append( adrr.preferredEmail()); | 2240 | uidList.append( adrr.preferredEmail()); |
2181 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2241 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2182 | return; | 2242 | return; |
2183 | } | 2243 | } |
2184 | 2244 | ||
2185 | } | 2245 | } |
2186 | 2246 | ||
2187 | if ( email == "sendbacklist" ) | 2247 | if ( email == "sendbacklist" ) |
2188 | return; | 2248 | return; |
2189 | if (foundUid.isEmpty()) | 2249 | if (foundUid.isEmpty()) |
2190 | { | 2250 | { |
2191 | //find the uid of the person first | 2251 | //find the uid of the person first |
2192 | Addressee::List namelist; | 2252 | Addressee::List namelist; |
2193 | Addressee::List emaillist; | 2253 | Addressee::List emaillist; |
2194 | 2254 | ||
2195 | if (!name.isEmpty()) | 2255 | if (!name.isEmpty()) |
2196 | namelist = mAddressBook->findByName( name ); | 2256 | namelist = mAddressBook->findByName( name ); |
2197 | 2257 | ||
2198 | if (!email.isEmpty()) | 2258 | if (!email.isEmpty()) |
2199 | emaillist = mAddressBook->findByEmail( email ); | 2259 | emaillist = mAddressBook->findByEmail( email ); |
2200 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2260 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2201 | //check if we have a match in Namelist and Emaillist | 2261 | //check if we have a match in Namelist and Emaillist |
2202 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2262 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2203 | foundUid = emaillist[0].uid(); | 2263 | foundUid = emaillist[0].uid(); |
2204 | } | 2264 | } |
2205 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2265 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2206 | foundUid = namelist[0].uid(); | 2266 | foundUid = namelist[0].uid(); |
2207 | else | 2267 | else |
2208 | { | 2268 | { |
2209 | for (int i = 0; i < namelist.count(); i++) | 2269 | for (int i = 0; i < namelist.count(); i++) |
2210 | { | 2270 | { |
2211 | for (int j = 0; j < emaillist.count(); j++) | 2271 | for (int j = 0; j < emaillist.count(); j++) |
2212 | { | 2272 | { |
2213 | if (namelist[i] == emaillist[j]) | 2273 | if (namelist[i] == emaillist[j]) |
2214 | { | 2274 | { |
2215 | foundUid = namelist[i].uid(); | 2275 | foundUid = namelist[i].uid(); |
2216 | } | 2276 | } |
2217 | } | 2277 | } |
2218 | } | 2278 | } |
2219 | } | 2279 | } |
2220 | } | 2280 | } |
2221 | else | 2281 | else |
2222 | { | 2282 | { |
2223 | foundUid = uid; | 2283 | foundUid = uid; |
2224 | } | 2284 | } |
2225 | 2285 | ||
2226 | if (!foundUid.isEmpty()) | 2286 | if (!foundUid.isEmpty()) |
2227 | { | 2287 | { |
2228 | 2288 | ||
2229 | // raise Ka/Pi if it is in the background | 2289 | // raise Ka/Pi if it is in the background |
2230 | #ifndef DESKTOP_VERSION | 2290 | #ifndef DESKTOP_VERSION |
2231 | #ifndef KORG_NODCOP | 2291 | #ifndef KORG_NODCOP |
2232 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2292 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2233 | #endif | 2293 | #endif |
2234 | #endif | 2294 | #endif |
2235 | 2295 | ||
2236 | mMainWindow->showMaximized(); | 2296 | mMainWindow->showMaximized(); |
2237 | mMainWindow-> raise(); | 2297 | mMainWindow-> raise(); |
2238 | 2298 | ||
2239 | mViewManager->setSelected( "", false); | 2299 | mViewManager->setSelected( "", false); |
2240 | mViewManager->refreshView( "" ); | 2300 | mViewManager->refreshView( "" ); |
2241 | mViewManager->setSelected( foundUid, true ); | 2301 | mViewManager->setSelected( foundUid, true ); |
2242 | mViewManager->refreshView( foundUid ); | 2302 | mViewManager->refreshView( foundUid ); |
2243 | 2303 | ||
2244 | if ( !mMultipleViewsAtOnce ) | 2304 | if ( !mMultipleViewsAtOnce ) |
2245 | { | 2305 | { |
2246 | setDetailsVisible( true ); | 2306 | setDetailsVisible( true ); |
2247 | mActionDetails->setChecked(true); | 2307 | mActionDetails->setChecked(true); |
2248 | } | 2308 | } |
2249 | } | 2309 | } |
2250 | } | 2310 | } |
2251 | 2311 | ||
2252 | void KABCore::whatsnew() | 2312 | void KABCore::whatsnew() |
2253 | { | 2313 | { |
2254 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2314 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2255 | } | 2315 | } |
2256 | void KABCore::synchowto() | 2316 | void KABCore::synchowto() |
2257 | { | 2317 | { |
2258 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2318 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2259 | } | 2319 | } |
2260 | 2320 | ||
2261 | void KABCore::faq() | 2321 | void KABCore::faq() |
2262 | { | 2322 | { |
2263 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2323 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2264 | } | 2324 | } |
2265 | 2325 | ||
2266 | #include <libkcal/syncdefines.h> | 2326 | #include <libkcal/syncdefines.h> |
2267 | 2327 | ||
2268 | KABC::Addressee KABCore::getLastSyncAddressee() | 2328 | KABC::Addressee KABCore::getLastSyncAddressee() |
2269 | { | 2329 | { |
2270 | Addressee lse; | 2330 | Addressee lse; |
2271 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2331 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2272 | 2332 | ||
2273 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2333 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2274 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2334 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2275 | if (lse.isEmpty()) { | 2335 | if (lse.isEmpty()) { |
2276 | qDebug("Creating new last-syncAddressee "); | 2336 | qDebug("Creating new last-syncAddressee "); |
2277 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2337 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2278 | QString sum = ""; | 2338 | QString sum = ""; |
2279 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2339 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2280 | sum = "E: "; | 2340 | sum = "E: "; |
2281 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2341 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2282 | lse.setRevision( mLastAddressbookSync ); | 2342 | lse.setRevision( mLastAddressbookSync ); |
2283 | lse.setCategories( i18n("SyncEvent") ); | 2343 | lse.setCategories( i18n("SyncEvent") ); |
2284 | mAddressBook->insertAddressee( lse ); | 2344 | mAddressBook->insertAddressee( lse ); |
2285 | } | 2345 | } |
2286 | return lse; | 2346 | return lse; |
2287 | } | 2347 | } |
2288 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2348 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2289 | { | 2349 | { |
2290 | 2350 | ||
2291 | //void setZaurusId(int id); | 2351 | //void setZaurusId(int id); |
2292 | // int zaurusId() const; | 2352 | // int zaurusId() const; |
2293 | // void setZaurusUid(int id); | 2353 | // void setZaurusUid(int id); |
2294 | // int zaurusUid() const; | 2354 | // int zaurusUid() const; |
2295 | // void setZaurusStat(int id); | 2355 | // void setZaurusStat(int id); |
2296 | // int zaurusStat() const; | 2356 | // int zaurusStat() const; |
2297 | // 0 equal | 2357 | // 0 equal |
2298 | // 1 take local | 2358 | // 1 take local |
2299 | // 2 take remote | 2359 | // 2 take remote |
2300 | // 3 cancel | 2360 | // 3 cancel |
2301 | QDateTime lastSync = mLastAddressbookSync; | 2361 | QDateTime lastSync = mLastAddressbookSync; |
2302 | QDateTime localMod = local->revision(); | 2362 | QDateTime localMod = local->revision(); |
2303 | QDateTime remoteMod = remote->revision(); | 2363 | QDateTime remoteMod = remote->revision(); |
2304 | 2364 | ||
2305 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2365 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2306 | 2366 | ||
2307 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2367 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2308 | bool remCh, locCh; | 2368 | bool remCh, locCh; |
2309 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2369 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2310 | 2370 | ||
2311 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2371 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2312 | locCh = ( localMod > mLastAddressbookSync ); | 2372 | locCh = ( localMod > mLastAddressbookSync ); |
2313 | if ( !remCh && ! locCh ) { | 2373 | if ( !remCh && ! locCh ) { |
2314 | //qDebug("both not changed "); | 2374 | //qDebug("both not changed "); |
2315 | lastSync = localMod.addDays(1); | 2375 | lastSync = localMod.addDays(1); |
2316 | if ( mode <= SYNC_PREF_ASK ) | 2376 | if ( mode <= SYNC_PREF_ASK ) |
2317 | return 0; | 2377 | return 0; |
2318 | } else { | 2378 | } else { |
2319 | if ( locCh ) { | 2379 | if ( locCh ) { |
2320 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2380 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2321 | lastSync = localMod.addDays( -1 ); | 2381 | lastSync = localMod.addDays( -1 ); |
2322 | if ( !remCh ) | 2382 | if ( !remCh ) |
2323 | remoteMod =( lastSync.addDays( -1 ) ); | 2383 | remoteMod =( lastSync.addDays( -1 ) ); |
2324 | } else { | 2384 | } else { |
2325 | //qDebug(" not loc changed "); | 2385 | //qDebug(" not loc changed "); |
2326 | lastSync = localMod.addDays( 1 ); | 2386 | lastSync = localMod.addDays( 1 ); |
2327 | if ( remCh ) | 2387 | if ( remCh ) |
2328 | remoteMod =( lastSync.addDays( 1 ) ); | 2388 | remoteMod =( lastSync.addDays( 1 ) ); |
2329 | 2389 | ||
2330 | } | 2390 | } |
2331 | } | 2391 | } |
2332 | full = true; | 2392 | full = true; |
2333 | if ( mode < SYNC_PREF_ASK ) | 2393 | if ( mode < SYNC_PREF_ASK ) |
2334 | mode = SYNC_PREF_ASK; | 2394 | mode = SYNC_PREF_ASK; |
2335 | } else { | 2395 | } else { |
2336 | if ( localMod == remoteMod ) | 2396 | if ( localMod == remoteMod ) |
2337 | return 0; | 2397 | return 0; |
2338 | 2398 | ||
2339 | } | 2399 | } |
2340 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 2400 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
@@ -2366,472 +2426,474 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2366 | case SYNC_PREF_LOCAL: | 2426 | case SYNC_PREF_LOCAL: |
2367 | if ( lastSync > remoteMod ) | 2427 | if ( lastSync > remoteMod ) |
2368 | return 1; | 2428 | return 1; |
2369 | if ( lastSync > localMod ) | 2429 | if ( lastSync > localMod ) |
2370 | return 2; | 2430 | return 2; |
2371 | return 1; | 2431 | return 1; |
2372 | break; | 2432 | break; |
2373 | case SYNC_PREF_REMOTE: | 2433 | case SYNC_PREF_REMOTE: |
2374 | if ( lastSync > remoteMod ) | 2434 | if ( lastSync > remoteMod ) |
2375 | return 1; | 2435 | return 1; |
2376 | if ( lastSync > localMod ) | 2436 | if ( lastSync > localMod ) |
2377 | return 2; | 2437 | return 2; |
2378 | return 2; | 2438 | return 2; |
2379 | break; | 2439 | break; |
2380 | case SYNC_PREF_NEWEST: | 2440 | case SYNC_PREF_NEWEST: |
2381 | if ( localMod > remoteMod ) | 2441 | if ( localMod > remoteMod ) |
2382 | return 1; | 2442 | return 1; |
2383 | else | 2443 | else |
2384 | return 2; | 2444 | return 2; |
2385 | break; | 2445 | break; |
2386 | case SYNC_PREF_ASK: | 2446 | case SYNC_PREF_ASK: |
2387 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2447 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2388 | if ( lastSync > remoteMod ) | 2448 | if ( lastSync > remoteMod ) |
2389 | return 1; | 2449 | return 1; |
2390 | if ( lastSync > localMod ) | 2450 | if ( lastSync > localMod ) |
2391 | return 2; | 2451 | return 2; |
2392 | localIsNew = localMod >= remoteMod; | 2452 | localIsNew = localMod >= remoteMod; |
2393 | //qDebug("conflict! ************************************** "); | 2453 | //qDebug("conflict! ************************************** "); |
2394 | { | 2454 | { |
2395 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2455 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2396 | result = acd.executeD(localIsNew); | 2456 | result = acd.executeD(localIsNew); |
2397 | return result; | 2457 | return result; |
2398 | } | 2458 | } |
2399 | break; | 2459 | break; |
2400 | case SYNC_PREF_FORCE_LOCAL: | 2460 | case SYNC_PREF_FORCE_LOCAL: |
2401 | return 1; | 2461 | return 1; |
2402 | break; | 2462 | break; |
2403 | case SYNC_PREF_FORCE_REMOTE: | 2463 | case SYNC_PREF_FORCE_REMOTE: |
2404 | return 2; | 2464 | return 2; |
2405 | break; | 2465 | break; |
2406 | 2466 | ||
2407 | default: | 2467 | default: |
2408 | // SYNC_PREF_TAKE_BOTH not implemented | 2468 | // SYNC_PREF_TAKE_BOTH not implemented |
2409 | break; | 2469 | break; |
2410 | } | 2470 | } |
2411 | return 0; | 2471 | return 0; |
2412 | } | 2472 | } |
2413 | 2473 | ||
2414 | 2474 | ||
2415 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2475 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2416 | { | 2476 | { |
2417 | bool syncOK = true; | 2477 | bool syncOK = true; |
2418 | int addedAddressee = 0; | 2478 | int addedAddressee = 0; |
2419 | int addedAddresseeR = 0; | 2479 | int addedAddresseeR = 0; |
2420 | int deletedAddresseeR = 0; | 2480 | int deletedAddresseeR = 0; |
2421 | int deletedAddresseeL = 0; | 2481 | int deletedAddresseeL = 0; |
2422 | int changedLocal = 0; | 2482 | int changedLocal = 0; |
2423 | int changedRemote = 0; | 2483 | int changedRemote = 0; |
2424 | 2484 | ||
2425 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2485 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2426 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2486 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2427 | 2487 | ||
2428 | //QPtrList<Addressee> el = local->rawAddressees(); | 2488 | //QPtrList<Addressee> el = local->rawAddressees(); |
2429 | Addressee addresseeR; | 2489 | Addressee addresseeR; |
2430 | QString uid; | 2490 | QString uid; |
2431 | int take; | 2491 | int take; |
2432 | Addressee addresseeL; | 2492 | Addressee addresseeL; |
2433 | Addressee addresseeRSync; | 2493 | Addressee addresseeRSync; |
2434 | Addressee addresseeLSync; | 2494 | Addressee addresseeLSync; |
2435 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2495 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2436 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2496 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2437 | bool fullDateRange = false; | 2497 | bool fullDateRange = false; |
2438 | local->resetTempSyncStat(); | 2498 | local->resetTempSyncStat(); |
2439 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2499 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2440 | QDateTime modifiedCalendar = mLastAddressbookSync;; | 2500 | QDateTime modifiedCalendar = mLastAddressbookSync;; |
2441 | addresseeLSync = getLastSyncAddressee(); | 2501 | addresseeLSync = getLastSyncAddressee(); |
2442 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2502 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2443 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2503 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2444 | if ( !addresseeR.isEmpty() ) { | 2504 | if ( !addresseeR.isEmpty() ) { |
2445 | addresseeRSync = addresseeR; | 2505 | addresseeRSync = addresseeR; |
2446 | remote->removeAddressee(addresseeR ); | 2506 | remote->removeAddressee(addresseeR ); |
2447 | 2507 | ||
2448 | } else { | 2508 | } else { |
2449 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2509 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2450 | addresseeRSync = addresseeLSync ; | 2510 | addresseeRSync = addresseeLSync ; |
2451 | } else { | 2511 | } else { |
2452 | qDebug("FULLDATE 1"); | 2512 | qDebug("FULLDATE 1"); |
2453 | fullDateRange = true; | 2513 | fullDateRange = true; |
2454 | Addressee newAdd; | 2514 | Addressee newAdd; |
2455 | addresseeRSync = newAdd; | 2515 | addresseeRSync = newAdd; |
2456 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2516 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2457 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2517 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2458 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2518 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2459 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2519 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2460 | } | 2520 | } |
2461 | } | 2521 | } |
2462 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2522 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2463 | qDebug("FULLDATE 2"); | 2523 | qDebug("FULLDATE 2"); |
2464 | fullDateRange = true; | 2524 | fullDateRange = true; |
2465 | } | 2525 | } |
2466 | if ( ! fullDateRange ) { | 2526 | if ( ! fullDateRange ) { |
2467 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2527 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2468 | 2528 | ||
2469 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2529 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2470 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2530 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2471 | fullDateRange = true; | 2531 | fullDateRange = true; |
2472 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2532 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2473 | } | 2533 | } |
2474 | } | 2534 | } |
2475 | // fullDateRange = true; // debug only! | 2535 | // fullDateRange = true; // debug only! |
2476 | if ( fullDateRange ) | 2536 | if ( fullDateRange ) |
2477 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2537 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2478 | else | 2538 | else |
2479 | mLastAddressbookSync = addresseeLSync.revision(); | 2539 | mLastAddressbookSync = addresseeLSync.revision(); |
2480 | // for resyncing if own file has changed | 2540 | // for resyncing if own file has changed |
2481 | // PENDING fixme later when implemented | 2541 | // PENDING fixme later when implemented |
2482 | #if 0 | 2542 | #if 0 |
2483 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 2543 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
2484 | mLastAddressbookSync = loadedFileVersion; | 2544 | mLastAddressbookSync = loadedFileVersion; |
2485 | qDebug("setting mLastAddressbookSync "); | 2545 | qDebug("setting mLastAddressbookSync "); |
2486 | } | 2546 | } |
2487 | #endif | 2547 | #endif |
2488 | 2548 | ||
2489 | //qDebug("*************************** "); | 2549 | //qDebug("*************************** "); |
2490 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2550 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2491 | QStringList er = remote->uidList(); | 2551 | QStringList er = remote->uidList(); |
2492 | Addressee inR ;//= er.first(); | 2552 | Addressee inR ;//= er.first(); |
2493 | Addressee inL; | 2553 | Addressee inL; |
2494 | 2554 | ||
2495 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 2555 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
2496 | 2556 | ||
2497 | int modulo = (er.count()/10)+1; | 2557 | int modulo = (er.count()/10)+1; |
2498 | int incCounter = 0; | 2558 | int incCounter = 0; |
2499 | while ( incCounter < er.count()) { | 2559 | while ( incCounter < er.count()) { |
2500 | if (syncManager->isProgressBarCanceled()) | 2560 | if (syncManager->isProgressBarCanceled()) |
2501 | return false; | 2561 | return false; |
2502 | if ( incCounter % modulo == 0 ) | 2562 | if ( incCounter % modulo == 0 ) |
2503 | syncManager->showProgressBar(incCounter); | 2563 | syncManager->showProgressBar(incCounter); |
2504 | 2564 | ||
2505 | uid = er[ incCounter ]; | 2565 | uid = er[ incCounter ]; |
2506 | bool skipIncidence = false; | 2566 | bool skipIncidence = false; |
2507 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2567 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2508 | skipIncidence = true; | 2568 | skipIncidence = true; |
2509 | QString idS,OidS; | 2569 | QString idS,OidS; |
2510 | qApp->processEvents(); | 2570 | qApp->processEvents(); |
2511 | if ( !skipIncidence ) { | 2571 | if ( !skipIncidence ) { |
2512 | inL = local->findByUid( uid ); | 2572 | inL = local->findByUid( uid ); |
2513 | inR = remote->findByUid( uid ); | 2573 | inR = remote->findByUid( uid ); |
2514 | //inL.setResource( 0 ); | 2574 | //inL.setResource( 0 ); |
2515 | //inR.setResource( 0 ); | 2575 | //inR.setResource( 0 ); |
2516 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2576 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2517 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2577 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2518 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2578 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2519 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2579 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2520 | if ( take == 3 ) | 2580 | if ( take == 3 ) |
2521 | return false; | 2581 | return false; |
2522 | if ( take == 1 ) {// take local | 2582 | if ( take == 1 ) {// take local |
2523 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2583 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2524 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2584 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2525 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2585 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2526 | local->insertAddressee( inL, false ); | 2586 | local->insertAddressee( inL, false ); |
2527 | idS = inR.externalUID(); | 2587 | idS = inR.externalUID(); |
2528 | OidS = inR.originalExternalUID(); | 2588 | OidS = inR.originalExternalUID(); |
2529 | } | 2589 | } |
2530 | else | 2590 | else |
2531 | idS = inR.IDStr(); | 2591 | idS = inR.IDStr(); |
2532 | remote->removeAddressee( inR ); | 2592 | remote->removeAddressee( inR ); |
2533 | inR = inL; | 2593 | inR = inL; |
2534 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2594 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2535 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2595 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2536 | inR.setOriginalExternalUID( OidS ); | 2596 | inR.setOriginalExternalUID( OidS ); |
2537 | inR.setExternalUID( idS ); | 2597 | inR.setExternalUID( idS ); |
2538 | } else { | 2598 | } else { |
2539 | inR.setIDStr( idS ); | 2599 | inR.setIDStr( idS ); |
2540 | } | 2600 | } |
2541 | inR.setResource( 0 ); | 2601 | inR.setResource( 0 ); |
2542 | remote->insertAddressee( inR , false); | 2602 | remote->insertAddressee( inR , false); |
2543 | ++changedRemote; | 2603 | ++changedRemote; |
2544 | } else { // take == 2 take remote | 2604 | } else { // take == 2 take remote |
2545 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2605 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2546 | if ( inR.revision().date().year() < 2004 ) | 2606 | if ( inR.revision().date().year() < 2004 ) |
2547 | inR.setRevision( modifiedCalendar ); | 2607 | inR.setRevision( modifiedCalendar ); |
2548 | } | 2608 | } |
2549 | idS = inL.IDStr(); | 2609 | idS = inL.IDStr(); |
2550 | local->removeAddressee( inL ); | 2610 | local->removeAddressee( inL ); |
2551 | inL = inR; | 2611 | inL = inR; |
2552 | inL.setIDStr( idS ); | 2612 | inL.setIDStr( idS ); |
2553 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2613 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2554 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2614 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2555 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2615 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2556 | } | 2616 | } |
2557 | inL.setResource( 0 ); | 2617 | inL.setResource( 0 ); |
2558 | local->insertAddressee( inL , false ); | 2618 | local->insertAddressee( inL , false ); |
2559 | ++changedLocal; | 2619 | ++changedLocal; |
2560 | } | 2620 | } |
2561 | } | 2621 | } |
2562 | } | 2622 | } |
2563 | } else { // no conflict | 2623 | } else { // no conflict |
2564 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2624 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2565 | QString des = addresseeLSync.note(); | 2625 | QString des = addresseeLSync.note(); |
2566 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2626 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2567 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2627 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
2568 | remote->insertAddressee( inR, false ); | 2628 | remote->insertAddressee( inR, false ); |
2569 | ++deletedAddresseeR; | 2629 | ++deletedAddresseeR; |
2570 | } else { | 2630 | } else { |
2571 | inR.setRevision( modifiedCalendar ); | 2631 | inR.setRevision( modifiedCalendar ); |
2572 | remote->insertAddressee( inR, false ); | 2632 | remote->insertAddressee( inR, false ); |
2573 | inL = inR; | 2633 | inL = inR; |
2574 | inL.setResource( 0 ); | 2634 | inL.setResource( 0 ); |
2575 | local->insertAddressee( inL , false); | 2635 | local->insertAddressee( inL , false); |
2576 | ++addedAddressee; | 2636 | ++addedAddressee; |
2577 | } | 2637 | } |
2578 | } else { | 2638 | } else { |
2579 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 2639 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
2580 | inR.setRevision( modifiedCalendar ); | 2640 | inR.setRevision( modifiedCalendar ); |
2581 | remote->insertAddressee( inR, false ); | 2641 | remote->insertAddressee( inR, false ); |
2582 | inR.setResource( 0 ); | 2642 | inR.setResource( 0 ); |
2583 | local->insertAddressee( inR, false ); | 2643 | local->insertAddressee( inR, false ); |
2584 | ++addedAddressee; | 2644 | ++addedAddressee; |
2585 | } else { | 2645 | } else { |
2586 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 2646 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
2587 | remote->removeAddressee( inR ); | 2647 | remote->removeAddressee( inR ); |
2588 | ++deletedAddresseeR; | 2648 | ++deletedAddresseeR; |
2589 | } | 2649 | } |
2590 | } | 2650 | } |
2591 | } | 2651 | } |
2592 | } | 2652 | } |
2593 | ++incCounter; | 2653 | ++incCounter; |
2594 | } | 2654 | } |
2595 | er.clear(); | 2655 | er.clear(); |
2596 | QStringList el = local->uidList(); | 2656 | QStringList el = local->uidList(); |
2597 | modulo = (el.count()/10)+1; | 2657 | modulo = (el.count()/10)+1; |
2598 | 2658 | ||
2599 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 2659 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
2600 | incCounter = 0; | 2660 | incCounter = 0; |
2601 | while ( incCounter < el.count()) { | 2661 | while ( incCounter < el.count()) { |
2602 | qApp->processEvents(); | 2662 | qApp->processEvents(); |
2603 | if (syncManager->isProgressBarCanceled()) | 2663 | if (syncManager->isProgressBarCanceled()) |
2604 | return false; | 2664 | return false; |
2605 | if ( incCounter % modulo == 0 ) | 2665 | if ( incCounter % modulo == 0 ) |
2606 | syncManager->showProgressBar(incCounter); | 2666 | syncManager->showProgressBar(incCounter); |
2607 | uid = el[ incCounter ]; | 2667 | uid = el[ incCounter ]; |
2608 | bool skipIncidence = false; | 2668 | bool skipIncidence = false; |
2609 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2669 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2610 | skipIncidence = true; | 2670 | skipIncidence = true; |
2611 | if ( !skipIncidence ) { | 2671 | if ( !skipIncidence ) { |
2612 | inL = local->findByUid( uid ); | 2672 | inL = local->findByUid( uid ); |
2613 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2673 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2614 | inR = remote->findByUid( uid ); | 2674 | inR = remote->findByUid( uid ); |
2615 | if ( inR.isEmpty() ) { | 2675 | if ( inR.isEmpty() ) { |
2616 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2676 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2617 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2677 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2618 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2678 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2619 | local->removeAddressee( inL ); | 2679 | local->removeAddressee( inL ); |
2620 | ++deletedAddresseeL; | 2680 | ++deletedAddresseeL; |
2621 | } else { | 2681 | } else { |
2622 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2682 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2623 | inL.removeID(mCurrentSyncDevice ); | 2683 | inL.removeID(mCurrentSyncDevice ); |
2624 | ++addedAddresseeR; | 2684 | ++addedAddresseeR; |
2625 | inL.setRevision( modifiedCalendar ); | 2685 | inL.setRevision( modifiedCalendar ); |
2626 | local->insertAddressee( inL, false ); | 2686 | local->insertAddressee( inL, false ); |
2627 | inR = inL; | 2687 | inR = inL; |
2628 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 2688 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
2629 | inR.setResource( 0 ); | 2689 | inR.setResource( 0 ); |
2630 | remote->insertAddressee( inR, false ); | 2690 | remote->insertAddressee( inR, false ); |
2631 | } | 2691 | } |
2632 | } | 2692 | } |
2633 | } else { | 2693 | } else { |
2634 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 2694 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2635 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2695 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2636 | local->removeAddressee( inL ); | 2696 | local->removeAddressee( inL ); |
2637 | ++deletedAddresseeL; | 2697 | ++deletedAddresseeL; |
2638 | } else { | 2698 | } else { |
2639 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2699 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2640 | ++addedAddresseeR; | 2700 | ++addedAddresseeR; |
2641 | inL.setRevision( modifiedCalendar ); | 2701 | inL.setRevision( modifiedCalendar ); |
2642 | local->insertAddressee( inL, false ); | 2702 | local->insertAddressee( inL, false ); |
2643 | inR = inL; | 2703 | inR = inL; |
2644 | inR.setResource( 0 ); | 2704 | inR.setResource( 0 ); |
2645 | remote->insertAddressee( inR, false ); | 2705 | remote->insertAddressee( inR, false ); |
2646 | } | 2706 | } |
2647 | } | 2707 | } |
2648 | } | 2708 | } |
2649 | } | 2709 | } |
2650 | } | 2710 | } |
2651 | } | 2711 | } |
2652 | ++incCounter; | 2712 | ++incCounter; |
2653 | } | 2713 | } |
2654 | el.clear(); | 2714 | el.clear(); |
2655 | syncManager->hideProgressBar(); | 2715 | syncManager->hideProgressBar(); |
2656 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 2716 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
2657 | // get rid of micro seconds | 2717 | // get rid of micro seconds |
2658 | QTime t = mLastAddressbookSync.time(); | 2718 | QTime t = mLastAddressbookSync.time(); |
2659 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 2719 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
2660 | addresseeLSync.setRevision( mLastAddressbookSync ); | 2720 | addresseeLSync.setRevision( mLastAddressbookSync ); |
2661 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2721 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2662 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 2722 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
2663 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 2723 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
2664 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 2724 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
2665 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 2725 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
2666 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 2726 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
2667 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 2727 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
2668 | addresseeRSync.setNote( "" ) ; | 2728 | addresseeRSync.setNote( "" ) ; |
2669 | addresseeLSync.setNote( "" ); | 2729 | addresseeLSync.setNote( "" ); |
2670 | 2730 | ||
2671 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 2731 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
2672 | remote->insertAddressee( addresseeRSync, false ); | 2732 | remote->insertAddressee( addresseeRSync, false ); |
2673 | local->insertAddressee( addresseeLSync, false ); | 2733 | local->insertAddressee( addresseeLSync, false ); |
2674 | QString mes; | 2734 | QString mes; |
2675 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); | 2735 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); |
2676 | if ( syncManager->mShowSyncSummary ) { | 2736 | if ( syncManager->mShowSyncSummary ) { |
2677 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); | 2737 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); |
2678 | } | 2738 | } |
2679 | qDebug( mes ); | 2739 | qDebug( mes ); |
2680 | return syncOK; | 2740 | return syncOK; |
2681 | } | 2741 | } |
2682 | 2742 | ||
2683 | 2743 | ||
2684 | //this is a overwritten callbackmethods from the syncinterface | 2744 | //this is a overwritten callbackmethods from the syncinterface |
2685 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 2745 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
2686 | { | 2746 | { |
2687 | 2747 | ||
2688 | //pending prepare addresseeview for output | 2748 | //pending prepare addresseeview for output |
2689 | //pending detect, if remote file has REV field. if not switch to external sync | 2749 | //pending detect, if remote file has REV field. if not switch to external sync |
2690 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 2750 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
2691 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2751 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2692 | 2752 | ||
2693 | AddressBook abLocal(filename,"syncContact"); | 2753 | AddressBook abLocal(filename,"syncContact"); |
2694 | bool syncOK = false; | 2754 | bool syncOK = false; |
2695 | if ( abLocal.load() ) { | 2755 | if ( abLocal.load() ) { |
2696 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 2756 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
2697 | bool external = false; | 2757 | bool external = false; |
2698 | bool isXML = false; | 2758 | bool isXML = false; |
2699 | if ( filename.right(4) == ".xml") { | 2759 | if ( filename.right(4) == ".xml") { |
2700 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2760 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2701 | isXML = true; | 2761 | isXML = true; |
2702 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2762 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2703 | } else { | 2763 | } else { |
2704 | external = !manager->mIsKapiFile; | 2764 | external = !manager->mIsKapiFile; |
2705 | if ( external ) { | 2765 | if ( external ) { |
2706 | qDebug("Setting vcf mode to external "); | 2766 | qDebug("Setting vcf mode to external "); |
2707 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2767 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2708 | AddressBook::Iterator it; | 2768 | AddressBook::Iterator it; |
2709 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2769 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2710 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 2770 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
2711 | (*it).computeCsum( mCurrentSyncDevice ); | 2771 | (*it).computeCsum( mCurrentSyncDevice ); |
2712 | } | 2772 | } |
2713 | } | 2773 | } |
2714 | } | 2774 | } |
2715 | //AddressBook::Iterator it; | 2775 | //AddressBook::Iterator it; |
2716 | //QStringList vcards; | 2776 | //QStringList vcards; |
2717 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2777 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2718 | // qDebug("Name %s ", (*it).familyName().latin1()); | 2778 | // qDebug("Name %s ", (*it).familyName().latin1()); |
2719 | //} | 2779 | //} |
2720 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 2780 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
2721 | if ( syncOK ) { | 2781 | if ( syncOK ) { |
2722 | if ( syncManager->mWriteBackFile ) | 2782 | if ( syncManager->mWriteBackFile ) |
2723 | { | 2783 | { |
2724 | if ( external ) | 2784 | if ( external ) |
2725 | abLocal.removeSyncAddressees( !isXML); | 2785 | abLocal.removeSyncAddressees( !isXML); |
2726 | qDebug("Saving remote AB "); | 2786 | qDebug("Saving remote AB "); |
2727 | if ( ! abLocal.saveAB()) | 2787 | if ( ! abLocal.saveAB()) |
2728 | qDebug("Error writing back AB to file "); | 2788 | qDebug("Error writing back AB to file "); |
2729 | if ( isXML ) { | 2789 | if ( isXML ) { |
2730 | // afterwrite processing | 2790 | // afterwrite processing |
2731 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2791 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2732 | } | 2792 | } |
2733 | } | 2793 | } |
2734 | } | 2794 | } |
2735 | setModified(); | 2795 | setModified(); |
2736 | 2796 | ||
2737 | } | 2797 | } |
2738 | if ( syncOK ) | 2798 | if ( syncOK ) |
2739 | mViewManager->refreshView(); | 2799 | mViewManager->refreshView(); |
2740 | return syncOK; | 2800 | return syncOK; |
2741 | 2801 | ||
2742 | } | 2802 | } |
2743 | 2803 | ||
2744 | 2804 | ||
2745 | //this is a overwritten callbackmethods from the syncinterface | 2805 | //this is a overwritten callbackmethods from the syncinterface |
2746 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2806 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2747 | { | 2807 | { |
2748 | if ( resource == "phone" ) | 2808 | if ( resource == "phone" ) |
2749 | return syncPhone(); | 2809 | return syncPhone(); |
2810 | disableBR( true ); | ||
2750 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2811 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2751 | 2812 | ||
2752 | AddressBook abLocal( resource,"syncContact"); | 2813 | AddressBook abLocal( resource,"syncContact"); |
2753 | bool syncOK = false; | 2814 | bool syncOK = false; |
2754 | if ( abLocal.load() ) { | 2815 | if ( abLocal.load() ) { |
2755 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2816 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2756 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2817 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2757 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2818 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2758 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2819 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2759 | if ( syncOK ) { | 2820 | if ( syncOK ) { |
2760 | if ( syncManager->mWriteBackFile ) { | 2821 | if ( syncManager->mWriteBackFile ) { |
2761 | abLocal.removeSyncAddressees( false ); | 2822 | abLocal.removeSyncAddressees( false ); |
2762 | abLocal.saveAB(); | 2823 | abLocal.saveAB(); |
2763 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2824 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2764 | } | 2825 | } |
2765 | } | 2826 | } |
2766 | setModified(); | 2827 | setModified(); |
2767 | } | 2828 | } |
2768 | if ( syncOK ) | 2829 | if ( syncOK ) |
2769 | mViewManager->refreshView(); | 2830 | mViewManager->refreshView(); |
2831 | disableBR( false ); | ||
2770 | return syncOK; | 2832 | return syncOK; |
2771 | 2833 | ||
2772 | } | 2834 | } |
2773 | void KABCore::message( QString m ) | 2835 | void KABCore::message( QString m ) |
2774 | { | 2836 | { |
2775 | topLevelWidget()->setCaption( m ); | 2837 | topLevelWidget()->setCaption( m ); |
2776 | mMessageTimer->start( 15000, true ); | 2838 | mMessageTimer->start( 15000, true ); |
2777 | } | 2839 | } |
2778 | bool KABCore::syncPhone() | 2840 | bool KABCore::syncPhone() |
2779 | { | 2841 | { |
2780 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2842 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2781 | QString fileName = getPhoneFile(); | 2843 | QString fileName = getPhoneFile(); |
2782 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 2844 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
2783 | message(i18n("Phone access failed!")); | 2845 | message(i18n("Phone access failed!")); |
2784 | return false; | 2846 | return false; |
2785 | } | 2847 | } |
2786 | AddressBook abLocal( fileName,"syncContact"); | 2848 | AddressBook abLocal( fileName,"syncContact"); |
2787 | bool syncOK = false; | 2849 | bool syncOK = false; |
2788 | { | 2850 | { |
2789 | abLocal.importFromFile( fileName ); | 2851 | abLocal.importFromFile( fileName ); |
2790 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2852 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2791 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2853 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2792 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 2854 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
2793 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2855 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2794 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2856 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2795 | if ( syncOK ) { | 2857 | if ( syncOK ) { |
2796 | if ( syncManager->mWriteBackFile ) { | 2858 | if ( syncManager->mWriteBackFile ) { |
2797 | abLocal.removeSyncAddressees( true ); | 2859 | abLocal.removeSyncAddressees( true ); |
2798 | abLocal.saveABphone( fileName ); | 2860 | abLocal.saveABphone( fileName ); |
2799 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2861 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2800 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2862 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2801 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2863 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2802 | } | 2864 | } |
2803 | } | 2865 | } |
2804 | setModified(); | 2866 | setModified(); |
2805 | } | 2867 | } |
2806 | if ( syncOK ) | 2868 | if ( syncOK ) |
2807 | mViewManager->refreshView(); | 2869 | mViewManager->refreshView(); |
2808 | return syncOK; | 2870 | return syncOK; |
2809 | } | 2871 | } |
2810 | void KABCore::getFile( bool success ) | 2872 | void KABCore::getFile( bool success ) |
2811 | { | 2873 | { |
2812 | if ( ! success ) { | 2874 | if ( ! success ) { |
2813 | message( i18n("Error receiving file. Nothing changed!") ); | 2875 | message( i18n("Error receiving file. Nothing changed!") ); |
2814 | return; | 2876 | return; |
2815 | } | 2877 | } |
2816 | mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2878 | mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2817 | message( i18n("Pi-Sync successful!") ); | 2879 | message( i18n("Pi-Sync successful!") ); |
2818 | mViewManager->refreshView(); | 2880 | mViewManager->refreshView(); |
2819 | } | 2881 | } |
2820 | void KABCore::syncFileRequest() | 2882 | void KABCore::syncFileRequest() |
2821 | { | 2883 | { |
2822 | mAddressBook->export2File( sentSyncFile() ); | 2884 | mAddressBook->export2File( sentSyncFile() ); |
2823 | } | 2885 | } |
2824 | QString KABCore::sentSyncFile() | 2886 | QString KABCore::sentSyncFile() |
2825 | { | 2887 | { |
2826 | #ifdef DESKTOP_VERSION | 2888 | #ifdef DESKTOP_VERSION |
2827 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2889 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2828 | #else | 2890 | #else |
2829 | return QString( "/tmp/copysyncab.vcf" ); | 2891 | return QString( "/tmp/copysyncab.vcf" ); |
2830 | #endif | 2892 | #endif |
2831 | } | 2893 | } |
2832 | 2894 | ||
2833 | void KABCore::setCaptionBack() | 2895 | void KABCore::setCaptionBack() |
2834 | { | 2896 | { |
2835 | mMessageTimer->stop(); | 2897 | mMessageTimer->stop(); |
2836 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2898 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2837 | } | 2899 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7be343..fcbe1e8 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,491 +1,502 @@ | |||
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 | ||
38 | #include <qcopchannel_qws.h> | ||
39 | #endif | ||
37 | 40 | ||
38 | namespace KABC { | 41 | namespace KABC { |
39 | class AddressBook; | 42 | class AddressBook; |
40 | } | 43 | } |
41 | 44 | ||
42 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
43 | class KAboutData; | 46 | class KAboutData; |
44 | class KConfig; | 47 | class KConfig; |
45 | 48 | ||
46 | class KAddressBookService; | 49 | class KAddressBookService; |
47 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
48 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
49 | class KAddressBookMain; | 52 | class KAddressBookMain; |
50 | //US class QAction; | 53 | //US class QAction; |
51 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
52 | class KCMultiDialog; | 55 | class KCMultiDialog; |
53 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
54 | class ExtensionManager; | 57 | class ExtensionManager; |
55 | class XXPortManager; | 58 | class XXPortManager; |
56 | class JumpButtonBar; | 59 | class JumpButtonBar; |
57 | class IncSearchWidget; | 60 | class IncSearchWidget; |
58 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
59 | class KAction; | 62 | class KAction; |
60 | class KActionCollection; | 63 | class KActionCollection; |
61 | class KToggleAction; | 64 | class KToggleAction; |
62 | class KSyncProfile; | 65 | class KSyncProfile; |
63 | 66 | ||
64 | class QAction; | 67 | class QAction; |
65 | class QMenuBar; | 68 | class QMenuBar; |
66 | class QSplitter; | 69 | class QSplitter; |
67 | class ViewContainer; | 70 | class ViewContainer; |
68 | class ViewManager; | 71 | class ViewManager; |
69 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
70 | class Ir; | 73 | class Ir; |
71 | 74 | ||
72 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
73 | { | 76 | { |
74 | Q_OBJECT | 77 | Q_OBJECT |
75 | 78 | ||
76 | public: | 79 | public: |
77 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
78 | 81 | ||
79 | 82 | ||
80 | ~KABCore(); | 83 | ~KABCore(); |
81 | 84 | ||
82 | 85 | ||
83 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
84 | //US added functionality | 87 | //US added functionality |
85 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
86 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
87 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
88 | void addActionsManually(); | 91 | void addActionsManually(); |
89 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
90 | /** | 93 | /** |
91 | Restores the global settings. | 94 | Restores the global settings. |
92 | */ | 95 | */ |
93 | void restoreSettings(); | 96 | void restoreSettings(); |
94 | 97 | ||
95 | /** | 98 | /** |
96 | Saves the global settings. | 99 | Saves the global settings. |
97 | */ | 100 | */ |
98 | void saveSettings(); | 101 | void saveSettings(); |
99 | 102 | ||
100 | /** | 103 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 104 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 105 | */ |
103 | KABC::AddressBook *addressBook() const; | 106 | KABC::AddressBook *addressBook() const; |
104 | 107 | ||
105 | /** | 108 | /** |
106 | Returns a pointer to the KConfig object of the application. | 109 | Returns a pointer to the KConfig object of the application. |
107 | */ | 110 | */ |
108 | static KConfig *config(); | 111 | static KConfig *config(); |
109 | 112 | ||
110 | /** | 113 | /** |
111 | Returns a pointer to the global KActionCollection object. So | 114 | Returns a pointer to the global KActionCollection object. So |
112 | other classes can register their actions easily. | 115 | other classes can register their actions easily. |
113 | */ | 116 | */ |
114 | KActionCollection *actionCollection() const; | 117 | KActionCollection *actionCollection() const; |
115 | 118 | ||
116 | /** | 119 | /** |
117 | Returns the current search field of the Incremental Search Widget. | 120 | Returns the current search field of the Incremental Search Widget. |
118 | */ | 121 | */ |
119 | KABC::Field *currentSearchField() const; | 122 | KABC::Field *currentSearchField() const; |
120 | 123 | ||
121 | /** | 124 | /** |
122 | Returns the uid list of the currently selected contacts. | 125 | Returns the uid list of the currently selected contacts. |
123 | */ | 126 | */ |
124 | QStringList selectedUIDs() const; | 127 | QStringList selectedUIDs() const; |
125 | 128 | ||
126 | /** | 129 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 130 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 131 | resource or a null pointer if no resource was selected by |
129 | the user. | 132 | the user. |
130 | */ | 133 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 134 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 135 | ||
133 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 137 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
136 | 139 | ||
137 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
141 | 144 | ||
142 | public slots: | 145 | public slots: |
143 | #ifdef KAB_EMBEDDED | 146 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 147 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 148 | #endif //KAB_EMBEDDED |
146 | 149 | ||
147 | void showLicence(); | 150 | void showLicence(); |
148 | void faq(); | 151 | void faq(); |
149 | void whatsnew() ; | 152 | void whatsnew() ; |
150 | void synchowto() ; | 153 | void synchowto() ; |
151 | void writeToPhone(); | 154 | void writeToPhone(); |
152 | 155 | ||
153 | /** | 156 | /** |
154 | Is called whenever a contact is selected in the view. | 157 | Is called whenever a contact is selected in the view. |
155 | */ | 158 | */ |
156 | void setContactSelected( const QString &uid ); | 159 | void setContactSelected( const QString &uid ); |
157 | 160 | ||
158 | /** | 161 | /** |
159 | Opens the preferred mail composer with all selected contacts as | 162 | Opens the preferred mail composer with all selected contacts as |
160 | arguments. | 163 | arguments. |
161 | */ | 164 | */ |
162 | void sendMail(); | 165 | void sendMail(); |
163 | 166 | ||
164 | /** | 167 | /** |
165 | Opens the preferred mail composer with the given contacts as | 168 | Opens the preferred mail composer with the given contacts as |
166 | arguments. | 169 | arguments. |
167 | */ | 170 | */ |
168 | void sendMail( const QString& email ); | 171 | void sendMail( const QString& email ); |
169 | 172 | ||
170 | 173 | ||
171 | void mailVCard(); | 174 | void mailVCard(); |
172 | void mailVCard(const QStringList& uids); | 175 | void mailVCard(const QStringList& uids); |
173 | 176 | ||
174 | /** | 177 | /** |
175 | Beams the "WhoAmI contact. | 178 | Beams the "WhoAmI contact. |
176 | */ | 179 | */ |
177 | void beamMySelf(); | 180 | void beamMySelf(); |
178 | 181 | ||
179 | void beamVCard(); | 182 | void beamVCard(); |
180 | void export2phone(); | 183 | void export2phone(); |
181 | void beamVCard(const QStringList& uids); | 184 | void beamVCard(const QStringList& uids); |
182 | void beamDone( Ir *ir ); | 185 | void beamDone( Ir *ir ); |
183 | 186 | ||
184 | 187 | ||
185 | /** | 188 | /** |
186 | Starts the preferred web browser with the given URL as argument. | 189 | Starts the preferred web browser with the given URL as argument. |
187 | */ | 190 | */ |
188 | void browse( const QString& url ); | 191 | void browse( const QString& url ); |
189 | 192 | ||
190 | /** | 193 | /** |
191 | Select all contacts in the view. | 194 | Select all contacts in the view. |
192 | */ | 195 | */ |
193 | void selectAllContacts(); | 196 | void selectAllContacts(); |
194 | 197 | ||
195 | /** | 198 | /** |
196 | Deletes all selected contacts from the address book. | 199 | Deletes all selected contacts from the address book. |
197 | */ | 200 | */ |
198 | void deleteContacts(); | 201 | void deleteContacts(); |
199 | 202 | ||
200 | /** | 203 | /** |
201 | Deletes given contacts from the address book. | 204 | Deletes given contacts from the address book. |
202 | 205 | ||
203 | @param uids The uids of the contacts, which shall be deleted. | 206 | @param uids The uids of the contacts, which shall be deleted. |
204 | */ | 207 | */ |
205 | void deleteContacts( const QStringList &uids ); | 208 | void deleteContacts( const QStringList &uids ); |
206 | 209 | ||
207 | /** | 210 | /** |
208 | Copys the selected contacts into clipboard for later pasting. | 211 | Copys the selected contacts into clipboard for later pasting. |
209 | */ | 212 | */ |
210 | void copyContacts(); | 213 | void copyContacts(); |
211 | 214 | ||
212 | /** | 215 | /** |
213 | Cuts the selected contacts and stores them for later pasting. | 216 | Cuts the selected contacts and stores them for later pasting. |
214 | */ | 217 | */ |
215 | void cutContacts(); | 218 | void cutContacts(); |
216 | 219 | ||
217 | /** | 220 | /** |
218 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
219 | */ | 222 | */ |
220 | void pasteContacts(); | 223 | void pasteContacts(); |
221 | 224 | ||
222 | /** | 225 | /** |
223 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
224 | 227 | ||
225 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
226 | */ | 229 | */ |
227 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
228 | 231 | ||
229 | /** | 232 | /** |
230 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
231 | get personal information about the current user. | 234 | get personal information about the current user. |
232 | */ | 235 | */ |
233 | void setWhoAmI(); | 236 | void setWhoAmI(); |
234 | 237 | ||
235 | /** | 238 | /** |
236 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
237 | selected contacts. | 240 | selected contacts. |
238 | */ | 241 | */ |
239 | void setCategories(); | 242 | void setCategories(); |
240 | 243 | ||
241 | /** | 244 | /** |
242 | Sets the field list of the Incremental Search Widget. | 245 | Sets the field list of the Incremental Search Widget. |
243 | */ | 246 | */ |
244 | void setSearchFields( const KABC::Field::List &fields ); | 247 | void setSearchFields( const KABC::Field::List &fields ); |
245 | 248 | ||
246 | /** | 249 | /** |
247 | Search with the current search field for a contact, that matches | 250 | Search with the current search field for a contact, that matches |
248 | the given text, and selects it in the view. | 251 | the given text, and selects it in the view. |
249 | */ | 252 | */ |
250 | void incrementalSearch( const QString& text ); | 253 | void incrementalSearch( const QString& text ); |
251 | 254 | ||
252 | /** | 255 | /** |
253 | Marks the address book as modified. | 256 | Marks the address book as modified. |
254 | */ | 257 | */ |
255 | void setModified(); | 258 | void setModified(); |
256 | /** | 259 | /** |
257 | Marks the address book as modified without refreshing the view. | 260 | Marks the address book as modified without refreshing the view. |
258 | */ | 261 | */ |
259 | void setModifiedWOrefresh(); | 262 | void setModifiedWOrefresh(); |
260 | 263 | ||
261 | /** | 264 | /** |
262 | Marks the address book as modified concerning the argument. | 265 | Marks the address book as modified concerning the argument. |
263 | */ | 266 | */ |
264 | void setModified( bool modified ); | 267 | void setModified( bool modified ); |
265 | 268 | ||
266 | /** | 269 | /** |
267 | Returns whether the address book is modified. | 270 | Returns whether the address book is modified. |
268 | */ | 271 | */ |
269 | bool modified() const; | 272 | bool modified() const; |
270 | 273 | ||
271 | /** | 274 | /** |
272 | Called whenever an contact is modified in the contact editor | 275 | Called whenever an contact is modified in the contact editor |
273 | dialog or the quick edit. | 276 | dialog or the quick edit. |
274 | */ | 277 | */ |
275 | void contactModified( const KABC::Addressee &addr ); | 278 | void contactModified( const KABC::Addressee &addr ); |
276 | 279 | ||
277 | /** | 280 | /** |
278 | DCOP METHODS. | 281 | DCOP METHODS. |
279 | */ | 282 | */ |
280 | void addEmail( QString addr ); | 283 | void addEmail( QString addr ); |
281 | void importVCard( const KURL& url, bool showPreview ); | 284 | void importVCard( const KURL& url, bool showPreview ); |
282 | void importVCard( const QString& vCard, bool showPreview ); | 285 | void importVCard( const QString& vCard, bool showPreview ); |
283 | void newContact(); | 286 | void newContact(); |
284 | QString getNameByPhone( const QString& phone ); | 287 | QString getNameByPhone( const QString& phone ); |
285 | /** | 288 | /** |
286 | END DCOP METHODS | 289 | END DCOP METHODS |
287 | */ | 290 | */ |
288 | 291 | ||
289 | /** | 292 | /** |
290 | Saves the contents of the AddressBook back to disk. | 293 | Saves the contents of the AddressBook back to disk. |
291 | */ | 294 | */ |
292 | void save(); | 295 | void save(); |
293 | 296 | ||
294 | /** | 297 | /** |
295 | Undos the last command using the undo stack. | 298 | Undos the last command using the undo stack. |
296 | */ | 299 | */ |
297 | void undo(); | 300 | void undo(); |
298 | 301 | ||
299 | /** | 302 | /** |
300 | Redos the last command that was undone, using the redo stack. | 303 | Redos the last command that was undone, using the redo stack. |
301 | */ | 304 | */ |
302 | void redo(); | 305 | void redo(); |
303 | 306 | ||
304 | /** | 307 | /** |
305 | Shows the edit dialog for the given uid. If the uid is QString::null, | 308 | Shows the edit dialog for the given uid. If the uid is QString::null, |
306 | the method will try to find a selected addressee in the view. | 309 | the method will try to find a selected addressee in the view. |
307 | */ | 310 | */ |
308 | void editContact( const QString &uid /*US = QString::null*/ ); | 311 | void editContact( const QString &uid /*US = QString::null*/ ); |
309 | //US added a second method without defaultparameter | 312 | //US added a second method without defaultparameter |
310 | void editContact2(); | 313 | void editContact2(); |
311 | 314 | ||
312 | /** | 315 | /** |
313 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 316 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 317 | the method will try to find a selected addressee in the view. |
315 | */ | 318 | */ |
316 | void executeContact( const QString &uid /*US = QString::null*/ ); | 319 | void executeContact( const QString &uid /*US = QString::null*/ ); |
317 | 320 | ||
318 | /** | 321 | /** |
319 | Launches the configuration dialog. | 322 | Launches the configuration dialog. |
320 | */ | 323 | */ |
321 | void openConfigDialog(); | 324 | void openConfigDialog(); |
322 | 325 | ||
323 | /** | 326 | /** |
324 | Launches the ldap search dialog. | 327 | Launches the ldap search dialog. |
325 | */ | 328 | */ |
326 | void openLDAPDialog(); | 329 | void openLDAPDialog(); |
327 | 330 | ||
328 | /** | 331 | /** |
329 | Creates a KAddressBookPrinter, which will display the print | 332 | Creates a KAddressBookPrinter, which will display the print |
330 | dialog and do the printing. | 333 | dialog and do the printing. |
331 | */ | 334 | */ |
332 | void print(); | 335 | void print(); |
333 | 336 | ||
334 | /** | 337 | /** |
335 | Registers a new GUI client, so plugins can register its actions. | 338 | Registers a new GUI client, so plugins can register its actions. |
336 | */ | 339 | */ |
337 | void addGUIClient( KXMLGUIClient *client ); | 340 | void addGUIClient( KXMLGUIClient *client ); |
338 | 341 | ||
339 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 342 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
340 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 343 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
341 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 344 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
342 | 345 | ||
343 | 346 | ||
344 | signals: | 347 | signals: |
345 | void contactSelected( const QString &name ); | 348 | void contactSelected( const QString &name ); |
346 | void contactSelected( const QPixmap &pixmap ); | 349 | void contactSelected( const QPixmap &pixmap ); |
347 | public slots: | 350 | public slots: |
348 | void recieve(QString cmsg ); | 351 | void recieve(QString cmsg ); |
349 | void getFile( bool success ); | 352 | void getFile( bool success ); |
350 | void syncFileRequest(); | 353 | void syncFileRequest(); |
351 | void setDetailsVisible( bool visible ); | 354 | void setDetailsVisible( bool visible ); |
352 | void setDetailsToState(); | 355 | void setDetailsToState(); |
353 | // void slotSyncMenu( int ); | 356 | // void slotSyncMenu( int ); |
354 | private slots: | 357 | private slots: |
358 | void receive( const QCString& cmsg, const QByteArray& data ); | ||
359 | void toggleBeamReceive( ); | ||
360 | void disableBR(bool); | ||
355 | void setJumpButtonBarVisible( bool visible ); | 361 | void setJumpButtonBarVisible( bool visible ); |
356 | void setCaptionBack(); | 362 | void setCaptionBack(); |
357 | void importFromOL(); | 363 | void importFromOL(); |
358 | void extensionModified( const KABC::Addressee::List &list ); | 364 | void extensionModified( const KABC::Addressee::List &list ); |
359 | void extensionChanged( int id ); | 365 | void extensionChanged( int id ); |
360 | void clipboardDataChanged(); | 366 | void clipboardDataChanged(); |
361 | void updateActionMenu(); | 367 | void updateActionMenu(); |
362 | void configureKeyBindings(); | 368 | void configureKeyBindings(); |
363 | void removeVoice(); | 369 | void removeVoice(); |
364 | #ifdef KAB_EMBEDDED | 370 | #ifdef KAB_EMBEDDED |
365 | void configureResources(); | 371 | void configureResources(); |
366 | #endif //KAB_EMBEDDED | 372 | #endif //KAB_EMBEDDED |
367 | 373 | ||
368 | void slotEditorDestroyed( const QString &uid ); | 374 | void slotEditorDestroyed( const QString &uid ); |
369 | void configurationChanged(); | 375 | void configurationChanged(); |
370 | void addressBookChanged(); | 376 | void addressBookChanged(); |
371 | 377 | ||
372 | private: | 378 | private: |
379 | bool mBRdisabled; | ||
380 | #ifndef DESKTOP_VERSION | ||
381 | QCopChannel* infrared; | ||
382 | #endif | ||
373 | QTimer *mMessageTimer; | 383 | QTimer *mMessageTimer; |
374 | void initGUI(); | 384 | void initGUI(); |
375 | void initActions(); | 385 | void initActions(); |
376 | QString getPhoneFile(); | 386 | QString getPhoneFile(); |
377 | 387 | ||
378 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 388 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
379 | const char *name = 0 ); | 389 | const char *name = 0 ); |
380 | 390 | ||
381 | KXMLGUIClient *mGUIClient; | 391 | KXMLGUIClient *mGUIClient; |
382 | 392 | ||
383 | KABC::AddressBook *mAddressBook; | 393 | KABC::AddressBook *mAddressBook; |
384 | 394 | ||
385 | ViewManager *mViewManager; | 395 | ViewManager *mViewManager; |
386 | // QSplitter *mDetailsSplitter; | 396 | // QSplitter *mDetailsSplitter; |
387 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 397 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
388 | ViewContainer *mDetails; | 398 | ViewContainer *mDetails; |
389 | KDGanttMinimizeSplitter* mMiniSplitter; | 399 | KDGanttMinimizeSplitter* mMiniSplitter; |
390 | XXPortManager *mXXPortManager; | 400 | XXPortManager *mXXPortManager; |
391 | JumpButtonBar *mJumpButtonBar; | 401 | JumpButtonBar *mJumpButtonBar; |
392 | IncSearchWidget *mIncSearchWidget; | 402 | IncSearchWidget *mIncSearchWidget; |
393 | ExtensionManager *mExtensionManager; | 403 | ExtensionManager *mExtensionManager; |
394 | 404 | ||
395 | KCMultiDialog *mConfigureDialog; | 405 | KCMultiDialog *mConfigureDialog; |
396 | 406 | ||
397 | #ifndef KAB_EMBEDDED | 407 | #ifndef KAB_EMBEDDED |
398 | LDAPSearchDialog *mLdapSearchDialog; | 408 | LDAPSearchDialog *mLdapSearchDialog; |
399 | #endif //KAB_EMBEDDED | 409 | #endif //KAB_EMBEDDED |
400 | // QDict<AddresseeEditorDialog> mEditorDict; | 410 | // QDict<AddresseeEditorDialog> mEditorDict; |
401 | AddresseeEditorDialog *mEditorDialog; | 411 | AddresseeEditorDialog *mEditorDialog; |
402 | bool mReadWrite; | 412 | bool mReadWrite; |
403 | bool mModified; | 413 | bool mModified; |
404 | bool mIsPart; | 414 | bool mIsPart; |
405 | bool mMultipleViewsAtOnce; | 415 | bool mMultipleViewsAtOnce; |
406 | 416 | ||
407 | 417 | ||
408 | //US file menu | 418 | //US file menu |
409 | KAction *mActionMail; | 419 | KAction *mActionMail; |
410 | KAction *mActionBeam; | 420 | KAction *mActionBeam; |
421 | KToggleAction *mActionBR; | ||
411 | KAction *mActionExport2phone; | 422 | KAction *mActionExport2phone; |
412 | KAction* mActionPrint; | 423 | KAction* mActionPrint; |
413 | KAction* mActionNewContact; | 424 | KAction* mActionNewContact; |
414 | KAction *mActionSave; | 425 | KAction *mActionSave; |
415 | KAction *mActionEditAddressee; | 426 | KAction *mActionEditAddressee; |
416 | KAction *mActionMailVCard; | 427 | KAction *mActionMailVCard; |
417 | KAction *mActionBeamVCard; | 428 | KAction *mActionBeamVCard; |
418 | 429 | ||
419 | KAction *mActionQuit; | 430 | KAction *mActionQuit; |
420 | 431 | ||
421 | //US edit menu | 432 | //US edit menu |
422 | KAction *mActionCopy; | 433 | KAction *mActionCopy; |
423 | KAction *mActionCut; | 434 | KAction *mActionCut; |
424 | KAction *mActionPaste; | 435 | KAction *mActionPaste; |
425 | KAction *mActionSelectAll; | 436 | KAction *mActionSelectAll; |
426 | KAction *mActionUndo; | 437 | KAction *mActionUndo; |
427 | KAction *mActionRedo; | 438 | KAction *mActionRedo; |
428 | KAction *mActionDelete; | 439 | KAction *mActionDelete; |
429 | 440 | ||
430 | //US settings menu | 441 | //US settings menu |
431 | KAction *mActionConfigResources; | 442 | KAction *mActionConfigResources; |
432 | KAction *mActionConfigKAddressbook; | 443 | KAction *mActionConfigKAddressbook; |
433 | KAction *mActionConfigShortcuts; | 444 | KAction *mActionConfigShortcuts; |
434 | KAction *mActionConfigureToolbars; | 445 | KAction *mActionConfigureToolbars; |
435 | KAction *mActionKeyBindings; | 446 | KAction *mActionKeyBindings; |
436 | KToggleAction *mActionJumpBar; | 447 | KToggleAction *mActionJumpBar; |
437 | KToggleAction *mActionDetails; | 448 | KToggleAction *mActionDetails; |
438 | KAction *mActionWhoAmI; | 449 | KAction *mActionWhoAmI; |
439 | KAction *mActionCategories; | 450 | KAction *mActionCategories; |
440 | KAction *mActionAboutKAddressbook; | 451 | KAction *mActionAboutKAddressbook; |
441 | KAction *mActionLicence; | 452 | KAction *mActionLicence; |
442 | KAction *mActionFaq; | 453 | KAction *mActionFaq; |
443 | KAction *mActionWN; | 454 | KAction *mActionWN; |
444 | KAction *mActionSyncHowto; | 455 | KAction *mActionSyncHowto; |
445 | 456 | ||
446 | KAction *mActionDeleteView; | 457 | KAction *mActionDeleteView; |
447 | 458 | ||
448 | QPopupMenu *viewMenu; | 459 | QPopupMenu *viewMenu; |
449 | QPopupMenu *filterMenu; | 460 | QPopupMenu *filterMenu; |
450 | QPopupMenu *settingsMenu; | 461 | QPopupMenu *settingsMenu; |
451 | QPopupMenu *changeMenu; | 462 | QPopupMenu *changeMenu; |
452 | //US QAction *mActionSave; | 463 | //US QAction *mActionSave; |
453 | QPopupMenu *ImportMenu; | 464 | QPopupMenu *ImportMenu; |
454 | QPopupMenu *ExportMenu; | 465 | QPopupMenu *ExportMenu; |
455 | //LR additional methods | 466 | //LR additional methods |
456 | KAction *mActionRemoveVoice; | 467 | KAction *mActionRemoveVoice; |
457 | KAction * mActionImportOL; | 468 | KAction * mActionImportOL; |
458 | 469 | ||
459 | #ifndef KAB_EMBEDDED | 470 | #ifndef KAB_EMBEDDED |
460 | KAddressBookService *mAddressBookService; | 471 | KAddressBookService *mAddressBookService; |
461 | #endif //KAB_EMBEDDED | 472 | #endif //KAB_EMBEDDED |
462 | 473 | ||
463 | class KABCorePrivate; | 474 | class KABCorePrivate; |
464 | KABCorePrivate *d; | 475 | KABCorePrivate *d; |
465 | //US bool mBlockSaveFlag; | 476 | //US bool mBlockSaveFlag; |
466 | 477 | ||
467 | #ifdef KAB_EMBEDDED | 478 | #ifdef KAB_EMBEDDED |
468 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 479 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
469 | #endif //KAB_EMBEDDED | 480 | #endif //KAB_EMBEDDED |
470 | 481 | ||
471 | //this are the overwritten callbackmethods from the syncinterface | 482 | //this are the overwritten callbackmethods from the syncinterface |
472 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 483 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
473 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 484 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
474 | bool syncPhone(); | 485 | bool syncPhone(); |
475 | void message( QString m ); | 486 | void message( QString m ); |
476 | 487 | ||
477 | // LR ******************************* | 488 | // LR ******************************* |
478 | // sync stuff! | 489 | // sync stuff! |
479 | QString sentSyncFile(); | 490 | QString sentSyncFile(); |
480 | QPopupMenu *syncMenu; | 491 | QPopupMenu *syncMenu; |
481 | KSyncManager* syncManager; | 492 | KSyncManager* syncManager; |
482 | int mGlobalSyncMode; | 493 | int mGlobalSyncMode; |
483 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 494 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
484 | KABC::Addressee getLastSyncAddressee(); | 495 | KABC::Addressee getLastSyncAddressee(); |
485 | QDateTime mLastAddressbookSync; | 496 | QDateTime mLastAddressbookSync; |
486 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 497 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
487 | // ********************* | 498 | // ********************* |
488 | 499 | ||
489 | }; | 500 | }; |
490 | 501 | ||
491 | #endif | 502 | #endif |
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8c4ca09..f48f214 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -1,250 +1,240 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 1999 Don Sanders <dsanders@kde.org> | 3 | Copyright (c) 1999 Don Sanders <dsanders@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 | #ifdef KAB_EMBEDDED | 24 | #ifdef KAB_EMBEDDED |
25 | #include "kabprefs.h" | 25 | #include "kabprefs.h" |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #else //KAB_EMBEDDED | 30 | #else //KAB_EMBEDDED |
31 | #include <kedittoolbar.h> | 31 | #include <kedittoolbar.h> |
32 | #include <kkeydialog.h> | 32 | #include <kkeydialog.h> |
33 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
34 | #include <kstatusbar.h> | 34 | #include <kstatusbar.h> |
35 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | 37 | ||
38 | #include "kabcore.h" | 38 | #include "kabcore.h" |
39 | #include "kaddressbookmain.h" | 39 | #include "kaddressbookmain.h" |
40 | #include "kactioncollection.h" | 40 | #include "kactioncollection.h" |
41 | 41 | ||
42 | #ifdef KAB_EMBEDDED | 42 | #ifdef KAB_EMBEDDED |
43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) | 43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) |
44 | #else //KAB_EMBEDDED | 44 | #else //KAB_EMBEDDED |
45 | //MOC_SKIP_BEGIN | 45 | //MOC_SKIP_BEGIN |
46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) | 46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) |
47 | //MOC_SKIP_END | 47 | //MOC_SKIP_END |
48 | #endif //KAB_EMBEDDED | 48 | #endif //KAB_EMBEDDED |
49 | { | 49 | { |
50 | 50 | ||
51 | setIcon(SmallIcon( "ka24" ) ); | 51 | setIcon(SmallIcon( "ka24" ) ); |
52 | #if 0 | 52 | #if 0 |
53 | //US for embedded systems, create the toolbar before we initiate KABCore. | 53 | //US for embedded systems, create the toolbar before we initiate KABCore. |
54 | // KABCore will fill the toolbar with menues and icons | 54 | // KABCore will fill the toolbar with menues and icons |
55 | QMainWindow::ToolBarDock tbd; | 55 | QMainWindow::ToolBarDock tbd; |
56 | tbd = Top; | 56 | tbd = Top; |
57 | iconToolBar = new QToolBar( this ); | 57 | iconToolBar = new QToolBar( this ); |
58 | addToolBar (iconToolBar , tbd ); | 58 | addToolBar (iconToolBar , tbd ); |
59 | iconToolBar->setHorizontalStretchable(true); | 59 | iconToolBar->setHorizontalStretchable(true); |
60 | //US iconToolBar->setWidth(300); | 60 | //US iconToolBar->setWidth(300); |
61 | #endif // 0 | 61 | #endif // 0 |
62 | 62 | ||
63 | mCore = new KABCore( this, true, this ); | 63 | mCore = new KABCore( this, true, this ); |
64 | 64 | ||
65 | #ifdef KAB_EMBEDDED | 65 | #ifdef KAB_EMBEDDED |
66 | setCaption( i18n( "KAddressbook/Pi" ) ); | 66 | setCaption( i18n( "KAddressbook/Pi" ) ); |
67 | #else //KAB_EMBEDDED | 67 | #else //KAB_EMBEDDED |
68 | setCaption( i18n( "Address Book Browser" ) ); | 68 | setCaption( i18n( "Address Book Browser" ) ); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | //mCore->restoreSettings(); | 71 | //mCore->restoreSettings(); |
72 | 72 | ||
73 | initActions(); | 73 | initActions(); |
74 | 74 | ||
75 | setCentralWidget( mCore ); | 75 | setCentralWidget( mCore ); |
76 | 76 | ||
77 | //US statusBar()->show(); | 77 | //US statusBar()->show(); |
78 | 78 | ||
79 | #ifndef KAB_EMBEDDED | 79 | #ifndef KAB_EMBEDDED |
80 | setStandardToolBarMenuEnabled(true); | 80 | setStandardToolBarMenuEnabled(true); |
81 | 81 | ||
82 | createGUI( "kaddressbookui.rc", false ); | 82 | createGUI( "kaddressbookui.rc", false ); |
83 | 83 | ||
84 | 84 | ||
85 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
86 | setAutoSaveSettings(); | 86 | setAutoSaveSettings(); |
87 | qApp->processEvents(); | 87 | qApp->processEvents(); |
88 | mCore->restoreSettings(); | 88 | mCore->restoreSettings(); |
89 | } | 89 | } |
90 | 90 | ||
91 | KAddressBookMain::~KAddressBookMain() | 91 | KAddressBookMain::~KAddressBookMain() |
92 | { | 92 | { |
93 | // mCore->saveSettings(); | 93 | // mCore->saveSettings(); |
94 | } | 94 | } |
95 | void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data ) | 95 | |
96 | { | ||
97 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
98 | if ( cmsg == "setDocument(QString)" ) { | ||
99 | QDataStream stream( data, IO_ReadOnly ); | ||
100 | QString fileName; | ||
101 | stream >> fileName; | ||
102 | mCore->recieve( fileName ); | ||
103 | return; | ||
104 | } | ||
105 | } | ||
106 | void KAddressBookMain::showMinimized () | 96 | void KAddressBookMain::showMinimized () |
107 | { | 97 | { |
108 | QWidget::showMinimized () ; | 98 | QWidget::showMinimized () ; |
109 | } | 99 | } |
110 | void KAddressBookMain::addEmail( QString addr ) | 100 | void KAddressBookMain::addEmail( QString addr ) |
111 | { | 101 | { |
112 | mCore->addEmail( addr ); | 102 | mCore->addEmail( addr ); |
113 | } | 103 | } |
114 | 104 | ||
115 | #ifndef KAB_EMBEDDED | 105 | #ifndef KAB_EMBEDDED |
116 | ASYNC KAddressBookMain::showContactEditor( QString uid ) | 106 | ASYNC KAddressBookMain::showContactEditor( QString uid ) |
117 | { | 107 | { |
118 | mCore->editContact( uid ); | 108 | mCore->editContact( uid ); |
119 | } | 109 | } |
120 | #endif //KAB_EMBEDDED | 110 | #endif //KAB_EMBEDDED |
121 | void KAddressBookMain::newContact() | 111 | void KAddressBookMain::newContact() |
122 | { | 112 | { |
123 | mCore->newContact(); | 113 | mCore->newContact(); |
124 | } | 114 | } |
125 | 115 | ||
126 | QString KAddressBookMain::getNameByPhone( QString phone ) | 116 | QString KAddressBookMain::getNameByPhone( QString phone ) |
127 | { | 117 | { |
128 | return mCore->getNameByPhone( phone ); | 118 | return mCore->getNameByPhone( phone ); |
129 | } | 119 | } |
130 | 120 | ||
131 | void KAddressBookMain::save() | 121 | void KAddressBookMain::save() |
132 | { | 122 | { |
133 | mCore->save(); | 123 | mCore->save(); |
134 | } | 124 | } |
135 | 125 | ||
136 | void KAddressBookMain::exit() | 126 | void KAddressBookMain::exit() |
137 | { | 127 | { |
138 | close( ); | 128 | close( ); |
139 | } | 129 | } |
140 | 130 | ||
141 | void KAddressBookMain::saveProperties( KConfig* ) | 131 | void KAddressBookMain::saveProperties( KConfig* ) |
142 | { | 132 | { |
143 | } | 133 | } |
144 | 134 | ||
145 | void KAddressBookMain::readProperties( KConfig* ) | 135 | void KAddressBookMain::readProperties( KConfig* ) |
146 | { | 136 | { |
147 | } | 137 | } |
148 | 138 | ||
149 | void KAddressBookMain::initActions() | 139 | void KAddressBookMain::initActions() |
150 | { | 140 | { |
151 | #ifndef KAB_EMBEDDED | 141 | #ifndef KAB_EMBEDDED |
152 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); | 142 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); |
153 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); | 143 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); |
154 | #else //KAB_EMBEDDED | 144 | #else //KAB_EMBEDDED |
155 | //US: transfered the setup of the actions into KABCore | 145 | //US: transfered the setup of the actions into KABCore |
156 | #endif //KAB_EMBEDDED | 146 | #endif //KAB_EMBEDDED |
157 | 147 | ||
158 | 148 | ||
159 | } | 149 | } |
160 | 150 | ||
161 | //US new method to setup menues and toolbars on embedded systems | 151 | //US new method to setup menues and toolbars on embedded systems |
162 | #ifdef KAB_EMBEDDED | 152 | #ifdef KAB_EMBEDDED |
163 | /* | 153 | /* |
164 | QToolBar * KAddressBookMain::getIconToolBar() | 154 | QToolBar * KAddressBookMain::getIconToolBar() |
165 | { | 155 | { |
166 | return iconToolBar; | 156 | return iconToolBar; |
167 | } | 157 | } |
168 | */ | 158 | */ |
169 | 159 | ||
170 | void KAddressBookMain::createGUI() | 160 | void KAddressBookMain::createGUI() |
171 | { | 161 | { |
172 | 162 | ||
173 | 163 | ||
174 | 164 | ||
175 | } | 165 | } |
176 | #endif //KAB_EMBEDDED | 166 | #endif //KAB_EMBEDDED |
177 | 167 | ||
178 | void KAddressBookMain::configureToolbars() | 168 | void KAddressBookMain::configureToolbars() |
179 | { | 169 | { |
180 | #ifndef KAB_EMBEDDED | 170 | #ifndef KAB_EMBEDDED |
181 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); | 171 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); |
182 | 172 | ||
183 | KEditToolbar dlg( factory() ); | 173 | KEditToolbar dlg( factory() ); |
184 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); | 174 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); |
185 | 175 | ||
186 | dlg.exec(); | 176 | dlg.exec(); |
187 | #else //KAB_EMBEDDED | 177 | #else //KAB_EMBEDDED |
188 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); | 178 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); |
189 | #endif //KAB_EMBEDDED | 179 | #endif //KAB_EMBEDDED |
190 | } | 180 | } |
191 | 181 | ||
192 | void KAddressBookMain::slotNewToolbarConfig() | 182 | void KAddressBookMain::slotNewToolbarConfig() |
193 | { | 183 | { |
194 | #ifndef KAB_EMBEDDED | 184 | #ifndef KAB_EMBEDDED |
195 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); | 185 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); |
196 | #else //KAB_EMBEDDED | 186 | #else //KAB_EMBEDDED |
197 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); | 187 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); |
198 | #endif //KAB_EMBEDDED | 188 | #endif //KAB_EMBEDDED |
199 | } | 189 | } |
200 | 190 | ||
201 | void KAddressBookMain::configureKeys() | 191 | void KAddressBookMain::configureKeys() |
202 | { | 192 | { |
203 | #ifndef KAB_EMBEDDED | 193 | #ifndef KAB_EMBEDDED |
204 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); | 194 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); |
205 | #else //KAB_EMBEDDED | 195 | #else //KAB_EMBEDDED |
206 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); | 196 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); |
207 | #endif //KAB_EMBEDDED | 197 | #endif //KAB_EMBEDDED |
208 | } | 198 | } |
209 | 199 | ||
210 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) | 200 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) |
211 | { | 201 | { |
212 | bool mModified = mCore->modified(); | 202 | bool mModified = mCore->modified(); |
213 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; | 203 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; |
214 | 204 | ||
215 | QString mess = i18n( "Close KA/Pi?"); | 205 | QString mess = i18n( "Close KA/Pi?"); |
216 | if ( mModified == true ) | 206 | if ( mModified == true ) |
217 | mess += i18n( "\nChanges will be saved!"); | 207 | mess += i18n( "\nChanges will be saved!"); |
218 | else | 208 | else |
219 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); | 209 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); |
220 | 210 | ||
221 | bool mQuit = true; | 211 | bool mQuit = true; |
222 | 212 | ||
223 | 213 | ||
224 | if (mAskForQuit) | 214 | if (mAskForQuit) |
225 | { | 215 | { |
226 | 216 | ||
227 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); | 217 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); |
228 | if (res == 0) | 218 | if (res == 0) |
229 | mQuit = true; | 219 | mQuit = true; |
230 | else | 220 | else |
231 | mQuit = false; | 221 | mQuit = false; |
232 | } | 222 | } |
233 | 223 | ||
234 | if (mQuit == false) | 224 | if (mQuit == false) |
235 | return; | 225 | return; |
236 | 226 | ||
237 | if (mModified == true) | 227 | if (mModified == true) |
238 | { | 228 | { |
239 | save(); | 229 | save(); |
240 | mCore->saveSettings(); | 230 | mCore->saveSettings(); |
241 | KABPrefs::instance()->writeConfig(); | 231 | KABPrefs::instance()->writeConfig(); |
242 | } | 232 | } |
243 | 233 | ||
244 | ce->accept(); | 234 | ce->accept(); |
245 | } | 235 | } |
246 | 236 | ||
247 | #ifndef KAB_EMBEDDED | 237 | #ifndef KAB_EMBEDDED |
248 | #include "kaddressbookmain.moc" | 238 | #include "kaddressbookmain.moc" |
249 | #endif //KAB_EMBEDDED | 239 | #endif //KAB_EMBEDDED |
250 | 240 | ||
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index 40d2bdd..b6d9b4b 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h | |||
@@ -1,122 +1,121 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 1999 Don Sanders <dsanders@kde.org> | 3 | Copyright (c) 1999 Don Sanders <dsanders@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 KADDRESSBOOKMAIN_H | 24 | #ifndef KADDRESSBOOKMAIN_H |
25 | #define KADDRESSBOOKMAIN_H | 25 | #define KADDRESSBOOKMAIN_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #ifdef KAB_EMBEDDED | 29 | #ifdef KAB_EMBEDDED |
30 | class QToolBar; | 30 | class QToolBar; |
31 | #include <qaction.h> | 31 | #include <qaction.h> |
32 | //#include <qmainwindow.h> | 32 | //#include <qmainwindow.h> |
33 | #include <kmainwindow.h> | 33 | #include <kmainwindow.h> |
34 | #else //KAB_EMBEDDED | 34 | #else //KAB_EMBEDDED |
35 | #include <kaction.h> | 35 | #include <kaction.h> |
36 | #include <kapplication.h> | 36 | #include <kapplication.h> |
37 | #include <kmainwindow.h> | 37 | #include <kmainwindow.h> |
38 | #include "kaddressbookiface.h" | 38 | #include "kaddressbookiface.h" |
39 | #endif //KAB_EMBEDDED | 39 | #endif //KAB_EMBEDDED |
40 | 40 | ||
41 | class KABCore; | 41 | class KABCore; |
42 | class KConfig; | 42 | class KConfig; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | This class serves as the main window for KAddressBook. It handles the | 45 | This class serves as the main window for KAddressBook. It handles the |
46 | menus, toolbars, and status bars. | 46 | menus, toolbars, and status bars. |
47 | 47 | ||
48 | @short Main window class | 48 | @short Main window class |
49 | @author Don Sanders <dsanders@kde.org> | 49 | @author Don Sanders <dsanders@kde.org> |
50 | @version 0.1 | 50 | @version 0.1 |
51 | */ | 51 | */ |
52 | #ifdef KAB_EMBEDDED | 52 | #ifdef KAB_EMBEDDED |
53 | class KAddressBookMain : public KMainWindow | 53 | class KAddressBookMain : public KMainWindow |
54 | #else //KAB_EMBEDDED | 54 | #else //KAB_EMBEDDED |
55 | //MOC_SKIP_BEGIN | 55 | //MOC_SKIP_BEGIN |
56 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface | 56 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface |
57 | //MOC_SKIP_END | 57 | //MOC_SKIP_END |
58 | #endif //KAB_EMBEDDED | 58 | #endif //KAB_EMBEDDED |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | public: | 62 | public: |
63 | KAddressBookMain(); | 63 | KAddressBookMain(); |
64 | virtual ~KAddressBookMain(); | 64 | virtual ~KAddressBookMain(); |
65 | 65 | ||
66 | #ifdef KAB_EMBEDDED | 66 | #ifdef KAB_EMBEDDED |
67 | // QPEToolBar * getIconToolBar(); | 67 | // QPEToolBar * getIconToolBar(); |
68 | // QToolBar * getIconToolBar(); | 68 | // QToolBar * getIconToolBar(); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | 71 | ||
72 | public slots: | 72 | public slots: |
73 | void showMinimized () ; | 73 | void showMinimized () ; |
74 | virtual void addEmail( QString addr ); | 74 | virtual void addEmail( QString addr ); |
75 | #ifndef KAB_EMBEDDED | 75 | #ifndef KAB_EMBEDDED |
76 | //MOC_SKIP_BEGIN | 76 | //MOC_SKIP_BEGIN |
77 | virtual ASYNC showContactEditor( QString uid ); | 77 | virtual ASYNC showContactEditor( QString uid ); |
78 | //MOC_SKIP_END | 78 | //MOC_SKIP_END |
79 | #endif //KAB_EMBEDDED | 79 | #endif //KAB_EMBEDDED |
80 | virtual void newContact(); | 80 | virtual void newContact(); |
81 | virtual QString getNameByPhone( QString phone ); | 81 | virtual QString getNameByPhone( QString phone ); |
82 | virtual void save(); | 82 | virtual void save(); |
83 | virtual void exit(); | 83 | virtual void exit(); |
84 | void recieve( const QCString& cmsg, const QByteArray& data ); | ||
85 | protected: | 84 | protected: |
86 | void initActions(); | 85 | void initActions(); |
87 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
88 | //US new method to setup menues and toolbars on embedded systems | 87 | //US new method to setup menues and toolbars on embedded systems |
89 | void createGUI(); | 88 | void createGUI(); |
90 | #endif //KAB_EMBEDDED | 89 | #endif //KAB_EMBEDDED |
91 | 90 | ||
92 | /** | 91 | /** |
93 | This function is called when it is time for the app to save its | 92 | This function is called when it is time for the app to save its |
94 | properties for session management purposes. | 93 | properties for session management purposes. |
95 | */ | 94 | */ |
96 | void saveProperties( KConfig* ); | 95 | void saveProperties( KConfig* ); |
97 | 96 | ||
98 | /** | 97 | /** |
99 | This function is called when this app is restored. The KConfig | 98 | This function is called when this app is restored. The KConfig |
100 | object points to the session management config file that was saved | 99 | object points to the session management config file that was saved |
101 | with @ref saveProperties | 100 | with @ref saveProperties |
102 | */ | 101 | */ |
103 | void readProperties( KConfig* ); | 102 | void readProperties( KConfig* ); |
104 | 103 | ||
105 | void closeEvent( QCloseEvent* ce ); | 104 | void closeEvent( QCloseEvent* ce ); |
106 | 105 | ||
107 | protected slots: | 106 | protected slots: |
108 | void configureToolbars(); | 107 | void configureToolbars(); |
109 | void configureKeys(); | 108 | void configureKeys(); |
110 | 109 | ||
111 | void slotNewToolbarConfig(); | 110 | void slotNewToolbarConfig(); |
112 | 111 | ||
113 | private: | 112 | private: |
114 | KABCore *mCore; | 113 | KABCore *mCore; |
115 | 114 | ||
116 | #ifdef KAB_EMBEDDED | 115 | #ifdef KAB_EMBEDDED |
117 | // QToolBar *iconToolBar; | 116 | // QToolBar *iconToolBar; |
118 | #endif //KAB_EMBEDDED | 117 | #endif //KAB_EMBEDDED |
119 | 118 | ||
120 | }; | 119 | }; |
121 | 120 | ||
122 | #endif | 121 | #endif |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 6dd97b8..a2ff1e9 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,218 +1,215 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <qplatinumstyle.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <kstandarddirs.h> | 12 | #include <kstandarddirs.h> |
13 | #include <qregexp.h> | 13 | #include <qregexp.h> |
14 | #include <kglobal.h> | 14 | #include <kglobal.h> |
15 | #include <stdio.h> | 15 | #include <stdio.h> |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include "kaddressbookmain.h" | 17 | #include "kaddressbookmain.h" |
18 | #include "externalapphandler.h" | 18 | #include "externalapphandler.h" |
19 | #include <libkdepim/kpimglobalprefs.h> | 19 | #include <libkdepim/kpimglobalprefs.h> |
20 | 20 | ||
21 | int main( int argc, char **argv ) | 21 | int main( int argc, char **argv ) |
22 | { | 22 | { |
23 | #ifndef DESKTOP_VERSION | 23 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 24 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 25 | a.setKeepRunning (); |
26 | #else | 26 | #else |
27 | QApplication a( argc, argv ); | 27 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 28 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | 29 | QString hdir = QDir::homeDirPath(); |
30 | // there is a bug when creating dirs for WIN 98 | 30 | // there is a bug when creating dirs for WIN 98 |
31 | // it is difficult to fix, because we have no WIN 98 runnung | 31 | // it is difficult to fix, because we have no WIN 98 runnung |
32 | // such that we try it to create the dirs at startup here | 32 | // such that we try it to create the dirs at startup here |
33 | if ( hdir == "C:\\" ) { // win 98 or ME | 33 | if ( hdir == "C:\\" ) { // win 98 or ME |
34 | QDir app_dir; | 34 | QDir app_dir; |
35 | if ( !app_dir.exists("C:\\kdepim") ) | 35 | if ( !app_dir.exists("C:\\kdepim") ) |
36 | app_dir.mkdir ("C:\\kdepim"); | 36 | app_dir.mkdir ("C:\\kdepim"); |
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | 38 | app_dir.mkdir ("C:\\kdepim\\apps"); |
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
40 | app_dir.mkdir ("C:\\kdepim\\config"); | 40 | app_dir.mkdir ("C:\\kdepim\\config"); |
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
42 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 42 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
43 | } | 43 | } |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | bool exitHelp = false; | 46 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 47 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 48 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 49 | if ( command == "-help" ){ |
50 | printf("KA/E command line commands:\n"); | 50 | printf("KA/E command line commands:\n"); |
51 | printf(" no command: Start KA/E in usual way\n"); | 51 | printf(" no command: Start KA/E in usual way\n"); |
52 | printf(" -help: This output\n"); | 52 | printf(" -help: This output\n"); |
53 | printf(" KA/E is exiting now. Bye!\n"); | 53 | printf(" KA/E is exiting now. Bye!\n"); |
54 | exitHelp = true; | 54 | exitHelp = true; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | if ( ! exitHelp ) { | 57 | if ( ! exitHelp ) { |
58 | 58 | ||
59 | KGlobal::setAppName( "kaddressbook" ); | 59 | KGlobal::setAppName( "kaddressbook" ); |
60 | #ifndef DESKTOP_VERSION | 60 | #ifndef DESKTOP_VERSION |
61 | if ( QApplication::desktop()->width() > 320 ) | 61 | if ( QApplication::desktop()->width() > 320 ) |
62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
63 | else | 63 | else |
64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
65 | #else | 65 | #else |
66 | QString fileName ; | 66 | QString fileName ; |
67 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 67 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
68 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 68 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
69 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 69 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
73 | KAddressBookMain m ; | 73 | KAddressBookMain m ; |
74 | //US MainWindow m; | 74 | //US MainWindow m; |
75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
76 | 76 | ||
77 | { | 77 | { |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 78 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | } | 79 | } |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | a.showMainWidget( &m ); | 81 | a.showMainWidget( &m ); |
82 | QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ; | 82 | |
83 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
84 | #else | 83 | #else |
85 | a.setMainWidget( &m ); | 84 | a.setMainWidget( &m ); |
86 | m.resize (640, 480 ); | 85 | m.resize (640, 480 ); |
87 | m.show(); | 86 | m.show(); |
88 | #endif | 87 | #endif |
89 | a.exec(); | 88 | a.exec(); |
90 | #ifndef DESKTOP_VERSION | 89 | |
91 | delete c1; | ||
92 | #endif | ||
93 | 90 | ||
94 | } | 91 | } |
95 | qDebug("KA: Bye! "); | 92 | qDebug("KA: Bye! "); |
96 | } | 93 | } |
97 | 94 | ||
98 | /* | 95 | /* |
99 | #include <stdlib.h> | 96 | #include <stdlib.h> |
100 | 97 | ||
101 | #include <qstring.h> | 98 | #include <qstring.h> |
102 | 99 | ||
103 | #include <kabc/stdaddressbook.h> | 100 | #include <kabc/stdaddressbook.h> |
104 | #include <kaboutdata.h> | 101 | #include <kaboutdata.h> |
105 | #include <kcmdlineargs.h> | 102 | #include <kcmdlineargs.h> |
106 | #include <kcrash.h> | 103 | #include <kcrash.h> |
107 | #include <kdebug.h> | 104 | #include <kdebug.h> |
108 | #include <klocale.h> | 105 | #include <klocale.h> |
109 | #include <kstartupinfo.h> | 106 | #include <kstartupinfo.h> |
110 | #include <kuniqueapplication.h> | 107 | #include <kuniqueapplication.h> |
111 | #include <kwin.h> | 108 | #include <kwin.h> |
112 | 109 | ||
113 | #include "kaddressbookmain.h" | 110 | #include "kaddressbookmain.h" |
114 | #include "kabcore.h" | 111 | #include "kabcore.h" |
115 | 112 | ||
116 | extern "C" { | 113 | extern "C" { |
117 | 114 | ||
118 | void crashHandler( int ) | 115 | void crashHandler( int ) |
119 | { | 116 | { |
120 | KABC::StdAddressBook::handleCrash(); | 117 | KABC::StdAddressBook::handleCrash(); |
121 | ::exit( 0 ); | 118 | ::exit( 0 ); |
122 | } | 119 | } |
123 | 120 | ||
124 | } | 121 | } |
125 | 122 | ||
126 | class KAddressBookApp : public KUniqueApplication { | 123 | class KAddressBookApp : public KUniqueApplication { |
127 | public: | 124 | public: |
128 | KAddressBookApp() : mMainWin( 0 ) {} | 125 | KAddressBookApp() : mMainWin( 0 ) {} |
129 | ~KAddressBookApp() {} | 126 | ~KAddressBookApp() {} |
130 | 127 | ||
131 | int newInstance(); | 128 | int newInstance(); |
132 | 129 | ||
133 | private: | 130 | private: |
134 | KAddressBookMain *mMainWin; | 131 | KAddressBookMain *mMainWin; |
135 | }; | 132 | }; |
136 | 133 | ||
137 | int KAddressBookApp::newInstance() | 134 | int KAddressBookApp::newInstance() |
138 | { | 135 | { |
139 | if ( isRestored() ) { | 136 | if ( isRestored() ) { |
140 | // There can only be one main window | 137 | // There can only be one main window |
141 | if ( KMainWindow::canBeRestored( 1 ) ) { | 138 | if ( KMainWindow::canBeRestored( 1 ) ) { |
142 | mMainWin = new KAddressBookMain; | 139 | mMainWin = new KAddressBookMain; |
143 | mMainWin->show(); | 140 | mMainWin->show(); |
144 | mMainWin->restore( 1 ); | 141 | mMainWin->restore( 1 ); |
145 | } | 142 | } |
146 | } else { | 143 | } else { |
147 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 144 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
148 | 145 | ||
149 | QCString addrStr = args->getOption( "addr" ); | 146 | QCString addrStr = args->getOption( "addr" ); |
150 | QCString uidStr = args->getOption( "uid" ); | 147 | QCString uidStr = args->getOption( "uid" ); |
151 | QString addr; | 148 | QString addr; |
152 | QString uid; | 149 | QString uid; |
153 | if ( !addrStr.isEmpty() ) | 150 | if ( !addrStr.isEmpty() ) |
154 | addr = QString::fromLocal8Bit( addrStr ); | 151 | addr = QString::fromLocal8Bit( addrStr ); |
155 | if ( !uidStr.isEmpty() ) | 152 | if ( !uidStr.isEmpty() ) |
156 | uid = QString::fromLocal8Bit( uidStr ); | 153 | uid = QString::fromLocal8Bit( uidStr ); |
157 | 154 | ||
158 | 155 | ||
159 | if ( args->isSet( "editor-only" ) ) { | 156 | if ( args->isSet( "editor-only" ) ) { |
160 | if ( !mMainWin ) | 157 | if ( !mMainWin ) |
161 | mMainWin = new KAddressBookMain; | 158 | mMainWin = new KAddressBookMain; |
162 | KStartupInfo::appStarted(); | 159 | KStartupInfo::appStarted(); |
163 | mMainWin->hide(); | 160 | mMainWin->hide(); |
164 | } else { | 161 | } else { |
165 | if ( mMainWin ) { | 162 | if ( mMainWin ) { |
166 | mMainWin->show(); | 163 | mMainWin->show(); |
167 | KWin::setActiveWindow( mMainWin->winId() ); | 164 | KWin::setActiveWindow( mMainWin->winId() ); |
168 | } else { | 165 | } else { |
169 | mMainWin = new KAddressBookMain; | 166 | mMainWin = new KAddressBookMain; |
170 | mMainWin->show(); | 167 | mMainWin->show(); |
171 | } | 168 | } |
172 | } | 169 | } |
173 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do | 170 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do |
174 | if ( !addr.isEmpty() ) | 171 | if ( !addr.isEmpty() ) |
175 | mMainWin->addEmail( addr ); | 172 | mMainWin->addEmail( addr ); |
176 | 173 | ||
177 | if ( !uid.isEmpty() ) | 174 | if ( !uid.isEmpty() ) |
178 | mMainWin->showContactEditor( uid ); | 175 | mMainWin->showContactEditor( uid ); |
179 | if ( args->isSet( "new-contact" ) ) { | 176 | if ( args->isSet( "new-contact" ) ) { |
180 | mMainWin->newContact(); | 177 | mMainWin->newContact(); |
181 | } | 178 | } |
182 | } | 179 | } |
183 | 180 | ||
184 | KCrash::setEmergencySaveFunction( crashHandler ); | 181 | KCrash::setEmergencySaveFunction( crashHandler ); |
185 | 182 | ||
186 | return 0; | 183 | return 0; |
187 | } | 184 | } |
188 | 185 | ||
189 | // the dummy argument is required, because KMail apparently sends an empty | 186 | // the dummy argument is required, because KMail apparently sends an empty |
190 | // argument. | 187 | // argument. |
191 | static KCmdLineOptions kmoptions[] = | 188 | static KCmdLineOptions kmoptions[] = |
192 | { | 189 | { |
193 | { "a", 0 , 0 }, | 190 | { "a", 0 , 0 }, |
194 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, | 191 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, |
195 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, | 192 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, |
196 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, | 193 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, |
197 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, | 194 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, |
198 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, | 195 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, |
199 | { 0, 0, 0} | 196 | { 0, 0, 0} |
200 | }; | 197 | }; |
201 | 198 | ||
202 | int main( int argc, char *argv[] ) | 199 | int main( int argc, char *argv[] ) |
203 | { | 200 | { |
204 | KLocale::setMainCatalogue( "kaddressbook" ); | 201 | KLocale::setMainCatalogue( "kaddressbook" ); |
205 | 202 | ||
206 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); | 203 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); |
207 | KCmdLineArgs::addCmdLineOptions( kmoptions ); | 204 | KCmdLineArgs::addCmdLineOptions( kmoptions ); |
208 | KUniqueApplication::addCmdLineOptions(); | 205 | KUniqueApplication::addCmdLineOptions(); |
209 | 206 | ||
210 | if ( !KAddressBookApp::start() ) | 207 | if ( !KAddressBookApp::start() ) |
211 | exit( 0 ); | 208 | exit( 0 ); |
212 | 209 | ||
213 | KAddressBookApp app; | 210 | KAddressBookApp app; |
214 | KGlobal::locale()->insertCatalogue( "libkdepim" ); | 211 | KGlobal::locale()->insertCatalogue( "libkdepim" ); |
215 | 212 | ||
216 | return app.exec(); | 213 | return app.exec(); |
217 | } | 214 | } |
218 | */ | 215 | */ |