summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-03-29 18:35:10 (UTC)
committer zautrix <zautrix>2005-03-29 18:35:10 (UTC)
commitb70d9695bb6a2d567b75965c0530792ad90c84a3 (patch) (unidiff)
treebc27647d044cf4a8d9c75acd19d9a2d078fe00b2 /kaddressbook
parenta7c827aa0e555206b60dec3bc07f7afab4352883 (diff)
downloadkdepimpi-b70d9695bb6a2d567b75965c0530792ad90c84a3.zip
kdepimpi-b70d9695bb6a2d567b75965c0530792ad90c84a3.tar.gz
kdepimpi-b70d9695bb6a2d567b75965c0530792ad90c84a3.tar.bz2
icons
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp2
-rw-r--r--kaddressbook/kabcore.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index a84fc61..b5a60f2 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -1,123 +1,123 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qapplication.h> 25#include <qapplication.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <klocale.h> 28#include <klocale.h>
29#include <kglobal.h> 29#include <kglobal.h>
30 30
31#include "addresseeeditorwidget.h" 31#include "addresseeeditorwidget.h"
32#include "kabcore.h" 32#include "kabcore.h"
33 33
34#include "addresseeeditordialog.h" 34#include "addresseeeditordialog.h"
35 35
36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
37 const char *name ) 37 const char *name )
38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), 38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, 39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
40 KDialogBase::Ok, parent, name, true ) 40 KDialogBase::Ok, parent, name, true )
41{ 41{
42 42
43 43
44 QWidget *page = plainPage(); 44 QWidget *page = plainPage();
45 45
46 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
47 47
48 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
50 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
51 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
52 52
53 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) { 54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons(); 55 hideButtons();
56 } 56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 //emit editorDestroyed( mEditorWidget->addressee().uid() ); 61 //emit editorDestroyed( mEditorWidget->addressee().uid() );
62} 62}
63 63
64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
65{ 65{
66 enableButton( KDialogBase::Apply, false ); 66 enableButton( KDialogBase::Apply, false );
67 67
68 mEditorWidget->setAddressee( addr ); 68 mEditorWidget->setAddressee( addr );
69 69
70 this->setCaption("Edit " + addr.formattedName()); 70 this->setCaption(i18n ("Edit ") + addr.formattedName());
71} 71}
72 72
73KABC::Addressee AddresseeEditorDialog::addressee() 73KABC::Addressee AddresseeEditorDialog::addressee()
74{ 74{
75 return mEditorWidget->addressee(); 75 return mEditorWidget->addressee();
76} 76}
77 77
78bool AddresseeEditorDialog::dirty() 78bool AddresseeEditorDialog::dirty()
79{ 79{
80 return mEditorWidget->dirty(); 80 return mEditorWidget->dirty();
81} 81}
82 82
83void AddresseeEditorDialog::slotApply() 83void AddresseeEditorDialog::slotApply()
84{ 84{
85 if ( mEditorWidget->dirty() ) { 85 if ( mEditorWidget->dirty() ) {
86 mEditorWidget->save(); 86 mEditorWidget->save();
87 emit contactModified( mEditorWidget->addressee() ); 87 emit contactModified( mEditorWidget->addressee() );
88 } 88 }
89 89
90 enableButton( KDialogBase::Apply, false ); 90 enableButton( KDialogBase::Apply, false );
91 91
92 KDialogBase::slotApply(); 92 KDialogBase::slotApply();
93} 93}
94 94
95void AddresseeEditorDialog:: accept () 95void AddresseeEditorDialog:: accept ()
96{ 96{
97 slotOk(); 97 slotOk();
98 98
99} 99}
100void AddresseeEditorDialog::slotOk() 100void AddresseeEditorDialog::slotOk()
101{ 101{
102 slotApply(); 102 slotApply();
103 103
104 //KDialogBase::slotOk(); 104 //KDialogBase::slotOk();
105 emit okClicked(); 105 emit okClicked();
106 QDialog::accept(); 106 QDialog::accept();
107} 107}
108 108
109void AddresseeEditorDialog::widgetModified() 109void AddresseeEditorDialog::widgetModified()
110{ 110{
111 enableButton( KDialogBase::Apply, true ); 111 enableButton( KDialogBase::Apply, true );
112} 112}
113 113
114void AddresseeEditorDialog::slotCancel() 114void AddresseeEditorDialog::slotCancel()
115{ 115{
116 KDialogBase::slotCancel(); 116 KDialogBase::slotCancel();
117 117
118 118
119} 119}
120 120
121#ifndef KAB_EMBEDDED 121#ifndef KAB_EMBEDDED
122#include "addresseeeditordialog.moc" 122#include "addresseeeditordialog.moc"
123#endif //KAB_EMBEDDED 123#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3f9b546..e1a490d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1071,384 +1071,385 @@ void KABCore::pasteContacts()
1071 1071
1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1073 1073
1074 pasteContacts( list ); 1074 pasteContacts( list );
1075} 1075}
1076 1076
1077void KABCore::pasteContacts( KABC::Addressee::List &list ) 1077void KABCore::pasteContacts( KABC::Addressee::List &list )
1078{ 1078{
1079 KABC::Resource *resource = requestResource( this ); 1079 KABC::Resource *resource = requestResource( this );
1080 KABC::Addressee::List::Iterator it; 1080 KABC::Addressee::List::Iterator it;
1081 for ( it = list.begin(); it != list.end(); ++it ) 1081 for ( it = list.begin(); it != list.end(); ++it )
1082 (*it).setResource( resource ); 1082 (*it).setResource( resource );
1083 1083
1084 PwPasteCommand *command = new PwPasteCommand( this, list ); 1084 PwPasteCommand *command = new PwPasteCommand( this, list );
1085 UndoStack::instance()->push( command ); 1085 UndoStack::instance()->push( command );
1086 RedoStack::instance()->clear(); 1086 RedoStack::instance()->clear();
1087 1087
1088 setModified( true ); 1088 setModified( true );
1089} 1089}
1090 1090
1091void KABCore::setWhoAmI() 1091void KABCore::setWhoAmI()
1092{ 1092{
1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1094 1094
1095 if ( addrList.count() > 1 ) { 1095 if ( addrList.count() > 1 ) {
1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1097 return; 1097 return;
1098 } 1098 }
1099 1099
1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1103} 1103}
1104void KABCore::editCategories() 1104void KABCore::editCategories()
1105{ 1105{
1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1107 dlg.exec(); 1107 dlg.exec();
1108} 1108}
1109void KABCore::setCategories() 1109void KABCore::setCategories()
1110{ 1110{
1111 1111
1112 QStringList uids; 1112 QStringList uids;
1113 XXPortSelectDialog dlgx( this, false, this ); 1113 XXPortSelectDialog dlgx( this, false, this );
1114 if ( dlgx.exec() ) 1114 if ( dlgx.exec() )
1115 uids = dlgx.uids(); 1115 uids = dlgx.uids();
1116 else 1116 else
1117 return; 1117 return;
1118 if ( uids.isEmpty() ) 1118 if ( uids.isEmpty() )
1119 return; 1119 return;
1120 // qDebug("count %d ", uids.count()); 1120 // qDebug("count %d ", uids.count());
1121 1121
1122 1122
1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1124 if ( !dlg.exec() ) { 1124 if ( !dlg.exec() ) {
1125 message( i18n("Setting categories cancelled") ); 1125 message( i18n("Setting categories cancelled") );
1126 return; 1126 return;
1127 } 1127 }
1128 bool merge = false; 1128 bool merge = false;
1129 QString msg = i18n( "Merge with existing categories?" ); 1129 QString msg = i18n( "Merge with existing categories?" );
1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1131 merge = true; 1131 merge = true;
1132 1132
1133 message( i18n("Setting categories ... please wait!") ); 1133 message( i18n("Setting categories ... please wait!") );
1134 QStringList categories = dlg.selectedCategories(); 1134 QStringList categories = dlg.selectedCategories();
1135 1135
1136 //QStringList uids = mViewManager->selectedUids(); 1136 //QStringList uids = mViewManager->selectedUids();
1137 QStringList::Iterator it; 1137 QStringList::Iterator it;
1138 for ( it = uids.begin(); it != uids.end(); ++it ) { 1138 for ( it = uids.begin(); it != uids.end(); ++it ) {
1139 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1139 KABC::Addressee addr = mAddressBook->findByUid( *it );
1140 if ( !addr.isEmpty() ) { 1140 if ( !addr.isEmpty() ) {
1141 if ( !merge ) 1141 if ( !merge )
1142 addr.setCategories( categories ); 1142 addr.setCategories( categories );
1143 else { 1143 else {
1144 QStringList addrCategories = addr.categories(); 1144 QStringList addrCategories = addr.categories();
1145 QStringList::Iterator catIt; 1145 QStringList::Iterator catIt;
1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1147 if ( !addrCategories.contains( *catIt ) ) 1147 if ( !addrCategories.contains( *catIt ) )
1148 addrCategories.append( *catIt ); 1148 addrCategories.append( *catIt );
1149 } 1149 }
1150 addr.setCategories( addrCategories ); 1150 addr.setCategories( addrCategories );
1151 } 1151 }
1152 mAddressBook->insertAddressee( addr ); 1152 mAddressBook->insertAddressee( addr );
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 if ( uids.count() > 0 ) 1156 if ( uids.count() > 0 )
1157 setModified( true ); 1157 setModified( true );
1158 message( i18n("Setting categories completed!") ); 1158 message( i18n("Setting categories completed!") );
1159} 1159}
1160 1160
1161void KABCore::setSearchFields( const KABC::Field::List &fields ) 1161void KABCore::setSearchFields( const KABC::Field::List &fields )
1162{ 1162{
1163 mIncSearchWidget->setFields( fields ); 1163 mIncSearchWidget->setFields( fields );
1164} 1164}
1165 1165
1166void KABCore::incrementalSearch( const QString& text ) 1166void KABCore::incrementalSearch( const QString& text )
1167{ 1167{
1168 QString stext; 1168 QString stext;
1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1170 stext = "*" + text; 1170 stext = "*" + text;
1171 } else { 1171 } else {
1172 stext = text; 1172 stext = text;
1173 } 1173 }
1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1175} 1175}
1176 1176
1177void KABCore::setModified() 1177void KABCore::setModified()
1178{ 1178{
1179 setModified( true ); 1179 setModified( true );
1180} 1180}
1181 1181
1182void KABCore::setModifiedWOrefresh() 1182void KABCore::setModifiedWOrefresh()
1183{ 1183{
1184 // qDebug("KABCore::setModifiedWOrefresh() "); 1184 // qDebug("KABCore::setModifiedWOrefresh() ");
1185 mModified = true; 1185 mModified = true;
1186 mActionSave->setEnabled( mModified ); 1186 mActionSave->setEnabled( mModified );
1187 1187
1188 1188
1189} 1189}
1190void KABCore::setModified( bool modified ) 1190void KABCore::setModified( bool modified )
1191{ 1191{
1192 mModified = modified; 1192 mModified = modified;
1193 mActionSave->setEnabled( mModified ); 1193 mActionSave->setEnabled( mModified );
1194 1194
1195 if ( modified ) 1195 if ( modified )
1196 mJumpButtonBar->recreateButtons(); 1196 mJumpButtonBar->recreateButtons();
1197 1197
1198 mViewManager->refreshView(); 1198 mViewManager->refreshView();
1199 1199
1200} 1200}
1201 1201
1202bool KABCore::modified() const 1202bool KABCore::modified() const
1203{ 1203{
1204 return mModified; 1204 return mModified;
1205} 1205}
1206 1206
1207void KABCore::contactModified( const KABC::Addressee &addr ) 1207void KABCore::contactModified( const KABC::Addressee &addr )
1208{ 1208{
1209 addrModified( addr ); 1209 addrModified( addr );
1210#if 0 // debug only 1210#if 0 // debug only
1211 KABC::Addressee ad = addr; 1211 KABC::Addressee ad = addr;
1212 ad.computeCsum( "123"); 1212 ad.computeCsum( "123");
1213#endif 1213#endif
1214} 1214}
1215 1215
1216void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1216void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1217{ 1217{
1218 1218
1219 Command *command = 0; 1219 Command *command = 0;
1220 QString uid; 1220 QString uid;
1221 1221
1222 // check if it exists already 1222 // check if it exists already
1223 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1223 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1224 if ( origAddr.isEmpty() ) 1224 if ( origAddr.isEmpty() )
1225 command = new PwNewCommand( mAddressBook, addr ); 1225 command = new PwNewCommand( mAddressBook, addr );
1226 else { 1226 else {
1227 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1227 command = new PwEditCommand( mAddressBook, origAddr, addr );
1228 uid = addr.uid(); 1228 uid = addr.uid();
1229 } 1229 }
1230 1230
1231 UndoStack::instance()->push( command ); 1231 UndoStack::instance()->push( command );
1232 RedoStack::instance()->clear(); 1232 RedoStack::instance()->clear();
1233 if ( updateDetails ) 1233 if ( updateDetails )
1234 mDetails->setAddressee( addr ); 1234 mDetails->setAddressee( addr );
1235 setModified( true ); 1235 setModified( true );
1236} 1236}
1237 1237
1238void KABCore::newContact() 1238void KABCore::newContact()
1239{ 1239{
1240 1240
1241 1241
1242 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1242 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1243 1243
1244 QPtrList<KRES::Resource> kresResources; 1244 QPtrList<KRES::Resource> kresResources;
1245 QPtrListIterator<KABC::Resource> it( kabcResources ); 1245 QPtrListIterator<KABC::Resource> it( kabcResources );
1246 KABC::Resource *resource; 1246 KABC::Resource *resource;
1247 while ( ( resource = it.current() ) != 0 ) { 1247 while ( ( resource = it.current() ) != 0 ) {
1248 ++it; 1248 ++it;
1249 if ( !resource->readOnly() ) { 1249 if ( !resource->readOnly() ) {
1250 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1250 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1251 if ( res ) 1251 if ( res )
1252 kresResources.append( res ); 1252 kresResources.append( res );
1253 } 1253 }
1254 } 1254 }
1255 1255
1256 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1256 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1257 resource = static_cast<KABC::Resource*>( res ); 1257 resource = static_cast<KABC::Resource*>( res );
1258 1258
1259 if ( resource ) { 1259 if ( resource ) {
1260 KABC::Addressee addr; 1260 KABC::Addressee addr;
1261 addr.setResource( resource ); 1261 addr.setResource( resource );
1262 mEditorDialog->setAddressee( addr ); 1262 mEditorDialog->setAddressee( addr );
1263 mEditorDialog->setCaption( i18n("Edit new contact"));
1263 KApplication::execDialog ( mEditorDialog ); 1264 KApplication::execDialog ( mEditorDialog );
1264 1265
1265 } else 1266 } else
1266 return; 1267 return;
1267 1268
1268 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1269 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1269 1270
1270 1271
1271} 1272}
1272 1273
1273void KABCore::addEmail( QString aStr ) 1274void KABCore::addEmail( QString aStr )
1274{ 1275{
1275#ifndef KAB_EMBEDDED 1276#ifndef KAB_EMBEDDED
1276 QString fullName, email; 1277 QString fullName, email;
1277 1278
1278 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1279 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1279 1280
1280 // Try to lookup the addressee matching the email address 1281 // Try to lookup the addressee matching the email address
1281 bool found = false; 1282 bool found = false;
1282 QStringList emailList; 1283 QStringList emailList;
1283 KABC::AddressBook::Iterator it; 1284 KABC::AddressBook::Iterator it;
1284 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1285 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1285 emailList = (*it).emails(); 1286 emailList = (*it).emails();
1286 if ( emailList.contains( email ) > 0 ) { 1287 if ( emailList.contains( email ) > 0 ) {
1287 found = true; 1288 found = true;
1288 (*it).setNameFromString( fullName ); 1289 (*it).setNameFromString( fullName );
1289 editContact( (*it).uid() ); 1290 editContact( (*it).uid() );
1290 } 1291 }
1291 } 1292 }
1292 1293
1293 if ( !found ) { 1294 if ( !found ) {
1294 KABC::Addressee addr; 1295 KABC::Addressee addr;
1295 addr.setNameFromString( fullName ); 1296 addr.setNameFromString( fullName );
1296 addr.insertEmail( email, true ); 1297 addr.insertEmail( email, true );
1297 1298
1298 mAddressBook->insertAddressee( addr ); 1299 mAddressBook->insertAddressee( addr );
1299 mViewManager->refreshView( addr.uid() ); 1300 mViewManager->refreshView( addr.uid() );
1300 editContact( addr.uid() ); 1301 editContact( addr.uid() );
1301 } 1302 }
1302#else //KAB_EMBEDDED 1303#else //KAB_EMBEDDED
1303 qDebug("KABCore::addEmail finsih method"); 1304 qDebug("KABCore::addEmail finsih method");
1304#endif //KAB_EMBEDDED 1305#endif //KAB_EMBEDDED
1305} 1306}
1306 1307
1307void KABCore::importVCard( const KURL &url, bool showPreview ) 1308void KABCore::importVCard( const KURL &url, bool showPreview )
1308{ 1309{
1309 mXXPortManager->importVCard( url, showPreview ); 1310 mXXPortManager->importVCard( url, showPreview );
1310} 1311}
1311void KABCore::importFromOL() 1312void KABCore::importFromOL()
1312{ 1313{
1313#ifdef _OL_IMPORT_ 1314#ifdef _OL_IMPORT_
1314 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1315 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1315 idgl->exec(); 1316 idgl->exec();
1316 KABC::Addressee::List list = idgl->getAddressList(); 1317 KABC::Addressee::List list = idgl->getAddressList();
1317 if ( list.count() > 0 ) { 1318 if ( list.count() > 0 ) {
1318 KABC::Addressee::List listNew; 1319 KABC::Addressee::List listNew;
1319 KABC::Addressee::List listExisting; 1320 KABC::Addressee::List listExisting;
1320 KABC::Addressee::List::Iterator it; 1321 KABC::Addressee::List::Iterator it;
1321 KABC::AddressBook::Iterator iter; 1322 KABC::AddressBook::Iterator iter;
1322 for ( it = list.begin(); it != list.end(); ++it ) { 1323 for ( it = list.begin(); it != list.end(); ++it ) {
1323 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1324 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1324 listNew.append( (*it) ); 1325 listNew.append( (*it) );
1325 else 1326 else
1326 listExisting.append( (*it) ); 1327 listExisting.append( (*it) );
1327 } 1328 }
1328 if ( listExisting.count() > 0 ) 1329 if ( listExisting.count() > 0 )
1329 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1330 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1330 if ( listNew.count() > 0 ) { 1331 if ( listNew.count() > 0 ) {
1331 pasteWithNewUid = false; 1332 pasteWithNewUid = false;
1332 pasteContacts( listNew ); 1333 pasteContacts( listNew );
1333 pasteWithNewUid = true; 1334 pasteWithNewUid = true;
1334 } 1335 }
1335 } 1336 }
1336 delete idgl; 1337 delete idgl;
1337#endif 1338#endif
1338} 1339}
1339 1340
1340void KABCore::importVCard( const QString &vCard, bool showPreview ) 1341void KABCore::importVCard( const QString &vCard, bool showPreview )
1341{ 1342{
1342 mXXPortManager->importVCard( vCard, showPreview ); 1343 mXXPortManager->importVCard( vCard, showPreview );
1343} 1344}
1344 1345
1345//US added a second method without defaultparameter 1346//US added a second method without defaultparameter
1346void KABCore::editContact2() { 1347void KABCore::editContact2() {
1347 editContact( QString::null ); 1348 editContact( QString::null );
1348} 1349}
1349 1350
1350void KABCore::editContact( const QString &uid ) 1351void KABCore::editContact( const QString &uid )
1351{ 1352{
1352 1353
1353 if ( mExtensionManager->isQuickEditVisible() ) 1354 if ( mExtensionManager->isQuickEditVisible() )
1354 return; 1355 return;
1355 1356
1356 // First, locate the contact entry 1357 // First, locate the contact entry
1357 QString localUID = uid; 1358 QString localUID = uid;
1358 if ( localUID.isNull() ) { 1359 if ( localUID.isNull() ) {
1359 QStringList uidList = mViewManager->selectedUids(); 1360 QStringList uidList = mViewManager->selectedUids();
1360 if ( uidList.count() > 0 ) 1361 if ( uidList.count() > 0 )
1361 localUID = *( uidList.at( 0 ) ); 1362 localUID = *( uidList.at( 0 ) );
1362 } 1363 }
1363 1364
1364 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1365 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1365 if ( !addr.isEmpty() ) { 1366 if ( !addr.isEmpty() ) {
1366 mEditorDialog->setAddressee( addr ); 1367 mEditorDialog->setAddressee( addr );
1367 KApplication::execDialog ( mEditorDialog ); 1368 KApplication::execDialog ( mEditorDialog );
1368 } 1369 }
1369} 1370}
1370 1371
1371/** 1372/**
1372 Shows or edits the detail view for the given uid. If the uid is QString::null, 1373 Shows or edits the detail view for the given uid. If the uid is QString::null,
1373 the method will try to find a selected addressee in the view. 1374 the method will try to find a selected addressee in the view.
1374 */ 1375 */
1375void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1376void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1376{ 1377{
1377 if ( mMultipleViewsAtOnce ) 1378 if ( mMultipleViewsAtOnce )
1378 { 1379 {
1379 editContact( uid ); 1380 editContact( uid );
1380 } 1381 }
1381 else 1382 else
1382 { 1383 {
1383 setDetailsVisible( true ); 1384 setDetailsVisible( true );
1384 mActionDetails->setChecked(true); 1385 mActionDetails->setChecked(true);
1385 } 1386 }
1386 1387
1387} 1388}
1388 1389
1389void KABCore::save() 1390void KABCore::save()
1390{ 1391{
1391 if (syncManager->blockSave()) 1392 if (syncManager->blockSave())
1392 return; 1393 return;
1393 if ( !mModified ) 1394 if ( !mModified )
1394 return; 1395 return;
1395 1396
1396 syncManager->setBlockSave(true); 1397 syncManager->setBlockSave(true);
1397 QString text = i18n( "There was an error while attempting to save\n the " 1398 QString text = i18n( "There was an error while attempting to save\n the "
1398 "address book. Please check that some \nother application is " 1399 "address book. Please check that some \nother application is "
1399 "not using it. " ); 1400 "not using it. " );
1400 message(i18n("Saving ... please wait! "), false); 1401 message(i18n("Saving ... please wait! "), false);
1401 //qApp->processEvents(); 1402 //qApp->processEvents();
1402#ifndef KAB_EMBEDDED 1403#ifndef KAB_EMBEDDED
1403 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1404 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1404 if ( !b || !b->save() ) { 1405 if ( !b || !b->save() ) {
1405 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1406 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1406 } 1407 }
1407#else //KAB_EMBEDDED 1408#else //KAB_EMBEDDED
1408 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1409 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1409 if ( !b || !b->save() ) { 1410 if ( !b || !b->save() ) {
1410 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1411 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1411 } 1412 }
1412#endif //KAB_EMBEDDED 1413#endif //KAB_EMBEDDED
1413 1414
1414 message(i18n("Addressbook saved!")); 1415 message(i18n("Addressbook saved!"));
1415 setModified( false ); 1416 setModified( false );
1416 syncManager->setBlockSave(false); 1417 syncManager->setBlockSave(false);
1417} 1418}
1418 1419
1419 1420
1420void KABCore::undo() 1421void KABCore::undo()
1421{ 1422{
1422 UndoStack::instance()->undo(); 1423 UndoStack::instance()->undo();
1423 1424
1424 // Refresh the view 1425 // Refresh the view
1425 mViewManager->refreshView(); 1426 mViewManager->refreshView();
1426} 1427}
1427 1428
1428void KABCore::redo() 1429void KABCore::redo()
1429{ 1430{
1430 RedoStack::instance()->redo(); 1431 RedoStack::instance()->redo();
1431 1432
1432 // Refresh the view 1433 // Refresh the view
1433 mViewManager->refreshView(); 1434 mViewManager->refreshView();
1434} 1435}
1435void KABCore::setJumpButtonBar( bool visible ) 1436void KABCore::setJumpButtonBar( bool visible )
1436{ 1437{
1437 setJumpButtonBarVisible(visible ); 1438 setJumpButtonBarVisible(visible );
1438 saveSettings(); 1439 saveSettings();
1439} 1440}
1440void KABCore::setJumpButtonBarVisible( bool visible ) 1441void KABCore::setJumpButtonBarVisible( bool visible )
1441{ 1442{
1442 if (mMultipleViewsAtOnce) 1443 if (mMultipleViewsAtOnce)
1443 { 1444 {
1444 if ( visible ) 1445 if ( visible )
1445 mJumpButtonBar->show(); 1446 mJumpButtonBar->show();
1446 else 1447 else
1447 mJumpButtonBar->hide(); 1448 mJumpButtonBar->hide();
1448 } 1449 }
1449 else 1450 else
1450 { 1451 {
1451 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1452 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1452 if (mViewManager->isVisible()) 1453 if (mViewManager->isVisible())
1453 { 1454 {
1454 if ( visible ) 1455 if ( visible )