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