summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index f52cedb..7e2aec1 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -20,77 +20,84 @@
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qstring.h> 29#include <qstring.h>
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#include <qapplication.h>
36 37
37#include <kbuttonbox.h> 38#include <kbuttonbox.h>
38#include <klistview.h> 39#include <klistview.h>
39#include <kapplication.h> 40#include <kapplication.h>
40#include <qapplication.h> 41#include <qapplication.h>
41#include <kconfig.h> 42#include <kconfig.h>
42#include <klineedit.h> 43#include <klineedit.h>
43#include <kcombobox.h> 44#include <kcombobox.h>
44#include <klocale.h> 45#include <klocale.h>
45#include <kdebug.h> 46#include <kdebug.h>
46#include <kglobal.h> 47#include <kglobal.h>
47#include <kiconloader.h> 48#include <kiconloader.h>
48 49
49#include <kabc/phonenumber.h> 50#include <kabc/phonenumber.h>
50 51
51#include "typecombo.h" 52#include "typecombo.h"
52 53
53#include "phoneeditwidget.h" 54#include "phoneeditwidget.h"
54 55
55PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) 56PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
56 : QWidget(parent,name) 57 : QWidget(parent,name)
57{ 58{
58 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); 59 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
59 60
60 QLabel *temp = new QLabel( "", this ); 61 QLabel *temp = new QLabel( "", this );
61 temp->setAlignment( Qt::AlignCenter ); 62 temp->setAlignment( Qt::AlignCenter );
62 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 63 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 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 );
69 68
70 sv = new QScrollView( this ); 69 sv = new QScrollView( this );
71 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); 70 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain );
72 sv->setLineWidth ( 1 ); 71 sv->setLineWidth ( 1 );
73 sv->setMidLineWidth ( 1 ); 72 sv->setMidLineWidth ( 1 );
74 mw = new QWidget ( sv->viewport() ); 73 mw = new QWidget ( sv->viewport() );
75 sv->addChild(mw); 74 sv->addChild(mw);
76 sv->setResizePolicy( QScrollView::AutoOneFit ); 75 sv->setResizePolicy( QScrollView::AutoOneFit );
77 mainLayout = new QVBoxLayout ( mw ); 76 mainLayout = new QVBoxLayout ( mw );
78 mainLayout->setMargin( 0 ); 77 mainLayout->setMargin( 0 );
79 mainLayout->setSpacing( 0 ); 78 mainLayout->setSpacing( 0 );
80 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); 79 if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) {
80 gridLayout->addWidget( addBut, 0, 0 );
81 gridLayout->addWidget( temp, 0, 1 );
82 gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 );
83 } else {
84 gridLayout->addWidget( temp, 1, 0 );
85 gridLayout->addWidget( addBut, 0, 0 );
86 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
87 }
81 setDefaults(); 88 setDefaults();
82 mTypeNumberEditList.setAutoDelete( true ); 89 mTypeNumberEditList.setAutoDelete( true );
83 mPopup = new QPopupMenu( this ); 90 mPopup = new QPopupMenu( this );
84 QStringList list = PhoneNumber::supportedTypeListNames(); 91 QStringList list = PhoneNumber::supportedTypeListNames();
85 mPopupCount = list.count(); 92 mPopupCount = list.count();
86 int i = 0; 93 int i = 0;
87 while ( i < mPopupCount ) { 94 while ( i < mPopupCount ) {
88 mPopup->insertItem( list[ i ], i ); 95 mPopup->insertItem( list[ i ], i );
89 ++i; 96 ++i;
90 } 97 }
91 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); 98 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
92 99
93} 100}
94 101
95PhoneEditWidget::~PhoneEditWidget() 102PhoneEditWidget::~PhoneEditWidget()
96{ 103{