summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/imagewidget.cpp25
-rw-r--r--kaddressbook/kabcore.cpp28
-rw-r--r--kaddressbook/xxportselectdialog.cpp48
-rw-r--r--kaddressbook/xxportselectdialog.h1
4 files changed, 75 insertions, 27 deletions
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 9ee4eac..1e9743c 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -1,211 +1,210 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/picture.h>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#include <kio/netaccess.h>
#include <kimageio.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kurlrequester.h>
#include <kurl.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qapplication.h>
#include "imagewidget.h"
ImageWidget::ImageWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
KDialog::spacingHint() );
QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
- QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 4, 2,
+ QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
KDialog::spacingHint() );
boxLayout->setRowStretch( 2, 1 );
mPhotoLabel = new QLabel( photoBox );
int fac = 9;
if ( QApplication::desktop()->width() > 320 )
fac = 6;
mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
mPhotoLabel->setScaledContents( true );
mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 );
mPhotoUrl = new KURLRequester( photoBox );
#ifndef KAB_EMBEDDED
mPhotoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mPhotoUrl, 0, 1 );
-
- mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), photoBox );
+ QHBox *hb1 = new QHBox ( photoBox );
+ mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 );
mUsePhotoUrl->setEnabled( false );
- boxLayout->addWidget( mUsePhotoUrl, 1, 1 );
+ boxLayout->addWidget( hb1, 1, 1 );
- QPushButton * pb = new QPushButton( i18n( "Remove" ), photoBox );
+ QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
- boxLayout->addWidget( pb, 2, 1 );
- boxLayout->addWidget( new QLabel( photoBox ), 3, 1 );
+ boxLayout->addWidget( new QLabel( photoBox ), 2, 1 );
topLayout->addWidget( photoBox, 0, 0 );
QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
- boxLayout = new QGridLayout( logoBox->layout(), 4, 2, KDialog::spacingHint() );
+ boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
boxLayout->setRowStretch( 2, 1 );
mLogoLabel = new QLabel( logoBox );
mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
mLogoLabel->setScaledContents( true );
mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 );
mLogoUrl = new KURLRequester( logoBox );
#ifndef KAB_EMBEDDED
mLogoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mLogoUrl, 0, 1 );
- mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), logoBox );
+ QHBox *hb2 = new QHBox ( logoBox );
+ mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 );
mUseLogoUrl->setEnabled( false );
- boxLayout->addWidget( mUseLogoUrl, 1, 1 );
+ boxLayout->addWidget( hb2, 1, 1 );
- pb = new QPushButton( i18n( "Remove" ), logoBox );
+ pb = new QPushButton( i18n( "Remove" ), hb2 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
- boxLayout->addWidget( pb, 2, 1 );
- boxLayout->addWidget( new QLabel( logoBox ), 3, 1 );
+ boxLayout->addWidget( new QLabel( logoBox ), 2, 1 );
topLayout->addWidget( logoBox, 1, 0 );
connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadPhoto() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadLogo() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#endif //KAB_EMBEDDED
}
ImageWidget::~ImageWidget()
{
}
void ImageWidget::setPhoto( const KABC::Picture &photo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( photo.isIntern() ) {
//US
//US mPhotoLabel->setPixmap( photo.data() );
if (photo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(photo.data());
mPhotoLabel->setPixmap( pm );
}
mUsePhotoUrl->setChecked( false );
} else {
mPhotoUrl->setURL( photo.url() );
if ( !photo.url().isEmpty() )
mUsePhotoUrl->setChecked( true );
loadPhoto();
}
blockSignals( blocked );
}
KABC::Picture ImageWidget::photo() const
{
KABC::Picture photo;
if ( mUsePhotoUrl->isChecked() )
photo.setUrl( mPhotoUrl->url() );
else {
QPixmap *px = mPhotoLabel->pixmap();
if ( px ) {
#ifndef KAB_EMBEDDED
if ( px->height() > px->width() )
photo.setData( px->convertToImage().scaleHeight( 140 ) );
else
photo.setData( px->convertToImage().scaleWidth( 100 ) );
#else //KAB_EMBEDDED
//US add teh nullcheck
if (px->isNull() != true )
photo.setData( px->convertToImage() );
#endif //KAB_EMBEDDED
photo.setType( "PNG" );
}
}
return photo;
}
void ImageWidget::setLogo( const KABC::Picture &logo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( logo.isIntern() ) {
//US
//US mLogoLabel->setPixmap( logo.data() );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9526f23..d393660 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -132,193 +132,194 @@ $Id$
#include <qlayout.h>
#include <qclipboard.h>
#include <qtextstream.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/categoryeditdialog.h>
#include <kabc/vcardconverter.h>
#include "addresseeutil.h"
#include "undocmds.h"
#include "addresseeeditordialog.h"
#include "viewmanager.h"
#include "details/detailsviewcontainer.h"
#include "kabprefs.h"
#include "xxportmanager.h"
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
#include "nameeditdialog.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
#include "kaimportoldialog.h"
#else
#include <unistd.h>
#endif
// sync includes
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/ksyncprefsdialog.h>
class KABCatPrefs : public QDialog
{
public:
KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Manage new Categories") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
lay->addWidget( lab );
QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
addCatBut = new QRadioButton(i18n("Add to category list"), format );
new QRadioButton(i18n("Remove from addressees"), format );
addCatBut->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
bool addCat() { return addCatBut->isChecked(); }
private:
QRadioButton* addCatBut;
};
class KABFormatPrefs : public QDialog
{
public:
KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Set formatted name") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
lay->addWidget( lab );
QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
simple = new QRadioButton(i18n("Simple: James Bond"), format );
full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
company = new QRadioButton(i18n("Organization: MI6"), format );
simple->setChecked( true );
setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
lay->addWidget( setCompany );
QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
- resize( 200, 200 );
+ //resize( 200, 200 );
+
}
public:
QRadioButton* simple, *full, *reverse, *company;
QCheckBox* setCompany;
};
class KAex2phonePrefs : public QDialog
{
public:
KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Export to phone options") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel *lab;
lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
lab->setAlignment (AlignHCenter );
QHBox* temphb;
temphb = new QHBox( this );
new QLabel( i18n("I/O device: "), temphb );
mPhoneDevice = new QLineEdit( temphb);
lay->addWidget( temphb );
temphb = new QHBox( this );
new QLabel( i18n("Connection: "), temphb );
mPhoneConnection = new QLineEdit( temphb);
lay->addWidget( temphb );
temphb = new QHBox( this );
new QLabel( i18n("Model(opt.): "), temphb );
mPhoneModel = new QLineEdit( temphb);
lay->addWidget( temphb );
// mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
// lay->addWidget( mWriteToSim );
lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
lab->setAlignment (AlignHCenter);
QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 220, 240 );
}
public:
QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
QCheckBox* mWriteToSim;
};
bool pasteWithNewUid = true;
#ifdef KAB_EMBEDDED
KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
#else //KAB_EMBEDDED
KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
mMiniSplitter = 0;
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
mAddressBook = KABC::StdAddressBook::self();
KABC::StdAddressBook::setAutomaticSave( false );
#ifndef KAB_EMBEDDED
mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
#endif //KAB_EMBEDDED
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
SLOT( addressBookChanged() ) );
#if 0
// LP moved to addressbook init method
mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
"X-Department", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
"X-Profession", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
"X-AssistantsName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
"X-ManagersName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
"X-SpousesName", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
@@ -1280,193 +1281,194 @@ void KABCore::addEmail( QString aStr )
#endif //KAB_EMBEDDED
}
void KABCore::importVCard( const KURL &url, bool showPreview )
{
mXXPortManager->importVCard( url, showPreview );
}
void KABCore::importFromOL()
{
#ifdef _WIN32_
KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
idgl->exec();
KABC::Addressee::List list = idgl->getAddressList();
if ( list.count() > 0 ) {
KABC::Addressee::List listNew;
KABC::Addressee::List listExisting;
KABC::Addressee::List::Iterator it;
KABC::AddressBook::Iterator iter;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
listNew.append( (*it) );
else
listExisting.append( (*it) );
}
if ( listExisting.count() > 0 )
KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
if ( listNew.count() > 0 ) {
pasteWithNewUid = false;
pasteContacts( listNew );
pasteWithNewUid = true;
}
}
delete idgl;
#endif
}
void KABCore::importVCard( const QString &vCard, bool showPreview )
{
mXXPortManager->importVCard( vCard, showPreview );
}
//US added a second method without defaultparameter
void KABCore::editContact2() {
editContact( QString::null );
}
void KABCore::editContact( const QString &uid )
{
if ( mExtensionManager->isQuickEditVisible() )
return;
// First, locate the contact entry
QString localUID = uid;
if ( localUID.isNull() ) {
QStringList uidList = mViewManager->selectedUids();
if ( uidList.count() > 0 )
localUID = *( uidList.at( 0 ) );
}
KABC::Addressee addr = mAddressBook->findByUid( localUID );
if ( !addr.isEmpty() ) {
mEditorDialog->setAddressee( addr );
KApplication::execDialog ( mEditorDialog );
}
}
/**
Shows or edits the detail view for the given uid. If the uid is QString::null,
the method will try to find a selected addressee in the view.
*/
void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
{
if ( mMultipleViewsAtOnce )
{
editContact( uid );
}
else
{
setDetailsVisible( true );
mActionDetails->setChecked(true);
}
}
void KABCore::save()
{
if (syncManager->blockSave())
return;
if ( !mModified )
return;
syncManager->setBlockSave(true);
QString text = i18n( "There was an error while attempting to save\n the "
"address book. Please check that some \nother application is "
"not using it. " );
- message(i18n("Saving addressbook ... "));
+ message(i18n("Saving ... please wait! "));
+ qApp->processEvents();
#ifndef KAB_EMBEDDED
KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
if ( !b || !b->save() ) {
KMessageBox::error( this, text, i18n( "Unable to Save" ) );
}
#else //KAB_EMBEDDED
KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
if ( !b || !b->save() ) {
QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
}
#endif //KAB_EMBEDDED
message(i18n("Addressbook saved!"));
setModified( false );
syncManager->setBlockSave(false);
}
void KABCore::undo()
{
UndoStack::instance()->undo();
// Refresh the view
mViewManager->refreshView();
}
void KABCore::redo()
{
RedoStack::instance()->redo();
// Refresh the view
mViewManager->refreshView();
}
void KABCore::setJumpButtonBarVisible( bool visible )
{
if (mMultipleViewsAtOnce)
{
if ( visible )
mJumpButtonBar->show();
else
mJumpButtonBar->hide();
}
else
{
// show the jumpbar only if "the details are hidden" == "viewmanager are shown"
if (mViewManager->isVisible())
{
if ( visible )
mJumpButtonBar->show();
else
mJumpButtonBar->hide();
}
else
{
mJumpButtonBar->hide();
}
}
}
void KABCore::setDetailsToState()
{
setDetailsVisible( mActionDetails->isChecked() );
}
void KABCore::setDetailsToggle()
{
mActionDetails->setChecked( !mActionDetails->isChecked() );
setDetailsToState();
}
void KABCore::setDetailsVisible( bool visible )
{
if (visible && mDetails->isHidden())
{
KABC::Addressee::List addrList = mViewManager->selectedAddressees();
if ( addrList.count() > 0 )
mDetails->setAddressee( addrList[ 0 ] );
}
// mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
// the listview and the detailview. We do that by changing the splitbar size.
if (mMultipleViewsAtOnce)
{
if ( visible )
mDetails->show();
else
mDetails->hide();
}
else
{
if ( visible ) {
mViewManager->hide();
mDetails->show();
@@ -2270,217 +2272,223 @@ void KABCore::addActionsManually()
*/
#endif //KAB_EMBEDDED
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::manageCategories( )
{
KABCatPrefs* cp = new KABCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
message( i18n("Please wait, processing categories..."));
if ( cp->addCat() ) {
KABC::AddressBook::Iterator it;
QStringList catList = KABPrefs::instance()->mCustomCategories;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
QStringList catIncList = (*it).categories();
int i;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
++count;
}
}
}
catList.sort();
KABPrefs::instance()->mCustomCategories = catList;
KABPrefs::instance()->writeConfig();
message(QString::number( count )+ i18n(" categories added to list! "));
} else {
QStringList catList = KABPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
KABC::AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
QStringList catIncList = (*it).categories();
int i;
if ( catIncList.count() ) {
newCatList.clear();
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i])) {
newCatList.append( catIncList[i] );
}
}
newCatList.sort();
(*it).setCategories( newCatList );
mAddressBook->insertAddressee( (*it) );
}
}
setModified( true );
mViewManager->refreshView();
message( i18n("Removing categories done!"));
}
delete cp;
}
void KABCore::removeVoice()
{
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 )
return;
KABC::Addressee::List list;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
list = dlg.contacts();
else
return;
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).removeVoice() )
addrModified((*it), false );
}
}
void KABCore::setFormattedName()
{
KABFormatPrefs setpref;
if ( !setpref.exec() ) {
return;
}
- KABC::Addressee::List list;
XXPortSelectDialog dlg( this, false, this );
- if ( dlg.exec() )
- list = dlg.contacts();
- else
+ if ( !dlg.exec() )
return;
- KABC::Addressee::List::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it ) {
+ mAddressBook->setUntagged();
+ dlg.tagSelected();
+ int count = 0;
+ KABC::AddressBook::Iterator it;
+ for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
+ if ( (*it).tagged() ) {
+ message(i18n("Changing contact #%1").arg( ++count ) );
+ qApp->processEvents();
QString fName;
if ( setpref.simple->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
else if ( setpref.full->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
else if ( setpref.reverse->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
else
fName = (*it).organization();
if ( setpref.setCompany->isChecked() )
if ( fName.isEmpty() || fName =="," )
fName = (*it).organization();
(*it).setFormattedName( fName );
- addrModified((*it),false );
}
+ }
+ message(i18n("Refreshing view...") );
+ mViewManager->refreshView( "" );
Addressee add;
mDetails->setAddressee( add );
+ message(i18n("Setting formatted name completed!") );
}
void KABCore::clipboardDataChanged()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
if ( undo->isEmpty() )
mActionUndo->setText( i18n( "Undo" ) );
else
mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
mActionUndo->setEnabled( !undo->isEmpty() );
if ( !redo->top() )
mActionRedo->setText( i18n( "Redo" ) );
else
mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
mActionRedo->setEnabled( !redo->isEmpty() );
}
void KABCore::configureKeyBindings()
{
#ifndef KAB_EMBEDDED
KKeyDialog::configure( actionCollection(), true );
#else //KAB_EMBEDDED
qDebug("KABCore::configureKeyBindings() not implemented");
#endif //KAB_EMBEDDED
}
#ifdef KAB_EMBEDDED
void KABCore::configureResources()
{
KRES::KCMKResources dlg( this, "" , 0 );
if ( !dlg.exec() )
return;
KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
QStringList nameList;
QStringList emailList;
QStringList uidList;
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++)
{
nameList.append(list[i].realName());
emailList.append(list[i].preferredEmail());
uidList.append(list[i].uid());
}
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
}
/* this method will be called through the QCop interface from Ko/Pi to select birthdays
* to put them into the calendar.
*/
void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
{
// qDebug("KABCore::requestForBirthdayList");
QStringList birthdayList;
QStringList anniversaryList;
QStringList realNameList;
QStringList preferredEmailList;
QStringList assembledNameList;
QStringList uidList;
KABC::AddressBook::Iterator it;
int count = 0;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
++count;
}
QProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
@@ -3113,164 +3121,164 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
AddressBook abLocal(filename,"syncContact");
bool syncOK = false;
if ( abLocal.load() ) {
qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
bool external = false;
bool isXML = false;
if ( filename.right(4) == ".xml") {
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
isXML = true;
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
} else {
external = !manager->mIsKapiFile;
if ( external ) {
qDebug("Setting vcf mode to external ");
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
AddressBook::Iterator it;
for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
(*it).setID( mCurrentSyncDevice, (*it).uid() );
(*it).computeCsum( mCurrentSyncDevice );
}
}
}
//AddressBook::Iterator it;
//QStringList vcards;
//for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
// qDebug("Name %s ", (*it).familyName().latin1());
//}
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
if ( syncOK ) {
if ( syncManager->mWriteBackFile )
{
if ( external )
abLocal.removeSyncAddressees( !isXML);
qDebug("Saving remote AB ");
if ( ! abLocal.saveAB())
qDebug("Error writing back AB to file ");
if ( external ) {
// afterwrite processing
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
}
}
}
setModified();
}
abLocal.removeResources();
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
void KABCore::removeSyncInfo( QString syncProfile)
{
qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
mAddressBook->removeSyncInfo( syncProfile );
setModified();
}
//this is a overwritten callbackmethods from the syncinterface
bool KABCore::syncExternal(KSyncManager* manager, QString resource)
{
if ( resource == "phone" )
return syncPhone();
disableBR( true );
if ( manager != syncManager )
qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
AddressBook abLocal( resource,"syncContact");
bool syncOK = false;
if ( abLocal.load() ) {
qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
abLocal.removeSyncAddressees( false );
abLocal.saveAB();
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
}
} else
message( i18n("Sync cancelled or failed.") );
setModified();
}
abLocal.removeResources();
if ( syncOK )
mViewManager->refreshView();
disableBR( false );
return syncOK;
}
void KABCore::message( QString m )
{
topLevelWidget()->setCaption( m );
- mMessageTimer->start( 15000, true );
+ mMessageTimer->start( 20000, true );
}
bool KABCore::syncPhone()
{
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
QString fileName = getPhoneFile();
if ( !PhoneAccess::readFromPhone( fileName) ) {
message(i18n("Phone access failed!"));
return false;
}
AddressBook abLocal( fileName,"syncContact");
bool syncOK = false;
{
abLocal.importFromFile( fileName );
qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
abLocal.preparePhoneSync( mCurrentSyncDevice, true );
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
abLocal.removeSyncAddressees( true );
abLocal.saveABphone( fileName );
abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
//abLocal.preparePhoneSync( mCurrentSyncDevice, false );
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
}
}
setModified();
}
abLocal.removeResources();
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
void KABCore::getFile( bool success )
{
if ( ! success ) {
message( i18n("Error receiving file. Nothing changed!") );
return;
}
int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
if ( count )
setModified( true );
message( i18n("Pi-Sync successful!") );
mViewManager->refreshView();
}
void KABCore::syncFileRequest()
{
if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
syncManager->slotSyncMenu( 999 );
}
mAddressBook->export2File( sentSyncFile() );
}
QString KABCore::sentSyncFile()
{
#ifdef DESKTOP_VERSION
return locateLocal( "tmp", "copysyncab.vcf" );
#else
return QString( "/tmp/copysyncab.vcf" );
#endif
}
void KABCore::setCaptionBack()
{
mMessageTimer->stop();
topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
}
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index 6282453..e7bc8c0 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,294 +1,334 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kabc/addressbook.h>
#include <kapplication.h>
#include <kcombobox.h>
#include <klocale.h>
#include <kglobal.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qstringlist.h>
#include <qwhatsthis.h>
#include "kabcore.h"
#include "kabprefs.h"
#include "xxportselectdialog.h"
XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
QWidget* parent, const char* name )
- : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel,
+ : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel,
Ok, parent, name, true, true ), mCore( core ),
mUseSorting( sort )
{
initGUI();
connect( mFiltersCombo, SIGNAL( activated( int ) ),
SLOT( filterChanged( int ) ) );
connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
SLOT( categoryClicked( QListViewItem* ) ) );
// setup filters
#ifndef KAB_EMBEDDED
mFilters = Filter::restore( kapp->config(), "Filter" );
Filter::List::iterator filterIt;
#else //KAB_EMBEDDED
mFilters = Filter::restore( KGlobal::config(), "Filter" );
Filter::List::Iterator filterIt;
#endif //KAB_EMBEDDED
QStringList filters;
for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
filters.append( (*filterIt).name() );
mFiltersCombo->insertStringList( filters );
mUseFilters->setEnabled( filters.count() > 0 );
// setup categories
QStringList categories = KABPrefs::instance()->mCustomCategories;
QStringList::Iterator it;
for ( it = categories.begin(); it != categories.end(); ++it )
new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
mUseCategories->setEnabled( categories.count() > 0 );
int count = mCore->selectedUIDs().count();
mUseSelection->setEnabled( count != 0 );
mUseSelection->setChecked( count > 1 );
mSortTypeCombo->insertItem( i18n( "Ascending" ) );
mSortTypeCombo->insertItem( i18n( "Descending" ) );
mFields = mCore->addressBook()->fields( KABC::Field::All );
KABC::Field::List::Iterator fieldIt;
for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
mFieldCombo->insertItem( (*fieldIt)->label() );
}
QStringList XXPortSelectDialog::uids()
{
QStringList uidlist;
KABC::AddresseeList list = contacts();
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
uidlist.append((*it).uid());
return uidlist;
}
-KABC::AddresseeList XXPortSelectDialog::contacts()
+void XXPortSelectDialog::tagSelected()
{
+ if ( mUseSelection->isChecked() ) {
+
QStringList selection = mCore->selectedUIDs();
+ KABC::AddressBook::Iterator it;
+ for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
+ if ( selection.findIndex((*it).uid()) >= 0 )
+ (*it).setTagged( true );
+ }
+ } else if ( mUseFilters->isChecked() ) {
+ // find contacts that can pass selected filter
+ Filter::List::Iterator filterIt;
+ for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
+ if ( (*filterIt).name() == mFiltersCombo->currentText() )
+ break;
+ KABC::AddressBook::Iterator it;
+ for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
+ if ( (*filterIt).filterAddressee( *it ) )
+ (*it).setTagged( true );
+ }
+ } else if ( mUseCategories->isChecked() ) {
+ QStringList categorieList = categories();
+ KABC::AddressBook::Iterator it;
+ for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
+ QStringList tmp( (*it).categories() );
+ QStringList::Iterator tmpIt;
+ for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
+ if ( categorieList.contains( *tmpIt ) ) {
+ (*it).setTagged( true );
+ break;
+ }
+ }
+ } else {
+ // create a string list of all entries:
+ KABC::AddressBook::Iterator it;
+ for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
+ (*it).setTagged( true );
+ }
+}
+KABC::AddresseeList XXPortSelectDialog::contacts()
+{
KABC::AddresseeList list;
if ( mUseSelection->isChecked() ) {
QStringList::Iterator it;
+ QStringList selection = mCore->selectedUIDs();
for ( it = selection.begin(); it != selection.end(); ++it ) {
KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
if ( !addr.isEmpty() )
list.append( addr );
}
} else if ( mUseFilters->isChecked() ) {
// find contacts that can pass selected filter
Filter::List::Iterator filterIt;
for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
if ( (*filterIt).name() == mFiltersCombo->currentText() )
break;
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
if ( (*filterIt).filterAddressee( *it ) )
list.append( *it );
}
} else if ( mUseCategories->isChecked() ) {
QStringList categorieList = categories();
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
QStringList tmp( (*it).categories() );
QStringList::Iterator tmpIt;
for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
if ( categorieList.contains( *tmpIt ) ) {
list.append( *it );
break;
}
}
} else {
// create a string list of all entries:
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
list.append( *it );
}
if ( mUseSorting ) {
list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
uint pos = mFieldCombo->currentItem();
if ( pos < mFields.count() )
list.sortByField( mFields[ pos ] );
}
return list;
}
QStringList XXPortSelectDialog::categories() const
{
QStringList list;
QListViewItemIterator it( mCategoriesView );
for ( ; it.current(); ++it ) {
QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
if ( qcli->isOn() )
list.append( it.current()->text( 0 ) );
}
return list;
}
void XXPortSelectDialog::filterChanged( int )
{
mUseFilters->setChecked( true );
}
void XXPortSelectDialog::categoryClicked( QListViewItem *i )
{
QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
if ( qcli->isOn() )
mUseCategories->setChecked( true );
}
void XXPortSelectDialog::slotHelp()
{
#ifndef KAB_EMBEDDED
kapp->invokeHelp( "import-and-export" );
#else //KAB_EMBEDDED
qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
#endif //KAB_EMBEDDED
}
void XXPortSelectDialog::initGUI()
{
QFrame *page = plainPage();
QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
topLayout->addWidget( label );
mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
mButtonGroup->setColumnLayout( 0, Qt::Vertical );
mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
mButtonGroup->layout()->setMargin( KDialog::marginHint() );
QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
groupLayout->setAlignment( Qt::AlignTop );
mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
mUseWholeBook->setChecked( true );
QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
groupLayout->addWidget( mUseWholeBook, 0, 0 );
mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
"This option is disabled if no contacts are selected." ) );
groupLayout->addWidget( mUseSelection, 1, 0 );
mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
"This option is disabled if you haven't defined any filters" ) );
groupLayout->addWidget( mUseFilters, 2, 0 );
mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
"This option is disabled if you have no categories." ) );
groupLayout->addWidget( mUseCategories, 3, 0 );
mFiltersCombo = new QComboBox( false, mButtonGroup );
QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
groupLayout->addWidget( mFiltersCombo, 2, 1 );
mCategoriesView = new QListView( mButtonGroup );
mCategoriesView->addColumn( "" );
mCategoriesView->header()->hide();
QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
groupLayout->addWidget( mCategoriesView, 3, 1 );
- // if (QApplication::desktop()->height() == 480 )
- // mCategoriesView->setMaximumHeight( 240 );
+ if (QApplication::desktop()->height() == 480 )
+ mCategoriesView->setMaximumHeight( 240 );
topLayout->addWidget( mButtonGroup );
QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
sortingGroup->setColumnLayout( 0, Qt::Vertical );
QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
KDialog::spacingHint() );
sortLayout->setAlignment( Qt::AlignTop );
label = new QLabel( i18n( "Criterion:" ), sortingGroup );
sortLayout->addWidget( label, 0, 0 );
#ifndef KAB_EMBEDDED
mFieldCombo = new KComboBox( false, sortingGroup );
#else //KAB_EMBEDDED
//US Combobox is not editable anyway
mFieldCombo = new KComboBox( sortingGroup );
#endif //KAB_EMBEDDED
sortLayout->addWidget( mFieldCombo, 0, 1 );
label = new QLabel( i18n( "Order:" ), sortingGroup );
sortLayout->addWidget( label, 1, 0 );
#ifndef KAB_EMBEDDED
mSortTypeCombo = new KComboBox( false, sortingGroup );
#else //KAB_EMBEDDED
//US Combobox is not editable anyway
mSortTypeCombo = new KComboBox( sortingGroup );
#endif //KAB_EMBEDDED
sortLayout->addWidget( mSortTypeCombo, 1, 1 );
topLayout->addWidget( sortingGroup );
if ( !mUseSorting )
sortingGroup->hide();
#ifndef DESKTOP_VERSION
hideButtons();
#endif
}
#ifndef KAB_EMBEDDED
#include "xxportselectdialog.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h
index 3bb696f..28b1fef 100644
--- a/kaddressbook/xxportselectdialog.h
+++ b/kaddressbook/xxportselectdialog.h
@@ -1,82 +1,83 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef XXPORTSELECTDIALOG_H
#define XXPORTSELECTDIALOG_H
#include <kabc/addresseelist.h>
#include <kabc/field.h>
#include <kdialogbase.h>
#include "filter.h"
class QButtonGroup;
class QComboBox;
class QListView;
class QListViewItem;
class QRadioButton;
class KABCore;
class KComboBox;
class XXPortSelectDialog : public KDialogBase
{
Q_OBJECT
public:
XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent,
const char* name = 0 );
KABC::AddresseeList contacts();
+ void tagSelected();
QStringList uids();
private slots:
void filterChanged( int );
void categoryClicked( QListViewItem * i );
protected slots:
void slotHelp();
private:
void initGUI();
QStringList categories() const;
QButtonGroup* mButtonGroup;
QRadioButton* mUseCategories;
QRadioButton* mUseFilters;
QRadioButton* mUseWholeBook;
QRadioButton* mUseSelection;
QComboBox* mFiltersCombo;
QListView* mCategoriesView;
KComboBox *mFieldCombo;
KComboBox *mSortTypeCombo;
KABCore *mCore;
KABC::AddresseeList mAddresseeList;
Filter::List mFilters;
KABC::Field::List mFields;
bool mUseSorting;
};
#endif