summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-10-28 16:38:18 (UTC)
committer zautrix <zautrix>2005-10-28 16:38:18 (UTC)
commitd6eb485cf2ff7a14918f51a5b21b5306f9908fdb (patch) (side-by-side diff)
tree6382df41981bad0d38a384868cfacc04c7b4a149 /kaddressbook
parent869e4921d8b052c376b2769de44674a8c2d68221 (diff)
downloadkdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.zip
kdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.tar.gz
kdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.tar.bz2
fixx
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp4
-rw-r--r--kaddressbook/phoneeditwidget.h5
2 files changed, 5 insertions, 4 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index d895ea1..f52cedb 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -30,98 +30,98 @@
#include <qlistbox.h>
#include <qlistview.h>
#include <qbuttongroup.h>
#include <qhbox.h>
#include <qcursor.h>
#include <qtimer.h>
#include <kbuttonbox.h>
#include <klistview.h>
#include <kapplication.h>
#include <qapplication.h>
#include <kconfig.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <klocale.h>
#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 ) );
gridLayout->addWidget( temp, 1, 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()));
gridLayout->addWidget( addBut, 0, 0 );
sv = new QScrollView( this );
sv->setFrameStyle ( QFrame::Panel | QFrame::Plain );
sv->setLineWidth ( 1 );
sv->setMidLineWidth ( 1 );
mw = new QWidget ( sv->viewport() );
sv->addChild(mw);
sv->setResizePolicy( QScrollView::AutoOneFit );
mainLayout = new QVBoxLayout ( mw );
- mainLayout->setMargin( 2 );
- mainLayout->setSpacing( 2 );
+ mainLayout->setMargin( 0 );
+ mainLayout->setSpacing( 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()
{
}
void PhoneEditWidget::setDefaults()
{
mTypeNumberEditList.clear();
PhoneTypeNumberEdit* edit = appendEditCombo();
KABC::PhoneNumber phoneNumber;
phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );
edit->setPhoneNumber( phoneNumber );
edit = appendEditCombo();
phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
edit->setPhoneNumber( phoneNumber );
edit = appendEditCombo();
phoneNumber.setType( KABC::PhoneNumber::Cell );
edit->setPhoneNumber( phoneNumber );
}
void PhoneEditWidget::addNumberInt( int index )
{
PhoneTypeNumberEdit* edit = appendEditCombo();
KABC::PhoneNumber phoneNumber;
phoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
edit->setPhoneNumber( phoneNumber );
//verticalScrollBar()->setValue( 1024);
QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) );
}
void PhoneEditWidget::bottomVisible()
{
sv->setContentsPos ( 0, 1024 );
}
void PhoneEditWidget::addNumber()
{
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index df5aff9..0477b6c 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -162,102 +162,103 @@ class PhoneEditDialog : public KDialogBase
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( KDialogBase::spacingHintSmall() );
- lay->setMargin( KDialogBase::marginHintSmall() );
+ 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() {
// qDebug("~PhoneTypeNumberEdit() ");
}
void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
{
mPhoneNumber = phoneNumber;
int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
mCombo->setCurrentItem( index );
mNumber->setText( mPhoneNumber.number() );
show();
mNumber->setFocus();
}
KABC::PhoneNumber phoneNumber()
{
mPhoneNumber.setNumber( mNumber->text() );
int index = mCombo->currentItem();
mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
return mPhoneNumber;
}
bool isValid()
{
if ( mNumber->text().isEmpty() )return false;
return true;
}
int currentType()
{
return mCombo->currentItem();
}
private slots:
void typeExternalChanged( int oldType, int newType )
{
if ( mPhoneNumber.type() == newType ) {
mPhoneNumber.setType(oldType);
int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
mCombo->setCurrentItem( index );
}
}
void deleteNumber()
{