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