summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.cpp
authorzautrix <zautrix>2005-10-28 23:31:46 (UTC)
committer zautrix <zautrix>2005-10-28 23:31:46 (UTC)
commit7a90e619147e06e5f4d4facef98364f78a4a04ef (patch) (unidiff)
treef1b11d0ca9c123d42f9b632bae1cc6608ee5e740 /kaddressbook/phoneeditwidget.cpp
parent85d2ea5c17a2b2c7a4ae4dd954bc635a56239b57 (diff)
downloadkdepimpi-7a90e619147e06e5f4d4facef98364f78a4a04ef.zip
kdepimpi-7a90e619147e06e5f4d4facef98364f78a4a04ef.tar.gz
kdepimpi-7a90e619147e06e5f4d4facef98364f78a4a04ef.tar.bz2
fixx
Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index 7e2aec1..5639aa2 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -38,73 +38,75 @@
38#include <kbuttonbox.h> 38#include <kbuttonbox.h>
39#include <klistview.h> 39#include <klistview.h>
40#include <kapplication.h> 40#include <kapplication.h>
41#include <qapplication.h> 41#include <qapplication.h>
42#include <kconfig.h> 42#include <kconfig.h>
43#include <klineedit.h> 43#include <klineedit.h>
44#include <kcombobox.h> 44#include <kcombobox.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include <kiconloader.h> 48#include <kiconloader.h>
49 49
50#include <kabc/phonenumber.h> 50#include <kabc/phonenumber.h>
51 51
52#include "typecombo.h" 52#include "typecombo.h"
53 53
54#include "phoneeditwidget.h" 54#include "phoneeditwidget.h"
55 55
56PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) 56PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
57 : QWidget(parent,name) 57 : QWidget(parent,name)
58{ 58{
59 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); 59 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
60 60
61 QLabel *temp = new QLabel( "", this ); 61 QLabel *temp = new QLabel( "", this );
62 temp->setAlignment( Qt::AlignCenter ); 62 temp->setAlignment( Qt::AlignCenter );
63 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 63 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 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 68
69 sv = new QScrollView( this ); 69 sv = new QScrollView( this );
70 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); 70 sv->setFrameStyle ( QFrame::Plain );
71 sv->setLineWidth ( 1 ); 71 sv->setLineWidth ( 0 );
72 sv->setMidLineWidth ( 1 ); 72 sv->setMidLineWidth ( 0 );
73 mw = new QWidget ( sv->viewport() ); 73 mw = new QWidget ( sv->viewport() );
74 sv->addChild(mw); 74 sv->addChild(mw);
75 sv->setResizePolicy( QScrollView::AutoOneFit ); 75 sv->setResizePolicy( QScrollView::AutoOneFit );
76 mainLayout = new QVBoxLayout ( mw ); 76 mainLayout = new QVBoxLayout ( mw );
77 mainLayout->setMargin( 0 ); 77 mainLayout->setMargin( 0 );
78 mainLayout->setSpacing( 0 ); 78 mainLayout->setSpacing( 0 );
79 gridLayout->setMargin( 2 );
80 gridLayout->setSpacing( 4 );
79 if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) { 81 if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) {
80 gridLayout->addWidget( addBut, 0, 0 ); 82 gridLayout->addWidget( addBut, 0, 0 );
81 gridLayout->addWidget( temp, 0, 1 ); 83 gridLayout->addWidget( temp, 0, 1 );
82 gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 ); 84 gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 );
83 } else { 85 } else {
84 gridLayout->addWidget( temp, 1, 0 ); 86 gridLayout->addWidget( temp, 1, 0 );
85 gridLayout->addWidget( addBut, 0, 0 ); 87 gridLayout->addWidget( addBut, 0, 0 );
86 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); 88 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
87 } 89 }
88 setDefaults(); 90 setDefaults();
89 mTypeNumberEditList.setAutoDelete( true ); 91 mTypeNumberEditList.setAutoDelete( true );
90 mPopup = new QPopupMenu( this ); 92 mPopup = new QPopupMenu( this );
91 QStringList list = PhoneNumber::supportedTypeListNames(); 93 QStringList list = PhoneNumber::supportedTypeListNames();
92 mPopupCount = list.count(); 94 mPopupCount = list.count();
93 int i = 0; 95 int i = 0;
94 while ( i < mPopupCount ) { 96 while ( i < mPopupCount ) {
95 mPopup->insertItem( list[ i ], i ); 97 mPopup->insertItem( list[ i ], i );
96 ++i; 98 ++i;
97 } 99 }
98 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); 100 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
99 101
100} 102}
101 103
102PhoneEditWidget::~PhoneEditWidget() 104PhoneEditWidget::~PhoneEditWidget()
103{ 105{
104} 106}
105void PhoneEditWidget::setDefaults() 107void PhoneEditWidget::setDefaults()
106{ 108{
107 mTypeNumberEditList.clear(); 109 mTypeNumberEditList.clear();
108 PhoneTypeNumberEdit* edit = appendEditCombo(); 110 PhoneTypeNumberEdit* edit = appendEditCombo();
109 KABC::PhoneNumber phoneNumber; 111 KABC::PhoneNumber phoneNumber;
110 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); 112 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );