author | zautrix <zautrix> | 2004-09-10 09:53:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-10 09:53:08 (UTC) |
commit | 14056eb4ec076bc243dcb9f600999eb437fb8afd (patch) (unidiff) | |
tree | e2040c584f7763826a5e6c474de7162514348bc3 /kaddressbook | |
parent | 10eb314475b75a162582e8138d465890dbd21806 (diff) | |
download | kdepimpi-14056eb4ec076bc243dcb9f600999eb437fb8afd.zip kdepimpi-14056eb4ec076bc243dcb9f600999eb437fb8afd.tar.gz kdepimpi-14056eb4ec076bc243dcb9f600999eb437fb8afd.tar.bz2 |
Fixed menubar problem
-rw-r--r-- | kaddressbook/kabcore.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2a2f904..bbf8e1b 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,290 +1,292 @@ | |||
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | 35 | ||
36 | #ifndef KAB_EMBEDDED | 36 | #ifndef KAB_EMBEDDED |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qapplicaton.h> | 40 | #include <qapplicaton.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qvbox.h> | 43 | #include <qvbox.h> |
44 | #include <kabc/addresseelist.h> | 44 | #include <kabc/addresseelist.h> |
45 | #include <kabc/errorhandler.h> | 45 | #include <kabc/errorhandler.h> |
46 | #include <kabc/resource.h> | 46 | #include <kabc/resource.h> |
47 | #include <kabc/vcardconverter.h> | 47 | #include <kabc/vcardconverter.h> |
48 | #include <kapplication.h> | 48 | #include <kapplication.h> |
49 | #include <kactionclasses.h> | 49 | #include <kactionclasses.h> |
50 | #include <kcmultidialog.h> | 50 | #include <kcmultidialog.h> |
51 | #include <kdebug.h> | 51 | #include <kdebug.h> |
52 | #include <kdeversion.h> | 52 | #include <kdeversion.h> |
53 | #include <kkeydialog.h> | 53 | #include <kkeydialog.h> |
54 | #include <kmessagebox.h> | 54 | #include <kmessagebox.h> |
55 | #include <kprinter.h> | 55 | #include <kprinter.h> |
56 | #include <kprotocolinfo.h> | 56 | #include <kprotocolinfo.h> |
57 | #include <kresources/selectdialog.h> | 57 | #include <kresources/selectdialog.h> |
58 | #include <kstandarddirs.h> | 58 | #include <kstandarddirs.h> |
59 | #include <ktempfile.h> | 59 | #include <ktempfile.h> |
60 | #include <kxmlguiclient.h> | 60 | #include <kxmlguiclient.h> |
61 | #include <kaboutdata.h> | 61 | #include <kaboutdata.h> |
62 | #include <libkdepim/categoryselectdialog.h> | 62 | #include <libkdepim/categoryselectdialog.h> |
63 | 63 | ||
64 | #include "addresseeutil.h" | 64 | #include "addresseeutil.h" |
65 | #include "addresseeeditordialog.h" | 65 | #include "addresseeeditordialog.h" |
66 | #include "extensionmanager.h" | 66 | #include "extensionmanager.h" |
67 | #include "kstdaction.h" | 67 | #include "kstdaction.h" |
68 | #include "kaddressbookservice.h" | 68 | #include "kaddressbookservice.h" |
69 | #include "ldapsearchdialog.h" | 69 | #include "ldapsearchdialog.h" |
70 | #include "printing/printingwizard.h" | 70 | #include "printing/printingwizard.h" |
71 | #else // KAB_EMBEDDED | 71 | #else // KAB_EMBEDDED |
72 | 72 | ||
73 | #include <kapplication.h> | 73 | #include <kapplication.h> |
74 | #include "KDGanttMinimizeSplitter.h" | 74 | #include "KDGanttMinimizeSplitter.h" |
75 | #include "kaddressbookmain.h" | 75 | #include "kaddressbookmain.h" |
76 | #include "kactioncollection.h" | 76 | #include "kactioncollection.h" |
77 | #include "addresseedialog.h" | 77 | #include "addresseedialog.h" |
78 | //US | 78 | //US |
79 | #include <libkdepim/addresseeview.h> | 79 | #include <libkdepim/addresseeview.h> |
80 | 80 | ||
81 | #include <qapp.h> | 81 | #include <qapp.h> |
82 | #include <qmenubar.h> | 82 | #include <qmenubar.h> |
83 | //#include <qtoolbar.h> | 83 | //#include <qtoolbar.h> |
84 | #include <qmessagebox.h> | 84 | #include <qmessagebox.h> |
85 | #include <kdebug.h> | 85 | #include <kdebug.h> |
86 | #include <kiconloader.h> // needed for SmallIcon | 86 | #include <kiconloader.h> // needed for SmallIcon |
87 | #include <kresources/kcmkresources.h> | 87 | #include <kresources/kcmkresources.h> |
88 | #include <ktoolbar.h> | 88 | #include <ktoolbar.h> |
89 | 89 | ||
90 | 90 | ||
91 | //#include <qlabel.h> | 91 | //#include <qlabel.h> |
92 | 92 | ||
93 | 93 | ||
94 | #ifndef DESKTOP_VERSION | 94 | #ifndef DESKTOP_VERSION |
95 | #include <qpe/ir.h> | 95 | #include <qpe/ir.h> |
96 | #include <qpe/qpemenubar.h> | ||
96 | #include <qtopia/qcopenvelope_qws.h> | 97 | #include <qtopia/qcopenvelope_qws.h> |
97 | #else | 98 | #else |
98 | 99 | ||
100 | #include <qmenubar.h> | ||
99 | #endif | 101 | #endif |
100 | 102 | ||
101 | #endif // KAB_EMBEDDED | 103 | #endif // KAB_EMBEDDED |
102 | #include "kcmconfigs/kcmkabconfig.h" | 104 | #include "kcmconfigs/kcmkabconfig.h" |
103 | #include "kcmconfigs/kcmkdepimconfig.h" | 105 | #include "kcmconfigs/kcmkdepimconfig.h" |
104 | #include "kpimglobalprefs.h" | 106 | #include "kpimglobalprefs.h" |
105 | #include "externalapphandler.h" | 107 | #include "externalapphandler.h" |
106 | 108 | ||
107 | 109 | ||
108 | #include <kresources/selectdialog.h> | 110 | #include <kresources/selectdialog.h> |
109 | #include <kmessagebox.h> | 111 | #include <kmessagebox.h> |
110 | 112 | ||
111 | #include <picture.h> | 113 | #include <picture.h> |
112 | #include <resource.h> | 114 | #include <resource.h> |
113 | 115 | ||
114 | //US#include <qsplitter.h> | 116 | //US#include <qsplitter.h> |
115 | #include <qmap.h> | 117 | #include <qmap.h> |
116 | #include <qdir.h> | 118 | #include <qdir.h> |
117 | #include <qfile.h> | 119 | #include <qfile.h> |
118 | #include <qvbox.h> | 120 | #include <qvbox.h> |
119 | #include <qlayout.h> | 121 | #include <qlayout.h> |
120 | #include <qclipboard.h> | 122 | #include <qclipboard.h> |
121 | #include <qtextstream.h> | 123 | #include <qtextstream.h> |
122 | 124 | ||
123 | #include <libkdepim/categoryselectdialog.h> | 125 | #include <libkdepim/categoryselectdialog.h> |
124 | #include <kabc/vcardconverter.h> | 126 | #include <kabc/vcardconverter.h> |
125 | 127 | ||
126 | 128 | ||
127 | #include "addresseeutil.h" | 129 | #include "addresseeutil.h" |
128 | #include "undocmds.h" | 130 | #include "undocmds.h" |
129 | #include "addresseeeditordialog.h" | 131 | #include "addresseeeditordialog.h" |
130 | #include "viewmanager.h" | 132 | #include "viewmanager.h" |
131 | #include "details/detailsviewcontainer.h" | 133 | #include "details/detailsviewcontainer.h" |
132 | #include "kabprefs.h" | 134 | #include "kabprefs.h" |
133 | #include "xxportmanager.h" | 135 | #include "xxportmanager.h" |
134 | #include "incsearchwidget.h" | 136 | #include "incsearchwidget.h" |
135 | #include "jumpbuttonbar.h" | 137 | #include "jumpbuttonbar.h" |
136 | #include "extensionmanager.h" | 138 | #include "extensionmanager.h" |
137 | #include "addresseeconfig.h" | 139 | #include "addresseeconfig.h" |
138 | #include <kcmultidialog.h> | 140 | #include <kcmultidialog.h> |
139 | 141 | ||
140 | #ifdef _WIN32_ | 142 | #ifdef _WIN32_ |
141 | 143 | ||
142 | #include "kaimportoldialog.h" | 144 | #include "kaimportoldialog.h" |
143 | #endif | 145 | #endif |
144 | 146 | ||
145 | bool pasteWithNewUid = true; | 147 | bool pasteWithNewUid = true; |
146 | 148 | ||
147 | #ifdef KAB_EMBEDDED | 149 | #ifdef KAB_EMBEDDED |
148 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 150 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
149 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 151 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
150 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 152 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
151 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 153 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
152 | #else //KAB_EMBEDDED | 154 | #else //KAB_EMBEDDED |
153 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 155 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
154 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 156 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
155 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 157 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
156 | mReadWrite( readWrite ), mModified( false ) | 158 | mReadWrite( readWrite ), mModified( false ) |
157 | #endif //KAB_EMBEDDED | 159 | #endif //KAB_EMBEDDED |
158 | { | 160 | { |
159 | 161 | ||
160 | mExtensionBarSplitter = 0; | 162 | mExtensionBarSplitter = 0; |
161 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 163 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
162 | 164 | ||
163 | mAddressBook = KABC::StdAddressBook::self(); | 165 | mAddressBook = KABC::StdAddressBook::self(); |
164 | KABC::StdAddressBook::setAutomaticSave( false ); | 166 | KABC::StdAddressBook::setAutomaticSave( false ); |
165 | 167 | ||
166 | #ifndef KAB_EMBEDDED | 168 | #ifndef KAB_EMBEDDED |
167 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 169 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
168 | #endif //KAB_EMBEDDED | 170 | #endif //KAB_EMBEDDED |
169 | 171 | ||
170 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 172 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
171 | SLOT( addressBookChanged() ) ); | 173 | SLOT( addressBookChanged() ) ); |
172 | 174 | ||
173 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 175 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
174 | "X-Department", "KADDRESSBOOK" ); | 176 | "X-Department", "KADDRESSBOOK" ); |
175 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 177 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
176 | "X-Profession", "KADDRESSBOOK" ); | 178 | "X-Profession", "KADDRESSBOOK" ); |
177 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 179 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
178 | "X-AssistantsName", "KADDRESSBOOK" ); | 180 | "X-AssistantsName", "KADDRESSBOOK" ); |
179 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 181 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
180 | "X-ManagersName", "KADDRESSBOOK" ); | 182 | "X-ManagersName", "KADDRESSBOOK" ); |
181 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 183 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
182 | "X-SpousesName", "KADDRESSBOOK" ); | 184 | "X-SpousesName", "KADDRESSBOOK" ); |
183 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 185 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
184 | "X-Office", "KADDRESSBOOK" ); | 186 | "X-Office", "KADDRESSBOOK" ); |
185 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 187 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
186 | "X-IMAddress", "KADDRESSBOOK" ); | 188 | "X-IMAddress", "KADDRESSBOOK" ); |
187 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 189 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
188 | "X-Anniversary", "KADDRESSBOOK" ); | 190 | "X-Anniversary", "KADDRESSBOOK" ); |
189 | 191 | ||
190 | //US added this field to become compatible with Opie/qtopia addressbook | 192 | //US added this field to become compatible with Opie/qtopia addressbook |
191 | // values can be "female" or "male" or "". An empty field represents undefined. | 193 | // values can be "female" or "male" or "". An empty field represents undefined. |
192 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 194 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
193 | "X-Gender", "KADDRESSBOOK" ); | 195 | "X-Gender", "KADDRESSBOOK" ); |
194 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 196 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
195 | "X-Children", "KADDRESSBOOK" ); | 197 | "X-Children", "KADDRESSBOOK" ); |
196 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 198 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
197 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 199 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
198 | 200 | ||
199 | initGUI(); | 201 | initGUI(); |
200 | 202 | ||
201 | mIncSearchWidget->setFocus(); | 203 | mIncSearchWidget->setFocus(); |
202 | 204 | ||
203 | 205 | ||
204 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 206 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
205 | SLOT( setContactSelected( const QString& ) ) ); | 207 | SLOT( setContactSelected( const QString& ) ) ); |
206 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 208 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
207 | SLOT( executeContact( const QString& ) ) ); | 209 | SLOT( executeContact( const QString& ) ) ); |
208 | 210 | ||
209 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 211 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
210 | SLOT( deleteContacts( ) ) ); | 212 | SLOT( deleteContacts( ) ) ); |
211 | connect( mViewManager, SIGNAL( modified() ), | 213 | connect( mViewManager, SIGNAL( modified() ), |
212 | SLOT( setModified() ) ); | 214 | SLOT( setModified() ) ); |
213 | 215 | ||
214 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 216 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
215 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 217 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
216 | 218 | ||
217 | connect( mXXPortManager, SIGNAL( modified() ), | 219 | connect( mXXPortManager, SIGNAL( modified() ), |
218 | SLOT( setModified() ) ); | 220 | SLOT( setModified() ) ); |
219 | 221 | ||
220 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 222 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
221 | SLOT( incrementalSearch( const QString& ) ) ); | 223 | SLOT( incrementalSearch( const QString& ) ) ); |
222 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 224 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
223 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 225 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
224 | 226 | ||
225 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 227 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
226 | SLOT( sendMail( const QString& ) ) ); | 228 | SLOT( sendMail( const QString& ) ) ); |
227 | 229 | ||
228 | 230 | ||
229 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 231 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
230 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 232 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
231 | 233 | ||
232 | 234 | ||
233 | #ifndef KAB_EMBEDDED | 235 | #ifndef KAB_EMBEDDED |
234 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 236 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
235 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 237 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
236 | 238 | ||
237 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 239 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
238 | SLOT( browse( const QString& ) ) ); | 240 | SLOT( browse( const QString& ) ) ); |
239 | 241 | ||
240 | 242 | ||
241 | mAddressBookService = new KAddressBookService( this ); | 243 | mAddressBookService = new KAddressBookService( this ); |
242 | 244 | ||
243 | #endif //KAB_EMBEDDED | 245 | #endif //KAB_EMBEDDED |
244 | mEditorDialog = 0; | 246 | mEditorDialog = 0; |
245 | createAddresseeEditorDialog( this ); | 247 | createAddresseeEditorDialog( this ); |
246 | setModified( false ); | 248 | setModified( false ); |
247 | } | 249 | } |
248 | 250 | ||
249 | KABCore::~KABCore() | 251 | KABCore::~KABCore() |
250 | { | 252 | { |
251 | // save(); | 253 | // save(); |
252 | //saveSettings(); | 254 | //saveSettings(); |
253 | //KABPrefs::instance()->writeConfig(); | 255 | //KABPrefs::instance()->writeConfig(); |
254 | delete AddresseeConfig::instance(); | 256 | delete AddresseeConfig::instance(); |
255 | mAddressBook = 0; | 257 | mAddressBook = 0; |
256 | KABC::StdAddressBook::close(); | 258 | KABC::StdAddressBook::close(); |
257 | } | 259 | } |
258 | 260 | ||
259 | void KABCore::restoreSettings() | 261 | void KABCore::restoreSettings() |
260 | { | 262 | { |
261 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 263 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
262 | 264 | ||
263 | bool state; | 265 | bool state; |
264 | 266 | ||
265 | if (mMultipleViewsAtOnce) | 267 | if (mMultipleViewsAtOnce) |
266 | state = KABPrefs::instance()->mDetailsPageVisible; | 268 | state = KABPrefs::instance()->mDetailsPageVisible; |
267 | else | 269 | else |
268 | state = false; | 270 | state = false; |
269 | 271 | ||
270 | mActionDetails->setChecked( state ); | 272 | mActionDetails->setChecked( state ); |
271 | setDetailsVisible( state ); | 273 | setDetailsVisible( state ); |
272 | 274 | ||
273 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 275 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
274 | 276 | ||
275 | mActionJumpBar->setChecked( state ); | 277 | mActionJumpBar->setChecked( state ); |
276 | setJumpButtonBarVisible( state ); | 278 | setJumpButtonBarVisible( state ); |
277 | /*US | 279 | /*US |
278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 280 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
279 | if ( splitterSize.count() == 0 ) { | 281 | if ( splitterSize.count() == 0 ) { |
280 | splitterSize.append( width() / 2 ); | 282 | splitterSize.append( width() / 2 ); |
281 | splitterSize.append( width() / 2 ); | 283 | splitterSize.append( width() / 2 ); |
282 | } | 284 | } |
283 | mMiniSplitter->setSizes( splitterSize ); | 285 | mMiniSplitter->setSizes( splitterSize ); |
284 | if ( mExtensionBarSplitter ) { | 286 | if ( mExtensionBarSplitter ) { |
285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 287 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
286 | if ( splitterSize.count() == 0 ) { | 288 | if ( splitterSize.count() == 0 ) { |
287 | splitterSize.append( width() / 2 ); | 289 | splitterSize.append( width() / 2 ); |
288 | splitterSize.append( width() / 2 ); | 290 | splitterSize.append( width() / 2 ); |
289 | } | 291 | } |
290 | mExtensionBarSplitter->setSizes( splitterSize ); | 292 | mExtensionBarSplitter->setSizes( splitterSize ); |
@@ -1570,385 +1572,385 @@ void KABCore::initActions() | |||
1570 | 1572 | ||
1571 | } else { | 1573 | } else { |
1572 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1574 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1573 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1575 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1574 | } | 1576 | } |
1575 | 1577 | ||
1576 | 1578 | ||
1577 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1579 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1578 | SLOT( save() ), actionCollection(), "file_sync" ); | 1580 | SLOT( save() ), actionCollection(), "file_sync" ); |
1579 | 1581 | ||
1580 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1582 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1581 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1583 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1582 | 1584 | ||
1583 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1585 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1584 | this, SLOT( mailVCard() ), | 1586 | this, SLOT( mailVCard() ), |
1585 | actionCollection(), "file_mail_vcard"); | 1587 | actionCollection(), "file_mail_vcard"); |
1586 | 1588 | ||
1587 | mActionBeamVCard = 0; | 1589 | mActionBeamVCard = 0; |
1588 | mActionBeam = 0; | 1590 | mActionBeam = 0; |
1589 | 1591 | ||
1590 | #ifndef DESKTOP_VERSION | 1592 | #ifndef DESKTOP_VERSION |
1591 | if ( Ir::supported() ) { | 1593 | if ( Ir::supported() ) { |
1592 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1594 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1593 | SLOT( beamVCard() ), actionCollection(), | 1595 | SLOT( beamVCard() ), actionCollection(), |
1594 | "kaddressbook_beam_vcard" ); | 1596 | "kaddressbook_beam_vcard" ); |
1595 | 1597 | ||
1596 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1598 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1597 | SLOT( beamMySelf() ), actionCollection(), | 1599 | SLOT( beamMySelf() ), actionCollection(), |
1598 | "kaddressbook_beam_myself" ); | 1600 | "kaddressbook_beam_myself" ); |
1599 | } | 1601 | } |
1600 | #endif | 1602 | #endif |
1601 | 1603 | ||
1602 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1604 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1603 | this, SLOT( editContact2() ), | 1605 | this, SLOT( editContact2() ), |
1604 | actionCollection(), "file_properties" ); | 1606 | actionCollection(), "file_properties" ); |
1605 | 1607 | ||
1606 | #ifdef KAB_EMBEDDED | 1608 | #ifdef KAB_EMBEDDED |
1607 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1609 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1608 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1610 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1609 | mMainWindow, SLOT( exit() ), | 1611 | mMainWindow, SLOT( exit() ), |
1610 | actionCollection(), "quit" ); | 1612 | actionCollection(), "quit" ); |
1611 | #endif //KAB_EMBEDDED | 1613 | #endif //KAB_EMBEDDED |
1612 | 1614 | ||
1613 | // edit menu | 1615 | // edit menu |
1614 | if ( mIsPart ) { | 1616 | if ( mIsPart ) { |
1615 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1617 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1616 | SLOT( copyContacts() ), actionCollection(), | 1618 | SLOT( copyContacts() ), actionCollection(), |
1617 | "kaddressbook_copy" ); | 1619 | "kaddressbook_copy" ); |
1618 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1620 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1619 | SLOT( cutContacts() ), actionCollection(), | 1621 | SLOT( cutContacts() ), actionCollection(), |
1620 | "kaddressbook_cut" ); | 1622 | "kaddressbook_cut" ); |
1621 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1623 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1622 | SLOT( pasteContacts() ), actionCollection(), | 1624 | SLOT( pasteContacts() ), actionCollection(), |
1623 | "kaddressbook_paste" ); | 1625 | "kaddressbook_paste" ); |
1624 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1626 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1625 | SLOT( selectAllContacts() ), actionCollection(), | 1627 | SLOT( selectAllContacts() ), actionCollection(), |
1626 | "kaddressbook_select_all" ); | 1628 | "kaddressbook_select_all" ); |
1627 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1629 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1628 | SLOT( undo() ), actionCollection(), | 1630 | SLOT( undo() ), actionCollection(), |
1629 | "kaddressbook_undo" ); | 1631 | "kaddressbook_undo" ); |
1630 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1632 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1631 | this, SLOT( redo() ), actionCollection(), | 1633 | this, SLOT( redo() ), actionCollection(), |
1632 | "kaddressbook_redo" ); | 1634 | "kaddressbook_redo" ); |
1633 | } else { | 1635 | } else { |
1634 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1636 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1635 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1637 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1636 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1638 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1637 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1639 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1638 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1640 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1639 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1641 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1640 | } | 1642 | } |
1641 | 1643 | ||
1642 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1644 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1643 | Key_Delete, this, SLOT( deleteContacts() ), | 1645 | Key_Delete, this, SLOT( deleteContacts() ), |
1644 | actionCollection(), "edit_delete" ); | 1646 | actionCollection(), "edit_delete" ); |
1645 | 1647 | ||
1646 | mActionUndo->setEnabled( false ); | 1648 | mActionUndo->setEnabled( false ); |
1647 | mActionRedo->setEnabled( false ); | 1649 | mActionRedo->setEnabled( false ); |
1648 | 1650 | ||
1649 | // settings menu | 1651 | // settings menu |
1650 | #ifdef KAB_EMBEDDED | 1652 | #ifdef KAB_EMBEDDED |
1651 | //US special menuentry to configure the addressbook resources. On KDE | 1653 | //US special menuentry to configure the addressbook resources. On KDE |
1652 | // you do that through the control center !!! | 1654 | // you do that through the control center !!! |
1653 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1655 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1654 | SLOT( configureResources() ), actionCollection(), | 1656 | SLOT( configureResources() ), actionCollection(), |
1655 | "kaddressbook_configure_resources" ); | 1657 | "kaddressbook_configure_resources" ); |
1656 | #endif //KAB_EMBEDDED | 1658 | #endif //KAB_EMBEDDED |
1657 | 1659 | ||
1658 | if ( mIsPart ) { | 1660 | if ( mIsPart ) { |
1659 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1661 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1660 | SLOT( openConfigDialog() ), actionCollection(), | 1662 | SLOT( openConfigDialog() ), actionCollection(), |
1661 | "kaddressbook_configure" ); | 1663 | "kaddressbook_configure" ); |
1662 | 1664 | ||
1663 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1665 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1664 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1666 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1665 | "kaddressbook_configure_shortcuts" ); | 1667 | "kaddressbook_configure_shortcuts" ); |
1666 | #ifdef KAB_EMBEDDED | 1668 | #ifdef KAB_EMBEDDED |
1667 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1669 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1668 | mActionConfigureToolbars->setEnabled( false ); | 1670 | mActionConfigureToolbars->setEnabled( false ); |
1669 | #endif //KAB_EMBEDDED | 1671 | #endif //KAB_EMBEDDED |
1670 | 1672 | ||
1671 | } else { | 1673 | } else { |
1672 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1674 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1673 | 1675 | ||
1674 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1676 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1679 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1678 | actionCollection(), "options_show_jump_bar" ); | 1680 | actionCollection(), "options_show_jump_bar" ); |
1679 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1681 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1680 | 1682 | ||
1681 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1683 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1682 | actionCollection(), "options_show_details" ); | 1684 | actionCollection(), "options_show_details" ); |
1683 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1685 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1684 | 1686 | ||
1685 | // misc | 1687 | // misc |
1686 | // only enable LDAP lookup if we can handle the protocol | 1688 | // only enable LDAP lookup if we can handle the protocol |
1687 | #ifndef KAB_EMBEDDED | 1689 | #ifndef KAB_EMBEDDED |
1688 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1690 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1689 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1691 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1690 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1692 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1691 | "ldap_lookup" ); | 1693 | "ldap_lookup" ); |
1692 | } | 1694 | } |
1693 | #else //KAB_EMBEDDED | 1695 | #else //KAB_EMBEDDED |
1694 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1696 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1695 | #endif //KAB_EMBEDDED | 1697 | #endif //KAB_EMBEDDED |
1696 | 1698 | ||
1697 | 1699 | ||
1698 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1700 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1699 | SLOT( setWhoAmI() ), actionCollection(), | 1701 | SLOT( setWhoAmI() ), actionCollection(), |
1700 | "set_personal" ); | 1702 | "set_personal" ); |
1701 | 1703 | ||
1702 | 1704 | ||
1703 | 1705 | ||
1704 | 1706 | ||
1705 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1707 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1706 | SLOT( setCategories() ), actionCollection(), | 1708 | SLOT( setCategories() ), actionCollection(), |
1707 | "edit_set_categories" ); | 1709 | "edit_set_categories" ); |
1708 | 1710 | ||
1709 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1711 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1710 | SLOT( removeVoice() ), actionCollection(), | 1712 | SLOT( removeVoice() ), actionCollection(), |
1711 | "remove_voice" ); | 1713 | "remove_voice" ); |
1712 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1714 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1713 | SLOT( importFromOL() ), actionCollection(), | 1715 | SLOT( importFromOL() ), actionCollection(), |
1714 | "import_OL" ); | 1716 | "import_OL" ); |
1715 | #ifdef KAB_EMBEDDED | 1717 | #ifdef KAB_EMBEDDED |
1716 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1718 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1717 | this, SLOT( showLicence() ), actionCollection(), | 1719 | this, SLOT( showLicence() ), actionCollection(), |
1718 | "licence_about_data" ); | 1720 | "licence_about_data" ); |
1719 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1721 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1720 | this, SLOT( faq() ), actionCollection(), | 1722 | this, SLOT( faq() ), actionCollection(), |
1721 | "faq_about_data" ); | 1723 | "faq_about_data" ); |
1722 | 1724 | ||
1723 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1725 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1724 | this, SLOT( createAboutData() ), actionCollection(), | 1726 | this, SLOT( createAboutData() ), actionCollection(), |
1725 | "kaddressbook_about_data" ); | 1727 | "kaddressbook_about_data" ); |
1726 | #endif //KAB_EMBEDDED | 1728 | #endif //KAB_EMBEDDED |
1727 | 1729 | ||
1728 | clipboardDataChanged(); | 1730 | clipboardDataChanged(); |
1729 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1731 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1730 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1732 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1731 | } | 1733 | } |
1732 | 1734 | ||
1733 | //US we need this function, to plug all actions into the correct menues. | 1735 | //US we need this function, to plug all actions into the correct menues. |
1734 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1736 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1735 | void KABCore::addActionsManually() | 1737 | void KABCore::addActionsManually() |
1736 | { | 1738 | { |
1737 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1739 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1738 | 1740 | ||
1739 | #ifdef KAB_EMBEDDED | 1741 | #ifdef KAB_EMBEDDED |
1740 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1742 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1741 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1743 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1742 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1744 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1743 | 1745 | ||
1744 | KToolBar* tb = mMainWindow->toolBar(); | 1746 | KToolBar* tb = mMainWindow->toolBar(); |
1745 | 1747 | ||
1746 | #ifdef DESKTOP_VERSION | 1748 | #ifdef DESKTOP_VERSION |
1747 | QMenuBar* mb = mMainWindow->menuBar(); | 1749 | QMenuBar* mb = mMainWindow->menuBar(); |
1748 | 1750 | ||
1749 | //US setup menubar. | 1751 | //US setup menubar. |
1750 | //Disable the following block if you do not want to have a menubar. | 1752 | //Disable the following block if you do not want to have a menubar. |
1751 | mb->insertItem( "&File", fileMenu ); | 1753 | mb->insertItem( "&File", fileMenu ); |
1752 | mb->insertItem( "&Edit", editMenu ); | 1754 | mb->insertItem( "&Edit", editMenu ); |
1753 | mb->insertItem( "&View", viewMenu ); | 1755 | mb->insertItem( "&View", viewMenu ); |
1754 | mb->insertItem( "&Settings", settingsMenu ); | 1756 | mb->insertItem( "&Settings", settingsMenu ); |
1755 | mb->insertItem( "&Change selected", changeMenu ); | 1757 | mb->insertItem( "&Change selected", changeMenu ); |
1756 | mb->insertItem( "&Help", helpMenu ); | 1758 | mb->insertItem( "&Help", helpMenu ); |
1757 | mIncSearchWidget = new IncSearchWidget( tb ); | 1759 | mIncSearchWidget = new IncSearchWidget( tb ); |
1758 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1760 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1759 | 1761 | ||
1760 | #else | 1762 | #else |
1761 | //US setup toolbar | 1763 | //US setup toolbar |
1762 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1764 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1763 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1765 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1764 | menuBarTB->insertItem( "ME", popupBarTB); | 1766 | menuBarTB->insertItem( "ME", popupBarTB); |
1765 | tb->insertWidget(-1, 0, menuBarTB); | 1767 | tb->insertWidget(-1, 0, menuBarTB); |
1766 | mIncSearchWidget = new IncSearchWidget( tb ); | 1768 | mIncSearchWidget = new IncSearchWidget( tb ); |
1767 | 1769 | ||
1768 | tb->enableMoving(false); | 1770 | tb->enableMoving(false); |
1769 | popupBarTB->insertItem( "&File", fileMenu ); | 1771 | popupBarTB->insertItem( "&File", fileMenu ); |
1770 | popupBarTB->insertItem( "&Edit", editMenu ); | 1772 | popupBarTB->insertItem( "&Edit", editMenu ); |
1771 | popupBarTB->insertItem( "&View", viewMenu ); | 1773 | popupBarTB->insertItem( "&View", viewMenu ); |
1772 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1774 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1773 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1775 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1774 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1776 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1775 | popupBarTB->insertItem( "&Help", helpMenu ); | 1777 | popupBarTB->insertItem( "&Help", helpMenu ); |
1776 | if (QApplication::desktop()->width() > 320 ) { | 1778 | if (QApplication::desktop()->width() > 320 ) { |
1777 | // mViewManager->getFilterAction()->plug ( tb); | 1779 | // mViewManager->getFilterAction()->plug ( tb); |
1778 | } | 1780 | } |
1779 | #endif | 1781 | #endif |
1780 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1782 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1781 | 1783 | ||
1782 | 1784 | ||
1783 | 1785 | ||
1784 | //US Now connect the actions with the menue entries. | 1786 | //US Now connect the actions with the menue entries. |
1785 | mActionPrint->plug( fileMenu ); | 1787 | mActionPrint->plug( fileMenu ); |
1786 | mActionMail->plug( fileMenu ); | 1788 | mActionMail->plug( fileMenu ); |
1787 | fileMenu->insertSeparator(); | 1789 | fileMenu->insertSeparator(); |
1788 | 1790 | ||
1789 | mActionNewContact->plug( fileMenu ); | 1791 | mActionNewContact->plug( fileMenu ); |
1790 | mActionNewContact->plug( tb ); | 1792 | mActionNewContact->plug( tb ); |
1791 | 1793 | ||
1792 | mActionEditAddressee->plug( fileMenu ); | 1794 | mActionEditAddressee->plug( fileMenu ); |
1793 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1795 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1794 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1796 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1795 | mActionEditAddressee->plug( tb ); | 1797 | mActionEditAddressee->plug( tb ); |
1796 | 1798 | ||
1797 | fileMenu->insertSeparator(); | 1799 | fileMenu->insertSeparator(); |
1798 | mActionSave->plug( fileMenu ); | 1800 | mActionSave->plug( fileMenu ); |
1799 | fileMenu->insertItem( "&Import", ImportMenu ); | 1801 | fileMenu->insertItem( "&Import", ImportMenu ); |
1800 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1802 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1801 | fileMenu->insertSeparator(); | 1803 | fileMenu->insertSeparator(); |
1802 | mActionMailVCard->plug( fileMenu ); | 1804 | mActionMailVCard->plug( fileMenu ); |
1803 | #ifndef DESKTOP_VERSION | 1805 | #ifndef DESKTOP_VERSION |
1804 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1806 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1805 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1807 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1806 | #endif | 1808 | #endif |
1807 | fileMenu->insertSeparator(); | 1809 | fileMenu->insertSeparator(); |
1808 | mActionQuit->plug( fileMenu ); | 1810 | mActionQuit->plug( fileMenu ); |
1809 | #ifdef _WIN32_ | 1811 | #ifdef _WIN32_ |
1810 | mActionImportOL->plug( ImportMenu ); | 1812 | mActionImportOL->plug( ImportMenu ); |
1811 | #endif | 1813 | #endif |
1812 | // edit menu | 1814 | // edit menu |
1813 | mActionUndo->plug( editMenu ); | 1815 | mActionUndo->plug( editMenu ); |
1814 | mActionRedo->plug( editMenu ); | 1816 | mActionRedo->plug( editMenu ); |
1815 | editMenu->insertSeparator(); | 1817 | editMenu->insertSeparator(); |
1816 | mActionCut->plug( editMenu ); | 1818 | mActionCut->plug( editMenu ); |
1817 | mActionCopy->plug( editMenu ); | 1819 | mActionCopy->plug( editMenu ); |
1818 | mActionPaste->plug( editMenu ); | 1820 | mActionPaste->plug( editMenu ); |
1819 | mActionDelete->plug( editMenu ); | 1821 | mActionDelete->plug( editMenu ); |
1820 | editMenu->insertSeparator(); | 1822 | editMenu->insertSeparator(); |
1821 | mActionSelectAll->plug( editMenu ); | 1823 | mActionSelectAll->plug( editMenu ); |
1822 | 1824 | ||
1823 | mActionRemoveVoice->plug( changeMenu ); | 1825 | mActionRemoveVoice->plug( changeMenu ); |
1824 | // settings menu | 1826 | // settings menu |
1825 | //US special menuentry to configure the addressbook resources. On KDE | 1827 | //US special menuentry to configure the addressbook resources. On KDE |
1826 | // you do that through the control center !!! | 1828 | // you do that through the control center !!! |
1827 | mActionConfigResources->plug( settingsMenu ); | 1829 | mActionConfigResources->plug( settingsMenu ); |
1828 | settingsMenu->insertSeparator(); | 1830 | settingsMenu->insertSeparator(); |
1829 | 1831 | ||
1830 | mActionConfigKAddressbook->plug( settingsMenu ); | 1832 | mActionConfigKAddressbook->plug( settingsMenu ); |
1831 | 1833 | ||
1832 | if ( mIsPart ) { | 1834 | if ( mIsPart ) { |
1833 | mActionConfigShortcuts->plug( settingsMenu ); | 1835 | mActionConfigShortcuts->plug( settingsMenu ); |
1834 | mActionConfigureToolbars->plug( settingsMenu ); | 1836 | mActionConfigureToolbars->plug( settingsMenu ); |
1835 | 1837 | ||
1836 | } else { | 1838 | } else { |
1837 | mActionKeyBindings->plug( settingsMenu ); | 1839 | mActionKeyBindings->plug( settingsMenu ); |
1838 | } | 1840 | } |
1839 | 1841 | ||
1840 | settingsMenu->insertSeparator(); | 1842 | settingsMenu->insertSeparator(); |
1841 | 1843 | ||
1842 | mActionJumpBar->plug( settingsMenu ); | 1844 | mActionJumpBar->plug( settingsMenu ); |
1843 | mActionDetails->plug( settingsMenu ); | 1845 | mActionDetails->plug( settingsMenu ); |
1844 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1846 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1845 | mActionDetails->plug( tb ); | 1847 | mActionDetails->plug( tb ); |
1846 | settingsMenu->insertSeparator(); | 1848 | settingsMenu->insertSeparator(); |
1847 | 1849 | ||
1848 | mActionWhoAmI->plug( settingsMenu ); | 1850 | mActionWhoAmI->plug( settingsMenu ); |
1849 | mActionCategories->plug( settingsMenu ); | 1851 | mActionCategories->plug( settingsMenu ); |
1850 | 1852 | ||
1851 | mActionLicence->plug( helpMenu ); | 1853 | mActionLicence->plug( helpMenu ); |
1852 | mActionFaq->plug( helpMenu ); | 1854 | mActionFaq->plug( helpMenu ); |
1853 | mActionAboutKAddressbook->plug( helpMenu ); | 1855 | mActionAboutKAddressbook->plug( helpMenu ); |
1854 | 1856 | ||
1855 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1857 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1856 | 1858 | ||
1857 | mActionSave->plug( tb ); | 1859 | mActionSave->plug( tb ); |
1858 | mViewManager->getFilterAction()->plug ( tb); | 1860 | mViewManager->getFilterAction()->plug ( tb); |
1859 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1861 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1860 | mActionUndo->plug( tb ); | 1862 | mActionUndo->plug( tb ); |
1861 | mActionDelete->plug( tb ); | 1863 | mActionDelete->plug( tb ); |
1862 | mActionRedo->plug( tb ); | 1864 | mActionRedo->plug( tb ); |
1863 | } | 1865 | } |
1864 | } | 1866 | } |
1865 | //mActionQuit->plug ( tb ); | 1867 | //mActionQuit->plug ( tb ); |
1866 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1868 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1867 | 1869 | ||
1868 | //US link the searchwidget first to this. | 1870 | //US link the searchwidget first to this. |
1869 | // The real linkage to the toolbar happens later. | 1871 | // The real linkage to the toolbar happens later. |
1870 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1872 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1871 | //US tb->insertItem( mIncSearchWidget ); | 1873 | //US tb->insertItem( mIncSearchWidget ); |
1872 | /*US | 1874 | /*US |
1873 | mIncSearchWidget = new IncSearchWidget( tb ); | 1875 | mIncSearchWidget = new IncSearchWidget( tb ); |
1874 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1876 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1875 | SLOT( incrementalSearch( const QString& ) ) ); | 1877 | SLOT( incrementalSearch( const QString& ) ) ); |
1876 | 1878 | ||
1877 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1879 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1878 | 1880 | ||
1879 | //US topLayout->addWidget( mJumpButtonBar ); | 1881 | //US topLayout->addWidget( mJumpButtonBar ); |
1880 | this->layout()->add( mJumpButtonBar ); | 1882 | this->layout()->add( mJumpButtonBar ); |
1881 | */ | 1883 | */ |
1882 | 1884 | ||
1883 | #endif //KAB_EMBEDDED | 1885 | #endif //KAB_EMBEDDED |
1884 | } | 1886 | } |
1885 | void KABCore::showLicence() | 1887 | void KABCore::showLicence() |
1886 | { | 1888 | { |
1887 | KApplication::showLicence(); | 1889 | KApplication::showLicence(); |
1888 | } | 1890 | } |
1889 | void KABCore::removeVoice() | 1891 | void KABCore::removeVoice() |
1890 | { | 1892 | { |
1891 | 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 ) | 1893 | 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 ) |
1892 | return; | 1894 | return; |
1893 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1895 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1894 | KABC::Addressee::List::Iterator it; | 1896 | KABC::Addressee::List::Iterator it; |
1895 | for ( it = list.begin(); it != list.end(); ++it ) { | 1897 | for ( it = list.begin(); it != list.end(); ++it ) { |
1896 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1898 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1897 | PhoneNumber::List::Iterator phoneIt; | 1899 | PhoneNumber::List::Iterator phoneIt; |
1898 | bool found = false; | 1900 | bool found = false; |
1899 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1901 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1900 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1902 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1901 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1903 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1902 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1904 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1903 | (*it).insertPhoneNumber( (*phoneIt) ); | 1905 | (*it).insertPhoneNumber( (*phoneIt) ); |
1904 | found = true; | 1906 | found = true; |
1905 | } | 1907 | } |
1906 | } | 1908 | } |
1907 | 1909 | ||
1908 | } | 1910 | } |
1909 | if ( found ) | 1911 | if ( found ) |
1910 | contactModified((*it) ); | 1912 | contactModified((*it) ); |
1911 | } | 1913 | } |
1912 | } | 1914 | } |
1913 | 1915 | ||
1914 | 1916 | ||
1915 | 1917 | ||
1916 | void KABCore::clipboardDataChanged() | 1918 | void KABCore::clipboardDataChanged() |
1917 | { | 1919 | { |
1918 | 1920 | ||
1919 | if ( mReadWrite ) | 1921 | if ( mReadWrite ) |
1920 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1922 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1921 | 1923 | ||
1922 | } | 1924 | } |
1923 | 1925 | ||
1924 | void KABCore::updateActionMenu() | 1926 | void KABCore::updateActionMenu() |
1925 | { | 1927 | { |
1926 | UndoStack *undo = UndoStack::instance(); | 1928 | UndoStack *undo = UndoStack::instance(); |
1927 | RedoStack *redo = RedoStack::instance(); | 1929 | RedoStack *redo = RedoStack::instance(); |
1928 | 1930 | ||
1929 | if ( undo->isEmpty() ) | 1931 | if ( undo->isEmpty() ) |
1930 | mActionUndo->setText( i18n( "Undo" ) ); | 1932 | mActionUndo->setText( i18n( "Undo" ) ); |
1931 | else | 1933 | else |
1932 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1934 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1933 | 1935 | ||
1934 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1936 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1935 | 1937 | ||
1936 | if ( !redo->top() ) | 1938 | if ( !redo->top() ) |
1937 | mActionRedo->setText( i18n( "Redo" ) ); | 1939 | mActionRedo->setText( i18n( "Redo" ) ); |
1938 | else | 1940 | else |
1939 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1941 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1940 | 1942 | ||
1941 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1943 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1942 | } | 1944 | } |
1943 | 1945 | ||
1944 | void KABCore::configureKeyBindings() | 1946 | void KABCore::configureKeyBindings() |
1945 | { | 1947 | { |
1946 | #ifndef KAB_EMBEDDED | 1948 | #ifndef KAB_EMBEDDED |
1947 | KKeyDialog::configure( actionCollection(), true ); | 1949 | KKeyDialog::configure( actionCollection(), true ); |
1948 | #else //KAB_EMBEDDED | 1950 | #else //KAB_EMBEDDED |
1949 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1951 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1950 | #endif //KAB_EMBEDDED | 1952 | #endif //KAB_EMBEDDED |
1951 | } | 1953 | } |
1952 | 1954 | ||
1953 | #ifdef KAB_EMBEDDED | 1955 | #ifdef KAB_EMBEDDED |
1954 | void KABCore::configureResources() | 1956 | void KABCore::configureResources() |