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