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