author | ulf69 <ulf69> | 2004-08-10 16:25:06 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 16:25:06 (UTC) |
commit | 972b441aa3435f4f9df6de2a36ba2d03a7de5bbc (patch) (unidiff) | |
tree | 62ba0f85b223a10ec82cee5d7ddcfda84a0af21a /kaddressbook | |
parent | c56c4729e32a9c8ba8709493b3ea11cf7cf229d3 (diff) | |
download | kdepimpi-972b441aa3435f4f9df6de2a36ba2d03a7de5bbc.zip kdepimpi-972b441aa3435f4f9df6de2a36ba2d03a7de5bbc.tar.gz kdepimpi-972b441aa3435f4f9df6de2a36ba2d03a7de5bbc.tar.bz2 |
removed unneedded references to qtopia/services.h
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index fe4841a..d6f0cee 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,1621 +1,1619 @@ | |||
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 | #include "kabcore.h" | 24 | #include "kabcore.h" |
25 | 25 | ||
26 | #include <stdaddressbook.h> | 26 | #include <stdaddressbook.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #include <qclipboard.h> | 30 | #include <qclipboard.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplicaton.h> | 33 | #include <qapplicaton.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | #include <kabc/addresseelist.h> | 37 | #include <kabc/addresseelist.h> |
38 | #include <kabc/errorhandler.h> | 38 | #include <kabc/errorhandler.h> |
39 | #include <kabc/resource.h> | 39 | #include <kabc/resource.h> |
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include <kapplication.h> | 66 | #include <kapplication.h> |
67 | #include "KDGanttMinimizeSplitter.h" | 67 | #include "KDGanttMinimizeSplitter.h" |
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | 79 | ||
80 | //#include <qlabel.h> | 80 | //#include <qlabel.h> |
81 | 81 | ||
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | #include <qtopia/services.h> | ||
85 | #include <qtopia/qcopenvelope_qws.h> | ||
86 | #include <qpe/ir.h> | 84 | #include <qpe/ir.h> |
87 | #endif | 85 | #endif |
88 | 86 | ||
89 | #endif // KAB_EMBEDDED | 87 | #endif // KAB_EMBEDDED |
90 | #include "kcmconfigs/kcmkabconfig.h" | 88 | #include "kcmconfigs/kcmkabconfig.h" |
91 | #include "kcmconfigs/kcmkdepimconfig.h" | 89 | #include "kcmconfigs/kcmkdepimconfig.h" |
92 | #include "kpimglobalprefs.h" | 90 | #include "kpimglobalprefs.h" |
93 | #include "externalapphandler.h" | 91 | #include "externalapphandler.h" |
94 | 92 | ||
95 | 93 | ||
96 | #include <kresources/selectdialog.h> | 94 | #include <kresources/selectdialog.h> |
97 | #include <kmessagebox.h> | 95 | #include <kmessagebox.h> |
98 | 96 | ||
99 | #include <picture.h> | 97 | #include <picture.h> |
100 | #include <resource.h> | 98 | #include <resource.h> |
101 | 99 | ||
102 | //US#include <qsplitter.h> | 100 | //US#include <qsplitter.h> |
103 | #include <qmap.h> | 101 | #include <qmap.h> |
104 | #include <qdir.h> | 102 | #include <qdir.h> |
105 | #include <qfile.h> | 103 | #include <qfile.h> |
106 | #include <qvbox.h> | 104 | #include <qvbox.h> |
107 | #include <qlayout.h> | 105 | #include <qlayout.h> |
108 | #include <qclipboard.h> | 106 | #include <qclipboard.h> |
109 | #include <qtextstream.h> | 107 | #include <qtextstream.h> |
110 | 108 | ||
111 | #include <libkdepim/categoryselectdialog.h> | 109 | #include <libkdepim/categoryselectdialog.h> |
112 | #include <kabc/vcardconverter.h> | 110 | #include <kabc/vcardconverter.h> |
113 | 111 | ||
114 | 112 | ||
115 | #include "addresseeutil.h" | 113 | #include "addresseeutil.h" |
116 | #include "undocmds.h" | 114 | #include "undocmds.h" |
117 | #include "addresseeeditordialog.h" | 115 | #include "addresseeeditordialog.h" |
118 | #include "viewmanager.h" | 116 | #include "viewmanager.h" |
119 | #include "details/detailsviewcontainer.h" | 117 | #include "details/detailsviewcontainer.h" |
120 | #include "kabprefs.h" | 118 | #include "kabprefs.h" |
121 | #include "xxportmanager.h" | 119 | #include "xxportmanager.h" |
122 | #include "incsearchwidget.h" | 120 | #include "incsearchwidget.h" |
123 | #include "jumpbuttonbar.h" | 121 | #include "jumpbuttonbar.h" |
124 | #include "extensionmanager.h" | 122 | #include "extensionmanager.h" |
125 | #include "addresseeconfig.h" | 123 | #include "addresseeconfig.h" |
126 | #include <kcmultidialog.h> | 124 | #include <kcmultidialog.h> |
127 | 125 | ||
128 | #ifdef _WIN32_ | 126 | #ifdef _WIN32_ |
129 | 127 | ||
130 | #include "kaimportoldialog.h" | 128 | #include "kaimportoldialog.h" |
131 | #endif | 129 | #endif |
132 | 130 | ||
133 | bool pasteWithNewUid = true; | 131 | bool pasteWithNewUid = true; |
134 | 132 | ||
135 | #ifdef KAB_EMBEDDED | 133 | #ifdef KAB_EMBEDDED |
136 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 134 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
137 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 135 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
138 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 136 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
139 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 137 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
140 | #else //KAB_EMBEDDED | 138 | #else //KAB_EMBEDDED |
141 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 139 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
142 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 140 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
143 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 141 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
144 | mReadWrite( readWrite ), mModified( false ) | 142 | mReadWrite( readWrite ), mModified( false ) |
145 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
146 | { | 144 | { |
147 | 145 | ||
148 | mExtensionBarSplitter = 0; | 146 | mExtensionBarSplitter = 0; |
149 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 147 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
150 | 148 | ||
151 | mAddressBook = KABC::StdAddressBook::self(); | 149 | mAddressBook = KABC::StdAddressBook::self(); |
152 | KABC::StdAddressBook::setAutomaticSave( false ); | 150 | KABC::StdAddressBook::setAutomaticSave( false ); |
153 | 151 | ||
154 | #ifndef KAB_EMBEDDED | 152 | #ifndef KAB_EMBEDDED |
155 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 153 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
156 | #endif //KAB_EMBEDDED | 154 | #endif //KAB_EMBEDDED |
157 | 155 | ||
158 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 156 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
159 | SLOT( addressBookChanged() ) ); | 157 | SLOT( addressBookChanged() ) ); |
160 | 158 | ||
161 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 159 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
162 | "X-Department", "KADDRESSBOOK" ); | 160 | "X-Department", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 161 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
164 | "X-Profession", "KADDRESSBOOK" ); | 162 | "X-Profession", "KADDRESSBOOK" ); |
165 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 163 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
166 | "X-AssistantsName", "KADDRESSBOOK" ); | 164 | "X-AssistantsName", "KADDRESSBOOK" ); |
167 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 165 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
168 | "X-ManagersName", "KADDRESSBOOK" ); | 166 | "X-ManagersName", "KADDRESSBOOK" ); |
169 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 167 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
170 | "X-SpousesName", "KADDRESSBOOK" ); | 168 | "X-SpousesName", "KADDRESSBOOK" ); |
171 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 169 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
172 | "X-Office", "KADDRESSBOOK" ); | 170 | "X-Office", "KADDRESSBOOK" ); |
173 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 171 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
174 | "X-IMAddress", "KADDRESSBOOK" ); | 172 | "X-IMAddress", "KADDRESSBOOK" ); |
175 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 173 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
176 | "X-Anniversary", "KADDRESSBOOK" ); | 174 | "X-Anniversary", "KADDRESSBOOK" ); |
177 | 175 | ||
178 | //US added this field to become compatible with Opie/qtopia addressbook | 176 | //US added this field to become compatible with Opie/qtopia addressbook |
179 | // values can be "female" or "male" or "". An empty field represents undefined. | 177 | // values can be "female" or "male" or "". An empty field represents undefined. |
180 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 178 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
181 | "X-Gender", "KADDRESSBOOK" ); | 179 | "X-Gender", "KADDRESSBOOK" ); |
182 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 180 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
183 | "X-Children", "KADDRESSBOOK" ); | 181 | "X-Children", "KADDRESSBOOK" ); |
184 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 182 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
185 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 183 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
186 | 184 | ||
187 | initGUI(); | 185 | initGUI(); |
188 | 186 | ||
189 | mIncSearchWidget->setFocus(); | 187 | mIncSearchWidget->setFocus(); |
190 | 188 | ||
191 | 189 | ||
192 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 190 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
193 | SLOT( setContactSelected( const QString& ) ) ); | 191 | SLOT( setContactSelected( const QString& ) ) ); |
194 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 192 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
195 | SLOT( editContact( const QString& ) ) ); | 193 | SLOT( editContact( const QString& ) ) ); |
196 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 194 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
197 | SLOT( deleteContacts( ) ) ); | 195 | SLOT( deleteContacts( ) ) ); |
198 | connect( mViewManager, SIGNAL( modified() ), | 196 | connect( mViewManager, SIGNAL( modified() ), |
199 | SLOT( setModified() ) ); | 197 | SLOT( setModified() ) ); |
200 | 198 | ||
201 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 199 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
202 | 200 | ||
203 | connect( mXXPortManager, SIGNAL( modified() ), | 201 | connect( mXXPortManager, SIGNAL( modified() ), |
204 | SLOT( setModified() ) ); | 202 | SLOT( setModified() ) ); |
205 | 203 | ||
206 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 204 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
207 | SLOT( incrementalSearch( const QString& ) ) ); | 205 | SLOT( incrementalSearch( const QString& ) ) ); |
208 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 206 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
209 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 207 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
210 | 208 | ||
211 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 209 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
212 | SLOT( sendMail( const QString& ) ) ); | 210 | SLOT( sendMail( const QString& ) ) ); |
213 | 211 | ||
214 | #ifndef KAB_EMBEDDED | 212 | #ifndef KAB_EMBEDDED |
215 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 213 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
216 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 214 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
217 | 215 | ||
218 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 216 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
219 | SLOT( browse( const QString& ) ) ); | 217 | SLOT( browse( const QString& ) ) ); |
220 | 218 | ||
221 | mAddressBookService = new KAddressBookService( this ); | 219 | mAddressBookService = new KAddressBookService( this ); |
222 | 220 | ||
223 | #endif //KAB_EMBEDDED | 221 | #endif //KAB_EMBEDDED |
224 | mEditorDialog = 0; | 222 | mEditorDialog = 0; |
225 | createAddresseeEditorDialog( this ); | 223 | createAddresseeEditorDialog( this ); |
226 | setModified( false ); | 224 | setModified( false ); |
227 | } | 225 | } |
228 | 226 | ||
229 | KABCore::~KABCore() | 227 | KABCore::~KABCore() |
230 | { | 228 | { |
231 | // save(); | 229 | // save(); |
232 | //saveSettings(); | 230 | //saveSettings(); |
233 | //KABPrefs::instance()->writeConfig(); | 231 | //KABPrefs::instance()->writeConfig(); |
234 | delete AddresseeConfig::instance(); | 232 | delete AddresseeConfig::instance(); |
235 | mAddressBook = 0; | 233 | mAddressBook = 0; |
236 | KABC::StdAddressBook::close(); | 234 | KABC::StdAddressBook::close(); |
237 | } | 235 | } |
238 | 236 | ||
239 | void KABCore::restoreSettings() | 237 | void KABCore::restoreSettings() |
240 | { | 238 | { |
241 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 239 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
242 | 240 | ||
243 | mActionJumpBar->setChecked( state ); | 241 | mActionJumpBar->setChecked( state ); |
244 | setJumpButtonBarVisible( state ); | 242 | setJumpButtonBarVisible( state ); |
245 | 243 | ||
246 | state = KABPrefs::instance()->mDetailsPageVisible; | 244 | state = KABPrefs::instance()->mDetailsPageVisible; |
247 | 245 | ||
248 | mActionDetails->setChecked( state ); | 246 | mActionDetails->setChecked( state ); |
249 | setDetailsVisible( state ); | 247 | setDetailsVisible( state ); |
250 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 248 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
251 | if ( splitterSize.count() == 0 ) { | 249 | if ( splitterSize.count() == 0 ) { |
252 | splitterSize.append( width() / 2 ); | 250 | splitterSize.append( width() / 2 ); |
253 | splitterSize.append( width() / 2 ); | 251 | splitterSize.append( width() / 2 ); |
254 | } | 252 | } |
255 | mMiniSplitter->setSizes( splitterSize ); | 253 | mMiniSplitter->setSizes( splitterSize ); |
256 | if ( mExtensionBarSplitter ) { | 254 | if ( mExtensionBarSplitter ) { |
257 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 255 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
258 | if ( splitterSize.count() == 0 ) { | 256 | if ( splitterSize.count() == 0 ) { |
259 | splitterSize.append( width() / 2 ); | 257 | splitterSize.append( width() / 2 ); |
260 | splitterSize.append( width() / 2 ); | 258 | splitterSize.append( width() / 2 ); |
261 | } | 259 | } |
262 | mExtensionBarSplitter->setSizes( splitterSize ); | 260 | mExtensionBarSplitter->setSizes( splitterSize ); |
263 | 261 | ||
264 | } | 262 | } |
265 | #ifndef KAB_EMBEDDED | 263 | #ifndef KAB_EMBEDDED |
266 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 264 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
267 | if ( splitterSize.count() == 0 ) { | 265 | if ( splitterSize.count() == 0 ) { |
268 | splitterSize.append( width() / 2 ); | 266 | splitterSize.append( width() / 2 ); |
269 | splitterSize.append( width() / 2 ); | 267 | splitterSize.append( width() / 2 ); |
270 | } | 268 | } |
271 | mExtensionBarSplitter->setSizes( splitterSize ); | 269 | mExtensionBarSplitter->setSizes( splitterSize ); |
272 | 270 | ||
273 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 271 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
274 | if ( splitterSize.count() == 0 ) { | 272 | if ( splitterSize.count() == 0 ) { |
275 | splitterSize.append( height() / 2 ); | 273 | splitterSize.append( height() / 2 ); |
276 | splitterSize.append( height() / 2 ); | 274 | splitterSize.append( height() / 2 ); |
277 | } | 275 | } |
278 | mDetailsSplitter->setSizes( splitterSize ); | 276 | mDetailsSplitter->setSizes( splitterSize ); |
279 | 277 | ||
280 | mExtensionManager->restoreSettings(); | 278 | mExtensionManager->restoreSettings(); |
281 | 279 | ||
282 | #endif //KAB_EMBEDDED | 280 | #endif //KAB_EMBEDDED |
283 | 281 | ||
284 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 282 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
285 | 283 | ||
286 | mViewManager->restoreSettings(); | 284 | mViewManager->restoreSettings(); |
287 | mExtensionManager->restoreSettings(); | 285 | mExtensionManager->restoreSettings(); |
288 | } | 286 | } |
289 | 287 | ||
290 | void KABCore::saveSettings() | 288 | void KABCore::saveSettings() |
291 | { | 289 | { |
292 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 290 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
293 | if ( mExtensionBarSplitter ) | 291 | if ( mExtensionBarSplitter ) |
294 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 292 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
295 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 293 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
296 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 294 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
297 | #ifndef KAB_EMBEDDED | 295 | #ifndef KAB_EMBEDDED |
298 | 296 | ||
299 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 297 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
300 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 298 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
301 | #endif //KAB_EMBEDDED | 299 | #endif //KAB_EMBEDDED |
302 | mExtensionManager->saveSettings(); | 300 | mExtensionManager->saveSettings(); |
303 | mViewManager->saveSettings(); | 301 | mViewManager->saveSettings(); |
304 | 302 | ||
305 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 303 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
306 | 304 | ||
307 | } | 305 | } |
308 | 306 | ||
309 | KABC::AddressBook *KABCore::addressBook() const | 307 | KABC::AddressBook *KABCore::addressBook() const |
310 | { | 308 | { |
311 | return mAddressBook; | 309 | return mAddressBook; |
312 | } | 310 | } |
313 | 311 | ||
314 | KConfig *KABCore::config() | 312 | KConfig *KABCore::config() |
315 | { | 313 | { |
316 | #ifndef KAB_EMBEDDED | 314 | #ifndef KAB_EMBEDDED |
317 | return KABPrefs::instance()->config(); | 315 | return KABPrefs::instance()->config(); |
318 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
319 | return KABPrefs::instance()->getConfig(); | 317 | return KABPrefs::instance()->getConfig(); |
320 | #endif //KAB_EMBEDDED | 318 | #endif //KAB_EMBEDDED |
321 | } | 319 | } |
322 | 320 | ||
323 | KActionCollection *KABCore::actionCollection() const | 321 | KActionCollection *KABCore::actionCollection() const |
324 | { | 322 | { |
325 | return mGUIClient->actionCollection(); | 323 | return mGUIClient->actionCollection(); |
326 | } | 324 | } |
327 | 325 | ||
328 | KABC::Field *KABCore::currentSearchField() const | 326 | KABC::Field *KABCore::currentSearchField() const |
329 | { | 327 | { |
330 | if (mIncSearchWidget) | 328 | if (mIncSearchWidget) |
331 | return mIncSearchWidget->currentField(); | 329 | return mIncSearchWidget->currentField(); |
332 | else | 330 | else |
333 | return 0; | 331 | return 0; |
334 | } | 332 | } |
335 | 333 | ||
336 | QStringList KABCore::selectedUIDs() const | 334 | QStringList KABCore::selectedUIDs() const |
337 | { | 335 | { |
338 | return mViewManager->selectedUids(); | 336 | return mViewManager->selectedUids(); |
339 | } | 337 | } |
340 | 338 | ||
341 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 339 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
342 | { | 340 | { |
343 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 341 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
344 | 342 | ||
345 | QPtrList<KRES::Resource> kresResources; | 343 | QPtrList<KRES::Resource> kresResources; |
346 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 344 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
347 | KABC::Resource *resource; | 345 | KABC::Resource *resource; |
348 | while ( ( resource = resIt.current() ) != 0 ) { | 346 | while ( ( resource = resIt.current() ) != 0 ) { |
349 | ++resIt; | 347 | ++resIt; |
350 | if ( !resource->readOnly() ) { | 348 | if ( !resource->readOnly() ) { |
351 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 349 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
352 | if ( res ) | 350 | if ( res ) |
353 | kresResources.append( res ); | 351 | kresResources.append( res ); |
354 | } | 352 | } |
355 | } | 353 | } |
356 | 354 | ||
357 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 355 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
358 | return static_cast<KABC::Resource*>( res ); | 356 | return static_cast<KABC::Resource*>( res ); |
359 | } | 357 | } |
360 | 358 | ||
361 | #ifndef KAB_EMBEDDED | 359 | #ifndef KAB_EMBEDDED |
362 | KAboutData *KABCore::createAboutData() | 360 | KAboutData *KABCore::createAboutData() |
363 | #else //KAB_EMBEDDED | 361 | #else //KAB_EMBEDDED |
364 | void KABCore::createAboutData() | 362 | void KABCore::createAboutData() |
365 | #endif //KAB_EMBEDDED | 363 | #endif //KAB_EMBEDDED |
366 | { | 364 | { |
367 | #ifndef KAB_EMBEDDED | 365 | #ifndef KAB_EMBEDDED |
368 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 366 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
369 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 367 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
370 | KAboutData::License_GPL_V2, | 368 | KAboutData::License_GPL_V2, |
371 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 369 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
372 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 370 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
373 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 371 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
374 | about->addAuthor( "Cornelius Schumacher", | 372 | about->addAuthor( "Cornelius Schumacher", |
375 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 373 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
376 | "schumacher@kde.org" ); | 374 | "schumacher@kde.org" ); |
377 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 375 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
378 | "mpilone@slac.com" ); | 376 | "mpilone@slac.com" ); |
379 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 377 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
380 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 378 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
381 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 379 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
382 | "michel@klaralvdalens-datakonsult.se" ); | 380 | "michel@klaralvdalens-datakonsult.se" ); |
383 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 381 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
384 | "hansen@kde.org" ); | 382 | "hansen@kde.org" ); |
385 | 383 | ||
386 | return about; | 384 | return about; |
387 | #endif //KAB_EMBEDDED | 385 | #endif //KAB_EMBEDDED |
388 | 386 | ||
389 | QString version; | 387 | QString version; |
390 | #include <../version> | 388 | #include <../version> |
391 | QMessageBox::about( this, "About KAddressbook/Pi", | 389 | QMessageBox::about( this, "About KAddressbook/Pi", |
392 | "KAddressbook/Platform-independent\n" | 390 | "KAddressbook/Platform-independent\n" |
393 | "(KA/Pi) " +version + " - " + | 391 | "(KA/Pi) " +version + " - " + |
394 | #ifdef DESKTOP_VERSION | 392 | #ifdef DESKTOP_VERSION |
395 | "Desktop Edition\n" | 393 | "Desktop Edition\n" |
396 | #else | 394 | #else |
397 | "PDA-Edition\n" | 395 | "PDA-Edition\n" |
398 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 396 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
399 | #endif | 397 | #endif |
400 | 398 | ||
401 | "(c) 2004 Ulf Schenk\n" | 399 | "(c) 2004 Ulf Schenk\n" |
402 | "(c) 1997-2003, The KDE PIM Team\n" | 400 | "(c) 1997-2003, The KDE PIM Team\n" |
403 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 401 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
404 | "Don Sanders Original author\n" | 402 | "Don Sanders Original author\n" |
405 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 403 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
406 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 404 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
407 | "Greg Stern DCOP interface\n" | 405 | "Greg Stern DCOP interface\n" |
408 | "Mark Westcot Contact pinning\n" | 406 | "Mark Westcot Contact pinning\n" |
409 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 407 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
410 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" | 408 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" |
411 | #ifdef _WIN32_ | 409 | #ifdef _WIN32_ |
412 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" | 410 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" |
413 | #endif | 411 | #endif |
414 | ); | 412 | ); |
415 | } | 413 | } |
416 | 414 | ||
417 | void KABCore::setContactSelected( const QString &uid ) | 415 | void KABCore::setContactSelected( const QString &uid ) |
418 | { | 416 | { |
419 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 417 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
420 | if ( !mDetails->isHidden() ) | 418 | if ( !mDetails->isHidden() ) |
421 | mDetails->setAddressee( addr ); | 419 | mDetails->setAddressee( addr ); |
422 | 420 | ||
423 | if ( !addr.isEmpty() ) { | 421 | if ( !addr.isEmpty() ) { |
424 | emit contactSelected( addr.formattedName() ); | 422 | emit contactSelected( addr.formattedName() ); |
425 | KABC::Picture pic = addr.photo(); | 423 | KABC::Picture pic = addr.photo(); |
426 | if ( pic.isIntern() ) { | 424 | if ( pic.isIntern() ) { |
427 | //US emit contactSelected( pic.data() ); | 425 | //US emit contactSelected( pic.data() ); |
428 | //US instead use: | 426 | //US instead use: |
429 | QPixmap px; | 427 | QPixmap px; |
430 | if (pic.data().isNull() != true) | 428 | if (pic.data().isNull() != true) |
431 | { | 429 | { |
432 | px.convertFromImage(pic.data()); | 430 | px.convertFromImage(pic.data()); |
433 | } | 431 | } |
434 | 432 | ||
435 | emit contactSelected( px ); | 433 | emit contactSelected( px ); |
436 | } | 434 | } |
437 | } | 435 | } |
438 | 436 | ||
439 | 437 | ||
440 | mExtensionManager->setSelectionChanged(); | 438 | mExtensionManager->setSelectionChanged(); |
441 | 439 | ||
442 | // update the actions | 440 | // update the actions |
443 | bool selected = !uid.isEmpty(); | 441 | bool selected = !uid.isEmpty(); |
444 | 442 | ||
445 | if ( mReadWrite ) { | 443 | if ( mReadWrite ) { |
446 | mActionCut->setEnabled( selected ); | 444 | mActionCut->setEnabled( selected ); |
447 | mActionPaste->setEnabled( selected ); | 445 | mActionPaste->setEnabled( selected ); |
448 | } | 446 | } |
449 | 447 | ||
450 | mActionCopy->setEnabled( selected ); | 448 | mActionCopy->setEnabled( selected ); |
451 | mActionDelete->setEnabled( selected ); | 449 | mActionDelete->setEnabled( selected ); |
452 | mActionEditAddressee->setEnabled( selected ); | 450 | mActionEditAddressee->setEnabled( selected ); |
453 | mActionMail->setEnabled( selected ); | 451 | mActionMail->setEnabled( selected ); |
454 | mActionMailVCard->setEnabled( selected ); | 452 | mActionMailVCard->setEnabled( selected ); |
455 | //if (mActionBeam) | 453 | //if (mActionBeam) |
456 | //mActionBeam->setEnabled( selected ); | 454 | //mActionBeam->setEnabled( selected ); |
457 | 455 | ||
458 | if (mActionBeamVCard) | 456 | if (mActionBeamVCard) |
459 | mActionBeamVCard->setEnabled( selected ); | 457 | mActionBeamVCard->setEnabled( selected ); |
460 | 458 | ||
461 | mActionWhoAmI->setEnabled( selected ); | 459 | mActionWhoAmI->setEnabled( selected ); |
462 | mActionCategories->setEnabled( selected ); | 460 | mActionCategories->setEnabled( selected ); |
463 | } | 461 | } |
464 | 462 | ||
465 | void KABCore::sendMail() | 463 | void KABCore::sendMail() |
466 | { | 464 | { |
467 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
468 | } | 466 | } |
469 | 467 | ||
470 | void KABCore::sendMail( const QString& email ) | 468 | void KABCore::sendMail( const QString& email ) |
471 | { | 469 | { |
472 | bool result = ExternalAppHandler::instance()->mailToContacts(email); | 470 | bool result = ExternalAppHandler::instance()->mailToContacts(email); |
473 | } | 471 | } |
474 | 472 | ||
475 | 473 | ||
476 | 474 | ||
477 | void KABCore::mailVCard() | 475 | void KABCore::mailVCard() |
478 | { | 476 | { |
479 | QStringList uids = mViewManager->selectedUids(); | 477 | QStringList uids = mViewManager->selectedUids(); |
480 | if ( !uids.isEmpty() ) | 478 | if ( !uids.isEmpty() ) |
481 | mailVCard( uids ); | 479 | mailVCard( uids ); |
482 | } | 480 | } |
483 | 481 | ||
484 | void KABCore::mailVCard( const QStringList& uids ) | 482 | void KABCore::mailVCard( const QStringList& uids ) |
485 | { | 483 | { |
486 | QStringList urls; | 484 | QStringList urls; |
487 | 485 | ||
488 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 486 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
489 | 487 | ||
490 | /*US | 488 | /*US |
491 | // Create a temp dir, so that we can put the files in it with proper names | 489 | // Create a temp dir, so that we can put the files in it with proper names |
492 | KTempFile tempDir; | 490 | KTempFile tempDir; |
493 | if ( tempDir.status() != 0 ) { | 491 | if ( tempDir.status() != 0 ) { |
494 | kdWarning() << strerror( tempDir.status() ) << endl; | 492 | kdWarning() << strerror( tempDir.status() ) << endl; |
495 | return; | 493 | return; |
496 | } | 494 | } |
497 | 495 | ||
498 | QString dirName = tempDir.name(); | 496 | QString dirName = tempDir.name(); |
499 | tempDir.unlink(); | 497 | tempDir.unlink(); |
500 | */ | 498 | */ |
501 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 499 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
502 | 500 | ||
503 | 501 | ||
504 | 502 | ||
505 | QDir().mkdir( dirName, true ); | 503 | QDir().mkdir( dirName, true ); |
506 | 504 | ||
507 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 505 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
508 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 506 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
509 | 507 | ||
510 | if ( a.isEmpty() ) | 508 | if ( a.isEmpty() ) |
511 | continue; | 509 | continue; |
512 | 510 | ||
513 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 511 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
514 | 512 | ||
515 | QString fileName = dirName + "/" + name; | 513 | QString fileName = dirName + "/" + name; |
516 | 514 | ||
517 | QFile outFile(fileName); | 515 | QFile outFile(fileName); |
518 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 516 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
519 | KABC::VCardConverter converter; | 517 | KABC::VCardConverter converter; |
520 | QString vcard; | 518 | QString vcard; |
521 | 519 | ||
522 | converter.addresseeToVCard( a, vcard ); | 520 | converter.addresseeToVCard( a, vcard ); |
523 | 521 | ||
524 | QTextStream t( &outFile ); // use a text stream | 522 | QTextStream t( &outFile ); // use a text stream |
525 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 523 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
526 | t << vcard; | 524 | t << vcard; |
527 | 525 | ||
528 | outFile.close(); | 526 | outFile.close(); |
529 | 527 | ||
530 | urls.append( fileName ); | 528 | urls.append( fileName ); |
531 | } | 529 | } |
532 | } | 530 | } |
533 | 531 | ||
534 | bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); | 532 | bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); |
535 | 533 | ||
536 | 534 | ||
537 | /*US | 535 | /*US |
538 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 536 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
539 | QString::null, // subject | 537 | QString::null, // subject |
540 | QString::null, // body | 538 | QString::null, // body |
541 | QString::null, | 539 | QString::null, |
542 | urls ); // attachments | 540 | urls ); // attachments |
543 | */ | 541 | */ |
544 | 542 | ||
545 | } | 543 | } |
546 | 544 | ||
547 | /** | 545 | /** |
548 | Beams the "WhoAmI contact. | 546 | Beams the "WhoAmI contact. |
549 | */ | 547 | */ |
550 | void KABCore::beamMySelf() | 548 | void KABCore::beamMySelf() |
551 | { | 549 | { |
552 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 550 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
553 | if (!a.isEmpty()) | 551 | if (!a.isEmpty()) |
554 | { | 552 | { |
555 | QStringList uids; | 553 | QStringList uids; |
556 | uids << a.uid(); | 554 | uids << a.uid(); |
557 | 555 | ||
558 | beamVCard(uids); | 556 | beamVCard(uids); |
559 | } else { | 557 | } else { |
560 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 558 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
561 | 559 | ||
562 | 560 | ||
563 | } | 561 | } |
564 | } | 562 | } |
565 | 563 | ||
566 | void KABCore::beamVCard() | 564 | void KABCore::beamVCard() |
567 | { | 565 | { |
568 | QStringList uids = mViewManager->selectedUids(); | 566 | QStringList uids = mViewManager->selectedUids(); |
569 | if ( !uids.isEmpty() ) | 567 | if ( !uids.isEmpty() ) |
570 | beamVCard( uids ); | 568 | beamVCard( uids ); |
571 | } | 569 | } |
572 | 570 | ||
573 | 571 | ||
574 | void KABCore::beamVCard(const QStringList& uids) | 572 | void KABCore::beamVCard(const QStringList& uids) |
575 | { | 573 | { |
576 | /*US | 574 | /*US |
577 | QString beamFilename; | 575 | QString beamFilename; |
578 | Opie::OPimContact c; | 576 | Opie::OPimContact c; |
579 | if ( actionPersonal->isOn() ) { | 577 | if ( actionPersonal->isOn() ) { |
580 | beamFilename = addressbookPersonalVCardName(); | 578 | beamFilename = addressbookPersonalVCardName(); |
581 | if ( !QFile::exists( beamFilename ) ) | 579 | if ( !QFile::exists( beamFilename ) ) |
582 | return; // can't beam a non-existent file | 580 | return; // can't beam a non-existent file |
583 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 581 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
584 | beamFilename ); | 582 | beamFilename ); |
585 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 583 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
586 | Opie::OPimContactAccess::List allList = access->allRecords(); | 584 | Opie::OPimContactAccess::List allList = access->allRecords(); |
587 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 585 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
588 | c = *it; | 586 | c = *it; |
589 | 587 | ||
590 | delete access; | 588 | delete access; |
591 | } else { | 589 | } else { |
592 | unlink( beamfile ); // delete if exists | 590 | unlink( beamfile ); // delete if exists |
593 | mkdir("/tmp/obex/", 0755); | 591 | mkdir("/tmp/obex/", 0755); |
594 | c = m_abView -> currentEntry(); | 592 | c = m_abView -> currentEntry(); |
595 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 593 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
596 | beamfile ); | 594 | beamfile ); |
597 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 595 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
598 | access->add( c ); | 596 | access->add( c ); |
599 | access->save(); | 597 | access->save(); |
600 | delete access; | 598 | delete access; |
601 | 599 | ||
602 | beamFilename = beamfile; | 600 | beamFilename = beamfile; |
603 | } | 601 | } |
604 | 602 | ||
605 | owarn << "Beaming: " << beamFilename << oendl; | 603 | owarn << "Beaming: " << beamFilename << oendl; |
606 | */ | 604 | */ |
607 | 605 | ||
608 | #if 0 | 606 | #if 0 |
609 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 607 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
610 | 608 | ||
611 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 609 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
612 | 610 | ||
613 | QString name = "contact.vcf"; | 611 | QString name = "contact.vcf"; |
614 | 612 | ||
615 | QString fileName = dirName + "/" + name; | 613 | QString fileName = dirName + "/" + name; |
616 | #endif | 614 | #endif |
617 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 615 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
618 | // | 616 | // |
619 | QString fileName = "/tmp/kdepimbeamfile"; | 617 | QString fileName = "/tmp/kdepimbeamfile"; |
620 | 618 | ||
621 | 619 | ||
622 | //QDir().mkdir( dirName, true ); | 620 | //QDir().mkdir( dirName, true ); |
623 | 621 | ||
624 | QFile outFile(fileName); | 622 | QFile outFile(fileName); |
625 | KABC::VCardConverter converter; | 623 | KABC::VCardConverter converter; |
626 | QString description; | 624 | QString description; |
627 | 625 | ||
628 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 626 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
629 | 627 | ||
630 | QTextStream t( &outFile ); // use a text stream | 628 | QTextStream t( &outFile ); // use a text stream |
631 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 629 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
632 | 630 | ||
633 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 631 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
634 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 632 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
635 | 633 | ||
636 | if ( a.isEmpty() ) | 634 | if ( a.isEmpty() ) |
637 | continue; | 635 | continue; |
638 | 636 | ||
639 | if (description.isEmpty()) | 637 | if (description.isEmpty()) |
640 | description = a.formattedName(); | 638 | description = a.formattedName(); |
641 | 639 | ||
642 | QString vcard; | 640 | QString vcard; |
643 | converter.addresseeToVCard( a, vcard ); | 641 | converter.addresseeToVCard( a, vcard ); |
644 | t << vcard; | 642 | t << vcard; |
645 | 643 | ||
646 | } | 644 | } |
647 | } else { | 645 | } else { |
648 | qDebug("Error open temp beam file "); | 646 | qDebug("Error open temp beam file "); |
649 | return; | 647 | return; |
650 | } | 648 | } |
651 | 649 | ||
652 | outFile.close(); | 650 | outFile.close(); |
653 | 651 | ||
654 | #ifndef DESKTOP_VERSION | 652 | #ifndef DESKTOP_VERSION |
655 | Ir *ir = new Ir( this ); | 653 | Ir *ir = new Ir( this ); |
656 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 654 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
657 | ir->send( fileName, description, "text/x-vCard" ); | 655 | ir->send( fileName, description, "text/x-vCard" ); |
658 | #endif | 656 | #endif |
659 | 657 | ||
660 | } | 658 | } |
661 | 659 | ||
662 | void KABCore::beamDone( Ir *ir ) | 660 | void KABCore::beamDone( Ir *ir ) |
663 | { | 661 | { |
664 | #ifndef DESKTOP_VERSION | 662 | #ifndef DESKTOP_VERSION |
665 | delete ir; | 663 | delete ir; |
666 | #endif | 664 | #endif |
667 | } | 665 | } |
668 | 666 | ||
669 | 667 | ||
670 | void KABCore::browse( const QString& url ) | 668 | void KABCore::browse( const QString& url ) |
671 | { | 669 | { |
672 | #ifndef KAB_EMBEDDED | 670 | #ifndef KAB_EMBEDDED |
673 | kapp->invokeBrowser( url ); | 671 | kapp->invokeBrowser( url ); |
674 | #else //KAB_EMBEDDED | 672 | #else //KAB_EMBEDDED |
675 | qDebug("KABCore::browse must be fixed"); | 673 | qDebug("KABCore::browse must be fixed"); |
676 | #endif //KAB_EMBEDDED | 674 | #endif //KAB_EMBEDDED |
677 | } | 675 | } |
678 | 676 | ||
679 | void KABCore::selectAllContacts() | 677 | void KABCore::selectAllContacts() |
680 | { | 678 | { |
681 | mViewManager->setSelected( QString::null, true ); | 679 | mViewManager->setSelected( QString::null, true ); |
682 | } | 680 | } |
683 | 681 | ||
684 | void KABCore::deleteContacts() | 682 | void KABCore::deleteContacts() |
685 | { | 683 | { |
686 | QStringList uidList = mViewManager->selectedUids(); | 684 | QStringList uidList = mViewManager->selectedUids(); |
687 | deleteContacts( uidList ); | 685 | deleteContacts( uidList ); |
688 | } | 686 | } |
689 | 687 | ||
690 | void KABCore::deleteContacts( const QStringList &uids ) | 688 | void KABCore::deleteContacts( const QStringList &uids ) |
691 | { | 689 | { |
692 | if ( uids.count() > 0 ) { | 690 | if ( uids.count() > 0 ) { |
693 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 691 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
694 | UndoStack::instance()->push( command ); | 692 | UndoStack::instance()->push( command ); |
695 | RedoStack::instance()->clear(); | 693 | RedoStack::instance()->clear(); |
696 | 694 | ||
697 | // now if we deleted anything, refresh | 695 | // now if we deleted anything, refresh |
698 | setContactSelected( QString::null ); | 696 | setContactSelected( QString::null ); |
699 | setModified( true ); | 697 | setModified( true ); |
700 | } | 698 | } |
701 | } | 699 | } |
702 | 700 | ||
703 | void KABCore::copyContacts() | 701 | void KABCore::copyContacts() |
704 | { | 702 | { |
705 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 703 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
706 | 704 | ||
707 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 705 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
708 | 706 | ||
709 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 707 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
710 | 708 | ||
711 | QClipboard *cb = QApplication::clipboard(); | 709 | QClipboard *cb = QApplication::clipboard(); |
712 | cb->setText( clipText ); | 710 | cb->setText( clipText ); |
713 | } | 711 | } |
714 | 712 | ||
715 | void KABCore::cutContacts() | 713 | void KABCore::cutContacts() |
716 | { | 714 | { |
717 | QStringList uidList = mViewManager->selectedUids(); | 715 | QStringList uidList = mViewManager->selectedUids(); |
718 | 716 | ||
719 | //US if ( uidList.size() > 0 ) { | 717 | //US if ( uidList.size() > 0 ) { |
720 | if ( uidList.count() > 0 ) { | 718 | if ( uidList.count() > 0 ) { |
721 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 719 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
722 | UndoStack::instance()->push( command ); | 720 | UndoStack::instance()->push( command ); |
723 | RedoStack::instance()->clear(); | 721 | RedoStack::instance()->clear(); |
724 | 722 | ||
725 | setModified( true ); | 723 | setModified( true ); |
726 | } | 724 | } |
727 | } | 725 | } |
728 | 726 | ||
729 | void KABCore::pasteContacts() | 727 | void KABCore::pasteContacts() |
730 | { | 728 | { |
731 | QClipboard *cb = QApplication::clipboard(); | 729 | QClipboard *cb = QApplication::clipboard(); |
732 | 730 | ||
733 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 731 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
734 | 732 | ||
735 | pasteContacts( list ); | 733 | pasteContacts( list ); |
736 | } | 734 | } |
737 | 735 | ||
738 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 736 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
739 | { | 737 | { |
740 | KABC::Resource *resource = requestResource( this ); | 738 | KABC::Resource *resource = requestResource( this ); |
741 | KABC::Addressee::List::Iterator it; | 739 | KABC::Addressee::List::Iterator it; |
742 | for ( it = list.begin(); it != list.end(); ++it ) | 740 | for ( it = list.begin(); it != list.end(); ++it ) |
743 | (*it).setResource( resource ); | 741 | (*it).setResource( resource ); |
744 | 742 | ||
745 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 743 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
746 | UndoStack::instance()->push( command ); | 744 | UndoStack::instance()->push( command ); |
747 | RedoStack::instance()->clear(); | 745 | RedoStack::instance()->clear(); |
748 | 746 | ||
749 | setModified( true ); | 747 | setModified( true ); |
750 | } | 748 | } |
751 | 749 | ||
752 | void KABCore::setWhoAmI() | 750 | void KABCore::setWhoAmI() |
753 | { | 751 | { |
754 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 752 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
755 | 753 | ||
756 | if ( addrList.count() > 1 ) { | 754 | if ( addrList.count() > 1 ) { |
757 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 755 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
758 | return; | 756 | return; |
759 | } | 757 | } |
760 | 758 | ||
761 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 759 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
762 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 760 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
763 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 761 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
764 | } | 762 | } |
765 | 763 | ||
766 | void KABCore::setCategories() | 764 | void KABCore::setCategories() |
767 | { | 765 | { |
768 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 766 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
769 | if ( !dlg.exec() ) | 767 | if ( !dlg.exec() ) |
770 | return; | 768 | return; |
771 | 769 | ||
772 | bool merge = false; | 770 | bool merge = false; |
773 | QString msg = i18n( "Merge with existing categories?" ); | 771 | QString msg = i18n( "Merge with existing categories?" ); |
774 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 772 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
775 | merge = true; | 773 | merge = true; |
776 | 774 | ||
777 | QStringList categories = dlg.selectedCategories(); | 775 | QStringList categories = dlg.selectedCategories(); |
778 | 776 | ||
779 | QStringList uids = mViewManager->selectedUids(); | 777 | QStringList uids = mViewManager->selectedUids(); |
780 | QStringList::Iterator it; | 778 | QStringList::Iterator it; |
781 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 779 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
782 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 780 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
783 | if ( !addr.isEmpty() ) { | 781 | if ( !addr.isEmpty() ) { |
784 | if ( !merge ) | 782 | if ( !merge ) |
785 | addr.setCategories( categories ); | 783 | addr.setCategories( categories ); |
786 | else { | 784 | else { |
787 | QStringList addrCategories = addr.categories(); | 785 | QStringList addrCategories = addr.categories(); |
788 | QStringList::Iterator catIt; | 786 | QStringList::Iterator catIt; |
789 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 787 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
790 | if ( !addrCategories.contains( *catIt ) ) | 788 | if ( !addrCategories.contains( *catIt ) ) |
791 | addrCategories.append( *catIt ); | 789 | addrCategories.append( *catIt ); |
792 | } | 790 | } |
793 | addr.setCategories( addrCategories ); | 791 | addr.setCategories( addrCategories ); |
794 | } | 792 | } |
795 | 793 | ||
796 | mAddressBook->insertAddressee( addr ); | 794 | mAddressBook->insertAddressee( addr ); |
797 | } | 795 | } |
798 | } | 796 | } |
799 | 797 | ||
800 | if ( uids.count() > 0 ) | 798 | if ( uids.count() > 0 ) |
801 | setModified( true ); | 799 | setModified( true ); |
802 | } | 800 | } |
803 | 801 | ||
804 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 802 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
805 | { | 803 | { |
806 | mIncSearchWidget->setFields( fields ); | 804 | mIncSearchWidget->setFields( fields ); |
807 | } | 805 | } |
808 | 806 | ||
809 | void KABCore::incrementalSearch( const QString& text ) | 807 | void KABCore::incrementalSearch( const QString& text ) |
810 | { | 808 | { |
811 | mViewManager->setSelected( QString::null, false ); | 809 | mViewManager->setSelected( QString::null, false ); |
812 | 810 | ||
813 | if ( !text.isEmpty() ) { | 811 | if ( !text.isEmpty() ) { |
814 | KABC::Field *field = mIncSearchWidget->currentField(); | 812 | KABC::Field *field = mIncSearchWidget->currentField(); |
815 | 813 | ||
816 | QString pattern = text.lower(); | 814 | QString pattern = text.lower(); |
817 | 815 | ||
818 | #if 1 //KDE_VERSION >= 319 | 816 | #if 1 //KDE_VERSION >= 319 |
819 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 817 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
820 | if ( field ) { | 818 | if ( field ) { |
821 | list.sortByField( field ); | 819 | list.sortByField( field ); |
822 | KABC::AddresseeList::Iterator it; | 820 | KABC::AddresseeList::Iterator it; |
823 | for ( it = list.begin(); it != list.end(); ++it ) { | 821 | for ( it = list.begin(); it != list.end(); ++it ) { |
824 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 822 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
825 | mViewManager->setSelected( (*it).uid(), true ); | 823 | mViewManager->setSelected( (*it).uid(), true ); |
826 | return; | 824 | return; |
827 | } | 825 | } |
828 | } | 826 | } |
829 | } else { | 827 | } else { |
830 | KABC::AddresseeList::Iterator it; | 828 | KABC::AddresseeList::Iterator it; |
831 | for ( it = list.begin(); it != list.end(); ++it ) { | 829 | for ( it = list.begin(); it != list.end(); ++it ) { |
832 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 830 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
833 | KABC::Field::List::ConstIterator fieldIt; | 831 | KABC::Field::List::ConstIterator fieldIt; |
834 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 832 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
835 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 833 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
836 | mViewManager->setSelected( (*it).uid(), true ); | 834 | mViewManager->setSelected( (*it).uid(), true ); |
837 | return; | 835 | return; |
838 | } | 836 | } |
839 | } | 837 | } |
840 | } | 838 | } |
841 | } | 839 | } |
842 | #else | 840 | #else |
843 | KABC::AddressBook::Iterator it; | 841 | KABC::AddressBook::Iterator it; |
844 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 842 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
845 | if ( field ) { | 843 | if ( field ) { |
846 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 844 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
847 | mViewManager->setSelected( (*it).uid(), true ); | 845 | mViewManager->setSelected( (*it).uid(), true ); |
848 | return; | 846 | return; |
849 | } | 847 | } |
850 | } else { | 848 | } else { |
851 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 849 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
852 | KABC::Field::List::ConstIterator fieldIt; | 850 | KABC::Field::List::ConstIterator fieldIt; |
853 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 851 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
854 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 852 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
855 | mViewManager->setSelected( (*it).uid(), true ); | 853 | mViewManager->setSelected( (*it).uid(), true ); |
856 | return; | 854 | return; |
857 | } | 855 | } |
858 | } | 856 | } |
859 | } | 857 | } |
860 | } | 858 | } |
861 | #endif | 859 | #endif |
862 | } | 860 | } |
863 | } | 861 | } |
864 | 862 | ||
865 | void KABCore::setModified() | 863 | void KABCore::setModified() |
866 | { | 864 | { |
867 | setModified( true ); | 865 | setModified( true ); |
868 | } | 866 | } |
869 | 867 | ||
870 | void KABCore::setModifiedWOrefresh() | 868 | void KABCore::setModifiedWOrefresh() |
871 | { | 869 | { |
872 | // qDebug("KABCore::setModifiedWOrefresh() "); | 870 | // qDebug("KABCore::setModifiedWOrefresh() "); |
873 | mModified = true; | 871 | mModified = true; |
874 | mActionSave->setEnabled( mModified ); | 872 | mActionSave->setEnabled( mModified ); |
875 | #ifdef DESKTOP_VERSION | 873 | #ifdef DESKTOP_VERSION |
876 | mDetails->refreshView(); | 874 | mDetails->refreshView(); |
877 | #endif | 875 | #endif |
878 | 876 | ||
879 | } | 877 | } |
880 | void KABCore::setModified( bool modified ) | 878 | void KABCore::setModified( bool modified ) |
881 | { | 879 | { |
882 | mModified = modified; | 880 | mModified = modified; |
883 | mActionSave->setEnabled( mModified ); | 881 | mActionSave->setEnabled( mModified ); |
884 | 882 | ||
885 | if ( modified ) | 883 | if ( modified ) |
886 | mJumpButtonBar->recreateButtons(); | 884 | mJumpButtonBar->recreateButtons(); |
887 | 885 | ||
888 | mViewManager->refreshView(); | 886 | mViewManager->refreshView(); |
889 | mDetails->refreshView(); | 887 | mDetails->refreshView(); |
890 | 888 | ||
891 | } | 889 | } |
892 | 890 | ||
893 | bool KABCore::modified() const | 891 | bool KABCore::modified() const |
894 | { | 892 | { |
895 | return mModified; | 893 | return mModified; |
896 | } | 894 | } |
897 | 895 | ||
898 | void KABCore::contactModified( const KABC::Addressee &addr ) | 896 | void KABCore::contactModified( const KABC::Addressee &addr ) |
899 | { | 897 | { |
900 | 898 | ||
901 | Command *command = 0; | 899 | Command *command = 0; |
902 | QString uid; | 900 | QString uid; |
903 | 901 | ||
904 | // check if it exists already | 902 | // check if it exists already |
905 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 903 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
906 | if ( origAddr.isEmpty() ) | 904 | if ( origAddr.isEmpty() ) |
907 | command = new PwNewCommand( mAddressBook, addr ); | 905 | command = new PwNewCommand( mAddressBook, addr ); |
908 | else { | 906 | else { |
909 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 907 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
910 | uid = addr.uid(); | 908 | uid = addr.uid(); |
911 | } | 909 | } |
912 | 910 | ||
913 | UndoStack::instance()->push( command ); | 911 | UndoStack::instance()->push( command ); |
914 | RedoStack::instance()->clear(); | 912 | RedoStack::instance()->clear(); |
915 | 913 | ||
916 | setModified( true ); | 914 | setModified( true ); |
917 | } | 915 | } |
918 | 916 | ||
919 | void KABCore::newContact() | 917 | void KABCore::newContact() |
920 | { | 918 | { |
921 | 919 | ||
922 | 920 | ||
923 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 921 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
924 | 922 | ||
925 | QPtrList<KRES::Resource> kresResources; | 923 | QPtrList<KRES::Resource> kresResources; |
926 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 924 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
927 | KABC::Resource *resource; | 925 | KABC::Resource *resource; |
928 | while ( ( resource = it.current() ) != 0 ) { | 926 | while ( ( resource = it.current() ) != 0 ) { |
929 | ++it; | 927 | ++it; |
930 | if ( !resource->readOnly() ) { | 928 | if ( !resource->readOnly() ) { |
931 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 929 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
932 | if ( res ) | 930 | if ( res ) |
933 | kresResources.append( res ); | 931 | kresResources.append( res ); |
934 | } | 932 | } |
935 | } | 933 | } |
936 | 934 | ||
937 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 935 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
938 | resource = static_cast<KABC::Resource*>( res ); | 936 | resource = static_cast<KABC::Resource*>( res ); |
939 | 937 | ||
940 | if ( resource ) { | 938 | if ( resource ) { |
941 | KABC::Addressee addr; | 939 | KABC::Addressee addr; |
942 | addr.setResource( resource ); | 940 | addr.setResource( resource ); |
943 | mEditorDialog->setAddressee( addr ); | 941 | mEditorDialog->setAddressee( addr ); |
944 | KApplication::execDialog ( mEditorDialog ); | 942 | KApplication::execDialog ( mEditorDialog ); |
945 | 943 | ||
946 | } else | 944 | } else |
947 | return; | 945 | return; |
948 | 946 | ||
949 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 947 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
950 | 948 | ||
951 | 949 | ||
952 | } | 950 | } |
953 | 951 | ||
954 | void KABCore::addEmail( QString aStr ) | 952 | void KABCore::addEmail( QString aStr ) |
955 | { | 953 | { |
956 | #ifndef KAB_EMBEDDED | 954 | #ifndef KAB_EMBEDDED |
957 | QString fullName, email; | 955 | QString fullName, email; |
958 | 956 | ||
959 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 957 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
960 | 958 | ||
961 | // Try to lookup the addressee matching the email address | 959 | // Try to lookup the addressee matching the email address |
962 | bool found = false; | 960 | bool found = false; |
963 | QStringList emailList; | 961 | QStringList emailList; |
964 | KABC::AddressBook::Iterator it; | 962 | KABC::AddressBook::Iterator it; |
965 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 963 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
966 | emailList = (*it).emails(); | 964 | emailList = (*it).emails(); |
967 | if ( emailList.contains( email ) > 0 ) { | 965 | if ( emailList.contains( email ) > 0 ) { |
968 | found = true; | 966 | found = true; |
969 | (*it).setNameFromString( fullName ); | 967 | (*it).setNameFromString( fullName ); |
970 | editContact( (*it).uid() ); | 968 | editContact( (*it).uid() ); |
971 | } | 969 | } |
972 | } | 970 | } |
973 | 971 | ||
974 | if ( !found ) { | 972 | if ( !found ) { |
975 | KABC::Addressee addr; | 973 | KABC::Addressee addr; |
976 | addr.setNameFromString( fullName ); | 974 | addr.setNameFromString( fullName ); |
977 | addr.insertEmail( email, true ); | 975 | addr.insertEmail( email, true ); |
978 | 976 | ||
979 | mAddressBook->insertAddressee( addr ); | 977 | mAddressBook->insertAddressee( addr ); |
980 | mViewManager->refreshView( addr.uid() ); | 978 | mViewManager->refreshView( addr.uid() ); |
981 | editContact( addr.uid() ); | 979 | editContact( addr.uid() ); |
982 | } | 980 | } |
983 | #else //KAB_EMBEDDED | 981 | #else //KAB_EMBEDDED |
984 | qDebug("KABCore::addEmail finsih method"); | 982 | qDebug("KABCore::addEmail finsih method"); |
985 | #endif //KAB_EMBEDDED | 983 | #endif //KAB_EMBEDDED |
986 | } | 984 | } |
987 | 985 | ||
988 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 986 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
989 | { | 987 | { |
990 | mXXPortManager->importVCard( url, showPreview ); | 988 | mXXPortManager->importVCard( url, showPreview ); |
991 | } | 989 | } |
992 | void KABCore::importFromOL() | 990 | void KABCore::importFromOL() |
993 | { | 991 | { |
994 | #ifdef _WIN32_ | 992 | #ifdef _WIN32_ |
995 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 993 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
996 | idgl->exec(); | 994 | idgl->exec(); |
997 | KABC::Addressee::List list = idgl->getAddressList(); | 995 | KABC::Addressee::List list = idgl->getAddressList(); |
998 | if ( list.count() > 0 ) { | 996 | if ( list.count() > 0 ) { |
999 | KABC::Addressee::List listNew; | 997 | KABC::Addressee::List listNew; |
1000 | KABC::Addressee::List listExisting; | 998 | KABC::Addressee::List listExisting; |
1001 | KABC::Addressee::List::Iterator it; | 999 | KABC::Addressee::List::Iterator it; |
1002 | KABC::AddressBook::Iterator iter; | 1000 | KABC::AddressBook::Iterator iter; |
1003 | for ( it = list.begin(); it != list.end(); ++it ) { | 1001 | for ( it = list.begin(); it != list.end(); ++it ) { |
1004 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1002 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1005 | listNew.append( (*it) ); | 1003 | listNew.append( (*it) ); |
1006 | else | 1004 | else |
1007 | listExisting.append( (*it) ); | 1005 | listExisting.append( (*it) ); |
1008 | } | 1006 | } |
1009 | if ( listExisting.count() > 0 ) | 1007 | if ( listExisting.count() > 0 ) |
1010 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1008 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1011 | if ( listNew.count() > 0 ) { | 1009 | if ( listNew.count() > 0 ) { |
1012 | pasteWithNewUid = false; | 1010 | pasteWithNewUid = false; |
1013 | pasteContacts( listNew ); | 1011 | pasteContacts( listNew ); |
1014 | pasteWithNewUid = true; | 1012 | pasteWithNewUid = true; |
1015 | } | 1013 | } |
1016 | } | 1014 | } |
1017 | delete idgl; | 1015 | delete idgl; |
1018 | #endif | 1016 | #endif |
1019 | } | 1017 | } |
1020 | 1018 | ||
1021 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1019 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1022 | { | 1020 | { |
1023 | mXXPortManager->importVCard( vCard, showPreview ); | 1021 | mXXPortManager->importVCard( vCard, showPreview ); |
1024 | } | 1022 | } |
1025 | 1023 | ||
1026 | //US added a second method without defaultparameter | 1024 | //US added a second method without defaultparameter |
1027 | void KABCore::editContact2() { | 1025 | void KABCore::editContact2() { |
1028 | editContact( QString::null ); | 1026 | editContact( QString::null ); |
1029 | } | 1027 | } |
1030 | 1028 | ||
1031 | void KABCore::editContact( const QString &uid ) | 1029 | void KABCore::editContact( const QString &uid ) |
1032 | { | 1030 | { |
1033 | 1031 | ||
1034 | if ( mExtensionManager->isQuickEditVisible() ) | 1032 | if ( mExtensionManager->isQuickEditVisible() ) |
1035 | return; | 1033 | return; |
1036 | 1034 | ||
1037 | // First, locate the contact entry | 1035 | // First, locate the contact entry |
1038 | QString localUID = uid; | 1036 | QString localUID = uid; |
1039 | if ( localUID.isNull() ) { | 1037 | if ( localUID.isNull() ) { |
1040 | QStringList uidList = mViewManager->selectedUids(); | 1038 | QStringList uidList = mViewManager->selectedUids(); |
1041 | if ( uidList.count() > 0 ) | 1039 | if ( uidList.count() > 0 ) |
1042 | localUID = *( uidList.at( 0 ) ); | 1040 | localUID = *( uidList.at( 0 ) ); |
1043 | } | 1041 | } |
1044 | 1042 | ||
1045 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1043 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1046 | if ( !addr.isEmpty() ) { | 1044 | if ( !addr.isEmpty() ) { |
1047 | mEditorDialog->setAddressee( addr ); | 1045 | mEditorDialog->setAddressee( addr ); |
1048 | KApplication::execDialog ( mEditorDialog ); | 1046 | KApplication::execDialog ( mEditorDialog ); |
1049 | } | 1047 | } |
1050 | } | 1048 | } |
1051 | 1049 | ||
1052 | void KABCore::save() | 1050 | void KABCore::save() |
1053 | { | 1051 | { |
1054 | if ( !mModified ) | 1052 | if ( !mModified ) |
1055 | return; | 1053 | return; |
1056 | QString text = i18n( "There was an error while attempting to save\n the " | 1054 | QString text = i18n( "There was an error while attempting to save\n the " |
1057 | "address book. Please check that some \nother application is " | 1055 | "address book. Please check that some \nother application is " |
1058 | "not using it. " ); | 1056 | "not using it. " ); |
1059 | statusMessage(i18n("Saving addressbook ... ")); | 1057 | statusMessage(i18n("Saving addressbook ... ")); |
1060 | #ifndef KAB_EMBEDDED | 1058 | #ifndef KAB_EMBEDDED |
1061 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1059 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1062 | if ( !b || !b->save() ) { | 1060 | if ( !b || !b->save() ) { |
1063 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1061 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1064 | } | 1062 | } |
1065 | #else //KAB_EMBEDDED | 1063 | #else //KAB_EMBEDDED |
1066 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1064 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1067 | if ( !b || !b->save() ) { | 1065 | if ( !b || !b->save() ) { |
1068 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1066 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1069 | } | 1067 | } |
1070 | #endif //KAB_EMBEDDED | 1068 | #endif //KAB_EMBEDDED |
1071 | 1069 | ||
1072 | statusMessage(i18n("Addressbook saved!")); | 1070 | statusMessage(i18n("Addressbook saved!")); |
1073 | setModified( false ); | 1071 | setModified( false ); |
1074 | } | 1072 | } |
1075 | 1073 | ||
1076 | void KABCore::statusMessage(QString mess , int time ) | 1074 | void KABCore::statusMessage(QString mess , int time ) |
1077 | { | 1075 | { |
1078 | //topLevelWidget()->setCaption( mess ); | 1076 | //topLevelWidget()->setCaption( mess ); |
1079 | // pending setting timer to revome message | 1077 | // pending setting timer to revome message |
1080 | } | 1078 | } |
1081 | void KABCore::undo() | 1079 | void KABCore::undo() |
1082 | { | 1080 | { |
1083 | UndoStack::instance()->undo(); | 1081 | UndoStack::instance()->undo(); |
1084 | 1082 | ||
1085 | // Refresh the view | 1083 | // Refresh the view |
1086 | mViewManager->refreshView(); | 1084 | mViewManager->refreshView(); |
1087 | } | 1085 | } |
1088 | 1086 | ||
1089 | void KABCore::redo() | 1087 | void KABCore::redo() |
1090 | { | 1088 | { |
1091 | RedoStack::instance()->redo(); | 1089 | RedoStack::instance()->redo(); |
1092 | 1090 | ||
1093 | // Refresh the view | 1091 | // Refresh the view |
1094 | mViewManager->refreshView(); | 1092 | mViewManager->refreshView(); |
1095 | } | 1093 | } |
1096 | 1094 | ||
1097 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1095 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1098 | { | 1096 | { |
1099 | if ( visible ) | 1097 | if ( visible ) |
1100 | mJumpButtonBar->show(); | 1098 | mJumpButtonBar->show(); |
1101 | else | 1099 | else |
1102 | mJumpButtonBar->hide(); | 1100 | mJumpButtonBar->hide(); |
1103 | } | 1101 | } |
1104 | void KABCore::setDetailsToState() | 1102 | void KABCore::setDetailsToState() |
1105 | { | 1103 | { |
1106 | setDetailsVisible( mActionDetails->isChecked() ); | 1104 | setDetailsVisible( mActionDetails->isChecked() ); |
1107 | } | 1105 | } |
1108 | 1106 | ||
1109 | void KABCore::setDetailsVisible( bool visible ) | 1107 | void KABCore::setDetailsVisible( bool visible ) |
1110 | { | 1108 | { |
1111 | if ( visible ) | 1109 | if ( visible ) |
1112 | mDetails->show(); | 1110 | mDetails->show(); |
1113 | else | 1111 | else |
1114 | mDetails->hide(); | 1112 | mDetails->hide(); |
1115 | } | 1113 | } |
1116 | 1114 | ||
1117 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1115 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1118 | { | 1116 | { |
1119 | 1117 | ||
1120 | if ( list.count() != 0 ) { | 1118 | if ( list.count() != 0 ) { |
1121 | KABC::Addressee::List::ConstIterator it; | 1119 | KABC::Addressee::List::ConstIterator it; |
1122 | for ( it = list.begin(); it != list.end(); ++it ) | 1120 | for ( it = list.begin(); it != list.end(); ++it ) |
1123 | mAddressBook->insertAddressee( *it ); | 1121 | mAddressBook->insertAddressee( *it ); |
1124 | if ( list.count() > 1 ) | 1122 | if ( list.count() > 1 ) |
1125 | setModified(); | 1123 | setModified(); |
1126 | else | 1124 | else |
1127 | setModifiedWOrefresh(); | 1125 | setModifiedWOrefresh(); |
1128 | } | 1126 | } |
1129 | if ( list.count() == 0 ) | 1127 | if ( list.count() == 0 ) |
1130 | mViewManager->refreshView(); | 1128 | mViewManager->refreshView(); |
1131 | else | 1129 | else |
1132 | mViewManager->refreshView( list[ 0 ].uid() ); | 1130 | mViewManager->refreshView( list[ 0 ].uid() ); |
1133 | 1131 | ||
1134 | 1132 | ||
1135 | 1133 | ||
1136 | } | 1134 | } |
1137 | 1135 | ||
1138 | QString KABCore::getNameByPhone( const QString &phone ) | 1136 | QString KABCore::getNameByPhone( const QString &phone ) |
1139 | { | 1137 | { |
1140 | #ifndef KAB_EMBEDDED | 1138 | #ifndef KAB_EMBEDDED |
1141 | QRegExp r( "[/*/-/ ]" ); | 1139 | QRegExp r( "[/*/-/ ]" ); |
1142 | QString localPhone( phone ); | 1140 | QString localPhone( phone ); |
1143 | 1141 | ||
1144 | bool found = false; | 1142 | bool found = false; |
1145 | QString ownerName = ""; | 1143 | QString ownerName = ""; |
1146 | KABC::AddressBook::Iterator iter; | 1144 | KABC::AddressBook::Iterator iter; |
1147 | KABC::PhoneNumber::List::Iterator phoneIter; | 1145 | KABC::PhoneNumber::List::Iterator phoneIter; |
1148 | KABC::PhoneNumber::List phoneList; | 1146 | KABC::PhoneNumber::List phoneList; |
1149 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1147 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1150 | phoneList = (*iter).phoneNumbers(); | 1148 | phoneList = (*iter).phoneNumbers(); |
1151 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1149 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1152 | ++phoneIter) { | 1150 | ++phoneIter) { |
1153 | // Get rid of separator chars so just the numbers are compared. | 1151 | // Get rid of separator chars so just the numbers are compared. |
1154 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1152 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1155 | ownerName = (*iter).formattedName(); | 1153 | ownerName = (*iter).formattedName(); |
1156 | found = true; | 1154 | found = true; |
1157 | } | 1155 | } |
1158 | } | 1156 | } |
1159 | } | 1157 | } |
1160 | 1158 | ||
1161 | return ownerName; | 1159 | return ownerName; |
1162 | #else //KAB_EMBEDDED | 1160 | #else //KAB_EMBEDDED |
1163 | qDebug("KABCore::getNameByPhone finsih method"); | 1161 | qDebug("KABCore::getNameByPhone finsih method"); |
1164 | return ""; | 1162 | return ""; |
1165 | #endif //KAB_EMBEDDED | 1163 | #endif //KAB_EMBEDDED |
1166 | 1164 | ||
1167 | } | 1165 | } |
1168 | 1166 | ||
1169 | void KABCore::openConfigDialog() | 1167 | void KABCore::openConfigDialog() |
1170 | { | 1168 | { |
1171 | KABPrefs* kab_prefs = KABPrefs::instance(); | 1169 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1172 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); | 1170 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1173 | 1171 | ||
1174 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1172 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1175 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1173 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1176 | ConfigureDialog->addModule(kabcfg ); | 1174 | ConfigureDialog->addModule(kabcfg ); |
1177 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1175 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1178 | ConfigureDialog->addModule(kdelibcfg ); | 1176 | ConfigureDialog->addModule(kdelibcfg ); |
1179 | 1177 | ||
1180 | 1178 | ||
1181 | 1179 | ||
1182 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1180 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1183 | this, SLOT( configurationChanged() ) ); | 1181 | this, SLOT( configurationChanged() ) ); |
1184 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1182 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1185 | this, SLOT( configurationChanged() ) ); | 1183 | this, SLOT( configurationChanged() ) ); |
1186 | saveSettings(); | 1184 | saveSettings(); |
1187 | ConfigureDialog->showMaximized(); | 1185 | ConfigureDialog->showMaximized(); |
1188 | if ( ConfigureDialog->exec() ) | 1186 | if ( ConfigureDialog->exec() ) |
1189 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); | 1187 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); |
1190 | delete ConfigureDialog; | 1188 | delete ConfigureDialog; |
1191 | } | 1189 | } |
1192 | 1190 | ||
1193 | void KABCore::openLDAPDialog() | 1191 | void KABCore::openLDAPDialog() |
1194 | { | 1192 | { |
1195 | #ifndef KAB_EMBEDDED | 1193 | #ifndef KAB_EMBEDDED |
1196 | if ( !mLdapSearchDialog ) { | 1194 | if ( !mLdapSearchDialog ) { |
1197 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1195 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1198 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1196 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1199 | SLOT( refreshView() ) ); | 1197 | SLOT( refreshView() ) ); |
1200 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1198 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1201 | SLOT( setModified() ) ); | 1199 | SLOT( setModified() ) ); |
1202 | } else | 1200 | } else |
1203 | mLdapSearchDialog->restoreSettings(); | 1201 | mLdapSearchDialog->restoreSettings(); |
1204 | 1202 | ||
1205 | if ( mLdapSearchDialog->isOK() ) | 1203 | if ( mLdapSearchDialog->isOK() ) |
1206 | mLdapSearchDialog->exec(); | 1204 | mLdapSearchDialog->exec(); |
1207 | #else //KAB_EMBEDDED | 1205 | #else //KAB_EMBEDDED |
1208 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1206 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1209 | #endif //KAB_EMBEDDED | 1207 | #endif //KAB_EMBEDDED |
1210 | } | 1208 | } |
1211 | 1209 | ||
1212 | void KABCore::print() | 1210 | void KABCore::print() |
1213 | { | 1211 | { |
1214 | #ifndef KAB_EMBEDDED | 1212 | #ifndef KAB_EMBEDDED |
1215 | KPrinter printer; | 1213 | KPrinter printer; |
1216 | if ( !printer.setup( this ) ) | 1214 | if ( !printer.setup( this ) ) |
1217 | return; | 1215 | return; |
1218 | 1216 | ||
1219 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1217 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1220 | mViewManager->selectedUids(), this ); | 1218 | mViewManager->selectedUids(), this ); |
1221 | 1219 | ||
1222 | wizard.exec(); | 1220 | wizard.exec(); |
1223 | #else //KAB_EMBEDDED | 1221 | #else //KAB_EMBEDDED |
1224 | qDebug("KABCore::print() finsih method"); | 1222 | qDebug("KABCore::print() finsih method"); |
1225 | #endif //KAB_EMBEDDED | 1223 | #endif //KAB_EMBEDDED |
1226 | 1224 | ||
1227 | } | 1225 | } |
1228 | 1226 | ||
1229 | 1227 | ||
1230 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1228 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1231 | { | 1229 | { |
1232 | if ( mGUIClient ) | 1230 | if ( mGUIClient ) |
1233 | mGUIClient->insertChildClient( client ); | 1231 | mGUIClient->insertChildClient( client ); |
1234 | else | 1232 | else |
1235 | KMessageBox::error( this, "no KXMLGUICLient"); | 1233 | KMessageBox::error( this, "no KXMLGUICLient"); |
1236 | } | 1234 | } |
1237 | 1235 | ||
1238 | 1236 | ||
1239 | void KABCore::configurationChanged() | 1237 | void KABCore::configurationChanged() |
1240 | { | 1238 | { |
1241 | mExtensionManager->reconfigure(); | 1239 | mExtensionManager->reconfigure(); |
1242 | } | 1240 | } |
1243 | 1241 | ||
1244 | void KABCore::addressBookChanged() | 1242 | void KABCore::addressBookChanged() |
1245 | { | 1243 | { |
1246 | /*US | 1244 | /*US |
1247 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1245 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1248 | while ( it.current() ) { | 1246 | while ( it.current() ) { |
1249 | if ( it.current()->dirty() ) { | 1247 | if ( it.current()->dirty() ) { |
1250 | QString text = i18n( "Data has been changed externally. Unsaved " | 1248 | QString text = i18n( "Data has been changed externally. Unsaved " |
1251 | "changes will be lost." ); | 1249 | "changes will be lost." ); |
1252 | KMessageBox::information( this, text ); | 1250 | KMessageBox::information( this, text ); |
1253 | } | 1251 | } |
1254 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1252 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1255 | ++it; | 1253 | ++it; |
1256 | } | 1254 | } |
1257 | */ | 1255 | */ |
1258 | if (mEditorDialog) | 1256 | if (mEditorDialog) |
1259 | { | 1257 | { |
1260 | if (mEditorDialog->dirty()) | 1258 | if (mEditorDialog->dirty()) |
1261 | { | 1259 | { |
1262 | QString text = i18n( "Data has been changed externally. Unsaved " | 1260 | QString text = i18n( "Data has been changed externally. Unsaved " |
1263 | "changes will be lost." ); | 1261 | "changes will be lost." ); |
1264 | KMessageBox::information( this, text ); | 1262 | KMessageBox::information( this, text ); |
1265 | } | 1263 | } |
1266 | QString currentuid = mEditorDialog->addressee().uid(); | 1264 | QString currentuid = mEditorDialog->addressee().uid(); |
1267 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1265 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1268 | } | 1266 | } |
1269 | mViewManager->refreshView(); | 1267 | mViewManager->refreshView(); |
1270 | // mDetails->refreshView(); | 1268 | // mDetails->refreshView(); |
1271 | 1269 | ||
1272 | 1270 | ||
1273 | } | 1271 | } |
1274 | 1272 | ||
1275 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1273 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1276 | const char *name ) | 1274 | const char *name ) |
1277 | { | 1275 | { |
1278 | 1276 | ||
1279 | if ( mEditorDialog == 0 ) { | 1277 | if ( mEditorDialog == 0 ) { |
1280 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1278 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1281 | name ? name : "editorDialog" ); | 1279 | name ? name : "editorDialog" ); |
1282 | 1280 | ||
1283 | 1281 | ||
1284 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1282 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1285 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1283 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1286 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1284 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1287 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1285 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1288 | } | 1286 | } |
1289 | 1287 | ||
1290 | return mEditorDialog; | 1288 | return mEditorDialog; |
1291 | } | 1289 | } |
1292 | 1290 | ||
1293 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1291 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1294 | { | 1292 | { |
1295 | //mEditorDict.remove( uid ); | 1293 | //mEditorDict.remove( uid ); |
1296 | } | 1294 | } |
1297 | 1295 | ||
1298 | void KABCore::initGUI() | 1296 | void KABCore::initGUI() |
1299 | { | 1297 | { |
1300 | #ifndef KAB_EMBEDDED | 1298 | #ifndef KAB_EMBEDDED |
1301 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1299 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1302 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1300 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1303 | 1301 | ||
1304 | mExtensionBarSplitter = new QSplitter( this ); | 1302 | mExtensionBarSplitter = new QSplitter( this ); |
1305 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1303 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1306 | 1304 | ||
1307 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1305 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1308 | 1306 | ||
1309 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1307 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1310 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1308 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1311 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1309 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1312 | SLOT( incrementalSearch( const QString& ) ) ); | 1310 | SLOT( incrementalSearch( const QString& ) ) ); |
1313 | 1311 | ||
1314 | mViewManager = new ViewManager( this, viewSpace ); | 1312 | mViewManager = new ViewManager( this, viewSpace ); |
1315 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1313 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1316 | 1314 | ||
1317 | mDetails = new ViewContainer( mDetailsSplitter ); | 1315 | mDetails = new ViewContainer( mDetailsSplitter ); |
1318 | 1316 | ||
1319 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1317 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1320 | 1318 | ||
1321 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1319 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1322 | 1320 | ||
1323 | topLayout->addWidget( mExtensionBarSplitter ); | 1321 | topLayout->addWidget( mExtensionBarSplitter ); |
1324 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1322 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1325 | topLayout->addWidget( mJumpButtonBar ); | 1323 | topLayout->addWidget( mJumpButtonBar ); |
1326 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1324 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1327 | 1325 | ||
1328 | mXXPortManager = new XXPortManager( this, this ); | 1326 | mXXPortManager = new XXPortManager( this, this ); |
1329 | 1327 | ||
1330 | #else //KAB_EMBEDDED | 1328 | #else //KAB_EMBEDDED |
1331 | //US initialize viewMenu before settingup viewmanager. | 1329 | //US initialize viewMenu before settingup viewmanager. |
1332 | // Viewmanager needs this menu to plugin submenues. | 1330 | // Viewmanager needs this menu to plugin submenues. |
1333 | viewMenu = new QPopupMenu( this ); | 1331 | viewMenu = new QPopupMenu( this ); |
1334 | settingsMenu = new QPopupMenu( this ); | 1332 | settingsMenu = new QPopupMenu( this ); |
1335 | //filterMenu = new QPopupMenu( this ); | 1333 | //filterMenu = new QPopupMenu( this ); |
1336 | ImportMenu = new QPopupMenu( this ); | 1334 | ImportMenu = new QPopupMenu( this ); |
1337 | ExportMenu = new QPopupMenu( this ); | 1335 | ExportMenu = new QPopupMenu( this ); |
1338 | 1336 | ||
1339 | changeMenu= new QPopupMenu( this ); | 1337 | changeMenu= new QPopupMenu( this ); |
1340 | 1338 | ||
1341 | //US since we have no splitter for the embedded system, setup | 1339 | //US since we have no splitter for the embedded system, setup |
1342 | // a layout with two frames. One left and one right. | 1340 | // a layout with two frames. One left and one right. |
1343 | 1341 | ||
1344 | QBoxLayout *topLayout; | 1342 | QBoxLayout *topLayout; |
1345 | 1343 | ||
1346 | // = new QHBoxLayout( this ); | 1344 | // = new QHBoxLayout( this ); |
1347 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1345 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1348 | 1346 | ||
1349 | // QWidget *mainBox = new QWidget( this ); | 1347 | // QWidget *mainBox = new QWidget( this ); |
1350 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1348 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1351 | 1349 | ||
1352 | #ifdef DESKTOP_VERSION | 1350 | #ifdef DESKTOP_VERSION |
1353 | topLayout = new QHBoxLayout( this ); | 1351 | topLayout = new QHBoxLayout( this ); |
1354 | 1352 | ||
1355 | 1353 | ||
1356 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1354 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1357 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1355 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1358 | 1356 | ||
1359 | topLayout->addWidget(mMiniSplitter ); | 1357 | topLayout->addWidget(mMiniSplitter ); |
1360 | 1358 | ||
1361 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1359 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1362 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1360 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1363 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1361 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1364 | mDetails = new ViewContainer( mMiniSplitter ); | 1362 | mDetails = new ViewContainer( mMiniSplitter ); |
1365 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1363 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1366 | #else | 1364 | #else |
1367 | if ( QApplication::desktop()->width() > 480 ) { | 1365 | if ( QApplication::desktop()->width() > 480 ) { |
1368 | topLayout = new QHBoxLayout( this ); | 1366 | topLayout = new QHBoxLayout( this ); |
1369 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1367 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1370 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1368 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1371 | } else { | 1369 | } else { |
1372 | 1370 | ||
1373 | topLayout = new QHBoxLayout( this ); | 1371 | topLayout = new QHBoxLayout( this ); |
1374 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1372 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1375 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1373 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1376 | } | 1374 | } |
1377 | 1375 | ||
1378 | topLayout->addWidget(mMiniSplitter ); | 1376 | topLayout->addWidget(mMiniSplitter ); |
1379 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1377 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1380 | mDetails = new ViewContainer( mMiniSplitter ); | 1378 | mDetails = new ViewContainer( mMiniSplitter ); |
1381 | 1379 | ||
1382 | 1380 | ||
1383 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1381 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1384 | #endif | 1382 | #endif |
1385 | //eh->hide(); | 1383 | //eh->hide(); |
1386 | // topLayout->addWidget(mExtensionManager ); | 1384 | // topLayout->addWidget(mExtensionManager ); |
1387 | 1385 | ||
1388 | 1386 | ||
1389 | /*US | 1387 | /*US |
1390 | #ifndef KAB_NOSPLITTER | 1388 | #ifndef KAB_NOSPLITTER |
1391 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1389 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1392 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1390 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1393 | topLayout->setSpacing( 10 ); | 1391 | topLayout->setSpacing( 10 ); |
1394 | 1392 | ||
1395 | mDetailsSplitter = new QSplitter( this ); | 1393 | mDetailsSplitter = new QSplitter( this ); |
1396 | 1394 | ||
1397 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1395 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1398 | 1396 | ||
1399 | mViewManager = new ViewManager( this, viewSpace ); | 1397 | mViewManager = new ViewManager( this, viewSpace ); |
1400 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1398 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1401 | 1399 | ||
1402 | mDetails = new ViewContainer( mDetailsSplitter ); | 1400 | mDetails = new ViewContainer( mDetailsSplitter ); |
1403 | 1401 | ||
1404 | topLayout->addWidget( mDetailsSplitter ); | 1402 | topLayout->addWidget( mDetailsSplitter ); |
1405 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1403 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1406 | #else //KAB_NOSPLITTER | 1404 | #else //KAB_NOSPLITTER |
1407 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1405 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1408 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1406 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1409 | topLayout->setSpacing( 10 ); | 1407 | topLayout->setSpacing( 10 ); |
1410 | 1408 | ||
1411 | // mDetailsSplitter = new QSplitter( this ); | 1409 | // mDetailsSplitter = new QSplitter( this ); |
1412 | 1410 | ||
1413 | QVBox *viewSpace = new QVBox( this ); | 1411 | QVBox *viewSpace = new QVBox( this ); |
1414 | 1412 | ||
1415 | mViewManager = new ViewManager( this, viewSpace ); | 1413 | mViewManager = new ViewManager( this, viewSpace ); |
1416 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1414 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1417 | 1415 | ||
1418 | mDetails = new ViewContainer( this ); | 1416 | mDetails = new ViewContainer( this ); |
1419 | 1417 | ||
1420 | topLayout->addWidget( viewSpace ); | 1418 | topLayout->addWidget( viewSpace ); |
1421 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1419 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1422 | topLayout->addWidget( mDetails ); | 1420 | topLayout->addWidget( mDetails ); |
1423 | #endif //KAB_NOSPLITTER | 1421 | #endif //KAB_NOSPLITTER |
1424 | */ | 1422 | */ |
1425 | 1423 | ||
1426 | 1424 | ||
1427 | #endif //KAB_EMBEDDED | 1425 | #endif //KAB_EMBEDDED |
1428 | initActions(); | 1426 | initActions(); |
1429 | 1427 | ||
1430 | #ifdef KAB_EMBEDDED | 1428 | #ifdef KAB_EMBEDDED |
1431 | addActionsManually(); | 1429 | addActionsManually(); |
1432 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1430 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1433 | mXXPortManager = new XXPortManager( this, this ); | 1431 | mXXPortManager = new XXPortManager( this, this ); |
1434 | 1432 | ||
1435 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1433 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1436 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1434 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1437 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1435 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1438 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1436 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1439 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1437 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1440 | // mIncSearchWidget->hide(); | 1438 | // mIncSearchWidget->hide(); |
1441 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1439 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1442 | SLOT( incrementalSearch( const QString& ) ) ); | 1440 | SLOT( incrementalSearch( const QString& ) ) ); |
1443 | 1441 | ||
1444 | 1442 | ||
1445 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1443 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1446 | 1444 | ||
1447 | topLayout->addWidget( mJumpButtonBar ); | 1445 | topLayout->addWidget( mJumpButtonBar ); |
1448 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1446 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1449 | 1447 | ||
1450 | // mMainWindow->getIconToolBar()->raise(); | 1448 | // mMainWindow->getIconToolBar()->raise(); |
1451 | 1449 | ||
1452 | #endif //KAB_EMBEDDED | 1450 | #endif //KAB_EMBEDDED |
1453 | 1451 | ||
1454 | } | 1452 | } |
1455 | void KABCore::initActions() | 1453 | void KABCore::initActions() |
1456 | { | 1454 | { |
1457 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1455 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1458 | 1456 | ||
1459 | #ifndef KAB_EMBEDDED | 1457 | #ifndef KAB_EMBEDDED |
1460 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1458 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1461 | SLOT( clipboardDataChanged() ) ); | 1459 | SLOT( clipboardDataChanged() ) ); |
1462 | #endif //KAB_EMBEDDED | 1460 | #endif //KAB_EMBEDDED |
1463 | 1461 | ||
1464 | // file menu | 1462 | // file menu |
1465 | if ( mIsPart ) { | 1463 | if ( mIsPart ) { |
1466 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1464 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1467 | SLOT( sendMail() ), actionCollection(), | 1465 | SLOT( sendMail() ), actionCollection(), |
1468 | "kaddressbook_mail" ); | 1466 | "kaddressbook_mail" ); |
1469 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1467 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1470 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1468 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1471 | 1469 | ||
1472 | } else { | 1470 | } else { |
1473 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1471 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1474 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1472 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1475 | } | 1473 | } |
1476 | 1474 | ||
1477 | 1475 | ||
1478 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1476 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1479 | SLOT( save() ), actionCollection(), "file_sync" ); | 1477 | SLOT( save() ), actionCollection(), "file_sync" ); |
1480 | 1478 | ||
1481 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1479 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1482 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1480 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1483 | 1481 | ||
1484 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1482 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1485 | this, SLOT( mailVCard() ), | 1483 | this, SLOT( mailVCard() ), |
1486 | actionCollection(), "file_mail_vcard"); | 1484 | actionCollection(), "file_mail_vcard"); |
1487 | 1485 | ||
1488 | mActionBeamVCard = 0; | 1486 | mActionBeamVCard = 0; |
1489 | mActionBeam = 0; | 1487 | mActionBeam = 0; |
1490 | 1488 | ||
1491 | #ifndef DESKTOP_VERSION | 1489 | #ifndef DESKTOP_VERSION |
1492 | if ( Ir::supported() ) { | 1490 | if ( Ir::supported() ) { |
1493 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1491 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1494 | SLOT( beamVCard() ), actionCollection(), | 1492 | SLOT( beamVCard() ), actionCollection(), |
1495 | "kaddressbook_beam_vcard" ); | 1493 | "kaddressbook_beam_vcard" ); |
1496 | 1494 | ||
1497 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1495 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1498 | SLOT( beamMySelf() ), actionCollection(), | 1496 | SLOT( beamMySelf() ), actionCollection(), |
1499 | "kaddressbook_beam_myself" ); | 1497 | "kaddressbook_beam_myself" ); |
1500 | } | 1498 | } |
1501 | #endif | 1499 | #endif |
1502 | 1500 | ||
1503 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1501 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1504 | this, SLOT( editContact2() ), | 1502 | this, SLOT( editContact2() ), |
1505 | actionCollection(), "file_properties" ); | 1503 | actionCollection(), "file_properties" ); |
1506 | 1504 | ||
1507 | #ifdef KAB_EMBEDDED | 1505 | #ifdef KAB_EMBEDDED |
1508 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1506 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1509 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1507 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1510 | mMainWindow, SLOT( exit() ), | 1508 | mMainWindow, SLOT( exit() ), |
1511 | actionCollection(), "quit" ); | 1509 | actionCollection(), "quit" ); |
1512 | #endif //KAB_EMBEDDED | 1510 | #endif //KAB_EMBEDDED |
1513 | 1511 | ||
1514 | // edit menu | 1512 | // edit menu |
1515 | if ( mIsPart ) { | 1513 | if ( mIsPart ) { |
1516 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1514 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1517 | SLOT( copyContacts() ), actionCollection(), | 1515 | SLOT( copyContacts() ), actionCollection(), |
1518 | "kaddressbook_copy" ); | 1516 | "kaddressbook_copy" ); |
1519 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1517 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1520 | SLOT( cutContacts() ), actionCollection(), | 1518 | SLOT( cutContacts() ), actionCollection(), |
1521 | "kaddressbook_cut" ); | 1519 | "kaddressbook_cut" ); |
1522 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1520 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1523 | SLOT( pasteContacts() ), actionCollection(), | 1521 | SLOT( pasteContacts() ), actionCollection(), |
1524 | "kaddressbook_paste" ); | 1522 | "kaddressbook_paste" ); |
1525 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1523 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1526 | SLOT( selectAllContacts() ), actionCollection(), | 1524 | SLOT( selectAllContacts() ), actionCollection(), |
1527 | "kaddressbook_select_all" ); | 1525 | "kaddressbook_select_all" ); |
1528 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1526 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1529 | SLOT( undo() ), actionCollection(), | 1527 | SLOT( undo() ), actionCollection(), |
1530 | "kaddressbook_undo" ); | 1528 | "kaddressbook_undo" ); |
1531 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1529 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1532 | this, SLOT( redo() ), actionCollection(), | 1530 | this, SLOT( redo() ), actionCollection(), |
1533 | "kaddressbook_redo" ); | 1531 | "kaddressbook_redo" ); |
1534 | } else { | 1532 | } else { |
1535 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1533 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1536 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1534 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1537 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1535 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1538 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1536 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1539 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1537 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1540 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1538 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1541 | } | 1539 | } |
1542 | 1540 | ||
1543 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1541 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1544 | Key_Delete, this, SLOT( deleteContacts() ), | 1542 | Key_Delete, this, SLOT( deleteContacts() ), |
1545 | actionCollection(), "edit_delete" ); | 1543 | actionCollection(), "edit_delete" ); |
1546 | 1544 | ||
1547 | mActionUndo->setEnabled( false ); | 1545 | mActionUndo->setEnabled( false ); |
1548 | mActionRedo->setEnabled( false ); | 1546 | mActionRedo->setEnabled( false ); |
1549 | 1547 | ||
1550 | // settings menu | 1548 | // settings menu |
1551 | #ifdef KAB_EMBEDDED | 1549 | #ifdef KAB_EMBEDDED |
1552 | //US special menuentry to configure the addressbook resources. On KDE | 1550 | //US special menuentry to configure the addressbook resources. On KDE |
1553 | // you do that through the control center !!! | 1551 | // you do that through the control center !!! |
1554 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1552 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1555 | SLOT( configureResources() ), actionCollection(), | 1553 | SLOT( configureResources() ), actionCollection(), |
1556 | "kaddressbook_configure_resources" ); | 1554 | "kaddressbook_configure_resources" ); |
1557 | #endif //KAB_EMBEDDED | 1555 | #endif //KAB_EMBEDDED |
1558 | 1556 | ||
1559 | if ( mIsPart ) { | 1557 | if ( mIsPart ) { |
1560 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1558 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1561 | SLOT( openConfigDialog() ), actionCollection(), | 1559 | SLOT( openConfigDialog() ), actionCollection(), |
1562 | "kaddressbook_configure" ); | 1560 | "kaddressbook_configure" ); |
1563 | 1561 | ||
1564 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1562 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1565 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1563 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1566 | "kaddressbook_configure_shortcuts" ); | 1564 | "kaddressbook_configure_shortcuts" ); |
1567 | #ifdef KAB_EMBEDDED | 1565 | #ifdef KAB_EMBEDDED |
1568 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1566 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1569 | mActionConfigureToolbars->setEnabled( false ); | 1567 | mActionConfigureToolbars->setEnabled( false ); |
1570 | #endif //KAB_EMBEDDED | 1568 | #endif //KAB_EMBEDDED |
1571 | 1569 | ||
1572 | } else { | 1570 | } else { |
1573 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1571 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1574 | 1572 | ||
1575 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1573 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1576 | } | 1574 | } |
1577 | 1575 | ||
1578 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1576 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1579 | actionCollection(), "options_show_jump_bar" ); | 1577 | actionCollection(), "options_show_jump_bar" ); |
1580 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1578 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1581 | 1579 | ||
1582 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1580 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1583 | actionCollection(), "options_show_details" ); | 1581 | actionCollection(), "options_show_details" ); |
1584 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1582 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1585 | 1583 | ||
1586 | // misc | 1584 | // misc |
1587 | // only enable LDAP lookup if we can handle the protocol | 1585 | // only enable LDAP lookup if we can handle the protocol |
1588 | #ifndef KAB_EMBEDDED | 1586 | #ifndef KAB_EMBEDDED |
1589 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1587 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1590 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1588 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1591 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1589 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1592 | "ldap_lookup" ); | 1590 | "ldap_lookup" ); |
1593 | } | 1591 | } |
1594 | #else //KAB_EMBEDDED | 1592 | #else //KAB_EMBEDDED |
1595 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1593 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1596 | #endif //KAB_EMBEDDED | 1594 | #endif //KAB_EMBEDDED |
1597 | 1595 | ||
1598 | 1596 | ||
1599 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1597 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1600 | SLOT( setWhoAmI() ), actionCollection(), | 1598 | SLOT( setWhoAmI() ), actionCollection(), |
1601 | "set_personal" ); | 1599 | "set_personal" ); |
1602 | 1600 | ||
1603 | 1601 | ||
1604 | 1602 | ||
1605 | 1603 | ||
1606 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1604 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1607 | SLOT( setCategories() ), actionCollection(), | 1605 | SLOT( setCategories() ), actionCollection(), |
1608 | "edit_set_categories" ); | 1606 | "edit_set_categories" ); |
1609 | 1607 | ||
1610 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1608 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1611 | SLOT( removeVoice() ), actionCollection(), | 1609 | SLOT( removeVoice() ), actionCollection(), |
1612 | "remove_voice" ); | 1610 | "remove_voice" ); |
1613 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1611 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1614 | SLOT( importFromOL() ), actionCollection(), | 1612 | SLOT( importFromOL() ), actionCollection(), |
1615 | "import_OL" ); | 1613 | "import_OL" ); |
1616 | #ifdef KAB_EMBEDDED | 1614 | #ifdef KAB_EMBEDDED |
1617 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, | 1615 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, |
1618 | this, SLOT( showLicence() ), actionCollection(), | 1616 | this, SLOT( showLicence() ), actionCollection(), |
1619 | "licence_about_data" ); | 1617 | "licence_about_data" ); |
1620 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1618 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1621 | this, SLOT( createAboutData() ), actionCollection(), | 1619 | this, SLOT( createAboutData() ), actionCollection(), |