summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp17
-rw-r--r--kaddressbook/phoneeditwidget.cpp8
-rw-r--r--kaddressbook/phoneeditwidget.h112
3 files changed, 16 insertions, 121 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 966efa5..c4083a9 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -139,148 +139,153 @@ void AddresseeEditorWidget::initGUI()
setupTab1_1();
setupTab2();
setupTab2_1();
setupTab3();
setupTab3_1();
mNameEdit->setFocus();
connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
SLOT( pageChanged(QWidget*) ) );
}
void AddresseeEditorWidget::setupTab1()
{
// This is the General tab
QWidget *tab1 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
bool horLayout = false;
int maxCol = 1;
if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
horLayout = true;
maxCol = 3;
}
- QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol );
+ QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
QPushButton *button;
//////////////////////////////////
// Upper left group (person info)
// Person icon
/* LR
label = new QLabel( tab1 );
//US ambiguous call. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
*/
// First name
button = new QPushButton( i18n( "Name..." ), tab1 );
//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
mNameEdit = new KLineEdit( tab1, "mNameEdit" );
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( nameTextChanged( const QString& ) ) );
connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
mNameLabel = new KSqueezedTextLabel( tab1 );
mNameLabel->hide();
layout->addWidget( button, 0, 0 );
layout->addWidget( mNameEdit, 0, 1 );
layout->addWidget( mNameLabel, 0, 1 );
button = new QPushButton( i18n( "Role:" ), tab1 );
connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
//label = new QLabel( i18n( "Role:" ), tab1 );
mRoleEdit = new KLineEdit( tab1 );
connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
//label->setBuddy( mRoleEdit );
+ if ( horLayout ) {
+ layout->addWidget( button, 0, 2 );
+ layout->addWidget( mRoleEdit, 0, 3 );
+
+ } else {
layout->addWidget( button, 1, 0 );
layout->addWidget( mRoleEdit, 1, 1 );
-
+ }
// Organization
button = new QPushButton( i18n( "Organization:" ), tab1 );
connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
//label = new QLabel( i18n( "Organization:" ), tab1 );
mOrgEdit = new KLineEdit( tab1 );
//label->setBuddy( mOrgEdit );
connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
if ( horLayout ) {
layout->addWidget( button, 1, 2 );
layout->addWidget( mOrgEdit, 1, 3 );
} else {
layout->addWidget( button, 2, 0 );
layout->addWidget( mOrgEdit, 2, 1 );
}
// File as (formatted name)
label = new QLabel( i18n( "Format.n.:" ), tab1 );
mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
if ( horLayout ) {
- layout->addWidget( label, 0,2 );
- layout->addWidget( mFormattedNameLabel, 0, 3 );
+ layout->addWidget( label, 1,0 );
+ layout->addWidget( mFormattedNameLabel, 1, 1 );
} else {
layout->addWidget( label, 3, 0 );
layout->addWidget( mFormattedNameLabel, 3, 1 );
}
/* LR
// Left hand separator. This separator doesn't go all the way
// across so the dialog still flows from top to bottom
bar = new KSeparator( KSeparator::HLine, tab1 );
layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
*/
//////////////////////////////////////
/* LR
// Phone numbers (upper right)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addMultiCellWidget( label, 5, 6, 0, 0 );
*/
mPhoneEditWidget = new PhoneEditWidget( tab1 );
connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
int iii;
#ifndef DESKTOP_VERSION
iii = 7;
#else
iii = 8;
#endif
- layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol );
- ++iii;
+ layout->addMultiCellWidget( mPhoneEditWidget, 5-maxCol, 5-maxCol+4, 0, maxCol );
+ iii = 6-maxCol+4;
/* LR
bar = new KSeparator( KSeparator::HLine, tab1 );
//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
*/
/*US
//////////////////////////////////////
// Addresses (lower left)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 5, 6, 0, 0 );
mAddressEditWidget = new AddressEditWidget( tab1 );
connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
layout->addMultiCellWidget( mAddressEditWidget, 5, 9, 1, 2 );
//////////////////////////////////////
// Email / Web (lower right)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, 0) );
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index 7e2aec1..5639aa2 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -46,57 +46,59 @@
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kabc/phonenumber.h>
#include "typecombo.h"
#include "phoneeditwidget.h"
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget(parent,name)
{
QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
QLabel *temp = new QLabel( "", this );
temp->setAlignment( Qt::AlignCenter );
temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
QPushButton *addBut = new QPushButton ( "add", this );
addBut->setPixmap ( SmallIcon("plus"));
addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
connect(addBut,SIGNAL(clicked ()),SLOT(addNumber()));
sv = new QScrollView( this );
- sv->setFrameStyle ( QFrame::Panel | QFrame::Plain );
- sv->setLineWidth ( 1 );
- sv->setMidLineWidth ( 1 );
+ sv->setFrameStyle ( QFrame::Plain );
+ sv->setLineWidth ( 0 );
+ sv->setMidLineWidth ( 0 );
mw = new QWidget ( sv->viewport() );
sv->addChild(mw);
sv->setResizePolicy( QScrollView::AutoOneFit );
mainLayout = new QVBoxLayout ( mw );
mainLayout->setMargin( 0 );
mainLayout->setSpacing( 0 );
+ gridLayout->setMargin( 2 );
+ gridLayout->setSpacing( 4 );
if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) {
gridLayout->addWidget( addBut, 0, 0 );
gridLayout->addWidget( temp, 0, 1 );
gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 );
} else {
gridLayout->addWidget( temp, 1, 0 );
gridLayout->addWidget( addBut, 0, 0 );
gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
}
setDefaults();
mTypeNumberEditList.setAutoDelete( true );
mPopup = new QPopupMenu( this );
QStringList list = PhoneNumber::supportedTypeListNames();
mPopupCount = list.count();
int i = 0;
while ( i < mPopupCount ) {
mPopup->insertItem( list[ i ], i );
++i;
}
connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
}
PhoneEditWidget::~PhoneEditWidget()
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 0477b6c..fbf9fe7 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -64,163 +64,51 @@ class PhoneEditWidget : public QWidget
signals:
void modified();
void typeChange( int oldType, int newType );
private slots:
void bottomVisible();
void addNumberInt( int );
void deleteEdit( PhoneTypeNumberEdit* ew );
void addNumber();
void pendingDelete();
protected:
private:
QScrollView* sv;
QPopupMenu *mPopup;
int mPopupCount;
PhoneTypeNumberEdit* mPendingDelete;
void setDefaults();
PhoneTypeNumberEdit* appendEditCombo();
QWidget* mw;
QVBoxLayout* mainLayout;
QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
- KABC::PhoneNumber::List mPhoneList;
};
-
-
-
-#if 0
-class PhoneEditWidget : public QWidget
-{
- Q___OBJECT
-
- public:
- PhoneEditWidget( QWidget *parent, const char *name = 0 );
- ~PhoneEditWidget();
-
- void setPhoneNumbers( const KABC::PhoneNumber::List &list );
- KABC::PhoneNumber::List phoneNumbers();
-
- void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
- KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
-
- sig_nals:
- void modified();
- void typeChange( int oldType, int newType );
-
- private sl_ots:
- void edit();
-
- void updatePrefEdit();
- void updateSecondEdit();
- void updateThirdEdit();
- void updateFourthEdit();
-
- void slotPrefEditChanged();
- void slotSecondEditChanged();
- void slotThirdEditChanged();
- void slotFourthEditChanged();
-
- protected:
- void updateLineEdits();
- void updateCombos();
-
- private:
- QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
- void updateEdit( PhoneTypeCombo *combo );
- void updatePhoneNumber( PhoneTypeCombo *combo );
- void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
-
- PhoneTypeCombo *mPrefCombo;
- PhoneTypeCombo *mSecondCombo;
- PhoneTypeCombo *mThirdCombo;
- PhoneTypeCombo *mFourthCombo;
-
- KLineEdit *mPrefEdit;
- KLineEdit *mSecondEdit;
- KLineEdit *mThirdEdit;
- KLineEdit *mFourthEdit;
-
- KABC::PhoneNumber::List mPhoneList;
-};
-
-/**
- Dialog for editing lists of phonenumbers.
-*/
-class PhoneEditDialog : public KDialogBase
-{
- Q___OBJECT
-
- public:
- PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
- ~PhoneEditDialog();
-
- const KABC::PhoneNumber::List &phoneNumbers();
- bool changed() const;
-
- protected s__lots:
- void slotAddPhoneNumber();
- void slotRemovePhoneNumber();
- void slotEditPhoneNumber();
- void slotSelectionChanged();
-
- private:
- KABC::PhoneNumber::List mPhoneNumberList;
- KABC::PhoneNumber::TypeList mTypeList;
- KComboBox *mTypeBox;
- KListView *mListView;
-
- QPushButton *mRemoveButton;
- QPushButton *mEditButton;
-
- bool mChanged;
-};
-
-/**
- Dialog for editing phone number types.
-*/
-class PhoneTypeDialog : public KDialogBase
-{
- Q___OBJECT
-public:
- PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
-
- KABC::PhoneNumber phoneNumber();
-
-private:
- KABC::PhoneNumber mPhoneNumber;
- KABC::PhoneNumber::TypeList mTypeList;
-
- QButtonGroup *mGroup;
- QCheckBox *mPreferredBox;
- KLineEdit *mNumber;
-};
-#endif
-
class PhoneTypeNumberEdit : public QWidget
{
Q_OBJECT
public:
PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
{
QHBoxLayout * lay = new QHBoxLayout( this );
lay->setSpacing( 2 );
lay->setMargin( 0 );
mMinusButton = new QPushButton ( this );
mMinusButton->setPixmap ( SmallIcon("minus"));
mCombo = new KComboBox( this );
mNumber = new KLineEdit( this );
mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6);
lay->addWidget( mMinusButton );
lay->addWidget( mCombo );
lay->addWidget( mNumber );
connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
this, SLOT ( textChanged ( const QString & ) ) );
mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
}
~PhoneTypeNumberEdit() {