author | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
commit | c9d570427f3d5bead7bee1301514a2d4b82836ea (patch) (unidiff) | |
tree | 8d25f388217c591b7dac1db6c26d0777e6459352 /kaddressbook | |
parent | 4f05a9fcbb9e54184aef93883886aaf865104463 (diff) | |
download | kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.zip kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.gz kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.bz2 |
enhancements to configure external apps like email and phones through a
generalized interface
-rw-r--r-- | kaddressbook/kabcore.cpp | 53 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.h | 10 |
3 files changed, 28 insertions, 55 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4303cab..fe4841a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,219 +1,221 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "kabcore.h" | 24 | #include "kabcore.h" |
25 | 25 | ||
26 | #include <stdaddressbook.h> | 26 | #include <stdaddressbook.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #include <qclipboard.h> | 30 | #include <qclipboard.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplicaton.h> | 33 | #include <qapplicaton.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | #include <kabc/addresseelist.h> | 37 | #include <kabc/addresseelist.h> |
38 | #include <kabc/errorhandler.h> | 38 | #include <kabc/errorhandler.h> |
39 | #include <kabc/resource.h> | 39 | #include <kabc/resource.h> |
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include <kapplication.h> | 66 | #include <kapplication.h> |
67 | #include "KDGanttMinimizeSplitter.h" | 67 | #include "KDGanttMinimizeSplitter.h" |
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | 79 | ||
80 | //#include <qlabel.h> | 80 | //#include <qlabel.h> |
81 | 81 | ||
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | #include <qtopia/services.h> | 84 | #include <qtopia/services.h> |
85 | #include <qtopia/qcopenvelope_qws.h> | 85 | #include <qtopia/qcopenvelope_qws.h> |
86 | #include <qpe/ir.h> | 86 | #include <qpe/ir.h> |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | #endif // KAB_EMBEDDED | 89 | #endif // KAB_EMBEDDED |
90 | #include "kcmconfigs/kcmkabconfig.h" | 90 | #include "kcmconfigs/kcmkabconfig.h" |
91 | #include "kcmconfigs/kcmkdepimconfig.h" | 91 | #include "kcmconfigs/kcmkdepimconfig.h" |
92 | #include "kpimglobalprefs.h" | ||
93 | #include "externalapphandler.h" | ||
92 | 94 | ||
93 | 95 | ||
94 | #include <kresources/selectdialog.h> | 96 | #include <kresources/selectdialog.h> |
95 | #include <kmessagebox.h> | 97 | #include <kmessagebox.h> |
96 | 98 | ||
97 | #include <picture.h> | 99 | #include <picture.h> |
98 | #include <resource.h> | 100 | #include <resource.h> |
99 | 101 | ||
100 | //US#include <qsplitter.h> | 102 | //US#include <qsplitter.h> |
101 | #include <qmap.h> | 103 | #include <qmap.h> |
102 | #include <qdir.h> | 104 | #include <qdir.h> |
103 | #include <qfile.h> | 105 | #include <qfile.h> |
104 | #include <qvbox.h> | 106 | #include <qvbox.h> |
105 | #include <qlayout.h> | 107 | #include <qlayout.h> |
106 | #include <qclipboard.h> | 108 | #include <qclipboard.h> |
107 | #include <qtextstream.h> | 109 | #include <qtextstream.h> |
108 | 110 | ||
109 | #include <libkdepim/categoryselectdialog.h> | 111 | #include <libkdepim/categoryselectdialog.h> |
110 | #include <kabc/vcardconverter.h> | 112 | #include <kabc/vcardconverter.h> |
111 | 113 | ||
112 | 114 | ||
113 | #include "addresseeutil.h" | 115 | #include "addresseeutil.h" |
114 | #include "undocmds.h" | 116 | #include "undocmds.h" |
115 | #include "addresseeeditordialog.h" | 117 | #include "addresseeeditordialog.h" |
116 | #include "viewmanager.h" | 118 | #include "viewmanager.h" |
117 | #include "details/detailsviewcontainer.h" | 119 | #include "details/detailsviewcontainer.h" |
118 | #include "kabprefs.h" | 120 | #include "kabprefs.h" |
119 | #include "xxportmanager.h" | 121 | #include "xxportmanager.h" |
120 | #include "incsearchwidget.h" | 122 | #include "incsearchwidget.h" |
121 | #include "jumpbuttonbar.h" | 123 | #include "jumpbuttonbar.h" |
122 | #include "extensionmanager.h" | 124 | #include "extensionmanager.h" |
123 | #include "addresseeconfig.h" | 125 | #include "addresseeconfig.h" |
124 | #include <kcmultidialog.h> | 126 | #include <kcmultidialog.h> |
125 | 127 | ||
126 | #ifdef _WIN32_ | 128 | #ifdef _WIN32_ |
127 | 129 | ||
128 | #include "kaimportoldialog.h" | 130 | #include "kaimportoldialog.h" |
129 | #endif | 131 | #endif |
130 | 132 | ||
131 | bool pasteWithNewUid = true; | 133 | bool pasteWithNewUid = true; |
132 | 134 | ||
133 | #ifdef KAB_EMBEDDED | 135 | #ifdef KAB_EMBEDDED |
134 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 136 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
135 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 137 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
136 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 138 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
137 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 139 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
138 | #else //KAB_EMBEDDED | 140 | #else //KAB_EMBEDDED |
139 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 141 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
140 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 142 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
141 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 143 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
142 | mReadWrite( readWrite ), mModified( false ) | 144 | mReadWrite( readWrite ), mModified( false ) |
143 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
144 | { | 146 | { |
145 | 147 | ||
146 | mExtensionBarSplitter = 0; | 148 | mExtensionBarSplitter = 0; |
147 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 149 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
148 | 150 | ||
149 | mAddressBook = KABC::StdAddressBook::self(); | 151 | mAddressBook = KABC::StdAddressBook::self(); |
150 | KABC::StdAddressBook::setAutomaticSave( false ); | 152 | KABC::StdAddressBook::setAutomaticSave( false ); |
151 | 153 | ||
152 | #ifndef KAB_EMBEDDED | 154 | #ifndef KAB_EMBEDDED |
153 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 155 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
154 | #endif //KAB_EMBEDDED | 156 | #endif //KAB_EMBEDDED |
155 | 157 | ||
156 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 158 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
157 | SLOT( addressBookChanged() ) ); | 159 | SLOT( addressBookChanged() ) ); |
158 | 160 | ||
159 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 161 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
160 | "X-Department", "KADDRESSBOOK" ); | 162 | "X-Department", "KADDRESSBOOK" ); |
161 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 163 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
162 | "X-Profession", "KADDRESSBOOK" ); | 164 | "X-Profession", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 165 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
164 | "X-AssistantsName", "KADDRESSBOOK" ); | 166 | "X-AssistantsName", "KADDRESSBOOK" ); |
165 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 167 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
166 | "X-ManagersName", "KADDRESSBOOK" ); | 168 | "X-ManagersName", "KADDRESSBOOK" ); |
167 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 169 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
168 | "X-SpousesName", "KADDRESSBOOK" ); | 170 | "X-SpousesName", "KADDRESSBOOK" ); |
169 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 171 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
170 | "X-Office", "KADDRESSBOOK" ); | 172 | "X-Office", "KADDRESSBOOK" ); |
171 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 173 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
172 | "X-IMAddress", "KADDRESSBOOK" ); | 174 | "X-IMAddress", "KADDRESSBOOK" ); |
173 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 175 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
174 | "X-Anniversary", "KADDRESSBOOK" ); | 176 | "X-Anniversary", "KADDRESSBOOK" ); |
175 | 177 | ||
176 | //US added this field to become compatible with Opie/qtopia addressbook | 178 | //US added this field to become compatible with Opie/qtopia addressbook |
177 | // values can be "female" or "male" or "". An empty field represents undefined. | 179 | // values can be "female" or "male" or "". An empty field represents undefined. |
178 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 180 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
179 | "X-Gender", "KADDRESSBOOK" ); | 181 | "X-Gender", "KADDRESSBOOK" ); |
180 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 182 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
181 | "X-Children", "KADDRESSBOOK" ); | 183 | "X-Children", "KADDRESSBOOK" ); |
182 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 184 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
183 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 185 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
184 | 186 | ||
185 | initGUI(); | 187 | initGUI(); |
186 | 188 | ||
187 | mIncSearchWidget->setFocus(); | 189 | mIncSearchWidget->setFocus(); |
188 | 190 | ||
189 | 191 | ||
190 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 192 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
191 | SLOT( setContactSelected( const QString& ) ) ); | 193 | SLOT( setContactSelected( const QString& ) ) ); |
192 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 194 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
193 | SLOT( editContact( const QString& ) ) ); | 195 | SLOT( editContact( const QString& ) ) ); |
194 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 196 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
195 | SLOT( deleteContacts( ) ) ); | 197 | SLOT( deleteContacts( ) ) ); |
196 | connect( mViewManager, SIGNAL( modified() ), | 198 | connect( mViewManager, SIGNAL( modified() ), |
197 | SLOT( setModified() ) ); | 199 | SLOT( setModified() ) ); |
198 | 200 | ||
199 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 201 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
200 | 202 | ||
201 | connect( mXXPortManager, SIGNAL( modified() ), | 203 | connect( mXXPortManager, SIGNAL( modified() ), |
202 | SLOT( setModified() ) ); | 204 | SLOT( setModified() ) ); |
203 | 205 | ||
204 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 206 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
205 | SLOT( incrementalSearch( const QString& ) ) ); | 207 | SLOT( incrementalSearch( const QString& ) ) ); |
206 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 208 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
207 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 209 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
208 | 210 | ||
209 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 211 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
210 | SLOT( sendMail( const QString& ) ) ); | 212 | SLOT( sendMail( const QString& ) ) ); |
211 | 213 | ||
212 | #ifndef KAB_EMBEDDED | 214 | #ifndef KAB_EMBEDDED |
213 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 215 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
214 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 216 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
215 | 217 | ||
216 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 218 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
217 | SLOT( browse( const QString& ) ) ); | 219 | SLOT( browse( const QString& ) ) ); |
218 | 220 | ||
219 | mAddressBookService = new KAddressBookService( this ); | 221 | mAddressBookService = new KAddressBookService( this ); |
@@ -342,359 +344,328 @@ KABC::Resource *KABCore::requestResource( QWidget *parent ) | |||
342 | 344 | ||
343 | QPtrList<KRES::Resource> kresResources; | 345 | QPtrList<KRES::Resource> kresResources; |
344 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 346 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
345 | KABC::Resource *resource; | 347 | KABC::Resource *resource; |
346 | while ( ( resource = resIt.current() ) != 0 ) { | 348 | while ( ( resource = resIt.current() ) != 0 ) { |
347 | ++resIt; | 349 | ++resIt; |
348 | if ( !resource->readOnly() ) { | 350 | if ( !resource->readOnly() ) { |
349 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 351 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
350 | if ( res ) | 352 | if ( res ) |
351 | kresResources.append( res ); | 353 | kresResources.append( res ); |
352 | } | 354 | } |
353 | } | 355 | } |
354 | 356 | ||
355 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 357 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
356 | return static_cast<KABC::Resource*>( res ); | 358 | return static_cast<KABC::Resource*>( res ); |
357 | } | 359 | } |
358 | 360 | ||
359 | #ifndef KAB_EMBEDDED | 361 | #ifndef KAB_EMBEDDED |
360 | KAboutData *KABCore::createAboutData() | 362 | KAboutData *KABCore::createAboutData() |
361 | #else //KAB_EMBEDDED | 363 | #else //KAB_EMBEDDED |
362 | void KABCore::createAboutData() | 364 | void KABCore::createAboutData() |
363 | #endif //KAB_EMBEDDED | 365 | #endif //KAB_EMBEDDED |
364 | { | 366 | { |
365 | #ifndef KAB_EMBEDDED | 367 | #ifndef KAB_EMBEDDED |
366 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 368 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
367 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 369 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
368 | KAboutData::License_GPL_V2, | 370 | KAboutData::License_GPL_V2, |
369 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 371 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
370 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 372 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
371 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 373 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
372 | about->addAuthor( "Cornelius Schumacher", | 374 | about->addAuthor( "Cornelius Schumacher", |
373 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 375 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
374 | "schumacher@kde.org" ); | 376 | "schumacher@kde.org" ); |
375 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 377 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
376 | "mpilone@slac.com" ); | 378 | "mpilone@slac.com" ); |
377 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 379 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
378 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 380 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
379 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 381 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
380 | "michel@klaralvdalens-datakonsult.se" ); | 382 | "michel@klaralvdalens-datakonsult.se" ); |
381 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 383 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
382 | "hansen@kde.org" ); | 384 | "hansen@kde.org" ); |
383 | 385 | ||
384 | return about; | 386 | return about; |
385 | #endif //KAB_EMBEDDED | 387 | #endif //KAB_EMBEDDED |
386 | 388 | ||
387 | QString version; | 389 | QString version; |
388 | #include <../version> | 390 | #include <../version> |
389 | QMessageBox::about( this, "About KAddressbook/Pi", | 391 | QMessageBox::about( this, "About KAddressbook/Pi", |
390 | "KAddressbook/Platform-independent\n" | 392 | "KAddressbook/Platform-independent\n" |
391 | "(KA/Pi) " +version + " - " + | 393 | "(KA/Pi) " +version + " - " + |
392 | #ifdef DESKTOP_VERSION | 394 | #ifdef DESKTOP_VERSION |
393 | "Desktop Edition\n" | 395 | "Desktop Edition\n" |
394 | #else | 396 | #else |
395 | "PDA-Edition\n" | 397 | "PDA-Edition\n" |
396 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 398 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
397 | #endif | 399 | #endif |
398 | 400 | ||
399 | "(c) 2004 Ulf Schenk\n" | 401 | "(c) 2004 Ulf Schenk\n" |
400 | "(c) 1997-2003, The KDE PIM Team\n" | 402 | "(c) 1997-2003, The KDE PIM Team\n" |
401 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 403 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
402 | "Don Sanders Original author\n" | 404 | "Don Sanders Original author\n" |
403 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 405 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
404 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 406 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
405 | "Greg Stern DCOP interface\n" | 407 | "Greg Stern DCOP interface\n" |
406 | "Mark Westcot Contact pinning\n" | 408 | "Mark Westcot Contact pinning\n" |
407 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 409 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
408 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" | 410 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" |
409 | #ifdef _WIN32_ | 411 | #ifdef _WIN32_ |
410 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" | 412 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" |
411 | #endif | 413 | #endif |
412 | ); | 414 | ); |
413 | } | 415 | } |
414 | 416 | ||
415 | void KABCore::setContactSelected( const QString &uid ) | 417 | void KABCore::setContactSelected( const QString &uid ) |
416 | { | 418 | { |
417 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 419 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
418 | if ( !mDetails->isHidden() ) | 420 | if ( !mDetails->isHidden() ) |
419 | mDetails->setAddressee( addr ); | 421 | mDetails->setAddressee( addr ); |
420 | 422 | ||
421 | if ( !addr.isEmpty() ) { | 423 | if ( !addr.isEmpty() ) { |
422 | emit contactSelected( addr.formattedName() ); | 424 | emit contactSelected( addr.formattedName() ); |
423 | KABC::Picture pic = addr.photo(); | 425 | KABC::Picture pic = addr.photo(); |
424 | if ( pic.isIntern() ) { | 426 | if ( pic.isIntern() ) { |
425 | //US emit contactSelected( pic.data() ); | 427 | //US emit contactSelected( pic.data() ); |
426 | //US instead use: | 428 | //US instead use: |
427 | QPixmap px; | 429 | QPixmap px; |
428 | if (pic.data().isNull() != true) | 430 | if (pic.data().isNull() != true) |
429 | { | 431 | { |
430 | px.convertFromImage(pic.data()); | 432 | px.convertFromImage(pic.data()); |
431 | } | 433 | } |
432 | 434 | ||
433 | emit contactSelected( px ); | 435 | emit contactSelected( px ); |
434 | } | 436 | } |
435 | } | 437 | } |
436 | 438 | ||
437 | 439 | ||
438 | mExtensionManager->setSelectionChanged(); | 440 | mExtensionManager->setSelectionChanged(); |
439 | 441 | ||
440 | // update the actions | 442 | // update the actions |
441 | bool selected = !uid.isEmpty(); | 443 | bool selected = !uid.isEmpty(); |
442 | 444 | ||
443 | if ( mReadWrite ) { | 445 | if ( mReadWrite ) { |
444 | mActionCut->setEnabled( selected ); | 446 | mActionCut->setEnabled( selected ); |
445 | mActionPaste->setEnabled( selected ); | 447 | mActionPaste->setEnabled( selected ); |
446 | } | 448 | } |
447 | 449 | ||
448 | mActionCopy->setEnabled( selected ); | 450 | mActionCopy->setEnabled( selected ); |
449 | mActionDelete->setEnabled( selected ); | 451 | mActionDelete->setEnabled( selected ); |
450 | mActionEditAddressee->setEnabled( selected ); | 452 | mActionEditAddressee->setEnabled( selected ); |
451 | mActionMail->setEnabled( selected ); | 453 | mActionMail->setEnabled( selected ); |
452 | mActionMailVCard->setEnabled( selected ); | 454 | mActionMailVCard->setEnabled( selected ); |
453 | //if (mActionBeam) | 455 | //if (mActionBeam) |
454 | //mActionBeam->setEnabled( selected ); | 456 | //mActionBeam->setEnabled( selected ); |
455 | 457 | ||
456 | if (mActionBeamVCard) | 458 | if (mActionBeamVCard) |
457 | mActionBeamVCard->setEnabled( selected ); | 459 | mActionBeamVCard->setEnabled( selected ); |
458 | 460 | ||
459 | mActionWhoAmI->setEnabled( selected ); | 461 | mActionWhoAmI->setEnabled( selected ); |
460 | mActionCategories->setEnabled( selected ); | 462 | mActionCategories->setEnabled( selected ); |
461 | } | 463 | } |
462 | 464 | ||
463 | void KABCore::sendMail() | 465 | void KABCore::sendMail() |
464 | { | 466 | { |
465 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 467 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
466 | } | 468 | } |
467 | 469 | ||
468 | void KABCore::sendMail( const QString& email ) | 470 | void KABCore::sendMail( const QString& email ) |
469 | { | 471 | { |
470 | //US original kde implementation : kapp->invokeMailer( email, "" ); | 472 | bool result = ExternalAppHandler::instance()->mailToContacts(email); |
471 | |||
472 | /*US original qtopia implementation | ||
473 | PimContact c = abList->currentEntry(); | ||
474 | QString name = c.fileAs(); | ||
475 | QString email = c.defaultEmail(); | ||
476 | #ifndef QT_NO_COP | ||
477 | QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); | ||
478 | e << name << email; | ||
479 | #else | ||
480 | */ | ||
481 | |||
482 | |||
483 | #ifndef QT_NO_COP | ||
484 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | ||
485 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
486 | |||
487 | QCopEnvelope e(channel, "writeMail(QString,QString)"); | ||
488 | //US we need no names in the To field. The emailadresses are enough | ||
489 | e << "" << email; | ||
490 | #else | ||
491 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
492 | #endif | ||
493 | } | 473 | } |
494 | 474 | ||
495 | 475 | ||
496 | 476 | ||
497 | void KABCore::mailVCard() | 477 | void KABCore::mailVCard() |
498 | { | 478 | { |
499 | QStringList uids = mViewManager->selectedUids(); | 479 | QStringList uids = mViewManager->selectedUids(); |
500 | if ( !uids.isEmpty() ) | 480 | if ( !uids.isEmpty() ) |
501 | mailVCard( uids ); | 481 | mailVCard( uids ); |
502 | } | 482 | } |
503 | 483 | ||
504 | void KABCore::mailVCard( const QStringList& uids ) | 484 | void KABCore::mailVCard( const QStringList& uids ) |
505 | { | 485 | { |
506 | QStringList urls; | 486 | QStringList urls; |
507 | 487 | ||
508 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 488 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
509 | 489 | ||
510 | /*US | 490 | /*US |
511 | // Create a temp dir, so that we can put the files in it with proper names | 491 | // Create a temp dir, so that we can put the files in it with proper names |
512 | KTempFile tempDir; | 492 | KTempFile tempDir; |
513 | if ( tempDir.status() != 0 ) { | 493 | if ( tempDir.status() != 0 ) { |
514 | kdWarning() << strerror( tempDir.status() ) << endl; | 494 | kdWarning() << strerror( tempDir.status() ) << endl; |
515 | return; | 495 | return; |
516 | } | 496 | } |
517 | 497 | ||
518 | QString dirName = tempDir.name(); | 498 | QString dirName = tempDir.name(); |
519 | tempDir.unlink(); | 499 | tempDir.unlink(); |
520 | */ | 500 | */ |
521 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 501 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
522 | 502 | ||
523 | 503 | ||
524 | 504 | ||
525 | QDir().mkdir( dirName, true ); | 505 | QDir().mkdir( dirName, true ); |
526 | 506 | ||
527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 507 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
528 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 508 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
529 | 509 | ||
530 | if ( a.isEmpty() ) | 510 | if ( a.isEmpty() ) |
531 | continue; | 511 | continue; |
532 | 512 | ||
533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 513 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
534 | 514 | ||
535 | QString fileName = dirName + "/" + name; | 515 | QString fileName = dirName + "/" + name; |
536 | 516 | ||
537 | QFile outFile(fileName); | 517 | QFile outFile(fileName); |
538 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 518 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
539 | KABC::VCardConverter converter; | 519 | KABC::VCardConverter converter; |
540 | QString vcard; | 520 | QString vcard; |
541 | 521 | ||
542 | converter.addresseeToVCard( a, vcard ); | 522 | converter.addresseeToVCard( a, vcard ); |
543 | 523 | ||
544 | QTextStream t( &outFile ); // use a text stream | 524 | QTextStream t( &outFile ); // use a text stream |
545 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 525 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
546 | t << vcard; | 526 | t << vcard; |
547 | 527 | ||
548 | outFile.close(); | 528 | outFile.close(); |
549 | 529 | ||
550 | urls.append( fileName ); | 530 | urls.append( fileName ); |
551 | } | 531 | } |
552 | } | 532 | } |
533 | |||
534 | bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); | ||
535 | |||
536 | |||
553 | /*US | 537 | /*US |
554 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 538 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
555 | QString::null, // subject | 539 | QString::null, // subject |
556 | QString::null, // body | 540 | QString::null, // body |
557 | QString::null, | 541 | QString::null, |
558 | urls ); // attachments | 542 | urls ); // attachments |
559 | */ | 543 | */ |
560 | #ifndef QT_NO_COP | ||
561 | QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); | ||
562 | qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); | ||
563 | |||
564 | QMap<QString, QString> parameterMap; | ||
565 | parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); | ||
566 | |||
567 | QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); | ||
568 | e << parameterMap; | ||
569 | #else | ||
570 | KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); | ||
571 | #endif | ||
572 | |||
573 | 544 | ||
574 | } | 545 | } |
575 | 546 | ||
576 | /** | 547 | /** |
577 | Beams the "WhoAmI contact. | 548 | Beams the "WhoAmI contact. |
578 | */ | 549 | */ |
579 | void KABCore::beamMySelf() | 550 | void KABCore::beamMySelf() |
580 | { | 551 | { |
581 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 552 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
582 | if (!a.isEmpty()) | 553 | if (!a.isEmpty()) |
583 | { | 554 | { |
584 | QStringList uids; | 555 | QStringList uids; |
585 | uids << a.uid(); | 556 | uids << a.uid(); |
586 | 557 | ||
587 | beamVCard(uids); | 558 | beamVCard(uids); |
588 | } else { | 559 | } 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" ) ); | 560 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
590 | 561 | ||
591 | 562 | ||
592 | } | 563 | } |
593 | } | 564 | } |
594 | 565 | ||
595 | void KABCore::beamVCard() | 566 | void KABCore::beamVCard() |
596 | { | 567 | { |
597 | QStringList uids = mViewManager->selectedUids(); | 568 | QStringList uids = mViewManager->selectedUids(); |
598 | if ( !uids.isEmpty() ) | 569 | if ( !uids.isEmpty() ) |
599 | beamVCard( uids ); | 570 | beamVCard( uids ); |
600 | } | 571 | } |
601 | 572 | ||
602 | 573 | ||
603 | void KABCore::beamVCard(const QStringList& uids) | 574 | void KABCore::beamVCard(const QStringList& uids) |
604 | { | 575 | { |
605 | /*US | 576 | /*US |
606 | QString beamFilename; | 577 | QString beamFilename; |
607 | Opie::OPimContact c; | 578 | Opie::OPimContact c; |
608 | if ( actionPersonal->isOn() ) { | 579 | if ( actionPersonal->isOn() ) { |
609 | beamFilename = addressbookPersonalVCardName(); | 580 | beamFilename = addressbookPersonalVCardName(); |
610 | if ( !QFile::exists( beamFilename ) ) | 581 | if ( !QFile::exists( beamFilename ) ) |
611 | return; // can't beam a non-existent file | 582 | return; // can't beam a non-existent file |
612 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 583 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
613 | beamFilename ); | 584 | beamFilename ); |
614 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 585 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
615 | Opie::OPimContactAccess::List allList = access->allRecords(); | 586 | Opie::OPimContactAccess::List allList = access->allRecords(); |
616 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 587 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
617 | c = *it; | 588 | c = *it; |
618 | 589 | ||
619 | delete access; | 590 | delete access; |
620 | } else { | 591 | } else { |
621 | unlink( beamfile ); // delete if exists | 592 | unlink( beamfile ); // delete if exists |
622 | mkdir("/tmp/obex/", 0755); | 593 | mkdir("/tmp/obex/", 0755); |
623 | c = m_abView -> currentEntry(); | 594 | c = m_abView -> currentEntry(); |
624 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 595 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
625 | beamfile ); | 596 | beamfile ); |
626 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 597 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
627 | access->add( c ); | 598 | access->add( c ); |
628 | access->save(); | 599 | access->save(); |
629 | delete access; | 600 | delete access; |
630 | 601 | ||
631 | beamFilename = beamfile; | 602 | beamFilename = beamfile; |
632 | } | 603 | } |
633 | 604 | ||
634 | owarn << "Beaming: " << beamFilename << oendl; | 605 | owarn << "Beaming: " << beamFilename << oendl; |
635 | */ | 606 | */ |
636 | 607 | ||
637 | #if 0 | 608 | #if 0 |
638 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 609 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
639 | 610 | ||
640 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 611 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
641 | 612 | ||
642 | QString name = "contact.vcf"; | 613 | QString name = "contact.vcf"; |
643 | 614 | ||
644 | QString fileName = dirName + "/" + name; | 615 | QString fileName = dirName + "/" + name; |
645 | #endif | 616 | #endif |
646 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 617 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
647 | // | 618 | // |
648 | QString fileName = "/tmp/kdepimbeamfile"; | 619 | QString fileName = "/tmp/kdepimbeamfile"; |
649 | 620 | ||
650 | 621 | ||
651 | //QDir().mkdir( dirName, true ); | 622 | //QDir().mkdir( dirName, true ); |
652 | 623 | ||
653 | QFile outFile(fileName); | 624 | QFile outFile(fileName); |
654 | KABC::VCardConverter converter; | 625 | KABC::VCardConverter converter; |
655 | QString description; | 626 | QString description; |
656 | 627 | ||
657 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 628 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
658 | 629 | ||
659 | QTextStream t( &outFile ); // use a text stream | 630 | QTextStream t( &outFile ); // use a text stream |
660 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 631 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
661 | 632 | ||
662 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 633 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
663 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 634 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
664 | 635 | ||
665 | if ( a.isEmpty() ) | 636 | if ( a.isEmpty() ) |
666 | continue; | 637 | continue; |
667 | 638 | ||
668 | if (description.isEmpty()) | 639 | if (description.isEmpty()) |
669 | description = a.formattedName(); | 640 | description = a.formattedName(); |
670 | 641 | ||
671 | QString vcard; | 642 | QString vcard; |
672 | converter.addresseeToVCard( a, vcard ); | 643 | converter.addresseeToVCard( a, vcard ); |
673 | t << vcard; | 644 | t << vcard; |
674 | 645 | ||
675 | } | 646 | } |
676 | } else { | 647 | } else { |
677 | qDebug("Error open temp beam file "); | 648 | qDebug("Error open temp beam file "); |
678 | return; | 649 | return; |
679 | } | 650 | } |
680 | 651 | ||
681 | outFile.close(); | 652 | outFile.close(); |
682 | 653 | ||
683 | #ifndef DESKTOP_VERSION | 654 | #ifndef DESKTOP_VERSION |
684 | Ir *ir = new Ir( this ); | 655 | Ir *ir = new Ir( this ); |
685 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 656 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
686 | ir->send( fileName, description, "text/x-vCard" ); | 657 | ir->send( fileName, description, "text/x-vCard" ); |
687 | #endif | 658 | #endif |
688 | 659 | ||
689 | } | 660 | } |
690 | 661 | ||
691 | void KABCore::beamDone( Ir *ir ) | 662 | void KABCore::beamDone( Ir *ir ) |
692 | { | 663 | { |
693 | #ifndef DESKTOP_VERSION | 664 | #ifndef DESKTOP_VERSION |
694 | delete ir; | 665 | delete ir; |
695 | #endif | 666 | #endif |
696 | } | 667 | } |
697 | 668 | ||
698 | 669 | ||
699 | void KABCore::browse( const QString& url ) | 670 | void KABCore::browse( const QString& url ) |
700 | { | 671 | { |
@@ -1072,261 +1043,263 @@ void KABCore::editContact( const QString &uid ) | |||
1072 | } | 1043 | } |
1073 | 1044 | ||
1074 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1045 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1075 | if ( !addr.isEmpty() ) { | 1046 | if ( !addr.isEmpty() ) { |
1076 | mEditorDialog->setAddressee( addr ); | 1047 | mEditorDialog->setAddressee( addr ); |
1077 | KApplication::execDialog ( mEditorDialog ); | 1048 | KApplication::execDialog ( mEditorDialog ); |
1078 | } | 1049 | } |
1079 | } | 1050 | } |
1080 | 1051 | ||
1081 | void KABCore::save() | 1052 | void KABCore::save() |
1082 | { | 1053 | { |
1083 | if ( !mModified ) | 1054 | if ( !mModified ) |
1084 | return; | 1055 | return; |
1085 | QString text = i18n( "There was an error while attempting to save\n the " | 1056 | QString text = i18n( "There was an error while attempting to save\n the " |
1086 | "address book. Please check that some \nother application is " | 1057 | "address book. Please check that some \nother application is " |
1087 | "not using it. " ); | 1058 | "not using it. " ); |
1088 | statusMessage(i18n("Saving addressbook ... ")); | 1059 | statusMessage(i18n("Saving addressbook ... ")); |
1089 | #ifndef KAB_EMBEDDED | 1060 | #ifndef KAB_EMBEDDED |
1090 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1061 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1091 | if ( !b || !b->save() ) { | 1062 | if ( !b || !b->save() ) { |
1092 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1063 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1093 | } | 1064 | } |
1094 | #else //KAB_EMBEDDED | 1065 | #else //KAB_EMBEDDED |
1095 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1066 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1096 | if ( !b || !b->save() ) { | 1067 | if ( !b || !b->save() ) { |
1097 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1068 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1098 | } | 1069 | } |
1099 | #endif //KAB_EMBEDDED | 1070 | #endif //KAB_EMBEDDED |
1100 | 1071 | ||
1101 | statusMessage(i18n("Addressbook saved!")); | 1072 | statusMessage(i18n("Addressbook saved!")); |
1102 | setModified( false ); | 1073 | setModified( false ); |
1103 | } | 1074 | } |
1104 | 1075 | ||
1105 | void KABCore::statusMessage(QString mess , int time ) | 1076 | void KABCore::statusMessage(QString mess , int time ) |
1106 | { | 1077 | { |
1107 | //topLevelWidget()->setCaption( mess ); | 1078 | //topLevelWidget()->setCaption( mess ); |
1108 | // pending setting timer to revome message | 1079 | // pending setting timer to revome message |
1109 | } | 1080 | } |
1110 | void KABCore::undo() | 1081 | void KABCore::undo() |
1111 | { | 1082 | { |
1112 | UndoStack::instance()->undo(); | 1083 | UndoStack::instance()->undo(); |
1113 | 1084 | ||
1114 | // Refresh the view | 1085 | // Refresh the view |
1115 | mViewManager->refreshView(); | 1086 | mViewManager->refreshView(); |
1116 | } | 1087 | } |
1117 | 1088 | ||
1118 | void KABCore::redo() | 1089 | void KABCore::redo() |
1119 | { | 1090 | { |
1120 | RedoStack::instance()->redo(); | 1091 | RedoStack::instance()->redo(); |
1121 | 1092 | ||
1122 | // Refresh the view | 1093 | // Refresh the view |
1123 | mViewManager->refreshView(); | 1094 | mViewManager->refreshView(); |
1124 | } | 1095 | } |
1125 | 1096 | ||
1126 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1097 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1127 | { | 1098 | { |
1128 | if ( visible ) | 1099 | if ( visible ) |
1129 | mJumpButtonBar->show(); | 1100 | mJumpButtonBar->show(); |
1130 | else | 1101 | else |
1131 | mJumpButtonBar->hide(); | 1102 | mJumpButtonBar->hide(); |
1132 | } | 1103 | } |
1133 | void KABCore::setDetailsToState() | 1104 | void KABCore::setDetailsToState() |
1134 | { | 1105 | { |
1135 | setDetailsVisible( mActionDetails->isChecked() ); | 1106 | setDetailsVisible( mActionDetails->isChecked() ); |
1136 | } | 1107 | } |
1137 | 1108 | ||
1138 | void KABCore::setDetailsVisible( bool visible ) | 1109 | void KABCore::setDetailsVisible( bool visible ) |
1139 | { | 1110 | { |
1140 | if ( visible ) | 1111 | if ( visible ) |
1141 | mDetails->show(); | 1112 | mDetails->show(); |
1142 | else | 1113 | else |
1143 | mDetails->hide(); | 1114 | mDetails->hide(); |
1144 | } | 1115 | } |
1145 | 1116 | ||
1146 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1117 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1147 | { | 1118 | { |
1148 | 1119 | ||
1149 | if ( list.count() != 0 ) { | 1120 | if ( list.count() != 0 ) { |
1150 | KABC::Addressee::List::ConstIterator it; | 1121 | KABC::Addressee::List::ConstIterator it; |
1151 | for ( it = list.begin(); it != list.end(); ++it ) | 1122 | for ( it = list.begin(); it != list.end(); ++it ) |
1152 | mAddressBook->insertAddressee( *it ); | 1123 | mAddressBook->insertAddressee( *it ); |
1153 | if ( list.count() > 1 ) | 1124 | if ( list.count() > 1 ) |
1154 | setModified(); | 1125 | setModified(); |
1155 | else | 1126 | else |
1156 | setModifiedWOrefresh(); | 1127 | setModifiedWOrefresh(); |
1157 | } | 1128 | } |
1158 | if ( list.count() == 0 ) | 1129 | if ( list.count() == 0 ) |
1159 | mViewManager->refreshView(); | 1130 | mViewManager->refreshView(); |
1160 | else | 1131 | else |
1161 | mViewManager->refreshView( list[ 0 ].uid() ); | 1132 | mViewManager->refreshView( list[ 0 ].uid() ); |
1162 | 1133 | ||
1163 | 1134 | ||
1164 | 1135 | ||
1165 | } | 1136 | } |
1166 | 1137 | ||
1167 | QString KABCore::getNameByPhone( const QString &phone ) | 1138 | QString KABCore::getNameByPhone( const QString &phone ) |
1168 | { | 1139 | { |
1169 | #ifndef KAB_EMBEDDED | 1140 | #ifndef KAB_EMBEDDED |
1170 | QRegExp r( "[/*/-/ ]" ); | 1141 | QRegExp r( "[/*/-/ ]" ); |
1171 | QString localPhone( phone ); | 1142 | QString localPhone( phone ); |
1172 | 1143 | ||
1173 | bool found = false; | 1144 | bool found = false; |
1174 | QString ownerName = ""; | 1145 | QString ownerName = ""; |
1175 | KABC::AddressBook::Iterator iter; | 1146 | KABC::AddressBook::Iterator iter; |
1176 | KABC::PhoneNumber::List::Iterator phoneIter; | 1147 | KABC::PhoneNumber::List::Iterator phoneIter; |
1177 | KABC::PhoneNumber::List phoneList; | 1148 | KABC::PhoneNumber::List phoneList; |
1178 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1149 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1179 | phoneList = (*iter).phoneNumbers(); | 1150 | phoneList = (*iter).phoneNumbers(); |
1180 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1151 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1181 | ++phoneIter) { | 1152 | ++phoneIter) { |
1182 | // Get rid of separator chars so just the numbers are compared. | 1153 | // Get rid of separator chars so just the numbers are compared. |
1183 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1154 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1184 | ownerName = (*iter).formattedName(); | 1155 | ownerName = (*iter).formattedName(); |
1185 | found = true; | 1156 | found = true; |
1186 | } | 1157 | } |
1187 | } | 1158 | } |
1188 | } | 1159 | } |
1189 | 1160 | ||
1190 | return ownerName; | 1161 | return ownerName; |
1191 | #else //KAB_EMBEDDED | 1162 | #else //KAB_EMBEDDED |
1192 | qDebug("KABCore::getNameByPhone finsih method"); | 1163 | qDebug("KABCore::getNameByPhone finsih method"); |
1193 | return ""; | 1164 | return ""; |
1194 | #endif //KAB_EMBEDDED | 1165 | #endif //KAB_EMBEDDED |
1195 | 1166 | ||
1196 | } | 1167 | } |
1197 | 1168 | ||
1198 | void KABCore::openConfigDialog() | 1169 | void KABCore::openConfigDialog() |
1199 | { | 1170 | { |
1200 | KABPrefs* prefs = KABPrefs::instance(); | 1171 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1201 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( prefs, "PIM", this ,"kabconfigdialog", true ); | 1172 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1202 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1173 | |
1174 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | ||
1175 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | ||
1203 | ConfigureDialog->addModule(kabcfg ); | 1176 | ConfigureDialog->addModule(kabcfg ); |
1204 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Pim")) , "KCMKdeLibConfig" ); | 1177 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1205 | ConfigureDialog->addModule(kdelibcfg ); | 1178 | ConfigureDialog->addModule(kdelibcfg ); |
1206 | 1179 | ||
1207 | 1180 | ||
1208 | 1181 | ||
1209 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1182 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1210 | this, SLOT( configurationChanged() ) ); | 1183 | this, SLOT( configurationChanged() ) ); |
1211 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1184 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1212 | this, SLOT( configurationChanged() ) ); | 1185 | this, SLOT( configurationChanged() ) ); |
1213 | saveSettings(); | 1186 | saveSettings(); |
1214 | ConfigureDialog->showMaximized(); | 1187 | ConfigureDialog->showMaximized(); |
1215 | if ( ConfigureDialog->exec() ) | 1188 | if ( ConfigureDialog->exec() ) |
1216 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); | 1189 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); |
1217 | delete ConfigureDialog; | 1190 | delete ConfigureDialog; |
1218 | } | 1191 | } |
1219 | 1192 | ||
1220 | void KABCore::openLDAPDialog() | 1193 | void KABCore::openLDAPDialog() |
1221 | { | 1194 | { |
1222 | #ifndef KAB_EMBEDDED | 1195 | #ifndef KAB_EMBEDDED |
1223 | if ( !mLdapSearchDialog ) { | 1196 | if ( !mLdapSearchDialog ) { |
1224 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1197 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1225 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1198 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1226 | SLOT( refreshView() ) ); | 1199 | SLOT( refreshView() ) ); |
1227 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1200 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1228 | SLOT( setModified() ) ); | 1201 | SLOT( setModified() ) ); |
1229 | } else | 1202 | } else |
1230 | mLdapSearchDialog->restoreSettings(); | 1203 | mLdapSearchDialog->restoreSettings(); |
1231 | 1204 | ||
1232 | if ( mLdapSearchDialog->isOK() ) | 1205 | if ( mLdapSearchDialog->isOK() ) |
1233 | mLdapSearchDialog->exec(); | 1206 | mLdapSearchDialog->exec(); |
1234 | #else //KAB_EMBEDDED | 1207 | #else //KAB_EMBEDDED |
1235 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1208 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1236 | #endif //KAB_EMBEDDED | 1209 | #endif //KAB_EMBEDDED |
1237 | } | 1210 | } |
1238 | 1211 | ||
1239 | void KABCore::print() | 1212 | void KABCore::print() |
1240 | { | 1213 | { |
1241 | #ifndef KAB_EMBEDDED | 1214 | #ifndef KAB_EMBEDDED |
1242 | KPrinter printer; | 1215 | KPrinter printer; |
1243 | if ( !printer.setup( this ) ) | 1216 | if ( !printer.setup( this ) ) |
1244 | return; | 1217 | return; |
1245 | 1218 | ||
1246 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1219 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1247 | mViewManager->selectedUids(), this ); | 1220 | mViewManager->selectedUids(), this ); |
1248 | 1221 | ||
1249 | wizard.exec(); | 1222 | wizard.exec(); |
1250 | #else //KAB_EMBEDDED | 1223 | #else //KAB_EMBEDDED |
1251 | qDebug("KABCore::print() finsih method"); | 1224 | qDebug("KABCore::print() finsih method"); |
1252 | #endif //KAB_EMBEDDED | 1225 | #endif //KAB_EMBEDDED |
1253 | 1226 | ||
1254 | } | 1227 | } |
1255 | 1228 | ||
1256 | 1229 | ||
1257 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1230 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1258 | { | 1231 | { |
1259 | if ( mGUIClient ) | 1232 | if ( mGUIClient ) |
1260 | mGUIClient->insertChildClient( client ); | 1233 | mGUIClient->insertChildClient( client ); |
1261 | else | 1234 | else |
1262 | KMessageBox::error( this, "no KXMLGUICLient"); | 1235 | KMessageBox::error( this, "no KXMLGUICLient"); |
1263 | } | 1236 | } |
1264 | 1237 | ||
1265 | 1238 | ||
1266 | void KABCore::configurationChanged() | 1239 | void KABCore::configurationChanged() |
1267 | { | 1240 | { |
1268 | mExtensionManager->reconfigure(); | 1241 | mExtensionManager->reconfigure(); |
1269 | } | 1242 | } |
1270 | 1243 | ||
1271 | void KABCore::addressBookChanged() | 1244 | void KABCore::addressBookChanged() |
1272 | { | 1245 | { |
1273 | /*US | 1246 | /*US |
1274 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1247 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1275 | while ( it.current() ) { | 1248 | while ( it.current() ) { |
1276 | if ( it.current()->dirty() ) { | 1249 | if ( it.current()->dirty() ) { |
1277 | QString text = i18n( "Data has been changed externally. Unsaved " | 1250 | QString text = i18n( "Data has been changed externally. Unsaved " |
1278 | "changes will be lost." ); | 1251 | "changes will be lost." ); |
1279 | KMessageBox::information( this, text ); | 1252 | KMessageBox::information( this, text ); |
1280 | } | 1253 | } |
1281 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1254 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1282 | ++it; | 1255 | ++it; |
1283 | } | 1256 | } |
1284 | */ | 1257 | */ |
1285 | if (mEditorDialog) | 1258 | if (mEditorDialog) |
1286 | { | 1259 | { |
1287 | if (mEditorDialog->dirty()) | 1260 | if (mEditorDialog->dirty()) |
1288 | { | 1261 | { |
1289 | QString text = i18n( "Data has been changed externally. Unsaved " | 1262 | QString text = i18n( "Data has been changed externally. Unsaved " |
1290 | "changes will be lost." ); | 1263 | "changes will be lost." ); |
1291 | KMessageBox::information( this, text ); | 1264 | KMessageBox::information( this, text ); |
1292 | } | 1265 | } |
1293 | QString currentuid = mEditorDialog->addressee().uid(); | 1266 | QString currentuid = mEditorDialog->addressee().uid(); |
1294 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1267 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1295 | } | 1268 | } |
1296 | mViewManager->refreshView(); | 1269 | mViewManager->refreshView(); |
1297 | // mDetails->refreshView(); | 1270 | // mDetails->refreshView(); |
1298 | 1271 | ||
1299 | 1272 | ||
1300 | } | 1273 | } |
1301 | 1274 | ||
1302 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1275 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1303 | const char *name ) | 1276 | const char *name ) |
1304 | { | 1277 | { |
1305 | 1278 | ||
1306 | if ( mEditorDialog == 0 ) { | 1279 | if ( mEditorDialog == 0 ) { |
1307 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1280 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1308 | name ? name : "editorDialog" ); | 1281 | name ? name : "editorDialog" ); |
1309 | 1282 | ||
1310 | 1283 | ||
1311 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1284 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1312 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1285 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1313 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1286 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1314 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1287 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1315 | } | 1288 | } |
1316 | 1289 | ||
1317 | return mEditorDialog; | 1290 | return mEditorDialog; |
1318 | } | 1291 | } |
1319 | 1292 | ||
1320 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1293 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1321 | { | 1294 | { |
1322 | //mEditorDict.remove( uid ); | 1295 | //mEditorDict.remove( uid ); |
1323 | } | 1296 | } |
1324 | 1297 | ||
1325 | void KABCore::initGUI() | 1298 | void KABCore::initGUI() |
1326 | { | 1299 | { |
1327 | #ifndef KAB_EMBEDDED | 1300 | #ifndef KAB_EMBEDDED |
1328 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1301 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1329 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1302 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1330 | 1303 | ||
1331 | mExtensionBarSplitter = new QSplitter( this ); | 1304 | mExtensionBarSplitter = new QSplitter( this ); |
1332 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1305 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index 26398f8..b460a81 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp | |||
@@ -1,92 +1,92 @@ | |||
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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #ifndef KAB_EMBEDDED | 26 | #ifndef KAB_EMBEDDED |
27 | #include <kaboutdata.h> | 27 | #include <kaboutdata.h> |
28 | #endif //KAB_EMBEDDED | 28 | #endif //KAB_EMBEDDED |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | //#include <klocale.h> | 30 | //#include <klocale.h> |
31 | //#include <stdlib.h> | 31 | //#include <stdlib.h> |
32 | 32 | ||
33 | #include "kabconfigwidget.h" | 33 | #include "kabconfigwidget.h" |
34 | 34 | ||
35 | #include "kcmkabconfig.h" | 35 | #include "kcmkabconfig.h" |
36 | 36 | ||
37 | #include "kabprefs.h" | 37 | #include "kabprefs.h" |
38 | #include "kprefs.h" | 38 | #include "kprefs.h" |
39 | 39 | ||
40 | extern "C" | 40 | extern "C" |
41 | { | 41 | { |
42 | KCModule *create_kabconfig( QWidget *parent, const char * ) { | 42 | KCModule *create_kabconfig( KABPrefs* prefs, QWidget *parent, const char * ) { |
43 | return new KCMKabConfig( parent, "kcmkabconfig" ); | 43 | return new KCMKabConfig( prefs, parent, "kcmkabconfig" ); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) | 47 | KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name ) |
48 | : KCModule( parent, name ) | 48 | : KCModule( prefs, parent, name ) |
49 | { | 49 | { |
50 | //abort(); | 50 | //abort(); |
51 | QVBoxLayout *layout = new QVBoxLayout( this ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this ); |
52 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); | 52 | mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); |
53 | layout->addWidget( mConfigWidget ); | 53 | layout->addWidget( mConfigWidget ); |
54 | layout->setSpacing( 0 ); | 54 | layout->setSpacing( 0 ); |
55 | layout->setMargin( 0 ); | 55 | layout->setMargin( 0 ); |
56 | 56 | ||
57 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 57 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
58 | } | 58 | } |
59 | 59 | ||
60 | void KCMKabConfig::load(KPrefs* prefs) | 60 | void KCMKabConfig::load() |
61 | { | 61 | { |
62 | mConfigWidget->restoreSettings((KABPrefs*)prefs); | 62 | mConfigWidget->restoreSettings((KABPrefs*)getPreferences()); |
63 | } | 63 | } |
64 | 64 | ||
65 | void KCMKabConfig::save(KPrefs* prefs) | 65 | void KCMKabConfig::save() |
66 | { | 66 | { |
67 | mConfigWidget->saveSettings((KABPrefs*)prefs); | 67 | mConfigWidget->saveSettings((KABPrefs*)getPreferences()); |
68 | } | 68 | } |
69 | 69 | ||
70 | void KCMKabConfig::defaults(KPrefs* prefs) | 70 | void KCMKabConfig::defaults() |
71 | { | 71 | { |
72 | mConfigWidget->defaults((KABPrefs*)prefs); | 72 | mConfigWidget->defaults((KABPrefs*)getPreferences()); |
73 | } | 73 | } |
74 | 74 | ||
75 | #ifndef KAB_EMBEDDED | 75 | #ifndef KAB_EMBEDDED |
76 | const KAboutData* KCMKabConfig::aboutData() const | 76 | const KAboutData* KCMKabConfig::aboutData() const |
77 | { | 77 | { |
78 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), | 78 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), |
79 | I18N_NOOP( "KAddressBook Configure Dialog" ), | 79 | I18N_NOOP( "KAddressBook Configure Dialog" ), |
80 | 0, 0, KAboutData::License_GPL, | 80 | 0, 0, KAboutData::License_GPL, |
81 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); | 81 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); |
82 | 82 | ||
83 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); | 83 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); |
84 | 84 | ||
85 | return about; | 85 | return about; |
86 | 86 | ||
87 | } | 87 | } |
88 | #endif //KAB_EMBEDDED | 88 | #endif //KAB_EMBEDDED |
89 | 89 | ||
90 | #ifndef KAB_EMBEDDED | 90 | #ifndef KAB_EMBEDDED |
91 | #include "kcmkabconfig.moc" | 91 | #include "kcmkabconfig.moc" |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h index b4858c1..1cb6ad3 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.h +++ b/kaddressbook/kcmconfigs/kcmkabconfig.h | |||
@@ -1,47 +1,47 @@ | |||
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 KCMKABCONFIG_H | 24 | #ifndef KCMKABCONFIG_H |
25 | #define KCMKABCONFIG_H | 25 | #define KCMKABCONFIG_H |
26 | 26 | ||
27 | #include <kcmodule.h> | 27 | #include <kcmodule.h> |
28 | 28 | ||
29 | class KABConfigWidget; | 29 | class KABConfigWidget; |
30 | class KPrefs; | 30 | class KABPrefs; |
31 | 31 | ||
32 | class KCMKabConfig : public KCModule | 32 | class KCMKabConfig : public KCModule |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); | 37 | KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); |
38 | 38 | ||
39 | virtual void load(KPrefs* prefs); | 39 | virtual void load(); |
40 | virtual void save(KPrefs* prefs); | 40 | virtual void save(); |
41 | virtual void defaults(KPrefs* prefs); | 41 | virtual void defaults(); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | KABConfigWidget *mConfigWidget; | 44 | KABConfigWidget *mConfigWidget; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif | 47 | #endif |