author | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
commit | ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb (patch) (unidiff) | |
tree | a9f62469297dda2981807b5235e7812cac72f44c /kaddressbook | |
parent | 0e46d151bca931ff5c69a637d91cfcc381094e0b (diff) | |
download | kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.zip kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.tar.gz kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.tar.bz2 |
QCop implementation for KOrganizer to access Ka/pi directly
-rw-r--r-- | kaddressbook/kabcore.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 3 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 19 |
3 files changed, 46 insertions, 9 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6807bed..e7c815e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,476 +1,483 @@ | |||
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 "addresseedialog.h" | ||
71 | |||
70 | #include <qapp.h> | 72 | #include <qapp.h> |
71 | #include <qmenubar.h> | 73 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 74 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 75 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 76 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 77 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 78 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 79 | #include <ktoolbar.h> |
78 | 80 | ||
79 | 81 | ||
80 | //#include <qlabel.h> | 82 | //#include <qlabel.h> |
81 | 83 | ||
82 | 84 | ||
83 | #ifndef DESKTOP_VERSION | 85 | #ifndef DESKTOP_VERSION |
84 | #include <qpe/ir.h> | 86 | #include <qpe/ir.h> |
85 | #endif | 87 | #endif |
86 | 88 | ||
87 | #endif // KAB_EMBEDDED | 89 | #endif // KAB_EMBEDDED |
88 | #include "kcmconfigs/kcmkabconfig.h" | 90 | #include "kcmconfigs/kcmkabconfig.h" |
89 | #include "kcmconfigs/kcmkdepimconfig.h" | 91 | #include "kcmconfigs/kcmkdepimconfig.h" |
90 | #include "kpimglobalprefs.h" | 92 | #include "kpimglobalprefs.h" |
91 | #include "externalapphandler.h" | 93 | #include "externalapphandler.h" |
92 | 94 | ||
93 | 95 | ||
94 | #include <kresources/selectdialog.h> | 96 | #include <kresources/selectdialog.h> |
95 | #include <kmessagebox.h> | 97 | #include <kmessagebox.h> |
96 | 98 | ||
97 | #include <picture.h> | 99 | #include <picture.h> |
98 | #include <resource.h> | 100 | #include <resource.h> |
99 | 101 | ||
100 | //US#include <qsplitter.h> | 102 | //US#include <qsplitter.h> |
101 | #include <qmap.h> | 103 | #include <qmap.h> |
102 | #include <qdir.h> | 104 | #include <qdir.h> |
103 | #include <qfile.h> | 105 | #include <qfile.h> |
104 | #include <qvbox.h> | 106 | #include <qvbox.h> |
105 | #include <qlayout.h> | 107 | #include <qlayout.h> |
106 | #include <qclipboard.h> | 108 | #include <qclipboard.h> |
107 | #include <qtextstream.h> | 109 | #include <qtextstream.h> |
108 | 110 | ||
109 | #include <libkdepim/categoryselectdialog.h> | 111 | #include <libkdepim/categoryselectdialog.h> |
110 | #include <kabc/vcardconverter.h> | 112 | #include <kabc/vcardconverter.h> |
111 | 113 | ||
112 | 114 | ||
113 | #include "addresseeutil.h" | 115 | #include "addresseeutil.h" |
114 | #include "undocmds.h" | 116 | #include "undocmds.h" |
115 | #include "addresseeeditordialog.h" | 117 | #include "addresseeeditordialog.h" |
116 | #include "viewmanager.h" | 118 | #include "viewmanager.h" |
117 | #include "details/detailsviewcontainer.h" | 119 | #include "details/detailsviewcontainer.h" |
118 | #include "kabprefs.h" | 120 | #include "kabprefs.h" |
119 | #include "xxportmanager.h" | 121 | #include "xxportmanager.h" |
120 | #include "incsearchwidget.h" | 122 | #include "incsearchwidget.h" |
121 | #include "jumpbuttonbar.h" | 123 | #include "jumpbuttonbar.h" |
122 | #include "extensionmanager.h" | 124 | #include "extensionmanager.h" |
123 | #include "addresseeconfig.h" | 125 | #include "addresseeconfig.h" |
124 | #include <kcmultidialog.h> | 126 | #include <kcmultidialog.h> |
125 | 127 | ||
126 | #ifdef _WIN32_ | 128 | #ifdef _WIN32_ |
127 | 129 | ||
128 | #include "kaimportoldialog.h" | 130 | #include "kaimportoldialog.h" |
129 | #endif | 131 | #endif |
130 | 132 | ||
131 | bool pasteWithNewUid = true; | 133 | bool pasteWithNewUid = true; |
132 | 134 | ||
133 | #ifdef KAB_EMBEDDED | 135 | #ifdef KAB_EMBEDDED |
134 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 136 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
135 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 137 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
136 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 138 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
137 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 139 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
138 | #else //KAB_EMBEDDED | 140 | #else //KAB_EMBEDDED |
139 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 141 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
140 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 142 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
141 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 143 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
142 | mReadWrite( readWrite ), mModified( false ) | 144 | mReadWrite( readWrite ), mModified( false ) |
143 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
144 | { | 146 | { |
145 | 147 | ||
146 | mExtensionBarSplitter = 0; | 148 | mExtensionBarSplitter = 0; |
147 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 149 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
148 | 150 | ||
149 | mAddressBook = KABC::StdAddressBook::self(); | 151 | mAddressBook = KABC::StdAddressBook::self(); |
150 | KABC::StdAddressBook::setAutomaticSave( false ); | 152 | KABC::StdAddressBook::setAutomaticSave( false ); |
151 | 153 | ||
152 | #ifndef KAB_EMBEDDED | 154 | #ifndef KAB_EMBEDDED |
153 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 155 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
154 | #endif //KAB_EMBEDDED | 156 | #endif //KAB_EMBEDDED |
155 | 157 | ||
156 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 158 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
157 | SLOT( addressBookChanged() ) ); | 159 | SLOT( addressBookChanged() ) ); |
158 | 160 | ||
159 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 161 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
160 | "X-Department", "KADDRESSBOOK" ); | 162 | "X-Department", "KADDRESSBOOK" ); |
161 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 163 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
162 | "X-Profession", "KADDRESSBOOK" ); | 164 | "X-Profession", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 165 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
164 | "X-AssistantsName", "KADDRESSBOOK" ); | 166 | "X-AssistantsName", "KADDRESSBOOK" ); |
165 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 167 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
166 | "X-ManagersName", "KADDRESSBOOK" ); | 168 | "X-ManagersName", "KADDRESSBOOK" ); |
167 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 169 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
168 | "X-SpousesName", "KADDRESSBOOK" ); | 170 | "X-SpousesName", "KADDRESSBOOK" ); |
169 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 171 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
170 | "X-Office", "KADDRESSBOOK" ); | 172 | "X-Office", "KADDRESSBOOK" ); |
171 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 173 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
172 | "X-IMAddress", "KADDRESSBOOK" ); | 174 | "X-IMAddress", "KADDRESSBOOK" ); |
173 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 175 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
174 | "X-Anniversary", "KADDRESSBOOK" ); | 176 | "X-Anniversary", "KADDRESSBOOK" ); |
175 | 177 | ||
176 | //US added this field to become compatible with Opie/qtopia addressbook | 178 | //US added this field to become compatible with Opie/qtopia addressbook |
177 | // values can be "female" or "male" or "". An empty field represents undefined. | 179 | // values can be "female" or "male" or "". An empty field represents undefined. |
178 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 180 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
179 | "X-Gender", "KADDRESSBOOK" ); | 181 | "X-Gender", "KADDRESSBOOK" ); |
180 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 182 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
181 | "X-Children", "KADDRESSBOOK" ); | 183 | "X-Children", "KADDRESSBOOK" ); |
182 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 184 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
183 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 185 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
184 | 186 | ||
185 | initGUI(); | 187 | initGUI(); |
186 | 188 | ||
187 | mIncSearchWidget->setFocus(); | 189 | mIncSearchWidget->setFocus(); |
188 | 190 | ||
189 | 191 | ||
190 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 192 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
191 | SLOT( setContactSelected( const QString& ) ) ); | 193 | SLOT( setContactSelected( const QString& ) ) ); |
192 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 194 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
193 | SLOT( executeContact( const QString& ) ) ); | 195 | SLOT( executeContact( const QString& ) ) ); |
194 | 196 | ||
195 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 197 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
196 | SLOT( deleteContacts( ) ) ); | 198 | SLOT( deleteContacts( ) ) ); |
197 | connect( mViewManager, SIGNAL( modified() ), | 199 | connect( mViewManager, SIGNAL( modified() ), |
198 | SLOT( setModified() ) ); | 200 | SLOT( setModified() ) ); |
199 | 201 | ||
200 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 202 | 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 ) ) ); | 203 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
202 | 204 | ||
203 | connect( mXXPortManager, SIGNAL( modified() ), | 205 | connect( mXXPortManager, SIGNAL( modified() ), |
204 | SLOT( setModified() ) ); | 206 | SLOT( setModified() ) ); |
205 | 207 | ||
206 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 208 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
207 | SLOT( incrementalSearch( const QString& ) ) ); | 209 | SLOT( incrementalSearch( const QString& ) ) ); |
208 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 210 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
209 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 211 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
210 | 212 | ||
211 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 213 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
212 | SLOT( sendMail( const QString& ) ) ); | 214 | SLOT( sendMail( const QString& ) ) ); |
213 | 215 | ||
216 | |||
217 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&, const QString&))); | ||
218 | |||
219 | |||
214 | #ifndef KAB_EMBEDDED | 220 | #ifndef KAB_EMBEDDED |
215 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 221 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
216 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 222 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
217 | 223 | ||
218 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 224 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
219 | SLOT( browse( const QString& ) ) ); | 225 | SLOT( browse( const QString& ) ) ); |
220 | 226 | ||
227 | |||
221 | mAddressBookService = new KAddressBookService( this ); | 228 | mAddressBookService = new KAddressBookService( this ); |
222 | 229 | ||
223 | #endif //KAB_EMBEDDED | 230 | #endif //KAB_EMBEDDED |
224 | mEditorDialog = 0; | 231 | mEditorDialog = 0; |
225 | createAddresseeEditorDialog( this ); | 232 | createAddresseeEditorDialog( this ); |
226 | setModified( false ); | 233 | setModified( false ); |
227 | } | 234 | } |
228 | 235 | ||
229 | KABCore::~KABCore() | 236 | KABCore::~KABCore() |
230 | { | 237 | { |
231 | // save(); | 238 | // save(); |
232 | //saveSettings(); | 239 | //saveSettings(); |
233 | //KABPrefs::instance()->writeConfig(); | 240 | //KABPrefs::instance()->writeConfig(); |
234 | delete AddresseeConfig::instance(); | 241 | delete AddresseeConfig::instance(); |
235 | mAddressBook = 0; | 242 | mAddressBook = 0; |
236 | KABC::StdAddressBook::close(); | 243 | KABC::StdAddressBook::close(); |
237 | } | 244 | } |
238 | 245 | ||
239 | void KABCore::restoreSettings() | 246 | void KABCore::restoreSettings() |
240 | { | 247 | { |
241 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 248 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
242 | 249 | ||
243 | bool state; | 250 | bool state; |
244 | 251 | ||
245 | if (mMultipleViewsAtOnce) | 252 | if (mMultipleViewsAtOnce) |
246 | state = KABPrefs::instance()->mDetailsPageVisible; | 253 | state = KABPrefs::instance()->mDetailsPageVisible; |
247 | else | 254 | else |
248 | state = false; | 255 | state = false; |
249 | 256 | ||
250 | mActionDetails->setChecked( state ); | 257 | mActionDetails->setChecked( state ); |
251 | setDetailsVisible( state ); | 258 | setDetailsVisible( state ); |
252 | 259 | ||
253 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 260 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
254 | 261 | ||
255 | mActionJumpBar->setChecked( state ); | 262 | mActionJumpBar->setChecked( state ); |
256 | setJumpButtonBarVisible( state ); | 263 | setJumpButtonBarVisible( state ); |
257 | /*US | 264 | /*US |
258 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 265 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
259 | if ( splitterSize.count() == 0 ) { | 266 | if ( splitterSize.count() == 0 ) { |
260 | splitterSize.append( width() / 2 ); | 267 | splitterSize.append( width() / 2 ); |
261 | splitterSize.append( width() / 2 ); | 268 | splitterSize.append( width() / 2 ); |
262 | } | 269 | } |
263 | mMiniSplitter->setSizes( splitterSize ); | 270 | mMiniSplitter->setSizes( splitterSize ); |
264 | if ( mExtensionBarSplitter ) { | 271 | if ( mExtensionBarSplitter ) { |
265 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 272 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
266 | if ( splitterSize.count() == 0 ) { | 273 | if ( splitterSize.count() == 0 ) { |
267 | splitterSize.append( width() / 2 ); | 274 | splitterSize.append( width() / 2 ); |
268 | splitterSize.append( width() / 2 ); | 275 | splitterSize.append( width() / 2 ); |
269 | } | 276 | } |
270 | mExtensionBarSplitter->setSizes( splitterSize ); | 277 | mExtensionBarSplitter->setSizes( splitterSize ); |
271 | 278 | ||
272 | } | 279 | } |
273 | */ | 280 | */ |
274 | mViewManager->restoreSettings(); | 281 | mViewManager->restoreSettings(); |
275 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 282 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
276 | mExtensionManager->restoreSettings(); | 283 | mExtensionManager->restoreSettings(); |
277 | 284 | ||
278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 285 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
279 | if ( splitterSize.count() == 0 ) { | 286 | if ( splitterSize.count() == 0 ) { |
280 | splitterSize.append( width() / 2 ); | 287 | splitterSize.append( width() / 2 ); |
281 | splitterSize.append( width() / 2 ); | 288 | splitterSize.append( width() / 2 ); |
282 | } | 289 | } |
283 | mMiniSplitter->setSizes( splitterSize ); | 290 | mMiniSplitter->setSizes( splitterSize ); |
284 | if ( mExtensionBarSplitter ) { | 291 | if ( mExtensionBarSplitter ) { |
285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 292 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
286 | if ( splitterSize.count() == 0 ) { | 293 | if ( splitterSize.count() == 0 ) { |
287 | splitterSize.append( width() / 2 ); | 294 | splitterSize.append( width() / 2 ); |
288 | splitterSize.append( width() / 2 ); | 295 | splitterSize.append( width() / 2 ); |
289 | } | 296 | } |
290 | mExtensionBarSplitter->setSizes( splitterSize ); | 297 | mExtensionBarSplitter->setSizes( splitterSize ); |
291 | 298 | ||
292 | } | 299 | } |
293 | 300 | ||
294 | 301 | ||
295 | } | 302 | } |
296 | 303 | ||
297 | void KABCore::saveSettings() | 304 | void KABCore::saveSettings() |
298 | { | 305 | { |
299 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 306 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
300 | if ( mExtensionBarSplitter ) | 307 | if ( mExtensionBarSplitter ) |
301 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 308 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
302 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 309 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
303 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 310 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
304 | #ifndef KAB_EMBEDDED | 311 | #ifndef KAB_EMBEDDED |
305 | 312 | ||
306 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 313 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
307 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 314 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
308 | #endif //KAB_EMBEDDED | 315 | #endif //KAB_EMBEDDED |
309 | mExtensionManager->saveSettings(); | 316 | mExtensionManager->saveSettings(); |
310 | mViewManager->saveSettings(); | 317 | mViewManager->saveSettings(); |
311 | 318 | ||
312 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 319 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
313 | } | 320 | } |
314 | 321 | ||
315 | KABC::AddressBook *KABCore::addressBook() const | 322 | KABC::AddressBook *KABCore::addressBook() const |
316 | { | 323 | { |
317 | return mAddressBook; | 324 | return mAddressBook; |
318 | } | 325 | } |
319 | 326 | ||
320 | KConfig *KABCore::config() | 327 | KConfig *KABCore::config() |
321 | { | 328 | { |
322 | #ifndef KAB_EMBEDDED | 329 | #ifndef KAB_EMBEDDED |
323 | return KABPrefs::instance()->config(); | 330 | return KABPrefs::instance()->config(); |
324 | #else //KAB_EMBEDDED | 331 | #else //KAB_EMBEDDED |
325 | return KABPrefs::instance()->getConfig(); | 332 | return KABPrefs::instance()->getConfig(); |
326 | #endif //KAB_EMBEDDED | 333 | #endif //KAB_EMBEDDED |
327 | } | 334 | } |
328 | 335 | ||
329 | KActionCollection *KABCore::actionCollection() const | 336 | KActionCollection *KABCore::actionCollection() const |
330 | { | 337 | { |
331 | return mGUIClient->actionCollection(); | 338 | return mGUIClient->actionCollection(); |
332 | } | 339 | } |
333 | 340 | ||
334 | KABC::Field *KABCore::currentSearchField() const | 341 | KABC::Field *KABCore::currentSearchField() const |
335 | { | 342 | { |
336 | if (mIncSearchWidget) | 343 | if (mIncSearchWidget) |
337 | return mIncSearchWidget->currentField(); | 344 | return mIncSearchWidget->currentField(); |
338 | else | 345 | else |
339 | return 0; | 346 | return 0; |
340 | } | 347 | } |
341 | 348 | ||
342 | QStringList KABCore::selectedUIDs() const | 349 | QStringList KABCore::selectedUIDs() const |
343 | { | 350 | { |
344 | return mViewManager->selectedUids(); | 351 | return mViewManager->selectedUids(); |
345 | } | 352 | } |
346 | 353 | ||
347 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 354 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
348 | { | 355 | { |
349 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 356 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
350 | 357 | ||
351 | QPtrList<KRES::Resource> kresResources; | 358 | QPtrList<KRES::Resource> kresResources; |
352 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 359 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
353 | KABC::Resource *resource; | 360 | KABC::Resource *resource; |
354 | while ( ( resource = resIt.current() ) != 0 ) { | 361 | while ( ( resource = resIt.current() ) != 0 ) { |
355 | ++resIt; | 362 | ++resIt; |
356 | if ( !resource->readOnly() ) { | 363 | if ( !resource->readOnly() ) { |
357 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 364 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
358 | if ( res ) | 365 | if ( res ) |
359 | kresResources.append( res ); | 366 | kresResources.append( res ); |
360 | } | 367 | } |
361 | } | 368 | } |
362 | 369 | ||
363 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 370 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
364 | return static_cast<KABC::Resource*>( res ); | 371 | return static_cast<KABC::Resource*>( res ); |
365 | } | 372 | } |
366 | 373 | ||
367 | #ifndef KAB_EMBEDDED | 374 | #ifndef KAB_EMBEDDED |
368 | KAboutData *KABCore::createAboutData() | 375 | KAboutData *KABCore::createAboutData() |
369 | #else //KAB_EMBEDDED | 376 | #else //KAB_EMBEDDED |
370 | void KABCore::createAboutData() | 377 | void KABCore::createAboutData() |
371 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
372 | { | 379 | { |
373 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
374 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 381 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
375 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 382 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
376 | KAboutData::License_GPL_V2, | 383 | KAboutData::License_GPL_V2, |
377 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 384 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
378 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 385 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
379 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 386 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
380 | about->addAuthor( "Cornelius Schumacher", | 387 | about->addAuthor( "Cornelius Schumacher", |
381 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 388 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
382 | "schumacher@kde.org" ); | 389 | "schumacher@kde.org" ); |
383 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 390 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
384 | "mpilone@slac.com" ); | 391 | "mpilone@slac.com" ); |
385 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 392 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
386 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 393 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
387 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 394 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
388 | "michel@klaralvdalens-datakonsult.se" ); | 395 | "michel@klaralvdalens-datakonsult.se" ); |
389 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 396 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
390 | "hansen@kde.org" ); | 397 | "hansen@kde.org" ); |
391 | 398 | ||
392 | return about; | 399 | return about; |
393 | #endif //KAB_EMBEDDED | 400 | #endif //KAB_EMBEDDED |
394 | 401 | ||
395 | QString version; | 402 | QString version; |
396 | #include <../version> | 403 | #include <../version> |
397 | QMessageBox::about( this, "About KAddressbook/Pi", | 404 | QMessageBox::about( this, "About KAddressbook/Pi", |
398 | "KAddressbook/Platform-independent\n" | 405 | "KAddressbook/Platform-independent\n" |
399 | "(KA/Pi) " +version + " - " + | 406 | "(KA/Pi) " +version + " - " + |
400 | #ifdef DESKTOP_VERSION | 407 | #ifdef DESKTOP_VERSION |
401 | "Desktop Edition\n" | 408 | "Desktop Edition\n" |
402 | #else | 409 | #else |
403 | "PDA-Edition\n" | 410 | "PDA-Edition\n" |
404 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 411 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
405 | #endif | 412 | #endif |
406 | 413 | ||
407 | "(c) 2004 Ulf Schenk\n" | 414 | "(c) 2004 Ulf Schenk\n" |
408 | "(c) 1997-2003, The KDE PIM Team\n" | 415 | "(c) 1997-2003, The KDE PIM Team\n" |
409 | "Tobias Koenig Current maintainer tokoe@kde.org\n" | 416 | "Tobias Koenig Current maintainer tokoe@kde.org\n" |
410 | "Don Sanders Original author\n" | 417 | "Don Sanders Original author\n" |
411 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" | 418 | "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" |
412 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" | 419 | "Mike Pilone GUI and framework redesign mpilone@slac.com\n" |
413 | "Greg Stern DCOP interface\n" | 420 | "Greg Stern DCOP interface\n" |
414 | "Mark Westcot Contact pinning\n" | 421 | "Mark Westcot Contact pinning\n" |
415 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 422 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
416 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" | 423 | "Steffen Hansen LDAP Lookup hansen@kde.org\n" |
417 | #ifdef _WIN32_ | 424 | #ifdef _WIN32_ |
418 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" | 425 | "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" |
419 | #endif | 426 | #endif |
420 | ); | 427 | ); |
421 | } | 428 | } |
422 | 429 | ||
423 | void KABCore::setContactSelected( const QString &uid ) | 430 | void KABCore::setContactSelected( const QString &uid ) |
424 | { | 431 | { |
425 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 432 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
426 | if ( !mDetails->isHidden() ) | 433 | if ( !mDetails->isHidden() ) |
427 | mDetails->setAddressee( addr ); | 434 | mDetails->setAddressee( addr ); |
428 | 435 | ||
429 | if ( !addr.isEmpty() ) { | 436 | if ( !addr.isEmpty() ) { |
430 | emit contactSelected( addr.formattedName() ); | 437 | emit contactSelected( addr.formattedName() ); |
431 | KABC::Picture pic = addr.photo(); | 438 | KABC::Picture pic = addr.photo(); |
432 | if ( pic.isIntern() ) { | 439 | if ( pic.isIntern() ) { |
433 | //US emit contactSelected( pic.data() ); | 440 | //US emit contactSelected( pic.data() ); |
434 | //US instead use: | 441 | //US instead use: |
435 | QPixmap px; | 442 | QPixmap px; |
436 | if (pic.data().isNull() != true) | 443 | if (pic.data().isNull() != true) |
437 | { | 444 | { |
438 | px.convertFromImage(pic.data()); | 445 | px.convertFromImage(pic.data()); |
439 | } | 446 | } |
440 | 447 | ||
441 | emit contactSelected( px ); | 448 | emit contactSelected( px ); |
442 | } | 449 | } |
443 | } | 450 | } |
444 | 451 | ||
445 | 452 | ||
446 | mExtensionManager->setSelectionChanged(); | 453 | mExtensionManager->setSelectionChanged(); |
447 | 454 | ||
448 | // update the actions | 455 | // update the actions |
449 | bool selected = !uid.isEmpty(); | 456 | bool selected = !uid.isEmpty(); |
450 | 457 | ||
451 | if ( mReadWrite ) { | 458 | if ( mReadWrite ) { |
452 | mActionCut->setEnabled( selected ); | 459 | mActionCut->setEnabled( selected ); |
453 | mActionPaste->setEnabled( selected ); | 460 | mActionPaste->setEnabled( selected ); |
454 | } | 461 | } |
455 | 462 | ||
456 | mActionCopy->setEnabled( selected ); | 463 | mActionCopy->setEnabled( selected ); |
457 | mActionDelete->setEnabled( selected ); | 464 | mActionDelete->setEnabled( selected ); |
458 | mActionEditAddressee->setEnabled( selected ); | 465 | mActionEditAddressee->setEnabled( selected ); |
459 | mActionMail->setEnabled( selected ); | 466 | mActionMail->setEnabled( selected ); |
460 | mActionMailVCard->setEnabled( selected ); | 467 | mActionMailVCard->setEnabled( selected ); |
461 | //if (mActionBeam) | 468 | //if (mActionBeam) |
462 | //mActionBeam->setEnabled( selected ); | 469 | //mActionBeam->setEnabled( selected ); |
463 | 470 | ||
464 | if (mActionBeamVCard) | 471 | if (mActionBeamVCard) |
465 | mActionBeamVCard->setEnabled( selected ); | 472 | mActionBeamVCard->setEnabled( selected ); |
466 | 473 | ||
467 | mActionWhoAmI->setEnabled( selected ); | 474 | mActionWhoAmI->setEnabled( selected ); |
468 | mActionCategories->setEnabled( selected ); | 475 | mActionCategories->setEnabled( selected ); |
469 | } | 476 | } |
470 | 477 | ||
471 | void KABCore::sendMail() | 478 | void KABCore::sendMail() |
472 | { | 479 | { |
473 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 480 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
474 | } | 481 | } |
475 | 482 | ||
476 | void KABCore::sendMail( const QString& emaillist ) | 483 | void KABCore::sendMail( const QString& emaillist ) |
@@ -1712,260 +1719,286 @@ void KABCore::initActions() | |||
1712 | 1719 | ||
1713 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1720 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1714 | SLOT( setCategories() ), actionCollection(), | 1721 | SLOT( setCategories() ), actionCollection(), |
1715 | "edit_set_categories" ); | 1722 | "edit_set_categories" ); |
1716 | 1723 | ||
1717 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1724 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1718 | SLOT( removeVoice() ), actionCollection(), | 1725 | SLOT( removeVoice() ), actionCollection(), |
1719 | "remove_voice" ); | 1726 | "remove_voice" ); |
1720 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1727 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1721 | SLOT( importFromOL() ), actionCollection(), | 1728 | SLOT( importFromOL() ), actionCollection(), |
1722 | "import_OL" ); | 1729 | "import_OL" ); |
1723 | #ifdef KAB_EMBEDDED | 1730 | #ifdef KAB_EMBEDDED |
1724 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, | 1731 | mActionLicence = new KAction( i18n( "Licence" ), "licence", 0, |
1725 | this, SLOT( showLicence() ), actionCollection(), | 1732 | this, SLOT( showLicence() ), actionCollection(), |
1726 | "licence_about_data" ); | 1733 | "licence_about_data" ); |
1727 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1734 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1728 | this, SLOT( createAboutData() ), actionCollection(), | 1735 | this, SLOT( createAboutData() ), actionCollection(), |
1729 | "kaddressbook_about_data" ); | 1736 | "kaddressbook_about_data" ); |
1730 | #endif //KAB_EMBEDDED | 1737 | #endif //KAB_EMBEDDED |
1731 | 1738 | ||
1732 | clipboardDataChanged(); | 1739 | clipboardDataChanged(); |
1733 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1740 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1734 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1741 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1735 | } | 1742 | } |
1736 | 1743 | ||
1737 | //US we need this function, to plug all actions into the correct menues. | 1744 | //US we need this function, to plug all actions into the correct menues. |
1738 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1745 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1739 | void KABCore::addActionsManually() | 1746 | void KABCore::addActionsManually() |
1740 | { | 1747 | { |
1741 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1748 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1742 | 1749 | ||
1743 | #ifdef KAB_EMBEDDED | 1750 | #ifdef KAB_EMBEDDED |
1744 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1751 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1745 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1752 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1746 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1753 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1747 | 1754 | ||
1748 | KToolBar* tb = mMainWindow->toolBar(); | 1755 | KToolBar* tb = mMainWindow->toolBar(); |
1749 | 1756 | ||
1750 | #ifdef DESKTOP_VERSION | 1757 | #ifdef DESKTOP_VERSION |
1751 | QMenuBar* mb = mMainWindow->menuBar(); | 1758 | QMenuBar* mb = mMainWindow->menuBar(); |
1752 | 1759 | ||
1753 | //US setup menubar. | 1760 | //US setup menubar. |
1754 | //Disable the following block if you do not want to have a menubar. | 1761 | //Disable the following block if you do not want to have a menubar. |
1755 | mb->insertItem( "&File", fileMenu ); | 1762 | mb->insertItem( "&File", fileMenu ); |
1756 | mb->insertItem( "&Edit", editMenu ); | 1763 | mb->insertItem( "&Edit", editMenu ); |
1757 | mb->insertItem( "&View", viewMenu ); | 1764 | mb->insertItem( "&View", viewMenu ); |
1758 | mb->insertItem( "&Settings", settingsMenu ); | 1765 | mb->insertItem( "&Settings", settingsMenu ); |
1759 | mb->insertItem( "&Change selected", changeMenu ); | 1766 | mb->insertItem( "&Change selected", changeMenu ); |
1760 | mb->insertItem( "&Help", helpMenu ); | 1767 | mb->insertItem( "&Help", helpMenu ); |
1761 | mIncSearchWidget = new IncSearchWidget( tb ); | 1768 | mIncSearchWidget = new IncSearchWidget( tb ); |
1762 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1769 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1763 | 1770 | ||
1764 | #else | 1771 | #else |
1765 | //US setup toolbar | 1772 | //US setup toolbar |
1766 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1773 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1767 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1774 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1768 | menuBarTB->insertItem( "ME", popupBarTB); | 1775 | menuBarTB->insertItem( "ME", popupBarTB); |
1769 | tb->insertWidget(-1, 0, menuBarTB); | 1776 | tb->insertWidget(-1, 0, menuBarTB); |
1770 | mIncSearchWidget = new IncSearchWidget( tb ); | 1777 | mIncSearchWidget = new IncSearchWidget( tb ); |
1771 | 1778 | ||
1772 | tb->enableMoving(false); | 1779 | tb->enableMoving(false); |
1773 | popupBarTB->insertItem( "&File", fileMenu ); | 1780 | popupBarTB->insertItem( "&File", fileMenu ); |
1774 | popupBarTB->insertItem( "&Edit", editMenu ); | 1781 | popupBarTB->insertItem( "&Edit", editMenu ); |
1775 | popupBarTB->insertItem( "&View", viewMenu ); | 1782 | popupBarTB->insertItem( "&View", viewMenu ); |
1776 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1783 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1777 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1784 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1778 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1785 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1779 | popupBarTB->insertItem( "&Help", helpMenu ); | 1786 | popupBarTB->insertItem( "&Help", helpMenu ); |
1780 | if (QApplication::desktop()->width() > 320 ) { | 1787 | if (QApplication::desktop()->width() > 320 ) { |
1781 | // mViewManager->getFilterAction()->plug ( tb); | 1788 | // mViewManager->getFilterAction()->plug ( tb); |
1782 | } | 1789 | } |
1783 | #endif | 1790 | #endif |
1784 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1791 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1785 | 1792 | ||
1786 | 1793 | ||
1787 | 1794 | ||
1788 | //US Now connect the actions with the menue entries. | 1795 | //US Now connect the actions with the menue entries. |
1789 | mActionPrint->plug( fileMenu ); | 1796 | mActionPrint->plug( fileMenu ); |
1790 | mActionMail->plug( fileMenu ); | 1797 | mActionMail->plug( fileMenu ); |
1791 | fileMenu->insertSeparator(); | 1798 | fileMenu->insertSeparator(); |
1792 | 1799 | ||
1793 | mActionNewContact->plug( fileMenu ); | 1800 | mActionNewContact->plug( fileMenu ); |
1794 | mActionNewContact->plug( tb ); | 1801 | mActionNewContact->plug( tb ); |
1795 | 1802 | ||
1796 | mActionEditAddressee->plug( fileMenu ); | 1803 | mActionEditAddressee->plug( fileMenu ); |
1797 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1804 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1798 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1805 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1799 | mActionEditAddressee->plug( tb ); | 1806 | mActionEditAddressee->plug( tb ); |
1800 | 1807 | ||
1801 | fileMenu->insertSeparator(); | 1808 | fileMenu->insertSeparator(); |
1802 | mActionSave->plug( fileMenu ); | 1809 | mActionSave->plug( fileMenu ); |
1803 | fileMenu->insertItem( "&Import", ImportMenu ); | 1810 | fileMenu->insertItem( "&Import", ImportMenu ); |
1804 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1811 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1805 | fileMenu->insertSeparator(); | 1812 | fileMenu->insertSeparator(); |
1806 | mActionMailVCard->plug( fileMenu ); | 1813 | mActionMailVCard->plug( fileMenu ); |
1807 | #ifndef DESKTOP_VERSION | 1814 | #ifndef DESKTOP_VERSION |
1808 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1815 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1809 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1816 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1810 | #endif | 1817 | #endif |
1811 | fileMenu->insertSeparator(); | 1818 | fileMenu->insertSeparator(); |
1812 | mActionQuit->plug( fileMenu ); | 1819 | mActionQuit->plug( fileMenu ); |
1813 | #ifdef _WIN32_ | 1820 | #ifdef _WIN32_ |
1814 | mActionImportOL->plug( ImportMenu ); | 1821 | mActionImportOL->plug( ImportMenu ); |
1815 | #endif | 1822 | #endif |
1816 | // edit menu | 1823 | // edit menu |
1817 | mActionUndo->plug( editMenu ); | 1824 | mActionUndo->plug( editMenu ); |
1818 | mActionRedo->plug( editMenu ); | 1825 | mActionRedo->plug( editMenu ); |
1819 | editMenu->insertSeparator(); | 1826 | editMenu->insertSeparator(); |
1820 | mActionCut->plug( editMenu ); | 1827 | mActionCut->plug( editMenu ); |
1821 | mActionCopy->plug( editMenu ); | 1828 | mActionCopy->plug( editMenu ); |
1822 | mActionPaste->plug( editMenu ); | 1829 | mActionPaste->plug( editMenu ); |
1823 | mActionDelete->plug( editMenu ); | 1830 | mActionDelete->plug( editMenu ); |
1824 | editMenu->insertSeparator(); | 1831 | editMenu->insertSeparator(); |
1825 | mActionSelectAll->plug( editMenu ); | 1832 | mActionSelectAll->plug( editMenu ); |
1826 | 1833 | ||
1827 | mActionRemoveVoice->plug( changeMenu ); | 1834 | mActionRemoveVoice->plug( changeMenu ); |
1828 | // settings menu | 1835 | // settings menu |
1829 | //US special menuentry to configure the addressbook resources. On KDE | 1836 | //US special menuentry to configure the addressbook resources. On KDE |
1830 | // you do that through the control center !!! | 1837 | // you do that through the control center !!! |
1831 | mActionConfigResources->plug( settingsMenu ); | 1838 | mActionConfigResources->plug( settingsMenu ); |
1832 | settingsMenu->insertSeparator(); | 1839 | settingsMenu->insertSeparator(); |
1833 | 1840 | ||
1834 | mActionConfigKAddressbook->plug( settingsMenu ); | 1841 | mActionConfigKAddressbook->plug( settingsMenu ); |
1835 | 1842 | ||
1836 | if ( mIsPart ) { | 1843 | if ( mIsPart ) { |
1837 | mActionConfigShortcuts->plug( settingsMenu ); | 1844 | mActionConfigShortcuts->plug( settingsMenu ); |
1838 | mActionConfigureToolbars->plug( settingsMenu ); | 1845 | mActionConfigureToolbars->plug( settingsMenu ); |
1839 | 1846 | ||
1840 | } else { | 1847 | } else { |
1841 | mActionKeyBindings->plug( settingsMenu ); | 1848 | mActionKeyBindings->plug( settingsMenu ); |
1842 | } | 1849 | } |
1843 | 1850 | ||
1844 | settingsMenu->insertSeparator(); | 1851 | settingsMenu->insertSeparator(); |
1845 | 1852 | ||
1846 | mActionJumpBar->plug( settingsMenu ); | 1853 | mActionJumpBar->plug( settingsMenu ); |
1847 | mActionDetails->plug( settingsMenu ); | 1854 | mActionDetails->plug( settingsMenu ); |
1848 | if (!KABPrefs::instance()->mMultipleViewsAtOnce ) | 1855 | if (!KABPrefs::instance()->mMultipleViewsAtOnce ) |
1849 | mActionDetails->plug( tb ); | 1856 | mActionDetails->plug( tb ); |
1850 | settingsMenu->insertSeparator(); | 1857 | settingsMenu->insertSeparator(); |
1851 | 1858 | ||
1852 | mActionWhoAmI->plug( settingsMenu ); | 1859 | mActionWhoAmI->plug( settingsMenu ); |
1853 | mActionCategories->plug( settingsMenu ); | 1860 | mActionCategories->plug( settingsMenu ); |
1854 | 1861 | ||
1855 | mActionAboutKAddressbook->plug( helpMenu ); | 1862 | mActionAboutKAddressbook->plug( helpMenu ); |
1856 | mActionLicence->plug( helpMenu ); | 1863 | mActionLicence->plug( helpMenu ); |
1857 | 1864 | ||
1858 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1865 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1859 | 1866 | ||
1860 | mActionSave->plug( tb ); | 1867 | mActionSave->plug( tb ); |
1861 | mViewManager->getFilterAction()->plug ( tb); | 1868 | mViewManager->getFilterAction()->plug ( tb); |
1862 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1869 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1863 | mActionUndo->plug( tb ); | 1870 | mActionUndo->plug( tb ); |
1864 | mActionDelete->plug( tb ); | 1871 | mActionDelete->plug( tb ); |
1865 | mActionRedo->plug( tb ); | 1872 | mActionRedo->plug( tb ); |
1866 | } | 1873 | } |
1867 | } | 1874 | } |
1868 | //mActionQuit->plug ( tb ); | 1875 | //mActionQuit->plug ( tb ); |
1869 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1876 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1870 | 1877 | ||
1871 | //US link the searchwidget first to this. | 1878 | //US link the searchwidget first to this. |
1872 | // The real linkage to the toolbar happens later. | 1879 | // The real linkage to the toolbar happens later. |
1873 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1880 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1874 | //US tb->insertItem( mIncSearchWidget ); | 1881 | //US tb->insertItem( mIncSearchWidget ); |
1875 | /*US | 1882 | /*US |
1876 | mIncSearchWidget = new IncSearchWidget( tb ); | 1883 | mIncSearchWidget = new IncSearchWidget( tb ); |
1877 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1884 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1878 | SLOT( incrementalSearch( const QString& ) ) ); | 1885 | SLOT( incrementalSearch( const QString& ) ) ); |
1879 | 1886 | ||
1880 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1887 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1881 | 1888 | ||
1882 | //US topLayout->addWidget( mJumpButtonBar ); | 1889 | //US topLayout->addWidget( mJumpButtonBar ); |
1883 | this->layout()->add( mJumpButtonBar ); | 1890 | this->layout()->add( mJumpButtonBar ); |
1884 | */ | 1891 | */ |
1885 | 1892 | ||
1886 | #endif //KAB_EMBEDDED | 1893 | #endif //KAB_EMBEDDED |
1887 | } | 1894 | } |
1888 | void KABCore::showLicence() | 1895 | void KABCore::showLicence() |
1889 | { | 1896 | { |
1890 | KApplication::showLicence(); | 1897 | KApplication::showLicence(); |
1891 | } | 1898 | } |
1892 | void KABCore::removeVoice() | 1899 | void KABCore::removeVoice() |
1893 | { | 1900 | { |
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 ) | 1901 | 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 ) |
1895 | return; | 1902 | return; |
1896 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1903 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1897 | KABC::Addressee::List::Iterator it; | 1904 | KABC::Addressee::List::Iterator it; |
1898 | for ( it = list.begin(); it != list.end(); ++it ) { | 1905 | for ( it = list.begin(); it != list.end(); ++it ) { |
1899 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1906 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1900 | PhoneNumber::List::Iterator phoneIt; | 1907 | PhoneNumber::List::Iterator phoneIt; |
1901 | bool found = false; | 1908 | bool found = false; |
1902 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1909 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1903 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1910 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1904 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1911 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1905 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1912 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1906 | (*it).insertPhoneNumber( (*phoneIt) ); | 1913 | (*it).insertPhoneNumber( (*phoneIt) ); |
1907 | found = true; | 1914 | found = true; |
1908 | } | 1915 | } |
1909 | } | 1916 | } |
1910 | 1917 | ||
1911 | } | 1918 | } |
1912 | if ( found ) | 1919 | if ( found ) |
1913 | contactModified((*it) ); | 1920 | contactModified((*it) ); |
1914 | } | 1921 | } |
1915 | } | 1922 | } |
1916 | 1923 | ||
1917 | 1924 | ||
1918 | 1925 | ||
1919 | void KABCore::clipboardDataChanged() | 1926 | void KABCore::clipboardDataChanged() |
1920 | { | 1927 | { |
1921 | 1928 | ||
1922 | if ( mReadWrite ) | 1929 | if ( mReadWrite ) |
1923 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1930 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1924 | 1931 | ||
1925 | } | 1932 | } |
1926 | 1933 | ||
1927 | void KABCore::updateActionMenu() | 1934 | void KABCore::updateActionMenu() |
1928 | { | 1935 | { |
1929 | UndoStack *undo = UndoStack::instance(); | 1936 | UndoStack *undo = UndoStack::instance(); |
1930 | RedoStack *redo = RedoStack::instance(); | 1937 | RedoStack *redo = RedoStack::instance(); |
1931 | 1938 | ||
1932 | if ( undo->isEmpty() ) | 1939 | if ( undo->isEmpty() ) |
1933 | mActionUndo->setText( i18n( "Undo" ) ); | 1940 | mActionUndo->setText( i18n( "Undo" ) ); |
1934 | else | 1941 | else |
1935 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1942 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1936 | 1943 | ||
1937 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1944 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1938 | 1945 | ||
1939 | if ( !redo->top() ) | 1946 | if ( !redo->top() ) |
1940 | mActionRedo->setText( i18n( "Redo" ) ); | 1947 | mActionRedo->setText( i18n( "Redo" ) ); |
1941 | else | 1948 | else |
1942 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1949 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1943 | 1950 | ||
1944 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1951 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1945 | } | 1952 | } |
1946 | 1953 | ||
1947 | void KABCore::configureKeyBindings() | 1954 | void KABCore::configureKeyBindings() |
1948 | { | 1955 | { |
1949 | #ifndef KAB_EMBEDDED | 1956 | #ifndef KAB_EMBEDDED |
1950 | KKeyDialog::configure( actionCollection(), true ); | 1957 | KKeyDialog::configure( actionCollection(), true ); |
1951 | #else //KAB_EMBEDDED | 1958 | #else //KAB_EMBEDDED |
1952 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1959 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1953 | #endif //KAB_EMBEDDED | 1960 | #endif //KAB_EMBEDDED |
1954 | } | 1961 | } |
1955 | 1962 | ||
1956 | #ifdef KAB_EMBEDDED | 1963 | #ifdef KAB_EMBEDDED |
1957 | void KABCore::configureResources() | 1964 | void KABCore::configureResources() |
1958 | { | 1965 | { |
1959 | KRES::KCMKResources dlg( this, "" , 0 ); | 1966 | KRES::KCMKResources dlg( this, "" , 0 ); |
1960 | 1967 | ||
1961 | if ( !dlg.exec() ) | 1968 | if ( !dlg.exec() ) |
1962 | return; | 1969 | return; |
1963 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 1970 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
1964 | } | 1971 | } |
1965 | #endif //KAB_EMBEDDED | 1972 | #endif //KAB_EMBEDDED |
1966 | 1973 | ||
1967 | 1974 | ||
1975 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | ||
1976 | * for the attendees list of an event. | ||
1977 | */ | ||
1978 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1) | ||
1979 | { | ||
1980 | //param1 is usually empty for this kind of request | ||
1981 | |||
1982 | QStringList nameList; | ||
1983 | QStringList emailList; | ||
1984 | QStringList uidList; | ||
1985 | |||
1986 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | ||
1987 | uint i=0; | ||
1988 | for (i=0; i < list.count(); i++) | ||
1989 | { | ||
1990 | nameList.append(list[i].realName()); | ||
1991 | emailList.append(list[i].preferredEmail()); | ||
1992 | uidList.append(list[i].uid()); | ||
1993 | } | ||
1994 | |||
1995 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | ||
1996 | |||
1997 | } | ||
1998 | |||
1999 | |||
2000 | |||
1968 | 2001 | ||
1969 | #ifndef KAB_EMBEDDED | 2002 | #ifndef KAB_EMBEDDED |
1970 | #include "kabcore.moc" | 2003 | #include "kabcore.moc" |
1971 | #endif //KAB_EMBEDDED | 2004 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index d4d28f1..fe778af 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -75,375 +75,378 @@ class KABCore : public QWidget | |||
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 or edits 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 executeContact( 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 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1); | ||
332 | |||
333 | |||
331 | signals: | 334 | signals: |
332 | void contactSelected( const QString &name ); | 335 | void contactSelected( const QString &name ); |
333 | void contactSelected( const QPixmap &pixmap ); | 336 | void contactSelected( const QPixmap &pixmap ); |
334 | public slots: | 337 | public slots: |
335 | void setDetailsVisible( bool visible ); | 338 | void setDetailsVisible( bool visible ); |
336 | void setDetailsToState(); | 339 | void setDetailsToState(); |
337 | private slots: | 340 | private slots: |
338 | void setJumpButtonBarVisible( bool visible ); | 341 | void setJumpButtonBarVisible( bool visible ); |
339 | void importFromOL(); | 342 | void importFromOL(); |
340 | void extensionModified( const KABC::Addressee::List &list ); | 343 | void extensionModified( const KABC::Addressee::List &list ); |
341 | void extensionChanged( int id ); | 344 | void extensionChanged( int id ); |
342 | void clipboardDataChanged(); | 345 | void clipboardDataChanged(); |
343 | void updateActionMenu(); | 346 | void updateActionMenu(); |
344 | void configureKeyBindings(); | 347 | void configureKeyBindings(); |
345 | void removeVoice(); | 348 | void removeVoice(); |
346 | #ifdef KAB_EMBEDDED | 349 | #ifdef KAB_EMBEDDED |
347 | void configureResources(); | 350 | void configureResources(); |
348 | #endif //KAB_EMBEDDED | 351 | #endif //KAB_EMBEDDED |
349 | 352 | ||
350 | void slotEditorDestroyed( const QString &uid ); | 353 | void slotEditorDestroyed( const QString &uid ); |
351 | void configurationChanged(); | 354 | void configurationChanged(); |
352 | void addressBookChanged(); | 355 | void addressBookChanged(); |
353 | 356 | ||
354 | private: | 357 | private: |
355 | void initGUI(); | 358 | void initGUI(); |
356 | void initActions(); | 359 | void initActions(); |
357 | 360 | ||
358 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 361 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
359 | const char *name = 0 ); | 362 | const char *name = 0 ); |
360 | 363 | ||
361 | KXMLGUIClient *mGUIClient; | 364 | KXMLGUIClient *mGUIClient; |
362 | 365 | ||
363 | KABC::AddressBook *mAddressBook; | 366 | KABC::AddressBook *mAddressBook; |
364 | 367 | ||
365 | ViewManager *mViewManager; | 368 | ViewManager *mViewManager; |
366 | // QSplitter *mDetailsSplitter; | 369 | // QSplitter *mDetailsSplitter; |
367 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 370 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
368 | ViewContainer *mDetails; | 371 | ViewContainer *mDetails; |
369 | KDGanttMinimizeSplitter* mMiniSplitter; | 372 | KDGanttMinimizeSplitter* mMiniSplitter; |
370 | XXPortManager *mXXPortManager; | 373 | XXPortManager *mXXPortManager; |
371 | JumpButtonBar *mJumpButtonBar; | 374 | JumpButtonBar *mJumpButtonBar; |
372 | IncSearchWidget *mIncSearchWidget; | 375 | IncSearchWidget *mIncSearchWidget; |
373 | ExtensionManager *mExtensionManager; | 376 | ExtensionManager *mExtensionManager; |
374 | 377 | ||
375 | KCMultiDialog *mConfigureDialog; | 378 | KCMultiDialog *mConfigureDialog; |
376 | 379 | ||
377 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
378 | LDAPSearchDialog *mLdapSearchDialog; | 381 | LDAPSearchDialog *mLdapSearchDialog; |
379 | #endif //KAB_EMBEDDED | 382 | #endif //KAB_EMBEDDED |
380 | // QDict<AddresseeEditorDialog> mEditorDict; | 383 | // QDict<AddresseeEditorDialog> mEditorDict; |
381 | AddresseeEditorDialog *mEditorDialog; | 384 | AddresseeEditorDialog *mEditorDialog; |
382 | bool mReadWrite; | 385 | bool mReadWrite; |
383 | bool mModified; | 386 | bool mModified; |
384 | bool mIsPart; | 387 | bool mIsPart; |
385 | bool mMultipleViewsAtOnce; | 388 | bool mMultipleViewsAtOnce; |
386 | 389 | ||
387 | 390 | ||
388 | //US file menu | 391 | //US file menu |
389 | KAction *mActionMail; | 392 | KAction *mActionMail; |
390 | KAction *mActionBeam; | 393 | KAction *mActionBeam; |
391 | KAction* mActionPrint; | 394 | KAction* mActionPrint; |
392 | KAction* mActionNewContact; | 395 | KAction* mActionNewContact; |
393 | KAction *mActionSave; | 396 | KAction *mActionSave; |
394 | KAction *mActionEditAddressee; | 397 | KAction *mActionEditAddressee; |
395 | KAction *mActionMailVCard; | 398 | KAction *mActionMailVCard; |
396 | KAction *mActionBeamVCard; | 399 | KAction *mActionBeamVCard; |
397 | 400 | ||
398 | KAction *mActionQuit; | 401 | KAction *mActionQuit; |
399 | 402 | ||
400 | //US edit menu | 403 | //US edit menu |
401 | KAction *mActionCopy; | 404 | KAction *mActionCopy; |
402 | KAction *mActionCut; | 405 | KAction *mActionCut; |
403 | KAction *mActionPaste; | 406 | KAction *mActionPaste; |
404 | KAction *mActionSelectAll; | 407 | KAction *mActionSelectAll; |
405 | KAction *mActionUndo; | 408 | KAction *mActionUndo; |
406 | KAction *mActionRedo; | 409 | KAction *mActionRedo; |
407 | KAction *mActionDelete; | 410 | KAction *mActionDelete; |
408 | 411 | ||
409 | //US settings menu | 412 | //US settings menu |
410 | KAction *mActionConfigResources; | 413 | KAction *mActionConfigResources; |
411 | KAction *mActionConfigKAddressbook; | 414 | KAction *mActionConfigKAddressbook; |
412 | KAction *mActionConfigShortcuts; | 415 | KAction *mActionConfigShortcuts; |
413 | KAction *mActionConfigureToolbars; | 416 | KAction *mActionConfigureToolbars; |
414 | KAction *mActionKeyBindings; | 417 | KAction *mActionKeyBindings; |
415 | KToggleAction *mActionJumpBar; | 418 | KToggleAction *mActionJumpBar; |
416 | KToggleAction *mActionDetails; | 419 | KToggleAction *mActionDetails; |
417 | KAction *mActionWhoAmI; | 420 | KAction *mActionWhoAmI; |
418 | KAction *mActionCategories; | 421 | KAction *mActionCategories; |
419 | KAction *mActionAboutKAddressbook; | 422 | KAction *mActionAboutKAddressbook; |
420 | KAction *mActionLicence; | 423 | KAction *mActionLicence; |
421 | 424 | ||
422 | KAction *mActionDeleteView; | 425 | KAction *mActionDeleteView; |
423 | 426 | ||
424 | QPopupMenu *viewMenu; | 427 | QPopupMenu *viewMenu; |
425 | QPopupMenu *filterMenu; | 428 | QPopupMenu *filterMenu; |
426 | QPopupMenu *settingsMenu; | 429 | QPopupMenu *settingsMenu; |
427 | QPopupMenu *changeMenu; | 430 | QPopupMenu *changeMenu; |
428 | 431 | ||
429 | //US QAction *mActionSave; | 432 | //US QAction *mActionSave; |
430 | QPopupMenu *ImportMenu; | 433 | QPopupMenu *ImportMenu; |
431 | QPopupMenu *ExportMenu; | 434 | QPopupMenu *ExportMenu; |
432 | //LR additional methods | 435 | //LR additional methods |
433 | KAction *mActionRemoveVoice; | 436 | KAction *mActionRemoveVoice; |
434 | KAction * mActionImportOL; | 437 | KAction * mActionImportOL; |
435 | 438 | ||
436 | #ifndef KAB_EMBEDDED | 439 | #ifndef KAB_EMBEDDED |
437 | KAddressBookService *mAddressBookService; | 440 | KAddressBookService *mAddressBookService; |
438 | #endif //KAB_EMBEDDED | 441 | #endif //KAB_EMBEDDED |
439 | 442 | ||
440 | class KABCorePrivate; | 443 | class KABCorePrivate; |
441 | KABCorePrivate *d; | 444 | KABCorePrivate *d; |
442 | 445 | ||
443 | #ifdef KAB_EMBEDDED | 446 | #ifdef KAB_EMBEDDED |
444 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 447 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
445 | #endif //KAB_EMBEDDED | 448 | #endif //KAB_EMBEDDED |
446 | 449 | ||
447 | }; | 450 | }; |
448 | 451 | ||
449 | #endif | 452 | #endif |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 7f368eb..850e5b2 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,191 +1,192 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #else | 4 | #else |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <qwindowsstyle.h> | 6 | #include <qwindowsstyle.h> |
7 | #include <qplatinumstyle.h> | 7 | #include <qplatinumstyle.h> |
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | #include <kstandarddirs.h> | 11 | #include <kstandarddirs.h> |
12 | #include <kglobal.h> | 12 | #include <kglobal.h> |
13 | #include <stdio.h> | 13 | #include <stdio.h> |
14 | #include <qdir.h> | 14 | #include <qdir.h> |
15 | #include "kaddressbookmain.h" | 15 | #include "kaddressbookmain.h" |
16 | #include "externalapphandler.h" | ||
16 | 17 | ||
17 | int main( int argc, char **argv ) | 18 | int main( int argc, char **argv ) |
18 | { | 19 | { |
19 | #ifndef DESKTOP_VERSION | 20 | #ifndef DESKTOP_VERSION |
20 | QPEApplication a( argc, argv ); | 21 | QPEApplication a( argc, argv ); |
21 | a.setKeepRunning (); | 22 | a.setKeepRunning (); |
22 | #else | 23 | #else |
23 | QApplication a( argc, argv ); | 24 | QApplication a( argc, argv ); |
24 | QApplication::setStyle( new QPlatinumStyle ()); | 25 | QApplication::setStyle( new QPlatinumStyle ()); |
25 | #endif | 26 | #endif |
26 | 27 | ||
27 | bool exitHelp = false; | 28 | bool exitHelp = false; |
28 | if ( argc > 1 ) { | 29 | if ( argc > 1 ) { |
29 | QString command = argv[1]; | 30 | QString command = argv[1]; |
30 | if ( command == "-help" ){ | 31 | if ( command == "-help" ){ |
31 | printf("KA/E command line commands:\n"); | 32 | printf("KA/E command line commands:\n"); |
32 | printf(" no command: Start KA/E in usual way\n"); | 33 | printf(" no command: Start KA/E in usual way\n"); |
33 | printf(" -help: This output\n"); | 34 | printf(" -help: This output\n"); |
34 | printf(" KA/E is exiting now. Bye!\n"); | 35 | printf(" KA/E is exiting now. Bye!\n"); |
35 | exitHelp = true; | 36 | exitHelp = true; |
36 | } | 37 | } |
37 | } | 38 | } |
38 | if ( ! exitHelp ) { | 39 | if ( ! exitHelp ) { |
39 | 40 | ||
40 | KGlobal::setAppName( "kaddressbook" ); | 41 | KGlobal::setAppName( "kaddressbook" ); |
41 | #ifndef DESKTOP_VERSION | 42 | #ifndef DESKTOP_VERSION |
42 | if ( QApplication::desktop()->width() > 320 ) | 43 | if ( QApplication::desktop()->width() > 320 ) |
43 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 44 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
44 | else | 45 | else |
45 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 46 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
46 | #else | 47 | #else |
47 | QString fileName ; | 48 | QString fileName ; |
48 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 49 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
49 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 50 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
50 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 51 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
51 | 52 | ||
52 | #endif | 53 | #endif |
53 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 54 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
54 | KAddressBookMain m ; | 55 | KAddressBookMain m ; |
55 | //US MainWindow m; | 56 | //US MainWindow m; |
56 | //US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 57 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
57 | 58 | ||
58 | #ifndef DESKTOP_VERSION | 59 | #ifndef DESKTOP_VERSION |
59 | a.showMainWidget( &m ); | 60 | a.showMainWidget( &m ); |
60 | #else | 61 | #else |
61 | a.setMainWidget( &m ); | 62 | a.setMainWidget( &m ); |
62 | m.resize (640, 480 ); | 63 | m.resize (640, 480 ); |
63 | m.show(); | 64 | m.show(); |
64 | #endif | 65 | #endif |
65 | a.exec(); | 66 | a.exec(); |
66 | 67 | ||
67 | } | 68 | } |
68 | qDebug("KA: Bye! "); | 69 | qDebug("KA: Bye! "); |
69 | } | 70 | } |
70 | 71 | ||
71 | /* | 72 | /* |
72 | #include <stdlib.h> | 73 | #include <stdlib.h> |
73 | 74 | ||
74 | #include <qstring.h> | 75 | #include <qstring.h> |
75 | 76 | ||
76 | #include <kabc/stdaddressbook.h> | 77 | #include <kabc/stdaddressbook.h> |
77 | #include <kaboutdata.h> | 78 | #include <kaboutdata.h> |
78 | #include <kcmdlineargs.h> | 79 | #include <kcmdlineargs.h> |
79 | #include <kcrash.h> | 80 | #include <kcrash.h> |
80 | #include <kdebug.h> | 81 | #include <kdebug.h> |
81 | #include <klocale.h> | 82 | #include <klocale.h> |
82 | #include <kstartupinfo.h> | 83 | #include <kstartupinfo.h> |
83 | #include <kuniqueapplication.h> | 84 | #include <kuniqueapplication.h> |
84 | #include <kwin.h> | 85 | #include <kwin.h> |
85 | 86 | ||
86 | #include "kaddressbookmain.h" | 87 | #include "kaddressbookmain.h" |
87 | #include "kabcore.h" | 88 | #include "kabcore.h" |
88 | 89 | ||
89 | extern "C" { | 90 | extern "C" { |
90 | 91 | ||
91 | void crashHandler( int ) | 92 | void crashHandler( int ) |
92 | { | 93 | { |
93 | KABC::StdAddressBook::handleCrash(); | 94 | KABC::StdAddressBook::handleCrash(); |
94 | ::exit( 0 ); | 95 | ::exit( 0 ); |
95 | } | 96 | } |
96 | 97 | ||
97 | } | 98 | } |
98 | 99 | ||
99 | class KAddressBookApp : public KUniqueApplication { | 100 | class KAddressBookApp : public KUniqueApplication { |
100 | public: | 101 | public: |
101 | KAddressBookApp() : mMainWin( 0 ) {} | 102 | KAddressBookApp() : mMainWin( 0 ) {} |
102 | ~KAddressBookApp() {} | 103 | ~KAddressBookApp() {} |
103 | 104 | ||
104 | int newInstance(); | 105 | int newInstance(); |
105 | 106 | ||
106 | private: | 107 | private: |
107 | KAddressBookMain *mMainWin; | 108 | KAddressBookMain *mMainWin; |
108 | }; | 109 | }; |
109 | 110 | ||
110 | int KAddressBookApp::newInstance() | 111 | int KAddressBookApp::newInstance() |
111 | { | 112 | { |
112 | if ( isRestored() ) { | 113 | if ( isRestored() ) { |
113 | // There can only be one main window | 114 | // There can only be one main window |
114 | if ( KMainWindow::canBeRestored( 1 ) ) { | 115 | if ( KMainWindow::canBeRestored( 1 ) ) { |
115 | mMainWin = new KAddressBookMain; | 116 | mMainWin = new KAddressBookMain; |
116 | mMainWin->show(); | 117 | mMainWin->show(); |
117 | mMainWin->restore( 1 ); | 118 | mMainWin->restore( 1 ); |
118 | } | 119 | } |
119 | } else { | 120 | } else { |
120 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 121 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
121 | 122 | ||
122 | QCString addrStr = args->getOption( "addr" ); | 123 | QCString addrStr = args->getOption( "addr" ); |
123 | QCString uidStr = args->getOption( "uid" ); | 124 | QCString uidStr = args->getOption( "uid" ); |
124 | QString addr; | 125 | QString addr; |
125 | QString uid; | 126 | QString uid; |
126 | if ( !addrStr.isEmpty() ) | 127 | if ( !addrStr.isEmpty() ) |
127 | addr = QString::fromLocal8Bit( addrStr ); | 128 | addr = QString::fromLocal8Bit( addrStr ); |
128 | if ( !uidStr.isEmpty() ) | 129 | if ( !uidStr.isEmpty() ) |
129 | uid = QString::fromLocal8Bit( uidStr ); | 130 | uid = QString::fromLocal8Bit( uidStr ); |
130 | 131 | ||
131 | 132 | ||
132 | if ( args->isSet( "editor-only" ) ) { | 133 | if ( args->isSet( "editor-only" ) ) { |
133 | if ( !mMainWin ) | 134 | if ( !mMainWin ) |
134 | mMainWin = new KAddressBookMain; | 135 | mMainWin = new KAddressBookMain; |
135 | KStartupInfo::appStarted(); | 136 | KStartupInfo::appStarted(); |
136 | mMainWin->hide(); | 137 | mMainWin->hide(); |
137 | } else { | 138 | } else { |
138 | if ( mMainWin ) { | 139 | if ( mMainWin ) { |
139 | mMainWin->show(); | 140 | mMainWin->show(); |
140 | KWin::setActiveWindow( mMainWin->winId() ); | 141 | KWin::setActiveWindow( mMainWin->winId() ); |
141 | } else { | 142 | } else { |
142 | mMainWin = new KAddressBookMain; | 143 | mMainWin = new KAddressBookMain; |
143 | mMainWin->show(); | 144 | mMainWin->show(); |
144 | } | 145 | } |
145 | } | 146 | } |
146 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do | 147 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do |
147 | if ( !addr.isEmpty() ) | 148 | if ( !addr.isEmpty() ) |
148 | mMainWin->addEmail( addr ); | 149 | mMainWin->addEmail( addr ); |
149 | 150 | ||
150 | if ( !uid.isEmpty() ) | 151 | if ( !uid.isEmpty() ) |
151 | mMainWin->showContactEditor( uid ); | 152 | mMainWin->showContactEditor( uid ); |
152 | if ( args->isSet( "new-contact" ) ) { | 153 | if ( args->isSet( "new-contact" ) ) { |
153 | mMainWin->newContact(); | 154 | mMainWin->newContact(); |
154 | } | 155 | } |
155 | } | 156 | } |
156 | 157 | ||
157 | KCrash::setEmergencySaveFunction( crashHandler ); | 158 | KCrash::setEmergencySaveFunction( crashHandler ); |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |
161 | 162 | ||
162 | // the dummy argument is required, because KMail apparently sends an empty | 163 | // the dummy argument is required, because KMail apparently sends an empty |
163 | // argument. | 164 | // argument. |
164 | static KCmdLineOptions kmoptions[] = | 165 | static KCmdLineOptions kmoptions[] = |
165 | { | 166 | { |
166 | { "a", 0 , 0 }, | 167 | { "a", 0 , 0 }, |
167 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, | 168 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, |
168 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, | 169 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, |
169 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, | 170 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, |
170 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, | 171 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, |
171 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, | 172 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, |
172 | { 0, 0, 0} | 173 | { 0, 0, 0} |
173 | }; | 174 | }; |
174 | 175 | ||
175 | int main( int argc, char *argv[] ) | 176 | int main( int argc, char *argv[] ) |
176 | { | 177 | { |
177 | KLocale::setMainCatalogue( "kaddressbook" ); | 178 | KLocale::setMainCatalogue( "kaddressbook" ); |
178 | 179 | ||
179 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); | 180 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); |
180 | KCmdLineArgs::addCmdLineOptions( kmoptions ); | 181 | KCmdLineArgs::addCmdLineOptions( kmoptions ); |
181 | KUniqueApplication::addCmdLineOptions(); | 182 | KUniqueApplication::addCmdLineOptions(); |
182 | 183 | ||
183 | if ( !KAddressBookApp::start() ) | 184 | if ( !KAddressBookApp::start() ) |
184 | exit( 0 ); | 185 | exit( 0 ); |
185 | 186 | ||
186 | KAddressBookApp app; | 187 | KAddressBookApp app; |
187 | KGlobal::locale()->insertCatalogue( "libkdepim" ); | 188 | KGlobal::locale()->insertCatalogue( "libkdepim" ); |
188 | 189 | ||
189 | return app.exec(); | 190 | return app.exec(); |
190 | } | 191 | } |
191 | */ | 192 | */ |