Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 4 |
1 files changed, 2 insertions, 2 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 @@ | |||
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qhbox.h> | 33 | #include <qhbox.h> |
34 | #include <qcursor.h> | 34 | #include <qcursor.h> |
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | 36 | ||
37 | #include <kbuttonbox.h> | 37 | #include <kbuttonbox.h> |
38 | #include <klistview.h> | 38 | #include <klistview.h> |
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <klineedit.h> | 42 | #include <klineedit.h> |
43 | #include <kcombobox.h> | 43 | #include <kcombobox.h> |
44 | #include <klocale.h> | 44 | #include <klocale.h> |
45 | #include <kdebug.h> | 45 | #include <kdebug.h> |
46 | #include <kglobal.h> | 46 | #include <kglobal.h> |
47 | #include <kiconloader.h> | 47 | #include <kiconloader.h> |
48 | 48 | ||
49 | #include <kabc/phonenumber.h> | 49 | #include <kabc/phonenumber.h> |
50 | 50 | ||
51 | #include "typecombo.h" | 51 | #include "typecombo.h" |
52 | 52 | ||
53 | #include "phoneeditwidget.h" | 53 | #include "phoneeditwidget.h" |
54 | 54 | ||
55 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 55 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
56 | : QWidget(parent,name) | 56 | : QWidget(parent,name) |
57 | { | 57 | { |
58 | QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); | 58 | QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); |
59 | 59 | ||
60 | QLabel *temp = new QLabel( "", this ); | 60 | QLabel *temp = new QLabel( "", this ); |
61 | temp->setAlignment( Qt::AlignCenter ); | 61 | temp->setAlignment( Qt::AlignCenter ); |
62 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 62 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
63 | gridLayout->addWidget( temp, 1, 0 ); | 63 | gridLayout->addWidget( temp, 1, 0 ); |
64 | QPushButton *addBut = new QPushButton ( "add", this ); | 64 | QPushButton *addBut = new QPushButton ( "add", this ); |
65 | addBut->setPixmap ( SmallIcon("plus")); | 65 | addBut->setPixmap ( SmallIcon("plus")); |
66 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | 66 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); |
67 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); | 67 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); |
68 | gridLayout->addWidget( addBut, 0, 0 ); | 68 | gridLayout->addWidget( addBut, 0, 0 ); |
69 | 69 | ||
70 | sv = new QScrollView( this ); | 70 | sv = new QScrollView( this ); |
71 | sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 71 | sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); |
72 | sv->setLineWidth ( 1 ); | 72 | sv->setLineWidth ( 1 ); |
73 | sv->setMidLineWidth ( 1 ); | 73 | sv->setMidLineWidth ( 1 ); |
74 | mw = new QWidget ( sv->viewport() ); | 74 | mw = new QWidget ( sv->viewport() ); |
75 | sv->addChild(mw); | 75 | sv->addChild(mw); |
76 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 76 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
77 | mainLayout = new QVBoxLayout ( mw ); | 77 | mainLayout = new QVBoxLayout ( mw ); |
78 | mainLayout->setMargin( 2 ); | 78 | mainLayout->setMargin( 0 ); |
79 | mainLayout->setSpacing( 2 ); | 79 | mainLayout->setSpacing( 0 ); |
80 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); | 80 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); |
81 | setDefaults(); | 81 | setDefaults(); |
82 | mTypeNumberEditList.setAutoDelete( true ); | 82 | mTypeNumberEditList.setAutoDelete( true ); |
83 | mPopup = new QPopupMenu( this ); | 83 | mPopup = new QPopupMenu( this ); |
84 | QStringList list = PhoneNumber::supportedTypeListNames(); | 84 | QStringList list = PhoneNumber::supportedTypeListNames(); |
85 | mPopupCount = list.count(); | 85 | mPopupCount = list.count(); |
86 | int i = 0; | 86 | int i = 0; |
87 | while ( i < mPopupCount ) { | 87 | while ( i < mPopupCount ) { |
88 | mPopup->insertItem( list[ i ], i ); | 88 | mPopup->insertItem( list[ i ], i ); |
89 | ++i; | 89 | ++i; |
90 | } | 90 | } |
91 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); | 91 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | PhoneEditWidget::~PhoneEditWidget() | 95 | PhoneEditWidget::~PhoneEditWidget() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | void PhoneEditWidget::setDefaults() | 98 | void PhoneEditWidget::setDefaults() |
99 | { | 99 | { |
100 | mTypeNumberEditList.clear(); | 100 | mTypeNumberEditList.clear(); |
101 | PhoneTypeNumberEdit* edit = appendEditCombo(); | 101 | PhoneTypeNumberEdit* edit = appendEditCombo(); |
102 | KABC::PhoneNumber phoneNumber; | 102 | KABC::PhoneNumber phoneNumber; |
103 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); | 103 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); |
104 | edit->setPhoneNumber( phoneNumber ); | 104 | edit->setPhoneNumber( phoneNumber ); |
105 | edit = appendEditCombo(); | 105 | edit = appendEditCombo(); |
106 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); | 106 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); |
107 | edit->setPhoneNumber( phoneNumber ); | 107 | edit->setPhoneNumber( phoneNumber ); |
108 | edit = appendEditCombo(); | 108 | edit = appendEditCombo(); |
109 | phoneNumber.setType( KABC::PhoneNumber::Cell ); | 109 | phoneNumber.setType( KABC::PhoneNumber::Cell ); |
110 | edit->setPhoneNumber( phoneNumber ); | 110 | edit->setPhoneNumber( phoneNumber ); |
111 | 111 | ||
112 | } | 112 | } |
113 | void PhoneEditWidget::addNumberInt( int index ) | 113 | void PhoneEditWidget::addNumberInt( int index ) |
114 | { | 114 | { |
115 | PhoneTypeNumberEdit* edit = appendEditCombo(); | 115 | PhoneTypeNumberEdit* edit = appendEditCombo(); |
116 | KABC::PhoneNumber phoneNumber; | 116 | KABC::PhoneNumber phoneNumber; |
117 | phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | 117 | phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); |
118 | edit->setPhoneNumber( phoneNumber ); | 118 | edit->setPhoneNumber( phoneNumber ); |
119 | //verticalScrollBar()->setValue( 1024); | 119 | //verticalScrollBar()->setValue( 1024); |
120 | QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); | 120 | QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); |
121 | } | 121 | } |
122 | void PhoneEditWidget::bottomVisible() | 122 | void PhoneEditWidget::bottomVisible() |
123 | { | 123 | { |
124 | sv->setContentsPos ( 0, 1024 ); | 124 | sv->setContentsPos ( 0, 1024 ); |
125 | } | 125 | } |
126 | void PhoneEditWidget::addNumber() | 126 | void PhoneEditWidget::addNumber() |
127 | { | 127 | { |