-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,1886 +1,1859 @@ | |||
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 ); |
220 | 222 | ||
221 | #endif //KAB_EMBEDDED | 223 | #endif //KAB_EMBEDDED |
222 | mEditorDialog = 0; | 224 | mEditorDialog = 0; |
223 | createAddresseeEditorDialog( this ); | 225 | createAddresseeEditorDialog( this ); |
224 | setModified( false ); | 226 | setModified( false ); |
225 | } | 227 | } |
226 | 228 | ||
227 | KABCore::~KABCore() | 229 | KABCore::~KABCore() |
228 | { | 230 | { |
229 | // save(); | 231 | // save(); |
230 | //saveSettings(); | 232 | //saveSettings(); |
231 | //KABPrefs::instance()->writeConfig(); | 233 | //KABPrefs::instance()->writeConfig(); |
232 | delete AddresseeConfig::instance(); | 234 | delete AddresseeConfig::instance(); |
233 | mAddressBook = 0; | 235 | mAddressBook = 0; |
234 | KABC::StdAddressBook::close(); | 236 | KABC::StdAddressBook::close(); |
235 | } | 237 | } |
236 | 238 | ||
237 | void KABCore::restoreSettings() | 239 | void KABCore::restoreSettings() |
238 | { | 240 | { |
239 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 241 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
240 | 242 | ||
241 | mActionJumpBar->setChecked( state ); | 243 | mActionJumpBar->setChecked( state ); |
242 | setJumpButtonBarVisible( state ); | 244 | setJumpButtonBarVisible( state ); |
243 | 245 | ||
244 | state = KABPrefs::instance()->mDetailsPageVisible; | 246 | state = KABPrefs::instance()->mDetailsPageVisible; |
245 | 247 | ||
246 | mActionDetails->setChecked( state ); | 248 | mActionDetails->setChecked( state ); |
247 | setDetailsVisible( state ); | 249 | setDetailsVisible( state ); |
248 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 250 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
249 | if ( splitterSize.count() == 0 ) { | 251 | if ( splitterSize.count() == 0 ) { |
250 | splitterSize.append( width() / 2 ); | 252 | splitterSize.append( width() / 2 ); |
251 | splitterSize.append( width() / 2 ); | 253 | splitterSize.append( width() / 2 ); |
252 | } | 254 | } |
253 | mMiniSplitter->setSizes( splitterSize ); | 255 | mMiniSplitter->setSizes( splitterSize ); |
254 | if ( mExtensionBarSplitter ) { | 256 | if ( mExtensionBarSplitter ) { |
255 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 257 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
256 | if ( splitterSize.count() == 0 ) { | 258 | if ( splitterSize.count() == 0 ) { |
257 | splitterSize.append( width() / 2 ); | 259 | splitterSize.append( width() / 2 ); |
258 | splitterSize.append( width() / 2 ); | 260 | splitterSize.append( width() / 2 ); |
259 | } | 261 | } |
260 | mExtensionBarSplitter->setSizes( splitterSize ); | 262 | mExtensionBarSplitter->setSizes( splitterSize ); |
261 | 263 | ||
262 | } | 264 | } |
263 | #ifndef KAB_EMBEDDED | 265 | #ifndef KAB_EMBEDDED |
264 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 266 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
265 | if ( splitterSize.count() == 0 ) { | 267 | if ( splitterSize.count() == 0 ) { |
266 | splitterSize.append( width() / 2 ); | 268 | splitterSize.append( width() / 2 ); |
267 | splitterSize.append( width() / 2 ); | 269 | splitterSize.append( width() / 2 ); |
268 | } | 270 | } |
269 | mExtensionBarSplitter->setSizes( splitterSize ); | 271 | mExtensionBarSplitter->setSizes( splitterSize ); |
270 | 272 | ||
271 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 273 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
272 | if ( splitterSize.count() == 0 ) { | 274 | if ( splitterSize.count() == 0 ) { |
273 | splitterSize.append( height() / 2 ); | 275 | splitterSize.append( height() / 2 ); |
274 | splitterSize.append( height() / 2 ); | 276 | splitterSize.append( height() / 2 ); |
275 | } | 277 | } |
276 | mDetailsSplitter->setSizes( splitterSize ); | 278 | mDetailsSplitter->setSizes( splitterSize ); |
277 | 279 | ||
278 | mExtensionManager->restoreSettings(); | 280 | mExtensionManager->restoreSettings(); |
279 | 281 | ||
280 | #endif //KAB_EMBEDDED | 282 | #endif //KAB_EMBEDDED |
281 | 283 | ||
282 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 284 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
283 | 285 | ||
284 | mViewManager->restoreSettings(); | 286 | mViewManager->restoreSettings(); |
285 | mExtensionManager->restoreSettings(); | 287 | mExtensionManager->restoreSettings(); |
286 | } | 288 | } |
287 | 289 | ||
288 | void KABCore::saveSettings() | 290 | void KABCore::saveSettings() |
289 | { | 291 | { |
290 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 292 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
291 | if ( mExtensionBarSplitter ) | 293 | if ( mExtensionBarSplitter ) |
292 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 294 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
293 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 295 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
294 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 296 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
295 | #ifndef KAB_EMBEDDED | 297 | #ifndef KAB_EMBEDDED |
296 | 298 | ||
297 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 299 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
298 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 300 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
299 | #endif //KAB_EMBEDDED | 301 | #endif //KAB_EMBEDDED |
300 | mExtensionManager->saveSettings(); | 302 | mExtensionManager->saveSettings(); |
301 | mViewManager->saveSettings(); | 303 | mViewManager->saveSettings(); |
302 | 304 | ||
303 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 305 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
304 | 306 | ||
305 | } | 307 | } |
306 | 308 | ||
307 | KABC::AddressBook *KABCore::addressBook() const | 309 | KABC::AddressBook *KABCore::addressBook() const |
308 | { | 310 | { |
309 | return mAddressBook; | 311 | return mAddressBook; |
310 | } | 312 | } |
311 | 313 | ||
312 | KConfig *KABCore::config() | 314 | KConfig *KABCore::config() |
313 | { | 315 | { |
314 | #ifndef KAB_EMBEDDED | 316 | #ifndef KAB_EMBEDDED |
315 | return KABPrefs::instance()->config(); | 317 | return KABPrefs::instance()->config(); |
316 | #else //KAB_EMBEDDED | 318 | #else //KAB_EMBEDDED |
317 | return KABPrefs::instance()->getConfig(); | 319 | return KABPrefs::instance()->getConfig(); |
318 | #endif //KAB_EMBEDDED | 320 | #endif //KAB_EMBEDDED |
319 | } | 321 | } |
320 | 322 | ||
321 | KActionCollection *KABCore::actionCollection() const | 323 | KActionCollection *KABCore::actionCollection() const |
322 | { | 324 | { |
323 | return mGUIClient->actionCollection(); | 325 | return mGUIClient->actionCollection(); |
324 | } | 326 | } |
325 | 327 | ||
326 | KABC::Field *KABCore::currentSearchField() const | 328 | KABC::Field *KABCore::currentSearchField() const |
327 | { | 329 | { |
328 | if (mIncSearchWidget) | 330 | if (mIncSearchWidget) |
329 | return mIncSearchWidget->currentField(); | 331 | return mIncSearchWidget->currentField(); |
330 | else | 332 | else |
331 | return 0; | 333 | return 0; |
332 | } | 334 | } |
333 | 335 | ||
334 | QStringList KABCore::selectedUIDs() const | 336 | QStringList KABCore::selectedUIDs() const |
335 | { | 337 | { |
336 | return mViewManager->selectedUids(); | 338 | return mViewManager->selectedUids(); |
337 | } | 339 | } |
338 | 340 | ||
339 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 341 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
340 | { | 342 | { |
341 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 343 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
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 | { |
701 | #ifndef KAB_EMBEDDED | 672 | #ifndef KAB_EMBEDDED |
702 | kapp->invokeBrowser( url ); | 673 | kapp->invokeBrowser( url ); |
703 | #else //KAB_EMBEDDED | 674 | #else //KAB_EMBEDDED |
704 | qDebug("KABCore::browse must be fixed"); | 675 | qDebug("KABCore::browse must be fixed"); |
705 | #endif //KAB_EMBEDDED | 676 | #endif //KAB_EMBEDDED |
706 | } | 677 | } |
707 | 678 | ||
708 | void KABCore::selectAllContacts() | 679 | void KABCore::selectAllContacts() |
709 | { | 680 | { |
710 | mViewManager->setSelected( QString::null, true ); | 681 | mViewManager->setSelected( QString::null, true ); |
711 | } | 682 | } |
712 | 683 | ||
713 | void KABCore::deleteContacts() | 684 | void KABCore::deleteContacts() |
714 | { | 685 | { |
715 | QStringList uidList = mViewManager->selectedUids(); | 686 | QStringList uidList = mViewManager->selectedUids(); |
716 | deleteContacts( uidList ); | 687 | deleteContacts( uidList ); |
717 | } | 688 | } |
718 | 689 | ||
719 | void KABCore::deleteContacts( const QStringList &uids ) | 690 | void KABCore::deleteContacts( const QStringList &uids ) |
720 | { | 691 | { |
721 | if ( uids.count() > 0 ) { | 692 | if ( uids.count() > 0 ) { |
722 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 693 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
723 | UndoStack::instance()->push( command ); | 694 | UndoStack::instance()->push( command ); |
724 | RedoStack::instance()->clear(); | 695 | RedoStack::instance()->clear(); |
725 | 696 | ||
726 | // now if we deleted anything, refresh | 697 | // now if we deleted anything, refresh |
727 | setContactSelected( QString::null ); | 698 | setContactSelected( QString::null ); |
728 | setModified( true ); | 699 | setModified( true ); |
729 | } | 700 | } |
730 | } | 701 | } |
731 | 702 | ||
732 | void KABCore::copyContacts() | 703 | void KABCore::copyContacts() |
733 | { | 704 | { |
734 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 705 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
735 | 706 | ||
736 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 707 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
737 | 708 | ||
738 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 709 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
739 | 710 | ||
740 | QClipboard *cb = QApplication::clipboard(); | 711 | QClipboard *cb = QApplication::clipboard(); |
741 | cb->setText( clipText ); | 712 | cb->setText( clipText ); |
742 | } | 713 | } |
743 | 714 | ||
744 | void KABCore::cutContacts() | 715 | void KABCore::cutContacts() |
745 | { | 716 | { |
746 | QStringList uidList = mViewManager->selectedUids(); | 717 | QStringList uidList = mViewManager->selectedUids(); |
747 | 718 | ||
748 | //US if ( uidList.size() > 0 ) { | 719 | //US if ( uidList.size() > 0 ) { |
749 | if ( uidList.count() > 0 ) { | 720 | if ( uidList.count() > 0 ) { |
750 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 721 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
751 | UndoStack::instance()->push( command ); | 722 | UndoStack::instance()->push( command ); |
752 | RedoStack::instance()->clear(); | 723 | RedoStack::instance()->clear(); |
753 | 724 | ||
754 | setModified( true ); | 725 | setModified( true ); |
755 | } | 726 | } |
756 | } | 727 | } |
757 | 728 | ||
758 | void KABCore::pasteContacts() | 729 | void KABCore::pasteContacts() |
759 | { | 730 | { |
760 | QClipboard *cb = QApplication::clipboard(); | 731 | QClipboard *cb = QApplication::clipboard(); |
761 | 732 | ||
762 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 733 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
763 | 734 | ||
764 | pasteContacts( list ); | 735 | pasteContacts( list ); |
765 | } | 736 | } |
766 | 737 | ||
767 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 738 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
768 | { | 739 | { |
769 | KABC::Resource *resource = requestResource( this ); | 740 | KABC::Resource *resource = requestResource( this ); |
770 | KABC::Addressee::List::Iterator it; | 741 | KABC::Addressee::List::Iterator it; |
771 | for ( it = list.begin(); it != list.end(); ++it ) | 742 | for ( it = list.begin(); it != list.end(); ++it ) |
772 | (*it).setResource( resource ); | 743 | (*it).setResource( resource ); |
773 | 744 | ||
774 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 745 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
775 | UndoStack::instance()->push( command ); | 746 | UndoStack::instance()->push( command ); |
776 | RedoStack::instance()->clear(); | 747 | RedoStack::instance()->clear(); |
777 | 748 | ||
778 | setModified( true ); | 749 | setModified( true ); |
779 | } | 750 | } |
780 | 751 | ||
781 | void KABCore::setWhoAmI() | 752 | void KABCore::setWhoAmI() |
782 | { | 753 | { |
783 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 754 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
784 | 755 | ||
785 | if ( addrList.count() > 1 ) { | 756 | if ( addrList.count() > 1 ) { |
786 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 757 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
787 | return; | 758 | return; |
788 | } | 759 | } |
789 | 760 | ||
790 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 761 | 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 ) | 762 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
792 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 763 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
793 | } | 764 | } |
794 | 765 | ||
795 | void KABCore::setCategories() | 766 | void KABCore::setCategories() |
796 | { | 767 | { |
797 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 768 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
798 | if ( !dlg.exec() ) | 769 | if ( !dlg.exec() ) |
799 | return; | 770 | return; |
800 | 771 | ||
801 | bool merge = false; | 772 | bool merge = false; |
802 | QString msg = i18n( "Merge with existing categories?" ); | 773 | QString msg = i18n( "Merge with existing categories?" ); |
803 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 774 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
804 | merge = true; | 775 | merge = true; |
805 | 776 | ||
806 | QStringList categories = dlg.selectedCategories(); | 777 | QStringList categories = dlg.selectedCategories(); |
807 | 778 | ||
808 | QStringList uids = mViewManager->selectedUids(); | 779 | QStringList uids = mViewManager->selectedUids(); |
809 | QStringList::Iterator it; | 780 | QStringList::Iterator it; |
810 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 781 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
811 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 782 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
812 | if ( !addr.isEmpty() ) { | 783 | if ( !addr.isEmpty() ) { |
813 | if ( !merge ) | 784 | if ( !merge ) |
814 | addr.setCategories( categories ); | 785 | addr.setCategories( categories ); |
815 | else { | 786 | else { |
816 | QStringList addrCategories = addr.categories(); | 787 | QStringList addrCategories = addr.categories(); |
817 | QStringList::Iterator catIt; | 788 | QStringList::Iterator catIt; |
818 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 789 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
819 | if ( !addrCategories.contains( *catIt ) ) | 790 | if ( !addrCategories.contains( *catIt ) ) |
820 | addrCategories.append( *catIt ); | 791 | addrCategories.append( *catIt ); |
821 | } | 792 | } |
822 | addr.setCategories( addrCategories ); | 793 | addr.setCategories( addrCategories ); |
823 | } | 794 | } |
824 | 795 | ||
825 | mAddressBook->insertAddressee( addr ); | 796 | mAddressBook->insertAddressee( addr ); |
826 | } | 797 | } |
827 | } | 798 | } |
828 | 799 | ||
829 | if ( uids.count() > 0 ) | 800 | if ( uids.count() > 0 ) |
830 | setModified( true ); | 801 | setModified( true ); |
831 | } | 802 | } |
832 | 803 | ||
833 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 804 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
834 | { | 805 | { |
835 | mIncSearchWidget->setFields( fields ); | 806 | mIncSearchWidget->setFields( fields ); |
836 | } | 807 | } |
837 | 808 | ||
838 | void KABCore::incrementalSearch( const QString& text ) | 809 | void KABCore::incrementalSearch( const QString& text ) |
839 | { | 810 | { |
840 | mViewManager->setSelected( QString::null, false ); | 811 | mViewManager->setSelected( QString::null, false ); |
841 | 812 | ||
842 | if ( !text.isEmpty() ) { | 813 | if ( !text.isEmpty() ) { |
843 | KABC::Field *field = mIncSearchWidget->currentField(); | 814 | KABC::Field *field = mIncSearchWidget->currentField(); |
844 | 815 | ||
845 | QString pattern = text.lower(); | 816 | QString pattern = text.lower(); |
846 | 817 | ||
847 | #if 1 //KDE_VERSION >= 319 | 818 | #if 1 //KDE_VERSION >= 319 |
848 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 819 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
849 | if ( field ) { | 820 | if ( field ) { |
850 | list.sortByField( field ); | 821 | list.sortByField( field ); |
851 | KABC::AddresseeList::Iterator it; | 822 | KABC::AddresseeList::Iterator it; |
852 | for ( it = list.begin(); it != list.end(); ++it ) { | 823 | for ( it = list.begin(); it != list.end(); ++it ) { |
853 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 824 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
854 | mViewManager->setSelected( (*it).uid(), true ); | 825 | mViewManager->setSelected( (*it).uid(), true ); |
855 | return; | 826 | return; |
856 | } | 827 | } |
857 | } | 828 | } |
858 | } else { | 829 | } else { |
859 | KABC::AddresseeList::Iterator it; | 830 | KABC::AddresseeList::Iterator it; |
860 | for ( it = list.begin(); it != list.end(); ++it ) { | 831 | for ( it = list.begin(); it != list.end(); ++it ) { |
861 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 832 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
862 | KABC::Field::List::ConstIterator fieldIt; | 833 | KABC::Field::List::ConstIterator fieldIt; |
863 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 834 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
864 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 835 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
865 | mViewManager->setSelected( (*it).uid(), true ); | 836 | mViewManager->setSelected( (*it).uid(), true ); |
866 | return; | 837 | return; |
867 | } | 838 | } |
868 | } | 839 | } |
869 | } | 840 | } |
870 | } | 841 | } |
871 | #else | 842 | #else |
872 | KABC::AddressBook::Iterator it; | 843 | KABC::AddressBook::Iterator it; |
873 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 844 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
874 | if ( field ) { | 845 | if ( field ) { |
875 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 846 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
876 | mViewManager->setSelected( (*it).uid(), true ); | 847 | mViewManager->setSelected( (*it).uid(), true ); |
877 | return; | 848 | return; |
878 | } | 849 | } |
879 | } else { | 850 | } else { |
880 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 851 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
881 | KABC::Field::List::ConstIterator fieldIt; | 852 | KABC::Field::List::ConstIterator fieldIt; |
882 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 853 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
883 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 854 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
884 | mViewManager->setSelected( (*it).uid(), true ); | 855 | mViewManager->setSelected( (*it).uid(), true ); |
885 | return; | 856 | return; |
886 | } | 857 | } |
887 | } | 858 | } |
888 | } | 859 | } |
889 | } | 860 | } |
890 | #endif | 861 | #endif |
891 | } | 862 | } |
892 | } | 863 | } |
893 | 864 | ||
894 | void KABCore::setModified() | 865 | void KABCore::setModified() |
895 | { | 866 | { |
896 | setModified( true ); | 867 | setModified( true ); |
897 | } | 868 | } |
898 | 869 | ||
899 | void KABCore::setModifiedWOrefresh() | 870 | void KABCore::setModifiedWOrefresh() |
900 | { | 871 | { |
901 | // qDebug("KABCore::setModifiedWOrefresh() "); | 872 | // qDebug("KABCore::setModifiedWOrefresh() "); |
902 | mModified = true; | 873 | mModified = true; |
903 | mActionSave->setEnabled( mModified ); | 874 | mActionSave->setEnabled( mModified ); |
904 | #ifdef DESKTOP_VERSION | 875 | #ifdef DESKTOP_VERSION |
905 | mDetails->refreshView(); | 876 | mDetails->refreshView(); |
906 | #endif | 877 | #endif |
907 | 878 | ||
908 | } | 879 | } |
909 | void KABCore::setModified( bool modified ) | 880 | void KABCore::setModified( bool modified ) |
910 | { | 881 | { |
911 | mModified = modified; | 882 | mModified = modified; |
912 | mActionSave->setEnabled( mModified ); | 883 | mActionSave->setEnabled( mModified ); |
913 | 884 | ||
914 | if ( modified ) | 885 | if ( modified ) |
915 | mJumpButtonBar->recreateButtons(); | 886 | mJumpButtonBar->recreateButtons(); |
916 | 887 | ||
917 | mViewManager->refreshView(); | 888 | mViewManager->refreshView(); |
918 | mDetails->refreshView(); | 889 | mDetails->refreshView(); |
919 | 890 | ||
920 | } | 891 | } |
921 | 892 | ||
922 | bool KABCore::modified() const | 893 | bool KABCore::modified() const |
923 | { | 894 | { |
924 | return mModified; | 895 | return mModified; |
925 | } | 896 | } |
926 | 897 | ||
927 | void KABCore::contactModified( const KABC::Addressee &addr ) | 898 | void KABCore::contactModified( const KABC::Addressee &addr ) |
928 | { | 899 | { |
929 | 900 | ||
930 | Command *command = 0; | 901 | Command *command = 0; |
931 | QString uid; | 902 | QString uid; |
932 | 903 | ||
933 | // check if it exists already | 904 | // check if it exists already |
934 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 905 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
935 | if ( origAddr.isEmpty() ) | 906 | if ( origAddr.isEmpty() ) |
936 | command = new PwNewCommand( mAddressBook, addr ); | 907 | command = new PwNewCommand( mAddressBook, addr ); |
937 | else { | 908 | else { |
938 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 909 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
939 | uid = addr.uid(); | 910 | uid = addr.uid(); |
940 | } | 911 | } |
941 | 912 | ||
942 | UndoStack::instance()->push( command ); | 913 | UndoStack::instance()->push( command ); |
943 | RedoStack::instance()->clear(); | 914 | RedoStack::instance()->clear(); |
944 | 915 | ||
945 | setModified( true ); | 916 | setModified( true ); |
946 | } | 917 | } |
947 | 918 | ||
948 | void KABCore::newContact() | 919 | void KABCore::newContact() |
949 | { | 920 | { |
950 | 921 | ||
951 | 922 | ||
952 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 923 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
953 | 924 | ||
954 | QPtrList<KRES::Resource> kresResources; | 925 | QPtrList<KRES::Resource> kresResources; |
955 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 926 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
956 | KABC::Resource *resource; | 927 | KABC::Resource *resource; |
957 | while ( ( resource = it.current() ) != 0 ) { | 928 | while ( ( resource = it.current() ) != 0 ) { |
958 | ++it; | 929 | ++it; |
959 | if ( !resource->readOnly() ) { | 930 | if ( !resource->readOnly() ) { |
960 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 931 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
961 | if ( res ) | 932 | if ( res ) |
962 | kresResources.append( res ); | 933 | kresResources.append( res ); |
963 | } | 934 | } |
964 | } | 935 | } |
965 | 936 | ||
966 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 937 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
967 | resource = static_cast<KABC::Resource*>( res ); | 938 | resource = static_cast<KABC::Resource*>( res ); |
968 | 939 | ||
969 | if ( resource ) { | 940 | if ( resource ) { |
970 | KABC::Addressee addr; | 941 | KABC::Addressee addr; |
971 | addr.setResource( resource ); | 942 | addr.setResource( resource ); |
972 | mEditorDialog->setAddressee( addr ); | 943 | mEditorDialog->setAddressee( addr ); |
973 | KApplication::execDialog ( mEditorDialog ); | 944 | KApplication::execDialog ( mEditorDialog ); |
974 | 945 | ||
975 | } else | 946 | } else |
976 | return; | 947 | return; |
977 | 948 | ||
978 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 949 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
979 | 950 | ||
980 | 951 | ||
981 | } | 952 | } |
982 | 953 | ||
983 | void KABCore::addEmail( QString aStr ) | 954 | void KABCore::addEmail( QString aStr ) |
984 | { | 955 | { |
985 | #ifndef KAB_EMBEDDED | 956 | #ifndef KAB_EMBEDDED |
986 | QString fullName, email; | 957 | QString fullName, email; |
987 | 958 | ||
988 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 959 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
989 | 960 | ||
990 | // Try to lookup the addressee matching the email address | 961 | // Try to lookup the addressee matching the email address |
991 | bool found = false; | 962 | bool found = false; |
992 | QStringList emailList; | 963 | QStringList emailList; |
993 | KABC::AddressBook::Iterator it; | 964 | KABC::AddressBook::Iterator it; |
994 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 965 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
995 | emailList = (*it).emails(); | 966 | emailList = (*it).emails(); |
996 | if ( emailList.contains( email ) > 0 ) { | 967 | if ( emailList.contains( email ) > 0 ) { |
997 | found = true; | 968 | found = true; |
998 | (*it).setNameFromString( fullName ); | 969 | (*it).setNameFromString( fullName ); |
999 | editContact( (*it).uid() ); | 970 | editContact( (*it).uid() ); |
1000 | } | 971 | } |
1001 | } | 972 | } |
1002 | 973 | ||
1003 | if ( !found ) { | 974 | if ( !found ) { |
1004 | KABC::Addressee addr; | 975 | KABC::Addressee addr; |
1005 | addr.setNameFromString( fullName ); | 976 | addr.setNameFromString( fullName ); |
1006 | addr.insertEmail( email, true ); | 977 | addr.insertEmail( email, true ); |
1007 | 978 | ||
1008 | mAddressBook->insertAddressee( addr ); | 979 | mAddressBook->insertAddressee( addr ); |
1009 | mViewManager->refreshView( addr.uid() ); | 980 | mViewManager->refreshView( addr.uid() ); |
1010 | editContact( addr.uid() ); | 981 | editContact( addr.uid() ); |
1011 | } | 982 | } |
1012 | #else //KAB_EMBEDDED | 983 | #else //KAB_EMBEDDED |
1013 | qDebug("KABCore::addEmail finsih method"); | 984 | qDebug("KABCore::addEmail finsih method"); |
1014 | #endif //KAB_EMBEDDED | 985 | #endif //KAB_EMBEDDED |
1015 | } | 986 | } |
1016 | 987 | ||
1017 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 988 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1018 | { | 989 | { |
1019 | mXXPortManager->importVCard( url, showPreview ); | 990 | mXXPortManager->importVCard( url, showPreview ); |
1020 | } | 991 | } |
1021 | void KABCore::importFromOL() | 992 | void KABCore::importFromOL() |
1022 | { | 993 | { |
1023 | #ifdef _WIN32_ | 994 | #ifdef _WIN32_ |
1024 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 995 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1025 | idgl->exec(); | 996 | idgl->exec(); |
1026 | KABC::Addressee::List list = idgl->getAddressList(); | 997 | KABC::Addressee::List list = idgl->getAddressList(); |
1027 | if ( list.count() > 0 ) { | 998 | if ( list.count() > 0 ) { |
1028 | KABC::Addressee::List listNew; | 999 | KABC::Addressee::List listNew; |
1029 | KABC::Addressee::List listExisting; | 1000 | KABC::Addressee::List listExisting; |
1030 | KABC::Addressee::List::Iterator it; | 1001 | KABC::Addressee::List::Iterator it; |
1031 | KABC::AddressBook::Iterator iter; | 1002 | KABC::AddressBook::Iterator iter; |
1032 | for ( it = list.begin(); it != list.end(); ++it ) { | 1003 | for ( it = list.begin(); it != list.end(); ++it ) { |
1033 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1004 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1034 | listNew.append( (*it) ); | 1005 | listNew.append( (*it) ); |
1035 | else | 1006 | else |
1036 | listExisting.append( (*it) ); | 1007 | listExisting.append( (*it) ); |
1037 | } | 1008 | } |
1038 | if ( listExisting.count() > 0 ) | 1009 | 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() )); | 1010 | 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 ) { | 1011 | if ( listNew.count() > 0 ) { |
1041 | pasteWithNewUid = false; | 1012 | pasteWithNewUid = false; |
1042 | pasteContacts( listNew ); | 1013 | pasteContacts( listNew ); |
1043 | pasteWithNewUid = true; | 1014 | pasteWithNewUid = true; |
1044 | } | 1015 | } |
1045 | } | 1016 | } |
1046 | delete idgl; | 1017 | delete idgl; |
1047 | #endif | 1018 | #endif |
1048 | } | 1019 | } |
1049 | 1020 | ||
1050 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1021 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1051 | { | 1022 | { |
1052 | mXXPortManager->importVCard( vCard, showPreview ); | 1023 | mXXPortManager->importVCard( vCard, showPreview ); |
1053 | } | 1024 | } |
1054 | 1025 | ||
1055 | //US added a second method without defaultparameter | 1026 | //US added a second method without defaultparameter |
1056 | void KABCore::editContact2() { | 1027 | void KABCore::editContact2() { |
1057 | editContact( QString::null ); | 1028 | editContact( QString::null ); |
1058 | } | 1029 | } |
1059 | 1030 | ||
1060 | void KABCore::editContact( const QString &uid ) | 1031 | void KABCore::editContact( const QString &uid ) |
1061 | { | 1032 | { |
1062 | 1033 | ||
1063 | if ( mExtensionManager->isQuickEditVisible() ) | 1034 | if ( mExtensionManager->isQuickEditVisible() ) |
1064 | return; | 1035 | return; |
1065 | 1036 | ||
1066 | // First, locate the contact entry | 1037 | // First, locate the contact entry |
1067 | QString localUID = uid; | 1038 | QString localUID = uid; |
1068 | if ( localUID.isNull() ) { | 1039 | if ( localUID.isNull() ) { |
1069 | QStringList uidList = mViewManager->selectedUids(); | 1040 | QStringList uidList = mViewManager->selectedUids(); |
1070 | if ( uidList.count() > 0 ) | 1041 | if ( uidList.count() > 0 ) |
1071 | localUID = *( uidList.at( 0 ) ); | 1042 | localUID = *( uidList.at( 0 ) ); |
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 ); |
1333 | 1306 | ||
1334 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1307 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1335 | 1308 | ||
1336 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1309 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1337 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1310 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1338 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1311 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1339 | SLOT( incrementalSearch( const QString& ) ) ); | 1312 | SLOT( incrementalSearch( const QString& ) ) ); |
1340 | 1313 | ||
1341 | mViewManager = new ViewManager( this, viewSpace ); | 1314 | mViewManager = new ViewManager( this, viewSpace ); |
1342 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1315 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1343 | 1316 | ||
1344 | mDetails = new ViewContainer( mDetailsSplitter ); | 1317 | mDetails = new ViewContainer( mDetailsSplitter ); |
1345 | 1318 | ||
1346 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1319 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1347 | 1320 | ||
1348 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1321 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1349 | 1322 | ||
1350 | topLayout->addWidget( mExtensionBarSplitter ); | 1323 | topLayout->addWidget( mExtensionBarSplitter ); |
1351 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1324 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1352 | topLayout->addWidget( mJumpButtonBar ); | 1325 | topLayout->addWidget( mJumpButtonBar ); |
1353 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1326 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1354 | 1327 | ||
1355 | mXXPortManager = new XXPortManager( this, this ); | 1328 | mXXPortManager = new XXPortManager( this, this ); |
1356 | 1329 | ||
1357 | #else //KAB_EMBEDDED | 1330 | #else //KAB_EMBEDDED |
1358 | //US initialize viewMenu before settingup viewmanager. | 1331 | //US initialize viewMenu before settingup viewmanager. |
1359 | // Viewmanager needs this menu to plugin submenues. | 1332 | // Viewmanager needs this menu to plugin submenues. |
1360 | viewMenu = new QPopupMenu( this ); | 1333 | viewMenu = new QPopupMenu( this ); |
1361 | settingsMenu = new QPopupMenu( this ); | 1334 | settingsMenu = new QPopupMenu( this ); |
1362 | //filterMenu = new QPopupMenu( this ); | 1335 | //filterMenu = new QPopupMenu( this ); |
1363 | ImportMenu = new QPopupMenu( this ); | 1336 | ImportMenu = new QPopupMenu( this ); |
1364 | ExportMenu = new QPopupMenu( this ); | 1337 | ExportMenu = new QPopupMenu( this ); |
1365 | 1338 | ||
1366 | changeMenu= new QPopupMenu( this ); | 1339 | changeMenu= new QPopupMenu( this ); |
1367 | 1340 | ||
1368 | //US since we have no splitter for the embedded system, setup | 1341 | //US since we have no splitter for the embedded system, setup |
1369 | // a layout with two frames. One left and one right. | 1342 | // a layout with two frames. One left and one right. |
1370 | 1343 | ||
1371 | QBoxLayout *topLayout; | 1344 | QBoxLayout *topLayout; |
1372 | 1345 | ||
1373 | // = new QHBoxLayout( this ); | 1346 | // = new QHBoxLayout( this ); |
1374 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1347 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1375 | 1348 | ||
1376 | // QWidget *mainBox = new QWidget( this ); | 1349 | // QWidget *mainBox = new QWidget( this ); |
1377 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1350 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1378 | 1351 | ||
1379 | #ifdef DESKTOP_VERSION | 1352 | #ifdef DESKTOP_VERSION |
1380 | topLayout = new QHBoxLayout( this ); | 1353 | topLayout = new QHBoxLayout( this ); |
1381 | 1354 | ||
1382 | 1355 | ||
1383 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1356 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1384 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1357 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1385 | 1358 | ||
1386 | topLayout->addWidget(mMiniSplitter ); | 1359 | topLayout->addWidget(mMiniSplitter ); |
1387 | 1360 | ||
1388 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1361 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1389 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1362 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1390 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1363 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1391 | mDetails = new ViewContainer( mMiniSplitter ); | 1364 | mDetails = new ViewContainer( mMiniSplitter ); |
1392 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1365 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1393 | #else | 1366 | #else |
1394 | if ( QApplication::desktop()->width() > 480 ) { | 1367 | if ( QApplication::desktop()->width() > 480 ) { |
1395 | topLayout = new QHBoxLayout( this ); | 1368 | topLayout = new QHBoxLayout( this ); |
1396 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1369 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1397 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1370 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1398 | } else { | 1371 | } else { |
1399 | 1372 | ||
1400 | topLayout = new QHBoxLayout( this ); | 1373 | topLayout = new QHBoxLayout( this ); |
1401 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1374 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1402 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1375 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1403 | } | 1376 | } |
1404 | 1377 | ||
1405 | topLayout->addWidget(mMiniSplitter ); | 1378 | topLayout->addWidget(mMiniSplitter ); |
1406 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1379 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1407 | mDetails = new ViewContainer( mMiniSplitter ); | 1380 | mDetails = new ViewContainer( mMiniSplitter ); |
1408 | 1381 | ||
1409 | 1382 | ||
1410 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1383 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1411 | #endif | 1384 | #endif |
1412 | //eh->hide(); | 1385 | //eh->hide(); |
1413 | // topLayout->addWidget(mExtensionManager ); | 1386 | // topLayout->addWidget(mExtensionManager ); |
1414 | 1387 | ||
1415 | 1388 | ||
1416 | /*US | 1389 | /*US |
1417 | #ifndef KAB_NOSPLITTER | 1390 | #ifndef KAB_NOSPLITTER |
1418 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1391 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1419 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1392 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1420 | topLayout->setSpacing( 10 ); | 1393 | topLayout->setSpacing( 10 ); |
1421 | 1394 | ||
1422 | mDetailsSplitter = new QSplitter( this ); | 1395 | mDetailsSplitter = new QSplitter( this ); |
1423 | 1396 | ||
1424 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1397 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1425 | 1398 | ||
1426 | mViewManager = new ViewManager( this, viewSpace ); | 1399 | mViewManager = new ViewManager( this, viewSpace ); |
1427 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1400 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1428 | 1401 | ||
1429 | mDetails = new ViewContainer( mDetailsSplitter ); | 1402 | mDetails = new ViewContainer( mDetailsSplitter ); |
1430 | 1403 | ||
1431 | topLayout->addWidget( mDetailsSplitter ); | 1404 | topLayout->addWidget( mDetailsSplitter ); |
1432 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1405 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1433 | #else //KAB_NOSPLITTER | 1406 | #else //KAB_NOSPLITTER |
1434 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1407 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1435 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1408 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1436 | topLayout->setSpacing( 10 ); | 1409 | topLayout->setSpacing( 10 ); |
1437 | 1410 | ||
1438 | // mDetailsSplitter = new QSplitter( this ); | 1411 | // mDetailsSplitter = new QSplitter( this ); |
1439 | 1412 | ||
1440 | QVBox *viewSpace = new QVBox( this ); | 1413 | QVBox *viewSpace = new QVBox( this ); |
1441 | 1414 | ||
1442 | mViewManager = new ViewManager( this, viewSpace ); | 1415 | mViewManager = new ViewManager( this, viewSpace ); |
1443 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1416 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1444 | 1417 | ||
1445 | mDetails = new ViewContainer( this ); | 1418 | mDetails = new ViewContainer( this ); |
1446 | 1419 | ||
1447 | topLayout->addWidget( viewSpace ); | 1420 | topLayout->addWidget( viewSpace ); |
1448 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1421 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1449 | topLayout->addWidget( mDetails ); | 1422 | topLayout->addWidget( mDetails ); |
1450 | #endif //KAB_NOSPLITTER | 1423 | #endif //KAB_NOSPLITTER |
1451 | */ | 1424 | */ |
1452 | 1425 | ||
1453 | 1426 | ||
1454 | #endif //KAB_EMBEDDED | 1427 | #endif //KAB_EMBEDDED |
1455 | initActions(); | 1428 | initActions(); |
1456 | 1429 | ||
1457 | #ifdef KAB_EMBEDDED | 1430 | #ifdef KAB_EMBEDDED |
1458 | addActionsManually(); | 1431 | addActionsManually(); |
1459 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1432 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1460 | mXXPortManager = new XXPortManager( this, this ); | 1433 | mXXPortManager = new XXPortManager( this, this ); |
1461 | 1434 | ||
1462 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1435 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1463 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1436 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1464 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1437 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1465 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1438 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1466 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1439 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1467 | // mIncSearchWidget->hide(); | 1440 | // mIncSearchWidget->hide(); |
1468 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1441 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1469 | SLOT( incrementalSearch( const QString& ) ) ); | 1442 | SLOT( incrementalSearch( const QString& ) ) ); |
1470 | 1443 | ||
1471 | 1444 | ||
1472 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1445 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1473 | 1446 | ||
1474 | topLayout->addWidget( mJumpButtonBar ); | 1447 | topLayout->addWidget( mJumpButtonBar ); |
1475 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1448 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1476 | 1449 | ||
1477 | // mMainWindow->getIconToolBar()->raise(); | 1450 | // mMainWindow->getIconToolBar()->raise(); |
1478 | 1451 | ||
1479 | #endif //KAB_EMBEDDED | 1452 | #endif //KAB_EMBEDDED |
1480 | 1453 | ||
1481 | } | 1454 | } |
1482 | void KABCore::initActions() | 1455 | void KABCore::initActions() |
1483 | { | 1456 | { |
1484 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1457 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1485 | 1458 | ||
1486 | #ifndef KAB_EMBEDDED | 1459 | #ifndef KAB_EMBEDDED |
1487 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1460 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1488 | SLOT( clipboardDataChanged() ) ); | 1461 | SLOT( clipboardDataChanged() ) ); |
1489 | #endif //KAB_EMBEDDED | 1462 | #endif //KAB_EMBEDDED |
1490 | 1463 | ||
1491 | // file menu | 1464 | // file menu |
1492 | if ( mIsPart ) { | 1465 | if ( mIsPart ) { |
1493 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1466 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1494 | SLOT( sendMail() ), actionCollection(), | 1467 | SLOT( sendMail() ), actionCollection(), |
1495 | "kaddressbook_mail" ); | 1468 | "kaddressbook_mail" ); |
1496 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1469 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1497 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1470 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1498 | 1471 | ||
1499 | } else { | 1472 | } else { |
1500 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1473 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1501 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1474 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1502 | } | 1475 | } |
1503 | 1476 | ||
1504 | 1477 | ||
1505 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1478 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1506 | SLOT( save() ), actionCollection(), "file_sync" ); | 1479 | SLOT( save() ), actionCollection(), "file_sync" ); |
1507 | 1480 | ||
1508 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1481 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1509 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1482 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1510 | 1483 | ||
1511 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1484 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1512 | this, SLOT( mailVCard() ), | 1485 | this, SLOT( mailVCard() ), |
1513 | actionCollection(), "file_mail_vcard"); | 1486 | actionCollection(), "file_mail_vcard"); |
1514 | 1487 | ||
1515 | mActionBeamVCard = 0; | 1488 | mActionBeamVCard = 0; |
1516 | mActionBeam = 0; | 1489 | mActionBeam = 0; |
1517 | 1490 | ||
1518 | #ifndef DESKTOP_VERSION | 1491 | #ifndef DESKTOP_VERSION |
1519 | if ( Ir::supported() ) { | 1492 | if ( Ir::supported() ) { |
1520 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1493 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1521 | SLOT( beamVCard() ), actionCollection(), | 1494 | SLOT( beamVCard() ), actionCollection(), |
1522 | "kaddressbook_beam_vcard" ); | 1495 | "kaddressbook_beam_vcard" ); |
1523 | 1496 | ||
1524 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1497 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1525 | SLOT( beamMySelf() ), actionCollection(), | 1498 | SLOT( beamMySelf() ), actionCollection(), |
1526 | "kaddressbook_beam_myself" ); | 1499 | "kaddressbook_beam_myself" ); |
1527 | } | 1500 | } |
1528 | #endif | 1501 | #endif |
1529 | 1502 | ||
1530 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1503 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1531 | this, SLOT( editContact2() ), | 1504 | this, SLOT( editContact2() ), |
1532 | actionCollection(), "file_properties" ); | 1505 | actionCollection(), "file_properties" ); |
1533 | 1506 | ||
1534 | #ifdef KAB_EMBEDDED | 1507 | #ifdef KAB_EMBEDDED |
1535 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1508 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1536 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1509 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1537 | mMainWindow, SLOT( exit() ), | 1510 | mMainWindow, SLOT( exit() ), |
1538 | actionCollection(), "quit" ); | 1511 | actionCollection(), "quit" ); |
1539 | #endif //KAB_EMBEDDED | 1512 | #endif //KAB_EMBEDDED |
1540 | 1513 | ||
1541 | // edit menu | 1514 | // edit menu |
1542 | if ( mIsPart ) { | 1515 | if ( mIsPart ) { |
1543 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1516 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1544 | SLOT( copyContacts() ), actionCollection(), | 1517 | SLOT( copyContacts() ), actionCollection(), |
1545 | "kaddressbook_copy" ); | 1518 | "kaddressbook_copy" ); |
1546 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1519 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1547 | SLOT( cutContacts() ), actionCollection(), | 1520 | SLOT( cutContacts() ), actionCollection(), |
1548 | "kaddressbook_cut" ); | 1521 | "kaddressbook_cut" ); |
1549 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1522 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1550 | SLOT( pasteContacts() ), actionCollection(), | 1523 | SLOT( pasteContacts() ), actionCollection(), |
1551 | "kaddressbook_paste" ); | 1524 | "kaddressbook_paste" ); |
1552 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1525 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1553 | SLOT( selectAllContacts() ), actionCollection(), | 1526 | SLOT( selectAllContacts() ), actionCollection(), |
1554 | "kaddressbook_select_all" ); | 1527 | "kaddressbook_select_all" ); |
1555 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1528 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1556 | SLOT( undo() ), actionCollection(), | 1529 | SLOT( undo() ), actionCollection(), |
1557 | "kaddressbook_undo" ); | 1530 | "kaddressbook_undo" ); |
1558 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1531 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1559 | this, SLOT( redo() ), actionCollection(), | 1532 | this, SLOT( redo() ), actionCollection(), |
1560 | "kaddressbook_redo" ); | 1533 | "kaddressbook_redo" ); |
1561 | } else { | 1534 | } else { |
1562 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1535 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1563 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1536 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1564 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1537 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1565 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1538 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1566 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1539 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1567 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1540 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1568 | } | 1541 | } |
1569 | 1542 | ||
1570 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1543 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1571 | Key_Delete, this, SLOT( deleteContacts() ), | 1544 | Key_Delete, this, SLOT( deleteContacts() ), |
1572 | actionCollection(), "edit_delete" ); | 1545 | actionCollection(), "edit_delete" ); |
1573 | 1546 | ||
1574 | mActionUndo->setEnabled( false ); | 1547 | mActionUndo->setEnabled( false ); |
1575 | mActionRedo->setEnabled( false ); | 1548 | mActionRedo->setEnabled( false ); |
1576 | 1549 | ||
1577 | // settings menu | 1550 | // settings menu |
1578 | #ifdef KAB_EMBEDDED | 1551 | #ifdef KAB_EMBEDDED |
1579 | //US special menuentry to configure the addressbook resources. On KDE | 1552 | //US special menuentry to configure the addressbook resources. On KDE |
1580 | // you do that through the control center !!! | 1553 | // you do that through the control center !!! |
1581 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1554 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1582 | SLOT( configureResources() ), actionCollection(), | 1555 | SLOT( configureResources() ), actionCollection(), |
1583 | "kaddressbook_configure_resources" ); | 1556 | "kaddressbook_configure_resources" ); |
1584 | #endif //KAB_EMBEDDED | 1557 | #endif //KAB_EMBEDDED |
1585 | 1558 | ||
1586 | if ( mIsPart ) { | 1559 | if ( mIsPart ) { |
1587 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1560 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1588 | SLOT( openConfigDialog() ), actionCollection(), | 1561 | SLOT( openConfigDialog() ), actionCollection(), |
1589 | "kaddressbook_configure" ); | 1562 | "kaddressbook_configure" ); |
1590 | 1563 | ||
1591 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1564 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1592 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1565 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1593 | "kaddressbook_configure_shortcuts" ); | 1566 | "kaddressbook_configure_shortcuts" ); |
1594 | #ifdef KAB_EMBEDDED | 1567 | #ifdef KAB_EMBEDDED |
1595 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1568 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1596 | mActionConfigureToolbars->setEnabled( false ); | 1569 | mActionConfigureToolbars->setEnabled( false ); |
1597 | #endif //KAB_EMBEDDED | 1570 | #endif //KAB_EMBEDDED |
1598 | 1571 | ||
1599 | } else { | 1572 | } else { |
1600 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1573 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1601 | 1574 | ||
1602 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1575 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1603 | } | 1576 | } |
1604 | 1577 | ||
1605 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1578 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1606 | actionCollection(), "options_show_jump_bar" ); | 1579 | actionCollection(), "options_show_jump_bar" ); |
1607 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1580 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1608 | 1581 | ||
1609 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1582 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1610 | actionCollection(), "options_show_details" ); | 1583 | actionCollection(), "options_show_details" ); |
1611 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1584 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1612 | 1585 | ||
1613 | // misc | 1586 | // misc |
1614 | // only enable LDAP lookup if we can handle the protocol | 1587 | // only enable LDAP lookup if we can handle the protocol |
1615 | #ifndef KAB_EMBEDDED | 1588 | #ifndef KAB_EMBEDDED |
1616 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1589 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1617 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1590 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1618 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1591 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1619 | "ldap_lookup" ); | 1592 | "ldap_lookup" ); |
1620 | } | 1593 | } |
1621 | #else //KAB_EMBEDDED | 1594 | #else //KAB_EMBEDDED |
1622 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1595 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1623 | #endif //KAB_EMBEDDED | 1596 | #endif //KAB_EMBEDDED |
1624 | 1597 | ||
1625 | 1598 | ||
1626 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1599 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1627 | SLOT( setWhoAmI() ), actionCollection(), | 1600 | SLOT( setWhoAmI() ), actionCollection(), |
1628 | "set_personal" ); | 1601 | "set_personal" ); |
1629 | 1602 | ||
1630 | 1603 | ||
1631 | 1604 | ||
1632 | 1605 | ||
1633 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1606 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1634 | SLOT( setCategories() ), actionCollection(), | 1607 | SLOT( setCategories() ), actionCollection(), |
1635 | "edit_set_categories" ); | 1608 | "edit_set_categories" ); |
1636 | 1609 | ||
1637 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1610 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1638 | SLOT( removeVoice() ), actionCollection(), | 1611 | SLOT( removeVoice() ), actionCollection(), |
1639 | "remove_voice" ); | 1612 | "remove_voice" ); |
1640 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1613 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1641 | SLOT( importFromOL() ), actionCollection(), | 1614 | SLOT( importFromOL() ), actionCollection(), |
1642 | "import_OL" ); | 1615 | "import_OL" ); |
1643 | #ifdef KAB_EMBEDDED | 1616 | #ifdef KAB_EMBEDDED |
1644 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, | 1617 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, |
1645 | this, SLOT( showLicence() ), actionCollection(), | 1618 | this, SLOT( showLicence() ), actionCollection(), |
1646 | "licence_about_data" ); | 1619 | "licence_about_data" ); |
1647 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1620 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1648 | this, SLOT( createAboutData() ), actionCollection(), | 1621 | this, SLOT( createAboutData() ), actionCollection(), |
1649 | "kaddressbook_about_data" ); | 1622 | "kaddressbook_about_data" ); |
1650 | #endif //KAB_EMBEDDED | 1623 | #endif //KAB_EMBEDDED |
1651 | 1624 | ||
1652 | clipboardDataChanged(); | 1625 | clipboardDataChanged(); |
1653 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1626 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1654 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1627 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1655 | } | 1628 | } |
1656 | 1629 | ||
1657 | //US we need this function, to plug all actions into the correct menues. | 1630 | //US we need this function, to plug all actions into the correct menues. |
1658 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1631 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1659 | void KABCore::addActionsManually() | 1632 | void KABCore::addActionsManually() |
1660 | { | 1633 | { |
1661 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1634 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1662 | 1635 | ||
1663 | #ifdef KAB_EMBEDDED | 1636 | #ifdef KAB_EMBEDDED |
1664 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1637 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1665 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1638 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1666 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1639 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1667 | 1640 | ||
1668 | KToolBar* tb = mMainWindow->toolBar(); | 1641 | KToolBar* tb = mMainWindow->toolBar(); |
1669 | 1642 | ||
1670 | #ifdef DESKTOP_VERSION | 1643 | #ifdef DESKTOP_VERSION |
1671 | QMenuBar* mb = mMainWindow->menuBar(); | 1644 | QMenuBar* mb = mMainWindow->menuBar(); |
1672 | 1645 | ||
1673 | //US setup menubar. | 1646 | //US setup menubar. |
1674 | //Disable the following block if you do not want to have a menubar. | 1647 | //Disable the following block if you do not want to have a menubar. |
1675 | mb->insertItem( "&File", fileMenu ); | 1648 | mb->insertItem( "&File", fileMenu ); |
1676 | mb->insertItem( "&Edit", editMenu ); | 1649 | mb->insertItem( "&Edit", editMenu ); |
1677 | mb->insertItem( "&View", viewMenu ); | 1650 | mb->insertItem( "&View", viewMenu ); |
1678 | mb->insertItem( "&Settings", settingsMenu ); | 1651 | mb->insertItem( "&Settings", settingsMenu ); |
1679 | mb->insertItem( "&Change selected", changeMenu ); | 1652 | mb->insertItem( "&Change selected", changeMenu ); |
1680 | mb->insertItem( "&Help", helpMenu ); | 1653 | mb->insertItem( "&Help", helpMenu ); |
1681 | mIncSearchWidget = new IncSearchWidget( tb ); | 1654 | mIncSearchWidget = new IncSearchWidget( tb ); |
1682 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1655 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1683 | 1656 | ||
1684 | #else | 1657 | #else |
1685 | //US setup toolbar | 1658 | //US setup toolbar |
1686 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1659 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1687 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1660 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1688 | menuBarTB->insertItem( "ME", popupBarTB); | 1661 | menuBarTB->insertItem( "ME", popupBarTB); |
1689 | tb->insertWidget(-1, 0, menuBarTB); | 1662 | tb->insertWidget(-1, 0, menuBarTB); |
1690 | mIncSearchWidget = new IncSearchWidget( tb ); | 1663 | mIncSearchWidget = new IncSearchWidget( tb ); |
1691 | 1664 | ||
1692 | tb->enableMoving(false); | 1665 | tb->enableMoving(false); |
1693 | popupBarTB->insertItem( "&File", fileMenu ); | 1666 | popupBarTB->insertItem( "&File", fileMenu ); |
1694 | popupBarTB->insertItem( "&Edit", editMenu ); | 1667 | popupBarTB->insertItem( "&Edit", editMenu ); |
1695 | popupBarTB->insertItem( "&View", viewMenu ); | 1668 | popupBarTB->insertItem( "&View", viewMenu ); |
1696 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1669 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1697 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1670 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1698 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1671 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1699 | popupBarTB->insertItem( "&Help", helpMenu ); | 1672 | popupBarTB->insertItem( "&Help", helpMenu ); |
1700 | if (QApplication::desktop()->width() > 320 ) { | 1673 | if (QApplication::desktop()->width() > 320 ) { |
1701 | // mViewManager->getFilterAction()->plug ( tb); | 1674 | // mViewManager->getFilterAction()->plug ( tb); |
1702 | } | 1675 | } |
1703 | #endif | 1676 | #endif |
1704 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1677 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1705 | 1678 | ||
1706 | 1679 | ||
1707 | 1680 | ||
1708 | //US Now connect the actions with the menue entries. | 1681 | //US Now connect the actions with the menue entries. |
1709 | mActionPrint->plug( fileMenu ); | 1682 | mActionPrint->plug( fileMenu ); |
1710 | mActionMail->plug( fileMenu ); | 1683 | mActionMail->plug( fileMenu ); |
1711 | fileMenu->insertSeparator(); | 1684 | fileMenu->insertSeparator(); |
1712 | 1685 | ||
1713 | mActionNewContact->plug( fileMenu ); | 1686 | mActionNewContact->plug( fileMenu ); |
1714 | mActionNewContact->plug( tb ); | 1687 | mActionNewContact->plug( tb ); |
1715 | 1688 | ||
1716 | mActionEditAddressee->plug( fileMenu ); | 1689 | mActionEditAddressee->plug( fileMenu ); |
1717 | fileMenu->insertSeparator(); | 1690 | fileMenu->insertSeparator(); |
1718 | mActionSave->plug( fileMenu ); | 1691 | mActionSave->plug( fileMenu ); |
1719 | fileMenu->insertItem( "&Import", ImportMenu ); | 1692 | fileMenu->insertItem( "&Import", ImportMenu ); |
1720 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1693 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1721 | fileMenu->insertSeparator(); | 1694 | fileMenu->insertSeparator(); |
1722 | mActionMailVCard->plug( fileMenu ); | 1695 | mActionMailVCard->plug( fileMenu ); |
1723 | #ifndef DESKTOP_VERSION | 1696 | #ifndef DESKTOP_VERSION |
1724 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1697 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1725 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1698 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1726 | #endif | 1699 | #endif |
1727 | fileMenu->insertSeparator(); | 1700 | fileMenu->insertSeparator(); |
1728 | mActionQuit->plug( fileMenu ); | 1701 | mActionQuit->plug( fileMenu ); |
1729 | #ifdef _WIN32_ | 1702 | #ifdef _WIN32_ |
1730 | mActionImportOL->plug( ImportMenu ); | 1703 | mActionImportOL->plug( ImportMenu ); |
1731 | #endif | 1704 | #endif |
1732 | // edit menu | 1705 | // edit menu |
1733 | mActionUndo->plug( editMenu ); | 1706 | mActionUndo->plug( editMenu ); |
1734 | mActionRedo->plug( editMenu ); | 1707 | mActionRedo->plug( editMenu ); |
1735 | editMenu->insertSeparator(); | 1708 | editMenu->insertSeparator(); |
1736 | mActionCut->plug( editMenu ); | 1709 | mActionCut->plug( editMenu ); |
1737 | mActionCopy->plug( editMenu ); | 1710 | mActionCopy->plug( editMenu ); |
1738 | mActionPaste->plug( editMenu ); | 1711 | mActionPaste->plug( editMenu ); |
1739 | mActionDelete->plug( editMenu ); | 1712 | mActionDelete->plug( editMenu ); |
1740 | editMenu->insertSeparator(); | 1713 | editMenu->insertSeparator(); |
1741 | mActionSelectAll->plug( editMenu ); | 1714 | mActionSelectAll->plug( editMenu ); |
1742 | 1715 | ||
1743 | mActionRemoveVoice->plug( changeMenu ); | 1716 | mActionRemoveVoice->plug( changeMenu ); |
1744 | // settings menu | 1717 | // settings menu |
1745 | //US special menuentry to configure the addressbook resources. On KDE | 1718 | //US special menuentry to configure the addressbook resources. On KDE |
1746 | // you do that through the control center !!! | 1719 | // you do that through the control center !!! |
1747 | mActionConfigResources->plug( settingsMenu ); | 1720 | mActionConfigResources->plug( settingsMenu ); |
1748 | settingsMenu->insertSeparator(); | 1721 | settingsMenu->insertSeparator(); |
1749 | 1722 | ||
1750 | mActionConfigKAddressbook->plug( settingsMenu ); | 1723 | mActionConfigKAddressbook->plug( settingsMenu ); |
1751 | 1724 | ||
1752 | if ( mIsPart ) { | 1725 | if ( mIsPart ) { |
1753 | mActionConfigShortcuts->plug( settingsMenu ); | 1726 | mActionConfigShortcuts->plug( settingsMenu ); |
1754 | mActionConfigureToolbars->plug( settingsMenu ); | 1727 | mActionConfigureToolbars->plug( settingsMenu ); |
1755 | 1728 | ||
1756 | } else { | 1729 | } else { |
1757 | mActionKeyBindings->plug( settingsMenu ); | 1730 | mActionKeyBindings->plug( settingsMenu ); |
1758 | } | 1731 | } |
1759 | 1732 | ||
1760 | settingsMenu->insertSeparator(); | 1733 | settingsMenu->insertSeparator(); |
1761 | 1734 | ||
1762 | mActionJumpBar->plug( settingsMenu ); | 1735 | mActionJumpBar->plug( settingsMenu ); |
1763 | mActionDetails->plug( settingsMenu ); | 1736 | mActionDetails->plug( settingsMenu ); |
1764 | settingsMenu->insertSeparator(); | 1737 | settingsMenu->insertSeparator(); |
1765 | 1738 | ||
1766 | mActionWhoAmI->plug( settingsMenu ); | 1739 | mActionWhoAmI->plug( settingsMenu ); |
1767 | mActionCategories->plug( settingsMenu ); | 1740 | mActionCategories->plug( settingsMenu ); |
1768 | 1741 | ||
1769 | mActionAboutKAddressbook->plug( helpMenu ); | 1742 | mActionAboutKAddressbook->plug( helpMenu ); |
1770 | mActionLicence->plug( helpMenu ); | 1743 | mActionLicence->plug( helpMenu ); |
1771 | 1744 | ||
1772 | if (QApplication::desktop()->width() > 320 ) { | 1745 | if (QApplication::desktop()->width() > 320 ) { |
1773 | 1746 | ||
1774 | mActionEditAddressee->plug( tb ); | 1747 | mActionEditAddressee->plug( tb ); |
1775 | mActionSave->plug( tb ); | 1748 | mActionSave->plug( tb ); |
1776 | mViewManager->getFilterAction()->plug ( tb); | 1749 | mViewManager->getFilterAction()->plug ( tb); |
1777 | if (QApplication::desktop()->width() > 480 ) { | 1750 | if (QApplication::desktop()->width() > 480 ) { |
1778 | mActionUndo->plug( tb ); | 1751 | mActionUndo->plug( tb ); |
1779 | mActionDelete->plug( tb ); | 1752 | mActionDelete->plug( tb ); |
1780 | mActionRedo->plug( tb ); | 1753 | mActionRedo->plug( tb ); |
1781 | } | 1754 | } |
1782 | } | 1755 | } |
1783 | //mActionQuit->plug ( tb ); | 1756 | //mActionQuit->plug ( tb ); |
1784 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1757 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1785 | 1758 | ||
1786 | //US link the searchwidget first to this. | 1759 | //US link the searchwidget first to this. |
1787 | // The real linkage to the toolbar happens later. | 1760 | // The real linkage to the toolbar happens later. |
1788 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1761 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1789 | //US tb->insertItem( mIncSearchWidget ); | 1762 | //US tb->insertItem( mIncSearchWidget ); |
1790 | /*US | 1763 | /*US |
1791 | mIncSearchWidget = new IncSearchWidget( tb ); | 1764 | mIncSearchWidget = new IncSearchWidget( tb ); |
1792 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1765 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1793 | SLOT( incrementalSearch( const QString& ) ) ); | 1766 | SLOT( incrementalSearch( const QString& ) ) ); |
1794 | 1767 | ||
1795 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1768 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1796 | 1769 | ||
1797 | //US topLayout->addWidget( mJumpButtonBar ); | 1770 | //US topLayout->addWidget( mJumpButtonBar ); |
1798 | this->layout()->add( mJumpButtonBar ); | 1771 | this->layout()->add( mJumpButtonBar ); |
1799 | */ | 1772 | */ |
1800 | 1773 | ||
1801 | #endif //KAB_EMBEDDED | 1774 | #endif //KAB_EMBEDDED |
1802 | } | 1775 | } |
1803 | void KABCore::showLicence() | 1776 | void KABCore::showLicence() |
1804 | { | 1777 | { |
1805 | KApplication::showLicence(); | 1778 | KApplication::showLicence(); |
1806 | } | 1779 | } |
1807 | void KABCore::removeVoice() | 1780 | void KABCore::removeVoice() |
1808 | { | 1781 | { |
1809 | 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 ) | 1782 | 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 ) |
1810 | return; | 1783 | return; |
1811 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1784 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1812 | KABC::Addressee::List::Iterator it; | 1785 | KABC::Addressee::List::Iterator it; |
1813 | for ( it = list.begin(); it != list.end(); ++it ) { | 1786 | for ( it = list.begin(); it != list.end(); ++it ) { |
1814 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1787 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1815 | PhoneNumber::List::Iterator phoneIt; | 1788 | PhoneNumber::List::Iterator phoneIt; |
1816 | bool found = false; | 1789 | bool found = false; |
1817 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1790 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1818 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1791 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1819 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1792 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1820 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1793 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1821 | (*it).insertPhoneNumber( (*phoneIt) ); | 1794 | (*it).insertPhoneNumber( (*phoneIt) ); |
1822 | found = true; | 1795 | found = true; |
1823 | } | 1796 | } |
1824 | } | 1797 | } |
1825 | 1798 | ||
1826 | } | 1799 | } |
1827 | if ( found ) | 1800 | if ( found ) |
1828 | contactModified((*it) ); | 1801 | contactModified((*it) ); |
1829 | } | 1802 | } |
1830 | } | 1803 | } |
1831 | 1804 | ||
1832 | 1805 | ||
1833 | 1806 | ||
1834 | void KABCore::clipboardDataChanged() | 1807 | void KABCore::clipboardDataChanged() |
1835 | { | 1808 | { |
1836 | 1809 | ||
1837 | if ( mReadWrite ) | 1810 | if ( mReadWrite ) |
1838 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1811 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1839 | 1812 | ||
1840 | } | 1813 | } |
1841 | 1814 | ||
1842 | void KABCore::updateActionMenu() | 1815 | void KABCore::updateActionMenu() |
1843 | { | 1816 | { |
1844 | UndoStack *undo = UndoStack::instance(); | 1817 | UndoStack *undo = UndoStack::instance(); |
1845 | RedoStack *redo = RedoStack::instance(); | 1818 | RedoStack *redo = RedoStack::instance(); |
1846 | 1819 | ||
1847 | if ( undo->isEmpty() ) | 1820 | if ( undo->isEmpty() ) |
1848 | mActionUndo->setText( i18n( "Undo" ) ); | 1821 | mActionUndo->setText( i18n( "Undo" ) ); |
1849 | else | 1822 | else |
1850 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1823 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1851 | 1824 | ||
1852 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1825 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1853 | 1826 | ||
1854 | if ( !redo->top() ) | 1827 | if ( !redo->top() ) |
1855 | mActionRedo->setText( i18n( "Redo" ) ); | 1828 | mActionRedo->setText( i18n( "Redo" ) ); |
1856 | else | 1829 | else |
1857 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1830 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1858 | 1831 | ||
1859 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1832 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1860 | } | 1833 | } |
1861 | 1834 | ||
1862 | void KABCore::configureKeyBindings() | 1835 | void KABCore::configureKeyBindings() |
1863 | { | 1836 | { |
1864 | #ifndef KAB_EMBEDDED | 1837 | #ifndef KAB_EMBEDDED |
1865 | KKeyDialog::configure( actionCollection(), true ); | 1838 | KKeyDialog::configure( actionCollection(), true ); |
1866 | #else //KAB_EMBEDDED | 1839 | #else //KAB_EMBEDDED |
1867 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1840 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1868 | #endif //KAB_EMBEDDED | 1841 | #endif //KAB_EMBEDDED |
1869 | } | 1842 | } |
1870 | 1843 | ||
1871 | #ifdef KAB_EMBEDDED | 1844 | #ifdef KAB_EMBEDDED |
1872 | void KABCore::configureResources() | 1845 | void KABCore::configureResources() |
1873 | { | 1846 | { |
1874 | KRES::KCMKResources dlg( this, "" , 0 ); | 1847 | KRES::KCMKResources dlg( this, "" , 0 ); |
1875 | 1848 | ||
1876 | if ( !dlg.exec() ) | 1849 | if ( !dlg.exec() ) |
1877 | return; | 1850 | return; |
1878 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 1851 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
1879 | } | 1852 | } |
1880 | #endif //KAB_EMBEDDED | 1853 | #endif //KAB_EMBEDDED |
1881 | 1854 | ||
1882 | 1855 | ||
1883 | 1856 | ||
1884 | #ifndef KAB_EMBEDDED | 1857 | #ifndef KAB_EMBEDDED |
1885 | #include "kabcore.moc" | 1858 | #include "kabcore.moc" |
1886 | #endif //KAB_EMBEDDED | 1859 | #endif //KAB_EMBEDDED |
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 |