summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/imagewidget.cpp25
-rw-r--r--kaddressbook/kabcore.cpp52
-rw-r--r--kaddressbook/xxportselectdialog.cpp48
-rw-r--r--kaddressbook/xxportselectdialog.h1
4 files changed, 87 insertions, 39 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 9ee4eac..1e9743c 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -50,13 +50,13 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
50 : QWidget( parent, name ) 50 : QWidget( parent, name )
51{ 51{
52 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), 52 QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
53 KDialog::spacingHint() ); 53 KDialog::spacingHint() );
54 54
55 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); 55 QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
56 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2, 56 QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
57 KDialog::spacingHint() ); 57 KDialog::spacingHint() );
58 boxLayout->setRowStretch( 2, 1 ); 58 boxLayout->setRowStretch( 2, 1 );
59 59
60 mPhotoLabel = new QLabel( photoBox ); 60 mPhotoLabel = new QLabel( photoBox );
61 int fac = 9; 61 int fac = 9;
62 if ( QApplication::desktop()->width() > 320 ) 62 if ( QApplication::desktop()->width() > 320 )
@@ -72,26 +72,25 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
72#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
73//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); 73//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
74#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
75 75
76 76
77 boxLayout->addWidget( mPhotoUrl, 0, 1 ); 77 boxLayout->addWidget( mPhotoUrl, 0, 1 );
78 78 QHBox *hb1 = new QHBox ( photoBox );
79 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox ); 79 mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 );
80 mUsePhotoUrl->setEnabled( false ); 80 mUsePhotoUrl->setEnabled( false );
81 boxLayout->addWidget( mUsePhotoUrl, 1, 1 ); 81 boxLayout->addWidget( hb1, 1, 1 );
82 82
83 QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox ); 83 QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 );
84 connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); 84 connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
85 boxLayout->addWidget( pb, 2, 1 ); 85 boxLayout->addWidget( new QLabel( photoBox ), 2, 1 );
86 boxLayout->addWidget( new QLabel( photoBox ), 3, 1 );
87 86
88 topLayout->addWidget( photoBox, 0, 0 ); 87 topLayout->addWidget( photoBox, 0, 0 );
89 88
90 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); 89 QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
91 boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() ); 90 boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
92 boxLayout->setRowStretch( 2, 1 ); 91 boxLayout->setRowStretch( 2, 1 );
93 92
94 mLogoLabel = new QLabel( logoBox ); 93 mLogoLabel = new QLabel( logoBox );
95 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); 94 mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
96 mLogoLabel->setScaledContents( true ); 95 mLogoLabel->setScaledContents( true );
97 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 96 mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
@@ -102,20 +101,20 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
102 mLogoUrl->setFilter( KImageIO::pattern() ); 101 mLogoUrl->setFilter( KImageIO::pattern() );
103#else //KAB_EMBEDDED 102#else //KAB_EMBEDDED
104//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); 103//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
105#endif //KAB_EMBEDDED 104#endif //KAB_EMBEDDED
106 boxLayout->addWidget( mLogoUrl, 0, 1 ); 105 boxLayout->addWidget( mLogoUrl, 0, 1 );
107 106
108 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox ); 107 QHBox *hb2 = new QHBox ( logoBox );
108 mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 );
109 mUseLogoUrl->setEnabled( false ); 109 mUseLogoUrl->setEnabled( false );
110 boxLayout->addWidget( mUseLogoUrl, 1, 1 ); 110 boxLayout->addWidget( hb2, 1, 1 );
111 111
112 pb = new QPushButton( i18n( "Remove" ), logoBox ); 112 pb = new QPushButton( i18n( "Remove" ), hb2 );
113 connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); 113 connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
114 boxLayout->addWidget( pb, 2, 1 ); 114 boxLayout->addWidget( new QLabel( logoBox ), 2, 1 );
115 boxLayout->addWidget( new QLabel( logoBox ), 3, 1 );
116 topLayout->addWidget( logoBox, 1, 0 ); 115 topLayout->addWidget( logoBox, 1, 0 );
117 116
118 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), 117 connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
119 SIGNAL( changed() ) ); 118 SIGNAL( changed() ) );
120 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), 119 connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
121 SLOT( loadPhoto() ) ); 120 SLOT( loadPhoto() ) );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9526f23..d393660 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -222,13 +222,14 @@ class KABFormatPrefs : public QDialog
222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
223 lay->addWidget( ok ); 223 lay->addWidget( ok );
224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
225 lay->addWidget( cancel ); 225 lay->addWidget( cancel );
226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
228 resize( 200, 200 ); 228 //resize( 200, 200 );
229
229 } 230 }
230public: 231public:
231 QRadioButton* simple, *full, *reverse, *company; 232 QRadioButton* simple, *full, *reverse, *company;
232 QCheckBox* setCompany; 233 QCheckBox* setCompany;
233}; 234};
234 235
@@ -1370,13 +1371,14 @@ void KABCore::save()
1370 return; 1371 return;
1371 1372
1372 syncManager->setBlockSave(true); 1373 syncManager->setBlockSave(true);
1373 QString text = i18n( "There was an error while attempting to save\n the " 1374 QString text = i18n( "There was an error while attempting to save\n the "
1374 "address book. Please check that some \nother application is " 1375 "address book. Please check that some \nother application is "
1375 "not using it. " ); 1376 "not using it. " );
1376 message(i18n("Saving addressbook ... ")); 1377 message(i18n("Saving ... please wait! "));
1378 qApp->processEvents();
1377#ifndef KAB_EMBEDDED 1379#ifndef KAB_EMBEDDED
1378 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1379 if ( !b || !b->save() ) { 1381 if ( !b || !b->save() ) {
1380 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1381 } 1383 }
1382#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
@@ -2360,37 +2362,43 @@ void KABCore::removeVoice()
2360void KABCore::setFormattedName() 2362void KABCore::setFormattedName()
2361{ 2363{
2362 KABFormatPrefs setpref; 2364 KABFormatPrefs setpref;
2363 if ( !setpref.exec() ) { 2365 if ( !setpref.exec() ) {
2364 return; 2366 return;
2365 } 2367 }
2366 KABC::Addressee::List list;
2367 XXPortSelectDialog dlg( this, false, this ); 2368 XXPortSelectDialog dlg( this, false, this );
2368 if ( dlg.exec() ) 2369 if ( !dlg.exec() )
2369 list = dlg.contacts();
2370 else
2371 return; 2370 return;
2372 KABC::Addressee::List::Iterator it; 2371 mAddressBook->setUntagged();
2373 for ( it = list.begin(); it != list.end(); ++it ) { 2372 dlg.tagSelected();
2374 QString fName; 2373 int count = 0;
2375 if ( setpref.simple->isChecked() ) 2374 KABC::AddressBook::Iterator it;
2376 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2375 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2377 else if ( setpref.full->isChecked() ) 2376 if ( (*it).tagged() ) {
2378 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2377 message(i18n("Changing contact #%1").arg( ++count ) );
2379 else if ( setpref.reverse->isChecked() ) 2378 qApp->processEvents();
2380 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2379 QString fName;
2381 else 2380 if ( setpref.simple->isChecked() )
2382 fName = (*it).organization(); 2381 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2383 if ( setpref.setCompany->isChecked() ) 2382 else if ( setpref.full->isChecked() )
2384 if ( fName.isEmpty() || fName =="," ) 2383 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2384 else if ( setpref.reverse->isChecked() )
2385 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2386 else
2385 fName = (*it).organization(); 2387 fName = (*it).organization();
2386 (*it).setFormattedName( fName ); 2388 if ( setpref.setCompany->isChecked() )
2387 addrModified((*it),false ); 2389 if ( fName.isEmpty() || fName =="," )
2390 fName = (*it).organization();
2391 (*it).setFormattedName( fName );
2392 }
2388 } 2393 }
2394 message(i18n("Refreshing view...") );
2395 mViewManager->refreshView( "" );
2389 Addressee add; 2396 Addressee add;
2390 mDetails->setAddressee( add ); 2397 mDetails->setAddressee( add );
2398 message(i18n("Setting formatted name completed!") );
2391} 2399}
2392 2400
2393void KABCore::clipboardDataChanged() 2401void KABCore::clipboardDataChanged()
2394{ 2402{
2395 2403
2396 if ( mReadWrite ) 2404 if ( mReadWrite )
@@ -3203,13 +3211,13 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3203 return syncOK; 3211 return syncOK;
3204 3212
3205} 3213}
3206void KABCore::message( QString m ) 3214void KABCore::message( QString m )
3207{ 3215{
3208 topLevelWidget()->setCaption( m ); 3216 topLevelWidget()->setCaption( m );
3209 mMessageTimer->start( 15000, true ); 3217 mMessageTimer->start( 20000, true );
3210} 3218}
3211bool KABCore::syncPhone() 3219bool KABCore::syncPhone()
3212{ 3220{
3213 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3221 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3214 QString fileName = getPhoneFile(); 3222 QString fileName = getPhoneFile();
3215 if ( !PhoneAccess::readFromPhone( fileName) ) { 3223 if ( !PhoneAccess::readFromPhone( fileName) ) {
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index 6282453..e7bc8c0 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -51,13 +51,13 @@ $Id$
51#include "kabprefs.h" 51#include "kabprefs.h"
52 52
53#include "xxportselectdialog.h" 53#include "xxportselectdialog.h"
54 54
55XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 55XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
56 QWidget* parent, const char* name ) 56 QWidget* parent, const char* name )
57 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, 57 : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel,
58 Ok, parent, name, true, true ), mCore( core ), 58 Ok, parent, name, true, true ), mCore( core ),
59 mUseSorting( sort ) 59 mUseSorting( sort )
60{ 60{
61 initGUI(); 61 initGUI();
62 62
63 connect( mFiltersCombo, SIGNAL( activated( int ) ), 63 connect( mFiltersCombo, SIGNAL( activated( int ) ),
@@ -106,19 +106,59 @@ QStringList XXPortSelectDialog::uids()
106 KABC::AddresseeList list = contacts(); 106 KABC::AddresseeList list = contacts();
107 KABC::Addressee::List::Iterator it; 107 KABC::Addressee::List::Iterator it;
108 for ( it = list.begin(); it != list.end(); ++it ) 108 for ( it = list.begin(); it != list.end(); ++it )
109 uidlist.append((*it).uid()); 109 uidlist.append((*it).uid());
110 return uidlist; 110 return uidlist;
111} 111}
112void XXPortSelectDialog::tagSelected()
113{
114 if ( mUseSelection->isChecked() ) {
115
116 QStringList selection = mCore->selectedUIDs();
117 KABC::AddressBook::Iterator it;
118 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
119 if ( selection.findIndex((*it).uid()) >= 0 )
120 (*it).setTagged( true );
121 }
122 } else if ( mUseFilters->isChecked() ) {
123 // find contacts that can pass selected filter
124 Filter::List::Iterator filterIt;
125 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
126 if ( (*filterIt).name() == mFiltersCombo->currentText() )
127 break;
128 KABC::AddressBook::Iterator it;
129 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
130 if ( (*filterIt).filterAddressee( *it ) )
131 (*it).setTagged( true );
132 }
133 } else if ( mUseCategories->isChecked() ) {
134 QStringList categorieList = categories();
135 KABC::AddressBook::Iterator it;
136 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
137 QStringList tmp( (*it).categories() );
138 QStringList::Iterator tmpIt;
139 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
140 if ( categorieList.contains( *tmpIt ) ) {
141 (*it).setTagged( true );
142 break;
143 }
144 }
145 } else {
146 // create a string list of all entries:
147 KABC::AddressBook::Iterator it;
148 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
149 (*it).setTagged( true );
150 }
151}
112KABC::AddresseeList XXPortSelectDialog::contacts() 152KABC::AddresseeList XXPortSelectDialog::contacts()
113{ 153{
114 QStringList selection = mCore->selectedUIDs();
115 154
116 KABC::AddresseeList list; 155 KABC::AddresseeList list;
117 if ( mUseSelection->isChecked() ) { 156 if ( mUseSelection->isChecked() ) {
118 QStringList::Iterator it; 157 QStringList::Iterator it;
158 QStringList selection = mCore->selectedUIDs();
119 for ( it = selection.begin(); it != selection.end(); ++it ) { 159 for ( it = selection.begin(); it != selection.end(); ++it ) {
120 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 160 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
121 if ( !addr.isEmpty() ) 161 if ( !addr.isEmpty() )
122 list.append( addr ); 162 list.append( addr );
123 } 163 }
124 } else if ( mUseFilters->isChecked() ) { 164 } else if ( mUseFilters->isChecked() ) {
@@ -243,14 +283,14 @@ void XXPortSelectDialog::initGUI()
243 mCategoriesView = new QListView( mButtonGroup ); 283 mCategoriesView = new QListView( mButtonGroup );
244 mCategoriesView->addColumn( "" ); 284 mCategoriesView->addColumn( "" );
245 mCategoriesView->header()->hide(); 285 mCategoriesView->header()->hide();
246 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); 286 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
247 groupLayout->addWidget( mCategoriesView, 3, 1 ); 287 groupLayout->addWidget( mCategoriesView, 3, 1 );
248 288
249 // if (QApplication::desktop()->height() == 480 ) 289 if (QApplication::desktop()->height() == 480 )
250 // mCategoriesView->setMaximumHeight( 240 ); 290 mCategoriesView->setMaximumHeight( 240 );
251 topLayout->addWidget( mButtonGroup ); 291 topLayout->addWidget( mButtonGroup );
252 292
253 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); 293 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
254 sortingGroup->setColumnLayout( 0, Qt::Vertical ); 294 sortingGroup->setColumnLayout( 0, Qt::Vertical );
255 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, 295 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
256 KDialog::spacingHint() ); 296 KDialog::spacingHint() );
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h
index 3bb696f..28b1fef 100644
--- a/kaddressbook/xxportselectdialog.h
+++ b/kaddressbook/xxportselectdialog.h
@@ -45,12 +45,13 @@ class XXPortSelectDialog : public KDialogBase
45 45
46 public: 46 public:
47 XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, 47 XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent,
48 const char* name = 0 ); 48 const char* name = 0 );
49 49
50 KABC::AddresseeList contacts(); 50 KABC::AddresseeList contacts();
51 void tagSelected();
51 QStringList uids(); 52 QStringList uids();
52 53
53 private slots: 54 private slots:
54 void filterChanged( int ); 55 void filterChanged( int );
55 void categoryClicked( QListViewItem * i ); 56 void categoryClicked( QListViewItem * i );
56 57